@apple-pie/slice 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chunks/Avatar-8-wPWe0V.js +68 -0
- package/dist/cjs/chunks/AvatarGroup-CVKmgBbD.js +39 -0
- package/dist/cjs/chunks/Badge-CMapJCij.js +41 -0
- package/dist/cjs/chunks/CheckBox-7AACxrdZ.js +76 -0
- package/dist/cjs/chunks/DivInput-BKKJTFeV.js +204 -0
- package/dist/cjs/chunks/DocIcons-BRWOzK96.js +41 -0
- package/dist/cjs/chunks/Dot-Dnr9M9na.js +80 -0
- package/dist/cjs/chunks/DrggablePanel-C6TPsDB-.js +302 -0
- package/dist/cjs/chunks/DropDown-D9sf_m2I.js +154 -0
- package/dist/cjs/chunks/EditorButtonBar-CUNDgRQd.js +244 -0
- package/dist/cjs/chunks/ErrorSummary-Dv44onsV.js +42 -0
- package/dist/cjs/chunks/FlexDiv-DZBpswHV.js +103 -0
- package/dist/cjs/chunks/Grouper-_kd2nU78.js +50 -0
- package/dist/cjs/chunks/IconButton-BfsPlKTb.js +84 -0
- package/dist/cjs/chunks/Logos-DSlAUz8l.js +119 -0
- package/dist/cjs/chunks/MessageInput-CiHFo2j8.js +399 -0
- package/dist/cjs/chunks/Overlay-DwCPvGB5.js +45 -0
- package/dist/cjs/chunks/Pager-CFtZ0IIW.js +42 -0
- package/dist/cjs/chunks/ProgressIndicator-C5oB7Mky.js +121 -0
- package/dist/cjs/chunks/RadioButton-e_y2qiPE.js +65 -0
- package/dist/cjs/chunks/RadioButtonList-I81UwHmM.js +116 -0
- package/dist/cjs/chunks/Slider-C-gn7Sby.js +285 -0
- package/dist/cjs/chunks/Spacer-BEY2-_PB.js +16 -0
- package/dist/cjs/chunks/Switch-CtkFtogd.js +43 -0
- package/dist/cjs/chunks/TabBar-D3bj4pjj.js +176 -0
- package/dist/cjs/chunks/TextArea-B1oKK3_b.js +153 -0
- package/dist/cjs/chunks/TextField-CiQdPP5E.js +248 -0
- package/dist/cjs/chunks/Tip-C2pzExut.js +91 -0
- package/dist/cjs/chunks/Toast-DrijUwoL.js +141 -0
- package/dist/cjs/chunks/UIButton-CH4p-8yq.js +317 -0
- package/dist/cjs/chunks/UIButtonBar-0fHPB0ww.js +58 -0
- package/dist/cjs/chunks/UICard-DBDSyT7E.js +36 -0
- package/dist/cjs/chunks/UIChip-kjhvRrOV.js +93 -0
- package/dist/cjs/chunks/UIFileIcon-ZrbDIeYz.js +54 -0
- package/dist/cjs/chunks/UILabel-DkBE2AIt.js +116 -0
- package/dist/cjs/chunks/_types-CoWzQFsT.js +714 -0
- package/dist/cjs/chunks/sharedTypes-BvTjh6M5.js +9 -0
- package/dist/cjs/chunks/style-inject.es-XZHJH68X.js +30 -0
- package/dist/cjs/chunks/tipStore-C9oV9SIh.js +23 -0
- package/dist/cjs/chunks/toastStore-C-ETP9H6.js +23 -0
- package/dist/cjs/chunks/tslib.es6-4H29ixHs.js +48 -0
- package/dist/cjs/chunks/utils-CbayehuI.js +126 -0
- package/dist/cjs/hooks/useDoubleClick.js +26 -0
- package/dist/cjs/hooks/useKeyboardShortcuts.js +42 -0
- package/dist/cjs/hooks/useLastUpdated.js +53 -0
- package/dist/cjs/hooks/useLocalStore.js +52 -0
- package/dist/cjs/hooks/useObserveResize.js +56 -0
- package/dist/cjs/hooks/useObserveTheme.js +36 -0
- package/dist/cjs/hooks/useTheme.js +85 -0
- package/dist/cjs/hooks/useToolTip.js +36 -0
- package/dist/cjs/hooks/useTrackRenders.js +38 -0
- package/dist/cjs/hooks/useWindow.js +64 -0
- package/dist/cjs/hooks.js +32 -0
- package/dist/cjs/index.js +121 -0
- package/dist/cjs/providers/ThemeProvider.js +51 -0
- package/dist/cjs/providers.js +13 -0
- package/dist/cjs/stores/tip.js +12 -0
- package/dist/cjs/stores/toast.js +12 -0
- package/dist/cjs/stores.js +18 -0
- package/dist/cjs/theme/colors.js +383 -0
- package/dist/cjs/theme/corners.js +14 -0
- package/dist/cjs/theme/themes.js +23 -0
- package/dist/cjs/theme/type.js +316 -0
- package/dist/cjs/theme.js +13 -0
- package/dist/cjs/uikit/Avatar.js +11 -0
- package/dist/cjs/uikit/AvatarGroup.js +12 -0
- package/dist/cjs/uikit/Badge.js +11 -0
- package/dist/cjs/uikit/CheckBox.js +21 -0
- package/dist/cjs/uikit/DivInput.js +13 -0
- package/dist/cjs/uikit/DocIcon.js +17 -0
- package/dist/cjs/uikit/Dot.js +12 -0
- package/dist/cjs/uikit/DraggablePanel.js +20 -0
- package/dist/cjs/uikit/DropDown.js +20 -0
- package/dist/cjs/uikit/EditorButtonBar.js +27 -0
- package/dist/cjs/uikit/ErrorSummary.js +12 -0
- package/dist/cjs/uikit/FlexDiv.js +12 -0
- package/dist/cjs/uikit/Grouper.js +22 -0
- package/dist/cjs/uikit/Icon.js +22 -0
- package/dist/cjs/uikit/IconButton.js +24 -0
- package/dist/cjs/uikit/Logos.js +17 -0
- package/dist/cjs/uikit/MessageInput.js +29 -0
- package/dist/cjs/uikit/Overlay.js +12 -0
- package/dist/cjs/uikit/Pager.js +12 -0
- package/dist/cjs/uikit/Progress.js +20 -0
- package/dist/cjs/uikit/RadioButton.js +25 -0
- package/dist/cjs/uikit/RadioButtonList.js +26 -0
- package/dist/cjs/uikit/Slider.js +13 -0
- package/dist/cjs/uikit/Spacer.js +10 -0
- package/dist/cjs/uikit/Switch.js +12 -0
- package/dist/cjs/uikit/TabBar.js +25 -0
- package/dist/cjs/uikit/TextArea.js +26 -0
- package/dist/cjs/uikit/Textfield.js +27 -0
- package/dist/cjs/uikit/Tip.js +13 -0
- package/dist/cjs/uikit/Toast.js +25 -0
- package/dist/cjs/uikit/UIButton.js +25 -0
- package/dist/cjs/uikit/UIButtonBar.js +25 -0
- package/dist/cjs/uikit/UICard.js +20 -0
- package/dist/cjs/uikit/UIChip.js +21 -0
- package/dist/cjs/uikit/UIFileIcon.js +17 -0
- package/dist/cjs/uikit/UILabel.js +18 -0
- package/dist/esm/chunks/Avatar-D_muqPrW.js +66 -0
- package/dist/esm/chunks/AvatarGroup-D8Xmrn52.js +37 -0
- package/dist/esm/chunks/Badge-PPf5Uvw3.js +39 -0
- package/dist/esm/chunks/CheckBox-CswFI0Xc.js +74 -0
- package/dist/esm/chunks/DivInput-iKFkeU2F.js +202 -0
- package/dist/esm/chunks/DocIcons-CbOX4n8Y.js +39 -0
- package/dist/esm/chunks/Dot-B84UVs2e.js +78 -0
- package/dist/esm/chunks/DrggablePanel-CYYwTmFd.js +300 -0
- package/dist/esm/chunks/DropDown-D4t6EhKL.js +152 -0
- package/dist/esm/chunks/EditorButtonBar-FnMa8Zv2.js +242 -0
- package/dist/esm/chunks/ErrorSummary-DhU5SKPt.js +40 -0
- package/dist/esm/chunks/FlexDiv-CmMpORgn.js +101 -0
- package/dist/esm/chunks/Grouper-BbreOXI9.js +48 -0
- package/dist/esm/chunks/IconButton-CguHGkBM.js +82 -0
- package/dist/esm/chunks/Logos-DwZP-TR2.js +117 -0
- package/dist/esm/chunks/MessageInput-DMHzCwjO.js +397 -0
- package/dist/esm/chunks/Overlay-CCBy7n7H.js +43 -0
- package/dist/esm/chunks/Pager-BsSti93V.js +40 -0
- package/dist/esm/chunks/ProgressIndicator-BVukxMU6.js +118 -0
- package/dist/esm/chunks/RadioButton-B5BxQI0R.js +63 -0
- package/dist/esm/chunks/RadioButtonList-C2z8McAD.js +114 -0
- package/dist/esm/chunks/Slider-C-PcWqTz.js +283 -0
- package/dist/esm/chunks/Spacer-DbZSG5x3.js +14 -0
- package/dist/esm/chunks/Switch-DjfrSiQz.js +41 -0
- package/dist/esm/chunks/TabBar-BSBcgTbd.js +174 -0
- package/dist/esm/chunks/TextArea-COM0UPo2.js +151 -0
- package/dist/esm/chunks/TextField-Bh24bRWs.js +246 -0
- package/dist/esm/chunks/Tip-Ct19Ljul.js +89 -0
- package/dist/esm/chunks/Toast-BR0oMX6z.js +139 -0
- package/dist/esm/chunks/UIButton-DKx-_O8h.js +315 -0
- package/dist/esm/chunks/UIButtonBar-BNdA5eVq.js +56 -0
- package/dist/esm/chunks/UICard-Dn5f3wg8.js +34 -0
- package/dist/esm/chunks/UIChip-DqnGeVyR.js +91 -0
- package/dist/esm/chunks/UIFileIcon-qGxIPsJJ.js +52 -0
- package/dist/esm/chunks/UILabel-RnbodPCS.js +114 -0
- package/dist/esm/chunks/_types-BaYeLEWK.js +712 -0
- package/dist/esm/chunks/sharedTypes-BfZzG1KX.js +9 -0
- package/dist/esm/chunks/style-inject.es-tgCJW-Cu.js +28 -0
- package/dist/esm/chunks/tipStore-nBYJ6tmE.js +17 -0
- package/dist/esm/chunks/toastStore-r3pvNa28.js +17 -0
- package/dist/esm/chunks/tslib.es6-0pkUdtrF.js +45 -0
- package/dist/esm/chunks/utils-BRZK2Drn.js +119 -0
- package/dist/esm/hooks/useDoubleClick.js +24 -0
- package/dist/esm/hooks/useKeyboardShortcuts.js +40 -0
- package/dist/esm/hooks/useLastUpdated.js +51 -0
- package/dist/esm/hooks/useLocalStore.js +50 -0
- package/dist/esm/hooks/useObserveResize.js +54 -0
- package/dist/esm/hooks/useObserveTheme.js +34 -0
- package/dist/esm/hooks/useTheme.js +83 -0
- package/dist/esm/hooks/useToolTip.js +34 -0
- package/dist/esm/hooks/useTrackRenders.js +36 -0
- package/dist/esm/hooks/useWindow.js +62 -0
- package/dist/esm/hooks.js +14 -0
- package/dist/esm/index.js +57 -0
- package/dist/esm/providers/ThemeProvider.js +49 -0
- package/dist/esm/providers.js +7 -0
- package/dist/esm/stores/tip.js +2 -0
- package/dist/esm/stores/toast.js +2 -0
- package/dist/esm/stores.js +3 -0
- package/dist/esm/theme/colors.js +377 -0
- package/dist/esm/theme/corners.js +12 -0
- package/dist/esm/theme/themes.js +20 -0
- package/dist/esm/theme/type.js +312 -0
- package/dist/esm/theme.js +4 -0
- package/dist/esm/uikit/Avatar.js +5 -0
- package/dist/esm/uikit/AvatarGroup.js +6 -0
- package/dist/esm/uikit/Badge.js +5 -0
- package/dist/esm/uikit/CheckBox.js +15 -0
- package/dist/esm/uikit/DivInput.js +7 -0
- package/dist/esm/uikit/DocIcon.js +11 -0
- package/dist/esm/uikit/Dot.js +6 -0
- package/dist/esm/uikit/DraggablePanel.js +14 -0
- package/dist/esm/uikit/DropDown.js +14 -0
- package/dist/esm/uikit/EditorButtonBar.js +21 -0
- package/dist/esm/uikit/ErrorSummary.js +6 -0
- package/dist/esm/uikit/FlexDiv.js +6 -0
- package/dist/esm/uikit/Grouper.js +16 -0
- package/dist/esm/uikit/Icon.js +12 -0
- package/dist/esm/uikit/IconButton.js +18 -0
- package/dist/esm/uikit/Logos.js +11 -0
- package/dist/esm/uikit/MessageInput.js +23 -0
- package/dist/esm/uikit/Overlay.js +6 -0
- package/dist/esm/uikit/Pager.js +6 -0
- package/dist/esm/uikit/Progress.js +13 -0
- package/dist/esm/uikit/RadioButton.js +19 -0
- package/dist/esm/uikit/RadioButtonList.js +20 -0
- package/dist/esm/uikit/Slider.js +7 -0
- package/dist/esm/uikit/Spacer.js +4 -0
- package/dist/esm/uikit/Switch.js +6 -0
- package/dist/esm/uikit/TabBar.js +19 -0
- package/dist/esm/uikit/TextArea.js +20 -0
- package/dist/esm/uikit/Textfield.js +21 -0
- package/dist/esm/uikit/Tip.js +7 -0
- package/dist/esm/uikit/Toast.js +15 -0
- package/dist/esm/uikit/UIButton.js +19 -0
- package/dist/esm/uikit/UIButtonBar.js +19 -0
- package/dist/esm/uikit/UICard.js +14 -0
- package/dist/esm/uikit/UIChip.js +15 -0
- package/dist/esm/uikit/UIFileIcon.js +11 -0
- package/dist/esm/uikit/UILabel.js +12 -0
- package/dist/types/hooks/index.d.ts +9 -2
- package/dist/types/hooks/useDoubleClick/useDoubleClick.d.ts +1 -0
- package/dist/types/hooks/useKeyboardShortcuts/useKeyboardShortcuts.d.ts +6 -0
- package/dist/types/hooks/useLastUpdated/useLastUpdated.d.ts +4 -0
- package/dist/types/hooks/useLocalStore/useLocalStore.d.ts +1 -0
- package/dist/types/hooks/{useObserveResize.d.ts → useObserveResize/useObserveResize.d.ts} +1 -1
- package/dist/types/hooks/useObserveTheme/useObserveTheme.d.ts +2 -0
- package/dist/types/hooks/useTheme/useTheme.d.ts +47 -0
- package/dist/types/hooks/useToolTip/useToolTip.d.ts +6 -0
- package/dist/types/hooks/useWindow/useWindow.d.ts +15 -0
- package/dist/types/index.d.ts +9 -4
- package/dist/types/providers/ThemeProvider.d.ts +1 -0
- package/dist/types/stores/index.d.ts +2 -0
- package/dist/types/stores/tip/_types.d.ts +8 -0
- package/dist/types/stores/tip/index.d.ts +2 -0
- package/dist/types/stores/tip/tipStore.d.ts +12 -0
- package/dist/types/stores/toast/_types.d.ts +14 -0
- package/dist/types/stores/toast/index.d.ts +2 -0
- package/dist/types/stores/toast/toastStore.d.ts +12 -0
- package/dist/types/theme/colors/colors.d.ts +2 -0
- package/dist/types/theme/colors/types.d.ts +14 -0
- package/dist/types/theme/components/BrandColors.d.ts +1 -0
- package/dist/types/theme/components/ColorTile.d.ts +6 -0
- package/dist/types/theme/components/ColorTileGroup.d.ts +6 -0
- package/dist/types/theme/components/ThemeColors.d.ts +2 -0
- package/dist/types/theme/components/_types.d.ts +15 -0
- package/dist/types/theme/index.d.ts +1 -1
- package/dist/types/theme/themes.d.ts +3 -3
- package/dist/types/theme/type/type.d.ts +3 -0
- package/dist/types/uikit/Avatar/_types.d.ts +3 -2
- package/dist/types/uikit/AvatarGroup/_types.d.ts +4 -2
- package/dist/types/uikit/Badge/_types.d.ts +5 -2
- package/dist/types/uikit/CheckBox/_types.d.ts +5 -2
- package/dist/types/uikit/DivInput/_types.d.ts +4 -2
- package/dist/types/uikit/DocIcon/_types.d.ts +5 -2
- package/dist/types/uikit/Dot/_types.d.ts +6 -2
- package/dist/types/uikit/DraggablePanel/DrggablePanel.d.ts +3 -2
- package/dist/types/uikit/DropDown/DropDown.d.ts +2 -1
- package/dist/types/uikit/DropDown/_types.d.ts +5 -2
- package/dist/types/uikit/EditorButtonBar/_types.d.ts +4 -2
- package/dist/types/uikit/ErrorSummary/ErrorSummary.d.ts +2 -1
- package/dist/types/uikit/ErrorSummary/_types.d.ts +5 -2
- package/dist/types/uikit/FlexDiv/FlexDiv.d.ts +59 -2
- package/dist/types/uikit/FlexDiv/_types.d.ts +8 -2
- package/dist/types/uikit/Grouper/_types.d.ts +6 -2
- package/dist/types/uikit/Icon/_types.d.ts +7 -2
- package/dist/types/uikit/Icon/iconRegistry.d.ts +1 -0
- package/dist/types/uikit/IconButton/_types.d.ts +4 -2
- package/dist/types/uikit/Logos/_types.d.ts +8 -4
- package/dist/types/uikit/MessageInput/InputField/_types.d.ts +5 -2
- package/dist/types/uikit/Overlay/_types.d.ts +5 -2
- package/dist/types/uikit/Pager/_types.d.ts +5 -2
- package/dist/types/uikit/Progress/DoneCheck/_types.d.ts +5 -2
- package/dist/types/uikit/Progress/ProgressIndicator/_types.d.ts +5 -2
- package/dist/types/uikit/RadioButton/_types.d.ts +5 -2
- package/dist/types/uikit/RadioButtonList/_types.d.ts +5 -2
- package/dist/types/uikit/Slider/_types.d.ts +5 -2
- package/dist/types/uikit/Spacer/_types.d.ts +5 -2
- package/dist/types/uikit/Switch/Switch.d.ts +1 -1
- package/dist/types/uikit/Switch/_types.d.ts +5 -4
- package/dist/types/uikit/TabBar/_types.d.ts +5 -2
- package/dist/types/uikit/TextArea/_types.d.ts +5 -2
- package/dist/types/uikit/Textfield/_types.d.ts +4 -2
- package/dist/types/uikit/Tip/Tip.d.ts +3 -0
- package/dist/types/uikit/Tip/_types.d.ts +28 -0
- package/dist/types/uikit/Tip/index.d.ts +2 -0
- package/dist/types/uikit/Toast/Toast.d.ts +3 -0
- package/dist/types/uikit/Toast/_types.d.ts +24 -0
- package/dist/types/uikit/Toast/index.d.ts +2 -0
- package/dist/types/uikit/UIButton/UIButton.d.ts +73 -2
- package/dist/types/uikit/UIButton/_types.d.ts +4 -2
- package/dist/types/uikit/UIButtonBar/_types.d.ts +5 -2
- package/dist/types/uikit/UICard/_types.d.ts +5 -2
- package/dist/types/uikit/UIChip/_types.d.ts +4 -2
- package/dist/types/uikit/UIFileIcon/UIFileIcon.d.ts +1 -1
- package/dist/types/uikit/UIFileIcon/_types.d.ts +4 -2
- package/dist/types/uikit/UILabel/_types.d.ts +4 -2
- package/dist/types/util/utils.d.ts +12 -0
- package/package.json +80 -5
- package/dist/colors.css +0 -237
- package/dist/index.esm.js +0 -4831
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js +0 -4873
- package/dist/index.js.map +0 -1
- package/dist/type.css +0 -16
- package/dist/types/hooks/useMayaTheme.d.ts +0 -7
- package/dist/types/hooks/useTheme.d.ts +0 -2
- package/dist/types/uikit/Avatar/AvatarInline.stories.d.ts +0 -7
- /package/dist/{flexBox.module.css → css/flexBox.module.css} +0 -0
- /package/dist/{type.module.css → css/type.module.css} +0 -0
- /package/dist/types/hooks/{useTrackRenders.d.ts → useTrackRenders/useTrackRenders.d.ts} +0 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var react = require('motion/react');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var hooks_useTheme = require('../hooks/useTheme.js');
|
|
8
|
+
require('../theme/colors.js');
|
|
9
|
+
require('../hooks/useWindow.js');
|
|
10
|
+
var UIButton = require('./UIButton-CH4p-8yq.js');
|
|
11
|
+
var _types = require('./_types-CoWzQFsT.js');
|
|
12
|
+
var IconButton = require('./IconButton-BfsPlKTb.js');
|
|
13
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
14
|
+
var UIFileIcon = require('./UIFileIcon-ZrbDIeYz.js');
|
|
15
|
+
var Avatar = require('./Avatar-8-wPWe0V.js');
|
|
16
|
+
|
|
17
|
+
var css_248z$3 = ".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.ExcerptList-module_excerptList__1tvcr {\n\talign-items: flex-start;\n\twidth: 100%;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.ExcerptList-module_excerptButton__A3ZJh {\n\talign-items: flex-start;\n\tpadding: 10px 16px 14px 12px;\n\tbackground: var(--core-surface-primary);\n\tborder: 1px solid var(--core-outline-primary);\n\tborder-radius: 24px;\n\tmin-height: 48px;\n\tcursor: default;\n}\n\n.ExcerptList-module_icon__E8d4K {\n\theight: 20px;\n\twidth: 20px;\n}\n\n.ExcerptList-module_content__TBPjX {\n\tmax-width: 300px;\n\tpadding: 0px 16px 0px 8px;\n\tgap: 4px;\n}\n\n.ExcerptList-module_label__xv7up {\n\tcolor: var(--core-text-primary);\n\tmax-width: 300px;\n\tline-height: 1.5em;\n\toverflow: hidden;\n\tword-break: normal;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 3;\n\t-webkit-box-orient: vertical;\n\tuser-select: none;\n\t-webkit-user-select: none;\n}\n\n.ExcerptList-module_type__i9e14 {\n\tpadding-top: 4px;\n\tcolor: var(--core-text-disabled);\n\tgap: 4px;\n}\n\n.ExcerptList-module_typeIcon__WwWEY {\n\theight: 16px;\n\twidth: 16px;\n\toverflow: hidden;\n}\n";
|
|
18
|
+
var css$3 = {"excerptList":"ExcerptList-module_excerptList__1tvcr flexBox-module_rowStart__nJZnW","excerptButton":"ExcerptList-module_excerptButton__A3ZJh flexBox-module_rowStart__nJZnW","icon":"ExcerptList-module_icon__E8d4K flexBox-module_row__PWxbe","content":"ExcerptList-module_content__TBPjX flexBox-module_columnStart__Kg8cV","label":"ExcerptList-module_label__xv7up type-module_body-m-regular__Qtp5G","type":"ExcerptList-module_type__i9e14 flexBox-module_rowStart__nJZnW type-module_body-xs-regular__QWEzl"};
|
|
19
|
+
styleInject_es.styleInject(css_248z$3);
|
|
20
|
+
|
|
21
|
+
const ExcerptList = React.memo(function ExcerptList(props) {
|
|
22
|
+
const { excerpts = [], onChange = () => null, onToolTip = () => null, } = props;
|
|
23
|
+
const theme = hooks_useTheme.useTheme();
|
|
24
|
+
// memo remove file
|
|
25
|
+
const handleRemoveFile = React.useCallback((content) => {
|
|
26
|
+
const updatedList = excerpts.filter((excerpt) => {
|
|
27
|
+
return content !== excerpt.content;
|
|
28
|
+
});
|
|
29
|
+
onChange(updatedList);
|
|
30
|
+
}, [excerpts, onChange]);
|
|
31
|
+
const excerptItems = React.useMemo(() => {
|
|
32
|
+
return excerpts.map((excerpt, index) => {
|
|
33
|
+
return (jsxRuntime.jsxs("div", { className: css$3.excerptButton, children: [jsxRuntime.jsxs("div", { className: css$3.content, children: [jsxRuntime.jsxs("div", { className: css$3.type, children: [jsxRuntime.jsx(_types.Icon, { name: "recent chats", size: 16, strokeColor: theme.current.colors['core-text-disabled'] }), excerpt.docTitle ? excerpt.docTitle : 'Document excerpt'] }), jsxRuntime.jsx("div", { className: css$3.label, children: excerpt.content })] }), jsxRuntime.jsx("div", { className: css$3.icon, children: jsxRuntime.jsx(IconButton.IconButton, { icon: 'x', hover: false, toggle: false, frameSize: 20, iconSize: 20, onClick: (e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
handleRemoveFile(excerpt.content);
|
|
36
|
+
}, tooltip: 'remove excerpt', onToolTip: (tip) => onToolTip(tip) }) })] }, `${excerpt.content}-${index}`));
|
|
37
|
+
});
|
|
38
|
+
}, [excerpts, theme.current.colors, onToolTip, handleRemoveFile]);
|
|
39
|
+
return (jsxRuntime.jsx("div", { className: css$3.excerptList, onKeyDown: (e) => e.stopPropagation(), onClick: (e) => e.stopPropagation(), children: excerptItems }));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
var UIFileIcons;
|
|
43
|
+
(function (UIFileIcons) {
|
|
44
|
+
UIFileIcons["Pdf"] = "pdf";
|
|
45
|
+
UIFileIcons["Document"] = "document";
|
|
46
|
+
UIFileIcons["Spreadhseet"] = "spreadsheet";
|
|
47
|
+
})(UIFileIcons || (UIFileIcons = {}));
|
|
48
|
+
|
|
49
|
+
var css_248z$2 = ".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.FileList-module_fileList__uw9o6 {\n\talign-items: flex-start;\n\twidth: 100%;\n\tflex-wrap: wrap;\n\tgap: 8px;\n}\n\n.FileList-module_fileButton__XnXaN {\n\talign-items: flex-start;\n\tpadding: 10px 16px 14px 12px;\n\tbackground: var(--core-surface-primary);\n\tborder: 1px solid var(--core-outline-primary);\n\tborder-radius: 24px;\n\tmin-height: 48px;\n\tcursor: default;\n}\n\n.FileList-module_icon__fiu9M {\n\theight: 20px;\n\twidth: 20px;\n}\n\n.FileList-module_content__Kb8mh {\n\tmax-width: 300px;\n\tpadding: 0px 16px 0px 8px;\n\tgap: 4px;\n}\n\n.FileList-module_label__hoDXY {\n\tcolor: var(--core-text-primary);\n\tmax-width: 300px;\n\tline-height: 1.5em;\n\toverflow: hidden;\n\tword-break: normal;\n\tdisplay: -webkit-box;\n\t-webkit-line-clamp: 3;\n\t-webkit-box-orient: vertical;\n\tuser-select: none;\n\t-webkit-user-select: none;\n}\n\n.FileList-module_type__zOO2e {\n\tpadding-top: 4px;\n\tcolor: var(--core-text-disabled);\n\tgap: 4px;\n}\n\n.FileList-module_typeIcon__8SvkW {\n\theight: 16px;\n\twidth: 16px;\n\toverflow: hidden;\n}\n";
|
|
50
|
+
var css$2 = {"fileList":"FileList-module_fileList__uw9o6 flexBox-module_rowStart__nJZnW","fileButton":"FileList-module_fileButton__XnXaN flexBox-module_rowStart__nJZnW","icon":"FileList-module_icon__fiu9M flexBox-module_row__PWxbe","content":"FileList-module_content__Kb8mh flexBox-module_columnStart__Kg8cV","label":"FileList-module_label__hoDXY type-module_body-m-regular__Qtp5G","type":"FileList-module_type__zOO2e flexBox-module_rowStart__nJZnW type-module_body-xs-regular__QWEzl"};
|
|
51
|
+
styleInject_es.styleInject(css_248z$2);
|
|
52
|
+
|
|
53
|
+
const FileList = React.memo(function FileList(props) {
|
|
54
|
+
const { files = [], onChange = () => null, onToolTip = () => null } = props;
|
|
55
|
+
const handleRemoveFile = React.useCallback((fileName) => {
|
|
56
|
+
const updatedList = files.filter((file) => {
|
|
57
|
+
return file.name !== fileName;
|
|
58
|
+
});
|
|
59
|
+
onChange(updatedList);
|
|
60
|
+
}, [files, onChange]);
|
|
61
|
+
const fileType = React.useCallback((file) => {
|
|
62
|
+
switch (file.type) {
|
|
63
|
+
case 'text/plain':
|
|
64
|
+
return 'Text file';
|
|
65
|
+
case 'text/html':
|
|
66
|
+
return 'Web HTML file';
|
|
67
|
+
case 'text/csv':
|
|
68
|
+
return 'CSV spread shseet';
|
|
69
|
+
case 'application/pdf':
|
|
70
|
+
return 'PDF document';
|
|
71
|
+
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
72
|
+
case 'application/docx':
|
|
73
|
+
return 'Word document';
|
|
74
|
+
default:
|
|
75
|
+
return 'Unknown file type';
|
|
76
|
+
}
|
|
77
|
+
}, []);
|
|
78
|
+
const fileIcon = React.useCallback((file) => {
|
|
79
|
+
switch (file.type) {
|
|
80
|
+
case 'text/plain':
|
|
81
|
+
case 'text/html':
|
|
82
|
+
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
|
83
|
+
return UIFileIcons.Document;
|
|
84
|
+
case 'text/csv':
|
|
85
|
+
return UIFileIcons.Spreadhseet;
|
|
86
|
+
case 'application/pdf':
|
|
87
|
+
return UIFileIcons.Pdf;
|
|
88
|
+
default:
|
|
89
|
+
return UIFileIcons.Document;
|
|
90
|
+
}
|
|
91
|
+
}, []);
|
|
92
|
+
const handleRemoveClick = React.useCallback((e, fileName) => {
|
|
93
|
+
e.stopPropagation();
|
|
94
|
+
handleRemoveFile(fileName);
|
|
95
|
+
}, [handleRemoveFile]);
|
|
96
|
+
return (jsxRuntime.jsx("div", { className: css$2.fileList, children: files.map((file, index) => {
|
|
97
|
+
return (jsxRuntime.jsxs("div", { className: css$2.fileButton, children: [jsxRuntime.jsxs("div", { className: css$2.content, children: [jsxRuntime.jsxs("div", { className: css$2.type, children: [jsxRuntime.jsx(UIFileIcon.UIFileIcon, { name: fileIcon(file), size: 18 }), fileType(file)] }), jsxRuntime.jsx("div", { className: css$2.label, children: file.name })] }), jsxRuntime.jsx("div", { className: css$2.icon, children: jsxRuntime.jsx(IconButton.IconButton, { icon: 'x', hover: false, toggle: false, frameSize: 20, iconSize: 20, onClick: (e) => handleRemoveClick(e, file.name), tooltip: 'remove file', onToolTip: (tip) => onToolTip(tip) }) })] }, `${file.name}-${index}`));
|
|
98
|
+
}) }));
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
var css_248z$1 = ".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.UserList-module_promptList__M6-D9 {\n\twidth: 100%;\n\tgap: 8px;\n}\n\n@keyframes UserList-module_blink__695OA {\n\t0% {\n\t\topacity: 1;\n\t}\n\t50% {\n\t\topacity: 0;\n\t}\n\t100% {\n\t\topacity: 1;\n\t}\n}\n\n.UserList-module_userPrompt__YyVU5 {\n\talign-items: flex-start;\n\tpadding: 10px 12px;\n\tborder-radius: 24px;\n\tbackground: var(--core-surface-primary);\n\tborder: 1px solid var(--core-outline-primary);\n\tcursor: default;\n}\n\n.UserList-module_avatar__WvAyh {\n\theight: 24px;\n\twidth: 24px;\n}\n\n.UserList-module_prompt__2on5a {\n\tflex: 1;\n\tpadding: 0px 16px 0px 8px;\n\tcolor: var(--core-text-tertiary);\n\tfont-weight: 380;\n\tline-height: 1.5em;\n\tmin-height: 24px;\n}\n\n.UserList-module_promptStrong__-2WPf {\n\tfont-size: inherit;\n\tfont-weight: inherit;\n\tline-height: inherit;\n\tcolor: var(--core-text-primary);\n}\n\n.UserList-module_promptParagraph__L6phk {\n\tmargin: 0;\n\tpadding: 0;\n}\n\n.UserList-module_control__iBmvg {\n\tborder-radius: 100%;\n\tborder: 1px solid var(--control-border-color);\n\theight: 24px;\n\twidth: 24px;\n\tcursor: pointer;\n}\n\n.UserList-module_cursor__xmRjh {\n\tdisplay: block;\n\tbackground: var(--cursor-background);\n\tmin-width: 0.5em;\n\tmin-height: 0.5em;\n\twidth: 0.5em;\n\theight: 0.5em;\n\tborder-radius: var(--cursor-border-radius);\n\tanimation: var(--cursor-animation);\n}\n";
|
|
102
|
+
var css$1 = {"promptList":"UserList-module_promptList__M6-D9 flexBox-module_columnStart__Kg8cV","userPrompt":"UserList-module_userPrompt__YyVU5 flexBox-module_rowStart__nJZnW","avatar":"UserList-module_avatar__WvAyh flexBox-module_row__PWxbe","prompt":"UserList-module_prompt__2on5a flexBox-module_rowStart__nJZnW type-module_body-s-regular__8-FO-","promptStrong":"UserList-module_promptStrong__-2WPf","promptParagraph":"UserList-module_promptParagraph__L6phk","control":"UserList-module_control__iBmvg flexBox-module_row__PWxbe","cursor":"UserList-module_cursor__xmRjh"};
|
|
103
|
+
styleInject_es.styleInject(css_248z$1);
|
|
104
|
+
|
|
105
|
+
var PrompState;
|
|
106
|
+
(function (PrompState) {
|
|
107
|
+
PrompState["Idle"] = "idle";
|
|
108
|
+
PrompState["Disabled"] = "disabled";
|
|
109
|
+
PrompState["Enabled"] = "enabled";
|
|
110
|
+
})(PrompState || (PrompState = {}));
|
|
111
|
+
var Role$1;
|
|
112
|
+
(function (Role) {
|
|
113
|
+
Role["Owner"] = "owner";
|
|
114
|
+
Role["Editor"] = "editor";
|
|
115
|
+
Role["Viewer"] = "viewer";
|
|
116
|
+
})(Role$1 || (Role$1 = {}));
|
|
117
|
+
|
|
118
|
+
function UserListComponent(props) {
|
|
119
|
+
const theme = hooks_useTheme.useTheme();
|
|
120
|
+
const { userPresence = [], onTogglePrompt = () => null, owner = '', currentUser = '', presenceID = '', } = props;
|
|
121
|
+
const [userList, setUserList] = React.useState(userPresence);
|
|
122
|
+
React.useEffect(() => setUserList(userPresence), [userPresence]);
|
|
123
|
+
const handleTogglePrompt = React.useCallback((user) => {
|
|
124
|
+
if (currentUser !== owner)
|
|
125
|
+
return;
|
|
126
|
+
let promptState = PrompState.Disabled;
|
|
127
|
+
if (user.promptState) {
|
|
128
|
+
promptState =
|
|
129
|
+
user.promptState === PrompState.Disabled
|
|
130
|
+
? PrompState.Enabled
|
|
131
|
+
: PrompState.Disabled;
|
|
132
|
+
}
|
|
133
|
+
const presenceUpdate = Object.assign(Object.assign({}, user), { promptState });
|
|
134
|
+
onTogglePrompt(presenceUpdate);
|
|
135
|
+
}, [currentUser, owner, onTogglePrompt]);
|
|
136
|
+
const getCssVars = React.useCallback((enabled) => ({
|
|
137
|
+
'--control-border-color': enabled
|
|
138
|
+
? theme.current.colors['core-outline-primary']
|
|
139
|
+
: theme.current.colors['feedback-warning'],
|
|
140
|
+
'--cursor-background': enabled
|
|
141
|
+
? theme.current.colors['core-icon-primary']
|
|
142
|
+
: theme.current.colors['feedback-warning'],
|
|
143
|
+
'--cursor-border-radius': enabled ? '100px' : '2px',
|
|
144
|
+
'--cursor-animation': enabled ? 'blink 2s infinite' : 'none',
|
|
145
|
+
}), [theme.current.colors]);
|
|
146
|
+
const renderedUserList = React.useMemo(() => userList.map((user, index) => {
|
|
147
|
+
if (user.id === presenceID)
|
|
148
|
+
return null;
|
|
149
|
+
if (!user.promptContent || user.promptContent === '')
|
|
150
|
+
return null;
|
|
151
|
+
const enabled = user.promptState !== PrompState.Disabled;
|
|
152
|
+
const cssVars = getCssVars(enabled);
|
|
153
|
+
return (jsxRuntime.jsxs("div", { className: css$1.userPrompt, onClick: (e) => e.stopPropagation(), onKeyDown: (e) => e.stopPropagation(), children: [jsxRuntime.jsx("div", { className: css$1.avatar, children: jsxRuntime.jsx(Avatar.Avatar, { size: 20, first: user.first, last: user.last, image: user.avatar, bgColor: user.bgColor, color: user.color, border: 0 }) }), jsxRuntime.jsx("div", { className: css$1.prompt, children: jsxRuntime.jsxs("p", { className: css$1.promptParagraph, children: [jsxRuntime.jsxs("strong", { className: css$1.promptStrong, children: [user.first, ":"] }), ' ', user.promptContent] }) }), currentUser === owner &&
|
|
154
|
+
currentUser !== user.email &&
|
|
155
|
+
user.promptContent !== '' && (jsxRuntime.jsx("div", { className: css$1.control, style: cssVars, role: 'button', "aria-label": 'Stop/Play', onKeyDown: () => handleTogglePrompt(user), onClick: () => handleTogglePrompt(user), tabIndex: 0, children: jsxRuntime.jsx("span", { className: css$1.cursor }) }))] }, `${user.email}-${index}`));
|
|
156
|
+
}), [userList, presenceID, currentUser, owner, getCssVars, handleTogglePrompt]);
|
|
157
|
+
return jsxRuntime.jsx("div", { className: css$1.promptList, children: renderedUserList });
|
|
158
|
+
}
|
|
159
|
+
const UserList = React.memo(UserListComponent);
|
|
160
|
+
|
|
161
|
+
var PromptType;
|
|
162
|
+
(function (PromptType) {
|
|
163
|
+
PromptType[PromptType["none"] = -1] = "none";
|
|
164
|
+
PromptType[PromptType["text"] = 0] = "text";
|
|
165
|
+
PromptType[PromptType["expand"] = 1] = "expand";
|
|
166
|
+
PromptType[PromptType["summarize"] = 2] = "summarize";
|
|
167
|
+
PromptType[PromptType["research"] = 3] = "research";
|
|
168
|
+
PromptType[PromptType["translate"] = 4] = "translate";
|
|
169
|
+
PromptType[PromptType["shorten"] = 5] = "shorten";
|
|
170
|
+
PromptType[PromptType["file"] = 6] = "file";
|
|
171
|
+
PromptType[PromptType["compliance"] = 7] = "compliance";
|
|
172
|
+
})(PromptType || (PromptType = {}));
|
|
173
|
+
var Role;
|
|
174
|
+
(function (Role) {
|
|
175
|
+
Role["USER"] = "user";
|
|
176
|
+
Role["ASSISTANT"] = "assistant";
|
|
177
|
+
Role["TOOL"] = "tool";
|
|
178
|
+
Role["SYSTEM"] = "system";
|
|
179
|
+
})(Role || (Role = {}));
|
|
180
|
+
|
|
181
|
+
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.MessageInput-module_wrapper__CDukE {\n\talign-self: center;\n\twidth: 100%;\n\tmin-width: 300px;\n\toverflow: visible;\n\toverflow-y: hidden;\n\tpadding: var(--wrapper-padding);\n\tborder-radius: 16px;\n\tbackground: var(--core-surface-primary);\n\tbox-shadow: var(--wrapper-shadow);\n\toutline: none;\n\ttransition: all 0.3s ease-in-out 0s;\n}\n\n.MessageInput-module_wrapper__CDukE.MessageInput-module_focused__DTxPV {\n\tbox-shadow: var(--wrapper-shadow-focused);\n}\n\n.MessageInput-module_textarea__p5ot8 {\n\twidth: 100%;\n\toverflow-y: hidden;\n\tresize: none;\n\tborder: 0;\n\toutline: none;\n\tcolor: var(--core-text-primary);\n\tbackground: transparent;\n\tpadding: 0 0 5px;\n}\n\n.MessageInput-module_textarea__p5ot8::placeholder {\n\tcolor: var(--core-text-disabled);\n}\n\n.MessageInput-module_buttonRow__cbSNm {\n\twidth: 100%;\n\tpadding: 0;\n}\n\n.MessageInput-module_actionButtons__mtfoV {\n\tcolor: var(--core-text-disabled);\n\tz-index: 1;\n\tgap: 12px;\n}\n\n.MessageInput-module_send__UksvP {\n\tposition: relative;\n}\n\n.MessageInput-module_inputWrapper__sB-l0 {\n\talign-items: flex-end;\n\twidth: 100%;\n\tpadding: var(--input-wrapper-padding);\n}\n";
|
|
182
|
+
var css = {"wrapper":"MessageInput-module_wrapper__CDukE flexBox-module_columnEnd__u2nwI","textarea":"MessageInput-module_textarea__p5ot8 type-module_body-m-regular__Qtp5G","buttonRow":"MessageInput-module_buttonRow__cbSNm flexBox-module_rowBetween__27lKK","actionButtons":"MessageInput-module_actionButtons__mtfoV flexBox-module_row__PWxbe type-module_body-m-regular__Qtp5G","send":"MessageInput-module_send__UksvP flexBox-module_row__PWxbe","inputWrapper":"MessageInput-module_inputWrapper__sB-l0 flexBox-module_columnEnd__u2nwI"};
|
|
183
|
+
styleInject_es.styleInject(css_248z);
|
|
184
|
+
|
|
185
|
+
function MessageInput(props) {
|
|
186
|
+
var _a, _b, _c, _d;
|
|
187
|
+
const { maxHeight = 300, focused = false, error = null, value = '', placeholder = 'Ask me anytning HR compliance', isStreaming = false, isFetching = false, isShort = true, jurisdiction = null, files = [], excerpts = [], users = [], currentUser, presenceID, owner, jurisdictionClick = () => null, attachClick = () => null, onChangeFiles = () => null, onChangeExcerpts = () => null, onTogglePrompt = () => null, onChange = () => null, onBlur = () => null, onFocus = () => null, onStop = () => null, onSend = () => null, onToolTip = () => null } = props, divAttributes = tslib_es6.__rest(props, ["maxHeight", "focused", "error", "value", "placeholder", "isStreaming", "isFetching", "isShort", "jurisdiction", "files", "excerpts", "users", "currentUser", "presenceID", "owner", "jurisdictionClick", "attachClick", "onChangeFiles", "onChangeExcerpts", "onTogglePrompt", "onChange", "onBlur", "onFocus", "onStop", "onSend", "onToolTip"]);
|
|
188
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
189
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
190
|
+
const divClass = className ? ` ${className}` : '';
|
|
191
|
+
const theme = hooks_useTheme.useTheme();
|
|
192
|
+
const ref = React.useRef(null);
|
|
193
|
+
const wrapperRef = React.useRef(null);
|
|
194
|
+
const [message, setMessage] = React.useState(value);
|
|
195
|
+
const [isFocused, setIsFocused] = React.useState(focused);
|
|
196
|
+
const [promptType, setPromptType] = React.useState(PromptType.text);
|
|
197
|
+
const [invalid, setInvalid] = React.useState(error);
|
|
198
|
+
const [remoteDisabled, setRemoteDisabled] = React.useState(false);
|
|
199
|
+
// reset size if the wrapper size changes
|
|
200
|
+
React.useEffect(() => {
|
|
201
|
+
if (ref === null || ref === void 0 ? void 0 : ref.current) {
|
|
202
|
+
ref.current.style.height = '0px';
|
|
203
|
+
ref.current.style.height = `${Math.min(ref.current.scrollHeight, maxHeight)}px`;
|
|
204
|
+
}
|
|
205
|
+
}, [maxHeight]);
|
|
206
|
+
// reset the message text of the active document is changed
|
|
207
|
+
React.useEffect(() => setMessage(value), [value]);
|
|
208
|
+
// enable setting focus byt changing the focus prop
|
|
209
|
+
React.useEffect(() => {
|
|
210
|
+
if (ref === null || ref === void 0 ? void 0 : ref.current) {
|
|
211
|
+
if (focused)
|
|
212
|
+
ref.current.focus();
|
|
213
|
+
else
|
|
214
|
+
ref.current.blur();
|
|
215
|
+
setIsFocused(focused);
|
|
216
|
+
}
|
|
217
|
+
}, [focused]);
|
|
218
|
+
// disabled prompt if remote owner disabled the user
|
|
219
|
+
React.useEffect(() => {
|
|
220
|
+
if (users.length > 0) {
|
|
221
|
+
const myPresensce = users.filter((user) => {
|
|
222
|
+
return user.email === currentUser;
|
|
223
|
+
});
|
|
224
|
+
if (myPresensce && myPresensce.length > 0) {
|
|
225
|
+
setRemoteDisabled(myPresensce[0].promptState === PrompState.Disabled);
|
|
226
|
+
}
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
setRemoteDisabled(false);
|
|
230
|
+
}, [users, currentUser]);
|
|
231
|
+
// update error is prop changes
|
|
232
|
+
React.useEffect(() => setInvalid(error), [error]);
|
|
233
|
+
const resetHeight = React.useCallback(() => {
|
|
234
|
+
if (ref === null || ref === void 0 ? void 0 : ref.current) {
|
|
235
|
+
ref.current.style.height = '0px';
|
|
236
|
+
ref.current.style.height = `${Math.min(ref.current.scrollHeight, maxHeight)}px`;
|
|
237
|
+
}
|
|
238
|
+
}, [maxHeight]);
|
|
239
|
+
const doSubmit = React.useCallback((e) => {
|
|
240
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
241
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
242
|
+
onToolTip(null);
|
|
243
|
+
if (message !== '' && ref.current) {
|
|
244
|
+
const newMessage = {
|
|
245
|
+
id: crypto.randomUUID(),
|
|
246
|
+
content: message,
|
|
247
|
+
timestamp: new Date().toISOString(),
|
|
248
|
+
promptType,
|
|
249
|
+
role: Role.USER,
|
|
250
|
+
htmlContent: '',
|
|
251
|
+
files,
|
|
252
|
+
excerpts,
|
|
253
|
+
done: false,
|
|
254
|
+
};
|
|
255
|
+
onSend(newMessage);
|
|
256
|
+
setMessage('');
|
|
257
|
+
onChange('');
|
|
258
|
+
resetHeight();
|
|
259
|
+
setIsFocused(false);
|
|
260
|
+
ref.current.blur();
|
|
261
|
+
ref.current.value = '';
|
|
262
|
+
}
|
|
263
|
+
}, [
|
|
264
|
+
message,
|
|
265
|
+
promptType,
|
|
266
|
+
files,
|
|
267
|
+
excerpts,
|
|
268
|
+
onSend,
|
|
269
|
+
onChange,
|
|
270
|
+
resetHeight,
|
|
271
|
+
onToolTip,
|
|
272
|
+
]);
|
|
273
|
+
const handleKeyDown = React.useCallback((e) => {
|
|
274
|
+
if (!e.shiftKey && e.key === 'Enter' && message !== '')
|
|
275
|
+
doSubmit(e);
|
|
276
|
+
else
|
|
277
|
+
return;
|
|
278
|
+
}, [message, doSubmit]);
|
|
279
|
+
const setFocus = React.useCallback(() => {
|
|
280
|
+
if (ref === null || ref === void 0 ? void 0 : ref.current) {
|
|
281
|
+
ref.current.focus();
|
|
282
|
+
setIsFocused(true);
|
|
283
|
+
onFocus();
|
|
284
|
+
}
|
|
285
|
+
}, [onFocus]);
|
|
286
|
+
const setBlur = React.useCallback(() => {
|
|
287
|
+
if (ref === null || ref === void 0 ? void 0 : ref.current) {
|
|
288
|
+
ref.current.blur();
|
|
289
|
+
setIsFocused(false);
|
|
290
|
+
onBlur();
|
|
291
|
+
}
|
|
292
|
+
}, [onBlur]);
|
|
293
|
+
const setDisabled = React.useCallback(() => {
|
|
294
|
+
if (remoteDisabled)
|
|
295
|
+
return 'disabled';
|
|
296
|
+
if (isStreaming)
|
|
297
|
+
return 'normal';
|
|
298
|
+
if (!isStreaming && files.length > 0)
|
|
299
|
+
return 'normal';
|
|
300
|
+
if (invalid && invalid !== '')
|
|
301
|
+
return 'disabled';
|
|
302
|
+
if (!isStreaming && isFetching)
|
|
303
|
+
return 'disabled';
|
|
304
|
+
if (!isStreaming && message === '')
|
|
305
|
+
return 'disabled';
|
|
306
|
+
return 'normal';
|
|
307
|
+
}, [remoteDisabled, isStreaming, files.length, invalid, isFetching, message]);
|
|
308
|
+
const iconColor = React.useCallback(() => {
|
|
309
|
+
var _a, _b, _c, _d;
|
|
310
|
+
if (isFetching || isStreaming) {
|
|
311
|
+
if (theme.current.name === 'lightMode')
|
|
312
|
+
return (_a = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _a === void 0 ? void 0 : _a['core-text-light'];
|
|
313
|
+
return (_b = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _b === void 0 ? void 0 : _b['core-surface-primary'];
|
|
314
|
+
}
|
|
315
|
+
if (message === '') {
|
|
316
|
+
return (_c = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _c === void 0 ? void 0 : _c['core-surface-secondary'];
|
|
317
|
+
}
|
|
318
|
+
return (_d = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _d === void 0 ? void 0 : _d['core-text-light'];
|
|
319
|
+
}, [
|
|
320
|
+
isFetching,
|
|
321
|
+
isStreaming,
|
|
322
|
+
theme.current.name,
|
|
323
|
+
theme === null || theme === void 0 ? void 0 : theme.current.colors,
|
|
324
|
+
message,
|
|
325
|
+
]);
|
|
326
|
+
const handleUpload = React.useCallback((e, type) => {
|
|
327
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
328
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
329
|
+
setPromptType(type);
|
|
330
|
+
attachClick(e);
|
|
331
|
+
}, [attachClick]);
|
|
332
|
+
const handleChange = React.useCallback((input) => {
|
|
333
|
+
if (message !== input)
|
|
334
|
+
onChange(input);
|
|
335
|
+
setMessage(input);
|
|
336
|
+
}, [message, onChange]);
|
|
337
|
+
const handleStop = React.useCallback((e) => {
|
|
338
|
+
e === null || e === void 0 ? void 0 : e.preventDefault();
|
|
339
|
+
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
340
|
+
onToolTip(null);
|
|
341
|
+
setBlur();
|
|
342
|
+
onStop();
|
|
343
|
+
}, [onToolTip, setBlur, onStop]);
|
|
344
|
+
const working = React.useCallback(() => {
|
|
345
|
+
if (isStreaming)
|
|
346
|
+
return false;
|
|
347
|
+
if (isFetching)
|
|
348
|
+
return true;
|
|
349
|
+
return false;
|
|
350
|
+
}, [isStreaming, isFetching]);
|
|
351
|
+
const toolTip = React.useCallback(() => {
|
|
352
|
+
if (isStreaming)
|
|
353
|
+
return 'Stop';
|
|
354
|
+
if (isFetching)
|
|
355
|
+
return 'Working ...';
|
|
356
|
+
return 'Send';
|
|
357
|
+
}, [isStreaming, isFetching]);
|
|
358
|
+
const setJurisdiction = React.useCallback(() => {
|
|
359
|
+
const country = jurisdiction === null || jurisdiction === void 0 ? void 0 : jurisdiction.country;
|
|
360
|
+
const state = jurisdiction === null || jurisdiction === void 0 ? void 0 : jurisdiction.state;
|
|
361
|
+
if (!country || country === 'None')
|
|
362
|
+
return 'None';
|
|
363
|
+
if (state !== 'None')
|
|
364
|
+
return state;
|
|
365
|
+
return country;
|
|
366
|
+
}, [jurisdiction === null || jurisdiction === void 0 ? void 0 : jurisdiction.country, jurisdiction === null || jurisdiction === void 0 ? void 0 : jurisdiction.state]);
|
|
367
|
+
// memo css vars
|
|
368
|
+
const cssVars = React.useMemo(() => {
|
|
369
|
+
const shadowValue = isShort ? 0 : 1;
|
|
370
|
+
return {
|
|
371
|
+
'--wrapper-padding': isShort
|
|
372
|
+
? '16px 12px 8px 16px'
|
|
373
|
+
: '16px 12px 16px 16px',
|
|
374
|
+
'--wrapper-shadow': `0 0 1px ${shadowValue}px transparent`,
|
|
375
|
+
// biome-ignore lint/style/noUnusedTemplateLiteral: <explanation>
|
|
376
|
+
'--wrapper-shadow-focused': `0 0 1px 2px var(--core-outline-special)`,
|
|
377
|
+
'--input-wrapper-padding': isShort
|
|
378
|
+
? '4px 4px 0px 4px'
|
|
379
|
+
: '4px 4px 16px 4px',
|
|
380
|
+
};
|
|
381
|
+
}, [isShort]);
|
|
382
|
+
const wrapperClassName = [css.wrapper, isFocused ? 'focused' : '']
|
|
383
|
+
.filter(Boolean)
|
|
384
|
+
.join(' ');
|
|
385
|
+
return (jsxRuntime.jsxs("div", Object.assign({ id: divId, className: `${wrapperClassName}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), onKeyDown: () => null, onClick: () => {
|
|
386
|
+
if (!isFocused)
|
|
387
|
+
setFocus();
|
|
388
|
+
}, ref: wrapperRef }, rest, { children: [jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: excerpts.length > 0 && (jsxRuntime.jsx(ExcerptList, { excerpts: excerpts, onChange: (excerpts) => onChangeExcerpts(excerpts), onToolTip: (tip) => onToolTip(tip) })) }), jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: files.length > 0 && (jsxRuntime.jsx(FileList, { files: files, onChange: (items) => onChangeFiles(items), onToolTip: (tip) => onToolTip(tip) })) }), jsxRuntime.jsx("div", { className: css.inputWrapper, style: cssVars, children: jsxRuntime.jsx("textarea", { id: 'messageInput', name: 'messageInput', className: css.textarea, ref: ref, value: message, onChange: ({ target }) => handleChange(target.value), onInput: () => resetHeight(), onKeyDown: (e) => handleKeyDown(e), placeholder: placeholder, disabled: isStreaming, onFocus: () => setFocus(), onBlur: () => setBlur(), rows: 1 }) }), jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: users.length > 0 && (jsxRuntime.jsx(UserList, { userPresence: users, owner: owner, currentUser: currentUser, presenceID: presenceID, onTogglePrompt: (presence) => onTogglePrompt(presence), onToolTip: (tip) => onToolTip(tip) })) }), jsxRuntime.jsxs("div", { className: css.buttonRow, children: [jsxRuntime.jsxs("div", { className: css.actionButtons, children: [jsxRuntime.jsx(UIButton.UIButton, { variant: 'outline', iconLeft: 'plus', tooltip: 'Attach file', onClick: (e) => handleUpload(e, PromptType.file), size: 'medium', iconColor: theme.current.colors['core-icon-primary'], round: true, onToolTip: (tip) => onToolTip(tip) }), jsxRuntime.jsx(UIButton.UIButton, { paddingRight: 18, paddingLeft: 8, variant: 'outline', label: `Focus: ${setJurisdiction()}`, tooltip: 'Jurisdication Focus', onClick: (_e) => jurisdictionClick(), iconLeft: 'focus', size: 'medium', iconColor: theme.current.colors['core-icon-primary'], labelColor: (_a = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _a === void 0 ? void 0 : _a['core-text-secondary'], onToolTip: (tip) => onToolTip(tip) })] }), jsxRuntime.jsx("div", { className: css.send, children: jsxRuntime.jsx(UIButton.UIButton, { variant: 'solid', iconLeft: isStreaming ? 'stop' : 'arrow up', bgColorDisabled: (_b = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _b === void 0 ? void 0 : _b['core-badge-secondary'], bgColor: isFetching || isStreaming
|
|
389
|
+
? (_c = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _c === void 0 ? void 0 : _c['core-text-primary']
|
|
390
|
+
: (_d = theme === null || theme === void 0 ? void 0 : theme.current.colors) === null || _d === void 0 ? void 0 : _d['core-button-primary'], iconColor: iconColor(), state: setDisabled(), size: 'medium', progress: true, working: working(), round: true, onClick: (e) => {
|
|
391
|
+
if (isStreaming)
|
|
392
|
+
handleStop(e);
|
|
393
|
+
if (isFetching)
|
|
394
|
+
return;
|
|
395
|
+
doSubmit(e);
|
|
396
|
+
}, tooltip: toolTip(), onToolTip: (tip) => onToolTip(tip) }) })] })] })));
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
exports.MessageInput = MessageInput;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var react = require('motion/react');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
8
|
+
|
|
9
|
+
var css_248z = ".Overlay-module_overlay__QJZO- {\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\tright: 0;\n\tbottom: 0;\n\tbackground-color: var(--overlay-color);\n\tz-index: 500;\n}\n";
|
|
10
|
+
var css = {"overlay":"Overlay-module_overlay__QJZO-"};
|
|
11
|
+
styleInject_es.styleInject(css_248z);
|
|
12
|
+
|
|
13
|
+
const Overlay = React.memo((props) => {
|
|
14
|
+
const { onClick = () => null, toggleOverlay = () => null, opacity = 0, color = 'rgb(0,0,0)', type = 'clear', global = false, overlay } = props, divAttributes = tslib_es6.__rest(props, ["onClick", "toggleOverlay", "opacity", "color", "type", "global", "overlay"]);
|
|
15
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
16
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
17
|
+
const divClass = className ? ` ${className}` : '';
|
|
18
|
+
const show = !global || (global && overlay);
|
|
19
|
+
// Memoize computed opacity value
|
|
20
|
+
const computedOpacity = React.useMemo(() => {
|
|
21
|
+
if (type === 'clear')
|
|
22
|
+
return 0;
|
|
23
|
+
if (opacity !== undefined)
|
|
24
|
+
return opacity;
|
|
25
|
+
if (type === 'dark')
|
|
26
|
+
return 0.8;
|
|
27
|
+
return 0;
|
|
28
|
+
}, [type, opacity]);
|
|
29
|
+
const handleClick = React.useCallback(() => {
|
|
30
|
+
if (global)
|
|
31
|
+
toggleOverlay(false);
|
|
32
|
+
onClick();
|
|
33
|
+
}, [global, toggleOverlay, onClick]);
|
|
34
|
+
const handleContextMenu = React.useCallback((e) => {
|
|
35
|
+
e.preventDefault();
|
|
36
|
+
}, []);
|
|
37
|
+
const cssVars = React.useMemo(() => {
|
|
38
|
+
return {
|
|
39
|
+
'--overlay-color': color !== null && color !== void 0 ? color : 'rgb(0,0,0)',
|
|
40
|
+
};
|
|
41
|
+
}, [color]);
|
|
42
|
+
return (jsxRuntime.jsx(react.AnimatePresence, { initial: false, children: show && (jsxRuntime.jsx(react.motion.div, Object.assign({ id: divId, className: `${css.overlay}${divClass}`, style: Object.assign(Object.assign({}, divStyle), cssVars), initial: { opacity: 0 }, animate: { opacity: computedOpacity }, exit: { opacity: 0 }, onClick: handleClick, onContextMenu: handleContextMenu }, rest))) }));
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
exports.Overlay = Overlay;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-4H29ixHs.js');
|
|
4
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var utils = require('./utils-CbayehuI.js');
|
|
7
|
+
var styleInject_es = require('./style-inject.es-XZHJH68X.js');
|
|
8
|
+
|
|
9
|
+
var css_248z = ".flexBox-module_row__PWxbe {\n\tdisplay: flex;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowBetween__27lKK {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowStart__nJZnW {\n\tdisplay: flex;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_rowEnd__dHcOU {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_column__MP2Xd {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: center;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStart__Kg8cV {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: flex-start;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnStartCenter__zcmtk {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-start;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnBetween__157yI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\talign-items: center;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}.flexBox-module_columnEnd__u2nwI {\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: flex-end;\n\talign-items: flex-end;\n\tbox-sizing: border-box;\n\tpadding: 0;\n\tmargin: 0;\n}\n\n.Pager-module_wrapper__L8AZG {\n\tgap: var(--pager-gap);\n\twidth: 100%;\n}\n\n.Pager-module_bullet__tj-vE {\n\twidth: var(--pager-size);\n\theight: var(--pager-size);\n\tmax-width: var(--pager-size);\n\tmax-height: var(--pager-size);\n\tbackground: var(--pager-color);\n\tborder-radius: 100%;\n\tborder: 0;\n\tcursor: pointer;\n\ttransition: background 0.25s ease-in-out 0s;\n\t&:hover {\n\t\tbackground: var(--pager-colorHover);\n\t}\n}\n\n.Pager-module_selected__EdNnR {\n\tbackground: var(--pager-colorOn);\n\t&:hover {\n\t\tbackground: var(--pager-colorOn);\n\t}\n}\n";
|
|
10
|
+
var css = {"wrapper":"Pager-module_wrapper__L8AZG flexBox-module_row__PWxbe","bullet":"Pager-module_bullet__tj-vE flexBox-module_row__PWxbe","selected":"Pager-module_selected__EdNnR"};
|
|
11
|
+
styleInject_es.styleInject(css_248z);
|
|
12
|
+
|
|
13
|
+
const Pager = React.memo((props) => {
|
|
14
|
+
const { size = 8, index = 0, color = undefined, colorHover = undefined, colorOn = undefined, pages = 2, gap = 4, onChange = () => null } = props, divAttributes = tslib_es6.__rest(props, ["size", "index", "color", "colorHover", "colorOn", "pages", "gap", "onChange"]);
|
|
15
|
+
const { id: divId, className, style } = divAttributes, rest = tslib_es6.__rest(divAttributes, ["id", "className", "style"]);
|
|
16
|
+
const divStyle = style !== null && style !== void 0 ? style : {};
|
|
17
|
+
const divClass = className ? ` ${className}` : '';
|
|
18
|
+
const [selected, setSelected] = React.useState(index);
|
|
19
|
+
const bullets = React.useMemo(() => {
|
|
20
|
+
return Array.from({ length: pages }, (_, i) => i);
|
|
21
|
+
}, [pages]);
|
|
22
|
+
React.useEffect(() => setSelected(index), [index]);
|
|
23
|
+
const handleClick = React.useCallback((i) => {
|
|
24
|
+
setSelected(i);
|
|
25
|
+
onChange(i);
|
|
26
|
+
}, [onChange]);
|
|
27
|
+
// memo css vars
|
|
28
|
+
const cssVars = React.useMemo(() => {
|
|
29
|
+
return {
|
|
30
|
+
'--pager-gap': `${gap}px`,
|
|
31
|
+
'--pager-size': `${size}px`,
|
|
32
|
+
'--pager-color': color !== null && color !== void 0 ? color : 'var(--core-text-disabled)',
|
|
33
|
+
'--pager-colorOn': colorOn !== null && colorOn !== void 0 ? colorOn : 'var(--core-text-primary)',
|
|
34
|
+
'--pager-colorHover': colorHover !== null && colorHover !== void 0 ? colorHover : 'var(--core-text-disabled)',
|
|
35
|
+
};
|
|
36
|
+
}, [gap, size, color, colorOn, colorHover]);
|
|
37
|
+
return (jsxRuntime.jsx("div", Object.assign({ id: divId, style: Object.assign(Object.assign({}, divStyle), cssVars), className: `${css.wrapper}${divClass}` }, rest, { children: bullets.map((bulletId) => {
|
|
38
|
+
return (jsxRuntime.jsx("input", { className: `${css.bullet} ${selected === bulletId ? css.selected : ''}`, type: 'button', onClick: () => handleClick(bulletId), onKeyDown: (e) => utils.accessibleKeyDown(e, () => handleClick(bulletId)), onTouchStart: () => handleClick(bulletId), tabIndex: bulletId }, `paging_bullet_${bulletId}`));
|
|
39
|
+
}) })));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
exports.Pager = Pager;
|