@apple-pie/slice 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chunks/Avatar-0EXaRG4e.js +54 -0
- package/dist/cjs/chunks/AvatarGroup-BsRUAZl0.js +37 -0
- package/dist/cjs/chunks/Badge-Bv6c2YVC.js +23 -0
- package/dist/cjs/chunks/Button-DFAWHJmQ.js +246 -0
- package/dist/cjs/chunks/ButtonBar-DOgYDAda.js +53 -0
- package/dist/cjs/chunks/Card-BPClSuHa.js +37 -0
- package/dist/cjs/chunks/CheckBox-tsExpwtr.js +56 -0
- package/dist/cjs/chunks/Chip-CPHF1zn-.js +84 -0
- package/dist/cjs/chunks/DivInput-DDQVtlot.js +102 -0
- package/dist/cjs/chunks/DocIcons-B5TcBqSH.js +108 -0
- package/dist/cjs/chunks/Dot-BSSClfHQ.js +73 -0
- package/dist/cjs/chunks/DrggablePanel-wWLPesc8.js +202 -0
- package/dist/cjs/chunks/DropDown-COdCr77A.js +102 -0
- package/dist/cjs/chunks/ErrorSummary-CIUqlSLC.js +60 -0
- package/dist/cjs/chunks/FileIcon-DTQaXxfC.js +221 -0
- package/dist/cjs/chunks/FileList-J2EgJyCo.js +217 -0
- package/dist/cjs/chunks/FlexDiv-CW5gSa4V.js +65 -0
- package/dist/cjs/chunks/Grouper-QwwunKen.js +61 -0
- package/dist/cjs/chunks/IconButton-B53y3z1_.js +77 -0
- package/dist/cjs/chunks/Label-DoiS07-y.js +111 -0
- package/dist/cjs/chunks/Logos-CAHU-eIP.js +483 -0
- package/dist/cjs/chunks/Overlay-Bb2YoSKr.js +36 -0
- package/dist/cjs/chunks/Pager-CN2z8M9E.js +37 -0
- package/dist/cjs/chunks/ProgressIndicator-BbrZ7Aoc.js +157 -0
- package/dist/cjs/chunks/PromptInput-BXDqUXFQ.js +150 -0
- package/dist/cjs/chunks/RadioButton-GKRhZEmb.js +56 -0
- package/dist/cjs/chunks/RadioButtonList-CFpZmyAX.js +59 -0
- package/dist/cjs/chunks/Slider-CZvCAodl.js +136 -0
- package/dist/cjs/chunks/Spacer-CtxV2Pww.js +18 -0
- package/dist/cjs/chunks/Switch-C94aofxQ.js +37 -0
- package/dist/cjs/chunks/TabBar-D6akzNUf.js +123 -0
- package/dist/cjs/chunks/TextArea-DjF8Koup.js +82 -0
- package/dist/cjs/chunks/TextField-Cg6mQcYl.js +204 -0
- package/dist/cjs/chunks/Tip-CjMHa-fD.js +88 -0
- package/dist/cjs/chunks/Toast-Cdyh6T-l.js +163 -0
- package/dist/cjs/chunks/UploadArea-BmZ50EEl.js +123 -0
- package/dist/cjs/chunks/_types-B5xXv4NA.js +1386 -0
- package/dist/cjs/chunks/sharedTypes-gCECyn2N.js +6 -0
- package/dist/cjs/chunks/style-inject.es-CMuL-BfJ.js +11 -0
- package/dist/cjs/chunks/tipStore-Ck4NLvml.js +17 -0
- package/dist/cjs/chunks/toastStore-CSStgB9d.js +17 -0
- package/dist/cjs/chunks/tslib.es6-C8dZW5nY.js +49 -0
- package/dist/cjs/chunks/uploads-worker-mD8pcsGP.js +221 -0
- package/dist/cjs/chunks/uploadsStore-CxWIctvI.js +75 -0
- package/dist/cjs/chunks/utils-BsBHecUI.js +70 -0
- package/dist/cjs/chunks/windowStore-RaJswiHM.js +70 -0
- package/dist/cjs/hooks/useDoubleClick.js +11 -23
- package/dist/cjs/hooks/useKeyboardShortcuts.js +18 -35
- package/dist/cjs/hooks/useLastUpdated.js +20 -42
- package/dist/cjs/hooks/useLocalStore.js +23 -39
- package/dist/cjs/hooks/useObserveResize.js +26 -44
- package/dist/cjs/hooks/useObserveTheme.js +18 -36
- package/dist/cjs/hooks/useTheme.js +17 -40
- package/dist/cjs/hooks/useToolTip.js +19 -32
- package/dist/cjs/hooks/useTrackRenders.js +11 -29
- package/dist/cjs/hooks/useWindow.js +29 -65
- package/dist/cjs/hooks.js +12 -30
- package/dist/cjs/index.js +47 -127
- package/dist/cjs/providers/ThemeProvider.js +27 -45
- package/dist/cjs/providers.js +5 -12
- package/dist/cjs/stores/tip.js +4 -9
- package/dist/cjs/stores/toast.js +4 -9
- package/dist/cjs/stores/uploads.js +11 -0
- package/dist/cjs/stores/window.js +8 -10
- package/dist/cjs/stores.js +18 -21
- package/dist/cjs/theme/colors.js +371 -379
- package/dist/cjs/theme/corners.js +10 -12
- package/dist/cjs/theme/elevations.js +10 -13
- package/dist/cjs/theme/themes.js +8 -13
- package/dist/cjs/theme/type.js +225 -384
- package/dist/cjs/theme.js +5 -13
- package/dist/cjs/uikit/Avatar/index.js +6 -0
- package/dist/cjs/uikit/AvatarGroup/index.js +7 -0
- package/dist/cjs/uikit/Badge/index.js +6 -0
- package/dist/cjs/uikit/Button/index.js +12 -0
- package/dist/cjs/uikit/ButtonBar/index.js +12 -0
- package/dist/cjs/uikit/Card/index.js +10 -0
- package/dist/cjs/uikit/CheckBox/index.js +10 -0
- package/dist/cjs/uikit/Chip/index.js +11 -0
- package/dist/cjs/uikit/DivInput/index.js +7 -0
- package/dist/cjs/uikit/DocIcon/index.js +9 -0
- package/dist/cjs/uikit/Dot/index.js +6 -0
- package/dist/cjs/uikit/DraggablePanel/index.js +10 -0
- package/dist/cjs/uikit/DropDown/index.js +10 -0
- package/dist/cjs/uikit/ErrorSummary/index.js +6 -0
- package/dist/cjs/uikit/FileIcon/index.js +15 -0
- package/dist/cjs/uikit/FileList/index.js +11 -0
- package/dist/cjs/uikit/FlexDiv/index.js +6 -0
- package/dist/cjs/uikit/Grouper/index.js +11 -0
- package/dist/cjs/uikit/Icon/index.js +14 -0
- package/dist/cjs/uikit/IconButton/index.js +12 -0
- package/dist/cjs/uikit/Label/index.js +10 -0
- package/dist/cjs/uikit/Logos/index.js +9 -0
- package/dist/cjs/uikit/Overlay/index.js +6 -0
- package/dist/cjs/uikit/Pager/index.js +7 -0
- package/dist/cjs/uikit/Progress/index.js +10 -0
- package/dist/cjs/uikit/PromptInput/index.js +14 -0
- package/dist/cjs/uikit/RadioButton/index.js +12 -0
- package/dist/cjs/uikit/RadioButtonList/index.js +13 -0
- package/dist/cjs/uikit/Slider/index.js +7 -0
- package/dist/cjs/uikit/Spacer/index.js +6 -0
- package/dist/cjs/uikit/Switch/index.js +6 -0
- package/dist/cjs/uikit/TabBar/index.js +12 -0
- package/dist/cjs/uikit/TextArea/index.js +13 -0
- package/dist/cjs/uikit/Textfield/index.js +13 -0
- package/dist/cjs/uikit/Tip/index.js +7 -0
- package/dist/cjs/uikit/Toast/index.js +16 -0
- package/dist/cjs/uikit/UploadArea/index.js +15 -0
- package/dist/cjs/workers/uploads/uploads.js +5 -0
- package/dist/esm/chunks/Avatar-D_W5zErj.mjs +60 -0
- package/dist/esm/chunks/AvatarGroup-Dbfmz0Yz.mjs +45 -0
- package/dist/esm/chunks/Badge-BISGWj5-.mjs +29 -0
- package/dist/esm/chunks/Button-B_aIY6wE.mjs +264 -0
- package/dist/esm/chunks/ButtonBar-Cr6TFvvD.mjs +66 -0
- package/dist/esm/chunks/Card-BzKBF0ny.mjs +45 -0
- package/dist/esm/chunks/CheckBox-CYggPKaT.mjs +68 -0
- package/dist/esm/chunks/Chip-B3wb9g1U.mjs +96 -0
- package/dist/esm/chunks/DivInput-_VL6PAqT.mjs +114 -0
- package/dist/esm/chunks/DocIcons-BxtcXsWI.mjs +114 -0
- package/dist/esm/chunks/Dot-C-Xu24wF.mjs +81 -0
- package/dist/esm/chunks/DrggablePanel-Bg3UKK1k.mjs +214 -0
- package/dist/esm/chunks/DropDown-D7KyGLkM.mjs +114 -0
- package/dist/esm/chunks/ErrorSummary-CZw06dSh.mjs +68 -0
- package/dist/esm/chunks/FileIcon-BcIJzIwA.mjs +233 -0
- package/dist/esm/chunks/FileList-DUzgHfE-.mjs +229 -0
- package/dist/esm/chunks/FlexDiv-BLYDgWu2.mjs +73 -0
- package/dist/esm/chunks/Grouper-CRldBHSw.mjs +75 -0
- package/dist/esm/chunks/IconButton-BBiZrXlS.mjs +93 -0
- package/dist/esm/chunks/Label-DPIAVkn1.mjs +124 -0
- package/dist/esm/chunks/Logos-CpcaarOG.mjs +493 -0
- package/dist/esm/chunks/Overlay-Bh0enFIe.mjs +44 -0
- package/dist/esm/chunks/Pager-B-1ZRUzU.mjs +45 -0
- package/dist/esm/chunks/ProgressIndicator-CNOBQ_Fv.mjs +167 -0
- package/dist/esm/chunks/PromptInput-DdsIgZ3T.mjs +160 -0
- package/dist/esm/chunks/RadioButton-D-TdQu3a.mjs +66 -0
- package/dist/esm/chunks/RadioButtonList-CEScWkbT.mjs +67 -0
- package/dist/esm/chunks/Slider-C3A8GCfH.mjs +142 -0
- package/dist/esm/chunks/Spacer-BlgEdKEM.mjs +20 -0
- package/dist/esm/chunks/Switch-obpmvCGd.mjs +45 -0
- package/dist/esm/chunks/TabBar-DFj021UP.mjs +141 -0
- package/dist/esm/chunks/TextArea-D_hq6VF3.mjs +90 -0
- package/dist/esm/chunks/TextField-Co0u-xdd.mjs +222 -0
- package/dist/esm/chunks/Tip-CHQh-Yq0.mjs +98 -0
- package/dist/esm/chunks/Toast-BiXzVFtM.mjs +179 -0
- package/dist/esm/chunks/UploadArea-B9685Z06.mjs +133 -0
- package/dist/esm/chunks/_types-KZDzhaiK.mjs +1395 -0
- package/dist/esm/chunks/sharedTypes-tn9-uJvb.mjs +8 -0
- package/dist/esm/chunks/style-inject.es-D0BjEaN8.mjs +11 -0
- package/dist/esm/chunks/tipStore-CL5a95Bl.mjs +15 -0
- package/dist/esm/chunks/toastStore-D2PEIqCo.mjs +15 -0
- package/dist/esm/chunks/tslib.es6-c-7TIv71.mjs +53 -0
- package/dist/esm/chunks/uploads-worker-Dv-4zGnC.mjs +224 -0
- package/dist/esm/chunks/uploadsStore-D69fEXMY.mjs +72 -0
- package/dist/esm/chunks/utils-BQ1v7VE4.mjs +74 -0
- package/dist/esm/chunks/windowStore-CwW0i_le.mjs +71 -0
- package/dist/esm/hooks/useDoubleClick.mjs +14 -0
- package/dist/esm/hooks/useKeyboardShortcuts.mjs +27 -0
- package/dist/esm/hooks/useLastUpdated.mjs +31 -0
- package/dist/esm/hooks/useLocalStore.mjs +36 -0
- package/dist/esm/hooks/useObserveResize.mjs +38 -0
- package/dist/esm/hooks/useObserveTheme.mjs +34 -0
- package/dist/esm/hooks/useTheme.mjs +73 -0
- package/dist/esm/hooks/useToolTip.mjs +23 -0
- package/dist/esm/hooks/useTrackRenders.mjs +23 -0
- package/dist/esm/hooks/useWindow.mjs +52 -0
- package/dist/esm/hooks.mjs +29 -0
- package/dist/esm/index.mjs +117 -0
- package/dist/esm/providers/ThemeProvider.mjs +49 -0
- package/dist/esm/providers.mjs +15 -0
- package/dist/esm/stores/tip.mjs +3 -0
- package/dist/esm/stores/toast.mjs +3 -0
- package/dist/esm/stores/uploads.mjs +7 -0
- package/dist/esm/stores/window.mjs +3 -0
- package/dist/esm/stores.mjs +13 -0
- package/dist/esm/theme/colors.mjs +373 -0
- package/dist/esm/theme/corners.mjs +12 -0
- package/dist/esm/theme/elevations.mjs +15 -0
- package/dist/esm/theme/themes.mjs +25 -0
- package/dist/esm/theme/type.mjs +236 -0
- package/dist/esm/theme.mjs +9 -0
- package/dist/esm/uikit/Avatar/index.mjs +9 -0
- package/dist/esm/uikit/AvatarGroup/index.mjs +11 -0
- package/dist/esm/uikit/Badge/index.mjs +9 -0
- package/dist/esm/uikit/Button/index.mjs +39 -0
- package/dist/esm/uikit/ButtonBar/index.mjs +39 -0
- package/dist/esm/uikit/Card/index.mjs +29 -0
- package/dist/esm/uikit/CheckBox/index.mjs +31 -0
- package/dist/esm/uikit/Chip/index.mjs +31 -0
- package/dist/esm/uikit/DivInput/index.mjs +13 -0
- package/dist/esm/uikit/DocIcon/index.mjs +23 -0
- package/dist/esm/uikit/Dot/index.mjs +11 -0
- package/dist/esm/uikit/DraggablePanel/index.mjs +29 -0
- package/dist/esm/uikit/DropDown/index.mjs +29 -0
- package/dist/esm/uikit/ErrorSummary/index.mjs +11 -0
- package/dist/esm/uikit/FileIcon/index.mjs +25 -0
- package/dist/esm/uikit/FileList/index.mjs +35 -0
- package/dist/esm/uikit/FlexDiv/index.mjs +11 -0
- package/dist/esm/uikit/Grouper/index.mjs +33 -0
- package/dist/esm/uikit/Icon/index.mjs +25 -0
- package/dist/esm/uikit/IconButton/index.mjs +37 -0
- package/dist/esm/uikit/Label/index.mjs +27 -0
- package/dist/esm/uikit/Logos/index.mjs +23 -0
- package/dist/esm/uikit/Overlay/index.mjs +11 -0
- package/dist/esm/uikit/Pager/index.mjs +11 -0
- package/dist/esm/uikit/Progress/index.mjs +27 -0
- package/dist/esm/uikit/PromptInput/index.mjs +45 -0
- package/dist/esm/uikit/RadioButton/index.mjs +39 -0
- package/dist/esm/uikit/RadioButtonList/index.mjs +41 -0
- package/dist/esm/uikit/Slider/index.mjs +13 -0
- package/dist/esm/uikit/Spacer/index.mjs +7 -0
- package/dist/esm/uikit/Switch/index.mjs +11 -0
- package/dist/esm/uikit/TabBar/index.mjs +39 -0
- package/dist/esm/uikit/TextArea/index.mjs +41 -0
- package/dist/esm/uikit/Textfield/index.mjs +43 -0
- package/dist/esm/uikit/Tip/index.mjs +13 -0
- package/dist/esm/uikit/Toast/index.mjs +31 -0
- package/dist/esm/uikit/UploadArea/index.mjs +37 -0
- package/dist/esm/workers/uploads/uploads.mjs +5 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/stores/index.d.ts +1 -0
- package/dist/types/stores/uploads/_types.d.ts +16 -0
- package/dist/types/stores/uploads/index.d.ts +2 -0
- package/dist/types/stores/uploads/uploadsStore.d.ts +22 -0
- package/dist/types/uikit/FileList/_types.d.ts +1 -0
- package/dist/types/uikit/UploadArea/UploadArea.d.ts +54 -0
- package/dist/types/uikit/UploadArea/_types.d.ts +46 -0
- package/dist/types/uikit/UploadArea/index.d.ts +3 -0
- package/dist/types/util/utils.d.ts +4 -0
- package/dist/types/workers/uploads/uploads-worker.d.ts +129 -0
- package/dist/types/workers/uploads/uploads.d.ts +1 -0
- package/dist/types/workers/uploads/uploads.runtime.d.ts +1 -0
- package/package.json +23 -17
- package/dist/cjs/chunks/Avatar-z2YcOAoP.js +0 -68
- package/dist/cjs/chunks/AvatarGroup-Cz8369zI.js +0 -39
- package/dist/cjs/chunks/Badge-COSg__VJ.js +0 -41
- package/dist/cjs/chunks/Button-BNXqiA13.js +0 -312
- package/dist/cjs/chunks/ButtonBar-CeDdAOlH.js +0 -58
- package/dist/cjs/chunks/Card-Cc_c-S7i.js +0 -36
- package/dist/cjs/chunks/CheckBox-hTWIPqV_.js +0 -76
- package/dist/cjs/chunks/Chip-CLKVldi4.js +0 -93
- package/dist/cjs/chunks/DivInput-DnY2emt-.js +0 -204
- package/dist/cjs/chunks/DocIcons-BRWOzK96.js +0 -41
- package/dist/cjs/chunks/Dot-B5dO8kSS.js +0 -80
- package/dist/cjs/chunks/DrggablePanel-BtsURL9o.js +0 -302
- package/dist/cjs/chunks/DropDown-COr9u96t.js +0 -154
- package/dist/cjs/chunks/ErrorSummary-BrSHbGpk.js +0 -42
- package/dist/cjs/chunks/FileIcon-CEMQK_Je.js +0 -132
- package/dist/cjs/chunks/FileList-DWIm4o46.js +0 -163
- package/dist/cjs/chunks/FlexDiv-BHl29ywz.js +0 -103
- package/dist/cjs/chunks/Grouper-EyHoeA8w.js +0 -50
- package/dist/cjs/chunks/IconButton-9QZ4eKBZ.js +0 -84
- package/dist/cjs/chunks/Label-DZJ_YDtD.js +0 -134
- package/dist/cjs/chunks/Logos-DSlAUz8l.js +0 -119
- package/dist/cjs/chunks/Overlay-DV3C5NDO.js +0 -45
- package/dist/cjs/chunks/Pager-CRjpl1FZ.js +0 -42
- package/dist/cjs/chunks/ProgressIndicator-BAwAaw58.js +0 -121
- package/dist/cjs/chunks/PromptInput-DmO8a3oX.js +0 -212
- package/dist/cjs/chunks/RadioButton-DA9YUGEF.js +0 -65
- package/dist/cjs/chunks/RadioButtonList-BtsT7GJc.js +0 -116
- package/dist/cjs/chunks/Slider-CqrIwn-L.js +0 -285
- package/dist/cjs/chunks/Spacer-BEY2-_PB.js +0 -16
- package/dist/cjs/chunks/Switch-CtkFtogd.js +0 -43
- package/dist/cjs/chunks/TabBar-WsNlr-aZ.js +0 -176
- package/dist/cjs/chunks/TextArea-BMJWUH2H.js +0 -153
- package/dist/cjs/chunks/TextField-mfwz79cD.js +0 -248
- package/dist/cjs/chunks/Tip-Af6FMEDi.js +0 -91
- package/dist/cjs/chunks/Toast-CxAEOW4z.js +0 -158
- package/dist/cjs/chunks/_types-BNlHsGMQ.js +0 -714
- package/dist/cjs/chunks/sharedTypes-BvTjh6M5.js +0 -9
- package/dist/cjs/chunks/style-inject.es-XZHJH68X.js +0 -30
- package/dist/cjs/chunks/tipStore-C9oV9SIh.js +0 -23
- package/dist/cjs/chunks/toastStore-C-ETP9H6.js +0 -23
- package/dist/cjs/chunks/tslib.es6-4H29ixHs.js +0 -48
- package/dist/cjs/chunks/utils-BwNacfBU.js +0 -128
- package/dist/cjs/chunks/windowStore-CPcVHJq6.js +0 -93
- package/dist/cjs/uikit/Avatar.js +0 -11
- package/dist/cjs/uikit/AvatarGroup.js +0 -12
- package/dist/cjs/uikit/Badge.js +0 -11
- package/dist/cjs/uikit/Button.js +0 -26
- package/dist/cjs/uikit/ButtonBar.js +0 -26
- package/dist/cjs/uikit/Card.js +0 -21
- package/dist/cjs/uikit/CheckBox.js +0 -22
- package/dist/cjs/uikit/Chip.js +0 -22
- package/dist/cjs/uikit/DivInput.js +0 -13
- package/dist/cjs/uikit/DocIcon.js +0 -18
- package/dist/cjs/uikit/Dot.js +0 -12
- package/dist/cjs/uikit/DraggablePanel.js +0 -21
- package/dist/cjs/uikit/DropDown.js +0 -21
- package/dist/cjs/uikit/ErrorSummary.js +0 -12
- package/dist/cjs/uikit/FileIcon.js +0 -23
- package/dist/cjs/uikit/FileList.js +0 -24
- package/dist/cjs/uikit/FlexDiv.js +0 -12
- package/dist/cjs/uikit/Grouper.js +0 -23
- package/dist/cjs/uikit/Icon.js +0 -23
- package/dist/cjs/uikit/IconButton.js +0 -25
- package/dist/cjs/uikit/Label.js +0 -20
- package/dist/cjs/uikit/Logos.js +0 -18
- package/dist/cjs/uikit/Overlay.js +0 -12
- package/dist/cjs/uikit/Pager.js +0 -12
- package/dist/cjs/uikit/Progress.js +0 -21
- package/dist/cjs/uikit/PromptInput.js +0 -29
- package/dist/cjs/uikit/RadioButton.js +0 -26
- package/dist/cjs/uikit/RadioButtonList.js +0 -27
- package/dist/cjs/uikit/Slider.js +0 -13
- package/dist/cjs/uikit/Spacer.js +0 -10
- package/dist/cjs/uikit/Switch.js +0 -12
- package/dist/cjs/uikit/TabBar.js +0 -26
- package/dist/cjs/uikit/TextArea.js +0 -27
- package/dist/cjs/uikit/Textfield.js +0 -28
- package/dist/cjs/uikit/Tip.js +0 -13
- package/dist/cjs/uikit/Toast.js +0 -26
- package/dist/esm/chunks/Avatar-BtkvMV1v.js +0 -66
- package/dist/esm/chunks/AvatarGroup-pbqdS56o.js +0 -37
- package/dist/esm/chunks/Badge-DtxDLSO0.js +0 -39
- package/dist/esm/chunks/Button-BUJkJqdO.js +0 -310
- package/dist/esm/chunks/ButtonBar-Bl0oCxd8.js +0 -56
- package/dist/esm/chunks/Card-Bjk0kgQh.js +0 -34
- package/dist/esm/chunks/CheckBox-CvkZuSeB.js +0 -74
- package/dist/esm/chunks/Chip-o-YG_HAf.js +0 -91
- package/dist/esm/chunks/DivInput-D6ORPrkT.js +0 -202
- package/dist/esm/chunks/DocIcons-CbOX4n8Y.js +0 -39
- package/dist/esm/chunks/Dot-BZcEZbnm.js +0 -78
- package/dist/esm/chunks/DrggablePanel-DWrTjXvf.js +0 -300
- package/dist/esm/chunks/DropDown-BDIvYWI-.js +0 -152
- package/dist/esm/chunks/ErrorSummary-DzDnacH0.js +0 -40
- package/dist/esm/chunks/FileIcon-Cxh-QsYb.js +0 -130
- package/dist/esm/chunks/FileList-yo_u1Kvw.js +0 -161
- package/dist/esm/chunks/FlexDiv-CFyndG99.js +0 -101
- package/dist/esm/chunks/Grouper-NJbpaaQG.js +0 -48
- package/dist/esm/chunks/IconButton-3m9ugITV.js +0 -82
- package/dist/esm/chunks/Label-CgntsR3g.js +0 -132
- package/dist/esm/chunks/Logos-DwZP-TR2.js +0 -117
- package/dist/esm/chunks/Overlay-BolsHW9S.js +0 -43
- package/dist/esm/chunks/Pager-BHLyXq9p.js +0 -40
- package/dist/esm/chunks/ProgressIndicator-uI9BZwBB.js +0 -118
- package/dist/esm/chunks/PromptInput-C_qj6kGp.js +0 -210
- package/dist/esm/chunks/RadioButton-D8otD_Jj.js +0 -63
- package/dist/esm/chunks/RadioButtonList-CtX1j7rO.js +0 -114
- package/dist/esm/chunks/Slider-O6UelMjh.js +0 -283
- package/dist/esm/chunks/Spacer-DbZSG5x3.js +0 -14
- package/dist/esm/chunks/Switch-DjfrSiQz.js +0 -41
- package/dist/esm/chunks/TabBar-C0NgwRa2.js +0 -174
- package/dist/esm/chunks/TextArea-DK0giDGR.js +0 -151
- package/dist/esm/chunks/TextField-CQ4XYYNm.js +0 -246
- package/dist/esm/chunks/Tip-iFECDhwN.js +0 -89
- package/dist/esm/chunks/Toast-ZxMZtbd0.js +0 -156
- package/dist/esm/chunks/_types-RJ7q8S0B.js +0 -712
- package/dist/esm/chunks/sharedTypes-BfZzG1KX.js +0 -9
- package/dist/esm/chunks/style-inject.es-tgCJW-Cu.js +0 -28
- package/dist/esm/chunks/tipStore-nBYJ6tmE.js +0 -17
- package/dist/esm/chunks/toastStore-r3pvNa28.js +0 -17
- package/dist/esm/chunks/tslib.es6-0pkUdtrF.js +0 -45
- package/dist/esm/chunks/utils-CZ1LWeN6.js +0 -121
- package/dist/esm/chunks/windowStore-Cu4W4zJM.js +0 -91
- package/dist/esm/hooks/useDoubleClick.js +0 -24
- package/dist/esm/hooks/useKeyboardShortcuts.js +0 -42
- package/dist/esm/hooks/useLastUpdated.js +0 -51
- package/dist/esm/hooks/useLocalStore.js +0 -50
- package/dist/esm/hooks/useObserveResize.js +0 -54
- package/dist/esm/hooks/useObserveTheme.js +0 -41
- package/dist/esm/hooks/useTheme.js +0 -84
- package/dist/esm/hooks/useToolTip.js +0 -34
- package/dist/esm/hooks/useTrackRenders.js +0 -37
- package/dist/esm/hooks/useWindow.js +0 -84
- package/dist/esm/hooks.js +0 -15
- package/dist/esm/index.js +0 -58
- package/dist/esm/providers/ThemeProvider.js +0 -56
- package/dist/esm/providers.js +0 -8
- package/dist/esm/stores/tip.js +0 -2
- package/dist/esm/stores/toast.js +0 -2
- package/dist/esm/stores/window.js +0 -2
- package/dist/esm/stores.js +0 -4
- package/dist/esm/theme/colors.js +0 -377
- package/dist/esm/theme/corners.js +0 -12
- package/dist/esm/theme/elevations.js +0 -15
- package/dist/esm/theme/themes.js +0 -23
- package/dist/esm/theme/type.js +0 -393
- package/dist/esm/theme.js +0 -5
- package/dist/esm/uikit/Avatar.js +0 -5
- package/dist/esm/uikit/AvatarGroup.js +0 -6
- package/dist/esm/uikit/Badge.js +0 -5
- package/dist/esm/uikit/Button.js +0 -20
- package/dist/esm/uikit/ButtonBar.js +0 -20
- package/dist/esm/uikit/Card.js +0 -15
- package/dist/esm/uikit/CheckBox.js +0 -16
- package/dist/esm/uikit/Chip.js +0 -16
- package/dist/esm/uikit/DivInput.js +0 -7
- package/dist/esm/uikit/DocIcon.js +0 -12
- package/dist/esm/uikit/Dot.js +0 -6
- package/dist/esm/uikit/DraggablePanel.js +0 -15
- package/dist/esm/uikit/DropDown.js +0 -15
- package/dist/esm/uikit/ErrorSummary.js +0 -6
- package/dist/esm/uikit/FileIcon.js +0 -13
- package/dist/esm/uikit/FileList.js +0 -18
- package/dist/esm/uikit/FlexDiv.js +0 -6
- package/dist/esm/uikit/Grouper.js +0 -17
- package/dist/esm/uikit/Icon.js +0 -13
- package/dist/esm/uikit/IconButton.js +0 -19
- package/dist/esm/uikit/Label.js +0 -14
- package/dist/esm/uikit/Logos.js +0 -12
- package/dist/esm/uikit/Overlay.js +0 -6
- package/dist/esm/uikit/Pager.js +0 -6
- package/dist/esm/uikit/Progress.js +0 -14
- package/dist/esm/uikit/PromptInput.js +0 -23
- package/dist/esm/uikit/RadioButton.js +0 -20
- package/dist/esm/uikit/RadioButtonList.js +0 -21
- package/dist/esm/uikit/Slider.js +0 -7
- package/dist/esm/uikit/Spacer.js +0 -4
- package/dist/esm/uikit/Switch.js +0 -6
- package/dist/esm/uikit/TabBar.js +0 -20
- package/dist/esm/uikit/TextArea.js +0 -21
- package/dist/esm/uikit/Textfield.js +0 -22
- package/dist/esm/uikit/Tip.js +0 -7
- package/dist/esm/uikit/Toast.js +0 -16
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React, { useRef, useMemo, useCallback, useEffect } from 'react';
|
|
4
|
-
import { useObserveResize } from '../hooks/useObserveResize.js';
|
|
5
|
-
import { p as pointerPosition } from './utils-CZ1LWeN6.js';
|
|
6
|
-
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* General debounce utility with delay setting and cancel/flush methods
|
|
10
|
-
* to clear a "debounce" or immediately "execute" the debounced function
|
|
11
|
-
*/
|
|
12
|
-
function debounce(func, delay) {
|
|
13
|
-
let timeoutId = null;
|
|
14
|
-
let lastArgs = null;
|
|
15
|
-
const debounced = function (...args) {
|
|
16
|
-
lastArgs = args;
|
|
17
|
-
if (timeoutId !== null) {
|
|
18
|
-
clearTimeout(timeoutId);
|
|
19
|
-
}
|
|
20
|
-
timeoutId = setTimeout(() => {
|
|
21
|
-
func.apply(this, lastArgs !== null && lastArgs !== void 0 ? lastArgs : []);
|
|
22
|
-
timeoutId = null;
|
|
23
|
-
lastArgs = null;
|
|
24
|
-
}, delay);
|
|
25
|
-
};
|
|
26
|
-
debounced.cancel = () => {
|
|
27
|
-
if (timeoutId !== null) {
|
|
28
|
-
clearTimeout(timeoutId);
|
|
29
|
-
timeoutId = null;
|
|
30
|
-
lastArgs = null;
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
debounced.flush = function () {
|
|
34
|
-
if (timeoutId !== null && lastArgs !== null) {
|
|
35
|
-
clearTimeout(timeoutId);
|
|
36
|
-
func.apply(this, lastArgs);
|
|
37
|
-
timeoutId = null;
|
|
38
|
-
lastArgs = null;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
return debounced;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.Slider-module_wrapper__ju4N2 {\n\tposition: relative;\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: var(--slider-padding);\n\tmargin: 0;\n\twidth: var(--slider-width);\n\theight: var(--slider-height);\n\tmin-height: var(--slider-touch-height);\n\tcursor: var(--slider-cursor);\n}\n\n.Slider-module_track__XogMe {\n\tposition: relative;\n\twidth: 0;\n\theight: 100%;\n\tbackground-color: var(--slider-progress-color);\n\toverflow: visible;\n\tpointer-events: none;\n\tborder-radius: 100px;\n}\n\n.Slider-module_trackHead__Ka3pu {\n\tposition: absolute;\n\tdisplay: var(--slider-head-display);\n\tbackground-color: var(--slider-head-color);\n\tpointer-events: none;\n\tborder-radius: var(--slider-head-radius);\n\tmax-width: var(--slider-head-width);\n\tmax-height: var(--slider-head-size);\n\tmin-width: var(--slider-head-width);\n\tmin-height: var(--slider-head-size);\n\ttop: 50%;\n\ttransform: translateY(-50%) translateX(-50%);\n}\n\n.Slider-module_trackBg__4z7Pt {\n\twidth: 100%;\n\theight: var(--slider-height);\n\tbackground-color: var(--slider-track-color);\n\tpointer-events: none;\n\tborder-radius: 100px;\n}\n";
|
|
45
|
-
var css = {"wrapper":"Slider-module_wrapper__ju4N2","track":"Slider-module_track__XogMe flexBox-module_rowStart__nJZnW","trackHead":"Slider-module_trackHead__Ka3pu","trackBg":"Slider-module_trackBg__4z7Pt flexBox-module_rowStart__nJZnW"};
|
|
46
|
-
styleInject(css_248z);
|
|
47
|
-
|
|
48
|
-
const Slider = React.memo((props) => {
|
|
49
|
-
const { value = 25, scaleMin = 0, scaleMax = 100, width, height = 2, touchHeight = 24, trackHeadSize = 7, headType = 'round', trackHeadWidth = 4, cursor = 'default', headColor = 'var(--core-text-primary)', trackColor = 'var(--core-surface-secondary)', progressColor = 'var(--core-text-primary)', onChange = () => null, onDragChange = () => null } = props, divAttributes = __rest(props, ["value", "scaleMin", "scaleMax", "width", "height", "touchHeight", "trackHeadSize", "headType", "trackHeadWidth", "cursor", "headColor", "trackColor", "progressColor", "onChange", "onDragChange"]);
|
|
50
|
-
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
51
|
-
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
52
|
-
const divClass = className ? ` ${className}` : '';
|
|
53
|
-
// hook into the relevant on screen elements
|
|
54
|
-
const ref = useRef(null);
|
|
55
|
-
const track = useRef(null);
|
|
56
|
-
const head = useRef(null);
|
|
57
|
-
// tracking slider values via ref to avoid state issues from direct listeners
|
|
58
|
-
const absProgressRef = useRef(value);
|
|
59
|
-
const relativeProgressRef = useRef(value / scaleMax);
|
|
60
|
-
const didMount = useRef(false);
|
|
61
|
-
// use resize observer to track changes to container size for responsive behavior
|
|
62
|
-
const size = useObserveResize(ref, { ignore: 'height' });
|
|
63
|
-
// use a "debounce" to limit the number of onChange calls
|
|
64
|
-
const debouncedOnChange = debounce((value, percent) => {
|
|
65
|
-
onChange(value, percent);
|
|
66
|
-
}, 0);
|
|
67
|
-
// set padding based on head size since dragging the head all the way to the edge will move it
|
|
68
|
-
// such that half the head would be outside the track constraints
|
|
69
|
-
const padding = useMemo(() => {
|
|
70
|
-
if (headType === 'none' || !trackHeadSize)
|
|
71
|
-
return 0;
|
|
72
|
-
return trackHeadSize / 2;
|
|
73
|
-
}, [headType, trackHeadSize]);
|
|
74
|
-
// set the position of the track progress and track head
|
|
75
|
-
// based on the pixel position / adjust for half the size of the head (= padding)
|
|
76
|
-
const setTrackAndHead = useCallback((pixelPos, max = false) => {
|
|
77
|
-
const tr = track.current;
|
|
78
|
-
const hd = head.current;
|
|
79
|
-
let adjustment = 0;
|
|
80
|
-
if (pixelPos === 0)
|
|
81
|
-
adjustment = padding;
|
|
82
|
-
if (max)
|
|
83
|
-
adjustment = -padding;
|
|
84
|
-
if (tr && hd) {
|
|
85
|
-
tr.style.width = `${pixelPos}px`;
|
|
86
|
-
hd.style.left = `${pixelPos - padding + adjustment}px`;
|
|
87
|
-
}
|
|
88
|
-
didMount.current = true;
|
|
89
|
-
}, [padding]);
|
|
90
|
-
// set the initial position of the slider absolute value within scale
|
|
91
|
-
const initialProgress = useCallback((current) => {
|
|
92
|
-
if (!(ref === null || ref === void 0 ? void 0 : ref.current))
|
|
93
|
-
return;
|
|
94
|
-
const sliderWidth = ref.current.getBoundingClientRect().width;
|
|
95
|
-
let adjustedCurrent = current;
|
|
96
|
-
if (adjustedCurrent > scaleMax || adjustedCurrent < scaleMin) {
|
|
97
|
-
console.warn('Slider outside range. Adjusted to mid point.');
|
|
98
|
-
adjustedCurrent = (scaleMax - scaleMin) / 2;
|
|
99
|
-
}
|
|
100
|
-
const normalized = (adjustedCurrent - scaleMin) / (scaleMax - scaleMin);
|
|
101
|
-
const pixelPos = normalized * sliderWidth;
|
|
102
|
-
absProgressRef.current = adjustedCurrent; // updated the progress value
|
|
103
|
-
relativeProgressRef.current = normalized; // updated the relative value
|
|
104
|
-
const max = relativeProgressRef.current === 1; // flag if at max value
|
|
105
|
-
setTrackAndHead(pixelPos, max);
|
|
106
|
-
didMount.current = true;
|
|
107
|
-
}, [scaleMax, scaleMin, setTrackAndHead]);
|
|
108
|
-
// based on x pos of a mouse drag/click, update the percent and normalized value of the slider
|
|
109
|
-
const progress = useCallback((posX) => {
|
|
110
|
-
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
111
|
-
if (!el)
|
|
112
|
-
return { value: 0, percent: 0 };
|
|
113
|
-
const rect = el.getBoundingClientRect();
|
|
114
|
-
const sliderWidth = rect.width;
|
|
115
|
-
relativeProgressRef.current = posX / sliderWidth;
|
|
116
|
-
absProgressRef.current =
|
|
117
|
-
scaleMin + relativeProgressRef.current * (scaleMax - scaleMin);
|
|
118
|
-
}, [scaleMax, scaleMin]);
|
|
119
|
-
// take a mouse pos and sets the slider position accordingly
|
|
120
|
-
// returns the pos value making sure it's in bounds
|
|
121
|
-
const updateSlider = useCallback((e) => {
|
|
122
|
-
const newPos = pointerPosition(e);
|
|
123
|
-
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
124
|
-
if (!el)
|
|
125
|
-
return 0;
|
|
126
|
-
const rect = el.getBoundingClientRect();
|
|
127
|
-
const sliderWidth = rect.width;
|
|
128
|
-
let pos = newPos - rect.x;
|
|
129
|
-
if (pos > sliderWidth - padding)
|
|
130
|
-
pos = sliderWidth;
|
|
131
|
-
else if (pos < padding)
|
|
132
|
-
pos = 0;
|
|
133
|
-
const max = pos === sliderWidth;
|
|
134
|
-
setTrackAndHead(pos, max);
|
|
135
|
-
return pos;
|
|
136
|
-
}, [setTrackAndHead, padding]);
|
|
137
|
-
// on mouse move, push slider to the updated mouse position and trigger the update events
|
|
138
|
-
// use ref values in the call back to avoid state issues
|
|
139
|
-
const handleMouseMove = useCallback((e) => {
|
|
140
|
-
e.preventDefault();
|
|
141
|
-
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
142
|
-
if (el) {
|
|
143
|
-
const pos = updateSlider(e); // return new pixel pos and updates head/track
|
|
144
|
-
progress(pos); // update the slider progress
|
|
145
|
-
debouncedOnChange(absProgressRef.current, relativeProgressRef.current); // debounce updates
|
|
146
|
-
}
|
|
147
|
-
}, [progress, updateSlider, debouncedOnChange]);
|
|
148
|
-
// on mouse up, push slider to the updated mouse up position and trigger the update events
|
|
149
|
-
// also cleaning up the mouse move and mouse up listeners attached to the window
|
|
150
|
-
const handleMouseUp = useCallback((e) => {
|
|
151
|
-
e.preventDefault();
|
|
152
|
-
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
153
|
-
if (el) {
|
|
154
|
-
const pos = updateSlider(e); // return new pixel pos and updates head/track
|
|
155
|
-
progress(pos);
|
|
156
|
-
debouncedOnChange.cancel(); // cancel current debounce if any
|
|
157
|
-
onDragChange(absProgressRef.current, relativeProgressRef.current); // immediate update
|
|
158
|
-
onChange(absProgressRef.current, relativeProgressRef.current);
|
|
159
|
-
}
|
|
160
|
-
globalThis.removeEventListener('mousemove', handleMouseMove, false);
|
|
161
|
-
globalThis.removeEventListener('touchmove', handleMouseMove, false);
|
|
162
|
-
globalThis.removeEventListener('mouseup', handleMouseUp, false);
|
|
163
|
-
globalThis.removeEventListener('touchend', handleMouseUp, false);
|
|
164
|
-
}, [
|
|
165
|
-
handleMouseMove,
|
|
166
|
-
progress,
|
|
167
|
-
updateSlider,
|
|
168
|
-
debouncedOnChange,
|
|
169
|
-
onDragChange,
|
|
170
|
-
onChange,
|
|
171
|
-
]);
|
|
172
|
-
// On mouse down push the progress of then slider to the mouse down point
|
|
173
|
-
// and trigger events - add the drag and mouse up window listeners
|
|
174
|
-
const handleMouseDown = useCallback((e) => {
|
|
175
|
-
e.preventDefault();
|
|
176
|
-
e.stopPropagation();
|
|
177
|
-
globalThis.addEventListener('mousemove', handleMouseMove, false);
|
|
178
|
-
globalThis.addEventListener('touchmove', handleMouseMove, false);
|
|
179
|
-
globalThis.addEventListener('mouseup', handleMouseUp, false);
|
|
180
|
-
globalThis.addEventListener('touchend', handleMouseUp, false);
|
|
181
|
-
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
182
|
-
if (el) {
|
|
183
|
-
const pos = updateSlider(e); // return new pixel pos and updates head/track
|
|
184
|
-
progress(pos);
|
|
185
|
-
debouncedOnChange.cancel(); // cancel current debounce if any
|
|
186
|
-
onChange(absProgressRef.current, relativeProgressRef.current); // immediate update
|
|
187
|
-
onDragChange(absProgressRef.current, relativeProgressRef.current);
|
|
188
|
-
}
|
|
189
|
-
}, [
|
|
190
|
-
handleMouseMove,
|
|
191
|
-
handleMouseUp,
|
|
192
|
-
onChange,
|
|
193
|
-
onDragChange,
|
|
194
|
-
progress,
|
|
195
|
-
updateSlider,
|
|
196
|
-
debouncedOnChange,
|
|
197
|
-
]);
|
|
198
|
-
// on mount, set the initial position of the slider
|
|
199
|
-
useEffect(() => {
|
|
200
|
-
if (didMount.current && value === absProgressRef.current)
|
|
201
|
-
return;
|
|
202
|
-
initialProgress(value);
|
|
203
|
-
}, [value, initialProgress]);
|
|
204
|
-
// set up slider
|
|
205
|
-
useEffect(() => {
|
|
206
|
-
const el = ref === null || ref === void 0 ? void 0 : ref.current;
|
|
207
|
-
el === null || el === void 0 ? void 0 : el.addEventListener('mousedown', handleMouseDown, false);
|
|
208
|
-
el === null || el === void 0 ? void 0 : el.addEventListener('touchstart', handleMouseDown, false);
|
|
209
|
-
return () => {
|
|
210
|
-
el === null || el === void 0 ? void 0 : el.removeEventListener('mousedown', handleMouseDown, false);
|
|
211
|
-
el === null || el === void 0 ? void 0 : el.removeEventListener('touchstart', handleMouseDown, false);
|
|
212
|
-
};
|
|
213
|
-
}, [handleMouseDown]);
|
|
214
|
-
// respond to size changes triggered by browser resizing as opposed to props
|
|
215
|
-
// note: this causes an extra render with every width prop change
|
|
216
|
-
useEffect(() => {
|
|
217
|
-
var _a;
|
|
218
|
-
const sliderWidth = (_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.offsetWidth;
|
|
219
|
-
if (!sliderWidth || size.width === 0)
|
|
220
|
-
return;
|
|
221
|
-
const max = relativeProgressRef.current === 1;
|
|
222
|
-
setTrackAndHead(relativeProgressRef.current * sliderWidth, max);
|
|
223
|
-
}, [size.width, setTrackAndHead]);
|
|
224
|
-
// memo head color
|
|
225
|
-
const trackHeadColor = useMemo(() => {
|
|
226
|
-
if (headType === 'none')
|
|
227
|
-
return 'transparent';
|
|
228
|
-
return headColor !== null && headColor !== void 0 ? headColor : 'var(--core-text-primary)';
|
|
229
|
-
}, [headColor, headType]);
|
|
230
|
-
// memo head height
|
|
231
|
-
const headSize = useMemo(() => {
|
|
232
|
-
if (headType === 'none')
|
|
233
|
-
return height;
|
|
234
|
-
return trackHeadSize;
|
|
235
|
-
}, [trackHeadSize, headType, height]);
|
|
236
|
-
// memo head width
|
|
237
|
-
const headWidth = useMemo(() => {
|
|
238
|
-
if (headType === 'round')
|
|
239
|
-
return trackHeadSize;
|
|
240
|
-
return trackHeadWidth;
|
|
241
|
-
}, [headType, trackHeadSize, trackHeadWidth]);
|
|
242
|
-
// set container width
|
|
243
|
-
const setWidth = useMemo(() => {
|
|
244
|
-
if (width && typeof width === 'string') {
|
|
245
|
-
if (width === 'auto')
|
|
246
|
-
return '100%';
|
|
247
|
-
return width;
|
|
248
|
-
}
|
|
249
|
-
return `${width !== null && width !== void 0 ? width : 100}px`;
|
|
250
|
-
}, [width]);
|
|
251
|
-
// memo css vars
|
|
252
|
-
const cssVars = useMemo(() => {
|
|
253
|
-
return {
|
|
254
|
-
'--slider-padding': `${padding}px`,
|
|
255
|
-
'--slider-width': setWidth,
|
|
256
|
-
'--slider-height': `${height}px`,
|
|
257
|
-
'--slider-touch-height': `${touchHeight}px`,
|
|
258
|
-
'--slider-cursor': cursor,
|
|
259
|
-
'--slider-head-display': height ? 'block' : 'none',
|
|
260
|
-
'--slider-head-radius': headType === 'round' ? '100%' : '0px',
|
|
261
|
-
'--slider-head-size': `${headSize}px`,
|
|
262
|
-
'--slider-head-width': `${headWidth}px`,
|
|
263
|
-
'--slider-head-color': trackHeadColor,
|
|
264
|
-
'--slider-progress-color': progressColor !== null && progressColor !== void 0 ? progressColor : 'var(--core-text-primary)',
|
|
265
|
-
'--slider-track-color': trackColor !== null && trackColor !== void 0 ? trackColor : 'var(--core-surface-secondary)',
|
|
266
|
-
};
|
|
267
|
-
}, [
|
|
268
|
-
padding,
|
|
269
|
-
height,
|
|
270
|
-
touchHeight,
|
|
271
|
-
cursor,
|
|
272
|
-
headWidth,
|
|
273
|
-
progressColor,
|
|
274
|
-
trackColor,
|
|
275
|
-
headSize,
|
|
276
|
-
trackHeadColor,
|
|
277
|
-
headType,
|
|
278
|
-
setWidth,
|
|
279
|
-
]);
|
|
280
|
-
return (jsx("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), ref: ref }, rest, { children: jsx("div", { className: css.trackBg, children: jsx("div", { className: css.track, ref: track, children: jsx("div", { className: css.trackHead, ref: head }) }) }) })));
|
|
281
|
-
});
|
|
282
|
-
|
|
283
|
-
export { Slider as S };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import React, { useMemo } from 'react';
|
|
4
|
-
|
|
5
|
-
const Spacer = React.memo((props) => {
|
|
6
|
-
const { size = 8 } = props, divAttributes = __rest(props, ["size"]);
|
|
7
|
-
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
8
|
-
const spacerStyle = useMemo(() => ({ height: size, minHeight: size, maxHeight: size }), [size]);
|
|
9
|
-
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
10
|
-
const divClass = className ? ` ${className}` : '';
|
|
11
|
-
return (jsx("div", Object.assign({ id: divId, className: divClass.trim(), style: Object.assign(Object.assign({}, divStyle), spacerStyle) }, rest)));
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
export { Spacer as S };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { motion } from 'motion/react';
|
|
4
|
-
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
5
|
-
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
6
|
-
|
|
7
|
-
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.Switch-module_wrapper__OqM0E {\n\tpadding: var(--switch-padding) !important;\n\twidth: var(--switch-width);\n\theight: var(--switch-height);\n\tborder-radius: 100px;\n\tcursor: pointer;\n\tbackground: var(--switch-bg-color);\n\ttransition: background 0.25s ease-in-out 0s;\n}\n\n.Switch-module_knob__BLGda {\n\twidth: var(--switch-knob-size);\n\theight: var(--switch-knob-size);\n\tbackground: var(--switch-knob-color);\n\tborder-radius: 100%;\n}\n";
|
|
8
|
-
var css = {"wrapper":"Switch-module_wrapper__OqM0E flexBox-module_row__PWxbe","knob":"Switch-module_knob__BLGda flexBox-module_row__PWxbe"};
|
|
9
|
-
styleInject(css_248z);
|
|
10
|
-
|
|
11
|
-
const Switch = React.memo((props) => {
|
|
12
|
-
const { state = false, height = 22, width = 44, padding = 3, bgColorOn = 'var(--feedback-positive)', bgColorOff = 'var(--core-text-disabled)', knobColor = 'var(--core-surface-primary)', onChange = () => null } = props, divAttributes = __rest(props, ["state", "height", "width", "padding", "bgColorOn", "bgColorOff", "knobColor", "onChange"]);
|
|
13
|
-
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
14
|
-
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
15
|
-
const divClass = className ? ` ${className}` : '';
|
|
16
|
-
const [on, setOn] = useState(state);
|
|
17
|
-
// Sync with prop changes
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setOn(state);
|
|
20
|
-
}, [state]);
|
|
21
|
-
const handleClick = useCallback(() => {
|
|
22
|
-
setOn(!on);
|
|
23
|
-
onChange(!on);
|
|
24
|
-
}, [on, onChange]);
|
|
25
|
-
// Memoize style object
|
|
26
|
-
const justify = useMemo(() => ({ justifyContent: on ? 'flex-end' : 'flex-start' }), [on]);
|
|
27
|
-
// memo css vars
|
|
28
|
-
const cssVars = useMemo(() => {
|
|
29
|
-
return {
|
|
30
|
-
'--switch-width': `${width}px`,
|
|
31
|
-
'--switch-height': `${height}px`,
|
|
32
|
-
'--switch-padding': `${padding}px`,
|
|
33
|
-
'--switch-knob-size': `${height - padding * 2}px`,
|
|
34
|
-
'--switch-knob-color': knobColor,
|
|
35
|
-
'--switch-bg-color': on ? bgColorOn : bgColorOff,
|
|
36
|
-
};
|
|
37
|
-
}, [width, height, padding, bgColorOff, bgColorOn, on, knobColor]);
|
|
38
|
-
return (jsx(motion.div, Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign(Object.assign({}, divStyle), justify), cssVars), onClick: handleClick }, rest, { children: jsx(motion.div, { className: css.knob, layout: 'preserve-aspect' }) })));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export { Switch as S };
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import React, { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
|
4
|
-
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
-
import '../theme/colors.js';
|
|
6
|
-
import '../hooks/useWindow.js';
|
|
7
|
-
import { B as Badge } from './Badge-DtxDLSO0.js';
|
|
8
|
-
import { I as Icon } from './_types-RJ7q8S0B.js';
|
|
9
|
-
import { I as IconButton } from './IconButton-3m9ugITV.js';
|
|
10
|
-
import { T as ToolTipType } from './sharedTypes-BfZzG1KX.js';
|
|
11
|
-
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
12
|
-
|
|
13
|
-
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.type-module_body-xs-regular__QWEzl {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-medium__FxEAv {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-xs-bold__rf7AV {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xs);\n\tline-height: 133.33%;\n\ttext-decoration: none;\n\tletter-spacing: 0.25px;\n}.type-module_body-s-regular__8-FO- {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-medium__qyYq- {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-s-bold__7GQ5Z {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-s);\n\tline-height: 142.86%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-m-regular__Qtp5G {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-medium__Ieh9K {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-m-bold__0lZ3I {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-m);\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_body-l-regular__Ar4d3 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-medium__6tV1n {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-l-bold__I8Q1v {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-l);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_body-xl-regular__zDf-z {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-regular);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-medium__R5GpK {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-medium);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.1px;\n}.type-module_body-xl-bold__SI-hC {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: var(--font-weight-bold);\n\tfont-size: var(--font-size-xl);\n\tline-height: 162.5%;\n\ttext-decoration: none;\n\tletter-spacing: 0.15px;\n}.type-module_heading-s-medium__jGIb2 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-bold__QFgN8 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-bold__tdBSi {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-m-medium__-7Uyu {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 24px;\n\tline-height: 116.67%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-medium__8hGYF {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-l-bold__Cryjg {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 30px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-medium__PUi44 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 500;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-xl-bold__1B6fk {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 600;\n\tfont-size: 36px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.TabBar-module_wrapper__z8Cvg {\n\tgap: var(--tab-bar-gap);\n\tborder-bottom: var(--tab-bar-border-bottom) solid var(--core-outline-primary);\n\theight: var(--tab-bar-height);\n\twidth: var(--tab-bar-width);\n\tcursor: pointer;\n}\n\n.TabBar-module_option__Og-E4 {\n\tgap: var(--tab-bar-option-gap);\n\tcolor: var(--tab-bar-option-color);\n\tpadding: var(--tab-bar-option-padding) !important;\n\theight: 100%;\n\twidth: var(--tab-bar-option-width);\n\tflex: var(--tab-bar-option-flex);\n\twhite-space: nowrap;\n\tbox-shadow: 0 var(--tab-bar-option-border) 0 0 var(--core-text-special);\n\tcursor: var(--tab-bar-option-cursor);\n\t-webkit-user-select: none;\n\tuser-select: none;\n}\n\n.TabBar-module_icon__LU5Rp {\n\tmax-height: var(--tab-bar-icon-size);\n\tmin-height: var(--tab-bar-icon-size);\n\tmax-width: var(--tab-bar-icon-size);\n\tmin-width: var(--tab-bar-icon-size);\n}\n\n.TabBar-module_close__ytzs5 {\n\theight: 100%;\n\tpadding: var(--tab-bar-close-padding) !important;\n\tborder-left: 1px solid var(--core-outline-primary);\n\twidth: min-content;\n}\n";
|
|
14
|
-
var css = {"wrapper":"TabBar-module_wrapper__z8Cvg flexBox-module_rowStart__nJZnW","option":"TabBar-module_option__Og-E4 flexBox-module_row__PWxbe type-module_body-m-regular__Qtp5G","icon":"TabBar-module_icon__LU5Rp flexBox-module_row__PWxbe","close":"TabBar-module_close__ytzs5 flexBox-module_row__PWxbe"};
|
|
15
|
-
styleInject(css_248z);
|
|
16
|
-
|
|
17
|
-
const placeholderOptions = [
|
|
18
|
-
{ name: 'Option 1', value: 'Option 1', icon: null },
|
|
19
|
-
{ name: 'Option 2', value: 'Option 2', icon: 'wallet' },
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
const TabBar = React.memo((props) => {
|
|
23
|
-
const { options = placeholderOptions, selected = 0, border = true, underline = true, height = '100%', width = '100%', tabWidth = 'distribute', padding = 8, iconSize = 20, iconGap = 8, tabGap = 0, disabled = false, hasClose = false, closeWidth = 'auto', selectedValue = null, onChange = () => null, onTabChange = () => null, onClose = () => null, onToolTip = () => null } = props, divAttributes = __rest(props, ["options", "selected", "border", "underline", "height", "width", "tabWidth", "padding", "iconSize", "iconGap", "tabGap", "disabled", "hasClose", "closeWidth", "selectedValue", "onChange", "onTabChange", "onClose", "onToolTip"]);
|
|
24
|
-
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
25
|
-
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
26
|
-
const divClass = className ? ` ${className}` : '';
|
|
27
|
-
const [index, setIndex] = useState(selected);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
let selectedIndex = 0;
|
|
30
|
-
if (selectedValue && options) {
|
|
31
|
-
selectedIndex = options.findIndex((option) => option.value === selectedValue);
|
|
32
|
-
setIndex(selectedIndex === -1 ? selected : selectedIndex);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
setIndex(selected);
|
|
36
|
-
}
|
|
37
|
-
}, [selected, selectedValue, options]);
|
|
38
|
-
// memo handleClick
|
|
39
|
-
const handleClick = useCallback((i) => {
|
|
40
|
-
setIndex(i);
|
|
41
|
-
onChange(i);
|
|
42
|
-
onTabChange(options[i]);
|
|
43
|
-
}, [onChange, onTabChange, options]);
|
|
44
|
-
// memo handleOptionClick
|
|
45
|
-
const handleOptionClick = useCallback((i) => {
|
|
46
|
-
onToolTip(null);
|
|
47
|
-
handleClick(i);
|
|
48
|
-
}, [onToolTip, handleClick]);
|
|
49
|
-
// memo rendered options
|
|
50
|
-
const renderedOptions = useMemo(() => options.map((option, i) => (jsx(Option, { label: option.name, value: i, showToolTip: option.toolTip, selected: i === index, padding: padding, icon: option.icon, iconSize: iconSize, iconGap: iconGap, disabled: disabled, count: option.count, onClick: handleOptionClick, onToolTip: onToolTip, underline: underline, tabWidth: tabWidth }, `${i}_option_${option.name}`))), [
|
|
51
|
-
options,
|
|
52
|
-
index,
|
|
53
|
-
padding,
|
|
54
|
-
iconSize,
|
|
55
|
-
iconGap,
|
|
56
|
-
disabled,
|
|
57
|
-
underline,
|
|
58
|
-
tabWidth,
|
|
59
|
-
onToolTip,
|
|
60
|
-
handleOptionClick,
|
|
61
|
-
]);
|
|
62
|
-
const setStyle = useCallback((value) => {
|
|
63
|
-
if (typeof value === 'string')
|
|
64
|
-
return value;
|
|
65
|
-
return `${value}px`;
|
|
66
|
-
}, []);
|
|
67
|
-
const cssVars = useMemo(() => {
|
|
68
|
-
return {
|
|
69
|
-
'--tab-bar-gap': `${tabGap}px`,
|
|
70
|
-
'--tab-bar-height': `${setStyle(height)}px`,
|
|
71
|
-
'--tab-bar-width': setStyle(width),
|
|
72
|
-
'--tab-bar-border-bottom': `${border ? '1px' : '0'}`,
|
|
73
|
-
'--tab-bar-close-width': `${closeWidth}px`,
|
|
74
|
-
'--tab-bar-close-padding': padding ? `${padding}px` : '8px',
|
|
75
|
-
};
|
|
76
|
-
}, [tabGap, height, width, border, setStyle, closeWidth, padding]);
|
|
77
|
-
return (jsxs("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars) }, rest, { children: [renderedOptions, hasClose && (jsx("div", { className: css.close, children: jsx(IconButton, { iconSize: iconSize - 4, frameSize: iconSize, toggle: false, hover: true, icon: 'x', onClick: onClose }) }))] })));
|
|
78
|
-
});
|
|
79
|
-
TabBar.displayName = 'TabBar';
|
|
80
|
-
const Option = React.memo((props) => {
|
|
81
|
-
const theme = useTheme();
|
|
82
|
-
const { label = 'Option', value = 0, icon = null, selected = false, onClick = () => null, onToolTip = () => null, padding = 8, iconSize = 20, iconGap = 6, disabled = false, showToolTip = null, underline = true, tabWidth = 'distribute', count = 0, } = props;
|
|
83
|
-
const ref = useRef(null);
|
|
84
|
-
// memo icon color
|
|
85
|
-
const strokeColor = useMemo(() => {
|
|
86
|
-
if (!disabled && selected)
|
|
87
|
-
return theme.current.colors['core-text-special'];
|
|
88
|
-
if (disabled)
|
|
89
|
-
return theme.current.colors['core-text-disabled'];
|
|
90
|
-
return theme.current.colors['core-text-primary'];
|
|
91
|
-
}, [disabled, selected, theme]);
|
|
92
|
-
// memo handleMouseOver
|
|
93
|
-
const handleMouseOver = useCallback((e) => {
|
|
94
|
-
onToolTip(null);
|
|
95
|
-
if (showToolTip && ref.current) {
|
|
96
|
-
const tip = {
|
|
97
|
-
type: ToolTipType.button,
|
|
98
|
-
payload: { label: showToolTip },
|
|
99
|
-
event: e,
|
|
100
|
-
ref,
|
|
101
|
-
};
|
|
102
|
-
onToolTip(tip);
|
|
103
|
-
}
|
|
104
|
-
}, [showToolTip, onToolTip]);
|
|
105
|
-
// memo handleMouseLeave
|
|
106
|
-
const handleMouseLeave = useCallback(() => {
|
|
107
|
-
if (showToolTip)
|
|
108
|
-
onToolTip(null);
|
|
109
|
-
}, [showToolTip, onToolTip]);
|
|
110
|
-
// memo color
|
|
111
|
-
const textColor = useMemo(() => {
|
|
112
|
-
if (disabled)
|
|
113
|
-
return 'var(--core-text-disabled)';
|
|
114
|
-
if (selected)
|
|
115
|
-
return 'var(--core-text-special)';
|
|
116
|
-
return 'var(--core-text-primary)';
|
|
117
|
-
}, [disabled, selected]);
|
|
118
|
-
// memo tab width
|
|
119
|
-
const setTabWidth = useMemo(() => {
|
|
120
|
-
if (tabWidth === 'min-content')
|
|
121
|
-
return 'min-content';
|
|
122
|
-
if (tabWidth === 'distribute')
|
|
123
|
-
return 'unset';
|
|
124
|
-
return `${tabWidth}px`;
|
|
125
|
-
}, [tabWidth]);
|
|
126
|
-
// memo flex tab
|
|
127
|
-
const setTabFlex = useMemo(() => {
|
|
128
|
-
if (tabWidth === 'distribute')
|
|
129
|
-
return '1';
|
|
130
|
-
return 'unset';
|
|
131
|
-
}, [tabWidth]);
|
|
132
|
-
// memo underline
|
|
133
|
-
const setUnderline = useMemo(() => {
|
|
134
|
-
if (selected && underline && !disabled)
|
|
135
|
-
return '1px';
|
|
136
|
-
return '0';
|
|
137
|
-
}, [underline, disabled, selected]);
|
|
138
|
-
const cssVars = useMemo(() => {
|
|
139
|
-
return {
|
|
140
|
-
'--tab-bar-option-border': setUnderline,
|
|
141
|
-
'--tab-bar-option-padding': `${padding}px`,
|
|
142
|
-
'--tab-bar-option-icon-size': `${iconSize}px`,
|
|
143
|
-
'--tab-bar-option-cursor': disabled ? 'default' : 'pointer',
|
|
144
|
-
'--tab-bar-option-gap': `${iconGap !== null && iconGap !== void 0 ? iconGap : 0}px`,
|
|
145
|
-
'--tab-bar-option-color': textColor,
|
|
146
|
-
'--tab-bar-option-width': setTabWidth,
|
|
147
|
-
'--tab-bar-option-flex': setTabFlex,
|
|
148
|
-
};
|
|
149
|
-
}, [
|
|
150
|
-
padding,
|
|
151
|
-
iconSize,
|
|
152
|
-
disabled,
|
|
153
|
-
textColor,
|
|
154
|
-
iconGap,
|
|
155
|
-
setTabFlex,
|
|
156
|
-
setTabWidth,
|
|
157
|
-
setUnderline,
|
|
158
|
-
]);
|
|
159
|
-
return (jsxs("div", { className: css.option, style: cssVars, ref: ref, "aria-selected": selected, onMouseEnter: handleMouseOver, onMouseLeave: handleMouseLeave, onClick: () => onClick(value), onKeyDown: () => onClick(value), children: [icon && (jsx("div", { className: css.icon, children: jsx(Icon, { name: icon, size: iconSize, strokeColor: strokeColor }) })), label, count !== 0 && (jsx(Badge, { variant: 'light', hideNull: false, count: count }))] }));
|
|
160
|
-
}, (prevProps, nextProps) => {
|
|
161
|
-
// Custom comparison for performance
|
|
162
|
-
return (prevProps.selected === nextProps.selected &&
|
|
163
|
-
prevProps.underline === nextProps.underline &&
|
|
164
|
-
prevProps.tabWidth === nextProps.tabWidth &&
|
|
165
|
-
prevProps.disabled === nextProps.disabled &&
|
|
166
|
-
prevProps.iconGap === nextProps.iconGap &&
|
|
167
|
-
prevProps.iconSize === nextProps.iconSize &&
|
|
168
|
-
prevProps.count === nextProps.count &&
|
|
169
|
-
prevProps.label === nextProps.label &&
|
|
170
|
-
prevProps.icon === nextProps.icon);
|
|
171
|
-
});
|
|
172
|
-
Option.displayName = 'TabOption';
|
|
173
|
-
|
|
174
|
-
export { TabBar as T };
|