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,79 +0,0 @@
|
|
|
1
|
-
import { Button } from '../../buttons';
|
|
2
|
-
import { ModalBackdrop } from '../modal';
|
|
3
|
-
|
|
4
|
-
import { Menu } from './menu';
|
|
5
|
-
|
|
6
|
-
import { PositionContainer } from '@polpo/helpers';
|
|
7
|
-
import { useModal } from '@polpo/hooks';
|
|
8
|
-
|
|
9
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
10
|
-
|
|
11
|
-
const meta: Meta<typeof Menu> = {
|
|
12
|
-
title: 'Modals/Menu',
|
|
13
|
-
component: Menu,
|
|
14
|
-
argTypes: {
|
|
15
|
-
closeOnClickOutside: { control: 'boolean' },
|
|
16
|
-
transitionDuration: { control: false },
|
|
17
|
-
windowOffset: { control: { type: 'range', min: 0, max: 100 } },
|
|
18
|
-
position: { control: 'inline-radio', options: Object.values(PositionContainer) },
|
|
19
|
-
offset: { control: { type: 'range', min: 0, max: 100 } },
|
|
20
|
-
},
|
|
21
|
-
args: {
|
|
22
|
-
offset: 5,
|
|
23
|
-
windowOffset: 10,
|
|
24
|
-
children: 'Menu content',
|
|
25
|
-
position: PositionContainer.BOTTOM_RIGHT,
|
|
26
|
-
backdrop: ModalBackdrop.TRANSPARENT,
|
|
27
|
-
},
|
|
28
|
-
decorators: [
|
|
29
|
-
(Story, { args }) => {
|
|
30
|
-
const { openModal, closeModal, isOpen, containerRef } = useModal<HTMLButtonElement>();
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<Button width='full' leftIcon={isOpen ? 'door-open' : 'door-closed'} ref={containerRef} onClick={openModal}>
|
|
35
|
-
Menu
|
|
36
|
-
</Button>
|
|
37
|
-
<Story
|
|
38
|
-
args={{
|
|
39
|
-
...args,
|
|
40
|
-
isOpen,
|
|
41
|
-
offset: 10,
|
|
42
|
-
style: { height: 300, minWidth: 200 },
|
|
43
|
-
onClose: closeModal,
|
|
44
|
-
containerRef,
|
|
45
|
-
children: (
|
|
46
|
-
<>
|
|
47
|
-
<Menu.GroupLabel>Checkbox</Menu.GroupLabel>
|
|
48
|
-
<Menu.Option asCheckbox icon='house' disabled label='Option 1' />
|
|
49
|
-
<Menu.Option asCheckbox icon='magnifying-glass' selected label='Option 2' />
|
|
50
|
-
<Menu.Option asCheckbox icon='document' label='Option 3' />
|
|
51
|
-
<Menu.Option asCheckbox icon='spinner' disabled selected label='Option 4' />
|
|
52
|
-
<Menu.Divider />
|
|
53
|
-
<Menu.GroupLabel>Options disabled</Menu.GroupLabel>
|
|
54
|
-
<Menu.Option icon='instagram' label='Option 5' />
|
|
55
|
-
<Menu.Option icon='airplane' disabled label='Option 6' />
|
|
56
|
-
<Menu.Option icon='whatsapp' disabled selected label='Option 7' />
|
|
57
|
-
<Menu.Option icon='order-list' label='Option 8' />
|
|
58
|
-
<Menu.Divider />
|
|
59
|
-
<Menu.GroupLabel>Options</Menu.GroupLabel>
|
|
60
|
-
<Menu.Option icon='thinking' label='Option 9' />
|
|
61
|
-
<Menu.Option icon='game-control' label='Option 10' />
|
|
62
|
-
<Menu.Option icon='bicycle' selected label='Option 11' />
|
|
63
|
-
<Menu.Option icon='link' label='Option 12' />
|
|
64
|
-
</>
|
|
65
|
-
),
|
|
66
|
-
}}
|
|
67
|
-
/>
|
|
68
|
-
</>
|
|
69
|
-
);
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export default meta;
|
|
75
|
-
type Story = StoryObj<typeof Menu>;
|
|
76
|
-
|
|
77
|
-
export const Default: Story = {
|
|
78
|
-
args: {},
|
|
79
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
|
|
3
|
-
import { Modal } from '../modal';
|
|
4
|
-
|
|
5
|
-
export const MenuModalStyle = styled(Modal)`
|
|
6
|
-
border-radius: 0.5em;
|
|
7
|
-
border: 1px solid ${props => props.theme.colors.border.main};
|
|
8
|
-
background: ${props => props.theme.colors.background.main};
|
|
9
|
-
box-shadow: 0 0 25px ${props => props.theme.colors.background.paper};
|
|
10
|
-
user-select: none;
|
|
11
|
-
position: relative;
|
|
12
|
-
overflow-y: auto;
|
|
13
|
-
|
|
14
|
-
.menu-content {
|
|
15
|
-
display: grid;
|
|
16
|
-
gap: 0.2em;
|
|
17
|
-
padding: 0;
|
|
18
|
-
margin: 0;
|
|
19
|
-
list-style: none;
|
|
20
|
-
align-content: start;
|
|
21
|
-
height: 100%;
|
|
22
|
-
position: relative;
|
|
23
|
-
overflow-y: auto;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.divider {
|
|
27
|
-
margin: 0.4em 0;
|
|
28
|
-
color: ${props => props.theme.colors.border.main};
|
|
29
|
-
}
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
export const LabelStyle = styled.li`
|
|
33
|
-
background: ${props => props.theme.colors.background.light};
|
|
34
|
-
color: ${props => props.theme.colors.text.light};
|
|
35
|
-
font-weight: lighter;
|
|
36
|
-
padding: 0.5em 1.2em;
|
|
37
|
-
position: sticky;
|
|
38
|
-
top: 0;
|
|
39
|
-
z-index: 10;
|
|
40
|
-
pointer-events: none;
|
|
41
|
-
`;
|
|
42
|
-
|
|
43
|
-
export const OptionStyle = styled.li`
|
|
44
|
-
padding: 0.2em 1em;
|
|
45
|
-
border-radius: 0.3em;
|
|
46
|
-
transition: all 300ms ease;
|
|
47
|
-
cursor: pointer;
|
|
48
|
-
display: flex;
|
|
49
|
-
align-items: center;
|
|
50
|
-
outline: 0;
|
|
51
|
-
margin: 0 0.2em;
|
|
52
|
-
position: relative;
|
|
53
|
-
|
|
54
|
-
.ripple-effect {
|
|
55
|
-
background: ${props => props.theme.colors.text.main}55;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
&:first-child {
|
|
59
|
-
margin-top: 5px;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.option-icon {
|
|
63
|
-
margin-right: 0.5em;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.menu-checkbox {
|
|
67
|
-
width: 100%;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&.is-disabled {
|
|
71
|
-
opacity: 0.4;
|
|
72
|
-
pointer-events: none;
|
|
73
|
-
cursor: default;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
&:focus,
|
|
77
|
-
&:hover {
|
|
78
|
-
background: ${props => props.theme.colors.background.paper}44;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
&.is-selected {
|
|
82
|
-
background: ${props => props.theme.colors.background.paper};
|
|
83
|
-
|
|
84
|
-
&:focus,
|
|
85
|
-
&:hover {
|
|
86
|
-
background: ${props => props.theme.colors.background.paper}AA;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
export const GroupStyle = styled.li`
|
|
92
|
-
position: relative;
|
|
93
|
-
|
|
94
|
-
.menu-group-content {
|
|
95
|
-
display: grid;
|
|
96
|
-
gap: 0.2em;
|
|
97
|
-
padding: 0;
|
|
98
|
-
margin: 0;
|
|
99
|
-
list-style: none;
|
|
100
|
-
align-content: start;
|
|
101
|
-
position: relative;
|
|
102
|
-
}
|
|
103
|
-
`;
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import React, { RefObject, useCallback, useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
import { Checkbox } from '../../form';
|
|
4
|
-
import { Icon, IconNameT } from '../../icon';
|
|
5
|
-
import { Line } from '../../line';
|
|
6
|
-
import { Ripple } from '../../ripple';
|
|
7
|
-
import { Typography, TypographyProps } from '../../typography';
|
|
8
|
-
import { ModalProps } from '../modal';
|
|
9
|
-
|
|
10
|
-
import { GroupStyle, LabelStyle, MenuModalStyle, OptionStyle } from './menu.style';
|
|
11
|
-
|
|
12
|
-
import { useClassNames } from '@polpo/hooks';
|
|
13
|
-
|
|
14
|
-
type MenuProps = ModalProps & {
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
contentClassName?: string;
|
|
17
|
-
contentStyle?: React.CSSProperties;
|
|
18
|
-
menuContentRef?: RefObject<HTMLUListElement>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Menu = ({
|
|
22
|
-
children,
|
|
23
|
-
isOpen,
|
|
24
|
-
onClose,
|
|
25
|
-
id,
|
|
26
|
-
menuContentRef,
|
|
27
|
-
contentClassName = '',
|
|
28
|
-
contentStyle = {},
|
|
29
|
-
...modalProps
|
|
30
|
-
}: MenuProps) => {
|
|
31
|
-
return (
|
|
32
|
-
<MenuModalStyle {...modalProps} id={`menu-${id}`} isOpen={isOpen} onClose={onClose}>
|
|
33
|
-
<ul className={`menu-content ${contentClassName}`} role='listbox' style={contentStyle} ref={menuContentRef}>
|
|
34
|
-
{children}
|
|
35
|
-
</ul>
|
|
36
|
-
</MenuModalStyle>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export type MenuOptionProps = Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> & {
|
|
41
|
-
id?: string;
|
|
42
|
-
children?: React.ReactNode;
|
|
43
|
-
label?: React.ReactNode;
|
|
44
|
-
disabled?: boolean;
|
|
45
|
-
selected?: boolean;
|
|
46
|
-
className?: string;
|
|
47
|
-
style?: React.CSSProperties;
|
|
48
|
-
asCheckbox?: boolean;
|
|
49
|
-
icon?: IconNameT;
|
|
50
|
-
onClick?: (newValue: boolean) => void;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const MenuOption = ({
|
|
54
|
-
children,
|
|
55
|
-
label = '',
|
|
56
|
-
asCheckbox,
|
|
57
|
-
icon,
|
|
58
|
-
id,
|
|
59
|
-
disabled = false,
|
|
60
|
-
selected = false,
|
|
61
|
-
className = '',
|
|
62
|
-
style = {},
|
|
63
|
-
onClick = () => null,
|
|
64
|
-
...liProps
|
|
65
|
-
}: MenuOptionProps) => {
|
|
66
|
-
const menuOptionClassName = useClassNames({
|
|
67
|
-
[className]: true,
|
|
68
|
-
'is-disabled': disabled,
|
|
69
|
-
'is-selected': selected,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
const handleClick = useCallback(
|
|
73
|
-
(e: React.MouseEvent) => {
|
|
74
|
-
e.stopPropagation();
|
|
75
|
-
|
|
76
|
-
if (!disabled) {
|
|
77
|
-
onClick(!selected);
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
[disabled, onClick, selected],
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const menuOptionContent = useMemo(() => {
|
|
84
|
-
if (children) {
|
|
85
|
-
return children;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (asCheckbox) {
|
|
89
|
-
return (
|
|
90
|
-
<Checkbox
|
|
91
|
-
className='menu-checkbox'
|
|
92
|
-
disabled={disabled}
|
|
93
|
-
value={selected}
|
|
94
|
-
setValue={n => onClick(n)}
|
|
95
|
-
name='option'
|
|
96
|
-
style={{ pointerEvents: 'none' }}
|
|
97
|
-
size='small'
|
|
98
|
-
label={
|
|
99
|
-
<>
|
|
100
|
-
{icon !== undefined && <Icon className='option-icon' name={icon} />}
|
|
101
|
-
<Typography variant='label'>{label}</Typography>
|
|
102
|
-
</>
|
|
103
|
-
}
|
|
104
|
-
/>
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<>
|
|
110
|
-
{icon !== undefined && <Icon className='option-icon' name={icon} />}
|
|
111
|
-
{typeof label === 'string' ? <Typography variant='label'>{label}</Typography> : label}
|
|
112
|
-
</>
|
|
113
|
-
);
|
|
114
|
-
}, [asCheckbox, children, disabled, icon, label, onClick, selected]);
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<OptionStyle
|
|
118
|
-
{...liProps}
|
|
119
|
-
id={id}
|
|
120
|
-
role='option'
|
|
121
|
-
tabIndex={-1}
|
|
122
|
-
aria-selected={selected}
|
|
123
|
-
aria-disabled={disabled}
|
|
124
|
-
onClick={handleClick}
|
|
125
|
-
className={menuOptionClassName}
|
|
126
|
-
style={style}
|
|
127
|
-
>
|
|
128
|
-
<Ripple zIndex={10} />
|
|
129
|
-
{menuOptionContent}
|
|
130
|
-
</OptionStyle>
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
Menu.Option = MenuOption;
|
|
135
|
-
|
|
136
|
-
const Divider = () => {
|
|
137
|
-
return (
|
|
138
|
-
<li>
|
|
139
|
-
<Line className='divider' />
|
|
140
|
-
</li>
|
|
141
|
-
);
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
Menu.Divider = Divider;
|
|
145
|
-
|
|
146
|
-
const Label = ({ children, className = '', ...props }: Omit<TypographyProps, 'variant'>) => {
|
|
147
|
-
return (
|
|
148
|
-
<LabelStyle tabIndex={-1}>
|
|
149
|
-
<Typography {...props} variant='small' className={`menu-group-label ${className}`}>
|
|
150
|
-
{children}
|
|
151
|
-
</Typography>
|
|
152
|
-
</LabelStyle>
|
|
153
|
-
);
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
Menu.GroupLabel = Label;
|
|
157
|
-
|
|
158
|
-
type MenuGroupProps = Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> & {
|
|
159
|
-
children: React.ReactNode;
|
|
160
|
-
label: React.ReactNode;
|
|
161
|
-
className?: string;
|
|
162
|
-
style?: React.CSSProperties;
|
|
163
|
-
contentClassName?: string;
|
|
164
|
-
contentStyle?: React.CSSProperties;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
const Group = ({
|
|
168
|
-
children,
|
|
169
|
-
label,
|
|
170
|
-
className = '',
|
|
171
|
-
style = {},
|
|
172
|
-
contentClassName = '',
|
|
173
|
-
contentStyle = {},
|
|
174
|
-
...props
|
|
175
|
-
}: MenuGroupProps) => {
|
|
176
|
-
return (
|
|
177
|
-
<GroupStyle tabIndex={-1} {...props} className={className} style={style}>
|
|
178
|
-
{label && <Label>{label}</Label>}
|
|
179
|
-
<ul className={`menu-group-content ${contentClassName}`} role='listbox' style={contentStyle}>
|
|
180
|
-
{children}
|
|
181
|
-
</ul>
|
|
182
|
-
</GroupStyle>
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
Menu.Group = Group;
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { useTheme } from 'styled-components';
|
|
3
|
-
|
|
4
|
-
import { BackdropStyle } from './modal.style';
|
|
5
|
-
|
|
6
|
-
import { ModalState, useClassNames } from '@polpo/hooks';
|
|
7
|
-
|
|
8
|
-
export enum ModalBackdrop {
|
|
9
|
-
OPAQUE = 'opaque',
|
|
10
|
-
TRANSPARENT = 'transparent',
|
|
11
|
-
BLUR = 'blur',
|
|
12
|
-
NONE = 'none',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type BackdropProps = {
|
|
16
|
-
opacity?: number;
|
|
17
|
-
backdrop?: `${ModalBackdrop}`;
|
|
18
|
-
zIndex?: React.CSSProperties['zIndex'];
|
|
19
|
-
backdropOnClick?: () => void;
|
|
20
|
-
modalState?: ModalState;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const Backdrop = ({
|
|
24
|
-
opacity = 0.6,
|
|
25
|
-
backdrop = ModalBackdrop.BLUR,
|
|
26
|
-
zIndex,
|
|
27
|
-
backdropOnClick,
|
|
28
|
-
modalState,
|
|
29
|
-
}: BackdropProps) => {
|
|
30
|
-
const theme = useTheme();
|
|
31
|
-
const backdropClassName = useClassNames({
|
|
32
|
-
'backdrop-close': modalState === ModalState.CLOSING || modalState === ModalState.CLOSED,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const backgroundStyles = useMemo(() => {
|
|
36
|
-
const backdropStyles = {
|
|
37
|
-
[ModalBackdrop.OPAQUE]: {
|
|
38
|
-
background: `${theme.colors.background.paper}${(opacity * 255)?.toString(16)}`,
|
|
39
|
-
},
|
|
40
|
-
[ModalBackdrop.TRANSPARENT]: {
|
|
41
|
-
background: 'transparent',
|
|
42
|
-
},
|
|
43
|
-
[ModalBackdrop.BLUR]: {
|
|
44
|
-
background: `${theme.colors.background.paper}${(opacity * 255)?.toString(16)}`,
|
|
45
|
-
backdropFilter: 'blur(5px)',
|
|
46
|
-
},
|
|
47
|
-
[ModalBackdrop.NONE]: {
|
|
48
|
-
display: 'none',
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
return backdropStyles[backdrop] ?? {};
|
|
53
|
-
}, [backdrop, theme.colors.background.paper, opacity]);
|
|
54
|
-
|
|
55
|
-
if (backdrop === ModalBackdrop.NONE) {
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<BackdropStyle
|
|
61
|
-
tabIndex={-1}
|
|
62
|
-
onClick={backdropOnClick}
|
|
63
|
-
className={backdropClassName}
|
|
64
|
-
style={{
|
|
65
|
-
zIndex,
|
|
66
|
-
...backgroundStyles,
|
|
67
|
-
}}
|
|
68
|
-
/>
|
|
69
|
-
);
|
|
70
|
-
};
|