@apple-pie/slice 0.0.1 → 0.0.3
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 +37 -0
- package/dist/cjs/hooks/useTheme.js +86 -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 +33 -0
- package/dist/cjs/index.js +124 -0
- package/dist/cjs/providers/ThemeProvider.js +55 -0
- package/dist/cjs/providers.js +14 -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/elevations.js +17 -0
- package/dist/cjs/theme/themes.js +26 -0
- package/dist/cjs/theme/type.js +316 -0
- package/dist/cjs/theme.js +16 -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 +22 -0
- package/dist/cjs/uikit/DivInput.js +13 -0
- package/dist/cjs/uikit/DocIcon.js +18 -0
- package/dist/cjs/uikit/Dot.js +12 -0
- package/dist/cjs/uikit/DraggablePanel.js +21 -0
- package/dist/cjs/uikit/DropDown.js +21 -0
- package/dist/cjs/uikit/EditorButtonBar.js +28 -0
- package/dist/cjs/uikit/ErrorSummary.js +12 -0
- package/dist/cjs/uikit/FlexDiv.js +12 -0
- package/dist/cjs/uikit/Grouper.js +23 -0
- package/dist/cjs/uikit/Icon.js +23 -0
- package/dist/cjs/uikit/IconButton.js +25 -0
- package/dist/cjs/uikit/Logos.js +18 -0
- package/dist/cjs/uikit/MessageInput.js +30 -0
- package/dist/cjs/uikit/Overlay.js +12 -0
- package/dist/cjs/uikit/Pager.js +12 -0
- package/dist/cjs/uikit/Progress.js +21 -0
- package/dist/cjs/uikit/RadioButton.js +26 -0
- package/dist/cjs/uikit/RadioButtonList.js +27 -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 +26 -0
- package/dist/cjs/uikit/TextArea.js +27 -0
- package/dist/cjs/uikit/Textfield.js +28 -0
- package/dist/cjs/uikit/Tip.js +13 -0
- package/dist/cjs/uikit/Toast.js +26 -0
- package/dist/cjs/uikit/UIButton.js +26 -0
- package/dist/cjs/uikit/UIButtonBar.js +26 -0
- package/dist/cjs/uikit/UICard.js +21 -0
- package/dist/cjs/uikit/UIChip.js +22 -0
- package/dist/cjs/uikit/UIFileIcon.js +18 -0
- package/dist/cjs/uikit/UILabel.js +19 -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 +35 -0
- package/dist/esm/hooks/useTheme.js +84 -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 +15 -0
- package/dist/esm/index.js +58 -0
- package/dist/esm/providers/ThemeProvider.js +53 -0
- package/dist/esm/providers.js +8 -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/elevations.js +15 -0
- package/dist/esm/theme/themes.js +23 -0
- package/dist/esm/theme/type.js +312 -0
- package/dist/esm/theme.js +5 -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 +16 -0
- package/dist/esm/uikit/DivInput.js +7 -0
- package/dist/esm/uikit/DocIcon.js +12 -0
- package/dist/esm/uikit/Dot.js +6 -0
- package/dist/esm/uikit/DraggablePanel.js +15 -0
- package/dist/esm/uikit/DropDown.js +15 -0
- package/dist/esm/uikit/EditorButtonBar.js +22 -0
- package/dist/esm/uikit/ErrorSummary.js +6 -0
- package/dist/esm/uikit/FlexDiv.js +6 -0
- package/dist/esm/uikit/Grouper.js +17 -0
- package/dist/esm/uikit/Icon.js +13 -0
- package/dist/esm/uikit/IconButton.js +19 -0
- package/dist/esm/uikit/Logos.js +12 -0
- package/dist/esm/uikit/MessageInput.js +24 -0
- package/dist/esm/uikit/Overlay.js +6 -0
- package/dist/esm/uikit/Pager.js +6 -0
- package/dist/esm/uikit/Progress.js +14 -0
- package/dist/esm/uikit/RadioButton.js +20 -0
- package/dist/esm/uikit/RadioButtonList.js +21 -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 +20 -0
- package/dist/esm/uikit/TextArea.js +21 -0
- package/dist/esm/uikit/Textfield.js +22 -0
- package/dist/esm/uikit/Tip.js +7 -0
- package/dist/esm/uikit/Toast.js +16 -0
- package/dist/esm/uikit/UIButton.js +20 -0
- package/dist/esm/uikit/UIButtonBar.js +20 -0
- package/dist/esm/uikit/UICard.js +15 -0
- package/dist/esm/uikit/UIChip.js +16 -0
- package/dist/esm/uikit/UIFileIcon.js +12 -0
- package/dist/esm/uikit/UILabel.js +13 -0
- package/dist/types/index.d.ts +3 -3
- 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/elevations/_types.d.ts +10 -0
- package/dist/types/theme/elevations/elevations.d.ts +5 -0
- package/dist/types/theme/index.d.ts +2 -0
- package/dist/types/theme/themes.d.ts +2 -0
- package/dist/types/uikit/FlexDiv/FlexDiv.d.ts +2 -0
- package/dist/types/uikit/FlexDiv/_types.d.ts +1 -0
- package/dist/types/uikit/Toast/Toast.d.ts +1 -1
- package/dist/types/uikit/Toast/_types.d.ts +7 -1
- package/dist/types/uikit/Toast/index.d.ts +1 -1
- package/package.json +84 -5
- package/dist/index.esm.js +0 -5859
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -5911
- package/dist/index.js.map +0 -1
|
@@ -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 };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-0pkUdtrF.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { motion } from 'motion/react';
|
|
4
|
+
import React, { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
5
|
+
import { B as Badge } from './Badge-PPf5Uvw3.js';
|
|
6
|
+
import { D as Dot } from './Dot-B84UVs2e.js';
|
|
7
|
+
import { I as Icon } from './_types-BaYeLEWK.js';
|
|
8
|
+
import { T as ToolTipType } from './sharedTypes-BfZzG1KX.js';
|
|
9
|
+
import { s as styleInject } from './style-inject.es-tgCJW-Cu.js';
|
|
10
|
+
|
|
11
|
+
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.IconButton-module_button__Mq4Gd {\n\tposition: relative;\n\tbackground: var(--ib-bg);\n\tborder-radius: var(--ib-border-radius);\n\tborder: var(--ib-border) solid var(--core-outline-primary);\n\tgap: 6px;\n\tcursor: pointer;\n\t&:hover {\n\t\tbackground: var(--ib-bg-hover);\n\t}\n}\n\n.IconButton-module_label__piWOE {\n\tcolor: var(--ib-color);\n\ttext-overflow: ellipsis;\n\toverflow: hidden;\n\tword-break: break-all;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 1;\n\t-webkit-box-orient: vertical;\n}\n\n.IconButton-module_icon__EQ8vW {\n\tmin-height: var(--ib-icon-size);\n\theight: var(--ib-icon-size);\n\tmin-width: var(--ib-icon-size);\n\twidth: var(--ib-icon-size);\n}\n\n.IconButton-module_count__BhOlH {\n\tposition: absolute;\n\ttop: 0;\n\tright: 0;\n\ttransform: translateX(5px) translateY(-2px);\n}\n";
|
|
12
|
+
var css = {"button":"IconButton-module_button__Mq4Gd flexBox-module_row__PWxbe","label":"IconButton-module_label__piWOE flexBox-module_row__PWxbe type-module_body-l-regular__Ar4d3","icon":"IconButton-module_icon__EQ8vW flexBox-module_row__PWxbe","count":"IconButton-module_count__BhOlH flexBox-module_row__PWxbe"};
|
|
13
|
+
styleInject(css_248z);
|
|
14
|
+
|
|
15
|
+
const IconButton = React.memo((props) => {
|
|
16
|
+
const { frameSize = 36, iconSize = 20, icon = 'more', borderRadius = 4, tooltip = undefined, color = undefined, colorOn = undefined, bgColor = 'var(--core-surface-secondary)', bgColorHover = 'var(--core-outline-primary)', bgColorOn = 'var(--core-outline-primary)', transition = undefined, variants = undefined, initial = undefined, animate = undefined, exit = undefined, fillColor = undefined, label = undefined, hover = undefined, count = 0, toggle = true, toggleIcon = false, isToggled = false, disabled = false, showDot = false, border = false, onClick = () => null, onToolTip = () => null } = props, divAttributes = __rest(props, ["frameSize", "iconSize", "icon", "borderRadius", "tooltip", "color", "colorOn", "bgColor", "bgColorHover", "bgColorOn", "transition", "variants", "initial", "animate", "exit", "fillColor", "label", "hover", "count", "toggle", "toggleIcon", "isToggled", "disabled", "showDot", "border", "onClick", "onToolTip"]);
|
|
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 [on, setOn] = useState(isToggled);
|
|
21
|
+
const ref = useRef(null);
|
|
22
|
+
useEffect(() => setOn(isToggled), [isToggled]);
|
|
23
|
+
const handleClick = useCallback((e) => {
|
|
24
|
+
if (disabled)
|
|
25
|
+
return;
|
|
26
|
+
if (tooltip)
|
|
27
|
+
onToolTip(null);
|
|
28
|
+
setOn(!on);
|
|
29
|
+
onClick(e);
|
|
30
|
+
}, [disabled, tooltip, onToolTip, on, onClick]);
|
|
31
|
+
const handleMouseEnter = useCallback((e) => {
|
|
32
|
+
if (!(ref === null || ref === void 0 ? void 0 : ref.current) || !tooltip)
|
|
33
|
+
return;
|
|
34
|
+
const tip = {
|
|
35
|
+
type: ToolTipType.button,
|
|
36
|
+
payload: { label: tooltip },
|
|
37
|
+
event: e,
|
|
38
|
+
ref: ref,
|
|
39
|
+
};
|
|
40
|
+
onToolTip(tip);
|
|
41
|
+
}, [tooltip, onToolTip]);
|
|
42
|
+
const handleMouseLeave = useCallback(() => {
|
|
43
|
+
if (tooltip)
|
|
44
|
+
onToolTip(null);
|
|
45
|
+
}, [tooltip, onToolTip]);
|
|
46
|
+
// memo icon stroke color
|
|
47
|
+
const strokeColor = useMemo(() => color || 'var(--core-icon-primary)', [color]);
|
|
48
|
+
// memo bg color
|
|
49
|
+
const bgColorNormal = useMemo(() => {
|
|
50
|
+
if (on && toggle)
|
|
51
|
+
return bgColorOn;
|
|
52
|
+
return bgColor !== null && bgColor !== void 0 ? bgColor : 'var(--core-surface-secondary)';
|
|
53
|
+
}, [toggle, bgColorOn, bgColor, on]);
|
|
54
|
+
// memo bg color on hover
|
|
55
|
+
const bgHoverColor = useMemo(() => {
|
|
56
|
+
if (hover && on)
|
|
57
|
+
return bgColorOn;
|
|
58
|
+
if (hover)
|
|
59
|
+
return bgColorHover;
|
|
60
|
+
return bgColor !== null && bgColor !== void 0 ? bgColor : 'transparent';
|
|
61
|
+
}, [hover, bgColor, bgColorOn, bgColorHover, on]);
|
|
62
|
+
// memo text color selected / unselected
|
|
63
|
+
const textColor = useMemo(() => {
|
|
64
|
+
if (toggle && on)
|
|
65
|
+
return colorOn;
|
|
66
|
+
return color !== null && color !== void 0 ? color : 'var(--core-text-primary)';
|
|
67
|
+
}, [toggle, on, colorOn, color]);
|
|
68
|
+
// memo css vars
|
|
69
|
+
const cssVars = useMemo(() => {
|
|
70
|
+
return {
|
|
71
|
+
'--ib-bg': bgColorNormal,
|
|
72
|
+
'--ib-bg-hover': bgHoverColor,
|
|
73
|
+
'--ib-icon-size': `${frameSize !== null && frameSize !== void 0 ? frameSize : 0}px`,
|
|
74
|
+
'--ib-border-radius': `${borderRadius !== null && borderRadius !== void 0 ? borderRadius : 0}px`,
|
|
75
|
+
'--ib-border': border ? '1px' : 0,
|
|
76
|
+
'--ib-color': textColor,
|
|
77
|
+
};
|
|
78
|
+
}, [bgColorNormal, bgHoverColor, textColor, border, frameSize, borderRadius]);
|
|
79
|
+
return (jsxs(motion.div, Object.assign({ id: divId, className: `${css.button}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), onClick: handleClick, onMouseLeave: handleMouseLeave, onMouseEnter: handleMouseEnter, transition: transition, variants: variants, initial: initial, animate: animate, exit: exit, ref: ref }, rest, { children: [jsx("div", { className: css.icon, style: { opacity: disabled ? 0.3 : 1 }, children: jsx(Icon, { name: icon, strokeColor: strokeColor, fillColor: fillColor, disabled: disabled, size: iconSize, toggle: toggleIcon ? isToggled : false, pointer: true }) }), label && jsx("div", { className: css.label, children: label }), jsx(Dot, { show: showDot }), count !== 0 && (jsx("div", { className: css.count, children: jsx(Badge, { variant: 'light', count: count, hideNull: true }) }))] })));
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export { IconButton as I };
|