Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions storybook/.expo-shared/assets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
"40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
}
18 changes: 18 additions & 0 deletions storybook/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
node_modules/
.expo/
dist/
npm-debug.*
*.jks
*.p8
*.p12
*.key
*.mobileprovision
*.orig.*
web-build/
lib

# macOS
.DS_Store

#build
storybook-static/
19 changes: 19 additions & 0 deletions storybook/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Dotfiles
.babelrc
.eslintignore
.eslintrc.json
.gitattributes
_config.yml
.editorconfig

# Documents
CONTRIBUTING.md
ISSUE_TEMPLATE.txt
img

# Test cases
__tests__
dist/__tests__

# Example
storybook-static/
1 change: 1 addition & 0 deletions storybook/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.13.0
6 changes: 6 additions & 0 deletions storybook/.ondevice/Storybook.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { getStorybookUI } from '@storybook/react-native';
import './doctools';
import './storybook.requires';

const StorybookUIRoot = getStorybookUI({});
export default StorybookUIRoot;
10 changes: 10 additions & 0 deletions storybook/.ondevice/doctools.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { extractArgTypes } from '@storybook/react/dist/modern/client/docs/extractArgTypes';
import { addArgTypesEnhancer, addParameters } from '@storybook/react-native';
import { enhanceArgTypes } from '@storybook/docs-tools';

addArgTypesEnhancer(enhanceArgTypes);
addParameters({
docs: {
extractArgTypes,
},
});
9 changes: 9 additions & 0 deletions storybook/.ondevice/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
stories: ['../components/**/*.stories.?(ts|tsx|js|jsx)'],
addons: [
'@storybook/addon-ondevice-notes',
'@storybook/addon-ondevice-controls',
'@storybook/addon-ondevice-backgrounds',
'@storybook/addon-ondevice-actions',
],
};
20 changes: 20 additions & 0 deletions storybook/.ondevice/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds';

export const decorators = [withBackgrounds];

export const parameters = {
backgrounds: {
default: 'plain',
values: [
{ name: 'plain', value: 'white' },
{ name: 'warm', value: 'hotpink' },
{ name: 'cool', value: 'deepskyblue' },
],
},
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};
85 changes: 85 additions & 0 deletions storybook/.ondevice/storybook.requires.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* do not change this file, it is auto generated by storybook. */

import {
configure,
addDecorator,
addParameters,
addArgsEnhancer,
clearDecorators,
} from '@storybook/react-native';

import '@storybook/addon-ondevice-notes/register';
import '@storybook/addon-ondevice-controls/register';
import '@storybook/addon-ondevice-backgrounds/register';
import '@storybook/addon-ondevice-actions/register';

import { argsEnhancers } from '@storybook/addon-actions/dist/modern/preset/addArgs';

import { decorators, parameters } from './preview';

if (decorators) {
if (__DEV__) {
// stops the warning from showing on every HMR
require('react-native').LogBox.ignoreLogs([
'`clearDecorators` is deprecated and will be removed in Storybook 7.0',
]);
}
// workaround for global decorators getting infinitely applied on HMR, see https://github.com/storybookjs/react-native/issues/185
clearDecorators();
decorators.forEach((decorator) => addDecorator(decorator));
}

if (parameters) {
addParameters(parameters);
}

try {
argsEnhancers.forEach((enhancer) => addArgsEnhancer(enhancer));
} catch {}

const getStories = () => {
return [
require('../components/Button/Button.stories.tsx'),
require('../components/Text/Text.stories.tsx'),
require('../components/Radio/Radio.stories.tsx'),
require('../components/Alert/Alert.stories.tsx'),
require('../components/Avatar/Avatar.stories.tsx'),
require('../components/Badge/Badge.stories.tsx'),
require('../components/Divider/Divider.stories.tsx'),
require('../components/Box/Box.stories.tsx'),
require('../components/Center/Center.stories.tsx'),
require('../components/Checkbox/Checkbox.stories.tsx'),
require('../components/FormControl/FormControl.stories.tsx'),
require('../components/Heading/Heading.stories.tsx'),
require('../components/HStack/HStack.stories.tsx'),
require('../components/Actionsheet/Actionsheet.stories.tsx'),
require('../components/Toast/Toast.stories.tsx'),
require('../components/UtilityProps/UtilityProps.stories.tsx'),
// require('../components/Icon/Icon.stories.tsx'),

// require('../components/Icon/Icon.stories.tsx'),
// require('../components/Pressable/Pressable.stories.tsx'),
// require('../components/FormControl/FormControl.stories.tsx'),
// require('../components/Icons/Icons.stories.tsx'),
// require('../components/Avatar/Avatar.stories.tsx'),
// require('../components/Button/Button.stories.tsx'),
// require('../components/Center/Center.stories.tsx'),
// require('../components/Switch/Switch.stories.tsx'),
// require('../components/Checkbox/Checkbox.stories.tsx'),
// require('../components/Heading/Heading.stories.tsx'),
// require('../components/HStack/HStack.stories.tsx'),
// require('../components/Image/Image.stories.tsx'),
// require('../components/Input/Input.stories.tsx'),
// require('../components/Image/Image.stories.tsx'),
// require('../components/Modal/Modal.stories.tsx'),
// require('../components/Slider/Slider.stories.tsx'),
// require('../components/Badge/Badge.stories.tsx'),
// require('../components/Divider/Divider.stories.tsx'),
// require('../components/AlertDialog/AlertDialog.stories.tsx'),
// require('../components/Fab/Fab.stories.tsx'),
// require('../components/IconButton/IconButton.stories.tsx'),
// require('../components/Progress/Progress.stories.tsx'),
];
};

