@soyfri/shared-library 1.5.0-beta.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dockerignore +8 -0
- package/.github/workflows/publish.yml +107 -0
- package/.prettierrc +3 -0
- package/.storybook/main.ts +19 -0
- package/.storybook/preview.ts +14 -0
- package/.storybook/vitest.setup.ts +9 -0
- package/Dockerfile +37 -0
- package/build.js +102 -0
- package/chromatic.config.json +5 -0
- package/cleanDirectories.js +40 -0
- package/dist/components/Autocomplete/Autocomplete.cjs +109 -0
- package/dist/components/Autocomplete/Autocomplete.cjs.map +1 -0
- package/dist/components/Autocomplete/Autocomplete.js +109 -0
- package/dist/components/Autocomplete/Autocomplete.js.map +1 -0
- package/dist/styles.css +112 -0
- package/package.json +43 -134
- package/rollup.config.cjs +87 -0
- package/src/components/Autocomplete/Autocomplete.definitions.ts +254 -0
- package/src/components/Autocomplete/Autocomplete.stories.tsx +387 -0
- package/src/components/Autocomplete/Autocomplete.tsx +139 -0
- package/src/components/Autocomplete/index.ts +1 -0
- package/src/components/Avatar/Avatar.stories.tsx +54 -0
- package/src/components/Avatar/Avatar.tsx +143 -0
- package/src/components/Avatar/index.ts +1 -0
- package/src/components/Button/Button.definition.ts +97 -0
- package/src/components/Button/Button.stories.tsx +285 -0
- package/src/components/Button/Button.tsx +67 -0
- package/src/components/Button/index.ts +1 -0
- package/src/components/Card/Card.definition.ts +5 -0
- package/src/components/Card/Card.stories.tsx +32 -0
- package/src/components/Card/Card.tsx +44 -0
- package/src/components/Card/index.ts +1 -0
- package/src/components/Chip/Chip.definitions.ts +167 -0
- package/src/components/Chip/Chip.stories.tsx +265 -0
- package/src/components/Chip/Chip.tsx +61 -0
- package/src/components/Chip/index.ts +1 -0
- package/src/components/Column/Column.tsx +29 -0
- package/src/components/Column/index.ts +1 -0
- package/src/components/DatePicker/DatePicker.definitions.ts +205 -0
- package/src/components/DatePicker/DatePicker.stories.tsx +282 -0
- package/src/components/DatePicker/DatePicker.tsx +165 -0
- package/src/components/DatePicker/index.ts +1 -0
- package/src/components/DateRangePicker/DateRangePicker.definitions.ts +191 -0
- package/src/components/DateRangePicker/DateRangePicker.stories.tsx +252 -0
- package/src/components/DateRangePicker/DateRangePicker.tsx +56 -0
- package/src/components/DateRangePicker/index.ts +1 -0
- package/src/components/DateTimePicker/DateTimePicker.definitions.ts +232 -0
- package/src/components/DateTimePicker/DateTimePicker.stories.tsx +390 -0
- package/src/components/DateTimePicker/DateTimePicker.tsx +191 -0
- package/src/components/DateTimePicker/index.ts +1 -0
- package/src/components/Flyout/Flyout.stories.tsx +274 -0
- package/src/components/Flyout/Flyout.tsx +122 -0
- package/src/components/Flyout/index.ts +1 -0
- package/src/components/Gallery/Gallery.definition.tsx +37 -0
- package/src/components/Gallery/Gallery.stories.tsx +82 -0
- package/src/components/Gallery/Gallery.tsx +118 -0
- package/src/components/Gallery/GalleryLightbox.tsx +170 -0
- package/src/components/Gallery/GalleryMain.tsx +84 -0
- package/src/components/Gallery/GalleryThumbnails.tsx +106 -0
- package/src/components/Gallery/index.ts +1 -0
- package/src/components/Icon/Icon.stories.tsx +54 -0
- package/src/components/Icon/Icon.tsx +94 -0
- package/src/components/Icon/index.ts +2 -0
- package/src/components/Input/Input.definitions.ts +252 -0
- package/src/components/Input/Input.stories.tsx +387 -0
- package/src/components/Input/Input.tsx +186 -0
- package/src/components/Input/index.ts +1 -0
- package/src/components/InputGroup/InputGroup.stories.tsx +136 -0
- package/src/components/InputGroup/InputGroup.tsx +136 -0
- package/src/components/InputGroup/index.ts +1 -0
- package/src/components/MenuButton/MenuButton.stories.tsx +197 -0
- package/src/components/MenuButton/MenuButton.tsx +100 -0
- package/src/components/MenuButton/index.ts +1 -0
- package/src/components/Modal/Modal.stories.tsx +293 -0
- package/src/components/Modal/Modal.tsx +173 -0
- package/src/components/Modal/ModalBody.tsx +16 -0
- package/src/components/Modal/ModalFooter.tsx +61 -0
- package/src/components/Modal/ModalHeader.tsx +18 -0
- package/src/components/Modal/index.ts +1 -0
- package/src/components/Select/Select.definitions.ts +488 -0
- package/src/components/Select/Select.stories.tsx +569 -0
- package/src/components/Select/Select.tsx +468 -0
- package/src/components/Select/index.ts +1 -0
- package/src/components/Stat/Stat.stories.tsx +85 -0
- package/src/components/Stat/Stat.tsx +117 -0
- package/src/components/Stat/index.ts +2 -0
- package/src/components/StatusMessage/StatusMessage.stories.tsx +130 -0
- package/src/components/StatusMessage/StatusMessage.tsx +162 -0
- package/src/components/StatusMessage/index.ts +2 -0
- package/src/components/Stepper/Step.tsx +21 -0
- package/src/components/Stepper/Stepper.definition.ts +75 -0
- package/src/components/Stepper/Stepper.stories.tsx +122 -0
- package/src/components/Stepper/Stepper.tsx +59 -0
- package/src/components/Stepper/index.ts +2 -0
- package/src/components/Table/EmptyTable.png +0 -0
- package/src/components/Table/Table.definition.ts +580 -0
- package/src/components/Table/Table.stories.tsx +853 -0
- package/src/components/Table/Table.tsx +495 -0
- package/src/components/Table/data.ts +134 -0
- package/src/components/Table/exportsUtils.ts +195 -0
- package/src/components/Table/index.ts +3 -0
- package/src/components/Table/types.ts +34 -0
- package/src/components/Tabs/Tab.definition.ts +53 -0
- package/src/components/Tabs/Tab.tsx +19 -0
- package/src/components/Tabs/Tabs.stories.tsx +118 -0
- package/src/components/Tabs/Tabs.tsx +99 -0
- package/src/components/Tabs/_tabUtils.tsx +4 -0
- package/src/components/Tabs/index.ts +2 -0
- package/src/components/Timeline/Timeline.definition.ts +43 -0
- package/src/components/Timeline/Timeline.stories.tsx +108 -0
- package/src/components/Timeline/Timeline.tsx +49 -0
- package/src/components/Timeline/TimelineItem.tsx +31 -0
- package/src/components/Timeline/index.ts +2 -0
- package/src/components/Tooltip/Tooltip.stories.tsx +117 -0
- package/src/components/Tooltip/Tooltip.tsx +58 -0
- package/src/components/Tooltip/index.ts +1 -0
- package/src/hooks/ClipBoard/ClipBoard.stories.tsx +168 -0
- package/src/hooks/ClipBoard/ClipBoard.tsx +131 -0
- package/src/hooks/ClipBoard/ClipboardUnifiedDemo.tsx +111 -0
- package/src/hooks/ClipBoard/index.ts +1 -0
- package/src/index.ts +1 -0
- package/src/styles.css +3 -0
- package/tailwind.config.js +10 -0
- package/tsconfig.json +48 -0
- package/tsup.config.js +41 -0
- package/vite.config.js +132 -0
- package/vitest.config.ts +35 -0
- package/components/Autocomplete/Autocomplete.cjs +0 -132
- package/components/Autocomplete/Autocomplete.cjs.map +0 -1
- package/components/Autocomplete/Autocomplete.js +0 -132
- package/components/Autocomplete/Autocomplete.js.map +0 -1
- /package/{README.md → Readme.md} +0 -0
- /package/{Button-C17mExpd.cjs → dist/Button-C17mExpd.cjs} +0 -0
- /package/{Button-C17mExpd.cjs.map → dist/Button-C17mExpd.cjs.map} +0 -0
- /package/{Button-UkkP-bNw.js → dist/Button-UkkP-bNw.js} +0 -0
- /package/{Button-UkkP-bNw.js.map → dist/Button-UkkP-bNw.js.map} +0 -0
- /package/{DatePicker-BSNboVhN.js → dist/DatePicker-BSNboVhN.js} +0 -0
- /package/{DatePicker-BSNboVhN.js.map → dist/DatePicker-BSNboVhN.js.map} +0 -0
- /package/{DatePicker-BoqxWAhj.cjs → dist/DatePicker-BoqxWAhj.cjs} +0 -0
- /package/{DatePicker-BoqxWAhj.cjs.map → dist/DatePicker-BoqxWAhj.cjs.map} +0 -0
- /package/{Input-DFHs7cJ_.js → dist/Input-DFHs7cJ_.js} +0 -0
- /package/{Input-DFHs7cJ_.js.map → dist/Input-DFHs7cJ_.js.map} +0 -0
- /package/{Input-c8MwNNPg.cjs → dist/Input-c8MwNNPg.cjs} +0 -0
- /package/{Input-c8MwNNPg.cjs.map → dist/Input-c8MwNNPg.cjs.map} +0 -0
- /package/{Select-BO2N56sm.cjs → dist/Select-BO2N56sm.cjs} +0 -0
- /package/{Select-BO2N56sm.cjs.map → dist/Select-BO2N56sm.cjs.map} +0 -0
- /package/{Select-BcLkyHSE.js → dist/Select-BcLkyHSE.js} +0 -0
- /package/{Select-BcLkyHSE.js.map → dist/Select-BcLkyHSE.js.map} +0 -0
- /package/{components → dist/components}/Autocomplete/Autocomplete.d.ts +0 -0
- /package/{components → dist/components}/Autocomplete/Autocomplete.definitions.d.ts +0 -0
- /package/{components → dist/components}/Autocomplete/index.d.ts +0 -0
- /package/{components → dist/components}/Autocomplete.d.ts +0 -0
- /package/{components → dist/components}/Avatar/Avatar.cjs +0 -0
- /package/{components → dist/components}/Avatar/Avatar.cjs.map +0 -0
- /package/{components → dist/components}/Avatar/Avatar.d.ts +0 -0
- /package/{components → dist/components}/Avatar/Avatar.js +0 -0
- /package/{components → dist/components}/Avatar/Avatar.js.map +0 -0
- /package/{components → dist/components}/Avatar/index.d.ts +0 -0
- /package/{components → dist/components}/Avatar.d.ts +0 -0
- /package/{components → dist/components}/Button/Button.cjs +0 -0
- /package/{components → dist/components}/Button/Button.cjs.map +0 -0
- /package/{components → dist/components}/Button/Button.d.ts +0 -0
- /package/{components → dist/components}/Button/Button.definition.d.ts +0 -0
- /package/{components → dist/components}/Button/Button.js +0 -0
- /package/{components → dist/components}/Button/Button.js.map +0 -0
- /package/{components → dist/components}/Button/index.d.ts +0 -0
- /package/{components → dist/components}/Button.d.ts +0 -0
- /package/{components → dist/components}/Card/Card.cjs +0 -0
- /package/{components → dist/components}/Card/Card.cjs.map +0 -0
- /package/{components → dist/components}/Card/Card.d.ts +0 -0
- /package/{components → dist/components}/Card/Card.definition.d.ts +0 -0
- /package/{components → dist/components}/Card/Card.js +0 -0
- /package/{components → dist/components}/Card/Card.js.map +0 -0
- /package/{components → dist/components}/Card/index.d.ts +0 -0
- /package/{components → dist/components}/Card.d.ts +0 -0
- /package/{components → dist/components}/Chip/Chip.cjs +0 -0
- /package/{components → dist/components}/Chip/Chip.cjs.map +0 -0
- /package/{components → dist/components}/Chip/Chip.d.ts +0 -0
- /package/{components → dist/components}/Chip/Chip.definitions.d.ts +0 -0
- /package/{components → dist/components}/Chip/Chip.js +0 -0
- /package/{components → dist/components}/Chip/Chip.js.map +0 -0
- /package/{components → dist/components}/Chip/index.d.ts +0 -0
- /package/{components → dist/components}/Chip.d.ts +0 -0
- /package/{components → dist/components}/Column/Column.cjs +0 -0
- /package/{components → dist/components}/Column/Column.cjs.map +0 -0
- /package/{components → dist/components}/Column/Column.d.ts +0 -0
- /package/{components → dist/components}/Column/Column.js +0 -0
- /package/{components → dist/components}/Column/Column.js.map +0 -0
- /package/{components → dist/components}/Column/index.d.ts +0 -0
- /package/{components → dist/components}/Column.d.ts +0 -0
- /package/{components → dist/components}/DatePicker/DatePicker.cjs +0 -0
- /package/{components → dist/components}/DatePicker/DatePicker.cjs.map +0 -0
- /package/{components → dist/components}/DatePicker/DatePicker.d.ts +0 -0
- /package/{components → dist/components}/DatePicker/DatePicker.definitions.d.ts +0 -0
- /package/{components → dist/components}/DatePicker/DatePicker.js +0 -0
- /package/{components → dist/components}/DatePicker/DatePicker.js.map +0 -0
- /package/{components → dist/components}/DatePicker/index.d.ts +0 -0
- /package/{components → dist/components}/DatePicker.d.ts +0 -0
- /package/{components → dist/components}/DateRangePicker/DateRangePicker.cjs +0 -0
- /package/{components → dist/components}/DateRangePicker/DateRangePicker.cjs.map +0 -0
- /package/{components → dist/components}/DateRangePicker/DateRangePicker.d.ts +0 -0
- /package/{components → dist/components}/DateRangePicker/DateRangePicker.definitions.d.ts +0 -0
- /package/{components → dist/components}/DateRangePicker/DateRangePicker.js +0 -0
- /package/{components → dist/components}/DateRangePicker/DateRangePicker.js.map +0 -0
- /package/{components → dist/components}/DateRangePicker/index.d.ts +0 -0
- /package/{components → dist/components}/DateRangePicker.d.ts +0 -0
- /package/{components → dist/components}/DateTimePicker/DateTimePicker.cjs +0 -0
- /package/{components → dist/components}/DateTimePicker/DateTimePicker.cjs.map +0 -0
- /package/{components → dist/components}/DateTimePicker/DateTimePicker.d.ts +0 -0
- /package/{components → dist/components}/DateTimePicker/DateTimePicker.definitions.d.ts +0 -0
- /package/{components → dist/components}/DateTimePicker/DateTimePicker.js +0 -0
- /package/{components → dist/components}/DateTimePicker/DateTimePicker.js.map +0 -0
- /package/{components → dist/components}/DateTimePicker/index.d.ts +0 -0
- /package/{components → dist/components}/DateTimePicker.d.ts +0 -0
- /package/{components → dist/components}/Flyout/Flyout.cjs +0 -0
- /package/{components → dist/components}/Flyout/Flyout.cjs.map +0 -0
- /package/{components → dist/components}/Flyout/Flyout.d.ts +0 -0
- /package/{components → dist/components}/Flyout/Flyout.js +0 -0
- /package/{components → dist/components}/Flyout/Flyout.js.map +0 -0
- /package/{components → dist/components}/Flyout/index.d.ts +0 -0
- /package/{components → dist/components}/Flyout.d.ts +0 -0
- /package/{components → dist/components}/Gallery/Gallery.cjs +0 -0
- /package/{components → dist/components}/Gallery/Gallery.cjs.map +0 -0
- /package/{components → dist/components}/Gallery/Gallery.d.ts +0 -0
- /package/{components → dist/components}/Gallery/Gallery.definition.d.ts +0 -0
- /package/{components → dist/components}/Gallery/Gallery.js +0 -0
- /package/{components → dist/components}/Gallery/Gallery.js.map +0 -0
- /package/{components → dist/components}/Gallery/GalleryLightbox.d.ts +0 -0
- /package/{components → dist/components}/Gallery/GalleryMain.d.ts +0 -0
- /package/{components → dist/components}/Gallery/GalleryThumbnails.d.ts +0 -0
- /package/{components → dist/components}/Gallery/index.d.ts +0 -0
- /package/{components → dist/components}/Gallery.d.ts +0 -0
- /package/{components → dist/components}/Icon/Icon.cjs +0 -0
- /package/{components → dist/components}/Icon/Icon.cjs.map +0 -0
- /package/{components → dist/components}/Icon/Icon.d.ts +0 -0
- /package/{components → dist/components}/Icon/Icon.js +0 -0
- /package/{components → dist/components}/Icon/Icon.js.map +0 -0
- /package/{components → dist/components}/Icon/index.d.ts +0 -0
- /package/{components → dist/components}/Icon.d.ts +0 -0
- /package/{components → dist/components}/Input/Input.cjs +0 -0
- /package/{components → dist/components}/Input/Input.cjs.map +0 -0
- /package/{components → dist/components}/Input/Input.d.ts +0 -0
- /package/{components → dist/components}/Input/Input.definitions.d.ts +0 -0
- /package/{components → dist/components}/Input/Input.js +0 -0
- /package/{components → dist/components}/Input/Input.js.map +0 -0
- /package/{components → dist/components}/Input/index.d.ts +0 -0
- /package/{components → dist/components}/Input.d.ts +0 -0
- /package/{components → dist/components}/InputGroup/InputGroup.cjs +0 -0
- /package/{components → dist/components}/InputGroup/InputGroup.cjs.map +0 -0
- /package/{components → dist/components}/InputGroup/InputGroup.d.ts +0 -0
- /package/{components → dist/components}/InputGroup/InputGroup.js +0 -0
- /package/{components → dist/components}/InputGroup/InputGroup.js.map +0 -0
- /package/{components → dist/components}/InputGroup/index.d.ts +0 -0
- /package/{components → dist/components}/InputGroup.d.ts +0 -0
- /package/{components → dist/components}/MenuButton/MenuButton.cjs +0 -0
- /package/{components → dist/components}/MenuButton/MenuButton.cjs.map +0 -0
- /package/{components → dist/components}/MenuButton/MenuButton.d.ts +0 -0
- /package/{components → dist/components}/MenuButton/MenuButton.js +0 -0
- /package/{components → dist/components}/MenuButton/MenuButton.js.map +0 -0
- /package/{components → dist/components}/MenuButton/index.d.ts +0 -0
- /package/{components → dist/components}/MenuButton.d.ts +0 -0
- /package/{components → dist/components}/Modal/Modal.cjs +0 -0
- /package/{components → dist/components}/Modal/Modal.cjs.map +0 -0
- /package/{components → dist/components}/Modal/Modal.d.ts +0 -0
- /package/{components → dist/components}/Modal/Modal.js +0 -0
- /package/{components → dist/components}/Modal/Modal.js.map +0 -0
- /package/{components → dist/components}/Modal/ModalBody.d.ts +0 -0
- /package/{components → dist/components}/Modal/ModalFooter.d.ts +0 -0
- /package/{components → dist/components}/Modal/ModalHeader.d.ts +0 -0
- /package/{components → dist/components}/Modal/index.d.ts +0 -0
- /package/{components → dist/components}/Modal.d.ts +0 -0
- /package/{components → dist/components}/Select/Select.cjs +0 -0
- /package/{components → dist/components}/Select/Select.cjs.map +0 -0
- /package/{components → dist/components}/Select/Select.d.ts +0 -0
- /package/{components → dist/components}/Select/Select.definitions.d.ts +0 -0
- /package/{components → dist/components}/Select/Select.js +0 -0
- /package/{components → dist/components}/Select/Select.js.map +0 -0
- /package/{components → dist/components}/Select/index.d.ts +0 -0
- /package/{components → dist/components}/Select.d.ts +0 -0
- /package/{components → dist/components}/Stat/Stat.cjs +0 -0
- /package/{components → dist/components}/Stat/Stat.cjs.map +0 -0
- /package/{components → dist/components}/Stat/Stat.d.ts +0 -0
- /package/{components → dist/components}/Stat/Stat.js +0 -0
- /package/{components → dist/components}/Stat/Stat.js.map +0 -0
- /package/{components → dist/components}/Stat/index.d.ts +0 -0
- /package/{components → dist/components}/Stat.d.ts +0 -0
- /package/{components → dist/components}/StatusMessage/StatusMessage.cjs +0 -0
- /package/{components → dist/components}/StatusMessage/StatusMessage.cjs.map +0 -0
- /package/{components → dist/components}/StatusMessage/StatusMessage.d.ts +0 -0
- /package/{components → dist/components}/StatusMessage/StatusMessage.js +0 -0
- /package/{components → dist/components}/StatusMessage/StatusMessage.js.map +0 -0
- /package/{components → dist/components}/StatusMessage/index.d.ts +0 -0
- /package/{components → dist/components}/StatusMessage.d.ts +0 -0
- /package/{components → dist/components}/Stepper/Step.d.ts +0 -0
- /package/{components → dist/components}/Stepper/Stepper.cjs +0 -0
- /package/{components → dist/components}/Stepper/Stepper.cjs.map +0 -0
- /package/{components → dist/components}/Stepper/Stepper.d.ts +0 -0
- /package/{components → dist/components}/Stepper/Stepper.definition.d.ts +0 -0
- /package/{components → dist/components}/Stepper/Stepper.js +0 -0
- /package/{components → dist/components}/Stepper/Stepper.js.map +0 -0
- /package/{components → dist/components}/Stepper/index.d.ts +0 -0
- /package/{components → dist/components}/Stepper.d.ts +0 -0
- /package/{components → dist/components}/Table/Table.cjs +0 -0
- /package/{components → dist/components}/Table/Table.cjs.map +0 -0
- /package/{components → dist/components}/Table/Table.d.ts +0 -0
- /package/{components → dist/components}/Table/Table.definition.d.ts +0 -0
- /package/{components → dist/components}/Table/Table.js +0 -0
- /package/{components → dist/components}/Table/Table.js.map +0 -0
- /package/{components → dist/components}/Table/data.d.ts +0 -0
- /package/{components → dist/components}/Table/exportsUtils.d.ts +0 -0
- /package/{components → dist/components}/Table/index.d.ts +0 -0
- /package/{components → dist/components}/Table/types.d.ts +0 -0
- /package/{components → dist/components}/Table.d.ts +0 -0
- /package/{components → dist/components}/Tabs/Tab.d.ts +0 -0
- /package/{components → dist/components}/Tabs/Tab.definition.d.ts +0 -0
- /package/{components → dist/components}/Tabs/Tabs.cjs +0 -0
- /package/{components → dist/components}/Tabs/Tabs.cjs.map +0 -0
- /package/{components → dist/components}/Tabs/Tabs.d.ts +0 -0
- /package/{components → dist/components}/Tabs/Tabs.js +0 -0
- /package/{components → dist/components}/Tabs/Tabs.js.map +0 -0
- /package/{components → dist/components}/Tabs/_tabUtils.d.ts +0 -0
- /package/{components → dist/components}/Tabs/index.d.ts +0 -0
- /package/{components → dist/components}/Tabs.d.ts +0 -0
- /package/{components → dist/components}/Timeline/Timeline.cjs +0 -0
- /package/{components → dist/components}/Timeline/Timeline.cjs.map +0 -0
- /package/{components → dist/components}/Timeline/Timeline.d.ts +0 -0
- /package/{components → dist/components}/Timeline/Timeline.definition.d.ts +0 -0
- /package/{components → dist/components}/Timeline/Timeline.js +0 -0
- /package/{components → dist/components}/Timeline/Timeline.js.map +0 -0
- /package/{components → dist/components}/Timeline/TimelineItem.d.ts +0 -0
- /package/{components → dist/components}/Timeline/index.d.ts +0 -0
- /package/{components → dist/components}/Timeline.d.ts +0 -0
- /package/{components → dist/components}/Tooltip/Tooltip.cjs +0 -0
- /package/{components → dist/components}/Tooltip/Tooltip.cjs.map +0 -0
- /package/{components → dist/components}/Tooltip/Tooltip.d.ts +0 -0
- /package/{components → dist/components}/Tooltip/Tooltip.js +0 -0
- /package/{components → dist/components}/Tooltip/Tooltip.js.map +0 -0
- /package/{components → dist/components}/Tooltip/index.d.ts +0 -0
- /package/{components → dist/components}/Tooltip.d.ts +0 -0
- /package/{hooks → dist/hooks}/ClipBoard/ClipBoard.cjs +0 -0
- /package/{hooks → dist/hooks}/ClipBoard/ClipBoard.cjs.map +0 -0
- /package/{hooks → dist/hooks}/ClipBoard/ClipBoard.d.ts +0 -0
- /package/{hooks → dist/hooks}/ClipBoard/ClipBoard.js +0 -0
- /package/{hooks → dist/hooks}/ClipBoard/ClipBoard.js.map +0 -0
- /package/{hooks → dist/hooks}/ClipBoard/ClipboardUnifiedDemo.d.ts +0 -0
- /package/{hooks → dist/hooks}/ClipBoard/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/ClipBoard.d.ts +0 -0
- /package/{index.cjs → dist/index.cjs} +0 -0
- /package/{index.cjs.map → dist/index.cjs.map} +0 -0
- /package/{index.css → dist/index.css} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{index.js.map → dist/index.js.map} +0 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import Gallery from "./Gallery";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import { DefaultGalleryDefinition } from "./Gallery.definition";
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Gallery> = {
|
|
6
|
+
title: "Components/Gallery",
|
|
7
|
+
component: Gallery,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "centered"
|
|
10
|
+
},
|
|
11
|
+
tags: ["autodocs"]
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
type Story = StoryObj<typeof Gallery>;
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
export const Default: Story = {
|
|
21
|
+
args: {
|
|
22
|
+
maxWidth: "600px",
|
|
23
|
+
items: [
|
|
24
|
+
{
|
|
25
|
+
type: "image",
|
|
26
|
+
url: "https://images.unsplash.com/photo-1506744038136-46273834b3fb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80",
|
|
27
|
+
title: "Image 1",
|
|
28
|
+
thumbnail: "https://images.unsplash.com/photo-1506744038136-46273834b3fb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "image",
|
|
32
|
+
url: "https://images.unsplash.com/photo-1511765224389-37f0e77cf0eb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80",
|
|
33
|
+
title: "Image 2",
|
|
34
|
+
thumbnail: "https://images.unsplash.com/photo-1511765224389-37f0e77cf0eb?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: "image",
|
|
38
|
+
url: "https://images.unsplash.com/photo-1500534623283-312aade485b7?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80",
|
|
39
|
+
title: "Image 3",
|
|
40
|
+
thumbnail: "https://images.unsplash.com/photo-1500534623283-312aade485b7?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "video",
|
|
44
|
+
url: "https://www.w3schools.com/html/mov_bbb.mp4",
|
|
45
|
+
title: "Video 1",
|
|
46
|
+
thumbnail: "https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: "image",
|
|
50
|
+
url: "https://images.unsplash.com/photo-1494526585095-c41746248156?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80",
|
|
51
|
+
title: "Image 4",
|
|
52
|
+
thumbnail: "https://images.unsplash.com/photo-1494526585095-c41746248156?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1170&q=80"
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
render: (args) => (
|
|
59
|
+
|
|
60
|
+
<Gallery {...args} />
|
|
61
|
+
|
|
62
|
+
),
|
|
63
|
+
parameters: {
|
|
64
|
+
docs: {
|
|
65
|
+
description: {
|
|
66
|
+
story: "Ejemplo básico de Gallery, permite ver imagenes y videos"
|
|
67
|
+
},
|
|
68
|
+
source: {
|
|
69
|
+
code: DefaultGalleryDefinition
|
|
70
|
+
},
|
|
71
|
+
argTypes: {
|
|
72
|
+
maxWidth: { description: 'Permite ajustar el maxwidht de el componente gallery' },
|
|
73
|
+
items: { control: false, description: `Array de objetos con la información de las imágenes y videos a mostrar, la estructura de los objetos es la siguiente : {
|
|
74
|
+
type: "image" | "video",
|
|
75
|
+
url: string,
|
|
76
|
+
title: string,
|
|
77
|
+
thumbnail: string
|
|
78
|
+
}` }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect } from "react";
|
|
2
|
+
import { Stack, useMediaQuery } from "@mui/material";
|
|
3
|
+
import { GalleryThumbnails } from "./GalleryThumbnails";
|
|
4
|
+
import { GalleryMain } from "./GalleryMain";
|
|
5
|
+
import { GalleryLightbox } from "./GalleryLightbox";
|
|
6
|
+
|
|
7
|
+
export interface Props {
|
|
8
|
+
items: Array<{
|
|
9
|
+
url: string;
|
|
10
|
+
type: "image" | "video" | string;
|
|
11
|
+
title: string;
|
|
12
|
+
thumbnail: string;
|
|
13
|
+
}>;
|
|
14
|
+
maxWidth?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export const Gallery:React.FC<Props> = ({ items, maxWidth='600px' }: Props) => {
|
|
19
|
+
const isMobile = useMediaQuery("(max-width:700px)");
|
|
20
|
+
const [selectedIdx, setSelectedIdx] = useState(0);
|
|
21
|
+
const [openLightbox, setOpenLightbox] = useState(false);
|
|
22
|
+
const [zoom, setZoom] = useState(1);
|
|
23
|
+
const [rotation, setRotation] = useState(0);
|
|
24
|
+
const videoRef = useRef<HTMLVideoElement | null>(null);
|
|
25
|
+
|
|
26
|
+
const [thumbStartIdx, setThumbStartIdx] = useState(0);
|
|
27
|
+
const THUMB_VISIBLE_COUNT = isMobile ? 3 : 5;
|
|
28
|
+
|
|
29
|
+
// Flechas para miniaturas
|
|
30
|
+
const handleThumbUp = () => {
|
|
31
|
+
setThumbStartIdx((prev) => Math.max(0, prev - 1));
|
|
32
|
+
};
|
|
33
|
+
const handleThumbDown = () => {
|
|
34
|
+
setThumbStartIdx((prev) =>
|
|
35
|
+
Math.min(items.length - THUMB_VISIBLE_COUNT, prev + 1)
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Navegación entre imágenes
|
|
40
|
+
const handlePrev = () => {
|
|
41
|
+
setSelectedIdx((idx) => (idx === 0 ? items.length - 1 : idx - 1));
|
|
42
|
+
};
|
|
43
|
+
const handleNext = () => {
|
|
44
|
+
setSelectedIdx((idx) =>
|
|
45
|
+
idx === items.length - 1 ? 0 : idx + 1
|
|
46
|
+
);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Acciones de teclado
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!openLightbox) return;
|
|
52
|
+
const handleKey = (e: KeyboardEvent) => {
|
|
53
|
+
switch (e.key) {
|
|
54
|
+
case "ArrowLeft":
|
|
55
|
+
handlePrev();
|
|
56
|
+
break;
|
|
57
|
+
case "ArrowRight":
|
|
58
|
+
handleNext();
|
|
59
|
+
break;
|
|
60
|
+
case "Escape":
|
|
61
|
+
setOpenLightbox(false);
|
|
62
|
+
break;
|
|
63
|
+
default:
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
window.addEventListener("keydown", handleKey);
|
|
68
|
+
return () => window.removeEventListener("keydown", handleKey);
|
|
69
|
+
}, [openLightbox, items.length]);
|
|
70
|
+
|
|
71
|
+
// Reset zoom/rotación y autoplay video
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (
|
|
74
|
+
openLightbox &&
|
|
75
|
+
items[selectedIdx]?.type === "video" &&
|
|
76
|
+
videoRef.current
|
|
77
|
+
) {
|
|
78
|
+
videoRef.current.currentTime = 0;
|
|
79
|
+
videoRef.current.play();
|
|
80
|
+
}
|
|
81
|
+
setZoom(1);
|
|
82
|
+
setRotation(0);
|
|
83
|
+
}, [openLightbox, selectedIdx, items]);
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Stack direction={isMobile ? "column" : "row"} gap={3} sx={{ maxWidth: maxWidth, mx: "auto", minHeight: 300 }}>
|
|
87
|
+
<GalleryThumbnails
|
|
88
|
+
items={items}
|
|
89
|
+
selectedIdx={selectedIdx}
|
|
90
|
+
onSelect={setSelectedIdx}
|
|
91
|
+
thumbStartIdx={thumbStartIdx}
|
|
92
|
+
THUMB_VISIBLE_COUNT={THUMB_VISIBLE_COUNT}
|
|
93
|
+
handleThumbUp={handleThumbUp}
|
|
94
|
+
handleThumbDown={handleThumbDown}
|
|
95
|
+
isMobile={isMobile}
|
|
96
|
+
/>
|
|
97
|
+
<GalleryMain
|
|
98
|
+
item={items[selectedIdx]}
|
|
99
|
+
onOpenLightbox={() => setOpenLightbox(true)}
|
|
100
|
+
isMobile={isMobile}
|
|
101
|
+
/>
|
|
102
|
+
<GalleryLightbox
|
|
103
|
+
open={openLightbox}
|
|
104
|
+
onClose={() => setOpenLightbox(false)}
|
|
105
|
+
item={items[selectedIdx]}
|
|
106
|
+
handlePrev={handlePrev}
|
|
107
|
+
handleNext={handleNext}
|
|
108
|
+
zoom={zoom}
|
|
109
|
+
setZoom={setZoom}
|
|
110
|
+
rotation={rotation}
|
|
111
|
+
setRotation={setRotation}
|
|
112
|
+
videoRef={videoRef}
|
|
113
|
+
/>
|
|
114
|
+
</Stack>
|
|
115
|
+
);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default Gallery;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
Dialog,
|
|
4
|
+
DialogContent,
|
|
5
|
+
DialogActions,
|
|
6
|
+
Stack,
|
|
7
|
+
IconButton,
|
|
8
|
+
Box,
|
|
9
|
+
Typography,
|
|
10
|
+
} from "@mui/material";
|
|
11
|
+
import ArrowBackIosNewIcon from "@mui/icons-material/ArrowBackIosNew";
|
|
12
|
+
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
|
|
13
|
+
import ZoomInIcon from "@mui/icons-material/ZoomIn";
|
|
14
|
+
import ZoomOutIcon from "@mui/icons-material/ZoomOut";
|
|
15
|
+
import RotateLeftIcon from "@mui/icons-material/RotateLeft";
|
|
16
|
+
import RotateRightIcon from "@mui/icons-material/RotateRight";
|
|
17
|
+
import RestartAltIcon from "@mui/icons-material/RestartAlt";
|
|
18
|
+
import CloseIcon from "@mui/icons-material/Close";
|
|
19
|
+
import { Button } from "../Button";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
interface Props {
|
|
23
|
+
open: boolean;
|
|
24
|
+
onClose: () => void;
|
|
25
|
+
item: {
|
|
26
|
+
url: string;
|
|
27
|
+
type: "image" | "video" | string;
|
|
28
|
+
title: string;
|
|
29
|
+
thumbnail: string;
|
|
30
|
+
};
|
|
31
|
+
handlePrev: () => void;
|
|
32
|
+
handleNext: () => void;
|
|
33
|
+
zoom: number;
|
|
34
|
+
setZoom: React.Dispatch<React.SetStateAction<number>>;
|
|
35
|
+
rotation: number;
|
|
36
|
+
setRotation: React.Dispatch<React.SetStateAction<number>>;
|
|
37
|
+
videoRef?: React.RefObject<HTMLVideoElement | null>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const GalleryLightbox = ({
|
|
41
|
+
open,
|
|
42
|
+
onClose,
|
|
43
|
+
item,
|
|
44
|
+
handlePrev,
|
|
45
|
+
handleNext,
|
|
46
|
+
zoom,
|
|
47
|
+
setZoom,
|
|
48
|
+
rotation,
|
|
49
|
+
setRotation,
|
|
50
|
+
videoRef,
|
|
51
|
+
}: Props) => (
|
|
52
|
+
<Dialog open={open} onClose={onClose} fullWidth maxWidth="lg">
|
|
53
|
+
<DialogContent
|
|
54
|
+
sx={{
|
|
55
|
+
minHeight: 431,
|
|
56
|
+
display: "flex",
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
gap: 2,
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
<Stack direction="row" justifyContent="space-between" alignItems="center" width="100%">
|
|
64
|
+
<IconButton onClick={handlePrev}>
|
|
65
|
+
<ArrowBackIosNewIcon />
|
|
66
|
+
</IconButton>
|
|
67
|
+
<Typography variant="subtitle1" fontWeight={600} sx={{ flex: 1, textAlign: "center" }}>
|
|
68
|
+
{item.title}
|
|
69
|
+
</Typography>
|
|
70
|
+
<IconButton onClick={handleNext}>
|
|
71
|
+
<ArrowForwardIosIcon />
|
|
72
|
+
</IconButton>
|
|
73
|
+
</Stack>
|
|
74
|
+
{item.type === "video" ? (
|
|
75
|
+
<Box
|
|
76
|
+
component="video"
|
|
77
|
+
key={item.url}
|
|
78
|
+
ref={videoRef}
|
|
79
|
+
src={item.url}
|
|
80
|
+
controls
|
|
81
|
+
autoPlay
|
|
82
|
+
sx={{
|
|
83
|
+
width: "100%",
|
|
84
|
+
maxWidth: "900px",
|
|
85
|
+
maxHeight: "70vh",
|
|
86
|
+
objectFit: "contain",
|
|
87
|
+
bgcolor: "#000",
|
|
88
|
+
borderRadius: 1,
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
) : (
|
|
92
|
+
<Box
|
|
93
|
+
component="img"
|
|
94
|
+
src={item.url}
|
|
95
|
+
alt={item.title}
|
|
96
|
+
sx={{
|
|
97
|
+
transform: `scale(${zoom}) rotate(${rotation}deg)`,
|
|
98
|
+
transition: "transform 0.2s ease",
|
|
99
|
+
width: "100%",
|
|
100
|
+
maxWidth: "900px",
|
|
101
|
+
maxHeight: "70vh",
|
|
102
|
+
objectFit: "contain",
|
|
103
|
+
borderRadius: 1,
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
107
|
+
</DialogContent>
|
|
108
|
+
<DialogActions
|
|
109
|
+
sx={{
|
|
110
|
+
display: "flex",
|
|
111
|
+
justifyContent: item.type === 'image' ? "space-between" : "end",
|
|
112
|
+
flexWrap: "wrap",
|
|
113
|
+
gap: 1,
|
|
114
|
+
}}
|
|
115
|
+
>
|
|
116
|
+
|
|
117
|
+
{item.type === 'image' && <>
|
|
118
|
+
<Stack direction="row" spacing={1}>
|
|
119
|
+
<Button
|
|
120
|
+
variant="outlined"
|
|
121
|
+
startIcon={<ZoomInIcon />}
|
|
122
|
+
onClick={() => setZoom((z) => z + 0.25)}
|
|
123
|
+
>
|
|
124
|
+
Zoom +
|
|
125
|
+
</Button>
|
|
126
|
+
<Button
|
|
127
|
+
variant="outlined"
|
|
128
|
+
startIcon={<ZoomOutIcon />}
|
|
129
|
+
onClick={() => setZoom((z) => Math.max(0.25, z - 0.25))}
|
|
130
|
+
>
|
|
131
|
+
Zoom −
|
|
132
|
+
</Button>
|
|
133
|
+
</Stack>
|
|
134
|
+
<Stack direction="row" spacing={1}>
|
|
135
|
+
<Button
|
|
136
|
+
variant="outlined"
|
|
137
|
+
onClick={() => setRotation((r) => r - 90)}
|
|
138
|
+
>
|
|
139
|
+
<RotateLeftIcon />
|
|
140
|
+
</Button>
|
|
141
|
+
<Button
|
|
142
|
+
variant="outlined"
|
|
143
|
+
onClick={() => setRotation((r) => r + 90)}
|
|
144
|
+
>
|
|
145
|
+
<RotateRightIcon />
|
|
146
|
+
</Button>
|
|
147
|
+
</Stack>
|
|
148
|
+
<Button
|
|
149
|
+
variant="outlined"
|
|
150
|
+
startIcon={<RestartAltIcon />}
|
|
151
|
+
onClick={() => {
|
|
152
|
+
setZoom(1);
|
|
153
|
+
setRotation(0);
|
|
154
|
+
}}
|
|
155
|
+
>
|
|
156
|
+
Reset
|
|
157
|
+
</Button>
|
|
158
|
+
|
|
159
|
+
</>
|
|
160
|
+
}
|
|
161
|
+
<Button
|
|
162
|
+
variant="contained"
|
|
163
|
+
startIcon={<CloseIcon />}
|
|
164
|
+
onClick={onClose}
|
|
165
|
+
>
|
|
166
|
+
Cerrar
|
|
167
|
+
</Button>
|
|
168
|
+
</DialogActions>
|
|
169
|
+
</Dialog >
|
|
170
|
+
);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, IconButton } from "@mui/material";
|
|
3
|
+
import FullscreenIcon from "@mui/icons-material/Fullscreen";
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
item: {
|
|
7
|
+
url: string;
|
|
8
|
+
type: "image" | "video" | string;
|
|
9
|
+
title: string;
|
|
10
|
+
thumbnail: string;
|
|
11
|
+
};
|
|
12
|
+
onOpenLightbox: () => void;
|
|
13
|
+
isMobile: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const GalleryMain = ({ item, onOpenLightbox, isMobile }: Props) => (
|
|
17
|
+
<Box
|
|
18
|
+
sx={{
|
|
19
|
+
width: isMobile ? "80%" : '100%',
|
|
20
|
+
maxHeight: 431,
|
|
21
|
+
maxWidth: isMobile ? "80%" : '100%',
|
|
22
|
+
display: "flex",
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
position: "relative",
|
|
26
|
+
borderRadius: 1,
|
|
27
|
+
bgcolor: "#f8f9fa",
|
|
28
|
+
overflow: "hidden",
|
|
29
|
+
mx: "auto",
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
<Box
|
|
33
|
+
sx={{
|
|
34
|
+
width: "100%",
|
|
35
|
+
height: "100%",
|
|
36
|
+
cursor: "pointer",
|
|
37
|
+
display: "flex",
|
|
38
|
+
alignItems: "center",
|
|
39
|
+
justifyContent: "center",
|
|
40
|
+
}}
|
|
41
|
+
onClick={onOpenLightbox}
|
|
42
|
+
>
|
|
43
|
+
{item.type === "video" ? (
|
|
44
|
+
<Box
|
|
45
|
+
component="video"
|
|
46
|
+
controls
|
|
47
|
+
src={item.url}
|
|
48
|
+
sx={{
|
|
49
|
+
width: "100%",
|
|
50
|
+
height: "100%",
|
|
51
|
+
objectFit: "contain",
|
|
52
|
+
bgcolor: "#000",
|
|
53
|
+
borderRadius: 1,
|
|
54
|
+
}}
|
|
55
|
+
/>
|
|
56
|
+
) : (
|
|
57
|
+
<Box
|
|
58
|
+
component="img"
|
|
59
|
+
src={item.url}
|
|
60
|
+
alt={item.title}
|
|
61
|
+
sx={{
|
|
62
|
+
width: "100%",
|
|
63
|
+
height: "100%",
|
|
64
|
+
objectFit: "contain",
|
|
65
|
+
borderRadius: 1,
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
)}
|
|
69
|
+
</Box>
|
|
70
|
+
<IconButton
|
|
71
|
+
onClick={onOpenLightbox}
|
|
72
|
+
sx={{
|
|
73
|
+
position: "absolute",
|
|
74
|
+
top: 16,
|
|
75
|
+
right: 16,
|
|
76
|
+
bgcolor: "#1976d2",
|
|
77
|
+
"&:hover": { bgcolor: "#1565c0" },
|
|
78
|
+
boxShadow: 2,
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
81
|
+
<FullscreenIcon sx={{ color: "#fff" }} />
|
|
82
|
+
</IconButton>
|
|
83
|
+
</Box>
|
|
84
|
+
);
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Box, IconButton } from "@mui/material";
|
|
3
|
+
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
4
|
+
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
5
|
+
import KeyboardArrowLeftIcon from "@mui/icons-material/KeyboardArrowLeft";
|
|
6
|
+
import KeyboardArrowRightIcon from "@mui/icons-material/KeyboardArrowRight";
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
interface Props {
|
|
10
|
+
items: Array<{
|
|
11
|
+
url: string;
|
|
12
|
+
type: string;
|
|
13
|
+
title: string;
|
|
14
|
+
thumbnail: string;
|
|
15
|
+
}>;
|
|
16
|
+
selectedIdx: number;
|
|
17
|
+
onSelect: (idx: number) => void;
|
|
18
|
+
thumbStartIdx: number;
|
|
19
|
+
THUMB_VISIBLE_COUNT: number;
|
|
20
|
+
handleThumbUp: () => void;
|
|
21
|
+
handleThumbDown: () => void;
|
|
22
|
+
isMobile: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const GalleryThumbnails = ({
|
|
26
|
+
items,
|
|
27
|
+
selectedIdx,
|
|
28
|
+
onSelect,
|
|
29
|
+
thumbStartIdx,
|
|
30
|
+
THUMB_VISIBLE_COUNT,
|
|
31
|
+
handleThumbUp,
|
|
32
|
+
handleThumbDown,
|
|
33
|
+
isMobile,
|
|
34
|
+
}: Props) => (
|
|
35
|
+
<Box
|
|
36
|
+
sx={{
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: isMobile ? "row" : "column",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
minWidth: 70,
|
|
41
|
+
width: 70,
|
|
42
|
+
borderRadius: 1,
|
|
43
|
+
bgcolor: "#f8f9fa",
|
|
44
|
+
boxSizing: "border-box",
|
|
45
|
+
py: 1,
|
|
46
|
+
mb: isMobile ? 2 : 0,
|
|
47
|
+
px: isMobile ? 1 : 0,
|
|
48
|
+
}}
|
|
49
|
+
>
|
|
50
|
+
<IconButton
|
|
51
|
+
size="small"
|
|
52
|
+
onClick={handleThumbUp}
|
|
53
|
+
disabled={thumbStartIdx === 0}
|
|
54
|
+
sx={{ mb: isMobile ? 0 : 1, mr: isMobile ? 1 : 0 }}
|
|
55
|
+
>
|
|
56
|
+
{isMobile ? <KeyboardArrowLeftIcon /> : <KeyboardArrowUpIcon />}
|
|
57
|
+
</IconButton>
|
|
58
|
+
{items
|
|
59
|
+
.slice(thumbStartIdx, thumbStartIdx + THUMB_VISIBLE_COUNT)
|
|
60
|
+
.map((item, idx) => {
|
|
61
|
+
const realIdx = thumbStartIdx + idx;
|
|
62
|
+
return (
|
|
63
|
+
<Box
|
|
64
|
+
key={realIdx}
|
|
65
|
+
onClick={() => onSelect(realIdx)}
|
|
66
|
+
sx={{
|
|
67
|
+
cursor: "pointer",
|
|
68
|
+
width: 60,
|
|
69
|
+
height: 60,
|
|
70
|
+
borderRadius: 1,
|
|
71
|
+
border:
|
|
72
|
+
selectedIdx === realIdx
|
|
73
|
+
? "2px solid #1976d2"
|
|
74
|
+
: "2px solid #eee",
|
|
75
|
+
overflow: "hidden",
|
|
76
|
+
bgcolor: "#eee",
|
|
77
|
+
display: "flex",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
justifyContent: "center",
|
|
80
|
+
flexShrink: 0,
|
|
81
|
+
m: isMobile ? "0 4px" : "4px 0",
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Box
|
|
85
|
+
component="img"
|
|
86
|
+
src={item.thumbnail}
|
|
87
|
+
alt={item.title}
|
|
88
|
+
sx={{
|
|
89
|
+
width: "100%",
|
|
90
|
+
height: "100%",
|
|
91
|
+
objectFit: "cover",
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
</Box>
|
|
95
|
+
);
|
|
96
|
+
})}
|
|
97
|
+
<IconButton
|
|
98
|
+
size="small"
|
|
99
|
+
onClick={handleThumbDown}
|
|
100
|
+
disabled={thumbStartIdx + THUMB_VISIBLE_COUNT >= items.length}
|
|
101
|
+
sx={{ mt: isMobile ? 0 : 1, ml: isMobile ? 1 : 0 }}
|
|
102
|
+
>
|
|
103
|
+
{isMobile ? <KeyboardArrowRightIcon /> : <KeyboardArrowDownIcon />}
|
|
104
|
+
</IconButton>
|
|
105
|
+
</Box>
|
|
106
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {default as Gallery } from './Gallery';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Icon } from './Icon';
|
|
3
|
+
import NotificationsIcon from '@mui/icons-material/Notifications';
|
|
4
|
+
import SettingsIcon from '@mui/icons-material/Settings';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Icon> = {
|
|
7
|
+
title: 'Components/Icon',
|
|
8
|
+
component: Icon,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof Icon>;
|
|
17
|
+
|
|
18
|
+
export const Default: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
children: <NotificationsIcon />
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const Outlined: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
children: <SettingsIcon />,
|
|
27
|
+
outlined: true,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Spinning: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
children: <SettingsIcon />,
|
|
34
|
+
spin: true,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const WithBadge: Story = {
|
|
39
|
+
args: {
|
|
40
|
+
children: <NotificationsIcon />,
|
|
41
|
+
badge: 3,
|
|
42
|
+
badgeColor: 'error',
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const LargeWhiteIcon: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
children: <NotificationsIcon />,
|
|
49
|
+
size: 'xl',
|
|
50
|
+
white: true,
|
|
51
|
+
badge: 10,
|
|
52
|
+
badgeColor: 'primary',
|
|
53
|
+
},
|
|
54
|
+
};
|