@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,152 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import '../theme/colors.js';
|
|
6
|
+
import '../hooks/useWindow.js';
|
|
7
|
+
import { I as Icon } from './_types-BaYeLEWK.js';
|
|
8
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
9
|
+
|
|
10
|
+
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.DropDown-module_wrapper__56asG {\n\tposition: relative;\n\tgap: var(--dd-gap);\n\tmin-width: var(--dd-width);\n\twidth: var(--dd-width);\n\tborder-radius: var(--dd-border-radius);\n\tbackground-color: var(--dd-bg-color);\n\tbox-shadow: 0 0 0 var(--dd-box-shadow-size) var(--dd-border-color);\n\tpadding: var(--dd-padding-tops) var(--dd-padding-left) var(--dd-padding-tops)\n\t\tvar(--dd-padding-right) !important;\n\ttransition: all 0.2s ease-in-out 0s;\n}\n\n.DropDown-module_face__kF56R {\n\tflex: 1;\n\toverflow: hidden;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 1;\n\t-webkit-box-orient: vertical;\n\ttext-overflow: ellipsis;\n\tword-break: break-all;\n\tcolor: var(--dd-color);\n}\n\n.DropDown-module_small__QYoM4 {\n}\n\n.DropDown-module_medium__FrKVH {\n}\n\n.DropDown-module_large__O1hDm {\n}\n\n.DropDown-module_chevron__upYr7 {\n\tmin-height: var(--dd-icon-size);\n\tmax-height: var(--dd-icon-size);\n\tmin-width: var(--dd-icon-size);\n\tmax-width: var(--dd-icon-size);\n}\n\n.DropDown-module_select__1rQRA {\n\tposition: absolute;\n\topacity: 0;\n\twidth: 100%;\n\theight: 100%;\n\tfont-size: 14px;\n\tbackground-color: #1f99cd;\n\tbackground-position: right 10px center;\n\tbackground-repeat: no-repeat;\n\tbackground-size: auto 50%;\n\tborder: none;\n\toutline: none;\n\t-moz-appearance: none;\n\t-webkit-appearance: none;\n\tappearance: none;\n\t&::-ms-expand {\n\t\tdisplay: none;\n\t}\n}\n";
|
|
11
|
+
var css = {"wrapper":"DropDown-module_wrapper__56asG flexBox-module_rowStart__nJZnW","face":"DropDown-module_face__kF56R flexBox-module_rowStart__nJZnW","small":"DropDown-module_small__QYoM4 type-module_body-s-regular__8-FO-","medium":"DropDown-module_medium__FrKVH type-module_body-m-regular__Qtp5G","large":"DropDown-module_large__O1hDm type-module_body-l-regular__Ar4d3","chevron":"DropDown-module_chevron__upYr7 flexBox-module_rowStart__nJZnW","select":"DropDown-module_select__1rQRA"};
|
|
12
|
+
styleInject(css_248z);
|
|
13
|
+
|
|
14
|
+
const DropDown = React.memo((props) => {
|
|
15
|
+
const theme = useTheme();
|
|
16
|
+
const { name = 'Select', width = '100%', height = 'auto', selectedIndex = 0, selectedValue = '', options = [], placeholder = true, validate = true, borderRadius = 4, bgColor = 'transparent', iconColor = theme.current.colors['core-icon-primary'], paddingLeft = '8px', paddingRight = '12px', paddingTops = '8px', iconSize = 20, disabled = false, unframed = false, focused = false, gap = 0, size = 'medium', onChange = () => null, onValidate = () => null, onFocus = () => null, onBlur = () => null } = props, divAttributes = __rest(props, ["name", "width", "height", "selectedIndex", "selectedValue", "options", "placeholder", "validate", "borderRadius", "bgColor", "iconColor", "paddingLeft", "paddingRight", "paddingTops", "iconSize", "disabled", "unframed", "focused", "gap", "size", "onChange", "onValidate", "onFocus", "onBlur"]);
|
|
17
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
18
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
19
|
+
const divClass = className ? ` ${className}` : '';
|
|
20
|
+
const [index, setIndex] = useState(selectedIndex);
|
|
21
|
+
const [selectedText, setSelectedText] = useState('Select an option');
|
|
22
|
+
const [initiated, setInitiated] = useState(false);
|
|
23
|
+
const [color, setColor] = useState(iconColor);
|
|
24
|
+
const ref = useRef(null);
|
|
25
|
+
useEffect(() => setColor(theme.current.colors['core-icon-primary']), [theme]);
|
|
26
|
+
// validate selection and if there's a placeholder
|
|
27
|
+
// with a validate flag, set error state and event error
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
let valid = true;
|
|
30
|
+
if (validate && placeholder && index === 0)
|
|
31
|
+
valid = false;
|
|
32
|
+
if (!initiated)
|
|
33
|
+
valid = true;
|
|
34
|
+
onValidate(valid);
|
|
35
|
+
}, [index, validate, placeholder, initiated, onValidate]);
|
|
36
|
+
// set focus
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (focused && (ref === null || ref === void 0 ? void 0 : ref.current)) {
|
|
39
|
+
setInitiated(true);
|
|
40
|
+
ref.current.click();
|
|
41
|
+
}
|
|
42
|
+
}, [focused]);
|
|
43
|
+
// set selected by index
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (ref === null || ref === void 0 ? void 0 : ref.current) {
|
|
46
|
+
if (!(options === null || options === void 0 ? void 0 : options[selectedIndex]))
|
|
47
|
+
return;
|
|
48
|
+
const label = options[selectedIndex].label || 'Select an option';
|
|
49
|
+
setIndex(selectedIndex);
|
|
50
|
+
setSelectedText(label);
|
|
51
|
+
ref.current.selectedIndex = selectedIndex;
|
|
52
|
+
}
|
|
53
|
+
}, [selectedIndex, options]);
|
|
54
|
+
// set selected by value - FIXED: potential infinite loop
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!options || options.length === 0 || selectedValue === '')
|
|
57
|
+
return;
|
|
58
|
+
const foundIndex = options.findIndex((option) => {
|
|
59
|
+
var _a, _b, _c;
|
|
60
|
+
return ((_a = option === null || option === void 0 ? void 0 : option.value) === null || _a === void 0 ? void 0 : _a.toLowerCase()) ===
|
|
61
|
+
selectedValue.toString().toLowerCase() ||
|
|
62
|
+
((_b = option === null || option === void 0 ? void 0 : option.label) === null || _b === void 0 ? void 0 : _b.toLowerCase()) ===
|
|
63
|
+
selectedValue.toString().toLowerCase() ||
|
|
64
|
+
((_c = option === null || option === void 0 ? void 0 : option.alt) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === selectedValue.toString().toLowerCase();
|
|
65
|
+
});
|
|
66
|
+
if (foundIndex !== -1) {
|
|
67
|
+
const label = options[foundIndex].label || 'Select an option';
|
|
68
|
+
setSelectedText(label);
|
|
69
|
+
setIndex(foundIndex);
|
|
70
|
+
if (ref.current)
|
|
71
|
+
ref.current.selectedIndex = foundIndex;
|
|
72
|
+
}
|
|
73
|
+
}, [selectedValue, options]);
|
|
74
|
+
// memo on change
|
|
75
|
+
const handleChange = useCallback((i) => {
|
|
76
|
+
if (!options)
|
|
77
|
+
return;
|
|
78
|
+
const label = options[i].label || 'Select an option';
|
|
79
|
+
setIndex(i);
|
|
80
|
+
setSelectedText(label);
|
|
81
|
+
if (index !== i)
|
|
82
|
+
onChange(i, options[i]);
|
|
83
|
+
onBlur(options[i].label || '');
|
|
84
|
+
}, [options, index, onChange, onBlur]);
|
|
85
|
+
// memo focus
|
|
86
|
+
const handleFocus = useCallback(() => {
|
|
87
|
+
setInitiated(true);
|
|
88
|
+
onFocus();
|
|
89
|
+
}, [onFocus]);
|
|
90
|
+
// Memoize renderOptions
|
|
91
|
+
const renderedOptions = useMemo(() => {
|
|
92
|
+
if (!options)
|
|
93
|
+
return null;
|
|
94
|
+
return options.map((option, i) => (jsx("option", { value: option === null || option === void 0 ? void 0 : option.value, onMouseUp: () => handleChange(i), children: option === null || option === void 0 ? void 0 : option.label }, `${option === null || option === void 0 ? void 0 : option.value}_${i}`)));
|
|
95
|
+
}, [options, handleChange]);
|
|
96
|
+
// Memoize displayed text
|
|
97
|
+
const displayText = useMemo(() => selectedText.replace('-- ', ''), [selectedText]);
|
|
98
|
+
// Memoize handleMouseDown
|
|
99
|
+
const handleMouseDown = useCallback((e) => {
|
|
100
|
+
if (disabled)
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
handleFocus();
|
|
103
|
+
}, [disabled, handleFocus]);
|
|
104
|
+
// Memoize onChange handler
|
|
105
|
+
const handleSelectChange = useCallback((e) => {
|
|
106
|
+
handleChange(e.target.selectedIndex);
|
|
107
|
+
}, [handleChange]);
|
|
108
|
+
const getSize = useCallback((value) => {
|
|
109
|
+
if (typeof value === 'string')
|
|
110
|
+
return value;
|
|
111
|
+
return `${value}px`;
|
|
112
|
+
}, []);
|
|
113
|
+
const cssVars = useMemo(() => {
|
|
114
|
+
return {
|
|
115
|
+
'--dd-gap': `${gap}px`,
|
|
116
|
+
'--dd-height': `${getSize(height)}`,
|
|
117
|
+
'--dd-width': `${getSize(width)}`,
|
|
118
|
+
'--dd-margin': '8px',
|
|
119
|
+
'--dd-border-radius': borderRadius ? `${borderRadius}px` : '4px',
|
|
120
|
+
'--dd-box-shadow-size': unframed ? '0' : '1px',
|
|
121
|
+
'--dd-border-color': unframed
|
|
122
|
+
? 'transparent'
|
|
123
|
+
: 'var(--core-outline-primary)',
|
|
124
|
+
'--dd-bg-color': bgColor !== null && bgColor !== void 0 ? bgColor : 'transparent',
|
|
125
|
+
'--dd-padding-left': unframed ? '0' : `${getSize(paddingLeft)}`,
|
|
126
|
+
'--dd-padding-right': unframed ? '0' : `${getSize(paddingRight)}`,
|
|
127
|
+
'--dd-padding-tops': unframed ? '0' : `${getSize(paddingTops)}`,
|
|
128
|
+
'--dd-icon-size': `${iconSize}px`,
|
|
129
|
+
'--dd-color': placeholder && index === 0
|
|
130
|
+
? 'var(--core-text-tertiary)'
|
|
131
|
+
: 'var(--core-text-primary)',
|
|
132
|
+
};
|
|
133
|
+
}, [
|
|
134
|
+
gap,
|
|
135
|
+
height,
|
|
136
|
+
width,
|
|
137
|
+
borderRadius,
|
|
138
|
+
bgColor,
|
|
139
|
+
paddingLeft,
|
|
140
|
+
paddingRight,
|
|
141
|
+
paddingTops,
|
|
142
|
+
unframed,
|
|
143
|
+
placeholder,
|
|
144
|
+
iconSize,
|
|
145
|
+
index,
|
|
146
|
+
getSize,
|
|
147
|
+
]);
|
|
148
|
+
return (jsxs("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars) }, rest, { children: [jsx("div", { className: `${css.face} ${css[size]}`, children: displayText }), jsx("div", { className: css.chevron, children: jsx(Icon, { name: "chevron down", size: iconSize, strokeColor: color }) }), jsx("select", { className: css.select, defaultValue: index, ref: ref, onFocus: handleFocus, onMouseDown: handleMouseDown, onChange: handleSelectChange, "aria-label": name, children: renderedOptions })] })));
|
|
149
|
+
});
|
|
150
|
+
DropDown.displayName = 'DropDown';
|
|
151
|
+
|
|
152
|
+
export { DropDown as D };
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
4
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
5
|
+
import '../theme/colors.js';
|
|
6
|
+
import '../hooks/useWindow.js';
|
|
7
|
+
import { useObserveResize } from '../hooks/useObserveResize.js';
|
|
8
|
+
import { D as DropDown } from './DropDown-D4t6EhKL.js';
|
|
9
|
+
import { I as IconButton } from './IconButton-CguHGkBM.js';
|
|
10
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
11
|
+
|
|
12
|
+
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.EditorButtonBar-module_wrapper__mfv-c {\n\twidth: 100%;\n}\n\n.EditorButtonBar-module_right__G2tBZ {\n}\n\n.EditorButtonBar-module_left__9omfV {\n\tflex: 1;\n}\n\n.EditorButtonBar-module_buttonGroup__p0aEd {\n\tgap: 4px;\n\tdiv.EditorButtonBar-module_divider__T5y5c {\n\t\theight: 20px;\n\t\tmin-height: 100%;\n\t\twidth: 1px;\n\t\tmin-width: 1px;\n\t\tmax-width: 1px;\n\t\tbackground: var(--core-surface-secondary);\n\t\tmargin: 0 8px;\n\t}\n}\n";
|
|
13
|
+
var css = {"wrapper":"EditorButtonBar-module_wrapper__mfv-c flexBox-module_rowStart__nJZnW","right":"EditorButtonBar-module_right__G2tBZ flexBox-module_rowStart__nJZnW","left":"EditorButtonBar-module_left__9omfV flexBox-module_rowStart__nJZnW","buttonGroup":"EditorButtonBar-module_buttonGroup__p0aEd flexBox-module_rowStart__nJZnW"};
|
|
14
|
+
styleInject(css_248z);
|
|
15
|
+
|
|
16
|
+
var FormattingOption;
|
|
17
|
+
(function (FormattingOption) {
|
|
18
|
+
FormattingOption["hilight"] = "hilight";
|
|
19
|
+
FormattingOption["bold"] = "bold";
|
|
20
|
+
FormattingOption["italic"] = "italic";
|
|
21
|
+
FormattingOption["underline"] = "underline";
|
|
22
|
+
FormattingOption["strikethrough"] = "strikethrough";
|
|
23
|
+
FormattingOption["list"] = "list";
|
|
24
|
+
FormattingOption["orderedList"] = "ordered list";
|
|
25
|
+
FormattingOption["taskList"] = "task list";
|
|
26
|
+
FormattingOption["sinkList"] = "sink list";
|
|
27
|
+
FormattingOption["raiseList"] = "raise list";
|
|
28
|
+
FormattingOption["undo"] = "undo";
|
|
29
|
+
FormattingOption["redo"] = "redo";
|
|
30
|
+
FormattingOption["download"] = "download";
|
|
31
|
+
FormattingOption["more"] = "more";
|
|
32
|
+
FormattingOption["copy"] = "copy";
|
|
33
|
+
FormattingOption["link"] = "link";
|
|
34
|
+
})(FormattingOption || (FormattingOption = {}));
|
|
35
|
+
|
|
36
|
+
const coreButtons = {
|
|
37
|
+
link: {
|
|
38
|
+
icon: 'link',
|
|
39
|
+
toolTip: 'Link',
|
|
40
|
+
command: 'link',
|
|
41
|
+
id: FormattingOption.link,
|
|
42
|
+
},
|
|
43
|
+
hilight: {
|
|
44
|
+
icon: 'hilight',
|
|
45
|
+
toolTip: 'Highlight',
|
|
46
|
+
command: 'hilight',
|
|
47
|
+
id: FormattingOption.hilight,
|
|
48
|
+
},
|
|
49
|
+
bold: {
|
|
50
|
+
icon: 'bold',
|
|
51
|
+
toolTip: 'Bold',
|
|
52
|
+
command: 'bold',
|
|
53
|
+
id: FormattingOption.bold,
|
|
54
|
+
shortcut: { modifier: 'meta', key: 'b' },
|
|
55
|
+
},
|
|
56
|
+
italic: {
|
|
57
|
+
icon: 'italic',
|
|
58
|
+
toolTip: 'Italic',
|
|
59
|
+
command: 'italic',
|
|
60
|
+
id: FormattingOption.italic,
|
|
61
|
+
shortcut: { modifier: 'meta', key: 'i' },
|
|
62
|
+
},
|
|
63
|
+
underline: {
|
|
64
|
+
icon: 'underline',
|
|
65
|
+
toolTip: 'Underline',
|
|
66
|
+
command: 'underline',
|
|
67
|
+
id: FormattingOption.underline,
|
|
68
|
+
shortcut: { modifier: 'meta', key: 'u' },
|
|
69
|
+
},
|
|
70
|
+
strikethrough: {
|
|
71
|
+
icon: 'strike',
|
|
72
|
+
toolTip: 'Strikethrough',
|
|
73
|
+
command: 'strike',
|
|
74
|
+
id: FormattingOption.strikethrough,
|
|
75
|
+
shortcut: { modifier: 'meta', key: 's' },
|
|
76
|
+
},
|
|
77
|
+
list: {
|
|
78
|
+
icon: 'bullet list',
|
|
79
|
+
toolTip: 'List',
|
|
80
|
+
command: 'ulist',
|
|
81
|
+
id: FormattingOption.list,
|
|
82
|
+
},
|
|
83
|
+
orderedList: {
|
|
84
|
+
icon: 'numbered list',
|
|
85
|
+
toolTip: 'Ordered list',
|
|
86
|
+
command: 'olist',
|
|
87
|
+
id: FormattingOption.orderedList,
|
|
88
|
+
},
|
|
89
|
+
taskList: {
|
|
90
|
+
icon: 'task list',
|
|
91
|
+
toolTip: 'Task list',
|
|
92
|
+
command: 'task',
|
|
93
|
+
id: FormattingOption.taskList,
|
|
94
|
+
},
|
|
95
|
+
sinkList: {
|
|
96
|
+
icon: 'sink',
|
|
97
|
+
toolTip: 'Sink list item',
|
|
98
|
+
command: 'sink',
|
|
99
|
+
id: FormattingOption.sinkList,
|
|
100
|
+
},
|
|
101
|
+
raiseList: {
|
|
102
|
+
icon: 'lift',
|
|
103
|
+
toolTip: 'Raise list item',
|
|
104
|
+
command: 'raise',
|
|
105
|
+
id: FormattingOption.raiseList,
|
|
106
|
+
},
|
|
107
|
+
undo: {
|
|
108
|
+
icon: 'undo',
|
|
109
|
+
toolTip: 'Undo',
|
|
110
|
+
command: 'undo',
|
|
111
|
+
id: FormattingOption.undo,
|
|
112
|
+
},
|
|
113
|
+
redo: {
|
|
114
|
+
icon: 'redo',
|
|
115
|
+
toolTip: 'Redo',
|
|
116
|
+
command: 'redo',
|
|
117
|
+
id: FormattingOption.redo,
|
|
118
|
+
},
|
|
119
|
+
copy: {
|
|
120
|
+
icon: 'copy',
|
|
121
|
+
toolTip: 'Copy',
|
|
122
|
+
command: 'copy',
|
|
123
|
+
id: FormattingOption.copy,
|
|
124
|
+
},
|
|
125
|
+
download: {
|
|
126
|
+
icon: 'download',
|
|
127
|
+
toolTip: 'Download',
|
|
128
|
+
command: 'download',
|
|
129
|
+
id: FormattingOption.download,
|
|
130
|
+
},
|
|
131
|
+
more: {
|
|
132
|
+
icon: 'more',
|
|
133
|
+
toolTip: 'More Options',
|
|
134
|
+
command: 'more',
|
|
135
|
+
id: FormattingOption.more,
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
const styles = [
|
|
139
|
+
{ label: 'Heading 1', value: 'h1', alt: 'h1' },
|
|
140
|
+
{ label: 'Heading 2', value: 'h2', alt: 'h2' },
|
|
141
|
+
{ label: 'Heading 3', value: 'h3', alt: 'h3' },
|
|
142
|
+
{ label: 'Body', value: 'p', alt: 'p' },
|
|
143
|
+
];
|
|
144
|
+
const buttonGroups = {
|
|
145
|
+
format: {
|
|
146
|
+
buttons: [
|
|
147
|
+
coreButtons.hilight,
|
|
148
|
+
coreButtons.bold,
|
|
149
|
+
coreButtons.italic,
|
|
150
|
+
coreButtons.underline,
|
|
151
|
+
coreButtons.strikethrough,
|
|
152
|
+
coreButtons.link,
|
|
153
|
+
],
|
|
154
|
+
},
|
|
155
|
+
lists: {
|
|
156
|
+
buttons: [coreButtons.list, coreButtons.orderedList, coreButtons.taskList],
|
|
157
|
+
},
|
|
158
|
+
listEdit: {
|
|
159
|
+
buttons: [coreButtons.sinkList, coreButtons.raiseList],
|
|
160
|
+
},
|
|
161
|
+
undo: {
|
|
162
|
+
buttons: [coreButtons.undo, coreButtons.redo],
|
|
163
|
+
},
|
|
164
|
+
more: {
|
|
165
|
+
buttons: [coreButtons.more],
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
const editControls = {
|
|
169
|
+
regular: {
|
|
170
|
+
styles,
|
|
171
|
+
buttons: [
|
|
172
|
+
buttonGroups.format,
|
|
173
|
+
buttonGroups.lists,
|
|
174
|
+
buttonGroups.listEdit,
|
|
175
|
+
buttonGroups.undo,
|
|
176
|
+
],
|
|
177
|
+
download: coreButtons.download,
|
|
178
|
+
},
|
|
179
|
+
small: {
|
|
180
|
+
buttons: [buttonGroups.format, buttonGroups.more],
|
|
181
|
+
download: coreButtons.download,
|
|
182
|
+
},
|
|
183
|
+
medium: {
|
|
184
|
+
styles,
|
|
185
|
+
buttons: [buttonGroups.format, buttonGroups.lists],
|
|
186
|
+
download: coreButtons.download,
|
|
187
|
+
},
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
const EditorButtonBar = React.memo((props) => {
|
|
191
|
+
var _a;
|
|
192
|
+
const { onCommand = () => null, onToolTip = () => null, shortSize = 500, mediumSize = 664, state = 'auto', activeStyle = 'p', disabledFormats = [], activeFormats } = props, divAttributes = __rest(props, ["onCommand", "onToolTip", "shortSize", "mediumSize", "state", "activeStyle", "disabledFormats", "activeFormats"]);
|
|
193
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
194
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
195
|
+
const divClass = className ? ` ${className}` : '';
|
|
196
|
+
const [barState, setBarState] = useState('regular');
|
|
197
|
+
const ref = useRef(null);
|
|
198
|
+
const size = useObserveResize(ref);
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
if (state !== 'auto')
|
|
201
|
+
setBarState(state);
|
|
202
|
+
else if (size.width < shortSize)
|
|
203
|
+
setBarState('small');
|
|
204
|
+
else if (size.width < mediumSize)
|
|
205
|
+
setBarState('medium');
|
|
206
|
+
else
|
|
207
|
+
setBarState('regular');
|
|
208
|
+
}, [size, shortSize, mediumSize, state]);
|
|
209
|
+
const handleStyleChange = useCallback((option) => {
|
|
210
|
+
switch (option.value) {
|
|
211
|
+
case 'h1':
|
|
212
|
+
onCommand('h1', undefined);
|
|
213
|
+
break;
|
|
214
|
+
case 'h2':
|
|
215
|
+
onCommand('h2', undefined);
|
|
216
|
+
break;
|
|
217
|
+
case 'h3':
|
|
218
|
+
onCommand('h3', undefined);
|
|
219
|
+
break;
|
|
220
|
+
case 'p':
|
|
221
|
+
onCommand('p', undefined);
|
|
222
|
+
break;
|
|
223
|
+
}
|
|
224
|
+
}, [onCommand]);
|
|
225
|
+
return (jsxs("div", Object.assign({ id: divId, className: `${css.wrapper}${divClass}`, style: divStyle, ref: ref }, rest, { children: [jsxs("div", { className: css.left, children: [(editControls === null || editControls === void 0 ? void 0 : editControls[barState].styles) && (jsx(DropDown, { options: editControls === null || editControls === void 0 ? void 0 : editControls[barState].styles, placeholder: false, unframed: true, width: '100px', selectedValue: activeStyle, onChange: (_index, option) => handleStyleChange(option) })), (_a = editControls === null || editControls === void 0 ? void 0 : editControls[barState].buttons) === null || _a === void 0 ? void 0 : _a.map((group, index) => {
|
|
226
|
+
return (jsx(RenderGroup, { onCommand: onCommand, onToolTip: onToolTip, buttonGroup: group, activeFormats: activeFormats, disabledFormats: disabledFormats, state: barState }, `button-group-${group.name}${index}`));
|
|
227
|
+
})] }), (editControls === null || editControls === void 0 ? void 0 : editControls[barState].download) && (jsxs("div", { className: css.right, children: [jsx(IconButton, { icon: coreButtons.copy.icon, tooltip: coreButtons.copy.toolTip, hover: disabledFormats.includes('download'), toggle: false, onToolTip: onToolTip, disabled: disabledFormats.includes('copy'), onClick: (e) => onCommand(coreButtons.copy.command, e) }), jsx(IconButton, { icon: coreButtons.download.icon, tooltip: coreButtons.download.toolTip, hover: !disabledFormats.includes('download'), toggle: false, onToolTip: onToolTip, disabled: disabledFormats.includes('download'), onClick: (e) => onCommand(coreButtons.download.command, e) })] }))] })));
|
|
228
|
+
});
|
|
229
|
+
const RenderGroup = React.memo((props) => {
|
|
230
|
+
var _a;
|
|
231
|
+
const { onCommand = () => null, onToolTip = () => null, buttonGroup, activeFormats, state = 'default', disabledFormats = [], } = props;
|
|
232
|
+
const theme = useTheme();
|
|
233
|
+
return (jsxs("div", { className: css.buttonGroup, children: [state !== 'small' && jsx("div", { className: "divider" }), (_a = buttonGroup === null || buttonGroup === void 0 ? void 0 : buttonGroup.buttons) === null || _a === void 0 ? void 0 : _a.map((button, index) => {
|
|
234
|
+
const active = (button === null || button === void 0 ? void 0 : button.id) ? activeFormats === null || activeFormats === void 0 ? void 0 : activeFormats.includes(button.id) : false;
|
|
235
|
+
const bgColor = active
|
|
236
|
+
? theme.current.colors['core-surface-secondary']
|
|
237
|
+
: 'transparent';
|
|
238
|
+
return (jsx(IconButton, { icon: button === null || button === void 0 ? void 0 : button.icon, tooltip: button === null || button === void 0 ? void 0 : button.toolTip, onToolTip: onToolTip, hover: !disabledFormats.includes(button.id || 'none'), toggle: false, bgColor: bgColor, onClick: (e) => onCommand(button === null || button === void 0 ? void 0 : button.command, e), disabled: disabledFormats.includes(button.id || 'none'), frameSize: 30, iconSize: 20 }, `button-${button === null || button === void 0 ? void 0 : button.icon}-${index}`));
|
|
239
|
+
})] }));
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
export { EditorButtonBar as E };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { AnimatePresence, motion } from 'motion/react';
|
|
4
|
+
import React, { 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}.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.ErrorSummary-module_errorBox__-R7XM {\n\twidth: 100%;\n\tbackground: var(--core-surface-secondary);\n\tcolor: var(--feedback-warning);\n\tborder: 1px solid var(--feedback-warning);\n\tborder-radius: 4px;\n\tpadding: 0 16px 16px 16px !important;\n\toverflow: hidden;\n\tmargin-bottom: 44px !important;\n}\n\n.ErrorSummary-module_error__YCQLh {\n\twidth: 100%;\n}\n\n.ErrorSummary-module_p__lbLpS {\n\tmargin: 0;\n\tpadding: 16px 0 0 0;\n}\n\n.ErrorSummary-module_strong__XVtAe {\n}\n\n.ErrorSummary-module_ul__d0xoc {\n\tlist-style-type: none;\n\tlist-style-position: outside;\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.ErrorSummary-module_li__jym6S {\n\tmargin: 3px 0 3px 0;\n\tline-height: 1.2em;\n\tpadding: 0;\n}\n";
|
|
8
|
+
var css = {"errorBox":"ErrorSummary-module_errorBox__-R7XM flexBox-module_columnStart__Kg8cV type-module_body-m-regular__Qtp5G","error":"ErrorSummary-module_error__YCQLh flexBox-module_columnStart__Kg8cV","p":"ErrorSummary-module_p__lbLpS type-module_body-m-regular__Qtp5G","strong":"ErrorSummary-module_strong__XVtAe type-module_body-m-bold__0lZ3I","ul":"ErrorSummary-module_ul__d0xoc","li":"ErrorSummary-module_li__jym6S type-module_body-m-regular__Qtp5G"};
|
|
9
|
+
styleInject(css_248z);
|
|
10
|
+
|
|
11
|
+
const ErrorSummary = React.memo((props) => {
|
|
12
|
+
const { entries, errors = [] } = props, divAttributes = __rest(props, ["entries", "errors"]);
|
|
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
|
+
// memo animation variants
|
|
17
|
+
const variants = useMemo(() => ({
|
|
18
|
+
enter: { opacity: 0, maxHeight: 0 },
|
|
19
|
+
animate: { opacity: 1, maxHeight: 500 },
|
|
20
|
+
exit: { opacity: 0, maxHeight: 0 },
|
|
21
|
+
}), []);
|
|
22
|
+
// memo trans
|
|
23
|
+
const transition = useMemo(() => ({ ease: 'easeInOut', duration: 0.25 }), []);
|
|
24
|
+
const renderedErrors = useMemo(() => {
|
|
25
|
+
if (!entries)
|
|
26
|
+
return null;
|
|
27
|
+
return entries.map((error, index) => {
|
|
28
|
+
var _a;
|
|
29
|
+
if (errors.includes(index) || errors.includes(error.id)) {
|
|
30
|
+
return (jsxs("div", { className: css.error, children: [jsx("p", { className: css.p, children: jsx("strong", { className: css.strong, children: error.title }) }), jsx("ul", { className: css.ul, children: (_a = error.bullets) === null || _a === void 0 ? void 0 : _a.map((bullet, index) => {
|
|
31
|
+
return (jsx("li", { className: css.li, children: bullet }, `${error.title}_bullet_${index}`));
|
|
32
|
+
}) })] }, `${error.id}_${index}`));
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
});
|
|
36
|
+
}, [entries, errors]);
|
|
37
|
+
return (jsx(AnimatePresence, { initial: false, children: entries && errors && errors.length > 0 && (jsx(motion.div, Object.assign({ id: divId, className: `${css.errorBox}${divClass}`, style: divStyle, initial: 'enter', animate: 'animate', exit: 'exit', variants: variants, transition: transition }, rest, { children: renderedErrors }))) }));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export { ErrorSummary as E };
|
|
@@ -0,0 +1,101 @@
|
|
|
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, { useMemo } from 'react';
|
|
5
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
6
|
+
|
|
7
|
+
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}.FlexDiv-module_flexDiv__VNfVQ {\n\t&::-webkit-scrollbar {\n\t\tbackground-color: var(--flex-div-bg);\n\t\twidth: 14px;\n\t}\n\n\t&::-webkit-scrollbar-track {\n\t\tbackground-color: var(--flex-div-scroll-border);\n\t}\n\n\t&::-webkit-scrollbar-thumb {\n\t\tbackground-color: var(--flex-div-scroll-handle);\n\t\tborder-radius: 20px;\n\t\tborder: 4px solid var(--flex-div-scroll-border);\n\t}\n\n\t&::-webkit-scrollbar-thumb:hover {\n\t\tbackground-color: var(--flex-div-scroll-handle-hover);\n\t\tborder-radius: 20px;\n\t\tborder: 4px solid var(--flex-div-scroll-border);\n\t\tcursor: default;\n\t}\n}\n";
|
|
8
|
+
var css = {"flexDiv":"FlexDiv-module_flexDiv__VNfVQ type-module_body-m-regular__Qtp5G"};
|
|
9
|
+
styleInject(css_248z);
|
|
10
|
+
|
|
11
|
+
// Extract helper functions outside component
|
|
12
|
+
function setSize(style, isHeight) {
|
|
13
|
+
if (typeof style === 'number')
|
|
14
|
+
return `${style}px`;
|
|
15
|
+
if (style === 'grow')
|
|
16
|
+
return 'unset';
|
|
17
|
+
if (style === 'fill')
|
|
18
|
+
return '100%';
|
|
19
|
+
if (style === 'fit')
|
|
20
|
+
return 'auto';
|
|
21
|
+
if (style === 'viewport')
|
|
22
|
+
return isHeight ? '100vh' : '100vw';
|
|
23
|
+
return style;
|
|
24
|
+
}
|
|
25
|
+
function setBox(style) {
|
|
26
|
+
if (typeof style === 'number')
|
|
27
|
+
return `${style}px`;
|
|
28
|
+
return style;
|
|
29
|
+
}
|
|
30
|
+
function setFlex(style) {
|
|
31
|
+
if (style === 'start' || style === 'top')
|
|
32
|
+
return 'flex-start';
|
|
33
|
+
if (style === 'end' || style === 'bottom')
|
|
34
|
+
return 'flex-end';
|
|
35
|
+
if (style === 'between')
|
|
36
|
+
return 'space-between';
|
|
37
|
+
return style;
|
|
38
|
+
}
|
|
39
|
+
const FlexDiv = React.memo(React.forwardRef((props, ref) => {
|
|
40
|
+
const { children, scrollY = false, scrollX = false, background = 'var(--core-surface-primary)', direction = 'column', alignItems = 'start', justify = 'start', height = 'fit', width = 'fill', maxWidth = undefined, centerSelf = undefined, wrap = false, reverse = false, padding = 0, margin = 0, absolute = false, flex, gap, variants, transition, animate, enter, exit, border, borderRadius, className, scrollHandle, scrollHandleHover } = props, divAttributes = __rest(props, ["children", "scrollY", "scrollX", "background", "direction", "alignItems", "justify", "height", "width", "maxWidth", "centerSelf", "wrap", "reverse", "padding", "margin", "absolute", "flex", "gap", "variants", "transition", "animate", "enter", "exit", "border", "borderRadius", "className", "scrollHandle", "scrollHandleHover"]);
|
|
41
|
+
const { id: divId, style: userStyle } = divAttributes, rest = __rest(divAttributes, ["id", "style"]);
|
|
42
|
+
const wrapperStyle = userStyle !== null && userStyle !== void 0 ? userStyle : {};
|
|
43
|
+
// Memoize layout
|
|
44
|
+
const style = useMemo(() => {
|
|
45
|
+
return {
|
|
46
|
+
display: 'flex',
|
|
47
|
+
position: `${absolute ? 'absolute' : 'relative'}`,
|
|
48
|
+
flexDirection: `${direction}${reverse ? '-reverse' : ''}`,
|
|
49
|
+
flexWrap: `${wrap ? 'wrap' : 'nowrap'}`,
|
|
50
|
+
justifyContent: `${setFlex(justify)}`,
|
|
51
|
+
alignItems: `${setFlex(alignItems)}`,
|
|
52
|
+
boxSizing: 'border-box',
|
|
53
|
+
padding: `${setBox(padding)}`,
|
|
54
|
+
margin: centerSelf ? '0 auto' : `${setBox(margin)}`,
|
|
55
|
+
width: `${absolute ? 'unset' : setSize(width, false)}`,
|
|
56
|
+
height: `${absolute ? 'unset' : setSize(height, true)}`,
|
|
57
|
+
maxWidth: `${maxWidth ? setSize(maxWidth, false) : 'unset'}`,
|
|
58
|
+
flex: `${absolute ? 'unset' : (flex !== null && flex !== void 0 ? flex : 'unset')}`,
|
|
59
|
+
top: `${absolute ? '0' : 'unset'}`,
|
|
60
|
+
bottom: `${absolute ? '0' : 'unset'}`,
|
|
61
|
+
left: `${absolute ? '0' : 'unset'}`,
|
|
62
|
+
right: `${absolute ? '0' : 'unset'}`,
|
|
63
|
+
gap: gap ? `${gap}px` : 'unset',
|
|
64
|
+
border: `${border !== null && border !== void 0 ? border : 'unset'}`,
|
|
65
|
+
background: `${background !== null && background !== void 0 ? background : 'transparent'}`,
|
|
66
|
+
overflow: 'hidden',
|
|
67
|
+
overflowY: `${scrollY ? 'auto' : 'unset'}`,
|
|
68
|
+
overflowX: `${scrollX ? 'auto' : 'unset'}`,
|
|
69
|
+
borderRadius: borderRadius ? `${borderRadius}px` : 'unset',
|
|
70
|
+
color: 'var(--core-text-primary)',
|
|
71
|
+
'--flex-div-scroll-border': `${background !== null && background !== void 0 ? background : 'transparent'}`,
|
|
72
|
+
'--flex-div-scroll-handle': `${scrollHandle !== null && scrollHandle !== void 0 ? scrollHandle : 'var(--scroll-bar)'}`,
|
|
73
|
+
'--flex-div-scroll-handle-hover': `${scrollHandleHover !== null && scrollHandleHover !== void 0 ? scrollHandleHover : 'var(--scroll-bar-hover)'}`,
|
|
74
|
+
};
|
|
75
|
+
}, [
|
|
76
|
+
absolute,
|
|
77
|
+
direction,
|
|
78
|
+
reverse,
|
|
79
|
+
wrap,
|
|
80
|
+
justify,
|
|
81
|
+
alignItems,
|
|
82
|
+
padding,
|
|
83
|
+
margin,
|
|
84
|
+
width,
|
|
85
|
+
height,
|
|
86
|
+
flex,
|
|
87
|
+
gap,
|
|
88
|
+
border,
|
|
89
|
+
background,
|
|
90
|
+
scrollY,
|
|
91
|
+
scrollX,
|
|
92
|
+
centerSelf,
|
|
93
|
+
maxWidth,
|
|
94
|
+
scrollHandle,
|
|
95
|
+
scrollHandleHover,
|
|
96
|
+
borderRadius,
|
|
97
|
+
]);
|
|
98
|
+
return (jsx(motion.div, Object.assign({ id: divId, ref: ref, className: `${css.flexDiv} ${className !== null && className !== void 0 ? className : ''}`, style: Object.assign(Object.assign({}, wrapperStyle), style), transition: transition, variants: variants, initial: enter, animate: animate, exit: exit }, rest, { children: children })));
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
export { FlexDiv as F };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useAnimate } from 'motion/react';
|
|
4
|
+
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|
5
|
+
import { useTheme } from '../hooks/useTheme.js';
|
|
6
|
+
import '../theme/colors.js';
|
|
7
|
+
import '../hooks/useWindow.js';
|
|
8
|
+
import { B as Badge } from './Badge-PPf5Uvw3.js';
|
|
9
|
+
import { I as Icon } from './_types-BaYeLEWK.js';
|
|
10
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
11
|
+
|
|
12
|
+
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.Grouper-module_header__NPgUW {\n\twidth: 100%;\n\tcursor: pointer;\n}\n\n.Grouper-module_title__-bt06 {\n\tcolor: var(--core-text-primary);\n\tflex: 1;\n}\n\n.Grouper-module_content__u2SN7 {\n\tuser-select: none;\n\t-webkit-user-select: none;\n\tpadding: 0 24px !important;\n\twidth: 100%;\n\tgap: 6px;\n\theight: var(--grouper-height);\n\tborder-top: var(--grouper-border) solid var(--core-outline-primary);\n}\n\n.Grouper-module_icon__7YSLa {\n\tmin-height: var(--grouper-icon-size);\n\theight: var(--grouper-icon-size);\n\tmin-width: var(--grouper-icon-size);\n\twidth: var(--grouper-icon-size);\n}\n";
|
|
13
|
+
var css = {"header":"Grouper-module_header__NPgUW flexBox-module_rowBetween__27lKK","title":"Grouper-module_title__-bt06 flexBox-module_rowBetween__27lKK type-module_body-m-regular__Qtp5G","content":"Grouper-module_content__u2SN7 flexBox-module_rowBetween__27lKK","icon":"Grouper-module_icon__7YSLa flexBox-module_row__PWxbe"};
|
|
14
|
+
styleInject(css_248z);
|
|
15
|
+
|
|
16
|
+
const Grouper = React.memo((props) => {
|
|
17
|
+
const { title = 'Group Title', toggle = true, open = true, hasIcon = true, iconName = 'chevron down', iconSize = 18, frameSize = 64, border = 0, count = 0, unframed = false, hideNull = true, showFilterBadge = false, onChange = () => null, onClick = () => null } = props, divAttributes = __rest(props, ["title", "toggle", "open", "hasIcon", "iconName", "iconSize", "frameSize", "border", "count", "unframed", "hideNull", "showFilterBadge", "onChange", "onClick"]);
|
|
18
|
+
const { id: divId, className, style } = divAttributes, rest = __rest(divAttributes, ["id", "className", "style"]);
|
|
19
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
20
|
+
const divClass = className ? ` ${className}` : '';
|
|
21
|
+
const theme = useTheme();
|
|
22
|
+
const [state, setState] = useState(open);
|
|
23
|
+
const [icon, animateIcon] = useAnimate();
|
|
24
|
+
useEffect(() => setState(open), [open]);
|
|
25
|
+
const animate = useCallback((state) => {
|
|
26
|
+
const animation = { rotate: state ? 0 : 180 };
|
|
27
|
+
animateIcon(icon.current, Object.assign({}, animation), { ease: 'easeInOut', duration: 0.25 });
|
|
28
|
+
}, [animateIcon, icon]);
|
|
29
|
+
const handleToggle = useCallback(() => {
|
|
30
|
+
if (!toggle)
|
|
31
|
+
return;
|
|
32
|
+
onClick();
|
|
33
|
+
onChange(!state);
|
|
34
|
+
animate(!state);
|
|
35
|
+
setState(!state);
|
|
36
|
+
}, [toggle, onClick, onChange, state, animate]);
|
|
37
|
+
// memo css vars
|
|
38
|
+
const cssVars = useMemo(() => {
|
|
39
|
+
return {
|
|
40
|
+
'--grouper-height': unframed ? 'auto' : `${frameSize}px`,
|
|
41
|
+
'--grouper-border': border ? `${border}px` : '0',
|
|
42
|
+
'--grouper-icon-size': `${iconSize}px`,
|
|
43
|
+
};
|
|
44
|
+
}, [frameSize, iconSize, border, unframed]);
|
|
45
|
+
return (jsx("div", Object.assign({ id: divId, className: `${css.header}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), onClick: handleToggle, onKeyDown: handleToggle }, rest, { children: jsxs("div", { className: css.content, children: [jsxs("div", { className: css.title, children: [title, jsx(Badge, { hideNull: hideNull, count: count, variant: 'light' }), showFilterBadge && (jsx(Icon, { name: "filter", size: 16, strokeColor: theme.current.colors['core-text-disabled'] }))] }), hasIcon && (jsx("div", { ref: icon, className: css.icon, children: jsx(Icon, { name: iconName, size: iconSize }) }))] }) })));
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export { Grouper as G };
|