configure(getStories, module, false);
39 changes: 39 additions & 0 deletions storybook/.storybook/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
const path = require('path');

console.log(path.resolve('../../', 'node_modules/@dank-style/react'));
module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'storybook-dark-mode',
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-react-native-web',
'@storybook/addon-docs',
],
framework: '@storybook/react',
typescript: {
reactDocgen: 'none',
},

staticDirs: ['../public'],
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.

// Make whatever fine-grained changes you need
// config.module.rules.push({
// test: /\.scss$/,
// use: ['style-loader', 'css-loader', 'sass-loader'],
// include: path.resolve(__dirname, '../'),
// });

config.module.rules.push({
test: /\.(js|ts|tsx)$/,
use: 'babel-loader',
});

// Return the altered config
return config;
},
};
Empty file.
12 changes: 12 additions & 0 deletions storybook/.storybook/preview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
docs: {
// inlineStories: false,
},
};
40 changes: 40 additions & 0 deletions storybook/.storybook/theme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// .storybook/YourTheme.js

import { create } from '@storybook/theming';

export default create({
base: 'light',

colorPrimary: 'hotpink',
colorSecondary: 'deepskyblue',

// UI
appBg: 'white',
appContentBg: 'silver',
appBorderColor: 'grey',
appBorderRadius: 4,

// Typography
fontBase: '"Open Sans", sans-serif',
fontCode: 'monospace',

// Text colors
textColor: 'black',
textInverseColor: 'rgba(255,255,255,0.9)',

// Toolbar default and active colors
barTextColor: 'silver',
barSelectedColor: 'black',
barBg: 'hotpink',

// Form colors
inputBg: 'white',
inputBorder: 'silver',
inputTextColor: 'black',
inputBorderRadius: 4,

brandTitle: 'My custom storybook',
brandUrl: 'https://example.com',
brandImage: 'https://place-hold.it/350x150',
brandTarget: '_self',
});
2 changes: 2 additions & 0 deletions storybook/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import StorybookUIRoot from './.ondevice/Storybook';
export { StorybookUIRoot as default };
7 changes: 7 additions & 0 deletions storybook/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @gluestack/ui

## 0.1.0

### Patch Changes

- Added accessible styled awesome ui components
35 changes: 35 additions & 0 deletions storybook/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
![image](https://user-images.githubusercontent.com/3481514/145904252-92e3dc1e-591f-410f-88a1-b4250f4ba6f2.png)

# getting started

```
expo init --template expo-template-storybook AwesomeStorybook
```

# Ondevice

```
yarn start
```

If you add new stories on the native (ondevice version) you either need to have the watcher running or run the stories loader

To update the stories one time

```
yarn update-stories
```

To watch the stories files

```
yarn storybook-watcher
```

Note that this is only necessary for when you add or remove a story file.

# Web

```
yarn storybook
```
31 changes: 31 additions & 0 deletions storybook/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"expo": {
"name": "injector-example-native",
"slug": "injector-example-native",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
}
Binary file added storybook/assets/adaptive-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added storybook/assets/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added storybook/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added storybook/assets/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions storybook/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const path = require("path");

module.exports = function (api) {
api.cache(true);
return {
presets: ["babel-preset-expo"],
plugins: [
process.env.NODE_ENV !== "production"
? [
"module-resolver",
{
alias: {
// For development, we want to alias the library to the source
// ["@gluestack/ui-creator"]: path.join(
// __dirname,
// "../creator/src"
// ),
},
},
]
: ["babel-plugin-react-docgen-typescript", { exclude: "node_modules" }],
],
};
};
8 changes: 8 additions & 0 deletions storybook/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { registerRootComponent } from 'expo';

import App from './App';

// registerRootComponent calls AppRegistry.registerComponent('main', () => App);
// It also ensures that whether you load the app in Expo Go or in a native build,
// the environment is set up appropriately
registerRootComponent(App);
Loading