@apple-pie/slice 0.0.0 → 0.0.2
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-8-wPWe0V.js +68 -0
- package/dist/cjs/chunks/AvatarGroup-CVKmgBbD.js +39 -0
- package/dist/cjs/chunks/Badge-CMapJCij.js +41 -0
- package/dist/cjs/chunks/CheckBox-7AACxrdZ.js +76 -0
- package/dist/cjs/chunks/DivInput-BKKJTFeV.js +204 -0
- package/dist/cjs/chunks/DocIcons-BRWOzK96.js +41 -0
- package/dist/cjs/chunks/Dot-Dnr9M9na.js +80 -0
- package/dist/cjs/chunks/DrggablePanel-C6TPsDB-.js +302 -0
- package/dist/cjs/chunks/DropDown-D9sf_m2I.js +154 -0
- package/dist/cjs/chunks/EditorButtonBar-CUNDgRQd.js +244 -0
- package/dist/cjs/chunks/ErrorSummary-Dv44onsV.js +42 -0
- package/dist/cjs/chunks/FlexDiv-DZBpswHV.js +103 -0
- package/dist/cjs/chunks/Grouper-_kd2nU78.js +50 -0
- package/dist/cjs/chunks/IconButton-BfsPlKTb.js +84 -0
- package/dist/cjs/chunks/Logos-DSlAUz8l.js +119 -0
- package/dist/cjs/chunks/MessageInput-CiHFo2j8.js +399 -0
- package/dist/cjs/chunks/Overlay-DwCPvGB5.js +45 -0
- package/dist/cjs/chunks/Pager-CFtZ0IIW.js +42 -0
- package/dist/cjs/chunks/ProgressIndicator-C5oB7Mky.js +121 -0
- package/dist/cjs/chunks/RadioButton-e_y2qiPE.js +65 -0
- package/dist/cjs/chunks/RadioButtonList-I81UwHmM.js +116 -0
- package/dist/cjs/chunks/Slider-C-gn7Sby.js +285 -0
- package/dist/cjs/chunks/Spacer-BEY2-_PB.js +16 -0
- package/dist/cjs/chunks/Switch-CtkFtogd.js +43 -0
- package/dist/cjs/chunks/TabBar-D3bj4pjj.js +176 -0
- package/dist/cjs/chunks/TextArea-B1oKK3_b.js +153 -0
- package/dist/cjs/chunks/TextField-CiQdPP5E.js +248 -0
- package/dist/cjs/chunks/Tip-C2pzExut.js +91 -0
- package/dist/cjs/chunks/Toast-DrijUwoL.js +141 -0
- package/dist/cjs/chunks/UIButton-CH4p-8yq.js +317 -0
- package/dist/cjs/chunks/UIButtonBar-0fHPB0ww.js +58 -0
- package/dist/cjs/chunks/UICard-DBDSyT7E.js +36 -0
- package/dist/cjs/chunks/UIChip-kjhvRrOV.js +93 -0
- package/dist/cjs/chunks/UIFileIcon-ZrbDIeYz.js +54 -0
- package/dist/cjs/chunks/UILabel-DkBE2AIt.js +116 -0
- package/dist/cjs/chunks/_types-CoWzQFsT.js +714 -0
- package/dist/cjs/chunks/sharedTypes-BvTjh6M5.js +9 -0
- package/dist/cjs/chunks/style-inject.es-XZHJH68X.js +30 -0
- package/dist/cjs/chunks/tipStore-C9oV9SIh.js +23 -0
- package/dist/cjs/chunks/toastStore-C-ETP9H6.js +23 -0
- package/dist/cjs/chunks/tslib.es6-4H29ixHs.js +48 -0
- package/dist/cjs/chunks/utils-CbayehuI.js +126 -0
- package/dist/cjs/hooks/useDoubleClick.js +26 -0
- package/dist/cjs/hooks/useKeyboardShortcuts.js +42 -0
- package/dist/cjs/hooks/useLastUpdated.js +53 -0
- package/dist/cjs/hooks/useLocalStore.js +52 -0
- package/dist/cjs/hooks/useObserveResize.js +56 -0
- package/dist/cjs/hooks/useObserveTheme.js +36 -0
- package/dist/cjs/hooks/useTheme.js +85 -0
- package/dist/cjs/hooks/useToolTip.js +36 -0
- package/dist/cjs/hooks/useTrackRenders.js +38 -0
- package/dist/cjs/hooks/useWindow.js +64 -0
- package/dist/cjs/hooks.js +32 -0
- package/dist/cjs/index.js +121 -0
- package/dist/cjs/providers/ThemeProvider.js +51 -0
- package/dist/cjs/providers.js +13 -0
- package/dist/cjs/stores/tip.js +12 -0
- package/dist/cjs/stores/toast.js +12 -0
- package/dist/cjs/stores.js +18 -0
- package/dist/cjs/theme/colors.js +383 -0
- package/dist/cjs/theme/corners.js +14 -0
- package/dist/cjs/theme/themes.js +23 -0
- package/dist/cjs/theme/type.js +316 -0
- package/dist/cjs/theme.js +13 -0
- package/dist/cjs/uikit/Avatar.js +11 -0
- package/dist/cjs/uikit/AvatarGroup.js +12 -0
- package/dist/cjs/uikit/Badge.js +11 -0
- package/dist/cjs/uikit/CheckBox.js +21 -0
- package/dist/cjs/uikit/DivInput.js +13 -0
- package/dist/cjs/uikit/DocIcon.js +17 -0
- package/dist/cjs/uikit/Dot.js +12 -0
- package/dist/cjs/uikit/DraggablePanel.js +20 -0
- package/dist/cjs/uikit/DropDown.js +20 -0
- package/dist/cjs/uikit/EditorButtonBar.js +27 -0
- package/dist/cjs/uikit/ErrorSummary.js +12 -0
- package/dist/cjs/uikit/FlexDiv.js +12 -0
- package/dist/cjs/uikit/Grouper.js +22 -0
- package/dist/cjs/uikit/Icon.js +22 -0
- package/dist/cjs/uikit/IconButton.js +24 -0
- package/dist/cjs/uikit/Logos.js +17 -0
- package/dist/cjs/uikit/MessageInput.js +29 -0
- package/dist/cjs/uikit/Overlay.js +12 -0
- package/dist/cjs/uikit/Pager.js +12 -0
- package/dist/cjs/uikit/Progress.js +20 -0
- package/dist/cjs/uikit/RadioButton.js +25 -0
- package/dist/cjs/uikit/RadioButtonList.js +26 -0
- package/dist/cjs/uikit/Slider.js +13 -0
- package/dist/cjs/uikit/Spacer.js +10 -0
- package/dist/cjs/uikit/Switch.js +12 -0
- package/dist/cjs/uikit/TabBar.js +25 -0
- package/dist/cjs/uikit/TextArea.js +26 -0
- package/dist/cjs/uikit/Textfield.js +27 -0
- package/dist/cjs/uikit/Tip.js +13 -0
- package/dist/cjs/uikit/Toast.js +25 -0
- package/dist/cjs/uikit/UIButton.js +25 -0
- package/dist/cjs/uikit/UIButtonBar.js +25 -0
- package/dist/cjs/uikit/UICard.js +20 -0
- package/dist/cjs/uikit/UIChip.js +21 -0
- package/dist/cjs/uikit/UIFileIcon.js +17 -0
- package/dist/cjs/uikit/UILabel.js +18 -0
- package/dist/esm/chunks/Avatar-D_muqPrW.js +66 -0
- package/dist/esm/chunks/AvatarGroup-D8Xmrn52.js +37 -0
- package/dist/esm/chunks/Badge-PPf5Uvw3.js +39 -0
- package/dist/esm/chunks/CheckBox-CswFI0Xc.js +74 -0
- package/dist/esm/chunks/DivInput-iKFkeU2F.js +202 -0
- package/dist/esm/chunks/DocIcons-CbOX4n8Y.js +39 -0
- package/dist/esm/chunks/Dot-B84UVs2e.js +78 -0
- package/dist/esm/chunks/DrggablePanel-CYYwTmFd.js +300 -0
- package/dist/esm/chunks/DropDown-D4t6EhKL.js +152 -0
- package/dist/esm/chunks/EditorButtonBar-FnMa8Zv2.js +242 -0
- package/dist/esm/chunks/ErrorSummary-DhU5SKPt.js +40 -0
- package/dist/esm/chunks/FlexDiv-CmMpORgn.js +101 -0
- package/dist/esm/chunks/Grouper-BbreOXI9.js +48 -0
- package/dist/esm/chunks/IconButton-CguHGkBM.js +82 -0
- package/dist/esm/chunks/Logos-DwZP-TR2.js +117 -0
- package/dist/esm/chunks/MessageInput-DMHzCwjO.js +397 -0
- package/dist/esm/chunks/Overlay-CCBy7n7H.js +43 -0
- package/dist/esm/chunks/Pager-BsSti93V.js +40 -0
- package/dist/esm/chunks/ProgressIndicator-BVukxMU6.js +118 -0
- package/dist/esm/chunks/RadioButton-B5BxQI0R.js +63 -0
- package/dist/esm/chunks/RadioButtonList-C2z8McAD.js +114 -0
- package/dist/esm/chunks/Slider-C-PcWqTz.js +283 -0
- package/dist/esm/chunks/Spacer-DbZSG5x3.js +14 -0
- package/dist/esm/chunks/Switch-DjfrSiQz.js +41 -0
- package/dist/esm/chunks/TabBar-BSBcgTbd.js +174 -0
- package/dist/esm/chunks/TextArea-COM0UPo2.js +151 -0
- package/dist/esm/chunks/TextField-Bh24bRWs.js +246 -0
- package/dist/esm/chunks/Tip-Ct19Ljul.js +89 -0
- package/dist/esm/chunks/Toast-BR0oMX6z.js +139 -0
- package/dist/esm/chunks/UIButton-DKx-_O8h.js +315 -0
- package/dist/esm/chunks/UIButtonBar-BNdA5eVq.js +56 -0
- package/dist/esm/chunks/UICard-Dn5f3wg8.js +34 -0
- package/dist/esm/chunks/UIChip-DqnGeVyR.js +91 -0
- package/dist/esm/chunks/UIFileIcon-qGxIPsJJ.js +52 -0
- package/dist/esm/chunks/UILabel-RnbodPCS.js +114 -0
- package/dist/esm/chunks/_types-BaYeLEWK.js +712 -0
- package/dist/esm/chunks/sharedTypes-BfZzG1KX.js +9 -0
- package/dist/esm/chunks/style-inject.es-tgCJW-Cu.js +28 -0
- package/dist/esm/chunks/tipStore-nBYJ6tmE.js +17 -0
- package/dist/esm/chunks/toastStore-r3pvNa28.js +17 -0
- package/dist/esm/chunks/tslib.es6-0pkUdtrF.js +45 -0
- package/dist/esm/chunks/utils-BRZK2Drn.js +119 -0
- package/dist/esm/hooks/useDoubleClick.js +24 -0
- package/dist/esm/hooks/useKeyboardShortcuts.js +40 -0
- package/dist/esm/hooks/useLastUpdated.js +51 -0
- package/dist/esm/hooks/useLocalStore.js +50 -0
- package/dist/esm/hooks/useObserveResize.js +54 -0
- package/dist/esm/hooks/useObserveTheme.js +34 -0
- package/dist/esm/hooks/useTheme.js +83 -0
- package/dist/esm/hooks/useToolTip.js +34 -0
- package/dist/esm/hooks/useTrackRenders.js +36 -0
- package/dist/esm/hooks/useWindow.js +62 -0
- package/dist/esm/hooks.js +14 -0
- package/dist/esm/index.js +57 -0
- package/dist/esm/providers/ThemeProvider.js +49 -0
- package/dist/esm/providers.js +7 -0
- package/dist/esm/stores/tip.js +2 -0
- package/dist/esm/stores/toast.js +2 -0
- package/dist/esm/stores.js +3 -0
- package/dist/esm/theme/colors.js +377 -0
- package/dist/esm/theme/corners.js +12 -0
- package/dist/esm/theme/themes.js +20 -0
- package/dist/esm/theme/type.js +312 -0
- package/dist/esm/theme.js +4 -0
- package/dist/esm/uikit/Avatar.js +5 -0
- package/dist/esm/uikit/AvatarGroup.js +6 -0
- package/dist/esm/uikit/Badge.js +5 -0
- package/dist/esm/uikit/CheckBox.js +15 -0
- package/dist/esm/uikit/DivInput.js +7 -0
- package/dist/esm/uikit/DocIcon.js +11 -0
- package/dist/esm/uikit/Dot.js +6 -0
- package/dist/esm/uikit/DraggablePanel.js +14 -0
- package/dist/esm/uikit/DropDown.js +14 -0
- package/dist/esm/uikit/EditorButtonBar.js +21 -0
- package/dist/esm/uikit/ErrorSummary.js +6 -0
- package/dist/esm/uikit/FlexDiv.js +6 -0
- package/dist/esm/uikit/Grouper.js +16 -0
- package/dist/esm/uikit/Icon.js +12 -0
- package/dist/esm/uikit/IconButton.js +18 -0
- package/dist/esm/uikit/Logos.js +11 -0
- package/dist/esm/uikit/MessageInput.js +23 -0
- package/dist/esm/uikit/Overlay.js +6 -0
- package/dist/esm/uikit/Pager.js +6 -0
- package/dist/esm/uikit/Progress.js +13 -0
- package/dist/esm/uikit/RadioButton.js +19 -0
- package/dist/esm/uikit/RadioButtonList.js +20 -0
- package/dist/esm/uikit/Slider.js +7 -0
- package/dist/esm/uikit/Spacer.js +4 -0
- package/dist/esm/uikit/Switch.js +6 -0
- package/dist/esm/uikit/TabBar.js +19 -0
- package/dist/esm/uikit/TextArea.js +20 -0
- package/dist/esm/uikit/Textfield.js +21 -0
- package/dist/esm/uikit/Tip.js +7 -0
- package/dist/esm/uikit/Toast.js +15 -0
- package/dist/esm/uikit/UIButton.js +19 -0
- package/dist/esm/uikit/UIButtonBar.js +19 -0
- package/dist/esm/uikit/UICard.js +14 -0
- package/dist/esm/uikit/UIChip.js +15 -0
- package/dist/esm/uikit/UIFileIcon.js +11 -0
- package/dist/esm/uikit/UILabel.js +12 -0
- package/dist/types/hooks/index.d.ts +9 -2
- package/dist/types/hooks/useDoubleClick/useDoubleClick.d.ts +1 -0
- package/dist/types/hooks/useKeyboardShortcuts/useKeyboardShortcuts.d.ts +6 -0
- package/dist/types/hooks/useLastUpdated/useLastUpdated.d.ts +4 -0
- package/dist/types/hooks/useLocalStore/useLocalStore.d.ts +1 -0
- package/dist/types/hooks/{useObserveResize.d.ts → useObserveResize/useObserveResize.d.ts} +1 -1
- package/dist/types/hooks/useObserveTheme/useObserveTheme.d.ts +2 -0
- package/dist/types/hooks/useTheme/useTheme.d.ts +47 -0
- package/dist/types/hooks/useToolTip/useToolTip.d.ts +6 -0
- package/dist/types/hooks/useWindow/useWindow.d.ts +15 -0
- package/dist/types/index.d.ts +9 -4
- package/dist/types/providers/ThemeProvider.d.ts +1 -0
- package/dist/types/stores/index.d.ts +2 -0
- package/dist/types/stores/tip/_types.d.ts +8 -0
- package/dist/types/stores/tip/index.d.ts +2 -0
- package/dist/types/stores/tip/tipStore.d.ts +12 -0
- package/dist/types/stores/toast/_types.d.ts +14 -0
- package/dist/types/stores/toast/index.d.ts +2 -0
- package/dist/types/stores/toast/toastStore.d.ts +12 -0
- package/dist/types/theme/colors/colors.d.ts +2 -0
- package/dist/types/theme/colors/types.d.ts +14 -0
- package/dist/types/theme/components/BrandColors.d.ts +1 -0
- package/dist/types/theme/components/ColorTile.d.ts +6 -0
- package/dist/types/theme/components/ColorTileGroup.d.ts +6 -0
- package/dist/types/theme/components/ThemeColors.d.ts +2 -0
- package/dist/types/theme/components/_types.d.ts +15 -0
- package/dist/types/theme/index.d.ts +1 -1
- package/dist/types/theme/themes.d.ts +3 -3
- package/dist/types/theme/type/type.d.ts +3 -0
- package/dist/types/uikit/Avatar/_types.d.ts +3 -2
- package/dist/types/uikit/AvatarGroup/_types.d.ts +4 -2
- package/dist/types/uikit/Badge/_types.d.ts +5 -2
- package/dist/types/uikit/CheckBox/_types.d.ts +5 -2
- package/dist/types/uikit/DivInput/_types.d.ts +4 -2
- package/dist/types/uikit/DocIcon/_types.d.ts +5 -2
- package/dist/types/uikit/Dot/_types.d.ts +6 -2
- package/dist/types/uikit/DraggablePanel/DrggablePanel.d.ts +3 -2
- package/dist/types/uikit/DropDown/DropDown.d.ts +2 -1
- package/dist/types/uikit/DropDown/_types.d.ts +5 -2
- package/dist/types/uikit/EditorButtonBar/_types.d.ts +4 -2
- package/dist/types/uikit/ErrorSummary/ErrorSummary.d.ts +2 -1
- package/dist/types/uikit/ErrorSummary/_types.d.ts +5 -2
- package/dist/types/uikit/FlexDiv/FlexDiv.d.ts +59 -2
- package/dist/types/uikit/FlexDiv/_types.d.ts +8 -2
- package/dist/types/uikit/Grouper/_types.d.ts +6 -2
- package/dist/types/uikit/Icon/_types.d.ts +7 -2
- package/dist/types/uikit/Icon/iconRegistry.d.ts +1 -0
- package/dist/types/uikit/IconButton/_types.d.ts +4 -2
- package/dist/types/uikit/Logos/_types.d.ts +8 -4
- package/dist/types/uikit/MessageInput/InputField/_types.d.ts +5 -2
- package/dist/types/uikit/Overlay/_types.d.ts +5 -2
- package/dist/types/uikit/Pager/_types.d.ts +5 -2
- package/dist/types/uikit/Progress/DoneCheck/_types.d.ts +5 -2
- package/dist/types/uikit/Progress/ProgressIndicator/_types.d.ts +5 -2
- package/dist/types/uikit/RadioButton/_types.d.ts +5 -2
- package/dist/types/uikit/RadioButtonList/_types.d.ts +5 -2
- package/dist/types/uikit/Slider/_types.d.ts +5 -2
- package/dist/types/uikit/Spacer/_types.d.ts +5 -2
- package/dist/types/uikit/Switch/Switch.d.ts +1 -1
- package/dist/types/uikit/Switch/_types.d.ts +5 -4
- package/dist/types/uikit/TabBar/_types.d.ts +5 -2
- package/dist/types/uikit/TextArea/_types.d.ts +5 -2
- package/dist/types/uikit/Textfield/_types.d.ts +4 -2
- package/dist/types/uikit/Tip/Tip.d.ts +3 -0
- package/dist/types/uikit/Tip/_types.d.ts +28 -0
- package/dist/types/uikit/Tip/index.d.ts +2 -0
- package/dist/types/uikit/Toast/Toast.d.ts +3 -0
- package/dist/types/uikit/Toast/_types.d.ts +24 -0
- package/dist/types/uikit/Toast/index.d.ts +2 -0
- package/dist/types/uikit/UIButton/UIButton.d.ts +73 -2
- package/dist/types/uikit/UIButton/_types.d.ts +4 -2
- package/dist/types/uikit/UIButtonBar/_types.d.ts +5 -2
- package/dist/types/uikit/UICard/_types.d.ts +5 -2
- package/dist/types/uikit/UIChip/_types.d.ts +4 -2
- package/dist/types/uikit/UIFileIcon/UIFileIcon.d.ts +1 -1
- package/dist/types/uikit/UIFileIcon/_types.d.ts +4 -2
- package/dist/types/uikit/UILabel/_types.d.ts +4 -2
- package/dist/types/util/utils.d.ts +12 -0
- package/package.json +80 -5
- package/dist/colors.css +0 -237
- package/dist/index.esm.js +0 -4831
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -4873
- package/dist/index.js.map +0 -1
- package/dist/type.css +0 -16
- package/dist/types/hooks/useMayaTheme.d.ts +0 -7
- package/dist/types/hooks/useTheme.d.ts +0 -2
- package/dist/types/uikit/Avatar/AvatarInline.stories.d.ts +0 -7
- /package/dist/{flexBox.module.css → css/flexBox.module.css} +0 -0
- /package/dist/{type.module.css → css/type.module.css} +0 -0
- /package/dist/types/hooks/{useTrackRenders.d.ts → useTrackRenders/useTrackRenders.d.ts} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
7
|
+
|
|
8
|
+
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_heading-s-bold__QFgN8 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 650;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-medium__jGIb2 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 560;\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: 650;\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: 560;\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: 560;\n\tfont-size: 28px;\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: 650;\n\tfont-size: 28px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.Avatar-module_wrapper__U4ZJr {\n\tposition: relative;\n\tmin-height: var(--avatar-size);\n\tmin-width: var(--avatar-size);\n\theight: var(--avatar-size);\n\twidth: var(--avatar-size);\n\tborder: 0;\n\toutline: 0;\n}\n\n.Avatar-module_user__GIczo {\n\tfont-size: var(--avatar-font-size) !important;\n\tmin-height: var(--avatar-size);\n\tmin-width: var(--avatar-size);\n\theight: var(--avatar-size);\n\twidth: var(--avatar-size);\n\tline-height: 1em;\n\ttext-transform: uppercase;\n\tborder-radius: 100%;\n\tborder: var(--avatar-border) solid var(--avatar-border-color);\n\tbackground-color: var(--avatar-bg-color);\n\tcolor: var(--avatar-color);\n\tbackground-image: var(--avatar-bg-image);\n\tbackground-size: cover;\n\tcursor: pointer;\n\tuser-select: none;\n\t-webkit-user-select: none;\n\ttransition: border-color 0.2s ease-in-out 0s;\n\t&:hover {\n\t\tborder-color: var(--core-link-primary);\n\t}\n}\n";
|
|
9
|
+
var css = {"wrapper":"Avatar-module_wrapper__U4ZJr flexBox-module_row__PWxbe type-module_body-m-regular__Qtp5G","user":"Avatar-module_user__GIczo flexBox-module_row__PWxbe type-module_body-m-regular__Qtp5G"};
|
|
10
|
+
styleInject_es.styleInject(css_248z);
|
|
11
|
+
|
|
12
|
+
const Avatar = React.memo((props) => {
|
|
13
|
+
const { first = '', last = '', image = '', border = 0, color = undefined, borderColor = undefined, bgColor = undefined, firstOnly = false, onClick = undefined, onKeyDown = undefined, fontSize = undefined, onToolTip = () => null, size = 34, frame = 34, tabIndex = 0 } = props, divAttributes = tslib_es6.__rest(props, ["first", "last", "image", "border", "color", "borderColor", "bgColor", "firstOnly", "onClick", "onKeyDown", "fontSize", "onToolTip", "size", "frame", "tabIndex"]);
|
|
14
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
15
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
16
|
+
const divClass = className ? ` ${className}` : '';
|
|
17
|
+
// memo initials computation
|
|
18
|
+
const initials = React.useMemo(() => `${first === null || first === void 0 ? void 0 : first.charAt(0)}${firstOnly ? '' : last.charAt(0)}`, [first, last, firstOnly]);
|
|
19
|
+
// memo the avatar image if there is one
|
|
20
|
+
const bgImage = React.useMemo(() => {
|
|
21
|
+
if (firstOnly)
|
|
22
|
+
return '';
|
|
23
|
+
return image ? `url(${image})` : '';
|
|
24
|
+
}, [firstOnly, image]);
|
|
25
|
+
// calc and memo font size
|
|
26
|
+
const setFontSize = React.useMemo(() => {
|
|
27
|
+
if (fontSize === undefined)
|
|
28
|
+
return 'inherit';
|
|
29
|
+
if (fontSize === 'auto') {
|
|
30
|
+
let fSize = Math.round(frame / 3);
|
|
31
|
+
fSize = Math.min(fSize, 24);
|
|
32
|
+
fSize = Math.max(fSize, 14);
|
|
33
|
+
return `${fSize}px`;
|
|
34
|
+
}
|
|
35
|
+
return `${fontSize}px`;
|
|
36
|
+
}, [frame, fontSize]);
|
|
37
|
+
// memo display content
|
|
38
|
+
const displayContent = React.useMemo(() => (firstOnly || !image ? initials : null), [firstOnly, image, initials]);
|
|
39
|
+
// handle mouse enter
|
|
40
|
+
const onMouseEnter = React.useCallback((event) => {
|
|
41
|
+
const payload = { label: first };
|
|
42
|
+
onToolTip({ payload, event });
|
|
43
|
+
}, [first, onToolTip]);
|
|
44
|
+
// handle mouse leave
|
|
45
|
+
const onMouseLeave = React.useCallback(() => {
|
|
46
|
+
onToolTip(null);
|
|
47
|
+
}, [onToolTip]);
|
|
48
|
+
// memo css vars
|
|
49
|
+
const avatarVars = React.useMemo(() => {
|
|
50
|
+
return {
|
|
51
|
+
'--avatar-size': `${size}px`,
|
|
52
|
+
'--avatar-frame': `${frame}px`,
|
|
53
|
+
'--avatar-border': `${border}px`,
|
|
54
|
+
'--avatar-color': color !== null && color !== void 0 ? color : 'var(--core-text-primary)',
|
|
55
|
+
'--avatar-bg-color': bgColor !== null && bgColor !== void 0 ? bgColor : 'var(--core-surface-secondary)',
|
|
56
|
+
'--avatar-border-color': borderColor !== null && borderColor !== void 0 ? borderColor : 'var(--core-surface-primary)',
|
|
57
|
+
'--avatar-bg-image': `${bgImage}`,
|
|
58
|
+
'--avatar-font-size': setFontSize,
|
|
59
|
+
};
|
|
60
|
+
}, [size, frame, border, color, bgColor, borderColor, bgImage, setFontSize]);
|
|
61
|
+
// memo class names
|
|
62
|
+
const classNames = React.useMemo(() => {
|
|
63
|
+
return `${css.wrapper}${divClass}`;
|
|
64
|
+
}, [divClass]);
|
|
65
|
+
return (jsxRuntime.jsx("div", Object.assign({ id: divId, className: classNames, style: Object.assign(Object.assign({}, divStyle), avatarVars), onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onClick: onClick, onKeyDown: onKeyDown, role: onClick ? 'button' : 'img', tabIndex: onClick ? tabIndex : undefined, "aria-label": `User Avatar - ${first}` }, rest, { children: jsxRuntime.jsx("div", { "aria-hidden": true, className: css.user, children: displayContent }) })));
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
exports.Avatar = Avatar;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var Avatar = require('./Avatar-8-wPWe0V.js');
|
|
7
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
8
|
+
|
|
9
|
+
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.AvatarGroup-module_wrapper__mmcUR {\n\tgap: var(--ag-gap);\n\tmargin: var(--ag-margin);\n}\n\n.AvatarGroup-module_avatar__YbQ5O {\n\tdisplay: inline-block;\n\tmargin-left: var(--ag-overlap);\n\tborder-radius: 100%;\n\t&:first-child {\n\t\tmargin-left: 0;\n\t}\n}\n";
|
|
10
|
+
var css = {"wrapper":"AvatarGroup-module_wrapper__mmcUR flexBox-module_rowStart__nJZnW","avatar":"AvatarGroup-module_avatar__YbQ5O"};
|
|
11
|
+
styleInject_es.styleInject(css_248z);
|
|
12
|
+
|
|
13
|
+
const AvatarGroup = React.memo((props) => {
|
|
14
|
+
const { avatars = [], size = 32, border = 3, overlap = 8, gap = 0, borderColor = undefined, margin = 0, firstOnly = false, onToolTip = () => null } = props, divAttributes = tslib_es6.__rest(props, ["avatars", "size", "border", "overlap", "gap", "borderColor", "margin", "firstOnly", "onToolTip"]);
|
|
15
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
16
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
17
|
+
const divClass = className ? ` ${className}` : '';
|
|
18
|
+
// memo css vars
|
|
19
|
+
const cssVars = React.useMemo(() => {
|
|
20
|
+
return {
|
|
21
|
+
'--ag-gap': `${gap !== null && gap !== void 0 ? gap : 0}px`,
|
|
22
|
+
'--ag-margin': `${margin !== null && margin !== void 0 ? margin : 0}px`,
|
|
23
|
+
'--ag-overlap': `${overlap > 0 ? -overlap : 0}px`,
|
|
24
|
+
};
|
|
25
|
+
}, [overlap, gap, margin]);
|
|
26
|
+
// memo rendered avatars list
|
|
27
|
+
const renderedAvatars = React.useMemo(() => {
|
|
28
|
+
if (!avatars)
|
|
29
|
+
return null;
|
|
30
|
+
return avatars.map((avatar, index) => (jsxRuntime.jsx("div", { className: css.avatar, children: jsxRuntime.jsx(Avatar.Avatar, { first: avatar.first, last: avatar.last, image: avatar.image || avatar.avatar, size: size, frame: size, border: border, borderColor: borderColor, color: avatar.color, bgColor: avatar.bgColor, firstOnly: firstOnly, onToolTip: onToolTip }) }, `avatar_${avatar.email}_${index}`)));
|
|
31
|
+
}, [avatars, size, border, borderColor, firstOnly, onToolTip]);
|
|
32
|
+
// memo class names
|
|
33
|
+
const classNames = React.useMemo(() => {
|
|
34
|
+
return `${css.wrapper}${divClass}`;
|
|
35
|
+
}, [divClass]);
|
|
36
|
+
return (jsxRuntime.jsx("div", Object.assign({ id: divId, className: classNames, style: Object.assign(Object.assign({}, divStyle), cssVars) }, rest, { children: renderedAvatars })));
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
exports.AvatarGroup = AvatarGroup;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
7
|
+
|
|
8
|
+
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_heading-s-bold__QFgN8 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 650;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-medium__jGIb2 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 560;\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: 650;\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: 560;\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: 560;\n\tfont-size: 28px;\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: 650;\n\tfont-size: 28px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.Badge-module_badge__8-cpJ {\n\tline-height: 1em;\n\tcolor: var(--badge-color);\n\tbackground: var(--badge-bg);\n\tpadding: 2px 8px;\n\tmin-width: 24px;\n\twidth: min-content;\n\tborder-radius: 8px;\n\twhite-space: nowrap;\n}\n";
|
|
9
|
+
var css = {"badge":"Badge-module_badge__8-cpJ flexBox-module_row__PWxbe type-module_body-xs-medium__FxEAv"};
|
|
10
|
+
styleInject_es.styleInject(css_248z);
|
|
11
|
+
|
|
12
|
+
const Badge = React.memo((props) => {
|
|
13
|
+
const { count, variant = 'dark', hideNull = true } = props, divAttributes = tslib_es6.__rest(props, ["count", "variant", "hideNull"]);
|
|
14
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
15
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
16
|
+
const divClass = className ? ` ${className}` : '';
|
|
17
|
+
// memo display count
|
|
18
|
+
const displayCount = React.useMemo(() => {
|
|
19
|
+
if (count === undefined)
|
|
20
|
+
return '0';
|
|
21
|
+
if (typeof count === 'string')
|
|
22
|
+
return count;
|
|
23
|
+
return count > 99 ? '99+' : count.toString();
|
|
24
|
+
}, [count]);
|
|
25
|
+
// memo css vars
|
|
26
|
+
const cssVars = React.useMemo(() => {
|
|
27
|
+
return {
|
|
28
|
+
'--badge-color': variant === 'light'
|
|
29
|
+
? 'var(--core-text-primary)'
|
|
30
|
+
: 'var(--core-text-light)',
|
|
31
|
+
'--badge-bg': variant === 'light'
|
|
32
|
+
? 'var(--core-badge-secondary)'
|
|
33
|
+
: 'var(--core-badge-primary)',
|
|
34
|
+
};
|
|
35
|
+
}, [variant]);
|
|
36
|
+
if (count === undefined || count === '' || (hideNull && count === 0))
|
|
37
|
+
return null;
|
|
38
|
+
return (jsxRuntime.jsx("div", Object.assign({ id: divId, className: `${css.badge}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), role: 'status', "aria-live": 'polite' }, rest, { children: displayCount })));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
exports.Badge = Badge;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var react = require('motion/react');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var hooks_useTheme = require('../hooks/useTheme.js');
|
|
8
|
+
require('../theme/colors.js');
|
|
9
|
+
require('../hooks/useWindow.js');
|
|
10
|
+
var _types = require('./_types-CoWzQFsT.js');
|
|
11
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.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_heading-s-bold__QFgN8 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 650;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-medium__jGIb2 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 560;\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: 650;\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: 560;\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: 560;\n\tfont-size: 28px;\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: 650;\n\tfont-size: 28px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.CheckBox-module_wrapper__m-SdK {\n\tmin-height: var(--cb-size);\n\theight: var(--cb-size);\n\twidth: auto;\n\tgap: 6px;\n\tcursor: pointer;\n\toverflow: hidden;\n\tuser-select: none;\n\t-webkit-user-select: none;\n\toutline: none;\n\tborder: 0;\n}\n\n.CheckBox-module_icon__N3ORQ {\n\tmin-width: var(--cb-size);\n\tmax-width: var(--cb-size);\n\tmin-height: var(--cb-size);\n\tmax-height: var(--cb-size);\n}\n\n.CheckBox-module_label__iNXWc {\n\tcolor: var(--core-text-primary);\n}\n";
|
|
14
|
+
var css = {"wrapper":"CheckBox-module_wrapper__m-SdK flexBox-module_row__PWxbe","icon":"CheckBox-module_icon__N3ORQ flexBox-module_row__PWxbe","label":"CheckBox-module_label__iNXWc type-module_body-m-regular__Qtp5G"};
|
|
15
|
+
styleInject_es.styleInject(css_248z);
|
|
16
|
+
|
|
17
|
+
const CheckBox = React.memo((props) => {
|
|
18
|
+
const { size = 20, checked = false, disabled = false, color = undefined, label = undefined, onChange = () => null } = props, divAttributes = tslib_es6.__rest(props, ["size", "checked", "disabled", "color", "label", "onChange"]);
|
|
19
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
20
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
21
|
+
const divClass = className ? ` ${className}` : '';
|
|
22
|
+
const [state, setState] = React.useState(checked);
|
|
23
|
+
const theme = hooks_useTheme.useTheme();
|
|
24
|
+
React.useEffect(() => setState(checked), [checked]);
|
|
25
|
+
// memo icon name
|
|
26
|
+
const iconName = React.useMemo(() => {
|
|
27
|
+
if (state === true)
|
|
28
|
+
return 'checked';
|
|
29
|
+
if (state === 'mixed')
|
|
30
|
+
return 'partial';
|
|
31
|
+
return 'unchecked';
|
|
32
|
+
}, [state]);
|
|
33
|
+
// memo icon color
|
|
34
|
+
const iconColor = React.useMemo(() => {
|
|
35
|
+
if (color)
|
|
36
|
+
return color;
|
|
37
|
+
if (disabled)
|
|
38
|
+
return theme.current.colors['core-icon-disabled'];
|
|
39
|
+
if (state === 'mixed')
|
|
40
|
+
return theme.current.colors['core-icon-primary'];
|
|
41
|
+
if (!state)
|
|
42
|
+
return theme.current.colors['core-icon-secondary'];
|
|
43
|
+
return theme.current.colors['core-text-special'];
|
|
44
|
+
}, [color, disabled, state, theme]);
|
|
45
|
+
// memo style vars
|
|
46
|
+
const cssVars = React.useMemo(() => {
|
|
47
|
+
return {
|
|
48
|
+
'--cb-size': `${size}px`,
|
|
49
|
+
'--cb-label-color': `${color}`,
|
|
50
|
+
};
|
|
51
|
+
}, [size, color]);
|
|
52
|
+
// handle toggle
|
|
53
|
+
const handleToggle = React.useCallback(() => {
|
|
54
|
+
let newState = false;
|
|
55
|
+
switch (state) {
|
|
56
|
+
case true:
|
|
57
|
+
break;
|
|
58
|
+
case 'mixed':
|
|
59
|
+
case false:
|
|
60
|
+
newState = true;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
setState(newState);
|
|
64
|
+
onChange(newState);
|
|
65
|
+
}, [state, onChange]);
|
|
66
|
+
// keyboard handler for accessibility
|
|
67
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
68
|
+
if (e.key === ' ' || e.key === 'Enter') {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
handleToggle();
|
|
71
|
+
}
|
|
72
|
+
}, [handleToggle]);
|
|
73
|
+
return (jsxRuntime.jsxs(react.motion.div, Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), onClick: handleToggle, onKeyDown: handleKeyDown, tabIndex: disabled ? -1 : 0, role: 'checkbox', "aria-checked": state === 'mixed' ? 'mixed' : state, "aria-disabled": disabled }, rest, { children: [jsxRuntime.jsx("div", { className: css.icon, children: jsxRuntime.jsx(_types.Icon, { name: iconName, strokeColor: iconColor, size: size }) }), label && jsxRuntime.jsx("span", { className: css.label, children: label })] })));
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
exports.CheckBox = CheckBox;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var react = require('motion/react');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var utils = require('./utils-CbayehuI.js');
|
|
8
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
9
|
+
|
|
10
|
+
var css_248z = ".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_heading-s-bold__QFgN8 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 650;\n\tfont-size: 20px;\n\tline-height: 140%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}.type-module_heading-s-medium__jGIb2 {\n\tfont-family: var(--font-family), sans-serif;\n\tfont-weight: 560;\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: 650;\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: 560;\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: 560;\n\tfont-size: 28px;\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: 650;\n\tfont-size: 28px;\n\tline-height: 128.57%;\n\ttext-decoration: none;\n\tletter-spacing: 0.2px;\n}\n\n.DivInput-module_wrapper__gljOU {\n\tpadding: var(--div-input-padding);\n\twidth: var(--div-input-width);\n\tborder-radius: var(--div-input-border-radius);\n\tbackground: var(--div-input-wrapper-bg);\n\t&:hover {\n\t\tbackground: var(--div-input-bg);\n\t}\n}\n\n.DivInput-module_input__R8myv {\n\tcolor: var(--div-input-color);\n\tuser-select: var(--div-input-user-select);\n\t-webkit-user-select: var(--div-input-user-select);\n\ttext-align: var(--div-input-text-align);\n\tpointer-events: all;\n\tbackground: transparent;\n\tborder-radius: 4px;\n\tborder: 0;\n\toutline: none;\n\ttext-overflow: ellipsis;\n\tdisplay: -webkit-box;\n\toverflow: hidden;\n\twhite-space: var(--div-input-white-space);\n\t-webkit-line-clamp: var(--div-input-line-clamp);\n\t-webkit-box-orient: vertical;\n\tcursor: var(--div-input-cursor);\n\ttransition: background 0.2s ease-in-out 0s;\n}\n";
|
|
11
|
+
var css = {"wrapper":"DivInput-module_wrapper__gljOU","input":"DivInput-module_input__R8myv type-module_body-m-regular__Qtp5G"};
|
|
12
|
+
styleInject_es.styleInject(css_248z);
|
|
13
|
+
|
|
14
|
+
const DivInput = React.memo((props) => {
|
|
15
|
+
const { value = '', name = 'Input Field', placeholder = 'Placeholder', isEditable = true, wrap = false, focus = false, width = 'auto', textAlign = 'left', clamp = 3, padding = '0px', onChange = () => null, onSubmit = () => null, onFocus = () => null, onBlur = () => null, onDblClick = () => null, onClick = () => null, radius = 4, bgColor = 'var(--core-surface-secondary)' } = props, divAttributes = tslib_es6.__rest(props, ["value", "name", "placeholder", "isEditable", "wrap", "focus", "width", "textAlign", "clamp", "padding", "onChange", "onSubmit", "onFocus", "onBlur", "onDblClick", "onClick", "radius", "bgColor"]);
|
|
16
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
17
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
18
|
+
const divClass = className ? ` ${className}` : '';
|
|
19
|
+
const ref = React.useRef(null);
|
|
20
|
+
const innerText = React.useRef(value === '' ? utils.cleanString(placeholder) : utils.cleanString(value));
|
|
21
|
+
const [isFocused, setIsFocused] = React.useState(focus);
|
|
22
|
+
const [text, setText] = React.useState(innerText.current);
|
|
23
|
+
const [isPlaceholder, setIsPlaceholder] = React.useState(false);
|
|
24
|
+
// Memoize setCursor function
|
|
25
|
+
const setCursor = React.useCallback((to, length = 1) => {
|
|
26
|
+
if (ref.current) {
|
|
27
|
+
const range = document.createRange();
|
|
28
|
+
range.setStart(ref.current, to === 'start' ? 0 : length);
|
|
29
|
+
range.setEnd(ref.current, to === 'start' ? 0 : 1);
|
|
30
|
+
const selection = globalThis.getSelection();
|
|
31
|
+
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges();
|
|
32
|
+
selection === null || selection === void 0 ? void 0 : selection.addRange(range);
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
// Memoize handleSelectAll
|
|
36
|
+
const handleSelectAll = React.useCallback(() => {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
if (!((_a = ref.current) === null || _a === void 0 ? void 0 : _a.firstChild))
|
|
39
|
+
return;
|
|
40
|
+
const range = document.createRange();
|
|
41
|
+
range.selectNode(ref.current.firstChild);
|
|
42
|
+
(_b = globalThis.getSelection()) === null || _b === void 0 ? void 0 : _b.removeAllRanges();
|
|
43
|
+
(_c = globalThis.getSelection()) === null || _c === void 0 ? void 0 : _c.addRange(range);
|
|
44
|
+
}, []);
|
|
45
|
+
// Combined effect for related state updates
|
|
46
|
+
React.useEffect(() => {
|
|
47
|
+
if (!ref.current)
|
|
48
|
+
return;
|
|
49
|
+
// Set contentEditable
|
|
50
|
+
ref.current.contentEditable = isEditable ? 'true' : 'false';
|
|
51
|
+
// Handle focus
|
|
52
|
+
if (focus) {
|
|
53
|
+
handleSelectAll();
|
|
54
|
+
ref.current.focus();
|
|
55
|
+
}
|
|
56
|
+
setIsFocused(focus);
|
|
57
|
+
// Update text
|
|
58
|
+
const newText = value === '' ? utils.cleanString(placeholder) : utils.cleanString(value);
|
|
59
|
+
innerText.current = newText;
|
|
60
|
+
ref.current.innerText = newText;
|
|
61
|
+
setText(newText);
|
|
62
|
+
}, [value, placeholder, focus, isEditable, handleSelectAll]);
|
|
63
|
+
// Effect for placeholder state
|
|
64
|
+
React.useEffect(() => {
|
|
65
|
+
if (placeholder) {
|
|
66
|
+
setIsPlaceholder(text === placeholder);
|
|
67
|
+
}
|
|
68
|
+
}, [placeholder, text]);
|
|
69
|
+
// Memoize handleSetValue
|
|
70
|
+
const handleSetValue = React.useCallback((e) => {
|
|
71
|
+
let textString = '';
|
|
72
|
+
const stripped = e.currentTarget.innerText.replaceAll(/\s+/g, '');
|
|
73
|
+
if (stripped.length === 0 && placeholder && ref.current) {
|
|
74
|
+
ref.current.innerText = placeholder;
|
|
75
|
+
setIsPlaceholder(true);
|
|
76
|
+
setCursor('start');
|
|
77
|
+
}
|
|
78
|
+
else if (isPlaceholder) {
|
|
79
|
+
const textString = e.currentTarget.innerText.replace(placeholder, '');
|
|
80
|
+
innerText.current = utils.cleanString(textString);
|
|
81
|
+
if (ref.current) {
|
|
82
|
+
ref.current.innerText = utils.cleanString(textString);
|
|
83
|
+
setCursor('end');
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
textString = e.currentTarget.innerText;
|
|
88
|
+
innerText.current = utils.cleanString(textString || '');
|
|
89
|
+
}
|
|
90
|
+
onChange(innerText.current);
|
|
91
|
+
setText(innerText.current);
|
|
92
|
+
}, [placeholder, isPlaceholder, onChange, setCursor]);
|
|
93
|
+
// Memoize handleKeyDown
|
|
94
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
95
|
+
// stop propagation to avoid conflicts with listeners to shortcuts while editing
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
if (e.key === 'Enter' && ref.current) {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
ref.current.innerHTML = utils.cleanString(innerText.current);
|
|
100
|
+
onChange(null);
|
|
101
|
+
onSubmit(innerText.current);
|
|
102
|
+
ref === null || ref === void 0 ? void 0 : ref.current.blur();
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
if (e.key === '<' || e.key === '>') {
|
|
106
|
+
e.preventDefault();
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}, [onChange, onSubmit]);
|
|
110
|
+
// Memoize handlePaste
|
|
111
|
+
const handlePaste = React.useCallback((e) => {
|
|
112
|
+
var _a;
|
|
113
|
+
e.preventDefault();
|
|
114
|
+
if (!e.clipboardData)
|
|
115
|
+
return;
|
|
116
|
+
const textData = e.clipboardData.getData('text/plain');
|
|
117
|
+
if (!textData)
|
|
118
|
+
return;
|
|
119
|
+
const pasteText = utils.cleanString(textData);
|
|
120
|
+
const selection = globalThis.getSelection();
|
|
121
|
+
if (!(selection === null || selection === void 0 ? void 0 : selection.rangeCount))
|
|
122
|
+
return;
|
|
123
|
+
selection === null || selection === void 0 ? void 0 : selection.deleteFromDocument();
|
|
124
|
+
selection === null || selection === void 0 ? void 0 : selection.getRangeAt(0).insertNode(document.createTextNode(pasteText));
|
|
125
|
+
selection === null || selection === void 0 ? void 0 : selection.collapseToEnd();
|
|
126
|
+
const newText = ((_a = ref.current) === null || _a === void 0 ? void 0 : _a.innerText) || '';
|
|
127
|
+
onChange(utils.cleanString(newText));
|
|
128
|
+
innerText.current = utils.cleanString(newText);
|
|
129
|
+
return true;
|
|
130
|
+
}, [onChange]);
|
|
131
|
+
// Memoize handleFocus
|
|
132
|
+
const handleFocus = React.useCallback((e) => {
|
|
133
|
+
setIsFocused(true);
|
|
134
|
+
onFocus(e);
|
|
135
|
+
}, [onFocus]);
|
|
136
|
+
// Memoize handleBlur
|
|
137
|
+
const handleBlur = React.useCallback((_e) => {
|
|
138
|
+
if (!ref.current)
|
|
139
|
+
return;
|
|
140
|
+
const blurText = utils.cleanString(innerText.current);
|
|
141
|
+
if (blurText === '') {
|
|
142
|
+
ref.current.innerText = placeholder;
|
|
143
|
+
innerText.current = placeholder;
|
|
144
|
+
}
|
|
145
|
+
onChange(null);
|
|
146
|
+
onSubmit(innerText.current);
|
|
147
|
+
setIsFocused(false);
|
|
148
|
+
onBlur(blurText);
|
|
149
|
+
}, [placeholder, onChange, onSubmit, onBlur]);
|
|
150
|
+
// Memoize handleClick
|
|
151
|
+
const handleClick = React.useCallback((e) => {
|
|
152
|
+
e.preventDefault();
|
|
153
|
+
e.stopPropagation();
|
|
154
|
+
if (isPlaceholder)
|
|
155
|
+
setTimeout(() => setCursor('start'), 50);
|
|
156
|
+
onClick();
|
|
157
|
+
}, [isPlaceholder, setCursor, onClick]);
|
|
158
|
+
// calc css values as number / string
|
|
159
|
+
const setWidth = React.useCallback((width) => {
|
|
160
|
+
if (typeof width === 'string')
|
|
161
|
+
return width;
|
|
162
|
+
return `${width}px`;
|
|
163
|
+
}, []);
|
|
164
|
+
// memo cssVars
|
|
165
|
+
const cssVars = React.useMemo(() => {
|
|
166
|
+
return {
|
|
167
|
+
'--div-input-color': isPlaceholder
|
|
168
|
+
? 'var(--core-text-tertiary)'
|
|
169
|
+
: 'var(--core-text-primary)',
|
|
170
|
+
'--div-input-width': `${setWidth(width)}`,
|
|
171
|
+
'--div-input-user-select': isEditable ? 'text' : 'none',
|
|
172
|
+
'--div-input-padding': padding !== null && padding !== void 0 ? padding : '0',
|
|
173
|
+
'--div-input-text-align': textAlign !== null && textAlign !== void 0 ? textAlign : 'left',
|
|
174
|
+
'--div-input-white-space': isEditable && wrap ? 'wrap' : 'no-wrap',
|
|
175
|
+
'--div-input-line-clamp': isEditable && isFocused ? 'none' : (clamp !== null && clamp !== void 0 ? clamp : 'none'),
|
|
176
|
+
'--div-input-cursor': isEditable ? 'text' : 'default',
|
|
177
|
+
'--div-input-bg': isEditable
|
|
178
|
+
? (bgColor !== null && bgColor !== void 0 ? bgColor : 'var(--core-surface-secondary)')
|
|
179
|
+
: 'transparent',
|
|
180
|
+
'--div-input-wrapper-bg': isEditable && isFocused
|
|
181
|
+
? (bgColor !== null && bgColor !== void 0 ? bgColor : 'var(--core-surface-secondary)')
|
|
182
|
+
: 'transparent',
|
|
183
|
+
'--div-input-border-radius': `${radius}px`,
|
|
184
|
+
};
|
|
185
|
+
}, [
|
|
186
|
+
clamp,
|
|
187
|
+
wrap,
|
|
188
|
+
isEditable,
|
|
189
|
+
width,
|
|
190
|
+
textAlign,
|
|
191
|
+
isFocused,
|
|
192
|
+
padding,
|
|
193
|
+
isPlaceholder,
|
|
194
|
+
setWidth,
|
|
195
|
+
bgColor,
|
|
196
|
+
radius,
|
|
197
|
+
]);
|
|
198
|
+
// avoid issues with safari that refocuses editable divs on blur
|
|
199
|
+
// by wrapping it with a pointer events none
|
|
200
|
+
return (jsxRuntime.jsx("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars) }, rest, { children: jsxRuntime.jsx(react.motion.div, { className: css.input, ref: ref, contentEditable: isEditable, suppressContentEditableWarning: true, onInput: handleSetValue, onKeyDown: handleKeyDown, onFocus: handleFocus, onBlur: handleBlur, onPaste: handlePaste, onDoubleClick: onDblClick, onClick: handleClick, role: 'textbox', "aria-label": name, children: value !== null && value !== void 0 ? value : placeholder }) })));
|
|
201
|
+
});
|
|
202
|
+
DivInput.displayName = 'DivInput';
|
|
203
|
+
|
|
204
|
+
exports.DivInput = DivInput;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var hooks_useTheme = require('../hooks/useTheme.js');
|
|
7
|
+
require('../theme/colors.js');
|
|
8
|
+
require('../hooks/useWindow.js');
|
|
9
|
+
|
|
10
|
+
const DocIcons = React.memo((props) => {
|
|
11
|
+
const { type = 'pdf', height = 36 } = props, divAttributes = tslib_es6.__rest(props, ["type", "height"]);
|
|
12
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
13
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
14
|
+
const divClass = className ? ` ${className}` : '';
|
|
15
|
+
const theme = hooks_useTheme.useTheme();
|
|
16
|
+
const renderIcon = React.useMemo(() => {
|
|
17
|
+
const images = [
|
|
18
|
+
{
|
|
19
|
+
name: 'not supported',
|
|
20
|
+
svg: (jsxRuntime.jsxs("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", height: height, "aria-label": 'Not supported', children: [jsxRuntime.jsx("title", { children: "Not supported" }), jsxRuntime.jsx("path", { d: "M 13.944 0 L 21.798 8 L 21.798 21.2 C 21.798 22.746 20.568 24 19.049 24 L 4.911 24 C 3.393 24 2.162 22.745 2.162 21.2 L 2.162 2.8 C 2.162 1.254 3.393 0 4.911 0 Z", fill: "rgb(102, 113, 127)" }), jsxRuntime.jsx("path", { d: "M 12.021 16.249 C 12.461 16.249 12.733 15.968 12.733 15.625 L 12.733 15.52 C 12.733 15.028 13.014 14.711 13.63 14.307 C 14.482 13.744 15.089 13.235 15.089 12.18 C 15.089 10.72 13.788 9.93 12.294 9.93 C 10.782 9.93 9.789 10.65 9.552 11.46 C 9.508 11.6 9.482 11.74 9.482 11.89 C 9.482 12.285 9.789 12.496 10.079 12.496 C 10.378 12.496 10.571 12.356 10.729 12.145 L 10.887 11.934 C 11.195 11.424 11.652 11.125 12.241 11.125 C 13.041 11.125 13.559 11.582 13.559 12.25 C 13.559 12.848 13.19 13.138 12.426 13.674 C 11.793 14.114 11.318 14.579 11.318 15.441 L 11.318 15.555 C 11.318 16.012 11.573 16.249 12.021 16.249 Z M 12.004 18.869 C 12.514 18.869 12.953 18.464 12.953 17.954 C 12.953 17.444 12.523 17.04 12.003 17.04 C 11.485 17.04 11.054 17.453 11.054 17.954 C 11.054 18.455 11.494 18.868 12.004 18.868 Z", fill: "rgb(255, 255, 255)" }), jsxRuntime.jsx("path", { d: "M 21.798 8 L 16.832 8 C 15.314 8 13.944 6.605 13.944 5.058 L 13.944 0 Z", fill: "rgba(255,255,255,0.4)" })] })),
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'text',
|
|
24
|
+
svg: (jsxRuntime.jsxs("svg", { viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg", height: height, "aria-label": "Text document", children: [jsxRuntime.jsx("title", { children: "Text document" }), jsxRuntime.jsx("path", { d: "M137.902 0a48.573 48.573 0 0 0-35.589 15.294 53.965 53.965 0 0 0-15.273 35.64v917.412a48.707 48.707 0 0 0 15.273 35.64 49.971 49.971 0 0 0 35.59 15.293h746.336a48.64 48.64 0 0 0 35.59-15.293 50.37 50.37 0 0 0 15.273-35.64V288.717L646.728 0H137.902z", fill: "#FD7541" }), jsxRuntime.jsx("path", { d: "M935.102 288.717H697.656c-27.822-.666-50.227-23.076-50.928-50.934V0l288.374 288.717z", fill: "#FFFFFF", opacity: 0.4 }), jsxRuntime.jsx("path", { d: "M248.126 365.184h220.518a25.518 25.518 0 0 0 24.192-25.497 25.518 25.518 0 0 0-24.197-25.503H248.126a25.518 25.518 0 0 0-24.197 25.498 25.518 25.518 0 0 0 24.197 25.497zm0 169.825H773.95a25.446 25.446 0 0 0 25.43-25.466 25.446 25.446 0 0 0-25.43-25.467H248.126a25.446 25.446 0 0 0-25.431 25.467 25.446 25.446 0 0 0 25.43 25.466zM773.95 653.896H248.126a25.518 25.518 0 0 0-24.197 25.497 25.518 25.518 0 0 0 24.197 25.503H773.95a25.518 25.518 0 0 0 24.197-25.497A25.518 25.518 0 0 0 773.95 653.9z", fill: "#FFF" })] })),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'docx',
|
|
28
|
+
svg: (jsxRuntime.jsxs("svg", { viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg", height: height, "aria-label": "Word document", children: [jsxRuntime.jsx("title", { children: "Word document" }), jsxRuntime.jsx("path", { d: "m594.944 0 335.124 341.32v563.2c0 65.996-52.5 119.48-117.294 119.48H209.546c-64.793 0-117.299-53.53-117.299-119.48V119.48C92.252 53.484 144.757 0 209.551 0h385.393z", fill: theme.current.colors['core-button-primary'] }), jsxRuntime.jsx("path", { d: "M930.068 341.32H718.152c-64.748 0-123.208-59.49-123.208-125.492V0l335.124 341.32z", fill: "#ffffff", fillOpacity: ".7" }), jsxRuntime.jsx("path", { d: "M427.377 725.32V768H259.814v-42.68h167.563zM594.944 640v42.68h-335.13V640h335.13zm0-85.32v42.64h-335.13v-42.64h335.13zm0-85.36V512h-335.13v-42.68h335.13z", fill: "#FFF" })] })),
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'pdf',
|
|
32
|
+
svg: (jsxRuntime.jsxs("svg", { viewBox: "0 0 1024 1024", xmlns: "http://www.w3.org/2000/svg", height: height, "aria-label": "PDF document", children: [jsxRuntime.jsx("title", { children: "PDF document" }), jsxRuntime.jsx("path", { d: "m594.944 0 335.124 341.32v563.2c0 65.996-52.5 119.48-117.294 119.48H209.546c-64.793 0-117.299-53.53-117.299-119.48V119.48C92.252 53.484 144.757 0 209.551 0h385.393z", fill: "#E94848" }), jsxRuntime.jsx("path", { d: "M482.954 375.48a40.586 40.586 0 0 0-40.028 40.776c0 27.786 15.17 62.326 31.18 94.771-12.564 39.834-26.715 82.473-44.82 118.503-37.094 14.796-70.195 25.83-90.06 42.168a41.708 41.708 0 0 0-12.39 29.926c0 22.344 18.063 40.776 40.038 40.776a39.332 39.332 0 0 0 29.27-12.472c14.618-17.828 31.888-50.13 47.294-79.642 35.42-14.198 72.607-28.672 108.447-37.325 26.163 21.453 64.051 35.65 95.186 35.65 21.97 0 40.033-18.385 40.033-40.775a40.586 40.586 0 0 0-40.033-40.724c-24.991 0-61.297 9.072-89.037 18.616a301.338 301.338 0 0 1-58.092-76.984c10.66-33.332 23.04-66.658 23.04-92.488a40.586 40.586 0 0 0-40.028-40.776zm0 24.438c8.98 0 16.01 7.168 16.01 16.292 0 12.237-6.42 34.816-13.87 59.018-9.958-23.552-18.15-46.172-18.15-58.972 0-9.165 7.025-16.292 16.01-16.292v-.046zm6.887 139.546a323.574 323.574 0 0 0 41.523 53.76c-23.742 6.604-46.92 15.078-69.822 23.92 11.08-25.364 19.917-51.758 28.299-77.726v.046zm157.235 52.126c8.98 0 16.01 7.122 16.01 16.292 0 9.124-7.03 16.292-16.015 16.292-18.059 0-43.659-8.284-64.185-19.876 23.552-6.794 49.204-12.749 64.185-12.749v.041zM408.15 664.576c-11.264 20.48-22.436 39.562-30.26 49.152a15.078 15.078 0 0 1-11.028 4.188 15.964 15.964 0 0 1-16.01-16.292 17.707 17.707 0 0 1 4.234-11.356c9.4-7.398 29.835-16.292 53.064-25.692z", fill: "#FFF" }), jsxRuntime.jsx("path", { d: "M930.068 341.32H718.152c-64.748 0-123.208-59.49-123.208-125.492V0l335.124 341.32z", fill: "#FFF", fillOpacity: ".4" })] })),
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
const item = images.filter((data) => type === data.name);
|
|
36
|
+
return item ? item[0].svg : null;
|
|
37
|
+
}, [height, type, theme]);
|
|
38
|
+
return (jsxRuntime.jsx("div", Object.assign({ id: divId, className: divClass.trim(), style: Object.assign(Object.assign({}, divStyle), { display: 'flex', justifyContent: 'center', alignItems: 'center' }) }, rest, { children: renderIcon })));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
exports.DocIcons = DocIcons;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var react = require('motion/react');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
8
|
+
|
|
9
|
+
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}.Dot-module_dot__8eYTa {\n\tdisplay: var(--dot-display);\n\tbox-sizing: content-box;\n\tposition: var(--dot-position);\n\ttop: var(--dot-top);\n\tright: var(--dot-right);\n\tvertical-align: var(--dot-vertical-align);\n\tmin-height: var(--dot-size);\n\tmin-width: var(--dot-size);\n\theight: var(--dot-size);\n\twidth: var(--dot-size);\n\tborder: var(--dot-border) solid var(--core-surface-primary);\n\tbackground: var(--dot-bg);\n\tborder-radius: 100%;\n\tz-index: 1000;\n}\n";
|
|
10
|
+
var css = {"dot":"Dot-module_dot__8eYTa flexBox-module_row__PWxbe"};
|
|
11
|
+
styleInject_es.styleInject(css_248z);
|
|
12
|
+
|
|
13
|
+
const DEFAULT_VARIANTS = {
|
|
14
|
+
initial: { opacity: 0 },
|
|
15
|
+
animate: { opacity: 1 },
|
|
16
|
+
exit: { opacity: 0 },
|
|
17
|
+
};
|
|
18
|
+
const DEFAULT_TRANSITION = {
|
|
19
|
+
ease: 'easeInOut',
|
|
20
|
+
duration: 0.5,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const Dot = React.memo((props) => {
|
|
24
|
+
const { size = 8, topOffset = 2, rightOffset = 2, border = 3, position = 'corner', color = undefined, transition = undefined, motionValues = undefined, show = false, state } = props, divAttributes = tslib_es6.__rest(props, ["size", "topOffset", "rightOffset", "border", "position", "color", "transition", "motionValues", "show", "state"]);
|
|
25
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
26
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
27
|
+
const divClass = className ? ` ${className}` : '';
|
|
28
|
+
// memo variants
|
|
29
|
+
const variants = React.useMemo(() => {
|
|
30
|
+
if (motionValues) {
|
|
31
|
+
return Object.assign(Object.assign({}, DEFAULT_VARIANTS), motionValues);
|
|
32
|
+
}
|
|
33
|
+
return DEFAULT_VARIANTS;
|
|
34
|
+
}, [motionValues]);
|
|
35
|
+
// memo transition
|
|
36
|
+
const trans = React.useMemo(() => {
|
|
37
|
+
if (transition) {
|
|
38
|
+
return Object.assign(Object.assign({}, DEFAULT_TRANSITION), transition);
|
|
39
|
+
}
|
|
40
|
+
return DEFAULT_TRANSITION;
|
|
41
|
+
}, [transition]);
|
|
42
|
+
// memo color
|
|
43
|
+
const bgColor = React.useMemo(() => {
|
|
44
|
+
if (color) {
|
|
45
|
+
return color;
|
|
46
|
+
}
|
|
47
|
+
if (state) {
|
|
48
|
+
switch (state) {
|
|
49
|
+
case 'red':
|
|
50
|
+
return 'var(--feedback-warning)';
|
|
51
|
+
case 'yellow':
|
|
52
|
+
return 'var(--feedback-attention)';
|
|
53
|
+
case 'green':
|
|
54
|
+
return 'var(--feedback-positive)';
|
|
55
|
+
case 'blue':
|
|
56
|
+
return 'var(--core-gp-logo-primary)';
|
|
57
|
+
case 'grey':
|
|
58
|
+
return 'var(--core-text-secondary)';
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return 'var(--core-text-special)';
|
|
62
|
+
}, [state, color]);
|
|
63
|
+
// memo css vars
|
|
64
|
+
const cssVars = React.useMemo(() => {
|
|
65
|
+
return {
|
|
66
|
+
'--dot-size': `${size}px`,
|
|
67
|
+
'--dot-display': position === 'inline' ? 'inline-flex' : 'flex',
|
|
68
|
+
'--dot-position': position === 'inline' ? 'relative' : 'absolute',
|
|
69
|
+
'--dot-top': position === 'inline' ? 'unset' : `${topOffset}px`,
|
|
70
|
+
'--dot-right': position === 'inline' ? 'unset' : `${rightOffset}px`,
|
|
71
|
+
'--dot-vertical-align': position === 'inline' ? 'middle' : 'unset',
|
|
72
|
+
'--dot-border': `${border}px solid`,
|
|
73
|
+
'--dot-border-color': 'var(--core-surface-primary)',
|
|
74
|
+
'--dot-bg': `${bgColor}`,
|
|
75
|
+
};
|
|
76
|
+
}, [size, position, topOffset, rightOffset, border, bgColor]);
|
|
77
|
+
return (jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: show && (jsxRuntime.jsx(react.motion.div, Object.assign({ id: divId, className: `${css.dot}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), initial: 'initial', animate: 'animate', exit: 'exit', transition: trans, variants: variants, role: 'status', "aria-live": 'polite', "aria-label": 'Blue dot indicating active or new' }, rest, { children: jsxRuntime.jsx("div", { className: "dot" }) }))) }));
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
exports.Dot = Dot;
|