@apple-pie/slice 0.0.4 → 0.0.5
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/README.md +13 -6
- package/dist/cjs/chunks/{Avatar-8-wPWe0V.js → Avatar-z2YcOAoP.js} +1 -1
- package/dist/cjs/chunks/{AvatarGroup-CVKmgBbD.js → AvatarGroup-Cz8369zI.js} +1 -1
- package/dist/cjs/chunks/{Badge-CMapJCij.js → Badge-COSg__VJ.js} +1 -1
- package/dist/cjs/chunks/{UIButton-W-WjUvVm.js → Button-BNXqiA13.js} +28 -33
- package/dist/cjs/chunks/{UIButtonBar-FvX4kB-s.js → ButtonBar-CeDdAOlH.js} +5 -5
- package/dist/cjs/chunks/{UICard-DBDSyT7E.js → Card-Cc_c-S7i.js} +5 -5
- package/dist/cjs/chunks/{CheckBox-7AACxrdZ.js → CheckBox-hTWIPqV_.js} +2 -2
- package/dist/cjs/chunks/{UIChip-kjhvRrOV.js → Chip-CLKVldi4.js} +5 -5
- package/dist/cjs/chunks/{DivInput-BKKJTFeV.js → DivInput-DnY2emt-.js} +2 -2
- package/dist/cjs/chunks/{DrggablePanel-C6TPsDB-.js → DrggablePanel-BtsURL9o.js} +1 -1
- package/dist/cjs/chunks/{DropDown-D9sf_m2I.js → DropDown-COr9u96t.js} +2 -2
- package/dist/cjs/chunks/{ErrorSummary-Dv44onsV.js → ErrorSummary-BrSHbGpk.js} +1 -1
- package/dist/cjs/chunks/FileIcon-CEMQK_Je.js +132 -0
- package/dist/cjs/chunks/FileList-DWIm4o46.js +163 -0
- package/dist/cjs/chunks/{FlexDiv-DZBpswHV.js → FlexDiv-BHl29ywz.js} +1 -1
- package/dist/cjs/chunks/{Grouper-_kd2nU78.js → Grouper-EyHoeA8w.js} +3 -3
- package/dist/cjs/chunks/{IconButton-CjiNliPL.js → IconButton-9QZ4eKBZ.js} +3 -3
- package/dist/cjs/chunks/{UILabel-DpMIPlZO.js → Label-DZJ_YDtD.js} +17 -7
- package/dist/cjs/chunks/{Pager--55eRDdu.js → Pager-CRjpl1FZ.js} +1 -1
- package/dist/cjs/chunks/PromptInput-DmO8a3oX.js +212 -0
- package/dist/cjs/chunks/{RadioButton--k2YFFEG.js → RadioButton-DA9YUGEF.js} +2 -2
- package/dist/cjs/chunks/{RadioButtonList-D99mA5EZ.js → RadioButtonList-BtsT7GJc.js} +1 -1
- package/dist/cjs/chunks/{Slider-C-gn7Sby.js → Slider-CqrIwn-L.js} +1 -1
- package/dist/cjs/chunks/{TabBar-CqnPPTFy.js → TabBar-WsNlr-aZ.js} +4 -4
- package/dist/cjs/chunks/{TextArea-CWr6mi3Q.js → TextArea-BMJWUH2H.js} +3 -3
- package/dist/cjs/chunks/{TextField-BTyhrsbK.js → TextField-mfwz79cD.js} +5 -5
- package/dist/cjs/chunks/{Tip-DnLgI7WY.js → Tip-Af6FMEDi.js} +2 -2
- package/dist/cjs/chunks/{Toast-CTCc6Cyl.js → Toast-CxAEOW4z.js} +17 -4
- package/dist/cjs/chunks/{_types-CoWzQFsT.js → _types-BNlHsGMQ.js} +2 -2
- package/dist/cjs/chunks/{utils-CbayehuI.js → utils-BwNacfBU.js} +2 -0
- package/dist/cjs/chunks/windowStore-CPcVHJq6.js +93 -0
- package/dist/cjs/hooks/useKeyboardShortcuts.js +3 -1
- package/dist/cjs/hooks/useObserveTheme.js +14 -8
- package/dist/cjs/hooks/useTrackRenders.js +2 -1
- package/dist/cjs/hooks/useWindow.js +29 -7
- package/dist/cjs/index.js +45 -38
- package/dist/cjs/providers/ThemeProvider.js +6 -3
- package/dist/cjs/stores/window.js +12 -0
- package/dist/cjs/stores.js +6 -0
- package/dist/cjs/theme/type.js +99 -18
- package/dist/cjs/uikit/Avatar.js +1 -1
- package/dist/cjs/uikit/AvatarGroup.js +2 -2
- package/dist/cjs/uikit/Badge.js +1 -1
- package/dist/cjs/uikit/{UIButton.js → Button.js} +7 -7
- package/dist/cjs/uikit/{UIButtonBar.js → ButtonBar.js} +6 -6
- package/dist/cjs/uikit/{UICard.js → Card.js} +4 -4
- package/dist/cjs/uikit/CheckBox.js +3 -3
- package/dist/cjs/uikit/{UIChip.js → Chip.js} +4 -4
- package/dist/cjs/uikit/DivInput.js +2 -2
- package/dist/cjs/uikit/DraggablePanel.js +2 -2
- package/dist/cjs/uikit/DropDown.js +3 -3
- package/dist/cjs/uikit/ErrorSummary.js +1 -1
- package/dist/cjs/uikit/{UIFileIcon.js → FileIcon.js} +7 -2
- package/dist/cjs/uikit/FileList.js +24 -0
- package/dist/cjs/uikit/FlexDiv.js +1 -1
- package/dist/cjs/uikit/Grouper.js +4 -4
- package/dist/cjs/uikit/Icon.js +2 -2
- package/dist/cjs/uikit/IconButton.js +4 -4
- package/dist/cjs/uikit/{UILabel.js → Label.js} +3 -3
- package/dist/cjs/uikit/Pager.js +2 -2
- package/dist/cjs/uikit/{MessageInput.js → PromptInput.js} +10 -11
- package/dist/cjs/uikit/RadioButton.js +5 -5
- package/dist/cjs/uikit/RadioButtonList.js +6 -6
- package/dist/cjs/uikit/Slider.js +2 -2
- package/dist/cjs/uikit/TabBar.js +5 -5
- package/dist/cjs/uikit/TextArea.js +7 -7
- package/dist/cjs/uikit/Textfield.js +7 -7
- package/dist/cjs/uikit/Tip.js +2 -2
- package/dist/cjs/uikit/Toast.js +3 -3
- package/dist/css/type.module.css +55 -10
- package/dist/esm/chunks/{Avatar-D_muqPrW.js → Avatar-BtkvMV1v.js} +1 -1
- package/dist/esm/chunks/{AvatarGroup-D8Xmrn52.js → AvatarGroup-pbqdS56o.js} +1 -1
- package/dist/esm/chunks/{Badge-PPf5Uvw3.js → Badge-DtxDLSO0.js} +1 -1
- package/dist/esm/chunks/{UIButton-HssaFaip.js → Button-BUJkJqdO.js} +28 -33
- package/dist/esm/chunks/{UIButtonBar-CUat663I.js → ButtonBar-Bl0oCxd8.js} +5 -5
- package/dist/esm/chunks/{UICard-Dn5f3wg8.js → Card-Bjk0kgQh.js} +5 -5
- package/dist/esm/chunks/{CheckBox-CswFI0Xc.js → CheckBox-CvkZuSeB.js} +2 -2
- package/dist/esm/chunks/{UIChip-DqnGeVyR.js → Chip-o-YG_HAf.js} +5 -5
- package/dist/esm/chunks/{DivInput-iKFkeU2F.js → DivInput-D6ORPrkT.js} +2 -2
- package/dist/esm/chunks/{DrggablePanel-CYYwTmFd.js → DrggablePanel-DWrTjXvf.js} +1 -1
- package/dist/esm/chunks/{DropDown-D4t6EhKL.js → DropDown-BDIvYWI-.js} +2 -2
- package/dist/esm/chunks/{ErrorSummary-DhU5SKPt.js → ErrorSummary-DzDnacH0.js} +1 -1
- package/dist/esm/chunks/FileIcon-Cxh-QsYb.js +130 -0
- package/dist/esm/chunks/FileList-yo_u1Kvw.js +161 -0
- package/dist/esm/chunks/{FlexDiv-CmMpORgn.js → FlexDiv-CFyndG99.js} +1 -1
- package/dist/esm/chunks/{Grouper-BbreOXI9.js → Grouper-NJbpaaQG.js} +3 -3
- package/dist/esm/chunks/{IconButton-hJDuWiDh.js → IconButton-3m9ugITV.js} +3 -3
- package/dist/esm/chunks/{UILabel-CpLi8OLx.js → Label-CgntsR3g.js} +17 -7
- package/dist/esm/chunks/{Pager-Beht2NyO.js → Pager-BHLyXq9p.js} +1 -1
- package/dist/esm/chunks/PromptInput-C_qj6kGp.js +210 -0
- package/dist/esm/chunks/{RadioButton-C4EhaRlp.js → RadioButton-D8otD_Jj.js} +2 -2
- package/dist/esm/chunks/{RadioButtonList-iVlML5jt.js → RadioButtonList-CtX1j7rO.js} +1 -1
- package/dist/esm/chunks/{Slider-C-PcWqTz.js → Slider-O6UelMjh.js} +1 -1
- package/dist/esm/chunks/{TabBar-CMfPQJj-.js → TabBar-C0NgwRa2.js} +4 -4
- package/dist/esm/chunks/{TextArea-CiHIh1P_.js → TextArea-DK0giDGR.js} +3 -3
- package/dist/esm/chunks/{TextField-6wse4On1.js → TextField-CQ4XYYNm.js} +5 -5
- package/dist/esm/chunks/{Tip-CeN0gy3B.js → Tip-iFECDhwN.js} +2 -2
- package/dist/esm/chunks/{Toast-C9P_ptX5.js → Toast-ZxMZtbd0.js} +17 -4
- package/dist/esm/chunks/{_types-BaYeLEWK.js → _types-RJ7q8S0B.js} +2 -2
- package/dist/esm/chunks/{utils-BRZK2Drn.js → utils-CZ1LWeN6.js} +2 -0
- package/dist/esm/chunks/windowStore-Cu4W4zJM.js +91 -0
- package/dist/esm/hooks/useKeyboardShortcuts.js +3 -1
- package/dist/esm/hooks/useObserveTheme.js +14 -8
- package/dist/esm/hooks/useTrackRenders.js +2 -1
- package/dist/esm/hooks/useWindow.js +30 -8
- package/dist/esm/index.js +30 -30
- package/dist/esm/providers/ThemeProvider.js +6 -3
- package/dist/esm/stores/window.js +2 -0
- package/dist/esm/stores.js +1 -0
- package/dist/esm/theme/type.js +99 -18
- package/dist/esm/uikit/Avatar.js +1 -1
- package/dist/esm/uikit/AvatarGroup.js +2 -2
- package/dist/esm/uikit/Badge.js +1 -1
- package/dist/esm/uikit/{UIButton.js → Button.js} +6 -6
- package/dist/esm/uikit/{UIButtonBar.js → ButtonBar.js} +5 -5
- package/dist/esm/uikit/{UICard.js → Card.js} +3 -3
- package/dist/esm/uikit/CheckBox.js +3 -3
- package/dist/esm/uikit/{UIChip.js → Chip.js} +3 -3
- package/dist/esm/uikit/DivInput.js +2 -2
- package/dist/esm/uikit/DraggablePanel.js +2 -2
- package/dist/esm/uikit/DropDown.js +3 -3
- package/dist/esm/uikit/ErrorSummary.js +1 -1
- package/dist/esm/uikit/{UIFileIcon.js → FileIcon.js} +2 -1
- package/dist/esm/uikit/FileList.js +18 -0
- package/dist/esm/uikit/FlexDiv.js +1 -1
- package/dist/esm/uikit/Grouper.js +4 -4
- package/dist/esm/uikit/Icon.js +2 -2
- package/dist/esm/uikit/IconButton.js +4 -4
- package/dist/esm/uikit/{UILabel.js → Label.js} +2 -2
- package/dist/esm/uikit/Pager.js +2 -2
- package/dist/esm/uikit/{MessageInput.js → PromptInput.js} +9 -10
- package/dist/esm/uikit/RadioButton.js +5 -5
- package/dist/esm/uikit/RadioButtonList.js +6 -6
- package/dist/esm/uikit/Slider.js +2 -2
- package/dist/esm/uikit/TabBar.js +5 -5
- package/dist/esm/uikit/TextArea.js +7 -7
- package/dist/esm/uikit/Textfield.js +7 -7
- package/dist/esm/uikit/Tip.js +2 -2
- package/dist/esm/uikit/Toast.js +3 -3
- package/dist/types/hooks/index.d.ts +1 -1
- package/dist/types/hooks/useKeyboardShortcuts/useKeyboardShortcuts.d.ts +1 -0
- package/dist/types/hooks/useWindow/useWindow.d.ts +11 -2
- package/dist/types/index.d.ts +17 -21
- package/dist/types/providers/ThemeProvider.d.ts +1 -0
- package/dist/types/stores/index.d.ts +1 -0
- package/dist/types/stores/window/_types.d.ts +28 -0
- package/dist/types/stores/window/index.d.ts +2 -0
- package/dist/types/stores/window/windowStore.d.ts +17 -0
- package/dist/types/theme/type/types.d.ts +5 -0
- package/dist/types/uikit/{UIButton/UIButton.d.ts → Button/Button.d.ts} +3 -3
- package/dist/types/uikit/{UIButton → Button}/_types.d.ts +3 -3
- package/dist/types/uikit/Button/index.d.ts +2 -0
- package/dist/types/uikit/ButtonBar/ButtonBar.d.ts +2 -0
- package/dist/types/uikit/{UIButtonBar → ButtonBar}/_types.d.ts +2 -2
- package/dist/types/uikit/ButtonBar/index.d.ts +2 -0
- package/dist/types/uikit/Card/Card.d.ts +3 -0
- package/dist/types/uikit/{UICard → Card}/_types.d.ts +2 -2
- package/dist/types/uikit/Card/index.d.ts +2 -0
- package/dist/types/uikit/Chip/Chip.d.ts +3 -0
- package/dist/types/uikit/{UIChip → Chip}/_types.d.ts +2 -2
- package/dist/types/uikit/Chip/index.d.ts +3 -0
- package/dist/types/uikit/FileIcon/FileIcon.d.ts +3 -0
- package/dist/types/uikit/FileIcon/_types.d.ts +27 -0
- package/dist/types/uikit/FileIcon/fileIconRegistry.d.ts +4 -0
- package/dist/types/uikit/FileIcon/index.d.ts +3 -0
- package/dist/types/uikit/FileList/FileList.d.ts +3 -0
- package/dist/types/uikit/FileList/_types.d.ts +23 -0
- package/dist/types/uikit/FileList/index.d.ts +2 -0
- package/dist/types/uikit/Label/Label.d.ts +2 -0
- package/dist/types/uikit/{UILabel → Label}/_types.d.ts +3 -2
- package/dist/types/uikit/Label/index.d.ts +2 -0
- package/dist/types/uikit/PromptInput/PromptInput.d.ts +63 -0
- package/dist/types/uikit/PromptInput/_types.d.ts +35 -0
- package/dist/types/uikit/PromptInput/index.d.ts +2 -0
- package/dist/types/util/files.d.ts +9 -0
- package/dist/types/util/utils.d.ts +4 -0
- package/package.json +5 -2
- package/dist/cjs/chunks/EditorButtonBar-Gaxq4gul.js +0 -244
- package/dist/cjs/chunks/MessageInput-YV8cqU8h.js +0 -399
- package/dist/cjs/chunks/UIFileIcon-ZrbDIeYz.js +0 -54
- package/dist/cjs/uikit/EditorButtonBar.js +0 -28
- package/dist/esm/chunks/EditorButtonBar-15cTeQ-H.js +0 -242
- package/dist/esm/chunks/MessageInput-DByI4x7h.js +0 -397
- package/dist/esm/chunks/UIFileIcon-qGxIPsJJ.js +0 -52
- package/dist/esm/uikit/EditorButtonBar.js +0 -22
- package/dist/types/uikit/EditorButtonBar/EditorButtonBar.d.ts +0 -4
- package/dist/types/uikit/EditorButtonBar/_Data.d.ts +0 -12
- package/dist/types/uikit/EditorButtonBar/_types.d.ts +0 -61
- package/dist/types/uikit/EditorButtonBar/index.d.ts +0 -2
- package/dist/types/uikit/MessageInput/ExcerptList/ExcerptList.d.ts +0 -2
- package/dist/types/uikit/MessageInput/ExcerptList/_types.d.ts +0 -15
- package/dist/types/uikit/MessageInput/FileList/FileList.d.ts +0 -2
- package/dist/types/uikit/MessageInput/FileList/_types.d.ts +0 -6
- package/dist/types/uikit/MessageInput/InputField/MessageInput.d.ts +0 -2
- package/dist/types/uikit/MessageInput/InputField/_types.d.ts +0 -39
- package/dist/types/uikit/MessageInput/UserList/UserList.d.ts +0 -5
- package/dist/types/uikit/MessageInput/UserList/_types.d.ts +0 -40
- package/dist/types/uikit/MessageInput/_Data.d.ts +0 -6
- package/dist/types/uikit/MessageInput/_types.d.ts +0 -42
- package/dist/types/uikit/MessageInput/index.d.ts +0 -4
- package/dist/types/uikit/UIButton/index.d.ts +0 -2
- package/dist/types/uikit/UIButtonBar/UIButtonBar.d.ts +0 -2
- package/dist/types/uikit/UIButtonBar/index.d.ts +0 -2
- package/dist/types/uikit/UICard/UICard.d.ts +0 -3
- package/dist/types/uikit/UICard/index.d.ts +0 -2
- package/dist/types/uikit/UIChip/UIChip.d.ts +0 -3
- package/dist/types/uikit/UIChip/index.d.ts +0 -3
- package/dist/types/uikit/UIFileIcon/UIFileIcon.d.ts +0 -3
- package/dist/types/uikit/UIFileIcon/_types.d.ts +0 -19
- package/dist/types/uikit/UIFileIcon/index.d.ts +0 -2
- package/dist/types/uikit/UILabel/UILabel.d.ts +0 -2
- package/dist/types/uikit/UILabel/index.d.ts +0 -2
|
@@ -1,242 +0,0 @@
|
|
|
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-hJDuWiDh.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 };
|