polpo 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +9 -0
- package/.storybook/decorators.tsx +61 -0
- package/.storybook/main.ts +47 -0
- package/.storybook/manager-head.html +2 -0
- package/.storybook/manager.ts +7 -0
- package/.storybook/preview-head.html +2 -0
- package/.storybook/preview.ts +38 -0
- package/.storybook/theme.ts +47 -0
- package/.turbo/daemon/f5c5c8fb195b01d0-turbo.log.2024-05-26 +0 -0
- package/.turbo/turbo-build$colon$watch.log +96 -0
- package/.turbo/turbo-build-storybook.log +0 -0
- package/.turbo/turbo-build.log +77 -0
- package/.turbo/turbo-lint$colon$fix.log +2 -0
- package/.turbo/turbo-lint.log +4 -0
- package/README.md +68 -0
- package/dist/chunk-M4KRSYE7.js +3 -0
- package/dist/chunk-M4KRSYE7.js.map +1 -0
- package/dist/chunk-U5XSMSKZ.js +3 -0
- package/dist/chunk-U5XSMSKZ.js.map +1 -0
- package/dist/get-modal-position-DPftPoU2.d.cts +28 -0
- package/dist/get-modal-position-DPftPoU2.d.ts +28 -0
- package/dist/helpers.cjs +3 -0
- package/dist/helpers.cjs.map +1 -0
- package/dist/helpers.d.cts +15 -0
- package/dist/helpers.d.ts +15 -0
- package/dist/helpers.js +3 -0
- package/dist/helpers.js.map +1 -0
- package/dist/hooks.cjs +3 -0
- package/dist/hooks.cjs.map +1 -0
- package/dist/hooks.d.cts +121 -0
- package/dist/hooks.d.ts +121 -0
- package/dist/hooks.js +3 -0
- package/dist/hooks.js.map +1 -0
- package/dist/ui.cjs +1987 -0
- package/dist/ui.cjs.map +1 -0
- package/dist/ui.d.cts +3932 -0
- package/dist/ui.d.ts +3932 -0
- package/dist/ui.js +1987 -0
- package/dist/ui.js.map +1 -0
- package/package.json +98 -0
- package/src/components/accordion/accordion-item.stories.tsx +128 -0
- package/src/components/accordion/accordion-item.tsx +119 -0
- package/src/components/accordion/accordion.stories.tsx +74 -0
- package/src/components/accordion/accordion.style.ts +42 -0
- package/src/components/accordion/accordion.tsx +56 -0
- package/src/components/accordion/index.ts +2 -0
- package/src/components/buttons/button/button.stories.tsx +103 -0
- package/src/components/buttons/button/button.style.ts +147 -0
- package/src/components/buttons/button/button.tsx +119 -0
- package/src/components/buttons/button/index.ts +1 -0
- package/src/components/buttons/index.ts +1 -0
- package/src/components/cards/flip-card/flip-card.stories.tsx +61 -0
- package/src/components/cards/flip-card/flip-card.style.ts +45 -0
- package/src/components/cards/flip-card/flip-card.tsx +55 -0
- package/src/components/cards/flip-card/index.ts +1 -0
- package/src/components/cards/hover-card/hover-card.stories.tsx +45 -0
- package/src/components/cards/hover-card/hover-card.style.ts +13 -0
- package/src/components/cards/hover-card/hover-card.tsx +71 -0
- package/src/components/cards/hover-card/index.ts +1 -0
- package/src/components/cards/index.ts +3 -0
- package/src/components/cards/slide-card/index.ts +1 -0
- package/src/components/cards/slide-card/slide-card.stories.tsx +47 -0
- package/src/components/cards/slide-card/slide-card.tsx +42 -0
- package/src/components/form/checkbox/checkbox.stories.tsx +34 -0
- package/src/components/form/checkbox/checkbox.style.ts +75 -0
- package/src/components/form/checkbox/checkbox.tsx +76 -0
- package/src/components/form/checkbox/index.ts +1 -0
- package/src/components/form/controller/controller.tsx +42 -0
- package/src/components/form/controller/index.ts +1 -0
- package/src/components/form/date-picker/date-picker.stories.tsx +38 -0
- package/src/components/form/date-picker/date-picker.tsx +67 -0
- package/src/components/form/date-picker/index.ts +1 -0
- package/src/components/form/field/field.stories.tsx +49 -0
- package/src/components/form/field/field.style.ts +79 -0
- package/src/components/form/field/field.tsx +83 -0
- package/src/components/form/field/field.types.ts +28 -0
- package/src/components/form/field/index.ts +2 -0
- package/src/components/form/form.stories.types.tsx +50 -0
- package/src/components/form/form.types.ts +37 -0
- package/src/components/form/index.ts +14 -0
- package/src/components/form/input/index.ts +1 -0
- package/src/components/form/input/input.stories.tsx +41 -0
- package/src/components/form/input/input.tsx +73 -0
- package/src/components/form/input-color/index.ts +1 -0
- package/src/components/form/input-color/input-color.stories.tsx +46 -0
- package/src/components/form/input-color/input-color.style.ts +93 -0
- package/src/components/form/input-color/input-color.tsx +159 -0
- package/src/components/form/input-file/index.ts +1 -0
- package/src/components/form/input-file/input-file.stories.tsx +40 -0
- package/src/components/form/input-file/input-file.style.ts +143 -0
- package/src/components/form/input-file/input-file.tsx +214 -0
- package/src/components/form/input-password/index.ts +1 -0
- package/src/components/form/input-password/input-password.stories.tsx +37 -0
- package/src/components/form/input-password/input-password.tsx +83 -0
- package/src/components/form/radio/index.ts +1 -0
- package/src/components/form/radio/radio.stories.tsx +43 -0
- package/src/components/form/radio/radio.style.ts +58 -0
- package/src/components/form/radio/radio.tsx +76 -0
- package/src/components/form/select/index.ts +1 -0
- package/src/components/form/select/options.tsx +140 -0
- package/src/components/form/select/select-option.tsx +84 -0
- package/src/components/form/select/select.stories.tsx +89 -0
- package/src/components/form/select/select.style.ts +164 -0
- package/src/components/form/select/select.tsx +327 -0
- package/src/components/form/select/select.types.ts +93 -0
- package/src/components/form/slider/index.ts +1 -0
- package/src/components/form/slider/slider.stories.tsx +40 -0
- package/src/components/form/slider/slider.style.ts +90 -0
- package/src/components/form/slider/slider.tsx +108 -0
- package/src/components/form/switch/index.ts +1 -0
- package/src/components/form/switch/switch.stories.tsx +38 -0
- package/src/components/form/switch/switch.style.ts +120 -0
- package/src/components/form/switch/switch.tsx +111 -0
- package/src/components/form/textarea/index.ts +1 -0
- package/src/components/form/textarea/textarea.stories.tsx +43 -0
- package/src/components/form/textarea/textarea.style.ts +7 -0
- package/src/components/form/textarea/textarea.tsx +76 -0
- package/src/components/icon/icon.stories.tsx +63 -0
- package/src/components/icon/icon.tsx +64 -0
- package/src/components/icon/icons/index.ts +18 -0
- package/src/components/icon/icons/object.tsx +482 -0
- package/src/components/icon/icons/social.tsx +72 -0
- package/src/components/icon/icons/symbol.tsx +776 -0
- package/src/components/icon/index.ts +5 -0
- package/src/components/image/image.stories.tsx +25 -0
- package/src/components/image/image.tsx +7 -0
- package/src/components/image/index.ts +1 -0
- package/src/components/index.ts +16 -0
- package/src/components/infinity-scroll/index.ts +1 -0
- package/src/components/infinity-scroll/infinity-scroll.stories.tsx +75 -0
- package/src/components/infinity-scroll/infinity-scroll.style.ts +30 -0
- package/src/components/infinity-scroll/infinity-scroll.tsx +56 -0
- package/src/components/line/index.ts +1 -0
- package/src/components/line/line.stories.tsx +67 -0
- package/src/components/line/line.style.ts +57 -0
- package/src/components/line/line.tsx +76 -0
- package/src/components/loaders/index.ts +1 -0
- package/src/components/loaders/simple-loader/index.ts +1 -0
- package/src/components/loaders/simple-loader/simple-loader.stories.tsx +21 -0
- package/src/components/loaders/simple-loader/simple-loader.style.ts +13 -0
- package/src/components/loaders/simple-loader/simple-loader.tsx +15 -0
- package/src/components/modals/action-modal/action-modal.stories.tsx +134 -0
- package/src/components/modals/action-modal/action-modal.style.ts +129 -0
- package/src/components/modals/action-modal/action-modal.tsx +150 -0
- package/src/components/modals/action-modal/index.ts +1 -0
- package/src/components/modals/aside-modal/aside-modal.stories.tsx +82 -0
- package/src/components/modals/aside-modal/aside-modal.style.ts +108 -0
- package/src/components/modals/aside-modal/aside-modal.tsx +66 -0
- package/src/components/modals/aside-modal/index.ts +1 -0
- package/src/components/modals/confirmation-modal/confirmation-modal.stories.tsx +50 -0
- package/src/components/modals/confirmation-modal/confirmation-modal.style.ts +17 -0
- package/src/components/modals/confirmation-modal/confirmation-modal.tsx +43 -0
- package/src/components/modals/confirmation-modal/index.ts +1 -0
- package/src/components/modals/index.ts +4 -0
- package/src/components/modals/modal/index.ts +1 -0
- package/src/components/modals/modal/modal.style.ts +10 -0
- package/src/components/modals/modal/modal.tsx +132 -0
- package/src/components/ripple/index.ts +1 -0
- package/src/components/ripple/ripple.stories.tsx +38 -0
- package/src/components/ripple/ripple.style.ts +33 -0
- package/src/components/ripple/ripple.tsx +63 -0
- package/src/components/smart-table/index.ts +1 -0
- package/src/components/smart-table/smart-table.column.tsx +63 -0
- package/src/components/smart-table/smart-table.helpers.tsx +59 -0
- package/src/components/smart-table/smart-table.hooks.ts +27 -0
- package/src/components/smart-table/smart-table.row.tsx +29 -0
- package/src/components/smart-table/smart-table.stories.tsx +301 -0
- package/src/components/smart-table/smart-table.style.ts +102 -0
- package/src/components/smart-table/smart-table.tsx +112 -0
- package/src/components/smart-table/smart-table.types.ts +41 -0
- package/src/components/tabs/index.ts +1 -0
- package/src/components/tabs/tabs-container.stories.tsx +159 -0
- package/src/components/tabs/tabs-list.tsx +131 -0
- package/src/components/tabs/tabs.stories.tsx +68 -0
- package/src/components/tabs/tabs.style.ts +132 -0
- package/src/components/tabs/tabs.tsx +117 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/tag/tag.stories.tsx +49 -0
- package/src/components/tag/tag.style.ts +24 -0
- package/src/components/tag/tag.tsx +44 -0
- package/src/components/tooltips/click-to-copy/click-to-copy.stories.tsx +39 -0
- package/src/components/tooltips/click-to-copy/click-to-copy.tsx +41 -0
- package/src/components/tooltips/click-to-copy/index.ts +1 -0
- package/src/components/tooltips/index.ts +2 -0
- package/src/components/tooltips/tooltip/index.ts +1 -0
- package/src/components/tooltips/tooltip/tooltip.stories.tsx +35 -0
- package/src/components/tooltips/tooltip/tooltip.style.ts +62 -0
- package/src/components/tooltips/tooltip/tooltip.tsx +45 -0
- package/src/components/typography/index.ts +2 -0
- package/src/components/typography/typography.constants.ts +43 -0
- package/src/components/typography/typography.stories.tsx +106 -0
- package/src/components/typography/typography.style.ts +76 -0
- package/src/components/typography/typography.tsx +79 -0
- package/src/contexts/fetch-context/fetch-context.tsx +114 -0
- package/src/contexts/fetch-context/index.ts +1 -0
- package/src/contexts/form-context/form-context.tsx +43 -0
- package/src/contexts/form-context/index.ts +1 -0
- package/src/contexts/index.ts +3 -0
- package/src/contexts/theme-context/index.ts +3 -0
- package/src/contexts/theme-context/theme-context.tsx +158 -0
- package/src/contexts/theme-context/theme.animations.ts +180 -0
- package/src/contexts/theme-context/theme.defaults.ts +205 -0
- package/src/contexts/theme-context/theme.style.ts +78 -0
- package/src/contexts/theme-context/themes.ts +96 -0
- package/src/core/http-client.d.ts +11 -0
- package/src/core/http-client.d.ts.map +1 -0
- package/src/core/http-client.ts +47 -0
- package/src/core/index.d.ts +2 -0
- package/src/core/index.d.ts.map +1 -0
- package/src/core/index.ts +1 -0
- package/src/core/variants/color.ts +36 -0
- package/src/core/variants/index.ts +3 -0
- package/src/core/variants/radius.ts +56 -0
- package/src/core/variants/size.ts +44 -0
- package/src/helpers/format-bytes.ts +11 -0
- package/src/helpers/format-dates.ts +11 -0
- package/src/helpers/get-modal-position.ts +66 -0
- package/src/helpers/index.ts +4 -0
- package/src/helpers/text/index.ts +1 -0
- package/src/helpers/text/to-capitalize.ts +17 -0
- package/src/hooks/index.ts +23 -0
- package/src/hooks/use-async.ts +88 -0
- package/src/hooks/use-classnames.ts +13 -0
- package/src/hooks/use-constant.ts +3 -0
- package/src/hooks/use-debounce.ts +15 -0
- package/src/hooks/use-dimensions.ts +22 -0
- package/src/hooks/use-event-listener.ts +71 -0
- package/src/hooks/use-file-reader.ts +69 -0
- package/src/hooks/use-hover.ts +17 -0
- package/src/hooks/use-in-view.ts +20 -0
- package/src/hooks/use-input-handlers.ts +49 -0
- package/src/hooks/use-media-query.ts +25 -0
- package/src/hooks/use-modal-in-container.ts +94 -0
- package/src/hooks/use-mouse-position.ts +16 -0
- package/src/hooks/use-observer.ts +18 -0
- package/src/hooks/use-on-click-outside-ref.ts +17 -0
- package/src/hooks/use-online-status.ts +12 -0
- package/src/hooks/use-render-count.ts +11 -0
- package/src/hooks/use-safe-dispatch.ts +22 -0
- package/src/hooks/use-scroll.ts +31 -0
- package/src/hooks/use-state-history.ts +22 -0
- package/src/hooks/use-toggle-values.ts +14 -0
- package/src/hooks/use-toggle.ts +11 -0
- package/src/hooks/use-viewport.ts +38 -0
- package/src/index.ts +5 -0
- package/src/layouts/flex/flex.tsx +75 -0
- package/src/layouts/flex/index.ts +1 -0
- package/src/layouts/grid/grid.tsx +86 -0
- package/src/layouts/grid/index.ts +1 -0
- package/src/layouts/index.ts +3 -0
- package/src/layouts/section-layout/index.ts +1 -0
- package/src/layouts/section-layout/section-layout.stories.tsx +55 -0
- package/src/layouts/section-layout/section-layout.style.ts +21 -0
- package/src/layouts/section-layout/section-layout.tsx +46 -0
- package/src/stories/GettingStarted.mdx +66 -0
- package/src/types/generics.ts +68 -0
- package/src/types/index.ts +1 -0
- package/svg/Name=airplane, Category=object.svg +3 -0
- package/svg/Name=arrow-circle, Category=symbol.svg +3 -0
- package/svg/Name=arrow-down, Category=symbol.svg +3 -0
- package/svg/Name=arrow-left, Category=symbol.svg +3 -0
- package/svg/Name=arrow-right, Category=symbol.svg +3 -0
- package/svg/Name=arrow-up, Category=symbol.svg +3 -0
- package/svg/Name=bell, Category=object.svg +3 -0
- package/svg/Name=bicycle, Category=object.svg +3 -0
- package/svg/Name=book-open, Category=object.svg +3 -0
- package/svg/Name=book-solid, Category=object.svg +6 -0
- package/svg/Name=box-shadow, Category=symbol.svg +5 -0
- package/svg/Name=calendar, Category=object.svg +3 -0
- package/svg/Name=camera, Category=object.svg +3 -0
- package/svg/Name=caret-down, Category=symbol.svg +3 -0
- package/svg/Name=caret-left, Category=symbol.svg +3 -0
- package/svg/Name=caret-right, Category=symbol.svg +3 -0
- package/svg/Name=caret-up, Category=symbol.svg +3 -0
- package/svg/Name=checkmark, Category=symbol.svg +3 -0
- package/svg/Name=clean-computer, Category=object.svg +10 -0
- package/svg/Name=codepen, Category=social.svg +3 -0
- package/svg/Name=creative, Category=symbol.svg +5 -0
- package/svg/Name=cross, Category=symbol.svg +4 -0
- package/svg/Name=crossed-flags, Category=object.svg +4 -0
- package/svg/Name=cv, Category=symbol.svg +5 -0
- package/svg/Name=design-ui, Category=symbol.svg +9 -0
- package/svg/Name=document, Category=object.svg +3 -0
- package/svg/Name=door-closed, Category=object.svg +3 -0
- package/svg/Name=door-open, Category=object.svg +3 -0
- package/svg/Name=double-caret-down, Category=symbol.svg +4 -0
- package/svg/Name=double-caret-left, Category=symbol.svg +4 -0
- package/svg/Name=double-caret-righ, Category=symbol.svg +4 -0
- package/svg/Name=double-caret-up, Category=symbol.svg +4 -0
- package/svg/Name=download, Category=symbol.svg +5 -0
- package/svg/Name=dropper, Category=object.svg +5 -0
- package/svg/Name=envelope, Category=object.svg +3 -0
- package/svg/Name=exclamation-close, Category=symbol.svg +4 -0
- package/svg/Name=exclamation-open, Category=symbol.svg +4 -0
- package/svg/Name=external-link, Category=symbol.svg +3 -0
- package/svg/Name=eye, Category=object.svg +4 -0
- package/svg/Name=eye-hidden, Category=object.svg +7 -0
- package/svg/Name=facebook, Category=social.svg +3 -0
- package/svg/Name=form, Category=symbol.svg +8 -0
- package/svg/Name=game-control, Category=object.svg +3 -0
- package/svg/Name=gear, Category=object.svg +3 -0
- package/svg/Name=github, Category=social.svg +3 -0
- package/svg/Name=house, Category=object.svg +3 -0
- package/svg/Name=hyphen, Category=symbol.svg +3 -0
- package/svg/Name=info, Category=symbol.svg +3 -0
- package/svg/Name=instagram, Category=social.svg +3 -0
- package/svg/Name=link, Category=symbol.svg +5 -0
- package/svg/Name=linkedin, Category=social.svg +3 -0
- package/svg/Name=magnifying-glass, Category=object.svg +3 -0
- package/svg/Name=message, Category=symbol.svg +4 -0
- package/svg/Name=moon, Category=object.svg +5 -0
- package/svg/Name=order-list, Category=symbol.svg +7 -0
- package/svg/Name=pencil, Category=object.svg +3 -0
- package/svg/Name=pin-location, Category=symbol.svg +3 -0
- package/svg/Name=question-mark-close, Category=symbol.svg +3 -0
- package/svg/Name=question-mark-open, Category=symbol.svg +3 -0
- package/svg/Name=share, Category=symbol.svg +5 -0
- package/svg/Name=spinner, Category=symbol.svg +9 -0
- package/svg/Name=star, Category=object.svg +3 -0
- package/svg/Name=star-empty, Category=object.svg +3 -0
- package/svg/Name=sun, Category=object.svg +11 -0
- package/svg/Name=text-shadow, Category=symbol.svg +4 -0
- package/svg/Name=thinking, Category=symbol.svg +3 -0
- package/svg/Name=trash-can, Category=object.svg +4 -0
- package/svg/Name=upload, Category=symbol.svg +5 -0
- package/svg/Name=user, Category=symbol.svg +4 -0
- package/svg/Name=warning, Category=symbol.svg +5 -0
- package/svg/Name=whatsapp, Category=social.svg +3 -0
- package/svgconfig.json +4 -0
- package/tsconfig.json +14 -0
- package/tsup.config.cjs +21 -0
- package/vite.config.ts +13 -0
package/package.json
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "polpo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"imports": {
|
|
8
|
+
"@juanmsl/ui": "./src",
|
|
9
|
+
"@juanmsl/hooks": "./src/hooks",
|
|
10
|
+
"@juanmsl/helpers": "./src/helpers"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": null,
|
|
14
|
+
"./ui": {
|
|
15
|
+
"main": "./dist/polpo.cjs",
|
|
16
|
+
"module": "./dist/polpo.js",
|
|
17
|
+
"types": "./dist/polpo.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./hooks": {
|
|
20
|
+
"main": "./dist/hooks.cjs",
|
|
21
|
+
"module": "./dist/hooks.js",
|
|
22
|
+
"types": "./dist/hooks.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./helpers": {
|
|
25
|
+
"main": "./dist/helpers.cjs",
|
|
26
|
+
"module": "./dist/helpers.js",
|
|
27
|
+
"types": "./dist/helpers.d.ts"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"type": "git",
|
|
32
|
+
"directory": "packages/polpo",
|
|
33
|
+
"url": "git+https://github.com/juanmsl/monorepo-juanmsl.git"
|
|
34
|
+
},
|
|
35
|
+
"website": "https://ui.juanmsl.com/",
|
|
36
|
+
"scripts": {
|
|
37
|
+
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
38
|
+
"lint:fix": "yarn lint --fix",
|
|
39
|
+
"build:watch": "tsup --watch",
|
|
40
|
+
"clean": "rm -rf ./dist",
|
|
41
|
+
"build": "yarn clean && tsup",
|
|
42
|
+
"publish-package": "yarn lint && yarn build && yarn publish --no-git-tag-version",
|
|
43
|
+
"transform-svgs": "node ../../node_modules/@juanmsl/svg-to-react && yarn lint:fix",
|
|
44
|
+
"dev": "storybook dev -p 6006 --quiet",
|
|
45
|
+
"build-storybook": "storybook build"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@juanmsl/svg-to-react": "*",
|
|
49
|
+
"@storybook/addon-essentials": "^8.5.2",
|
|
50
|
+
"@storybook/addon-interactions": "^8.5.2",
|
|
51
|
+
"@storybook/addon-links": "^8.5.2",
|
|
52
|
+
"@storybook/blocks": "^8.5.2",
|
|
53
|
+
"@storybook/manager-api": "^8.5.2",
|
|
54
|
+
"@storybook/react": "^8.5.2",
|
|
55
|
+
"@storybook/react-vite": "^8.5.2",
|
|
56
|
+
"@storybook/test": "^8.5.2",
|
|
57
|
+
"@storybook/theming": "^8.5.2",
|
|
58
|
+
"@types/color": "^3.0.3",
|
|
59
|
+
"@types/react": "^18.2.0",
|
|
60
|
+
"@types/react-dom": "^18.2.18",
|
|
61
|
+
"@types/styled-components": "^5.1.26",
|
|
62
|
+
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
63
|
+
"@typescript-eslint/parser": "^7.4.0",
|
|
64
|
+
"@vitejs/plugin-react": "^4.3.2",
|
|
65
|
+
"eslint": "^8.57.0",
|
|
66
|
+
"eslint-config-custom": "*",
|
|
67
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
68
|
+
"eslint-plugin-storybook": "^0.11.2",
|
|
69
|
+
"framer-motion": "^11.0.24",
|
|
70
|
+
"react": "^18.2.0",
|
|
71
|
+
"react-hook-form": "^7.44.2",
|
|
72
|
+
"storybook": "^8.5.2",
|
|
73
|
+
"styled-components": "^6.1.11",
|
|
74
|
+
"tsconfig": "*",
|
|
75
|
+
"tsup": "^8.0.1",
|
|
76
|
+
"typescript": "^5.5.4",
|
|
77
|
+
"vite": "^5.4.8"
|
|
78
|
+
},
|
|
79
|
+
"peerDependencies": {
|
|
80
|
+
"framer-motion": "^11.0.24",
|
|
81
|
+
"react": "^18.2.0",
|
|
82
|
+
"react-dom": "^18.2.0",
|
|
83
|
+
"react-hook-form": "^7.44.2",
|
|
84
|
+
"styled-components": "^6.1.11"
|
|
85
|
+
},
|
|
86
|
+
"dependencies": {
|
|
87
|
+
"@hookform/resolvers": "^3.1.0",
|
|
88
|
+
"axios": "^1.4.0",
|
|
89
|
+
"color": "^4.2.3",
|
|
90
|
+
"moment": "^2.30.1",
|
|
91
|
+
"react-colorful": "^5.6.1",
|
|
92
|
+
"use-eye-dropper": "^1.6.1",
|
|
93
|
+
"yup": "^1.2.0"
|
|
94
|
+
},
|
|
95
|
+
"publishConfig": {
|
|
96
|
+
"access": "public"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { Grid } from '../../layouts';
|
|
2
|
+
import { Icon, IconNames } from '../icon';
|
|
3
|
+
import { Line } from '../line';
|
|
4
|
+
import { Typography } from '../typography';
|
|
5
|
+
|
|
6
|
+
import { Accordion } from './accordion';
|
|
7
|
+
import { AccordionItem } from './accordion-item';
|
|
8
|
+
|
|
9
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof AccordionItem> = {
|
|
12
|
+
title: 'Accordion/AccordionItem',
|
|
13
|
+
component: AccordionItem,
|
|
14
|
+
argTypes: {
|
|
15
|
+
children: { control: false },
|
|
16
|
+
className: { control: false },
|
|
17
|
+
classNames: { control: false },
|
|
18
|
+
style: { control: false },
|
|
19
|
+
icon: { control: 'select', options: [undefined, ...IconNames.toSorted()] },
|
|
20
|
+
title: { control: 'text' },
|
|
21
|
+
subtitle: { control: 'text' },
|
|
22
|
+
startContent: { control: false },
|
|
23
|
+
endContent: { control: false },
|
|
24
|
+
content: { control: false },
|
|
25
|
+
},
|
|
26
|
+
args: {},
|
|
27
|
+
render: args => (
|
|
28
|
+
<Accordion>
|
|
29
|
+
<AccordionItem {...args}>
|
|
30
|
+
<Typography variant='header4'>Title</Typography>
|
|
31
|
+
<Typography>
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam assumenda atque blanditiis commodi delectus
|
|
33
|
+
deleniti distinctio excepturi explicabo facere fuga laboriosam natus nihil pariatur perspiciatis quaerat qui
|
|
34
|
+
recusandae rerum sed, unde voluptatem.
|
|
35
|
+
</Typography>
|
|
36
|
+
<Typography>
|
|
37
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam assumenda atque blanditiis commodi delectus
|
|
38
|
+
deleniti distinctio excepturi explicabo facere fuga laboriosam natus nihil pariatur perspiciatis quaerat qui
|
|
39
|
+
recusandae rerum sed, unde voluptatem.
|
|
40
|
+
</Typography>
|
|
41
|
+
</AccordionItem>
|
|
42
|
+
</Accordion>
|
|
43
|
+
),
|
|
44
|
+
decorators: [
|
|
45
|
+
Story => (
|
|
46
|
+
<Grid style={{ width: '500px' }}>
|
|
47
|
+
<Story />
|
|
48
|
+
</Grid>
|
|
49
|
+
),
|
|
50
|
+
],
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
type Story = StoryObj<typeof AccordionItem>;
|
|
55
|
+
|
|
56
|
+
export const Default: Story = {
|
|
57
|
+
args: {
|
|
58
|
+
title: 'Accordion Item',
|
|
59
|
+
subtitle: 'Default with Title and Subtitle',
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export const LeftContent: Story = {
|
|
64
|
+
args: {
|
|
65
|
+
title: 'Accordion Item',
|
|
66
|
+
subtitle: 'Custom left content',
|
|
67
|
+
startContent: isOpen => (
|
|
68
|
+
<Grid
|
|
69
|
+
pc='center'
|
|
70
|
+
style={{
|
|
71
|
+
borderRadius: '8px',
|
|
72
|
+
color: `${isOpen ? 'tomato' : 'currentColor'}`,
|
|
73
|
+
border: '1px solid',
|
|
74
|
+
filter: `grayscale(${isOpen ? 0 : 1})`,
|
|
75
|
+
width: '40px',
|
|
76
|
+
height: '40px',
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<Icon name='airplane' />
|
|
80
|
+
</Grid>
|
|
81
|
+
),
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const CustomContent: Story = {
|
|
86
|
+
argTypes: {
|
|
87
|
+
title: { control: false },
|
|
88
|
+
subtitle: { control: false },
|
|
89
|
+
},
|
|
90
|
+
args: {
|
|
91
|
+
content: isOpen => (
|
|
92
|
+
<Grid flow='column' gap='1em' ai='center' gtc='auto 1fr auto'>
|
|
93
|
+
<section>
|
|
94
|
+
<Typography variant='body' weight='bold' noPadding style={{ color: `${isOpen ? 'tomato' : 'currentColor'}` }}>
|
|
95
|
+
Accordion item
|
|
96
|
+
</Typography>
|
|
97
|
+
<Typography variant='small'>Custom content</Typography>
|
|
98
|
+
</section>
|
|
99
|
+
<Line />
|
|
100
|
+
<Grid
|
|
101
|
+
pc='center'
|
|
102
|
+
style={{
|
|
103
|
+
borderRadius: '8px',
|
|
104
|
+
color: `${isOpen ? 'tomato' : 'currentColor'}`,
|
|
105
|
+
border: '1px solid',
|
|
106
|
+
filter: `grayscale(${isOpen ? 0 : 1})`,
|
|
107
|
+
width: '40px',
|
|
108
|
+
height: '40px',
|
|
109
|
+
}}
|
|
110
|
+
>
|
|
111
|
+
<Icon name={isOpen ? 'eye' : 'eye-hidden'} />
|
|
112
|
+
</Grid>
|
|
113
|
+
</Grid>
|
|
114
|
+
),
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export const RightContent: Story = {
|
|
119
|
+
args: {
|
|
120
|
+
title: 'Item',
|
|
121
|
+
subtitle: 'Subtitle',
|
|
122
|
+
endContent: isOpen => (
|
|
123
|
+
<section>
|
|
124
|
+
<Typography variant='small'>{isOpen ? 'Close' : 'Open'}</Typography>
|
|
125
|
+
</section>
|
|
126
|
+
),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
|
|
3
|
+
import { SlideCard } from '../cards';
|
|
4
|
+
import { Icon, IconNameT } from '../icon';
|
|
5
|
+
import { Typography } from '../typography';
|
|
6
|
+
|
|
7
|
+
import { useAccordionItem } from './accordion';
|
|
8
|
+
import { AccordionItemStyle } from './accordion.style';
|
|
9
|
+
|
|
10
|
+
import { useClassNames } from '@polpo/hooks';
|
|
11
|
+
|
|
12
|
+
type NodeFunction = (isOpen: boolean) => React.ReactNode;
|
|
13
|
+
|
|
14
|
+
type ContentType = React.ReactNode | NodeFunction;
|
|
15
|
+
|
|
16
|
+
type AccordionItemCommonProps = {
|
|
17
|
+
icon?: IconNameT;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
startContent?: ContentType;
|
|
20
|
+
endContent?: ContentType;
|
|
21
|
+
className?: string;
|
|
22
|
+
style?: React.CSSProperties;
|
|
23
|
+
classNames?: {
|
|
24
|
+
header?: string;
|
|
25
|
+
headerContent?: string;
|
|
26
|
+
title?: string;
|
|
27
|
+
subtitle?: string;
|
|
28
|
+
toggleIcon?: string;
|
|
29
|
+
body?: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
type AccordionItemTitleProps = AccordionItemCommonProps & {
|
|
34
|
+
title?: ContentType;
|
|
35
|
+
subtitle?: ContentType;
|
|
36
|
+
content?: never;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
type AccordionItemContentProps = AccordionItemCommonProps & {
|
|
40
|
+
title?: never;
|
|
41
|
+
subtitle?: never;
|
|
42
|
+
content?: ContentType;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
type AccordionItemProps = AccordionItemTitleProps | AccordionItemContentProps;
|
|
46
|
+
|
|
47
|
+
const getContent = (content: ContentType | undefined, isOpen: boolean): React.ReactNode | undefined => {
|
|
48
|
+
if (typeof content === 'function') {
|
|
49
|
+
return content(isOpen);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return content;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const AccordionItem: React.FC<AccordionItemProps> = ({
|
|
56
|
+
title,
|
|
57
|
+
subtitle,
|
|
58
|
+
children,
|
|
59
|
+
icon = 'caret-left',
|
|
60
|
+
startContent,
|
|
61
|
+
content,
|
|
62
|
+
endContent,
|
|
63
|
+
classNames = {},
|
|
64
|
+
className = '',
|
|
65
|
+
style = {},
|
|
66
|
+
}: AccordionItemProps) => {
|
|
67
|
+
const id = useMemo(() => crypto.randomUUID(), []);
|
|
68
|
+
const [isOpen, toggle] = useAccordionItem(id);
|
|
69
|
+
const headerClassName = useClassNames({
|
|
70
|
+
'accordion-header': true,
|
|
71
|
+
'has-start-content': !!startContent,
|
|
72
|
+
[classNames?.header ?? '']: !!classNames?.header,
|
|
73
|
+
'is-open': isOpen,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const headerContentClassName = useClassNames({
|
|
77
|
+
'accordion-header-content': true,
|
|
78
|
+
[classNames?.headerContent ?? '']: !!classNames?.headerContent,
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const toggleIconClassName = useClassNames({
|
|
82
|
+
'accordion-toggle-icon': true,
|
|
83
|
+
isOpen: isOpen,
|
|
84
|
+
[classNames?.toggleIcon ?? '']: !!classNames?.toggleIcon,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const bodyContentClassName = useClassNames({
|
|
88
|
+
'accordion-body': true,
|
|
89
|
+
[classNames?.body ?? '']: !!classNames?.body,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const titleContent = getContent(title, isOpen);
|
|
93
|
+
const subtitleContent = getContent(subtitle, isOpen);
|
|
94
|
+
const headerStart = getContent(startContent, isOpen);
|
|
95
|
+
const headerMiddle = getContent(content, isOpen) ?? (
|
|
96
|
+
<section className={headerContentClassName}>
|
|
97
|
+
<Typography className={classNames?.title} variant='body' noPadding weight='bold'>
|
|
98
|
+
{titleContent}
|
|
99
|
+
</Typography>
|
|
100
|
+
<Typography className={classNames?.subtitle} variant='label' noPadding weight='light'>
|
|
101
|
+
{subtitleContent}
|
|
102
|
+
</Typography>
|
|
103
|
+
</section>
|
|
104
|
+
);
|
|
105
|
+
const headerEnd = getContent(endContent, isOpen) ?? <Icon className={toggleIconClassName} name={icon} />;
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<AccordionItemStyle className={className} style={style}>
|
|
109
|
+
<section className={headerClassName} onClick={toggle}>
|
|
110
|
+
{headerStart}
|
|
111
|
+
{headerMiddle}
|
|
112
|
+
{headerEnd}
|
|
113
|
+
</section>
|
|
114
|
+
<SlideCard isOpen={isOpen}>
|
|
115
|
+
<section className={bodyContentClassName}>{children}</section>
|
|
116
|
+
</SlideCard>
|
|
117
|
+
</AccordionItemStyle>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Grid } from '../../layouts';
|
|
2
|
+
import { Typography } from '../typography';
|
|
3
|
+
|
|
4
|
+
import { Accordion } from './accordion';
|
|
5
|
+
import { AccordionItem } from './accordion-item';
|
|
6
|
+
import { CustomContent as AccordionItemStories } from './accordion-item.stories';
|
|
7
|
+
|
|
8
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof Accordion> = {
|
|
11
|
+
title: 'Accordion/Accordion',
|
|
12
|
+
component: Accordion,
|
|
13
|
+
argTypes: {
|
|
14
|
+
children: { control: false },
|
|
15
|
+
className: { control: false },
|
|
16
|
+
noSeparators: { control: 'boolean' },
|
|
17
|
+
style: { control: false },
|
|
18
|
+
},
|
|
19
|
+
args: {
|
|
20
|
+
noSeparators: false,
|
|
21
|
+
},
|
|
22
|
+
decorators: [
|
|
23
|
+
Story => (
|
|
24
|
+
<Grid style={{ width: '500px' }}>
|
|
25
|
+
<Story />
|
|
26
|
+
</Grid>
|
|
27
|
+
),
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export default meta;
|
|
32
|
+
type Story = StoryObj<typeof Accordion>;
|
|
33
|
+
|
|
34
|
+
export const Default: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
children: Array.from(new Array(10)).map((_, key) => (
|
|
37
|
+
<AccordionItem {...AccordionItemStories.args} key={key}>
|
|
38
|
+
<Typography variant='header4'>Title {key + 1}</Typography>
|
|
39
|
+
<Typography>
|
|
40
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam assumenda atque blanditiis commodi delectus
|
|
41
|
+
deleniti distinctio excepturi explicabo facere fuga laboriosam natus nihil pariatur perspiciatis quaerat qui
|
|
42
|
+
recusandae rerum sed, unde voluptatem.
|
|
43
|
+
</Typography>
|
|
44
|
+
</AccordionItem>
|
|
45
|
+
)),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const FAQ: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
noSeparators: true,
|
|
52
|
+
style: {
|
|
53
|
+
gap: '1em',
|
|
54
|
+
},
|
|
55
|
+
children: Array.from(new Array(10)).map((_, key) => (
|
|
56
|
+
<AccordionItem
|
|
57
|
+
key={key}
|
|
58
|
+
title={`Is there a question #${key + 1}?`}
|
|
59
|
+
style={{
|
|
60
|
+
border: '1px solid',
|
|
61
|
+
borderRadius: '1em',
|
|
62
|
+
overflow: 'hidden',
|
|
63
|
+
padding: '0 1em',
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<Typography noPadding>
|
|
67
|
+
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aperiam assumenda atque blanditiis commodi delectus
|
|
68
|
+
deleniti distinctio excepturi explicabo facere fuga laboriosam natus nihil pariatur perspiciatis quaerat qui
|
|
69
|
+
recusandae rerum sed, unde voluptatem.
|
|
70
|
+
</Typography>
|
|
71
|
+
</AccordionItem>
|
|
72
|
+
)),
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const AccordionStyle = styled.section`
|
|
4
|
+
display: grid;
|
|
5
|
+
`;
|
|
6
|
+
|
|
7
|
+
export const AccordionItemStyle = styled.section`
|
|
8
|
+
display: grid;
|
|
9
|
+
position: relative;
|
|
10
|
+
|
|
11
|
+
.accordion-header {
|
|
12
|
+
display: grid;
|
|
13
|
+
grid-template-columns: 1fr auto;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: 20px;
|
|
16
|
+
cursor: pointer;
|
|
17
|
+
position: sticky;
|
|
18
|
+
top: 0;
|
|
19
|
+
padding: 20px 0;
|
|
20
|
+
background: ${props => props.theme.colors.background.main};
|
|
21
|
+
|
|
22
|
+
&.has-start-content {
|
|
23
|
+
grid-template-columns: auto 1fr auto;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.accordion-header-content {
|
|
28
|
+
display: grid;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.accordion-toggle-icon {
|
|
32
|
+
transition: all 300ms ease;
|
|
33
|
+
|
|
34
|
+
&.isOpen {
|
|
35
|
+
transform: rotate(-90deg);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.accordion-body {
|
|
40
|
+
padding: 10px 0 20px;
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { createContext, useCallback, useContext, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { Line } from '../line';
|
|
4
|
+
|
|
5
|
+
import { AccordionStyle } from './accordion.style';
|
|
6
|
+
|
|
7
|
+
type AccordionContextState = {
|
|
8
|
+
toggleItem: (id: string) => void;
|
|
9
|
+
openedItem: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const AccordionContext = createContext<AccordionContextState | null>(null);
|
|
13
|
+
|
|
14
|
+
export const useAccordionItem = (id: string): [boolean, () => void] => {
|
|
15
|
+
const context = useContext(AccordionContext);
|
|
16
|
+
|
|
17
|
+
if (!context) {
|
|
18
|
+
throw new Error('You cant use this component out off an Accordion component');
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { toggleItem, openedItem } = context;
|
|
22
|
+
|
|
23
|
+
const toggle = () => toggleItem(id);
|
|
24
|
+
|
|
25
|
+
return [openedItem === id, toggle];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type AccordionProps = {
|
|
29
|
+
children: React.ReactNode;
|
|
30
|
+
className?: string;
|
|
31
|
+
style?: React.CSSProperties;
|
|
32
|
+
noSeparators?: boolean;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const Accordion = ({ children, className = '', noSeparators, style = {} }: AccordionProps) => {
|
|
36
|
+
const [openedItem, setOpenedItem] = useState<string>('');
|
|
37
|
+
|
|
38
|
+
const toggleItem = useCallback((id: string) => {
|
|
39
|
+
setOpenedItem(prev => (prev === id ? '' : id));
|
|
40
|
+
}, []);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<AccordionContext.Provider
|
|
44
|
+
value={{
|
|
45
|
+
toggleItem,
|
|
46
|
+
openedItem,
|
|
47
|
+
}}
|
|
48
|
+
>
|
|
49
|
+
<AccordionStyle className={className} style={style}>
|
|
50
|
+
{(Array.isArray(children) ? children : [children]).flatMap((child, key) => {
|
|
51
|
+
return key === 0 ? child : [noSeparators ? null : <Line orientation='horizontal' key={`${key}.5`} />, child];
|
|
52
|
+
})}
|
|
53
|
+
</AccordionStyle>
|
|
54
|
+
</AccordionContext.Provider>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { RadiusVariants, SizeVariants } from '../../../core/variants';
|
|
2
|
+
import { Grid } from '../../../layouts';
|
|
3
|
+
import { IconNames } from '../../icon';
|
|
4
|
+
|
|
5
|
+
import { Button, ButtonColor, ButtonVariant } from './button';
|
|
6
|
+
|
|
7
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof Button> = {
|
|
10
|
+
title: 'Buttons/Button',
|
|
11
|
+
component: Button,
|
|
12
|
+
argTypes: {
|
|
13
|
+
children: { control: 'text' },
|
|
14
|
+
className: { control: false },
|
|
15
|
+
color: {
|
|
16
|
+
control: 'inline-radio',
|
|
17
|
+
options: [undefined, ...Object.values(ButtonColor)],
|
|
18
|
+
},
|
|
19
|
+
disabled: { control: 'boolean' },
|
|
20
|
+
isLoading: { control: 'boolean' },
|
|
21
|
+
leftIcon: { options: [undefined, ...IconNames.toSorted()] },
|
|
22
|
+
noShadow: { control: 'boolean' },
|
|
23
|
+
onClick: { control: false },
|
|
24
|
+
size: { control: 'inline-radio', options: Object.values(SizeVariants) },
|
|
25
|
+
style: { control: false },
|
|
26
|
+
rightIcon: { options: [undefined, ...IconNames.toSorted()] },
|
|
27
|
+
radius: { control: 'inline-radio', options: Object.values(RadiusVariants) },
|
|
28
|
+
type: { control: false, options: ['button', 'submit', 'reset'] },
|
|
29
|
+
variant: { control: 'inline-radio', options: Object.values(ButtonVariant) },
|
|
30
|
+
width: { control: 'inline-radio', options: ['fit', 'full'] },
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
width: 'full',
|
|
34
|
+
size: 'medium',
|
|
35
|
+
radius: 'medium',
|
|
36
|
+
children: 'Button',
|
|
37
|
+
noShadow: false,
|
|
38
|
+
disabled: false,
|
|
39
|
+
isLoading: false,
|
|
40
|
+
},
|
|
41
|
+
decorators: [
|
|
42
|
+
Story => (
|
|
43
|
+
<Grid ji='center' gtc='300px'>
|
|
44
|
+
<Story />
|
|
45
|
+
</Grid>
|
|
46
|
+
),
|
|
47
|
+
],
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default meta;
|
|
51
|
+
type Story = StoryObj<typeof meta>;
|
|
52
|
+
|
|
53
|
+
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
54
|
+
export const Default: Story = {};
|
|
55
|
+
|
|
56
|
+
export const Variants: Story = {
|
|
57
|
+
argTypes: {
|
|
58
|
+
variant: { control: false },
|
|
59
|
+
children: { control: false },
|
|
60
|
+
},
|
|
61
|
+
render: args => (
|
|
62
|
+
<Grid gtc='300px' ji='center' gap='1em' ai='center'>
|
|
63
|
+
{Object.values(ButtonVariant).map(variant => (
|
|
64
|
+
<Button {...args} variant={variant} key={variant}>
|
|
65
|
+
{variant}
|
|
66
|
+
</Button>
|
|
67
|
+
))}
|
|
68
|
+
</Grid>
|
|
69
|
+
),
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export const Sizes: Story = {
|
|
73
|
+
argTypes: {
|
|
74
|
+
size: { control: false },
|
|
75
|
+
children: { control: false },
|
|
76
|
+
},
|
|
77
|
+
render: args => (
|
|
78
|
+
<Grid gtc='300px' ji='center' gap='1em' ai='center'>
|
|
79
|
+
{Object.values(SizeVariants).map(size => (
|
|
80
|
+
<Button {...args} size={size} key={size}>
|
|
81
|
+
{size}
|
|
82
|
+
</Button>
|
|
83
|
+
))}
|
|
84
|
+
</Grid>
|
|
85
|
+
),
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const Colors: Story = {
|
|
89
|
+
argTypes: {
|
|
90
|
+
color: { control: false },
|
|
91
|
+
children: { control: false },
|
|
92
|
+
},
|
|
93
|
+
render: args => (
|
|
94
|
+
<Grid gtc='300px' ji='center' gap='1em' ai='center'>
|
|
95
|
+
<Button {...args}>Default</Button>
|
|
96
|
+
{Object.values(ButtonColor).map(color => (
|
|
97
|
+
<Button {...args} color={color} key={color}>
|
|
98
|
+
{color}
|
|
99
|
+
</Button>
|
|
100
|
+
))}
|
|
101
|
+
</Grid>
|
|
102
|
+
),
|
|
103
|
+
};
|