polpo 0.1.7 → 0.1.9
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/dist/components.cjs +3 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.css +2 -0
- package/dist/components.css.map +1 -0
- package/dist/components.d.cts +1866 -0
- package/dist/components.d.ts +1866 -0
- package/dist/components.js +3 -0
- package/dist/components.js.map +1 -0
- package/dist/{get-modal-position-drle0OjP.d.cts → get-modal-position-C5jQsaGx.d.cts} +1 -1
- package/dist/{get-modal-position-drle0OjP.d.ts → get-modal-position-C5jQsaGx.d.ts} +1 -1
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/helpers.js +1 -1
- package/dist/helpers.js.map +1 -1
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +15 -13
- package/dist/hooks.d.ts +15 -13
- package/dist/hooks.js +1 -1
- package/dist/hooks.js.map +1 -1
- package/dist/layouts.cjs +3 -0
- package/dist/layouts.cjs.map +1 -0
- package/dist/layouts.css +2 -0
- package/dist/layouts.css.map +1 -0
- package/dist/{ui.d.cts → layouts.d.cts} +237 -2202
- package/dist/{ui.d.ts → layouts.d.ts} +237 -2202
- package/dist/layouts.js +3 -0
- package/dist/layouts.js.map +1 -0
- package/dist/types.cjs +3 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +8 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/{use-modal-transition-XQHye62R.d.cts → use-modal-transition-C0lyjvkD.d.ts} +4 -4
- package/dist/{use-modal-transition-DPZFWFFf.d.ts → use-modal-transition-C7DzbnY5.d.cts} +4 -4
- package/package.json +76 -76
- package/.eslintrc.cjs +0 -9
- package/.storybook/decorators.tsx +0 -61
- package/.storybook/main.ts +0 -47
- package/.storybook/manager-head.html +0 -2
- package/.storybook/manager.ts +0 -7
- package/.storybook/preview-head.html +0 -2
- package/.storybook/preview.ts +0 -38
- package/.storybook/theme.ts +0 -47
- package/.turbo/turbo-lint.log +0 -4
- package/README.md +0 -65
- package/dist/chunk-CF5MBMWG.js +0 -3
- package/dist/chunk-CF5MBMWG.js.map +0 -1
- package/dist/chunk-MAWW6AA7.js +0 -3
- package/dist/chunk-MAWW6AA7.js.map +0 -1
- package/dist/ui.cjs +0 -2279
- package/dist/ui.cjs.map +0 -1
- package/dist/ui.js +0 -2279
- package/dist/ui.js.map +0 -1
- package/src/components/accordion/accordion-item.stories.tsx +0 -128
- package/src/components/accordion/accordion-item.tsx +0 -119
- package/src/components/accordion/accordion.stories.tsx +0 -74
- package/src/components/accordion/accordion.style.ts +0 -42
- package/src/components/accordion/accordion.tsx +0 -74
- package/src/components/accordion/index.ts +0 -2
- package/src/components/buttons/button/button.stories.tsx +0 -103
- package/src/components/buttons/button/button.style.ts +0 -152
- package/src/components/buttons/button/button.tsx +0 -107
- package/src/components/buttons/button/index.ts +0 -1
- package/src/components/buttons/index.ts +0 -1
- package/src/components/cards/flip-card/flip-card.stories.tsx +0 -61
- package/src/components/cards/flip-card/flip-card.style.ts +0 -45
- package/src/components/cards/flip-card/flip-card.tsx +0 -55
- package/src/components/cards/flip-card/index.ts +0 -1
- package/src/components/cards/hover-card/hover-card.stories.tsx +0 -45
- package/src/components/cards/hover-card/hover-card.style.ts +0 -13
- package/src/components/cards/hover-card/hover-card.tsx +0 -71
- package/src/components/cards/hover-card/index.ts +0 -1
- package/src/components/cards/index.ts +0 -3
- package/src/components/cards/slide-card/index.ts +0 -1
- package/src/components/cards/slide-card/slide-card.stories.tsx +0 -47
- package/src/components/cards/slide-card/slide-card.tsx +0 -42
- package/src/components/cursor/cursor.stories.tsx +0 -36
- package/src/components/cursor/cursor.style.ts +0 -73
- package/src/components/cursor/cursor.tsx +0 -49
- package/src/components/cursor/index.ts +0 -1
- package/src/components/form/checkbox/checkbox.stories.tsx +0 -85
- package/src/components/form/checkbox/checkbox.style.ts +0 -109
- package/src/components/form/checkbox/checkbox.tsx +0 -120
- package/src/components/form/checkbox/index.ts +0 -1
- package/src/components/form/controller/controller.tsx +0 -42
- package/src/components/form/controller/index.ts +0 -1
- package/src/components/form/date-picker/date-picker.stories.tsx +0 -38
- package/src/components/form/date-picker/date-picker.tsx +0 -67
- package/src/components/form/date-picker/index.ts +0 -1
- package/src/components/form/field/field.stories.tsx +0 -52
- package/src/components/form/field/field.style.ts +0 -94
- package/src/components/form/field/field.tsx +0 -86
- package/src/components/form/field/field.types.ts +0 -34
- package/src/components/form/field/index.ts +0 -2
- package/src/components/form/form.stories.types.tsx +0 -50
- package/src/components/form/form.types.ts +0 -37
- package/src/components/form/index.ts +0 -14
- package/src/components/form/input/index.ts +0 -1
- package/src/components/form/input/input.stories.tsx +0 -41
- package/src/components/form/input/input.tsx +0 -73
- package/src/components/form/input-color/index.ts +0 -1
- package/src/components/form/input-color/input-color.stories.tsx +0 -46
- package/src/components/form/input-color/input-color.style.ts +0 -94
- package/src/components/form/input-color/input-color.tsx +0 -162
- package/src/components/form/input-file/index.ts +0 -1
- package/src/components/form/input-file/input-file.stories.tsx +0 -40
- package/src/components/form/input-file/input-file.style.ts +0 -143
- package/src/components/form/input-file/input-file.tsx +0 -214
- package/src/components/form/input-password/index.ts +0 -1
- package/src/components/form/input-password/input-password.stories.tsx +0 -37
- package/src/components/form/input-password/input-password.tsx +0 -83
- package/src/components/form/radio/index.ts +0 -1
- package/src/components/form/radio/radio.stories.tsx +0 -68
- package/src/components/form/radio/radio.style.ts +0 -79
- package/src/components/form/radio/radio.tsx +0 -106
- package/src/components/form/select/data.stories.json +0 -452
- package/src/components/form/select/index.ts +0 -1
- package/src/components/form/select/option.tsx +0 -101
- package/src/components/form/select/options.tsx +0 -161
- package/src/components/form/select/select.stories.tsx +0 -369
- package/src/components/form/select/select.style.ts +0 -116
- package/src/components/form/select/select.tsx +0 -312
- package/src/components/form/select/select.types.ts +0 -97
- package/src/components/form/slider/index.ts +0 -1
- package/src/components/form/slider/slider.stories.tsx +0 -40
- package/src/components/form/slider/slider.style.ts +0 -92
- package/src/components/form/slider/slider.tsx +0 -108
- package/src/components/form/switch/index.ts +0 -1
- package/src/components/form/switch/switch.stories.tsx +0 -88
- package/src/components/form/switch/switch.style.ts +0 -137
- package/src/components/form/switch/switch.tsx +0 -177
- package/src/components/form/textarea/index.ts +0 -1
- package/src/components/form/textarea/textarea.stories.tsx +0 -43
- package/src/components/form/textarea/textarea.style.ts +0 -7
- package/src/components/form/textarea/textarea.tsx +0 -76
- package/src/components/icon/icon.stories.tsx +0 -63
- package/src/components/icon/icon.tsx +0 -64
- package/src/components/icon/icons/index.ts +0 -18
- package/src/components/icon/icons/object.tsx +0 -482
- package/src/components/icon/icons/social.tsx +0 -88
- package/src/components/icon/icons/symbol.tsx +0 -776
- package/src/components/icon/index.ts +0 -5
- package/src/components/image/image.stories.tsx +0 -25
- package/src/components/image/image.tsx +0 -7
- package/src/components/image/index.ts +0 -1
- package/src/components/index.ts +0 -17
- package/src/components/infinity-scroll/index.ts +0 -1
- package/src/components/infinity-scroll/infinity-scroll.stories.tsx +0 -118
- package/src/components/infinity-scroll/infinity-scroll.style.ts +0 -30
- package/src/components/infinity-scroll/infinity-scroll.tsx +0 -53
- package/src/components/line/index.ts +0 -1
- package/src/components/line/line.stories.tsx +0 -66
- package/src/components/line/line.style.ts +0 -57
- package/src/components/line/line.tsx +0 -76
- package/src/components/loaders/icons/box-1.tsx +0 -31
- package/src/components/loaders/icons/box-2.tsx +0 -30
- package/src/components/loaders/icons/box-3.tsx +0 -66
- package/src/components/loaders/icons/clock-1.tsx +0 -25
- package/src/components/loaders/icons/clock-2.tsx +0 -58
- package/src/components/loaders/icons/dots-1.tsx +0 -194
- package/src/components/loaders/icons/dots-2.tsx +0 -15
- package/src/components/loaders/icons/dots-3.tsx +0 -38
- package/src/components/loaders/icons/dots-4.tsx +0 -90
- package/src/components/loaders/icons/dots-5.tsx +0 -30
- package/src/components/loaders/icons/dots-6.tsx +0 -72
- package/src/components/loaders/icons/dots-7.tsx +0 -51
- package/src/components/loaders/icons/dots-8.tsx +0 -42
- package/src/components/loaders/icons/dots-9.tsx +0 -27
- package/src/components/loaders/icons/lines-1.tsx +0 -96
- package/src/components/loaders/icons/lines-2.tsx +0 -48
- package/src/components/loaders/icons/pulse-1.tsx +0 -69
- package/src/components/loaders/icons/pulse-2.tsx +0 -69
- package/src/components/loaders/icons/pulse-3.tsx +0 -105
- package/src/components/loaders/icons/pulse-4.tsx +0 -105
- package/src/components/loaders/icons/pulse-5.tsx +0 -56
- package/src/components/loaders/icons/spinner-1.tsx +0 -162
- package/src/components/loaders/icons/spinner-2.tsx +0 -147
- package/src/components/loaders/icons/spinner-3.tsx +0 -35
- package/src/components/loaders/icons/spinner-4.tsx +0 -16
- package/src/components/loaders/index.ts +0 -1
- package/src/components/loaders/simple-loader/index.ts +0 -1
- package/src/components/loaders/simple-loader/simple-loader.stories.tsx +0 -42
- package/src/components/loaders/simple-loader/simple-loader.style.ts +0 -12
- package/src/components/loaders/simple-loader/simple-loader.tsx +0 -99
- package/src/components/modals/action-modal/action-modal.stories.tsx +0 -157
- package/src/components/modals/action-modal/action-modal.style.ts +0 -117
- package/src/components/modals/action-modal/action-modal.tsx +0 -148
- package/src/components/modals/action-modal/index.ts +0 -1
- package/src/components/modals/aside-modal/aside-modal.stories.tsx +0 -81
- package/src/components/modals/aside-modal/aside-modal.style.ts +0 -88
- package/src/components/modals/aside-modal/aside-modal.tsx +0 -64
- package/src/components/modals/aside-modal/index.ts +0 -1
- package/src/components/modals/confirmation-modal/confirmation-modal.stories.tsx +0 -62
- package/src/components/modals/confirmation-modal/confirmation-modal.style.ts +0 -17
- package/src/components/modals/confirmation-modal/confirmation-modal.tsx +0 -43
- package/src/components/modals/confirmation-modal/index.ts +0 -1
- package/src/components/modals/index.ts +0 -6
- package/src/components/modals/menu/index.ts +0 -1
- package/src/components/modals/menu/menu.stories.tsx +0 -79
- package/src/components/modals/menu/menu.style.ts +0 -103
- package/src/components/modals/menu/menu.tsx +0 -186
- package/src/components/modals/modal/backdrop.tsx +0 -70
- package/src/components/modals/modal/index.ts +0 -2
- package/src/components/modals/modal/modal.stories.tsx +0 -328
- package/src/components/modals/modal/modal.style.ts +0 -70
- package/src/components/modals/modal/modal.tsx +0 -106
- package/src/components/modals/portal/index.ts +0 -1
- package/src/components/modals/portal/portal.tsx +0 -21
- package/src/components/ripple/index.ts +0 -1
- package/src/components/ripple/ripple.stories.tsx +0 -38
- package/src/components/ripple/ripple.style.ts +0 -33
- package/src/components/ripple/ripple.tsx +0 -65
- package/src/components/smart-table/index.ts +0 -1
- package/src/components/smart-table/smart-table.column.tsx +0 -63
- package/src/components/smart-table/smart-table.helpers.tsx +0 -59
- package/src/components/smart-table/smart-table.hooks.ts +0 -27
- package/src/components/smart-table/smart-table.row.tsx +0 -29
- package/src/components/smart-table/smart-table.stories.tsx +0 -301
- package/src/components/smart-table/smart-table.style.ts +0 -102
- package/src/components/smart-table/smart-table.tsx +0 -112
- package/src/components/smart-table/smart-table.types.ts +0 -41
- package/src/components/tabs/index.ts +0 -1
- package/src/components/tabs/tabs-container.stories.tsx +0 -159
- package/src/components/tabs/tabs-list.tsx +0 -134
- package/src/components/tabs/tabs.stories.tsx +0 -68
- package/src/components/tabs/tabs.style.ts +0 -137
- package/src/components/tabs/tabs.tsx +0 -117
- package/src/components/tag/index.ts +0 -1
- package/src/components/tag/tag.stories.tsx +0 -48
- package/src/components/tag/tag.style.ts +0 -29
- package/src/components/tag/tag.tsx +0 -34
- package/src/components/tooltips/click-to-copy/click-to-copy.stories.tsx +0 -39
- package/src/components/tooltips/click-to-copy/click-to-copy.tsx +0 -41
- package/src/components/tooltips/click-to-copy/index.ts +0 -1
- package/src/components/tooltips/index.ts +0 -2
- package/src/components/tooltips/tooltip/index.ts +0 -1
- package/src/components/tooltips/tooltip/tooltip.stories.tsx +0 -38
- package/src/components/tooltips/tooltip/tooltip.style.ts +0 -93
- package/src/components/tooltips/tooltip/tooltip.tsx +0 -59
- package/src/components/typography/index.ts +0 -2
- package/src/components/typography/typography.constants.ts +0 -43
- package/src/components/typography/typography.stories.tsx +0 -108
- package/src/components/typography/typography.style.ts +0 -76
- package/src/components/typography/typography.tsx +0 -100
- package/src/contexts/fetch-context/fetch-context.tsx +0 -114
- package/src/contexts/fetch-context/index.ts +0 -1
- package/src/contexts/form-context/form-context.tsx +0 -43
- package/src/contexts/form-context/index.ts +0 -1
- package/src/contexts/index.ts +0 -3
- package/src/contexts/theme-context/index.ts +0 -3
- package/src/contexts/theme-context/theme-context.tsx +0 -158
- package/src/contexts/theme-context/theme.animations.ts +0 -269
- package/src/contexts/theme-context/theme.defaults.ts +0 -209
- package/src/contexts/theme-context/theme.style.ts +0 -78
- package/src/contexts/theme-context/themes.ts +0 -98
- package/src/core/http-client.d.ts +0 -11
- package/src/core/http-client.d.ts.map +0 -1
- package/src/core/http-client.ts +0 -49
- package/src/core/index.d.ts +0 -2
- package/src/core/index.d.ts.map +0 -1
- package/src/core/index.ts +0 -1
- package/src/core/variants/color.ts +0 -9
- package/src/core/variants/index.ts +0 -3
- package/src/core/variants/radius.ts +0 -27
- package/src/core/variants/size.ts +0 -19
- package/src/helpers/format-bytes.ts +0 -11
- package/src/helpers/format-dates.ts +0 -11
- package/src/helpers/get-modal-position-relative-to-screen.ts +0 -86
- package/src/helpers/get-modal-position.ts +0 -211
- package/src/helpers/index.ts +0 -5
- package/src/helpers/text/index.ts +0 -1
- package/src/helpers/text/to-capitalize.ts +0 -17
- package/src/hooks/index.ts +0 -29
- package/src/hooks/use-async.ts +0 -88
- package/src/hooks/use-classnames.ts +0 -13
- package/src/hooks/use-click-outside.ts +0 -32
- package/src/hooks/use-constant.ts +0 -3
- package/src/hooks/use-cookie.ts +0 -124
- package/src/hooks/use-debounce.ts +0 -15
- package/src/hooks/use-dimensions.ts +0 -19
- package/src/hooks/use-dom-container.ts +0 -35
- package/src/hooks/use-event-listener.ts +0 -71
- package/src/hooks/use-file-reader.ts +0 -69
- package/src/hooks/use-geolocation.ts +0 -63
- package/src/hooks/use-hover.ts +0 -17
- package/src/hooks/use-in-view.ts +0 -18
- package/src/hooks/use-input-handlers.ts +0 -49
- package/src/hooks/use-intersection-observer.ts +0 -19
- package/src/hooks/use-media-query.ts +0 -25
- package/src/hooks/use-modal-in-container.ts +0 -85
- package/src/hooks/use-modal-transition.ts +0 -64
- package/src/hooks/use-modal.ts +0 -21
- package/src/hooks/use-mouse-position.ts +0 -64
- package/src/hooks/use-online-status.ts +0 -12
- package/src/hooks/use-render-count.ts +0 -11
- package/src/hooks/use-resize-observer.ts +0 -18
- package/src/hooks/use-safe-dispatch.ts +0 -22
- package/src/hooks/use-scroll.ts +0 -31
- package/src/hooks/use-state-history.ts +0 -22
- package/src/hooks/use-toggle-values.ts +0 -14
- package/src/hooks/use-toggle.ts +0 -11
- package/src/hooks/use-viewport.ts +0 -38
- package/src/index.ts +0 -5
- package/src/layouts/flex/flex.tsx +0 -75
- package/src/layouts/flex/index.ts +0 -1
- package/src/layouts/grid/grid.tsx +0 -86
- package/src/layouts/grid/index.ts +0 -1
- package/src/layouts/index.ts +0 -3
- package/src/layouts/section-layout/index.ts +0 -1
- package/src/layouts/section-layout/section-layout.stories.tsx +0 -55
- package/src/layouts/section-layout/section-layout.style.ts +0 -21
- package/src/layouts/section-layout/section-layout.tsx +0 -46
- package/src/stories/GettingStarted.mdx +0 -62
- package/src/types/generics.ts +0 -68
- package/src/types/index.ts +0 -1
- package/svg/Name=airplane, Category=object.svg +0 -3
- package/svg/Name=arrow-circle, Category=symbol.svg +0 -3
- package/svg/Name=arrow-down, Category=symbol.svg +0 -3
- package/svg/Name=arrow-left, Category=symbol.svg +0 -3
- package/svg/Name=arrow-right, Category=symbol.svg +0 -3
- package/svg/Name=arrow-up, Category=symbol.svg +0 -3
- package/svg/Name=bell, Category=object.svg +0 -3
- package/svg/Name=bicycle, Category=object.svg +0 -3
- package/svg/Name=book-open, Category=object.svg +0 -3
- package/svg/Name=book-solid, Category=object.svg +0 -6
- package/svg/Name=box-shadow, Category=symbol.svg +0 -5
- package/svg/Name=calendar, Category=object.svg +0 -3
- package/svg/Name=camera, Category=object.svg +0 -3
- package/svg/Name=caret-down, Category=symbol.svg +0 -3
- package/svg/Name=caret-left, Category=symbol.svg +0 -3
- package/svg/Name=caret-right, Category=symbol.svg +0 -3
- package/svg/Name=caret-up, Category=symbol.svg +0 -3
- package/svg/Name=checkmark, Category=symbol.svg +0 -3
- package/svg/Name=clean-computer, Category=object.svg +0 -10
- package/svg/Name=codepen, Category=social.svg +0 -3
- package/svg/Name=creative, Category=symbol.svg +0 -5
- package/svg/Name=cross, Category=symbol.svg +0 -4
- package/svg/Name=crossed-flags, Category=object.svg +0 -4
- package/svg/Name=cv, Category=symbol.svg +0 -5
- package/svg/Name=design-ui, Category=symbol.svg +0 -9
- package/svg/Name=document, Category=object.svg +0 -3
- package/svg/Name=door-closed, Category=object.svg +0 -3
- package/svg/Name=door-open, Category=object.svg +0 -3
- package/svg/Name=double-caret-down, Category=symbol.svg +0 -4
- package/svg/Name=double-caret-left, Category=symbol.svg +0 -4
- package/svg/Name=double-caret-righ, Category=symbol.svg +0 -4
- package/svg/Name=double-caret-up, Category=symbol.svg +0 -4
- package/svg/Name=download, Category=symbol.svg +0 -5
- package/svg/Name=dropper, Category=object.svg +0 -5
- package/svg/Name=envelope, Category=object.svg +0 -3
- package/svg/Name=exclamation-close, Category=symbol.svg +0 -4
- package/svg/Name=exclamation-open, Category=symbol.svg +0 -4
- package/svg/Name=external-link, Category=symbol.svg +0 -3
- package/svg/Name=eye, Category=object.svg +0 -4
- package/svg/Name=eye-hidden, Category=object.svg +0 -7
- package/svg/Name=facebook, Category=social.svg +0 -3
- package/svg/Name=form, Category=symbol.svg +0 -8
- package/svg/Name=game-control, Category=object.svg +0 -3
- package/svg/Name=gear, Category=object.svg +0 -3
- package/svg/Name=github, Category=social.svg +0 -3
- package/svg/Name=house, Category=object.svg +0 -3
- package/svg/Name=hyphen, Category=symbol.svg +0 -3
- package/svg/Name=info, Category=symbol.svg +0 -3
- package/svg/Name=instagram, Category=social.svg +0 -3
- package/svg/Name=link, Category=symbol.svg +0 -5
- package/svg/Name=linkedin, Category=social.svg +0 -3
- package/svg/Name=magnifying-glass, Category=object.svg +0 -3
- package/svg/Name=message, Category=symbol.svg +0 -4
- package/svg/Name=moon, Category=object.svg +0 -5
- package/svg/Name=npm, Category=social.svg +0 -3
- package/svg/Name=order-list, Category=symbol.svg +0 -7
- package/svg/Name=pencil, Category=object.svg +0 -3
- package/svg/Name=pin-location, Category=symbol.svg +0 -3
- package/svg/Name=question-mark-close, Category=symbol.svg +0 -3
- package/svg/Name=question-mark-open, Category=symbol.svg +0 -3
- package/svg/Name=share, Category=symbol.svg +0 -5
- package/svg/Name=spinner, Category=symbol.svg +0 -9
- package/svg/Name=star, Category=object.svg +0 -3
- package/svg/Name=star-empty, Category=object.svg +0 -3
- package/svg/Name=sun, Category=object.svg +0 -11
- package/svg/Name=text-shadow, Category=symbol.svg +0 -4
- package/svg/Name=thinking, Category=symbol.svg +0 -3
- package/svg/Name=trash-can, Category=object.svg +0 -4
- package/svg/Name=upload, Category=symbol.svg +0 -5
- package/svg/Name=user, Category=symbol.svg +0 -4
- package/svg/Name=warning, Category=symbol.svg +0 -5
- package/svg/Name=whatsapp, Category=social.svg +0 -3
- package/svgconfig.json +0 -4
- package/tsconfig.json +0 -15
- package/tsup.config.cjs +0 -21
- package/vite.config.ts +0 -14
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { ColorVariants, SizeVariants } from '../../../core/variants';
|
|
4
|
-
import { SectionLayout } from '../../../layouts';
|
|
5
|
-
import { IconNames } from '../../icon';
|
|
6
|
-
import { UnControlledComponentArgTypes } from '../form.stories.types';
|
|
7
|
-
|
|
8
|
-
import { Checkbox } from './checkbox';
|
|
9
|
-
|
|
10
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
11
|
-
|
|
12
|
-
const meta: Meta<typeof Checkbox> = {
|
|
13
|
-
title: 'Form/Checkbox',
|
|
14
|
-
component: Checkbox,
|
|
15
|
-
argTypes: {
|
|
16
|
-
...UnControlledComponentArgTypes,
|
|
17
|
-
placeholder: { table: { disable: true } },
|
|
18
|
-
label: { control: 'text' },
|
|
19
|
-
size: { control: 'inline-radio', options: Object.values(SizeVariants) },
|
|
20
|
-
icon: { options: [undefined, ...IconNames.toSorted()] },
|
|
21
|
-
color: { control: { type: 'inline-radio', options: Object.values(ColorVariants) } },
|
|
22
|
-
},
|
|
23
|
-
args: {
|
|
24
|
-
label: 'Checkbox',
|
|
25
|
-
},
|
|
26
|
-
render: args => {
|
|
27
|
-
const [value, setValue] = useState(false);
|
|
28
|
-
|
|
29
|
-
return <Checkbox {...args} value={value} setValue={setValue} />;
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
type Story = StoryObj<typeof Checkbox>;
|
|
35
|
-
|
|
36
|
-
export const Default: Story = {
|
|
37
|
-
args: {},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const MultipleOptions: Story = {
|
|
41
|
-
args: {},
|
|
42
|
-
render: args => {
|
|
43
|
-
const [option1, setOption1] = useState(false);
|
|
44
|
-
const [option2, setOption2] = useState(false);
|
|
45
|
-
const [option3, setOption3] = useState(false);
|
|
46
|
-
const [option4, setOption4] = useState(false);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<SectionLayout fitHeightContent>
|
|
50
|
-
<Checkbox {...args} value={option1} setValue={setOption1} label='Option 1' />
|
|
51
|
-
<Checkbox {...args} value={option2} setValue={setOption2} label='Option 2' />
|
|
52
|
-
<Checkbox {...args} value={option3} setValue={setOption3} label='Option 3' />
|
|
53
|
-
<Checkbox {...args} value={option4} setValue={setOption4} label='Option 4' />
|
|
54
|
-
</SectionLayout>
|
|
55
|
-
);
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const Colors: Story = {
|
|
60
|
-
args: {},
|
|
61
|
-
argTypes: {
|
|
62
|
-
color: { control: false },
|
|
63
|
-
},
|
|
64
|
-
render: args => {
|
|
65
|
-
const [option1, setOption1] = useState(false);
|
|
66
|
-
const [option2, setOption2] = useState(false);
|
|
67
|
-
const [option3, setOption3] = useState(false);
|
|
68
|
-
const [option4, setOption4] = useState(false);
|
|
69
|
-
const [option5, setOption5] = useState(false);
|
|
70
|
-
const [option6, setOption6] = useState(false);
|
|
71
|
-
const [option7, setOption7] = useState(false);
|
|
72
|
-
|
|
73
|
-
return (
|
|
74
|
-
<SectionLayout fitHeightContent>
|
|
75
|
-
<Checkbox {...args} color='primary' value={option1} setValue={setOption1} label='Primary' />
|
|
76
|
-
<Checkbox {...args} color='secondary' value={option2} setValue={setOption2} label='Secondary' />
|
|
77
|
-
<Checkbox {...args} color='tertiary' value={option3} setValue={setOption3} label='Tertiary' />
|
|
78
|
-
<Checkbox {...args} color='info' value={option4} setValue={setOption4} label='Info' />
|
|
79
|
-
<Checkbox {...args} color='active' value={option5} setValue={setOption5} label='Active' />
|
|
80
|
-
<Checkbox {...args} color='warning' value={option6} setValue={setOption6} label='Warning' />
|
|
81
|
-
<Checkbox {...args} color='alert' value={option7} setValue={setOption7} label='Alert' />
|
|
82
|
-
</SectionLayout>
|
|
83
|
-
);
|
|
84
|
-
},
|
|
85
|
-
};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
export const CheckboxFillStyle = styled.section`
|
|
4
|
-
transition: all 200ms ease-out;
|
|
5
|
-
border-radius: inherit;
|
|
6
|
-
margin: auto;
|
|
7
|
-
width: 0;
|
|
8
|
-
height: 0;
|
|
9
|
-
overflow: hidden;
|
|
10
|
-
position: relative;
|
|
11
|
-
display: grid;
|
|
12
|
-
place-content: center;
|
|
13
|
-
place-items: center;
|
|
14
|
-
|
|
15
|
-
.checkbox-icon {
|
|
16
|
-
font-size: 0.7em;
|
|
17
|
-
z-index: 1;
|
|
18
|
-
opacity: 0;
|
|
19
|
-
transition: opacity 300ms ease;
|
|
20
|
-
}
|
|
21
|
-
`;
|
|
22
|
-
|
|
23
|
-
export const CheckboxStyle = styled.section`
|
|
24
|
-
border-radius: 40%;
|
|
25
|
-
background: ${props => props.theme.colors.background.paper};
|
|
26
|
-
transition: all 300ms ease;
|
|
27
|
-
width: 1em;
|
|
28
|
-
height: 1em;
|
|
29
|
-
margin: 2px;
|
|
30
|
-
outline: 1px solid;
|
|
31
|
-
display: flex;
|
|
32
|
-
position: relative;
|
|
33
|
-
|
|
34
|
-
.checkbox-input {
|
|
35
|
-
position: absolute;
|
|
36
|
-
top: 0;
|
|
37
|
-
left: 0;
|
|
38
|
-
width: 100%;
|
|
39
|
-
height: 100%;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
opacity: 0;
|
|
42
|
-
z-index: 2;
|
|
43
|
-
}
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
type CheckboxContainerStyleProps = {
|
|
47
|
-
$color: string;
|
|
48
|
-
$colorIcon: string;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const CheckboxContainerStyle = styled.section<CheckboxContainerStyleProps>`
|
|
52
|
-
display: grid;
|
|
53
|
-
grid-auto-flow: column;
|
|
54
|
-
grid-auto-columns: auto 1fr;
|
|
55
|
-
align-items: center;
|
|
56
|
-
gap: 0.5em;
|
|
57
|
-
width: fit-content;
|
|
58
|
-
|
|
59
|
-
.checkbox-label {
|
|
60
|
-
cursor: pointer;
|
|
61
|
-
user-select: none;
|
|
62
|
-
width: 100%;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
${CheckboxStyle} {
|
|
66
|
-
color: ${props => props.$color};
|
|
67
|
-
|
|
68
|
-
&.is-checked {
|
|
69
|
-
${CheckboxFillStyle} {
|
|
70
|
-
width: 100%;
|
|
71
|
-
height: 100%;
|
|
72
|
-
background: ${props => props.$color};
|
|
73
|
-
color: ${props => props.$colorIcon};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.checkbox-icon {
|
|
77
|
-
opacity: 1;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
${CheckboxStyle}:hover,
|
|
83
|
-
&:has(.checkbox-label:hover) ${CheckboxStyle} {
|
|
84
|
-
box-shadow: 0 0 0 0.3em ${props => props.$color}88;
|
|
85
|
-
|
|
86
|
-
${CheckboxFillStyle} {
|
|
87
|
-
width: 20%;
|
|
88
|
-
height: 20%;
|
|
89
|
-
border-radius: 20%;
|
|
90
|
-
background: ${props => props.$color}88;
|
|
91
|
-
color: ${props => props.$colorIcon};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&:is(.is-checked) {
|
|
95
|
-
${CheckboxFillStyle} {
|
|
96
|
-
width: 100%;
|
|
97
|
-
height: 100%;
|
|
98
|
-
border-radius: inherit;
|
|
99
|
-
background: ${props => props.$color};
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
${CheckboxStyle}:focus,
|
|
105
|
-
&:has(.checkbox-input:focus) ${CheckboxStyle},
|
|
106
|
-
&:has(.checkbox-label:focus) ${CheckboxStyle} {
|
|
107
|
-
box-shadow: 0 0 0 0.3em ${props => props.$color}88;
|
|
108
|
-
}
|
|
109
|
-
`;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import { DefaultTheme, useTheme } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { ColorVariants, SizeVariants } from '../../../core/variants';
|
|
5
|
-
import { Icon, IconNameT } from '../../icon';
|
|
6
|
-
import { Typography } from '../../typography';
|
|
7
|
-
import { Controller } from '../controller';
|
|
8
|
-
import { ControllerGeneratorProps, UnControlledComponentProps } from '../form.types';
|
|
9
|
-
|
|
10
|
-
import { CheckboxContainerStyle, CheckboxFillStyle, CheckboxStyle } from './checkbox.style';
|
|
11
|
-
|
|
12
|
-
import { useInputHandlers } from '@polpo/hooks';
|
|
13
|
-
|
|
14
|
-
type CheckboxColor = {
|
|
15
|
-
color: string;
|
|
16
|
-
colorIcon: string;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const getCheckboxColor = (theme: DefaultTheme, color: `${ColorVariants}`): CheckboxColor => {
|
|
20
|
-
const checkboxColors: Record<ColorVariants, CheckboxColor> = {
|
|
21
|
-
[ColorVariants.Primary]: { color: theme.colors.primary.main, colorIcon: theme.colors.primary.contrast },
|
|
22
|
-
[ColorVariants.Secondary]: { color: theme.colors.secondary.main, colorIcon: theme.colors.secondary.contrast },
|
|
23
|
-
[ColorVariants.Tertiary]: { color: theme.colors.tertiary.main, colorIcon: theme.colors.tertiary.contrast },
|
|
24
|
-
[ColorVariants.Info]: { color: theme.colors.info.main, colorIcon: theme.colors.info.contrast },
|
|
25
|
-
[ColorVariants.Active]: { color: theme.colors.active.main, colorIcon: theme.colors.active.contrast },
|
|
26
|
-
[ColorVariants.Warning]: { color: theme.colors.warning.main, colorIcon: theme.colors.warning.contrast },
|
|
27
|
-
[ColorVariants.Alert]: { color: theme.colors.alert.main, colorIcon: theme.colors.alert.contrast },
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return checkboxColors[color] ?? checkboxColors[ColorVariants.Primary];
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const CheckboxSizeMap = {
|
|
34
|
-
[SizeVariants.Small]: 1,
|
|
35
|
-
[SizeVariants.Medium]: 1.2,
|
|
36
|
-
[SizeVariants.Large]: 1.4,
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
type CheckboxProps = {
|
|
40
|
-
label?: React.ReactNode;
|
|
41
|
-
placeholder?: never;
|
|
42
|
-
icon?: IconNameT;
|
|
43
|
-
color?: `${ColorVariants}`;
|
|
44
|
-
size?: `${SizeVariants}`;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export const Checkbox = ({
|
|
48
|
-
name,
|
|
49
|
-
value,
|
|
50
|
-
setValue,
|
|
51
|
-
onBlur,
|
|
52
|
-
onFocus,
|
|
53
|
-
className = '',
|
|
54
|
-
style = {},
|
|
55
|
-
autoFocus = false,
|
|
56
|
-
readOnly = false,
|
|
57
|
-
disabled = false,
|
|
58
|
-
autoComplete = 'off',
|
|
59
|
-
icon = 'checkmark',
|
|
60
|
-
label,
|
|
61
|
-
color = ColorVariants.Primary,
|
|
62
|
-
size = SizeVariants.Medium,
|
|
63
|
-
/*
|
|
64
|
-
* isDirty = false,
|
|
65
|
-
* isTouched = false,
|
|
66
|
-
* invalid = false,
|
|
67
|
-
* error,
|
|
68
|
-
*/
|
|
69
|
-
}: UnControlledComponentProps<CheckboxProps, boolean>) => {
|
|
70
|
-
const theme = useTheme();
|
|
71
|
-
const id = useMemo(() => crypto.randomUUID(), []);
|
|
72
|
-
const { handlers } = useInputHandlers<HTMLInputElement>({
|
|
73
|
-
onChange: e => setValue(e.target.checked),
|
|
74
|
-
onBlur: onBlur,
|
|
75
|
-
onFocus: onFocus,
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
const checkboxColor = getCheckboxColor(theme, color);
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<CheckboxContainerStyle
|
|
82
|
-
$color={checkboxColor.color}
|
|
83
|
-
$colorIcon={checkboxColor.colorIcon}
|
|
84
|
-
className={className}
|
|
85
|
-
style={style}
|
|
86
|
-
onClick={e => e.stopPropagation()}
|
|
87
|
-
>
|
|
88
|
-
<CheckboxStyle
|
|
89
|
-
className={value ? 'is-checked' : ''}
|
|
90
|
-
style={{ fontSize: `${CheckboxSizeMap[size] ?? CheckboxSizeMap[SizeVariants.Medium]}em` }}
|
|
91
|
-
>
|
|
92
|
-
<CheckboxFillStyle>
|
|
93
|
-
<Icon name={icon} className='checkbox-icon' />
|
|
94
|
-
</CheckboxFillStyle>
|
|
95
|
-
<input
|
|
96
|
-
id={id}
|
|
97
|
-
type='checkbox'
|
|
98
|
-
name={name}
|
|
99
|
-
className='checkbox-input'
|
|
100
|
-
checked={value}
|
|
101
|
-
autoFocus={autoFocus}
|
|
102
|
-
autoComplete={autoComplete}
|
|
103
|
-
disabled={disabled || readOnly}
|
|
104
|
-
{...handlers}
|
|
105
|
-
/>
|
|
106
|
-
</CheckboxStyle>
|
|
107
|
-
{label ? (
|
|
108
|
-
<Typography variant='label-form' htmlFor={id} className='checkbox-label'>
|
|
109
|
-
{label}
|
|
110
|
-
</Typography>
|
|
111
|
-
) : null}
|
|
112
|
-
</CheckboxContainerStyle>
|
|
113
|
-
);
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const CheckboxController = ({ rules, ...props }: ControllerGeneratorProps<CheckboxProps, boolean>) => {
|
|
117
|
-
return <Controller Component={Checkbox} defaultValue={false} inputProps={props} rules={rules} />;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
Checkbox.Controller = CheckboxController;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './checkbox';
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Controller as RHFController, useFormContext, UseControllerProps } from 'react-hook-form';
|
|
3
|
-
|
|
4
|
-
import { ControlledComponentProps, Props, UnControlledComponentProps } from '../form.types';
|
|
5
|
-
|
|
6
|
-
type ControllerProps<T extends Props, V> = {
|
|
7
|
-
inputProps: ControlledComponentProps<T, V>;
|
|
8
|
-
Component: React.FC<UnControlledComponentProps<T, V>>;
|
|
9
|
-
rules?: UseControllerProps['rules'];
|
|
10
|
-
defaultValue: V;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const Controller = <T extends Props, V>({
|
|
14
|
-
Component,
|
|
15
|
-
inputProps,
|
|
16
|
-
defaultValue: fieldDefaultValue,
|
|
17
|
-
rules,
|
|
18
|
-
}: ControllerProps<T, V>) => {
|
|
19
|
-
const { control, setValue } = useFormContext();
|
|
20
|
-
const { name, defaultValue } = inputProps;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<RHFController
|
|
24
|
-
name={name}
|
|
25
|
-
control={control}
|
|
26
|
-
rules={rules}
|
|
27
|
-
defaultValue={defaultValue ?? fieldDefaultValue}
|
|
28
|
-
render={({ field: { onBlur, value }, fieldState }) => (
|
|
29
|
-
<Component
|
|
30
|
-
value={value}
|
|
31
|
-
error={fieldState.error?.message}
|
|
32
|
-
invalid={fieldState.invalid}
|
|
33
|
-
isTouched={fieldState.isTouched}
|
|
34
|
-
isDirty={fieldState.isDirty}
|
|
35
|
-
setValue={value => setValue(name, value)}
|
|
36
|
-
onBlur={onBlur}
|
|
37
|
-
{...inputProps}
|
|
38
|
-
/>
|
|
39
|
-
)}
|
|
40
|
-
/>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './controller';
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { FieldSharedArgs, FieldSharedArgTypes } from '../field/field.stories';
|
|
4
|
-
import { ContainerDecorator, UnControlledComponentArgTypes } from '../form.stories.types';
|
|
5
|
-
|
|
6
|
-
import { DatePicker } from './date-picker';
|
|
7
|
-
|
|
8
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
-
|
|
10
|
-
const meta: Meta<typeof DatePicker> = {
|
|
11
|
-
title: 'Form/DatePicker',
|
|
12
|
-
component: DatePicker,
|
|
13
|
-
argTypes: {
|
|
14
|
-
...FieldSharedArgTypes,
|
|
15
|
-
...UnControlledComponentArgTypes,
|
|
16
|
-
type: { control: 'select', options: ['date', 'datetime-local', 'month', 'time', 'week'] },
|
|
17
|
-
},
|
|
18
|
-
args: {
|
|
19
|
-
type: 'date',
|
|
20
|
-
label: 'DatePicker',
|
|
21
|
-
rightIcon: undefined,
|
|
22
|
-
leftIcon: undefined,
|
|
23
|
-
...FieldSharedArgs,
|
|
24
|
-
},
|
|
25
|
-
decorators: [ContainerDecorator],
|
|
26
|
-
render: args => {
|
|
27
|
-
const [value, setValue] = useState('');
|
|
28
|
-
|
|
29
|
-
return <DatePicker {...args} value={value} setValue={setValue} />;
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default meta;
|
|
34
|
-
type Story = StoryObj<typeof DatePicker>;
|
|
35
|
-
|
|
36
|
-
export const Default: Story = {
|
|
37
|
-
args: {},
|
|
38
|
-
};
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Controller } from '../controller';
|
|
4
|
-
import { Field, InputFieldProps } from '../field';
|
|
5
|
-
import { ControllerGeneratorProps, UnControlledComponentProps } from '../form.types';
|
|
6
|
-
|
|
7
|
-
import { useInputHandlers } from '@polpo/hooks';
|
|
8
|
-
|
|
9
|
-
type DatePickerProps = InputFieldProps<{
|
|
10
|
-
type?: 'date' | 'datetime-local' | 'month' | 'time' | 'week';
|
|
11
|
-
}>;
|
|
12
|
-
|
|
13
|
-
export const DatePicker = ({
|
|
14
|
-
name,
|
|
15
|
-
value,
|
|
16
|
-
setValue,
|
|
17
|
-
onBlur,
|
|
18
|
-
onFocus,
|
|
19
|
-
type = 'date',
|
|
20
|
-
className = '',
|
|
21
|
-
style = {},
|
|
22
|
-
autoFocus = false,
|
|
23
|
-
readOnly = false,
|
|
24
|
-
disabled = false,
|
|
25
|
-
placeholder = '',
|
|
26
|
-
autoComplete = 'off',
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
28
|
-
isDirty = false,
|
|
29
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
30
|
-
isTouched = false,
|
|
31
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
|
-
invalid = false,
|
|
33
|
-
error,
|
|
34
|
-
...fieldProps
|
|
35
|
-
}: UnControlledComponentProps<DatePickerProps, string>) => {
|
|
36
|
-
const id = useMemo(() => crypto.randomUUID(), []);
|
|
37
|
-
const { isFocus, handlers } = useInputHandlers({
|
|
38
|
-
onBlur: onBlur,
|
|
39
|
-
onChange: e => setValue(e.target.value),
|
|
40
|
-
onFocus: onFocus,
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<Field id={id} error={error} isFocus={isFocus} {...fieldProps}>
|
|
45
|
-
<input
|
|
46
|
-
id={id}
|
|
47
|
-
type={type}
|
|
48
|
-
name={name}
|
|
49
|
-
className={className}
|
|
50
|
-
style={style}
|
|
51
|
-
value={value}
|
|
52
|
-
autoFocus={autoFocus}
|
|
53
|
-
autoComplete={autoComplete}
|
|
54
|
-
placeholder={placeholder}
|
|
55
|
-
disabled={disabled}
|
|
56
|
-
readOnly={readOnly}
|
|
57
|
-
{...handlers}
|
|
58
|
-
/>
|
|
59
|
-
</Field>
|
|
60
|
-
);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const DatePickerController = ({ rules, ...props }: ControllerGeneratorProps<DatePickerProps, string>) => {
|
|
64
|
-
return <Controller Component={DatePicker} defaultValue='' inputProps={props} rules={rules} />;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
DatePicker.Controller = DatePickerController;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './date-picker';
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { IconNames } from '../../icon';
|
|
2
|
-
import { ContainerDecorator } from '../form.stories.types';
|
|
3
|
-
|
|
4
|
-
import { Field } from './field';
|
|
5
|
-
import { FieldOrientation, FieldVariant } from './field.types';
|
|
6
|
-
|
|
7
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
8
|
-
|
|
9
|
-
export const FieldSharedArgTypes: Meta<typeof Field>['argTypes'] = {
|
|
10
|
-
label: { control: 'text' },
|
|
11
|
-
rightIcon: { options: [undefined, ...IconNames.toSorted()] },
|
|
12
|
-
leftIcon: { options: [undefined, ...IconNames.toSorted()] },
|
|
13
|
-
errorIcon: { options: [undefined, ...IconNames.toSorted()] },
|
|
14
|
-
fieldOrientation: { control: 'inline-radio', options: Object.values(FieldOrientation) },
|
|
15
|
-
variant: { control: 'select', options: [undefined, ...Object.values(FieldVariant)] },
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const FieldSharedArgs: StoryObj<typeof Field>['args'] = {
|
|
19
|
-
variant: 'full-border',
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const meta: Meta<typeof Field> = {
|
|
23
|
-
title: 'Form/Field',
|
|
24
|
-
component: Field,
|
|
25
|
-
includeStories: ['Default'],
|
|
26
|
-
excludeStories: /.*Shared*$/,
|
|
27
|
-
argTypes: {
|
|
28
|
-
...FieldSharedArgTypes,
|
|
29
|
-
id: { control: false },
|
|
30
|
-
error: { control: 'text' },
|
|
31
|
-
isFocus: { control: 'boolean' },
|
|
32
|
-
children: { control: 'text' },
|
|
33
|
-
},
|
|
34
|
-
args: {
|
|
35
|
-
label: 'Field label',
|
|
36
|
-
children: 'Hello world',
|
|
37
|
-
isFocus: false,
|
|
38
|
-
error: '',
|
|
39
|
-
...FieldSharedArgs,
|
|
40
|
-
leftIcon: 'facebook',
|
|
41
|
-
rightIcon: 'airplane',
|
|
42
|
-
fieldOrientation: 'vertical',
|
|
43
|
-
},
|
|
44
|
-
decorators: [ContainerDecorator],
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default meta;
|
|
48
|
-
type Story = StoryObj<typeof Field>;
|
|
49
|
-
|
|
50
|
-
export const Default: Story = {
|
|
51
|
-
args: {},
|
|
52
|
-
};
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
export const FieldStyle = styled.section`
|
|
4
|
-
display: grid;
|
|
5
|
-
grid-auto-columns: auto;
|
|
6
|
-
gap: 0.5em;
|
|
7
|
-
transition: all 200ms ease;
|
|
8
|
-
|
|
9
|
-
.field-content {
|
|
10
|
-
display: grid;
|
|
11
|
-
grid-template-columns: auto 1fr auto;
|
|
12
|
-
align-items: center;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.field-left-icon,
|
|
16
|
-
.field-right-icon {
|
|
17
|
-
font-size: 1em;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.field-left-icon {
|
|
21
|
-
margin-right: 1em;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.field-right-icon {
|
|
25
|
-
margin-left: 1em;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.field-message {
|
|
29
|
-
display: grid;
|
|
30
|
-
grid-auto-flow: column;
|
|
31
|
-
gap: 5px;
|
|
32
|
-
align-items: center;
|
|
33
|
-
justify-content: start;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
&.variant-content-border {
|
|
37
|
-
.field-content {
|
|
38
|
-
border: 1px solid ${props => props.theme.colors.border.main};
|
|
39
|
-
border-radius: 4px;
|
|
40
|
-
padding: 1em;
|
|
41
|
-
background: ${props => props.theme.colors.background.main};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
&.variant-content-line {
|
|
46
|
-
.field-content {
|
|
47
|
-
border-bottom: 1px solid;
|
|
48
|
-
padding: 0.5em 0;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&.variant-full-border {
|
|
53
|
-
border: 1px solid ${props => props.theme.colors.border.main};
|
|
54
|
-
border-radius: 4px;
|
|
55
|
-
padding: 0.5em 0;
|
|
56
|
-
background: ${props => props.theme.colors.background.main};
|
|
57
|
-
|
|
58
|
-
.field-label,
|
|
59
|
-
.field-content,
|
|
60
|
-
.field-message {
|
|
61
|
-
padding: 0 1em;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&.variant-inline {
|
|
66
|
-
grid-auto-flow: column;
|
|
67
|
-
padding: 0.5em 0;
|
|
68
|
-
align-items: center;
|
|
69
|
-
|
|
70
|
-
.field-label {
|
|
71
|
-
width: auto;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
&.error {
|
|
76
|
-
color: ${props => props.theme.colors.alert.main};
|
|
77
|
-
border-color: ${props => props.theme.colors.alert.main};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&.focus {
|
|
81
|
-
color: ${props => props.theme.colors.info.main};
|
|
82
|
-
border-color: ${props => props.theme.colors.info.main};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
&.error,
|
|
86
|
-
&.focus {
|
|
87
|
-
.field-left-icon,
|
|
88
|
-
.field-right-icon,
|
|
89
|
-
.field-children {
|
|
90
|
-
color: ${props => props.theme.colors.text.main};
|
|
91
|
-
border-color: ${props => props.theme.colors.text.main};
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
`;
|