polpo 0.1.7 → 0.1.8
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 +31 -0
- package/dist/components.cjs.map +1 -0
- package/dist/components.d.cts +1866 -0
- package/dist/components.d.ts +1866 -0
- package/dist/components.js +31 -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 +4 -0
- package/dist/layouts.cjs.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 +4 -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,143 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
export const InputFileContainerStyle = styled.section`
|
|
4
|
-
display: grid;
|
|
5
|
-
gap: 10px;
|
|
6
|
-
|
|
7
|
-
.input-file--box {
|
|
8
|
-
border: 1px solid;
|
|
9
|
-
border-radius: 5px;
|
|
10
|
-
position: relative;
|
|
11
|
-
transition: all 0.3s ease;
|
|
12
|
-
display: grid;
|
|
13
|
-
grid-template-columns: 32px 1fr;
|
|
14
|
-
padding: 10px;
|
|
15
|
-
gap: 10px;
|
|
16
|
-
background: ${props => props.theme.colors.secondary.main};
|
|
17
|
-
color: ${props => props.theme.colors.secondary.contrast};
|
|
18
|
-
align-items: center;
|
|
19
|
-
|
|
20
|
-
&--icon {
|
|
21
|
-
width: 32px;
|
|
22
|
-
height: 32px;
|
|
23
|
-
border-radius: 5px;
|
|
24
|
-
background: ${props => props.theme.colors.primary.contrast};
|
|
25
|
-
color: ${props => props.theme.colors.primary.main};
|
|
26
|
-
display: grid;
|
|
27
|
-
place-content: center;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
input {
|
|
31
|
-
position: absolute;
|
|
32
|
-
top: 0;
|
|
33
|
-
left: 0;
|
|
34
|
-
width: 100%;
|
|
35
|
-
height: 100%;
|
|
36
|
-
cursor: copy;
|
|
37
|
-
opacity: 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
&:hover {
|
|
41
|
-
background: ${props => props.theme.colors.primary.contrast};
|
|
42
|
-
color: ${props => props.theme.colors.primary.main};
|
|
43
|
-
|
|
44
|
-
.input-file--box--icon {
|
|
45
|
-
background: ${props => props.theme.colors.primary.main};
|
|
46
|
-
color: ${props => props.theme.colors.primary.contrast};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.input-file--files {
|
|
52
|
-
max-height: 280px;
|
|
53
|
-
overflow-y: auto;
|
|
54
|
-
border: 1px solid;
|
|
55
|
-
border-radius: 5px;
|
|
56
|
-
|
|
57
|
-
&--content {
|
|
58
|
-
display: grid;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.error {
|
|
63
|
-
color: tomato;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.total-info {
|
|
67
|
-
font-size: 1em;
|
|
68
|
-
display: grid;
|
|
69
|
-
grid-auto-flow: column;
|
|
70
|
-
justify-content: end;
|
|
71
|
-
align-items: center;
|
|
72
|
-
gap: 0.5em;
|
|
73
|
-
|
|
74
|
-
&--delete {
|
|
75
|
-
display: grid;
|
|
76
|
-
place-content: center;
|
|
77
|
-
height: 100%;
|
|
78
|
-
background: transparent;
|
|
79
|
-
cursor: pointer;
|
|
80
|
-
transition: all 0.3s ease;
|
|
81
|
-
aspect-ratio: 1 / 1;
|
|
82
|
-
border-radius: 50%;
|
|
83
|
-
width: 2em;
|
|
84
|
-
font-size: 0.8em;
|
|
85
|
-
|
|
86
|
-
&:hover {
|
|
87
|
-
background: ${props => props.theme.colors.primary.main};
|
|
88
|
-
color: ${props => props.theme.colors.primary.contrast};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
`;
|
|
93
|
-
|
|
94
|
-
export const FileCardStyle = styled.section`
|
|
95
|
-
display: grid;
|
|
96
|
-
grid-template-columns: 35px 1fr 35px;
|
|
97
|
-
gap: 1em;
|
|
98
|
-
align-items: center;
|
|
99
|
-
padding: 10px;
|
|
100
|
-
background: ${props => props.theme.colors.background.main};
|
|
101
|
-
|
|
102
|
-
&:not(:last-child) {
|
|
103
|
-
border-bottom: 1px dashed;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&:hover {
|
|
107
|
-
.file-card--delete {
|
|
108
|
-
color: ${props => props.theme.colors.primary.main};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
.file-card--image {
|
|
113
|
-
background: ${props => props.theme.colors.primary.main};
|
|
114
|
-
color: ${props => props.theme.colors.primary.contrast};
|
|
115
|
-
width: 32px;
|
|
116
|
-
height: 32px;
|
|
117
|
-
border-radius: 5px;
|
|
118
|
-
display: grid;
|
|
119
|
-
place-content: center;
|
|
120
|
-
border: 1px solid;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.file-card--data {
|
|
124
|
-
display: grid;
|
|
125
|
-
font-size: 0.7em;
|
|
126
|
-
justify-content: start;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.file-card--delete {
|
|
130
|
-
border-radius: 5px;
|
|
131
|
-
display: grid;
|
|
132
|
-
place-content: center;
|
|
133
|
-
width: 32px;
|
|
134
|
-
height: 32px;
|
|
135
|
-
cursor: pointer;
|
|
136
|
-
transition: all 0.3s ease;
|
|
137
|
-
|
|
138
|
-
&:hover {
|
|
139
|
-
background: ${props => props.theme.colors.primary.main};
|
|
140
|
-
color: ${props => props.theme.colors.primary.contrast};
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
`;
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Grid } from '../../../layouts';
|
|
4
|
-
import { Icon, IconNameT } from '../../icon';
|
|
5
|
-
import { Typography } from '../../typography';
|
|
6
|
-
import { Controller } from '../controller';
|
|
7
|
-
import { ControllerGeneratorProps, UnControlledComponentProps } from '../form.types';
|
|
8
|
-
|
|
9
|
-
import { FileCardStyle, InputFileContainerStyle } from './input-file.style';
|
|
10
|
-
|
|
11
|
-
import { formatBytes } from '@polpo/helpers';
|
|
12
|
-
import { FileTypeEnum, useInputHandlers } from '@polpo/hooks';
|
|
13
|
-
|
|
14
|
-
type InputFileProps = {
|
|
15
|
-
label?: string;
|
|
16
|
-
accept?: string;
|
|
17
|
-
multiple?: boolean;
|
|
18
|
-
limitSize?: number;
|
|
19
|
-
errorTimeout?: number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
type InputFileValue = { [key: string]: File };
|
|
23
|
-
|
|
24
|
-
export const InputFile = ({
|
|
25
|
-
name,
|
|
26
|
-
value = {},
|
|
27
|
-
setValue,
|
|
28
|
-
onBlur,
|
|
29
|
-
onFocus,
|
|
30
|
-
className = '',
|
|
31
|
-
style = {},
|
|
32
|
-
autoFocus = false,
|
|
33
|
-
readOnly = false,
|
|
34
|
-
disabled = false,
|
|
35
|
-
placeholder = 'Click to upload or drag and drop',
|
|
36
|
-
autoComplete = 'off',
|
|
37
|
-
accept,
|
|
38
|
-
multiple = false,
|
|
39
|
-
limitSize = 5000000,
|
|
40
|
-
errorTimeout = 3000,
|
|
41
|
-
label,
|
|
42
|
-
/*
|
|
43
|
-
* isDirty = false,
|
|
44
|
-
* isTouched = false,
|
|
45
|
-
* invalid = false,
|
|
46
|
-
* error,
|
|
47
|
-
*/
|
|
48
|
-
}: UnControlledComponentProps<InputFileProps, InputFileValue>) => {
|
|
49
|
-
const [error, setError] = useState<string | null>(null);
|
|
50
|
-
const id = useMemo(() => crypto.randomUUID(), []);
|
|
51
|
-
const { handlers } = useInputHandlers<HTMLInputElement>({
|
|
52
|
-
onBlur,
|
|
53
|
-
onFocus,
|
|
54
|
-
onChange: e => {
|
|
55
|
-
const { files } = e.target;
|
|
56
|
-
files && saveFiles(files);
|
|
57
|
-
},
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
let intervalId: ReturnType<typeof setTimeout> | null = null;
|
|
62
|
-
|
|
63
|
-
if (error !== null) {
|
|
64
|
-
intervalId = setTimeout(() => {
|
|
65
|
-
setError(null);
|
|
66
|
-
}, errorTimeout);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
return () => {
|
|
70
|
-
if (intervalId !== null) {
|
|
71
|
-
clearTimeout(intervalId);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}, [error, errorTimeout]);
|
|
75
|
-
|
|
76
|
-
const saveFiles = (files: FileList) => {
|
|
77
|
-
const finalFiles = multiple ? { ...value } : {};
|
|
78
|
-
|
|
79
|
-
const filesToCheck = multiple ? files.length : 1;
|
|
80
|
-
|
|
81
|
-
for (let i = 0; i < filesToCheck; i++) {
|
|
82
|
-
const file = files.item(i);
|
|
83
|
-
|
|
84
|
-
if (!file) {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (file.size < limitSize) {
|
|
89
|
-
finalFiles[file.name] = file;
|
|
90
|
-
} else {
|
|
91
|
-
setError(`File '${file.name}' size is larger than ${formatBytes(limitSize)}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
setValue(finalFiles);
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
const handleDrop = (e: React.DragEvent<HTMLInputElement>) => {
|
|
99
|
-
e.preventDefault();
|
|
100
|
-
e.stopPropagation();
|
|
101
|
-
|
|
102
|
-
if (e.dataTransfer.files && e.dataTransfer.files.length) {
|
|
103
|
-
saveFiles(e.dataTransfer.files);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const getIconType = (type: FileTypeEnum): IconNameT => {
|
|
108
|
-
const iconTypes: Record<FileTypeEnum, IconNameT> = {
|
|
109
|
-
[FileTypeEnum.PNG]: 'download',
|
|
110
|
-
[FileTypeEnum.PDF]: 'download',
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
return iconTypes[type] ?? 'warning';
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const deleteFile = (file: File) => {
|
|
117
|
-
const prevValue = { ...value };
|
|
118
|
-
delete prevValue[file.name];
|
|
119
|
-
setValue(prevValue);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
const deleteAll = () => {
|
|
123
|
-
setValue({});
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
const totalSize = useMemo(() => Object.values(value).reduce((prev, { size }) => prev + size, 0), [value]);
|
|
127
|
-
|
|
128
|
-
const renderFileToCard = (file: File, key: number) => (
|
|
129
|
-
<FileCardStyle key={key}>
|
|
130
|
-
<section className='file-card--image'>
|
|
131
|
-
<Icon name={getIconType(file.type as FileTypeEnum)} />
|
|
132
|
-
</section>
|
|
133
|
-
<Grid>
|
|
134
|
-
<Typography variant='label' noPadding nowrap>
|
|
135
|
-
{file.name}
|
|
136
|
-
</Typography>
|
|
137
|
-
<Typography noPadding variant='small'>
|
|
138
|
-
{formatBytes(file.size)}
|
|
139
|
-
</Typography>
|
|
140
|
-
</Grid>
|
|
141
|
-
<section className='file-card--delete' onClick={() => deleteFile(file)}>
|
|
142
|
-
<Icon name='trash-can' />
|
|
143
|
-
</section>
|
|
144
|
-
</FileCardStyle>
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
return (
|
|
148
|
-
<InputFileContainerStyle>
|
|
149
|
-
{Boolean(label) && (
|
|
150
|
-
<Typography variant='label-form' htmlFor={id} noPadding>
|
|
151
|
-
{label}
|
|
152
|
-
</Typography>
|
|
153
|
-
)}
|
|
154
|
-
<section className='input-file--box' onDrop={handleDrop}>
|
|
155
|
-
<section className='input-file--box--icon'>
|
|
156
|
-
<Icon name='magnifying-glass' />
|
|
157
|
-
</section>
|
|
158
|
-
<Grid>
|
|
159
|
-
<Typography variant='label-form' htmlFor={id} noPadding weight='bold'>
|
|
160
|
-
{placeholder}
|
|
161
|
-
</Typography>
|
|
162
|
-
<Typography variant='small' noPadding>
|
|
163
|
-
Max size ({formatBytes(limitSize)})
|
|
164
|
-
</Typography>
|
|
165
|
-
</Grid>
|
|
166
|
-
<input
|
|
167
|
-
id={id}
|
|
168
|
-
type='file'
|
|
169
|
-
name={name}
|
|
170
|
-
value=''
|
|
171
|
-
placeholder={placeholder}
|
|
172
|
-
readOnly={readOnly}
|
|
173
|
-
autoFocus={autoFocus}
|
|
174
|
-
disabled={disabled}
|
|
175
|
-
autoComplete={autoComplete}
|
|
176
|
-
className={className}
|
|
177
|
-
style={style}
|
|
178
|
-
accept={accept}
|
|
179
|
-
multiple={multiple}
|
|
180
|
-
title=''
|
|
181
|
-
{...handlers}
|
|
182
|
-
/>
|
|
183
|
-
</section>
|
|
184
|
-
{error !== null && (
|
|
185
|
-
<Typography variant='small' noPadding className='error'>
|
|
186
|
-
{error}
|
|
187
|
-
</Typography>
|
|
188
|
-
)}
|
|
189
|
-
{Object.keys(value).length > 0 && (
|
|
190
|
-
<>
|
|
191
|
-
{multiple && (
|
|
192
|
-
<span className='total-info'>
|
|
193
|
-
<Typography variant='small' noPadding>
|
|
194
|
-
{Object.keys(value).length} files - {formatBytes(totalSize)}
|
|
195
|
-
</Typography>
|
|
196
|
-
<span className='total-info--delete' onClick={deleteAll}>
|
|
197
|
-
<Icon name='trash-can' />
|
|
198
|
-
</span>
|
|
199
|
-
</span>
|
|
200
|
-
)}
|
|
201
|
-
<section className='input-file--files'>
|
|
202
|
-
<section className='input-file--files--content'>{Object.values(value).map(renderFileToCard)}</section>
|
|
203
|
-
</section>
|
|
204
|
-
</>
|
|
205
|
-
)}
|
|
206
|
-
</InputFileContainerStyle>
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
const InputFileController = ({ rules, ...props }: ControllerGeneratorProps<InputFileProps, InputFileValue>) => {
|
|
211
|
-
return <Controller Component={InputFile} defaultValue={{}} inputProps={props} rules={rules} />;
|
|
212
|
-
};
|
|
213
|
-
|
|
214
|
-
InputFile.Controller = InputFileController;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './input-password';
|
|
@@ -1,37 +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 { InputPassword } from './input-password';
|
|
7
|
-
|
|
8
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
-
|
|
10
|
-
const meta: Meta<typeof InputPassword> = {
|
|
11
|
-
title: 'Form/InputPassword',
|
|
12
|
-
component: InputPassword,
|
|
13
|
-
argTypes: {
|
|
14
|
-
...FieldSharedArgTypes,
|
|
15
|
-
...UnControlledComponentArgTypes,
|
|
16
|
-
rightIcon: { table: { disable: true } },
|
|
17
|
-
},
|
|
18
|
-
args: {
|
|
19
|
-
label: 'Password',
|
|
20
|
-
placeholder: 'Password',
|
|
21
|
-
...FieldSharedArgs,
|
|
22
|
-
rightIcon: undefined,
|
|
23
|
-
},
|
|
24
|
-
decorators: [ContainerDecorator],
|
|
25
|
-
render: args => {
|
|
26
|
-
const [value, setValue] = useState('');
|
|
27
|
-
|
|
28
|
-
return <InputPassword {...args} value={value} setValue={setValue} />;
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default meta;
|
|
33
|
-
type Story = StoryObj<typeof InputPassword>;
|
|
34
|
-
|
|
35
|
-
export const Default: Story = {
|
|
36
|
-
args: {},
|
|
37
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Controller, InputFieldProps } from '..';
|
|
4
|
-
import { IconNameT } from '../../icon';
|
|
5
|
-
import { Field } from '../field';
|
|
6
|
-
import { ControllerGeneratorProps, UnControlledComponentProps } from '../form.types';
|
|
7
|
-
|
|
8
|
-
import { useInputHandlers, useToggleValues } from '@polpo/hooks';
|
|
9
|
-
|
|
10
|
-
type InputPasswordProps = InputFieldProps<{
|
|
11
|
-
rightIcon?: never;
|
|
12
|
-
}>;
|
|
13
|
-
|
|
14
|
-
export const InputPassword = ({
|
|
15
|
-
name,
|
|
16
|
-
value,
|
|
17
|
-
setValue,
|
|
18
|
-
onBlur,
|
|
19
|
-
onFocus,
|
|
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<InputPasswordProps, string>) => {
|
|
36
|
-
const id = useMemo(() => crypto.randomUUID(), []);
|
|
37
|
-
const [type, toggle] = useToggleValues<'password' | 'text'>(['password', 'text']);
|
|
38
|
-
const { isFocus, handlers } = useInputHandlers({
|
|
39
|
-
onBlur: onBlur,
|
|
40
|
-
onChange: e => setValue(e.target.value),
|
|
41
|
-
onFocus: onFocus,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const iconName = useMemo<IconNameT>(() => {
|
|
45
|
-
if (type === 'password') return 'eye' as IconNameT;
|
|
46
|
-
|
|
47
|
-
if (type === 'text') return 'eye-hidden' as IconNameT;
|
|
48
|
-
|
|
49
|
-
return 'warning' as IconNameT;
|
|
50
|
-
}, [type]);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Field
|
|
54
|
-
id={id}
|
|
55
|
-
error={error}
|
|
56
|
-
isFocus={isFocus}
|
|
57
|
-
{...fieldProps}
|
|
58
|
-
rightIcon={iconName}
|
|
59
|
-
onClickRightIcon={() => toggle()}
|
|
60
|
-
>
|
|
61
|
-
<input
|
|
62
|
-
id={id}
|
|
63
|
-
type={type}
|
|
64
|
-
name={name}
|
|
65
|
-
className={className}
|
|
66
|
-
style={style}
|
|
67
|
-
value={value}
|
|
68
|
-
autoFocus={autoFocus}
|
|
69
|
-
autoComplete={autoComplete}
|
|
70
|
-
placeholder={placeholder}
|
|
71
|
-
disabled={disabled}
|
|
72
|
-
readOnly={readOnly}
|
|
73
|
-
{...handlers}
|
|
74
|
-
/>
|
|
75
|
-
</Field>
|
|
76
|
-
);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const InputPasswordController = ({ rules, ...props }: ControllerGeneratorProps<InputPasswordProps, string>) => {
|
|
80
|
-
return <Controller Component={InputPassword} defaultValue='' inputProps={props} rules={rules} />;
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
InputPassword.Controller = InputPasswordController;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './radio';
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { ColorVariants, SizeVariants } from '../../../core/variants';
|
|
4
|
-
import { Grid, SectionLayout } from '../../../layouts';
|
|
5
|
-
import { UnControlledComponentArgTypes } from '../form.stories.types';
|
|
6
|
-
|
|
7
|
-
import { Radio } from './radio';
|
|
8
|
-
|
|
9
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof Radio> = {
|
|
12
|
-
title: 'Form/Radio',
|
|
13
|
-
component: Radio,
|
|
14
|
-
argTypes: {
|
|
15
|
-
...UnControlledComponentArgTypes,
|
|
16
|
-
label: { control: 'text' },
|
|
17
|
-
radioValue: { control: false },
|
|
18
|
-
size: { control: 'inline-radio', options: Object.values(SizeVariants) },
|
|
19
|
-
placeholder: { table: { disable: true } },
|
|
20
|
-
color: { control: { type: 'inline-radio', options: Object.values(ColorVariants) } },
|
|
21
|
-
},
|
|
22
|
-
args: {
|
|
23
|
-
label: 'Option A',
|
|
24
|
-
placeholder: undefined,
|
|
25
|
-
},
|
|
26
|
-
render: args => {
|
|
27
|
-
const [value, setValue] = useState('A');
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Grid gap='0.4em'>
|
|
31
|
-
<Radio {...args} name='radio' value={value} radioValue='A' setValue={setValue} />
|
|
32
|
-
<Radio {...args} name='radio' value={value} label='Option B' radioValue='B' setValue={setValue} />
|
|
33
|
-
<Radio {...args} name='radio' value={value} label='Option C' radioValue='C' setValue={setValue} />
|
|
34
|
-
<Radio {...args} name='radio' value={value} label='Option D' radioValue='D' setValue={setValue} />
|
|
35
|
-
<Radio {...args} name='radio' value={value} label='Option E' radioValue='E' setValue={setValue} />
|
|
36
|
-
</Grid>
|
|
37
|
-
);
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default meta;
|
|
42
|
-
type Story = StoryObj<typeof Radio>;
|
|
43
|
-
|
|
44
|
-
export const Default: Story = {
|
|
45
|
-
args: {},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Colors: Story = {
|
|
49
|
-
args: {},
|
|
50
|
-
argTypes: {
|
|
51
|
-
color: { control: false },
|
|
52
|
-
},
|
|
53
|
-
render: args => {
|
|
54
|
-
const [value, setValue] = useState('Primary');
|
|
55
|
-
|
|
56
|
-
return (
|
|
57
|
-
<SectionLayout>
|
|
58
|
-
<Radio {...args} color='primary' value={value} setValue={setValue} radioValue='Primary' label='Primary' />
|
|
59
|
-
<Radio {...args} color='secondary' value={value} setValue={setValue} radioValue='Secondary' label='Secondary' />
|
|
60
|
-
<Radio {...args} color='tertiary' value={value} setValue={setValue} radioValue='Tertiary' label='Tertiary' />
|
|
61
|
-
<Radio {...args} color='info' value={value} setValue={setValue} radioValue='Info' label='Info' />
|
|
62
|
-
<Radio {...args} color='active' value={value} setValue={setValue} radioValue='Active' label='Active' />
|
|
63
|
-
<Radio {...args} color='warning' value={value} setValue={setValue} radioValue='Warning' label='Warning' />
|
|
64
|
-
<Radio {...args} color='alert' value={value} setValue={setValue} radioValue='Alert' label='Alert' />
|
|
65
|
-
</SectionLayout>
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
export const RadioFillStyle = styled.section`
|
|
4
|
-
transition: all 200ms ease-out;
|
|
5
|
-
border-radius: inherit;
|
|
6
|
-
margin: auto;
|
|
7
|
-
width: 0;
|
|
8
|
-
height: 0;
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
export const RadioStyle = styled.section`
|
|
12
|
-
border-radius: 50%;
|
|
13
|
-
background: ${props => props.theme.colors.background.paper};
|
|
14
|
-
transition: all 300ms ease;
|
|
15
|
-
width: 1em;
|
|
16
|
-
height: 1em;
|
|
17
|
-
outline: 2px solid;
|
|
18
|
-
display: flex;
|
|
19
|
-
position: relative;
|
|
20
|
-
padding: 2px;
|
|
21
|
-
|
|
22
|
-
.radio-input {
|
|
23
|
-
position: absolute;
|
|
24
|
-
top: 0;
|
|
25
|
-
left: 0;
|
|
26
|
-
width: 100%;
|
|
27
|
-
height: 100%;
|
|
28
|
-
cursor: pointer;
|
|
29
|
-
opacity: 0;
|
|
30
|
-
z-index: 1;
|
|
31
|
-
}
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
type RadioContainerStyleProps = {
|
|
35
|
-
$color: string;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const RadioContainerStyle = styled.section<RadioContainerStyleProps>`
|
|
39
|
-
display: flex;
|
|
40
|
-
align-items: center;
|
|
41
|
-
gap: 1em;
|
|
42
|
-
width: fit-content;
|
|
43
|
-
|
|
44
|
-
.radio-label {
|
|
45
|
-
cursor: pointer;
|
|
46
|
-
user-select: none;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
${RadioStyle} {
|
|
50
|
-
color: ${props => props.$color};
|
|
51
|
-
|
|
52
|
-
&.is-checked {
|
|
53
|
-
${RadioFillStyle} {
|
|
54
|
-
width: 100%;
|
|
55
|
-
height: 100%;
|
|
56
|
-
background: ${props => props.$color};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
${RadioStyle}:hover,
|
|
62
|
-
&:has(.radio-label:hover) ${RadioStyle} {
|
|
63
|
-
box-shadow: 0 0 0 0.4em ${props => props.$color}88;
|
|
64
|
-
|
|
65
|
-
${RadioFillStyle} {
|
|
66
|
-
width: 20%;
|
|
67
|
-
height: 20%;
|
|
68
|
-
background: ${props => props.$color}88;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
&:is(.is-checked) {
|
|
72
|
-
${RadioFillStyle} {
|
|
73
|
-
width: 80%;
|
|
74
|
-
height: 80%;
|
|
75
|
-
background: ${props => props.$color};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
`;
|