@soyfri/shared-library 1.5.0-beta.3 → 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/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/{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.cjs +0 -0
- /package/{components → dist/components}/Autocomplete/Autocomplete.cjs.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/Autocomplete.js +0 -0
- /package/{components → dist/components}/Autocomplete/Autocomplete.js.map +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,191 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
|
|
3
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
|
|
4
|
+
import { DateTimePicker as MuiDateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
5
|
+
import { DateValidationError } from '@mui/x-date-pickers/models';
|
|
6
|
+
import { Dayjs } from 'dayjs';
|
|
7
|
+
import { styled } from '@mui/system';
|
|
8
|
+
import { Box, TextField, TextFieldProps } from '@mui/material';
|
|
9
|
+
|
|
10
|
+
// Define las props para el DateTimePicker
|
|
11
|
+
export interface DateTimePickerProps {
|
|
12
|
+
label: string;
|
|
13
|
+
selectedDateTime: Dayjs | null;
|
|
14
|
+
onDateTimeChange: (dateTime: Dayjs | null) => void;
|
|
15
|
+
minDateTime?: Dayjs;
|
|
16
|
+
maxDateTime?: Dayjs;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
inputFormat?: string;
|
|
20
|
+
slotProps?: any;
|
|
21
|
+
clearButtonText?: string;
|
|
22
|
+
cancelButtonText?: string;
|
|
23
|
+
acceptButtonText?: string;
|
|
24
|
+
minutesStep?: number;
|
|
25
|
+
minTime?: Dayjs;
|
|
26
|
+
customClass?: string;
|
|
27
|
+
viewRenderers?: any
|
|
28
|
+
timeSteps?: any
|
|
29
|
+
ampm?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 1. Crear un componente estilizado para el TextField
|
|
33
|
+
// Este componente tendrá los mismos estilos de altura, padding y label que tu Input.tsx
|
|
34
|
+
const StyledTextField = styled(TextField)(({ theme }) => ({
|
|
35
|
+
'& .MuiInputBase-root': {
|
|
36
|
+
maxHeight: '34px',
|
|
37
|
+
padding: '8px 10px',
|
|
38
|
+
borderRadius: '10px',
|
|
39
|
+
display: 'flex',
|
|
40
|
+
alignItems: 'center',
|
|
41
|
+
fontSize: '14px',
|
|
42
|
+
},
|
|
43
|
+
'& .MuiInputBase-input': {
|
|
44
|
+
padding: '0 !important',
|
|
45
|
+
height: '18px',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
alignItems: 'center',
|
|
48
|
+
marginTop: '-4px'
|
|
49
|
+
},
|
|
50
|
+
'& .MuiInputLabel-root': {
|
|
51
|
+
top: '50%',
|
|
52
|
+
transform: 'translate(14px, -50%)',
|
|
53
|
+
'&.MuiInputLabel-shrink': {
|
|
54
|
+
transform: 'translate(1px, -200%) scale(0.75)',
|
|
55
|
+
fontSize: '16px !important',
|
|
56
|
+
'> legend': {
|
|
57
|
+
display: 'none',
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
62
|
+
border: '0.7px solid',
|
|
63
|
+
borderColor: '#e0e0e0',
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Custom Material UI DateTimePicker component.
|
|
69
|
+
* Allows selecting a date and time, and updates a Dayjs state.
|
|
70
|
+
*/
|
|
71
|
+
export const DateTimePicker: React.FC<DateTimePickerProps> = ({
|
|
72
|
+
label,
|
|
73
|
+
selectedDateTime,
|
|
74
|
+
onDateTimeChange,
|
|
75
|
+
minDateTime,
|
|
76
|
+
maxDateTime,
|
|
77
|
+
disabled,
|
|
78
|
+
readOnly,
|
|
79
|
+
customClass= '',
|
|
80
|
+
inputFormat,
|
|
81
|
+
slotProps,
|
|
82
|
+
clearButtonText,
|
|
83
|
+
cancelButtonText,
|
|
84
|
+
acceptButtonText,
|
|
85
|
+
minutesStep,
|
|
86
|
+
minTime,
|
|
87
|
+
viewRenderers,
|
|
88
|
+
timeSteps,
|
|
89
|
+
ampm,
|
|
90
|
+
...rest
|
|
91
|
+
}) => {
|
|
92
|
+
const [error, setError] = React.useState<DateValidationError | null>(null);
|
|
93
|
+
|
|
94
|
+
const errorMessage = useMemo(() => {
|
|
95
|
+
switch (error) {
|
|
96
|
+
case 'minDate':
|
|
97
|
+
case 'maxDate':
|
|
98
|
+
case 'invalidDate': {
|
|
99
|
+
return 'Formato de fecha/hora inválido';
|
|
100
|
+
}
|
|
101
|
+
case 'disableFuture': {
|
|
102
|
+
return 'No se permiten fechas/horas futuras';
|
|
103
|
+
}
|
|
104
|
+
case 'disablePast': {
|
|
105
|
+
return 'No se permiten fechas/horas pasadas';
|
|
106
|
+
}
|
|
107
|
+
default: {
|
|
108
|
+
return '';
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}, [error]);
|
|
112
|
+
|
|
113
|
+
const customLocaleText = useMemo(() => {
|
|
114
|
+
const text: Record<string, string> = {};
|
|
115
|
+
if (clearButtonText) text.clearButtonLabel = clearButtonText;
|
|
116
|
+
if (cancelButtonText) text.cancelButtonLabel = cancelButtonText;
|
|
117
|
+
if (acceptButtonText) text.okButtonLabel = acceptButtonText;
|
|
118
|
+
return text;
|
|
119
|
+
}, [clearButtonText, cancelButtonText, acceptButtonText]);
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<LocalizationProvider dateAdapter={AdapterDayjs}>
|
|
123
|
+
<Box
|
|
124
|
+
sx={{
|
|
125
|
+
width: '100%',
|
|
126
|
+
display: 'grid',
|
|
127
|
+
marginBottom: '10px',
|
|
128
|
+
marginTop: '10px'
|
|
129
|
+
}}
|
|
130
|
+
|
|
131
|
+
>
|
|
132
|
+
<MuiDateTimePicker
|
|
133
|
+
className={customClass}
|
|
134
|
+
label={label}
|
|
135
|
+
value={selectedDateTime}
|
|
136
|
+
onChange={onDateTimeChange}
|
|
137
|
+
minDateTime={minDateTime}
|
|
138
|
+
maxDateTime={maxDateTime}
|
|
139
|
+
minutesStep={minutesStep}
|
|
140
|
+
disabled={disabled}
|
|
141
|
+
readOnly={readOnly}
|
|
142
|
+
minTime={minTime}
|
|
143
|
+
format={inputFormat ? inputFormat: 'DD/MM/YYYY HH:mm'}
|
|
144
|
+
viewRenderers={viewRenderers}
|
|
145
|
+
timeSteps={timeSteps}
|
|
146
|
+
sx={{
|
|
147
|
+
'& .MuiPickersInputBase-root, .MuiPickersOutlinedInput-root': {
|
|
148
|
+
maxHeight: '28px',
|
|
149
|
+
borderRadius: '10px',
|
|
150
|
+
},
|
|
151
|
+
'& .MuiInputLabel-root': {
|
|
152
|
+
// El label se alinea con el padding del input base.
|
|
153
|
+
top: '50%',
|
|
154
|
+
transform: 'translate(14px, -50%)',
|
|
155
|
+
|
|
156
|
+
// Estilo para el label "encogido" cuando el input está lleno o en foco
|
|
157
|
+
'&.MuiInputLabel-shrink': {
|
|
158
|
+
transform: 'translate(1px, -200%) scale(0.75)', // Ajustar la posición para que se vea por encima del input
|
|
159
|
+
fontSize: '16px !important',
|
|
160
|
+
'> legend': {
|
|
161
|
+
display: 'none', // Ocultar el legend del outline
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
'& .MuiPickersInputBase-root > fieldset > legend':{
|
|
166
|
+
display: 'none', // Ocultar el legend del outline
|
|
167
|
+
},
|
|
168
|
+
}}
|
|
169
|
+
slotProps={{
|
|
170
|
+
...slotProps,
|
|
171
|
+
// 2. Usar 'slotProps' para pasar el componente estilizado al TextField
|
|
172
|
+
textField: {
|
|
173
|
+
...slotProps?.textField,
|
|
174
|
+
helperText: errorMessage || slotProps?.textField?.helperText,
|
|
175
|
+
error: !!errorMessage || slotProps?.textField?.error,
|
|
176
|
+
InputProps: {
|
|
177
|
+
...slotProps?.textField?.InputProps,
|
|
178
|
+
inputComponent: StyledTextField,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
}}
|
|
182
|
+
localeText={{ ...customLocaleText }}
|
|
183
|
+
ampm={false}
|
|
184
|
+
{...rest}
|
|
185
|
+
/>
|
|
186
|
+
</Box>
|
|
187
|
+
</LocalizationProvider>
|
|
188
|
+
);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
export default DateTimePicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as DateTimePicker } from './DateTimePicker';
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Box, Button, List, ListItem, ListItemText, TextField, Typography } from '@mui/material';
|
|
4
|
+
import Flyout from './Flyout'; // Adjust the import path if your Flyout.tsx is in a different directory
|
|
5
|
+
|
|
6
|
+
// Define the Meta for the Flyout component
|
|
7
|
+
const meta: Meta<typeof Flyout> = {
|
|
8
|
+
title: 'Components/Flyout', // Category in Storybook
|
|
9
|
+
component: Flyout,
|
|
10
|
+
tags: ['autodocs'], // Automatically generate documentation
|
|
11
|
+
argTypes: {
|
|
12
|
+
open: {
|
|
13
|
+
control: 'boolean',
|
|
14
|
+
description: 'Controls the visibility of the flyout.',
|
|
15
|
+
},
|
|
16
|
+
onClose: {
|
|
17
|
+
action: 'closed', // Log the onClose event in Storybook actions panel
|
|
18
|
+
description: 'Callback function when the flyout is requested to close.',
|
|
19
|
+
},
|
|
20
|
+
title: {
|
|
21
|
+
control: 'text',
|
|
22
|
+
description: 'Title displayed at the top of the flyout.',
|
|
23
|
+
},
|
|
24
|
+
anchor: {
|
|
25
|
+
control: 'select',
|
|
26
|
+
options: ['left', 'top', 'right', 'bottom'],
|
|
27
|
+
description: 'Side from which the flyout will appear.',
|
|
28
|
+
},
|
|
29
|
+
size: {
|
|
30
|
+
control: 'select',
|
|
31
|
+
options: ['small', 'medium', 'large'],
|
|
32
|
+
description: 'Predefined size of the flyout (width for left/right, height for top/bottom).',
|
|
33
|
+
},
|
|
34
|
+
height: {
|
|
35
|
+
control: 'text',
|
|
36
|
+
description: 'Custom height for top/bottom anchored flyouts (e.g., "50vh", "300px").',
|
|
37
|
+
if: { arg: 'anchor', eq: ['top', 'bottom'] }, // Only show if anchor is top or bottom
|
|
38
|
+
},
|
|
39
|
+
children: {
|
|
40
|
+
control: 'text', // Can be set to 'text' for simple string content, or 'disable'
|
|
41
|
+
description: 'Content to be rendered inside the flyout.',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
parameters: {
|
|
45
|
+
docs: {
|
|
46
|
+
description: {
|
|
47
|
+
component: 'A customizable Drawer component that slides in from a specified anchor point, ideal for displaying supplementary content or forms without navigating away from the main page.',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default meta;
|
|
54
|
+
|
|
55
|
+
type Story = StoryObj<typeof Flyout>;
|
|
56
|
+
|
|
57
|
+
// --- Helper component for demonstration content ---
|
|
58
|
+
const DemoContent: React.FC = () => (
|
|
59
|
+
<Box>
|
|
60
|
+
<Typography variant="body1" paragraph>
|
|
61
|
+
This is some example content inside the flyout. It can contain any React elements.
|
|
62
|
+
</Typography>
|
|
63
|
+
<List dense>
|
|
64
|
+
<ListItem disablePadding>
|
|
65
|
+
<ListItemText primary="Item 1:" secondary="Detail A" />
|
|
66
|
+
</ListItem>
|
|
67
|
+
<ListItem disablePadding>
|
|
68
|
+
<ListItemText primary="Item 2:" secondary="Detail B" />
|
|
69
|
+
</ListItem>
|
|
70
|
+
<ListItem disablePadding>
|
|
71
|
+
<ListItemText primary="Item 3:" secondary="Detail C" />
|
|
72
|
+
</ListItem>
|
|
73
|
+
{[...Array(15)].map((_, i) => ( // Add more items to demonstrate scrolling
|
|
74
|
+
<ListItem key={i + 4} disablePadding>
|
|
75
|
+
<ListItemText primary={`More Item ${i + 4}:`} secondary={`More Detail ${i + 4}`} />
|
|
76
|
+
</ListItem>
|
|
77
|
+
))}
|
|
78
|
+
</List>
|
|
79
|
+
<TextField
|
|
80
|
+
label="Input Field"
|
|
81
|
+
variant="outlined"
|
|
82
|
+
fullWidth
|
|
83
|
+
margin="normal"
|
|
84
|
+
defaultValue="Some text"
|
|
85
|
+
/>
|
|
86
|
+
<Button variant="contained" color="primary" sx={{ mt: 2 }}>
|
|
87
|
+
Action Button
|
|
88
|
+
</Button>
|
|
89
|
+
</Box>
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
// --- Stories ---
|
|
94
|
+
|
|
95
|
+
// Default story for a basic right-anchored flyout
|
|
96
|
+
export const Default: Story = {
|
|
97
|
+
render: (args) => {
|
|
98
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
99
|
+
return (
|
|
100
|
+
<Box sx={{ height: '200vh', p: 2, backgroundColor: '#f0f0f0' }}> {/* Added height to simulate scrollable page */}
|
|
101
|
+
<Typography variant="h5" mb={2}>Default Flyout Example</Typography>
|
|
102
|
+
<Button variant="contained" onClick={() => setIsOpen(true)}>
|
|
103
|
+
Open Flyout (Right)
|
|
104
|
+
</Button>
|
|
105
|
+
<Flyout {...args} open={isOpen} onClose={() => setIsOpen(false)}>
|
|
106
|
+
<DemoContent />
|
|
107
|
+
</Flyout>
|
|
108
|
+
</Box>
|
|
109
|
+
);
|
|
110
|
+
},
|
|
111
|
+
args: {
|
|
112
|
+
title: 'Flyout Title',
|
|
113
|
+
anchor: 'right',
|
|
114
|
+
size: 'medium',
|
|
115
|
+
// children is handled by the render function with DemoContent
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// Story for a small flyout from the left
|
|
120
|
+
export const SmallLeft: Story = {
|
|
121
|
+
render: (args) => {
|
|
122
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
123
|
+
return (
|
|
124
|
+
<Box sx={{ p: 2 }}>
|
|
125
|
+
<Typography variant="h5" mb={2}>Small Flyout from Left</Typography>
|
|
126
|
+
<Button variant="contained" onClick={() => setIsOpen(true)}>
|
|
127
|
+
Open Small Flyout (Left)
|
|
128
|
+
</Button>
|
|
129
|
+
<Flyout {...args} open={isOpen} onClose={() => setIsOpen(false)}>
|
|
130
|
+
<DemoContent />
|
|
131
|
+
</Flyout>
|
|
132
|
+
</Box>
|
|
133
|
+
);
|
|
134
|
+
},
|
|
135
|
+
args: {
|
|
136
|
+
title: 'Small Flyout',
|
|
137
|
+
anchor: 'left',
|
|
138
|
+
size: 'small',
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// Story for a large flyout from the right
|
|
143
|
+
export const LargeRight: Story = {
|
|
144
|
+
render: (args) => {
|
|
145
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
146
|
+
return (
|
|
147
|
+
<Box sx={{ p: 2 }}>
|
|
148
|
+
<Typography variant="h5" mb={2}>Large Flyout from Right</Typography>
|
|
149
|
+
<Button variant="contained" onClick={() => setIsOpen(true)}>
|
|
150
|
+
Open Large Flyout (Right)
|
|
151
|
+
</Button>
|
|
152
|
+
<Flyout {...args} open={isOpen} onClose={() => setIsOpen(false)}>
|
|
153
|
+
<DemoContent />
|
|
154
|
+
</Flyout>
|
|
155
|
+
</Box>
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
args: {
|
|
159
|
+
title: 'Large Flyout',
|
|
160
|
+
anchor: 'right',
|
|
161
|
+
size: 'large',
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// Story for a top-anchored flyout with custom height
|
|
166
|
+
export const TopAnchor: Story = {
|
|
167
|
+
render: (args) => {
|
|
168
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
169
|
+
return (
|
|
170
|
+
<Box sx={{ p: 2 }}>
|
|
171
|
+
<Typography variant="h5" mb={2}>Top Anchored Flyout</Typography>
|
|
172
|
+
<Button variant="contained" onClick={() => setIsOpen(true)}>
|
|
173
|
+
Open Top Flyout
|
|
174
|
+
</Button>
|
|
175
|
+
<Flyout {...args} open={isOpen} onClose={() => setIsOpen(false)}>
|
|
176
|
+
<DemoContent />
|
|
177
|
+
</Flyout>
|
|
178
|
+
</Box>
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
args: {
|
|
182
|
+
title: 'Top Flyout',
|
|
183
|
+
anchor: 'top',
|
|
184
|
+
height: '300px', // Custom height for top/bottom anchor
|
|
185
|
+
size: 'medium', // Size prop still applies but width is 100% for top/bottom
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
// Story for a bottom-anchored flyout with custom height
|
|
190
|
+
export const BottomAnchor: Story = {
|
|
191
|
+
render: (args) => {
|
|
192
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
193
|
+
return (
|
|
194
|
+
<Box sx={{ p: 2 }}>
|
|
195
|
+
<Typography variant="h5" mb={2}>Bottom Anchored Flyout</Typography>
|
|
196
|
+
<Button variant="contained" onClick={() => setIsOpen(true)}>
|
|
197
|
+
Open Bottom Flyout
|
|
198
|
+
</Button>
|
|
199
|
+
<Flyout {...args} open={isOpen} onClose={() => setIsOpen(false)}>
|
|
200
|
+
<DemoContent />
|
|
201
|
+
</Flyout>
|
|
202
|
+
</Box>
|
|
203
|
+
);
|
|
204
|
+
},
|
|
205
|
+
args: {
|
|
206
|
+
title: 'Bottom Flyout',
|
|
207
|
+
anchor: 'bottom',
|
|
208
|
+
height: '40vh', // Custom height using viewport units
|
|
209
|
+
size: 'medium',
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// Story with no title
|
|
214
|
+
export const NoTitle: Story = {
|
|
215
|
+
render: (args) => {
|
|
216
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
217
|
+
return (
|
|
218
|
+
<Box sx={{ p: 2 }}>
|
|
219
|
+
<Typography variant="h5" mb={2}>Flyout with No Title</Typography>
|
|
220
|
+
<Button variant="contained" onClick={() => setIsOpen(true)}>
|
|
221
|
+
Open Flyout (No Title)
|
|
222
|
+
</Button>
|
|
223
|
+
<Flyout {...args} open={isOpen} onClose={() => setIsOpen(false)}>
|
|
224
|
+
<DemoContent />
|
|
225
|
+
</Flyout>
|
|
226
|
+
</Box>
|
|
227
|
+
);
|
|
228
|
+
},
|
|
229
|
+
args: {
|
|
230
|
+
title: undefined, // Explicitly no title
|
|
231
|
+
anchor: 'right',
|
|
232
|
+
size: 'medium',
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// Story with custom content
|
|
237
|
+
export const CustomContent: Story = {
|
|
238
|
+
render: (args) => {
|
|
239
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
240
|
+
const [customText, setCustomText] = useState('This is some custom text that can be edited.');
|
|
241
|
+
return (
|
|
242
|
+
<Box sx={{ p: 2 }}>
|
|
243
|
+
<Typography variant="h5" mb={2}>Flyout with Custom Content</Typography>
|
|
244
|
+
<Button variant="contained" onClick={() => setIsOpen(true)}>
|
|
245
|
+
Open Custom Content Flyout
|
|
246
|
+
</Button>
|
|
247
|
+
<Flyout {...args} open={isOpen} onClose={() => setIsOpen(false)}>
|
|
248
|
+
<Box sx={{ p: 2 }}>
|
|
249
|
+
<Typography variant="h6" gutterBottom>Custom Form</Typography>
|
|
250
|
+
<TextField
|
|
251
|
+
label="Your Message"
|
|
252
|
+
multiline
|
|
253
|
+
rows={4}
|
|
254
|
+
fullWidth
|
|
255
|
+
variant="outlined"
|
|
256
|
+
value={customText}
|
|
257
|
+
onChange={(e) => setCustomText(e.target.value)}
|
|
258
|
+
sx={{ mb: 2 }}
|
|
259
|
+
/>
|
|
260
|
+
<Button variant="contained" color="secondary">
|
|
261
|
+
Submit Custom Content
|
|
262
|
+
</Button>
|
|
263
|
+
</Box>
|
|
264
|
+
</Flyout>
|
|
265
|
+
</Box>
|
|
266
|
+
);
|
|
267
|
+
},
|
|
268
|
+
args: {
|
|
269
|
+
title: 'Custom Content Flyout',
|
|
270
|
+
anchor: 'right',
|
|
271
|
+
size: 'medium',
|
|
272
|
+
// children is handled by the render function
|
|
273
|
+
},
|
|
274
|
+
};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Box,
|
|
4
|
+
Typography,
|
|
5
|
+
IconButton,
|
|
6
|
+
Divider,
|
|
7
|
+
Drawer,
|
|
8
|
+
List,
|
|
9
|
+
ListItem,
|
|
10
|
+
ListItemText,
|
|
11
|
+
TextField,
|
|
12
|
+
Button,
|
|
13
|
+
} from '@mui/material';
|
|
14
|
+
import CloseIcon from '@mui/icons-material/Close';
|
|
15
|
+
|
|
16
|
+
// Define the size types for the Flyout
|
|
17
|
+
type FlyoutSize = 'small' | 'medium' | 'large';
|
|
18
|
+
|
|
19
|
+
// Define the props for the Flyout component
|
|
20
|
+
export interface FlyoutProps {
|
|
21
|
+
open: boolean;
|
|
22
|
+
onClose: () => void;
|
|
23
|
+
title?: string;
|
|
24
|
+
anchor?: 'left' | 'top' | 'right' | 'bottom';
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
size?: FlyoutSize; // New prop for predefined size
|
|
27
|
+
height?: string | number; // Allows custom height for top/bottom anchors
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const Flyout: React.FC<FlyoutProps> = ({
|
|
31
|
+
open,
|
|
32
|
+
onClose,
|
|
33
|
+
title,
|
|
34
|
+
anchor = 'right',
|
|
35
|
+
children,
|
|
36
|
+
size = 'medium', // Default size: 'medium'
|
|
37
|
+
height = 'auto',
|
|
38
|
+
}) => {
|
|
39
|
+
// Mapping of predefined sizes to pixel widths
|
|
40
|
+
const getWidthBySize = (flyoutSize: FlyoutSize): number => {
|
|
41
|
+
const baseMultiplier = 1.15; // 15% larger than base
|
|
42
|
+
switch (flyoutSize) {
|
|
43
|
+
case 'small':
|
|
44
|
+
return Math.round(300 * baseMultiplier); // ~345px
|
|
45
|
+
case 'medium':
|
|
46
|
+
return Math.round(450 * baseMultiplier); // ~518px (rounded)
|
|
47
|
+
case 'large':
|
|
48
|
+
return Math.round(600 * baseMultiplier); // ~690px
|
|
49
|
+
default:
|
|
50
|
+
return Math.round(450 * baseMultiplier); // Fallback, ~518px
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
// Calculate width based on size prop for left/right anchors
|
|
55
|
+
const calculatedWidth = getWidthBySize(size);
|
|
56
|
+
|
|
57
|
+
// Determine the style for the content box based on anchor
|
|
58
|
+
const contentStyle = useMemo(() => {
|
|
59
|
+
if (anchor === 'left' || anchor === 'right') {
|
|
60
|
+
return { width: calculatedWidth }; // Use the calculated width
|
|
61
|
+
} else {
|
|
62
|
+
// For 'top' or 'bottom' anchors, width is 100% and height is controlled
|
|
63
|
+
return { height: height, width: '100%' };
|
|
64
|
+
}
|
|
65
|
+
}, [anchor, calculatedWidth, height]);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Drawer
|
|
69
|
+
anchor={anchor}
|
|
70
|
+
open={open}
|
|
71
|
+
onClose={onClose}
|
|
72
|
+
// Allows closing with Escape key, but prevents closing by clicking outside if ModalProps.disableBackdropClick is true
|
|
73
|
+
disableEscapeKeyDown={false}
|
|
74
|
+
ModalProps={{
|
|
75
|
+
// Keep mounted for better performance if content is complex or needs to retain state
|
|
76
|
+
keepMounted: true,
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
<Box
|
|
80
|
+
sx={{
|
|
81
|
+
...contentStyle, // Apply calculated width/height
|
|
82
|
+
display: 'flex',
|
|
83
|
+
flexDirection: 'column',
|
|
84
|
+
p: 2, // Padding around the content
|
|
85
|
+
backgroundColor: (theme) => theme.palette.background.paper, // Use theme background color
|
|
86
|
+
color: (theme) => theme.palette.text.primary, // Use theme text color
|
|
87
|
+
height: '100%', // Ensure the main container of the Drawer takes full height
|
|
88
|
+
}}
|
|
89
|
+
role="presentation" // ARIA role for accessibility
|
|
90
|
+
>
|
|
91
|
+
{/* Header section with title and close button */}
|
|
92
|
+
<Box
|
|
93
|
+
sx={{
|
|
94
|
+
display: 'flex',
|
|
95
|
+
justifyContent: 'space-between',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
mb: 2, // Margin bottom for separation from content
|
|
98
|
+
flexShrink: 0, // Prevent the header from shrinking when content scrolls
|
|
99
|
+
}}
|
|
100
|
+
>
|
|
101
|
+
{title && (
|
|
102
|
+
<Typography variant="h6" component="div" sx={{ fontWeight: 'bold' }}>
|
|
103
|
+
{title}
|
|
104
|
+
</Typography>
|
|
105
|
+
)}
|
|
106
|
+
<IconButton onClick={onClose} sx={{ ml: 'auto' }}>
|
|
107
|
+
<CloseIcon />
|
|
108
|
+
</IconButton>
|
|
109
|
+
</Box>
|
|
110
|
+
|
|
111
|
+
<Divider sx={{ mb: 2 }} /> {/* Separator line */}
|
|
112
|
+
|
|
113
|
+
{/* Scrollable content area */}
|
|
114
|
+
<Box sx={{ flexGrow: 1, overflowY: 'auto' }}>
|
|
115
|
+
{children}
|
|
116
|
+
</Box>
|
|
117
|
+
</Box>
|
|
118
|
+
</Drawer>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export default Flyout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Flyout } from './Flyout';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const DefaultGalleryDefinition = `
|
|
2
|
+
<Gallery
|
|
3
|
+
maxWidth="600px"
|
|
4
|
+
items={[
|
|
5
|
+
{
|
|
6
|
+
type: "image",
|
|
7
|
+
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",
|
|
8
|
+
title: "Image 1",
|
|
9
|
+
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"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
type: "image",
|
|
13
|
+
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",
|
|
14
|
+
title: "Image 2",
|
|
15
|
+
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"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: "image",
|
|
19
|
+
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",
|
|
20
|
+
title: "Image 3",
|
|
21
|
+
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"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: "video",
|
|
25
|
+
url: "https://www.w3schools.com/html/mov_bbb.mp4",
|
|
26
|
+
title: "Video 1",
|
|
27
|
+
thumbnail: "https://peach.blender.org/wp-content/uploads/title_anouncement.jpg?x11217"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: "image",
|
|
31
|
+
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",
|
|
32
|
+
title: "Image 4",
|
|
33
|
+
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"
|
|
34
|
+
}
|
|
35
|
+
]}
|
|
36
|
+
/>
|
|
37
|
+
`.trim();
|