react-miui 0.20.1 → 0.22.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/CHANGELOG.md +22 -0
- package/dist/components/form/Select.d.ts +1 -5
- package/dist/components/form/Select.d.ts.map +1 -1
- package/dist/components/form/Select.js +2 -23
- package/dist/components/form/Select.js.map +1 -1
- package/dist/components/form/Select.stories.d.ts +8 -0
- package/dist/components/form/Select.stories.d.ts.map +1 -0
- package/dist/components/form/Select.stories.js +26 -0
- package/dist/components/form/Select.stories.js.map +1 -0
- package/dist/components/{layout/list/Value.styled.d.ts → form/Select.styled.d.ts} +20 -12
- package/dist/components/form/Select.styled.d.ts.map +1 -0
- package/dist/components/form/Select.styled.js +24 -0
- package/dist/components/form/Select.styled.js.map +1 -0
- package/dist/components/form/input/Input.css.d.ts +16 -16
- package/dist/components/form/input/Input.css.d.ts.map +1 -1
- package/dist/components/form/input/Input.css.js.map +1 -1
- package/dist/components/form/input/Input.styled.d.ts +68 -36
- package/dist/components/form/input/Input.styled.d.ts.map +1 -1
- package/dist/components/form/textarea/TextArea.styled.d.ts +17 -9
- package/dist/components/form/textarea/TextArea.styled.d.ts.map +1 -1
- package/dist/components/icons/Icon.js +1 -2
- package/dist/components/icons/Icon.js.map +1 -1
- package/dist/components/layout/list/Header.d.ts +174 -7
- package/dist/components/layout/list/Header.d.ts.map +1 -1
- package/dist/components/layout/list/Header.js +36 -11
- package/dist/components/layout/list/Header.js.map +1 -1
- package/dist/components/layout/list/Header.stories.d.ts +8 -0
- package/dist/components/layout/list/Header.stories.d.ts.map +1 -0
- package/dist/components/layout/list/Header.stories.js +33 -0
- package/dist/components/layout/list/Header.stories.js.map +1 -0
- package/dist/components/layout/list/Item.d.ts +88 -7
- package/dist/components/layout/list/Item.d.ts.map +1 -1
- package/dist/components/layout/list/Item.js +66 -33
- package/dist/components/layout/list/Item.js.map +1 -1
- package/dist/components/layout/list/Item.stories.d.ts +10 -0
- package/dist/components/layout/list/Item.stories.d.ts.map +1 -0
- package/dist/components/layout/list/Item.stories.js +65 -0
- package/dist/components/layout/list/Item.stories.js.map +1 -0
- package/dist/components/layout/list/Label.d.ts +83 -5
- package/dist/components/layout/list/Label.d.ts.map +1 -1
- package/dist/components/layout/list/Label.js +24 -6
- package/dist/components/layout/list/Label.js.map +1 -1
- package/dist/components/layout/list/Label.stories.d.ts +8 -0
- package/dist/components/layout/list/Label.stories.d.ts.map +1 -0
- package/dist/components/layout/list/Label.stories.js +35 -0
- package/dist/components/layout/list/Label.stories.js.map +1 -0
- package/dist/components/layout/list/List.d.ts +86 -7
- package/dist/components/layout/list/List.d.ts.map +1 -1
- package/dist/components/layout/list/List.js +15 -9
- package/dist/components/layout/list/List.js.map +1 -1
- package/dist/components/layout/list/List.stories.d.ts +9 -0
- package/dist/components/layout/list/List.stories.d.ts.map +1 -0
- package/dist/components/layout/list/List.stories.js +53 -0
- package/dist/components/layout/list/List.stories.js.map +1 -0
- package/dist/components/layout/list/Value.d.ts +81 -1
- package/dist/components/layout/list/Value.d.ts.map +1 -1
- package/dist/components/layout/list/Value.js +9 -2
- package/dist/components/layout/list/Value.js.map +1 -1
- package/dist/components/layout/list/Value.stories.d.ts +8 -0
- package/dist/components/layout/list/Value.stories.d.ts.map +1 -0
- package/dist/components/layout/list/Value.stories.js +29 -0
- package/dist/components/layout/list/Value.stories.js.map +1 -0
- package/dist/components/layout/section/Section.d.ts +83 -8
- package/dist/components/layout/section/Section.d.ts.map +1 -1
- package/dist/components/layout/section/Section.js +17 -15
- package/dist/components/layout/section/Section.js.map +1 -1
- package/dist/components/layout/section/Section.stories.d.ts +8 -0
- package/dist/components/layout/section/Section.stories.d.ts.map +1 -0
- package/dist/components/layout/section/Section.stories.js +37 -0
- package/dist/components/layout/section/Section.stories.js.map +1 -0
- package/dist/components/layout/section/SectionContainer.d.ts +80 -5
- package/dist/components/layout/section/SectionContainer.d.ts.map +1 -1
- package/dist/components/layout/section/SectionContainer.js +9 -8
- package/dist/components/layout/section/SectionContainer.js.map +1 -1
- package/dist/components/ui/button/Button.d.ts +1 -7
- package/dist/components/ui/button/Button.d.ts.map +1 -1
- package/dist/components/ui/button/Button.js +2 -28
- package/dist/components/ui/button/Button.js.map +1 -1
- package/dist/components/ui/button/Button.stories.d.ts +9 -0
- package/dist/components/ui/button/Button.stories.d.ts.map +1 -0
- package/dist/components/ui/button/Button.stories.js +62 -0
- package/dist/components/ui/button/Button.stories.js.map +1 -0
- package/dist/components/ui/button/Button.styled.d.ts +85 -0
- package/dist/components/ui/button/Button.styled.d.ts.map +1 -0
- package/dist/components/ui/button/Button.styled.js +38 -0
- package/dist/components/ui/button/Button.styled.js.map +1 -0
- package/dist/components/ui/message/Message.d.ts +17 -9
- package/dist/components/ui/message/Message.d.ts.map +1 -1
- package/dist/components/ui/message/Message.styled.d.ts +17 -9
- package/dist/components/ui/message/Message.styled.d.ts.map +1 -1
- package/dist/components/ui/modal/Modal.d.ts +6 -4
- package/dist/components/ui/modal/Modal.d.ts.map +1 -1
- package/dist/components/ui/modal/Modal.js +30 -21
- package/dist/components/ui/modal/Modal.js.map +1 -1
- package/dist/components/ui/modal/Modal.stories.d.ts +10 -0
- package/dist/components/ui/modal/Modal.stories.d.ts.map +1 -0
- package/dist/components/ui/modal/Modal.stories.js +112 -0
- package/dist/components/ui/modal/Modal.stories.js.map +1 -0
- package/dist/components/ui/modal/Modal.styled.d.ts +329 -0
- package/dist/components/ui/modal/Modal.styled.d.ts.map +1 -0
- package/dist/components/ui/modal/Modal.styled.js +90 -0
- package/dist/components/ui/modal/Modal.styled.js.map +1 -0
- package/dist/components/ui/modal/ModalButtons.d.ts +1 -11
- package/dist/components/ui/modal/ModalButtons.d.ts.map +1 -1
- package/dist/components/ui/modal/ModalButtons.js +2 -12
- package/dist/components/ui/modal/ModalButtons.js.map +1 -1
- package/dist/components/ui/modal/ModalButtons.stories.d.ts +8 -0
- package/dist/components/ui/modal/ModalButtons.stories.d.ts.map +1 -0
- package/dist/components/ui/modal/ModalButtons.stories.js +25 -0
- package/dist/components/ui/modal/ModalButtons.stories.js.map +1 -0
- package/dist/components/ui/modal/ModalButtons.styled.d.ts +166 -0
- package/dist/components/ui/modal/ModalButtons.styled.d.ts.map +1 -0
- package/dist/components/ui/modal/ModalButtons.styled.js +42 -0
- package/dist/components/ui/modal/ModalButtons.styled.js.map +1 -0
- package/dist/components/ui/pop/Pop.module.scss +1 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +125 -69
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +2 -0
- package/dist/theme.js.map +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/Drawer.html +14 -17
- package/docs/classes/Pop.html +14 -17
- package/docs/classes/ToasterProvider.html +10 -13
- package/docs/enums/ICON.html +14 -17
- package/docs/functions/Action.html +6 -10
- package/docs/functions/Button.html +44 -15
- package/docs/functions/Card.html +6 -10
- package/docs/functions/Checkbox.html +6 -10
- package/docs/functions/Choice.html +7 -11
- package/docs/functions/CoveringLoader.html +6 -10
- package/docs/functions/DirectionPad.html +6 -10
- package/docs/functions/EqualActions.html +6 -10
- package/docs/functions/FullLoader.html +6 -10
- package/docs/functions/HandleEsc.html +6 -10
- package/docs/functions/Header.html +6 -10
- package/docs/functions/HeaderIconAction.html +6 -10
- package/docs/functions/Icon-1.html +6 -10
- package/docs/functions/If.html +6 -10
- package/docs/functions/Input.html +7 -11
- package/docs/functions/KeyValue.html +6 -10
- package/docs/functions/Label.html +6 -10
- package/docs/functions/List-1.html +18 -12
- package/docs/functions/Loader.html +6 -10
- package/docs/functions/Loading.html +6 -10
- package/docs/functions/Message.html +6 -10
- package/docs/functions/Modal-1.html +6 -10
- package/docs/functions/ModalButtons.html +135 -0
- package/docs/functions/PopLoader.html +6 -10
- package/docs/functions/PopOption.html +6 -10
- package/docs/functions/SearchContainer.html +6 -10
- package/docs/functions/Section.html +145 -0
- package/docs/functions/Select.html +40 -15
- package/docs/functions/Selector.html +7 -11
- package/docs/functions/Spacer.html +6 -10
- package/docs/functions/Stats.html +6 -10
- package/docs/functions/StickyHeader-1.html +6 -10
- package/docs/functions/StickyHeader.Content.html +5 -8
- package/docs/functions/Table.html +6 -10
- package/docs/functions/TextArea.html +6 -10
- package/docs/functions/Toggle.html +6 -10
- package/docs/functions/getCssText.html +6 -10
- package/docs/functions/styled.html +6 -10
- package/docs/functions/useToaster.html +7 -11
- package/docs/index.html +6 -10
- package/docs/modules/List.html +10 -10
- package/docs/modules/Modal.html +8 -11
- package/docs/modules/StickyHeader.html +6 -9
- package/docs/modules.html +9 -17
- package/docs/pages/tutorials/Test.html +6 -10
- package/docs/types/ThemeCSS.html +7 -11
- package/docs/variables/List.Header.html +8 -10
- package/docs/variables/List.Item.html +53 -0
- package/docs/variables/{ModalButtons.Button.html → Modal.RemovePadding.html} +11 -14
- package/docs/variables/cssReset.html +7 -11
- package/docs/variables/miuiScrollbars.html +7 -11
- package/esm/components/form/Select.d.ts +1 -5
- package/esm/components/form/Select.d.ts.map +1 -1
- package/esm/components/form/Select.js +1 -8
- package/esm/components/form/Select.js.map +1 -1
- package/esm/components/form/Select.stories.d.ts +8 -0
- package/esm/components/form/Select.stories.d.ts.map +1 -0
- package/esm/components/form/Select.stories.js +20 -0
- package/esm/components/form/Select.stories.js.map +1 -0
- package/esm/components/{layout/list/Value.styled.d.ts → form/Select.styled.d.ts} +20 -12
- package/esm/components/form/Select.styled.d.ts.map +1 -0
- package/esm/components/form/Select.styled.js +21 -0
- package/esm/components/form/Select.styled.js.map +1 -0
- package/esm/components/form/input/Input.css.d.ts +16 -16
- package/esm/components/form/input/Input.css.d.ts.map +1 -1
- package/esm/components/form/input/Input.css.js.map +1 -1
- package/esm/components/form/input/Input.styled.d.ts +68 -36
- package/esm/components/form/input/Input.styled.d.ts.map +1 -1
- package/esm/components/form/textarea/TextArea.styled.d.ts +17 -9
- package/esm/components/form/textarea/TextArea.styled.d.ts.map +1 -1
- package/esm/components/layout/list/Header.d.ts +174 -7
- package/esm/components/layout/list/Header.d.ts.map +1 -1
- package/esm/components/layout/list/Header.js +24 -11
- package/esm/components/layout/list/Header.js.map +1 -1
- package/esm/components/layout/list/Header.stories.d.ts +8 -0
- package/esm/components/layout/list/Header.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Header.stories.js +27 -0
- package/esm/components/layout/list/Header.stories.js.map +1 -0
- package/esm/components/layout/list/Item.d.ts +88 -7
- package/esm/components/layout/list/Item.d.ts.map +1 -1
- package/esm/components/layout/list/Item.js +64 -33
- package/esm/components/layout/list/Item.js.map +1 -1
- package/esm/components/layout/list/Item.stories.d.ts +10 -0
- package/esm/components/layout/list/Item.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Item.stories.js +57 -0
- package/esm/components/layout/list/Item.stories.js.map +1 -0
- package/esm/components/layout/list/Label.d.ts +83 -5
- package/esm/components/layout/list/Label.d.ts.map +1 -1
- package/esm/components/layout/list/Label.js +12 -6
- package/esm/components/layout/list/Label.js.map +1 -1
- package/esm/components/layout/list/Label.stories.d.ts +8 -0
- package/esm/components/layout/list/Label.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Label.stories.js +29 -0
- package/esm/components/layout/list/Label.stories.js.map +1 -0
- package/esm/components/layout/list/List.d.ts +86 -7
- package/esm/components/layout/list/List.d.ts.map +1 -1
- package/esm/components/layout/list/List.js +15 -9
- package/esm/components/layout/list/List.js.map +1 -1
- package/esm/components/layout/list/List.stories.d.ts +9 -0
- package/esm/components/layout/list/List.stories.d.ts.map +1 -0
- package/esm/components/layout/list/List.stories.js +46 -0
- package/esm/components/layout/list/List.stories.js.map +1 -0
- package/esm/components/layout/list/Value.d.ts +81 -1
- package/esm/components/layout/list/Value.d.ts.map +1 -1
- package/esm/components/layout/list/Value.js +9 -1
- package/esm/components/layout/list/Value.js.map +1 -1
- package/esm/components/layout/list/Value.stories.d.ts +8 -0
- package/esm/components/layout/list/Value.stories.d.ts.map +1 -0
- package/esm/components/layout/list/Value.stories.js +23 -0
- package/esm/components/layout/list/Value.stories.js.map +1 -0
- package/esm/components/layout/section/Section.d.ts +83 -8
- package/esm/components/layout/section/Section.d.ts.map +1 -1
- package/esm/components/layout/section/Section.js +17 -12
- package/esm/components/layout/section/Section.js.map +1 -1
- package/esm/components/layout/section/Section.stories.d.ts +8 -0
- package/esm/components/layout/section/Section.stories.d.ts.map +1 -0
- package/esm/components/layout/section/Section.stories.js +31 -0
- package/esm/components/layout/section/Section.stories.js.map +1 -0
- package/esm/components/layout/section/SectionContainer.d.ts +80 -5
- package/esm/components/layout/section/SectionContainer.d.ts.map +1 -1
- package/esm/components/layout/section/SectionContainer.js +9 -5
- package/esm/components/layout/section/SectionContainer.js.map +1 -1
- package/esm/components/ui/button/Button.d.ts +1 -7
- package/esm/components/ui/button/Button.d.ts.map +1 -1
- package/esm/components/ui/button/Button.js +1 -13
- package/esm/components/ui/button/Button.js.map +1 -1
- package/esm/components/ui/button/Button.stories.d.ts +9 -0
- package/esm/components/ui/button/Button.stories.d.ts.map +1 -0
- package/esm/components/ui/button/Button.stories.js +35 -0
- package/esm/components/ui/button/Button.stories.js.map +1 -0
- package/esm/components/ui/button/Button.styled.d.ts +85 -0
- package/esm/components/ui/button/Button.styled.d.ts.map +1 -0
- package/esm/components/ui/button/Button.styled.js +35 -0
- package/esm/components/ui/button/Button.styled.js.map +1 -0
- package/esm/components/ui/message/Message.d.ts +17 -9
- package/esm/components/ui/message/Message.d.ts.map +1 -1
- package/esm/components/ui/message/Message.styled.d.ts +17 -9
- package/esm/components/ui/message/Message.styled.d.ts.map +1 -1
- package/esm/components/ui/modal/Modal.d.ts +6 -4
- package/esm/components/ui/modal/Modal.d.ts.map +1 -1
- package/esm/components/ui/modal/Modal.js +30 -18
- package/esm/components/ui/modal/Modal.js.map +1 -1
- package/esm/components/ui/modal/Modal.stories.d.ts +10 -0
- package/esm/components/ui/modal/Modal.stories.d.ts.map +1 -0
- package/esm/components/ui/modal/Modal.stories.js +84 -0
- package/esm/components/ui/modal/Modal.stories.js.map +1 -0
- package/esm/components/ui/modal/Modal.styled.d.ts +329 -0
- package/esm/components/ui/modal/Modal.styled.d.ts.map +1 -0
- package/esm/components/ui/modal/Modal.styled.js +83 -0
- package/esm/components/ui/modal/Modal.styled.js.map +1 -0
- package/esm/components/ui/modal/ModalButtons.d.ts +1 -11
- package/esm/components/ui/modal/ModalButtons.d.ts.map +1 -1
- package/esm/components/ui/modal/ModalButtons.js +1 -9
- package/esm/components/ui/modal/ModalButtons.js.map +1 -1
- package/esm/components/ui/modal/ModalButtons.stories.d.ts +8 -0
- package/esm/components/ui/modal/ModalButtons.stories.d.ts.map +1 -0
- package/esm/components/ui/modal/ModalButtons.stories.js +19 -0
- package/esm/components/ui/modal/ModalButtons.stories.js.map +1 -0
- package/esm/components/ui/modal/ModalButtons.styled.d.ts +166 -0
- package/esm/components/ui/modal/ModalButtons.styled.d.ts.map +1 -0
- package/esm/components/ui/modal/ModalButtons.styled.js +39 -0
- package/esm/components/ui/modal/ModalButtons.styled.js.map +1 -0
- package/esm/components/ui/pop/Pop.module.scss +1 -0
- package/esm/index.d.ts +0 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +0 -1
- package/esm/index.js.map +1 -1
- package/esm/theme.d.ts +125 -69
- package/esm/theme.d.ts.map +1 -1
- package/esm/theme.js +2 -0
- package/esm/theme.js.map +1 -1
- package/package.json +8 -7
- package/src/components/form/Select.stories.tsx +30 -0
- package/src/components/form/Select.styled.ts +25 -0
- package/src/components/form/Select.tsx +1 -22
- package/src/components/form/input/Input.css.ts +5 -3
- package/src/components/layout/list/Header.stories.tsx +40 -0
- package/src/components/layout/list/Header.tsx +43 -26
- package/src/components/layout/list/Item.stories.tsx +69 -0
- package/src/components/layout/list/Item.tsx +118 -46
- package/src/components/layout/list/Label.stories.tsx +45 -0
- package/src/components/layout/list/Label.tsx +21 -12
- package/src/components/layout/list/List.stories.tsx +84 -0
- package/src/components/layout/list/List.tsx +34 -23
- package/src/components/layout/list/Value.stories.tsx +37 -0
- package/src/components/layout/list/Value.tsx +15 -1
- package/src/components/layout/section/Section.stories.tsx +54 -0
- package/src/components/layout/section/Section.tsx +27 -27
- package/src/components/layout/section/SectionContainer.tsx +10 -13
- package/src/components/ui/button/Button.stories.tsx +55 -0
- package/src/components/ui/button/Button.styled.ts +43 -0
- package/src/components/ui/button/Button.tsx +1 -35
- package/src/components/ui/modal/Modal.stories.tsx +143 -0
- package/src/components/ui/modal/Modal.styled.ts +100 -0
- package/src/components/ui/modal/Modal.tsx +49 -26
- package/src/components/ui/modal/ModalButtons.stories.tsx +40 -0
- package/src/components/ui/modal/ModalButtons.styled.ts +51 -0
- package/src/components/ui/modal/ModalButtons.tsx +1 -22
- package/src/components/ui/pop/Pop.module.scss +1 -0
- package/src/demo/components/form/Choice.tsx +3 -3
- package/src/demo/components/form/Form.tsx +1 -1
- package/src/demo/components/form/Search.tsx +3 -1
- package/src/demo/components/form/Toggle.tsx +3 -1
- package/src/demo/components/layout/card/Card.tsx +3 -3
- package/src/demo/components/ui/icons/Icons.tsx +3 -1
- package/src/demo/components/ui/keyValue/KeyValue.tsx +1 -1
- package/src/demo/components/ui/pop/Pop.tsx +1 -1
- package/src/demo/componentsMap.ts +0 -77
- package/src/index.ts +0 -1
- package/src/pages/_app.tsx +2 -0
- package/src/theme.ts +5 -3
- package/dist/components/form/Select.module.scss +0 -18
- package/dist/components/layout/list/Header.module.scss +0 -8
- package/dist/components/layout/list/Item.module.scss +0 -46
- package/dist/components/layout/list/Label.module.scss +0 -9
- package/dist/components/layout/list/List.module.scss +0 -8
- package/dist/components/layout/list/Value.styled.d.ts.map +0 -1
- package/dist/components/layout/list/Value.styled.js +0 -13
- package/dist/components/layout/list/Value.styled.js.map +0 -1
- package/dist/components/layout/section/Section.module.scss +0 -24
- package/dist/components/layout/section/SectionContainer.module.scss +0 -4
- package/dist/components/ui/button/Button.module.scss +0 -25
- package/dist/components/ui/modal/Modal.module.scss +0 -92
- package/dist/components/ui/modal/ModalButtons.module.scss +0 -32
- package/dist/components/ui/modal/ModalNoMargin.d.ts +0 -7
- package/dist/components/ui/modal/ModalNoMargin.d.ts.map +0 -1
- package/dist/components/ui/modal/ModalNoMargin.js +0 -22
- package/dist/components/ui/modal/ModalNoMargin.js.map +0 -1
- package/docs/functions/Item-1.html +0 -110
- package/docs/functions/ModalButtons-1.html +0 -110
- package/docs/functions/Section-1.html +0 -110
- package/docs/modules/Item.html +0 -64
- package/docs/modules/ModalButtons.html +0 -61
- package/docs/modules/Section.html +0 -61
- package/docs/variables/Item.Label.html +0 -56
- package/docs/variables/Item.Value.html +0 -56
- package/docs/variables/Modal.NegateMargin.html +0 -55
- package/docs/variables/Section.Container.html +0 -55
- package/esm/components/form/Select.module.scss +0 -18
- package/esm/components/layout/list/Header.module.scss +0 -8
- package/esm/components/layout/list/Item.module.scss +0 -46
- package/esm/components/layout/list/Label.module.scss +0 -9
- package/esm/components/layout/list/List.module.scss +0 -8
- package/esm/components/layout/list/Value.styled.d.ts.map +0 -1
- package/esm/components/layout/list/Value.styled.js +0 -10
- package/esm/components/layout/list/Value.styled.js.map +0 -1
- package/esm/components/layout/section/Section.module.scss +0 -24
- package/esm/components/layout/section/SectionContainer.module.scss +0 -4
- package/esm/components/ui/button/Button.module.scss +0 -25
- package/esm/components/ui/modal/Modal.module.scss +0 -92
- package/esm/components/ui/modal/ModalButtons.module.scss +0 -32
- package/esm/components/ui/modal/ModalNoMargin.d.ts +0 -7
- package/esm/components/ui/modal/ModalNoMargin.d.ts.map +0 -1
- package/esm/components/ui/modal/ModalNoMargin.js +0 -16
- package/esm/components/ui/modal/ModalNoMargin.js.map +0 -1
- package/src/components/form/Select.module.scss +0 -18
- package/src/components/layout/list/Header.module.scss +0 -8
- package/src/components/layout/list/Item.module.scss +0 -46
- package/src/components/layout/list/Label.module.scss +0 -9
- package/src/components/layout/list/List.module.scss +0 -8
- package/src/components/layout/list/Value.styled.ts +0 -13
- package/src/components/layout/section/Section.module.scss +0 -24
- package/src/components/layout/section/SectionContainer.module.scss +0 -4
- package/src/components/ui/button/Button.module.scss +0 -25
- package/src/components/ui/modal/Modal.module.scss +0 -92
- package/src/components/ui/modal/ModalButtons.module.scss +0 -32
- package/src/components/ui/modal/ModalNoMargin.tsx +0 -25
- package/src/demo/components/form/Input.tsx +0 -28
- package/src/demo/components/form/Select.tsx +0 -26
- package/src/demo/components/layout/list/Header.tsx +0 -23
- package/src/demo/components/layout/list/Inset.tsx +0 -23
- package/src/demo/components/layout/list/ItemRatio.tsx +0 -20
- package/src/demo/components/layout/list/Label.tsx +0 -31
- package/src/demo/components/layout/list/List.Item.module.scss +0 -7
- package/src/demo/components/layout/list/List.Item.tsx +0 -24
- package/src/demo/components/layout/list/Selection.tsx +0 -16
- package/src/demo/components/layout/list/Value.module.scss +0 -4
- package/src/demo/components/layout/list/Value.tsx +0 -25
- package/src/demo/components/layout/section/Section.tsx +0 -33
- package/src/demo/components/ui/button/ButtonDemo.tsx +0 -23
- package/src/demo/components/ui/message/Message.tsx +0 -27
- package/src/demo/components/ui/modal/Modal.tsx +0 -104
package/esm/theme.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../src/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKjD,MAAM,MAAM,GAAG;IACX,UAAU,EAAE,CAAC;IACb,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,QAAQ;CACjB,CAAC;AAGF,MAAM,OAAO,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC;AAChD,MAAM,iBAAiB,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;AAC1E,MAAM,aAAa,GAAG,CAAC,EAAU,EAAE,EAA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,9 @@
|
|
|
13
13
|
"lint": "eslint src --ext .ts,.tsx,.js,.jsx,.mjs",
|
|
14
14
|
"lint:fix": "yarn lint --fix",
|
|
15
15
|
"prepack": "yarn compile",
|
|
16
|
-
"prepublishOnly": "yarn
|
|
16
|
+
"prepublishOnly": "yarn lint && yarn test && yarn docs",
|
|
17
17
|
"start:dev": "yarn storybook",
|
|
18
|
+
"start:dev:legacy": "next dev",
|
|
18
19
|
"deploy:dev": "next build && next export && netlify deploy --dir out",
|
|
19
20
|
"updates": "npx --yes npm-check-updates --dep prod",
|
|
20
21
|
"updates:dev": "npx --yes npm-check-updates --dep dev",
|
|
@@ -39,9 +40,9 @@
|
|
|
39
40
|
"oop-timers": "^5.0.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@babel/core": "^7.
|
|
43
|
-
"@babel/preset-env": "^7.
|
|
44
|
-
"@babel/preset-typescript": "^7.
|
|
43
|
+
"@babel/core": "^7.22.5",
|
|
44
|
+
"@babel/preset-env": "^7.22.5",
|
|
45
|
+
"@babel/preset-typescript": "^7.22.5",
|
|
45
46
|
"@dzek69/eslint-config-base": "^2.4.0",
|
|
46
47
|
"@dzek69/eslint-config-import": "^1.2.0",
|
|
47
48
|
"@dzek69/eslint-config-import-typescript": "^1.0.0",
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
"fs-extra": "^11.1.1",
|
|
72
73
|
"jest": "^29.5.0",
|
|
73
74
|
"must": "^0.13.4",
|
|
74
|
-
"next": "^13.
|
|
75
|
+
"next": "^13.4.4",
|
|
75
76
|
"nodemon": "^2.0.22",
|
|
76
77
|
"prettier": "^2.8.7",
|
|
77
78
|
"react": "^18.2.0",
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
"storybook": "^7.0.11",
|
|
82
83
|
"ts-node": "^10.9.1",
|
|
83
84
|
"typedoc": "^0.23.28",
|
|
84
|
-
"typescript": "^5.
|
|
85
|
+
"typescript": "^5.1.3"
|
|
85
86
|
},
|
|
86
87
|
"peerDependencies": {
|
|
87
88
|
"react": "^18.2.0",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { Select } from "./Select.js";
|
|
6
|
+
|
|
7
|
+
const meta: Meta = {
|
|
8
|
+
title: "Components/Form/Select",
|
|
9
|
+
component: Select,
|
|
10
|
+
tags: ["autodocs", "form"],
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Select>;
|
|
14
|
+
|
|
15
|
+
const Primary: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
children: [
|
|
18
|
+
<option key={"1"} value={"1"}>First</option>,
|
|
19
|
+
<option key={"2"} value={"2"}>Second</option>,
|
|
20
|
+
<option key={"3"} value={"3"}>Third</option>,
|
|
21
|
+
],
|
|
22
|
+
disabled: false,
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
Primary,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default meta;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { borderPxToRem, dimensionsPxToRem, pxToRem, styled } from "../../theme.js";
|
|
2
|
+
|
|
3
|
+
const Select = styled("select", {
|
|
4
|
+
"boxSizing": "border-box",
|
|
5
|
+
"height": dimensionsPxToRem(103),
|
|
6
|
+
"color": "$text",
|
|
7
|
+
"display": "flex",
|
|
8
|
+
"alignItems": "center",
|
|
9
|
+
"width": "100%",
|
|
10
|
+
"background": "white",
|
|
11
|
+
"fontFamily": "inherit",
|
|
12
|
+
"borderRadius": pxToRem(2),
|
|
13
|
+
"padding": `0 ${dimensionsPxToRem(36)}`,
|
|
14
|
+
"border": `${borderPxToRem(1)} solid $border`,
|
|
15
|
+
"appearance": "auto",
|
|
16
|
+
|
|
17
|
+
"&:disabled": {
|
|
18
|
+
background: "$inputDisabledBg",
|
|
19
|
+
color: "$inputDisabledText",
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
Select,
|
|
25
|
+
};
|
|
@@ -1,22 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
|
|
5
|
-
import styles from "./Select.module.scss";
|
|
6
|
-
|
|
7
|
-
interface Props {
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const Select: React.FC<React.SelectHTMLAttributes<HTMLSelectElement> & Props> = ({ className, children, ...props }) => {
|
|
11
|
-
const wrapperCls = classnames(styles.select, className);
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<select className={wrapperCls} {...props}>
|
|
15
|
-
{children}
|
|
16
|
-
</select>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export {
|
|
21
|
-
Select,
|
|
22
|
-
};
|
|
1
|
+
export { Select } from "./Select.styled.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ThemeCSS } from "../../../theme";
|
|
1
|
+
// import type { ThemeCSS } from "../../../theme"; TODO restore
|
|
2
2
|
|
|
3
3
|
import { dimensionsPxToRem, fontPxToRem, borderPxToRem } from "../../../theme.js";
|
|
4
4
|
|
|
@@ -21,7 +21,8 @@ const input = {
|
|
|
21
21
|
"&:read-only, &:disabled": {
|
|
22
22
|
color: "inherit",
|
|
23
23
|
},
|
|
24
|
-
}
|
|
24
|
+
};
|
|
25
|
+
// satisfies ThemeCSS; @TODO restore
|
|
25
26
|
|
|
26
27
|
const wrapper = {
|
|
27
28
|
background: "white",
|
|
@@ -50,7 +51,8 @@ const wrapper = {
|
|
|
50
51
|
},
|
|
51
52
|
},
|
|
52
53
|
},
|
|
53
|
-
}
|
|
54
|
+
};
|
|
55
|
+
// satisfies ThemeCSS; TODO restore
|
|
54
56
|
|
|
55
57
|
export {
|
|
56
58
|
input,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { Header } from "./Header.js";
|
|
6
|
+
import { List } from "./List.js";
|
|
7
|
+
|
|
8
|
+
const meta: Meta = {
|
|
9
|
+
title: "Components/Layout/List/Header",
|
|
10
|
+
component: Header,
|
|
11
|
+
tags: ["autodocs", "layout"],
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type Story = StoryObj<typeof Header>;
|
|
15
|
+
|
|
16
|
+
const Primary: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
children: "Section name",
|
|
19
|
+
},
|
|
20
|
+
render: (args) => {
|
|
21
|
+
return (
|
|
22
|
+
<List>
|
|
23
|
+
<Header {...args} />
|
|
24
|
+
<List.Item>Item 1</List.Item>
|
|
25
|
+
<List.Item>Item 2</List.Item>
|
|
26
|
+
<List.Item>Item 3</List.Item>
|
|
27
|
+
<Header {...args} />
|
|
28
|
+
<List.Item>Item 1</List.Item>
|
|
29
|
+
<List.Item>Item 2</List.Item>
|
|
30
|
+
<List.Item>Item 3</List.Item>
|
|
31
|
+
</List>
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
Primary,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
@@ -1,32 +1,49 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
3
|
+
import type { VariantProps } from "@stitches/react";
|
|
4
|
+
|
|
5
|
+
import { dimensionsPxToRem, fontPxToRem, styled } from "../../../theme.js";
|
|
6
|
+
|
|
7
|
+
import { Item, ItemInnerContainerClassName } from "./Item.js";
|
|
8
|
+
|
|
9
|
+
const StyledContent = styled("div", {});
|
|
10
|
+
|
|
11
|
+
const StyledHeader = styled(Item, {
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
13
|
+
paddingTop: dimensionsPxToRem(80),
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
15
|
+
paddingBottom: dimensionsPxToRem(40),
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
17
|
+
fontSize: fontPxToRem(26),
|
|
18
|
+
color: "$sub",
|
|
19
|
+
textTransform: "uppercase",
|
|
20
|
+
|
|
21
|
+
[`& ${ItemInnerContainerClassName}`]: {
|
|
22
|
+
minHeight: 0,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
variants: {
|
|
26
|
+
inset: {
|
|
27
|
+
true: {
|
|
28
|
+
paddingLeft: 0,
|
|
29
|
+
paddingRight: 0,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
type StyledHeaderProps = React.ComponentProps<typeof StyledHeader>;
|
|
36
|
+
type Variants = VariantProps<typeof StyledHeader>;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Use this to render a header within a `List`.
|
|
40
|
+
* Use `as` prop to define which tag to use.
|
|
41
|
+
*/
|
|
42
|
+
const Header: React.FC<StyledHeaderProps & Variants & { as?: string }> = ({ as, ...props }) => {
|
|
26
43
|
return (
|
|
27
|
-
<
|
|
28
|
-
<
|
|
29
|
-
</
|
|
44
|
+
<StyledHeader {...props}>
|
|
45
|
+
<StyledContent {...(as ? { as } : undefined)}>{props.children}</StyledContent>
|
|
46
|
+
</StyledHeader>
|
|
30
47
|
);
|
|
31
48
|
};
|
|
32
49
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { NextLink } from "../../../demo/NextLink.js";
|
|
6
|
+
|
|
7
|
+
import { Item } from "./Item.js";
|
|
8
|
+
import { List } from "./List.js";
|
|
9
|
+
|
|
10
|
+
const meta: Meta = {
|
|
11
|
+
title: "Components/Layout/List/Item",
|
|
12
|
+
component: Item,
|
|
13
|
+
tags: ["autodocs", "layout"],
|
|
14
|
+
argTypes: {
|
|
15
|
+
inset: {
|
|
16
|
+
type: "boolean",
|
|
17
|
+
},
|
|
18
|
+
Link: {
|
|
19
|
+
controls: "none",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof Item>;
|
|
25
|
+
|
|
26
|
+
const Primary: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
children: "I am a list item",
|
|
29
|
+
inset: false,
|
|
30
|
+
Link: NextLink,
|
|
31
|
+
},
|
|
32
|
+
render: (args) => {
|
|
33
|
+
return <List><Item {...args} /></List>;
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const Alignment: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
children: [
|
|
40
|
+
<div key={"1st"}>first</div>,
|
|
41
|
+
<div key={"2nd"}>2nd</div>,
|
|
42
|
+
<div key={"3rd"}>last</div>,
|
|
43
|
+
],
|
|
44
|
+
ratio: "1/2/1",
|
|
45
|
+
},
|
|
46
|
+
render: (args) => {
|
|
47
|
+
return <List><Item {...args} /></List>;
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const OnClick: Story = {
|
|
52
|
+
args: {
|
|
53
|
+
children: "I am a list item, but I will render a button, click me",
|
|
54
|
+
onClick: () => {
|
|
55
|
+
alert("Clicked!");
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
render: (args) => {
|
|
59
|
+
return <List><Item {...args} /></List>;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
Primary,
|
|
65
|
+
Alignment,
|
|
66
|
+
OnClick,
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default meta;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
|
-
import classnames from "classnames";
|
|
4
|
-
|
|
5
|
-
import { makeVariants } from "../../../utils/index.js";
|
|
6
3
|
import { ICON, Icon } from "../../icons/Icon.js";
|
|
4
|
+
import { dimensionsPxToRem, fontPxToRem, pxToRem, styled } from "../../../theme.js";
|
|
7
5
|
|
|
8
|
-
import styles from "./Item.module.scss";
|
|
9
6
|
import { Value } from "./Value.js";
|
|
10
7
|
import { Label } from "./Label.js";
|
|
11
8
|
|
|
@@ -14,18 +11,12 @@ interface LinkProps {
|
|
|
14
11
|
children: React.ReactNode;
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
type Variant = "inset";
|
|
18
|
-
|
|
19
14
|
interface Props {
|
|
20
15
|
href?: string;
|
|
21
16
|
to?: string;
|
|
22
17
|
onClick?: () => void;
|
|
23
|
-
className?: string;
|
|
24
18
|
Link?: React.ComponentClass<LinkProps> | React.FC<LinkProps>;
|
|
25
19
|
ratio?: string; // @TODO number/number/number/.. type?
|
|
26
|
-
variant?: Variant | Variant[];
|
|
27
|
-
selected?: boolean | undefined;
|
|
28
|
-
children: React.ReactNode;
|
|
29
20
|
}
|
|
30
21
|
|
|
31
22
|
interface SubComponents {
|
|
@@ -33,32 +24,101 @@ interface SubComponents {
|
|
|
33
24
|
Value: typeof Value;
|
|
34
25
|
}
|
|
35
26
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// eslint-disable-next-line
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
27
|
+
const iconStyles = {
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
29
|
+
width: pxToRem(7),
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
31
|
+
marginRight: pxToRem(10),
|
|
32
|
+
display: "inline-block",
|
|
33
|
+
}; // TODO satisfies
|
|
34
|
+
|
|
35
|
+
const StyledIcon = styled(Icon, iconStyles);
|
|
36
|
+
const StyledNoIcon = styled("span", iconStyles);
|
|
37
|
+
|
|
38
|
+
const icon = <StyledIcon name={ICON.forward} />;
|
|
39
|
+
const noIcon = <StyledNoIcon />;
|
|
40
|
+
|
|
41
|
+
const StyledInnerContainer = styled("div", {
|
|
42
|
+
display: "flex",
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
44
|
+
minHeight: dimensionsPxToRem(174),
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
gap: "1rem",
|
|
47
|
+
|
|
48
|
+
border: "none",
|
|
49
|
+
background: "none",
|
|
50
|
+
width: "100%",
|
|
51
|
+
textAlign: "left",
|
|
52
|
+
fontFamily: "inherit",
|
|
53
|
+
fontSize: "inherit",
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const ItemInnerContainerClassName = StyledInnerContainer.toString();
|
|
57
|
+
|
|
58
|
+
const StyledItem = styled("li", {
|
|
59
|
+
"listStyleType": "none",
|
|
60
|
+
"margin": 0,
|
|
61
|
+
"padding": 0,
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
63
|
+
"fontSize": fontPxToRem(34),
|
|
64
|
+
|
|
65
|
+
"&:not(:first-child)": {
|
|
66
|
+
borderTop: "0.37px solid $headerBorder",
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
"> *": {
|
|
70
|
+
display: "block",
|
|
71
|
+
padding: 0,
|
|
72
|
+
textDecoration: "none",
|
|
73
|
+
},
|
|
74
|
+
|
|
75
|
+
"variants": {
|
|
76
|
+
inset: {
|
|
77
|
+
true: {
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
79
|
+
paddingLeft: dimensionsPxToRem(37),
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
81
|
+
paddingRight: dimensionsPxToRem(37),
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
selected: {
|
|
85
|
+
true: {
|
|
86
|
+
color: "$mainColor",
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
type StyledItemProps = React.ComponentProps<typeof StyledItem>;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Represents a single item in a list.
|
|
96
|
+
*
|
|
97
|
+
* It has two subcomponents:
|
|
98
|
+
* - `Label`: for rendering the label with sublabel (usually on the left)
|
|
99
|
+
* - `Value`: for rendering the value (usually on the right)
|
|
100
|
+
*
|
|
101
|
+
* It can be however used with any children, its children are rendered in a flexbox container, `ratio` prop can be used
|
|
102
|
+
* to set the flex ratio of each child.
|
|
103
|
+
*
|
|
104
|
+
* It has two variants:
|
|
105
|
+
* - `inset`: which adds padding to the left and right side of the item - it should be used when the list is inset (it's
|
|
106
|
+
* applied automatically if used within `List` component)
|
|
107
|
+
* - `selected`: which renders an arrow on the left side, useful when creating a radio-like list (please note that not
|
|
108
|
+
* sending `selected` is different from sending `false`)
|
|
109
|
+
*
|
|
110
|
+
* It accepts few more props:
|
|
111
|
+
* - `href`: if given it will render an anchor tag with the given href
|
|
112
|
+
* - `to`: if given it will render an anchor tag wrapped in a link using the given `Link` component
|
|
113
|
+
* - `onClick`: if given it will render a button tag with the given onClick handler (it can be passed with `href` too)
|
|
114
|
+
*/
|
|
115
|
+
const Item: React.FC<StyledItemProps & Props> & SubComponents = ({ href, to, onClick, Link, ratio, ...props }) => {
|
|
116
|
+
const r = ratio ? ratio.split("/") : [];
|
|
49
117
|
|
|
50
|
-
const pre = typeof selected === "boolean"
|
|
51
|
-
? (
|
|
52
|
-
selected ? icon : noIcon
|
|
53
|
-
)
|
|
118
|
+
const pre = typeof props.selected === "boolean"
|
|
119
|
+
? (props.selected ? icon : noIcon)
|
|
54
120
|
: null;
|
|
55
121
|
|
|
56
|
-
const liProps = {
|
|
57
|
-
className: cls,
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const r = ratio ? ratio.split("/") : [];
|
|
61
|
-
|
|
62
122
|
const ren = React.Children.map(props.children, (child, index) => {
|
|
63
123
|
let flex = undefined;
|
|
64
124
|
if (!r.length && child && typeof child === "object" && "type" in child && child.type === Value) {
|
|
@@ -75,28 +135,40 @@ const Item: React.FC<Props> & SubComponents = (props) => {
|
|
|
75
135
|
throw new TypeError("`to` prop given without `Link` component");
|
|
76
136
|
}
|
|
77
137
|
|
|
78
|
-
return
|
|
138
|
+
return (
|
|
139
|
+
<StyledItem {...props}>
|
|
140
|
+
<Link href={to}><StyledInnerContainer as={"a"} href={to}>{ren}</StyledInnerContainer></Link>
|
|
141
|
+
</StyledItem>
|
|
142
|
+
);
|
|
79
143
|
}
|
|
144
|
+
|
|
80
145
|
if (href) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
146
|
+
return (
|
|
147
|
+
<StyledItem {...props}>
|
|
148
|
+
{/* eslint-disable-next-line react/jsx-handler-names */}
|
|
149
|
+
<StyledInnerContainer as={"a"} href={href} onClick={onClick}>{ren}</StyledInnerContainer>
|
|
150
|
+
</StyledItem>
|
|
151
|
+
);
|
|
86
152
|
}
|
|
153
|
+
|
|
87
154
|
if (onClick) {
|
|
88
155
|
return (
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
</li>
|
|
156
|
+
<StyledItem {...props}>
|
|
157
|
+
{/* eslint-disable-next-line react/jsx-handler-names */}
|
|
158
|
+
<StyledInnerContainer as={"button"} onClick={onClick}>{ren}</StyledInnerContainer>
|
|
159
|
+
</StyledItem>
|
|
94
160
|
);
|
|
95
161
|
}
|
|
96
|
-
|
|
162
|
+
|
|
163
|
+
return <StyledItem {...props}><StyledInnerContainer>{ren}</StyledInnerContainer></StyledItem>;
|
|
97
164
|
};
|
|
98
165
|
|
|
99
166
|
Item.Label = Label;
|
|
100
167
|
Item.Value = Value;
|
|
101
168
|
|
|
102
|
-
export { Item };
|
|
169
|
+
export { Item, ItemInnerContainerClassName };
|
|
170
|
+
|
|
171
|
+
export type {
|
|
172
|
+
Props as ItemProps,
|
|
173
|
+
SubComponents as ItemSubComponents,
|
|
174
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import type { StoryObj, Meta } from "@storybook/react";
|
|
4
|
+
|
|
5
|
+
import { Label } from "./Label.js";
|
|
6
|
+
import { List } from "./List.js";
|
|
7
|
+
import { Item } from "./Item.js";
|
|
8
|
+
|
|
9
|
+
const meta: Meta = {
|
|
10
|
+
title: "Components/Layout/List/Label",
|
|
11
|
+
component: Label,
|
|
12
|
+
tags: ["autodocs", "layout"],
|
|
13
|
+
argTypes: {
|
|
14
|
+
sub: {
|
|
15
|
+
type: "string",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type Story = StoryObj<typeof Label>;
|
|
21
|
+
|
|
22
|
+
const Primary: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
children: "I am a label",
|
|
25
|
+
sub: "Sub text",
|
|
26
|
+
},
|
|
27
|
+
render: (args) => {
|
|
28
|
+
return (
|
|
29
|
+
<List>
|
|
30
|
+
<Item>
|
|
31
|
+
<Label {...args} />
|
|
32
|
+
</Item>
|
|
33
|
+
<Item>
|
|
34
|
+
I am classic list item
|
|
35
|
+
</Item>
|
|
36
|
+
</List>
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
Primary,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default meta;
|
|
@@ -1,24 +1,33 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import { dimensionsPxToRem, fontPxToRem, styled } from "../../../theme.js";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
const SubLabel = styled("div", {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
8
|
+
fontSize: fontPxToRem(27),
|
|
9
|
+
color: "$sub",
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
11
|
+
marginTop: fontPxToRem(27 / 3),
|
|
12
|
+
});
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
14
|
+
const StyledLabel = styled("div", {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
16
|
+
padding: `${dimensionsPxToRem(54)} 0`,
|
|
17
|
+
});
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
const sub = props.sub ? <div className={styles.sub}>{props.sub}</div> : null;
|
|
19
|
+
type StyledLabelProps = React.ComponentProps<typeof StyledLabel>;
|
|
16
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Use this to render a label within `Item`, optionally you can render a sublabel as well (with a tip message for
|
|
23
|
+
* example).
|
|
24
|
+
*/
|
|
25
|
+
const Label: React.FC<StyledLabelProps & { sub?: ReactNode }> = ({ sub, ...props }) => {
|
|
17
26
|
return (
|
|
18
|
-
<
|
|
27
|
+
<StyledLabel {...props}>
|
|
19
28
|
<div>{props.children}</div>
|
|
20
|
-
{sub}
|
|
21
|
-
</
|
|
29
|
+
{sub && <SubLabel>{sub}</SubLabel>}
|
|
30
|
+
</StyledLabel>
|
|
22
31
|
);
|
|
23
32
|
};
|
|
24
33
|
|