tfy-web-components 0.0.34 → 0.0.35
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 +49 -58
- package/dist/Button-C77b7jpW.js +284 -0
- package/dist/Button-C77b7jpW.js.map +1 -0
- package/dist/CompositeItem-BGwD51jI.js +33 -0
- package/dist/CompositeItem-BGwD51jI.js.map +1 -0
- package/dist/CompositeList-D4xmSZ5V.js +291 -0
- package/dist/CompositeList-D4xmSZ5V.js.map +1 -0
- package/dist/CompositeRoot-BxrPc7F6.js +351 -0
- package/dist/CompositeRoot-BxrPc7F6.js.map +1 -0
- package/dist/DirectionContext-Pb9yafF5.js +11 -0
- package/dist/DirectionContext-Pb9yafF5.js.map +1 -0
- package/dist/FieldItemContext-DRVgx-D1.js +13 -0
- package/dist/FieldItemContext-DRVgx-D1.js.map +1 -0
- package/dist/{Input-BvwIpntS.js → Input-Dhmo6L2n.js} +100 -78
- package/dist/Input-Dhmo6L2n.js.map +1 -0
- package/dist/Modal-C4MUy9GD.js +696 -0
- package/dist/Modal-C4MUy9GD.js.map +1 -0
- package/dist/{MonacoEditorCore-xfpJ6z-E.js → MonacoEditorCore-n-df5f7I.js} +2 -2
- package/dist/{MonacoEditorCore-xfpJ6z-E.js.map → MonacoEditorCore-n-df5f7I.js.map} +1 -1
- package/dist/Popover-eC_vX5By.js +1074 -0
- package/dist/Popover-eC_vX5By.js.map +1 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js +11 -0
- package/dist/ToolbarRootContext-B_HxjkNI.js.map +1 -0
- package/dist/Tooltip-BuGLP-PU.js +4096 -0
- package/dist/Tooltip-BuGLP-PU.js.map +1 -0
- package/dist/classNames-B1XpQHle.js +44 -0
- package/dist/classNames-B1XpQHle.js.map +1 -0
- package/dist/components/atoms/Accordion.d.ts +19 -37
- package/dist/components/atoms/Accordion.es.js +847 -78
- package/dist/components/atoms/Accordion.es.js.map +1 -1
- package/dist/components/atoms/AudioPlayer.es.js +9 -9
- package/dist/components/atoms/AudioPlayer.es.js.map +1 -1
- package/dist/components/atoms/Avatar.d.ts +42 -9
- package/dist/components/atoms/Avatar.es.js +491 -36
- package/dist/components/atoms/Avatar.es.js.map +1 -1
- package/dist/components/atoms/Badge.d.ts +40 -35
- package/dist/components/atoms/Badge.es.js +163 -53
- package/dist/components/atoms/Badge.es.js.map +1 -1
- package/dist/components/atoms/Button.d.ts +37 -16
- package/dist/components/atoms/Button.es.js +16 -221
- package/dist/components/atoms/Button.es.js.map +1 -1
- package/dist/components/atoms/ButtonGroup.d.ts +53 -0
- package/dist/components/atoms/ButtonGroup.es.js +349 -0
- package/dist/components/atoms/ButtonGroup.es.js.map +1 -0
- package/dist/components/atoms/IconButton.d.ts +23 -9
- package/dist/components/atoms/IconButton.es.js +82 -16
- package/dist/components/atoms/IconButton.es.js.map +1 -1
- package/dist/components/atoms/IconProvider.d.ts +1 -1
- package/dist/components/atoms/IconProvider.es.js +48 -7
- package/dist/components/atoms/IconProvider.es.js.map +1 -1
- package/dist/components/atoms/Modal.d.ts +27 -3
- package/dist/components/atoms/Modal.es.js +15 -16
- package/dist/components/atoms/Modal.es.js.map +1 -1
- package/dist/components/atoms/Notification.d.ts +1 -1
- package/dist/components/atoms/Notification.es.js +26 -3
- package/dist/components/atoms/Notification.es.js.map +1 -1
- package/dist/components/atoms/OutlinedRadio.d.ts +6 -2
- package/dist/components/atoms/OutlinedRadio.es.js +12 -25
- package/dist/components/atoms/OutlinedRadio.es.js.map +1 -1
- package/dist/components/atoms/Progress.d.ts +48 -0
- package/dist/components/atoms/Progress.es.js +279 -0
- package/dist/components/atoms/Progress.es.js.map +1 -0
- package/dist/components/atoms/Skeleton.d.ts +9 -3
- package/dist/components/atoms/Skeleton.es.js +33 -3
- package/dist/components/atoms/Skeleton.es.js.map +1 -1
- package/dist/components/atoms/Spinner.d.ts +15 -4
- package/dist/components/atoms/Spinner.es.js +86 -22
- package/dist/components/atoms/Spinner.es.js.map +1 -1
- package/dist/components/atoms/Switch.d.ts +19 -7
- package/dist/components/atoms/Switch.es.js +288 -50
- package/dist/components/atoms/Switch.es.js.map +1 -1
- package/dist/components/atoms/TabButton.d.ts +17 -3
- package/dist/components/atoms/TabButton.es.js +647 -25
- package/dist/components/atoms/TabButton.es.js.map +1 -1
- package/dist/components/atoms/TabPanel.es.js +1 -1
- package/dist/components/atoms/Tag.d.ts +43 -0
- package/dist/components/atoms/Tag.es.js +219 -0
- package/dist/components/atoms/Tag.es.js.map +1 -0
- package/dist/components/atoms/Tooltip.d.ts +36 -14
- package/dist/components/atoms/Tooltip.es.js +7 -114
- package/dist/components/atoms/Tooltip.es.js.map +1 -1
- package/dist/components/molecules/Alert.d.ts +1 -1
- package/dist/components/molecules/Alert.es.js +13 -9
- package/dist/components/molecules/Alert.es.js.map +1 -1
- package/dist/components/molecules/CopyField.d.ts +2 -2
- package/dist/components/molecules/CopyField.es.js +3 -4
- package/dist/components/molecules/CopyField.es.js.map +1 -1
- package/dist/components/molecules/CustomDrawer.d.ts +5 -4
- package/dist/components/molecules/CustomDrawer.es.js +141 -82
- package/dist/components/molecules/CustomDrawer.es.js.map +1 -1
- package/dist/components/molecules/Dialog.d.ts +16 -8
- package/dist/components/molecules/Dialog.es.js +33 -31
- package/dist/components/molecules/Dialog.es.js.map +1 -1
- package/dist/components/molecules/ImagesPreview.es.js +15 -11
- package/dist/components/molecules/ImagesPreview.es.js.map +1 -1
- package/dist/components/molecules/Input.d.ts +1 -1
- package/dist/components/molecules/Input.es.js +3 -5
- package/dist/components/molecules/Input.es.js.map +1 -1
- package/dist/components/molecules/Markdown/ExpandableMarkdown.d.ts +8 -8
- package/dist/components/molecules/Markdown/components.d.ts +12 -11
- package/dist/components/molecules/Markdown.es.js +26 -49
- package/dist/components/molecules/Markdown.es.js.map +1 -1
- package/dist/components/molecules/Notify.d.ts +30 -1
- package/dist/components/molecules/Notify.es.js +91 -36
- package/dist/components/molecules/Notify.es.js.map +1 -1
- package/dist/components/molecules/SimpleCodeEditor.es.js +32 -19
- package/dist/components/molecules/SimpleCodeEditor.es.js.map +1 -1
- package/dist/components/molecules/ToggleButton.d.ts +3 -2
- package/dist/components/molecules/ToggleButton.es.js +155 -57
- package/dist/components/molecules/ToggleButton.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessage.es.js +2 -2
- package/dist/components/molecules/agent-chat/UserMessage.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js +5 -5
- package/dist/components/molecules/agent-chat/UserMessageEdit.es.js.map +1 -1
- package/dist/components/molecules/agent-chat/index.d.ts +0 -6
- package/dist/components/molecules/agent-chat.es.js +76 -407
- package/dist/components/molecules/agent-chat.es.js.map +1 -1
- package/dist/components/molecules/monacoEditorCore/MonacoEditorCore.d.ts +0 -1
- package/dist/components/theme/colors.d.ts +17 -53
- package/dist/components/theme/colors.es.js +384 -180
- package/dist/components/theme/colors.es.js.map +1 -1
- package/dist/components/theme/theme.d.ts +14 -11
- package/dist/components/theme/theme.es.js +3 -64
- package/dist/components/theme/theme.es.js.map +1 -1
- package/dist/components/theme/useTheme.es.js +1 -4
- package/dist/components/theme/useTheme.es.js.map +1 -1
- package/dist/composite-CrCQWAKA.js +108 -0
- package/dist/composite-CrCQWAKA.js.map +1 -0
- package/dist/composite-DCpXNxz9.js +66 -0
- package/dist/composite-DCpXNxz9.js.map +1 -0
- package/dist/conversions-CbWPvHRE.js +14 -0
- package/dist/conversions-CbWPvHRE.js.map +1 -0
- package/dist/error-FX4R42W-.js +6 -0
- package/dist/error-FX4R42W-.js.map +1 -0
- package/dist/fonts.css +7 -0
- package/dist/hooks/useContainerDimensions.d.ts +1 -1
- package/dist/index-B806bfA-.js +257 -0
- package/dist/index-B806bfA-.js.map +1 -0
- package/dist/index-DSVg79g-.js +45 -0
- package/dist/index-DSVg79g-.js.map +1 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.es.js +56 -9
- package/dist/index.es.js.map +1 -1
- package/dist/inertValue-IJM5NA30.js +11 -0
- package/dist/inertValue-IJM5NA30.js.map +1 -0
- package/dist/lib/utils.d.ts +1 -0
- package/dist/markdown.css +13 -14
- package/dist/new-components/atoms/Checkbox.d.ts +6 -0
- package/dist/new-components/atoms/Checkbox.es.js +423 -0
- package/dist/new-components/atoms/Checkbox.es.js.map +1 -0
- package/dist/new-components/atoms/Chip.d.ts +38 -0
- package/dist/new-components/atoms/Chip.es.js +269 -0
- package/dist/new-components/atoms/Chip.es.js.map +1 -0
- package/dist/new-components/atoms/Popover.d.ts +87 -0
- package/dist/new-components/atoms/Popover.es.js +21 -0
- package/dist/new-components/atoms/Popover.es.js.map +1 -0
- package/dist/new-components/atoms/Radio.d.ts +14 -0
- package/dist/new-components/atoms/Radio.es.js +536 -0
- package/dist/new-components/atoms/Radio.es.js.map +1 -0
- package/dist/new-components/atoms/SegmentedControl.d.ts +28 -0
- package/dist/new-components/atoms/SegmentedControl.es.js +326 -0
- package/dist/new-components/atoms/SegmentedControl.es.js.map +1 -0
- package/dist/new-components/atoms/Slider.d.ts +8 -0
- package/dist/new-components/atoms/Slider.es.js +1415 -0
- package/dist/new-components/atoms/Slider.es.js.map +1 -0
- package/dist/new-components/atoms/Toggletip.d.ts +43 -0
- package/dist/new-components/atoms/Toggletip.es.js +216 -0
- package/dist/new-components/atoms/Toggletip.es.js.map +1 -0
- package/dist/new-components/atoms/stories/ThemeComparison.d.ts +8 -0
- package/dist/shadowDom-Bq4g0Qeu.js +52 -0
- package/dist/shadowDom-Bq4g0Qeu.js.map +1 -0
- package/dist/style.css +1 -1
- package/dist/theme.css +9 -154
- package/dist/tokens.css +1136 -0
- package/dist/useAnimationFrame-DwhymJoW.js +108 -0
- package/dist/useAnimationFrame-DwhymJoW.js.map +1 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js +49 -0
- package/dist/useAriaLabelledBy-B6n92QBS.js.map +1 -0
- package/dist/useBaseUiId-Ch7ujXpo.js +281 -0
- package/dist/useBaseUiId-Ch7ujXpo.js.map +1 -0
- package/dist/useButton-PUBhT4Vo.js +235 -0
- package/dist/useButton-PUBhT4Vo.js.map +1 -0
- package/dist/useControlled-BSyYkg5C.js +65 -0
- package/dist/useControlled-BSyYkg5C.js.map +1 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js +499 -0
- package/dist/useIsoLayoutEffect-e9VA-ICd.js.map +1 -0
- package/dist/useLabelableId-DCLzrdD-.js +241 -0
- package/dist/useLabelableId-DCLzrdD-.js.map +1 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js +1086 -0
- package/dist/useOpenInteractionType-DGWLoAqp.js.map +1 -0
- package/dist/usePopupHandleStore-BdS-xYID.js +2372 -0
- package/dist/usePopupHandleStore-BdS-xYID.js.map +1 -0
- package/dist/useTimeout-BXf1hDIL.js +46 -0
- package/dist/useTimeout-BXf1hDIL.js.map +1 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js +202 -0
- package/dist/useTransitionStatus-C9gg_XJ-.js.map +1 -0
- package/dist/useValueAsRef-BfFRcMg6.js +28 -0
- package/dist/useValueAsRef-BfFRcMg6.js.map +1 -0
- package/dist/utils/classNames.d.ts +3 -2
- package/dist/visuallyHidden-B6H2X3_Y.js +26 -0
- package/dist/visuallyHidden-B6H2X3_Y.js.map +1 -0
- package/dist/vite-env.d.ts +18 -0
- package/package.json +30 -22
- package/dist/Input-BvwIpntS.js.map +0 -1
- package/dist/Notification-BT4CZ69U.js +0 -39
- package/dist/Notification-BT4CZ69U.js.map +0 -1
- package/dist/RootFontSizeContext-7vgn7Y_k.js +0 -22
- package/dist/RootFontSizeContext-7vgn7Y_k.js.map +0 -1
- package/dist/classNames-Dy-RXSjS.js +0 -9
- package/dist/classNames-Dy-RXSjS.js.map +0 -1
- package/dist/components/molecules/DropdownMenu.d.ts +0 -18
- package/dist/components/molecules/DropdownMenu.es.js +0 -104
- package/dist/components/molecules/DropdownMenu.es.js.map +0 -1
- package/dist/components/molecules/ThumbsFeedback.d.ts +0 -13
- package/dist/components/molecules/ThumbsFeedback.es.js +0 -98
- package/dist/components/molecules/ThumbsFeedback.es.js.map +0 -1
- package/dist/components/molecules/agent-chat/SandboxToolCall.d.ts +0 -15
- package/dist/components/molecules/agent-chat/ToolCallCard.d.ts +0 -26
- package/dist/components/molecules/agent-chat/ToolCallContentBlock.d.ts +0 -17
- package/dist/components/theme/lightColorPlugin.d.ts +0 -1
- package/dist/components/theme/lightColorPlugin.es.js +0 -92
- package/dist/components/theme/lightColorPlugin.es.js.map +0 -1
- package/dist/tailwindPreset.d.ts +0 -144
- package/dist/tailwindPreset.es.js +0 -100
- package/dist/tailwindPreset.es.js.map +0 -1
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
const toDataTestId = (testId, prefix) => {
|
|
3
|
-
if (!testId || prefix == null) {
|
|
4
|
-
return void 0;
|
|
5
|
-
}
|
|
6
|
-
let id = testId.trim().replaceAll(/\s+/g, "-");
|
|
7
|
-
if (prefix) {
|
|
8
|
-
id = prefix + "-" + id;
|
|
9
|
-
}
|
|
10
|
-
return id.toLowerCase();
|
|
11
|
-
};
|
|
12
|
-
const Toast = ({ title, msg, icon, dataTestPrefix }) => {
|
|
13
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
14
|
-
icon,
|
|
15
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
16
|
-
/* @__PURE__ */ jsx(
|
|
17
|
-
"h2",
|
|
18
|
-
{
|
|
19
|
-
className: "font-bold text-gray-850 font-sans text-xl leading-6 mb-2",
|
|
20
|
-
"data-test": toDataTestId("toast-header", dataTestPrefix),
|
|
21
|
-
children: title
|
|
22
|
-
}
|
|
23
|
-
),
|
|
24
|
-
/* @__PURE__ */ jsx(
|
|
25
|
-
"div",
|
|
26
|
-
{
|
|
27
|
-
className: "text-xs font-normal text-gray-850 font-sans text-base leading-5",
|
|
28
|
-
"data-test": toDataTestId("toast-subheader", dataTestPrefix),
|
|
29
|
-
children: msg
|
|
30
|
-
}
|
|
31
|
-
)
|
|
32
|
-
] })
|
|
33
|
-
] });
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
Toast as T,
|
|
37
|
-
toDataTestId as t
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=Notification-BT4CZ69U.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Notification-BT4CZ69U.js","sources":["../src/utils/conversions.ts","../src/components/atoms/Notification.tsx"],"sourcesContent":["export const toDataTestId = (testId?: string, prefix?: string) => {\n if (!testId || prefix == null) {\n return undefined\n }\n let id = testId.trim().replaceAll(/\\s+/g, '-')\n if (prefix) {\n id = prefix + '-' + id\n }\n return id.toLowerCase()\n}\n","import React from 'react'\n\nimport { toDataTestId } from '@/utils/conversions'\n\ntype ToastProps = {\n title?: string\n msg?: string\n icon?: React.ReactNode | JSX.Element | string\n dataTestPrefix?: string\n}\nexport const Toast: React.FC<ToastProps> = ({ title, msg, icon, dataTestPrefix }) => {\n return (\n <div className=\"flex\">\n {icon}\n <div>\n <h2\n className=\"font-bold text-gray-850 font-sans text-xl leading-6 mb-2\"\n data-test={toDataTestId('toast-header', dataTestPrefix)}\n >\n {title}\n </h2>\n <div\n className=\"text-xs font-normal text-gray-850 font-sans text-base leading-5\"\n data-test={toDataTestId('toast-subheader', dataTestPrefix)}\n >\n {msg}\n </div>\n </div>\n </div>\n )\n}\n"],"names":[],"mappings":";AAAO,MAAM,eAAe,CAAC,QAAiB,WAAoB;AAChE,MAAI,CAAC,UAAU,UAAU,MAAM;AAC7B,WAAO;AAAA,EACT;AACA,MAAI,KAAK,OAAO,KAAA,EAAO,WAAW,QAAQ,GAAG;AAC7C,MAAI,QAAQ;AACV,SAAK,SAAS,MAAM;AAAA,EACtB;AACA,SAAO,GAAG,YAAA;AACZ;ACCO,MAAM,QAA8B,CAAC,EAAE,OAAO,KAAK,MAAM,qBAAqB;AACnF,SACE,qBAAC,OAAA,EAAI,WAAU,QACZ,UAAA;AAAA,IAAA;AAAA,yBACA,OAAA,EACC,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,aAAW,aAAa,gBAAgB,cAAc;AAAA,UAErD,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,MAEH;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,aAAW,aAAa,mBAAmB,cAAc;AAAA,UAExD,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACH,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useContext, createContext } from "react";
|
|
2
|
-
const getRootFontSize = () => {
|
|
3
|
-
const width = window.innerWidth;
|
|
4
|
-
switch (true) {
|
|
5
|
-
case width >= 3840:
|
|
6
|
-
return 32;
|
|
7
|
-
case width >= 2880:
|
|
8
|
-
return 24;
|
|
9
|
-
case width >= 2400:
|
|
10
|
-
return 20;
|
|
11
|
-
default:
|
|
12
|
-
return 16;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const RootFontSizeContext = createContext({
|
|
16
|
-
rootFontSize: getRootFontSize()
|
|
17
|
-
});
|
|
18
|
-
const useRootFontSize = () => useContext(RootFontSizeContext);
|
|
19
|
-
export {
|
|
20
|
-
useRootFontSize as u
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=RootFontSizeContext-7vgn7Y_k.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RootFontSizeContext-7vgn7Y_k.js","sources":["../src/utils/getRootFontSize.ts","../src/contexts/RootFontSizeContext.tsx"],"sourcesContent":["const getRootFontSize = (): number => {\n const width = window.innerWidth\n switch (true) {\n case width >= 3840:\n return 32\n case width >= 2880:\n return 24\n case width >= 2400:\n return 20\n default:\n return 16\n }\n}\n\nexport default getRootFontSize\n","import React, { createContext, useContext, useEffect, useState } from 'react'\nimport _throttle from 'lodash-es/throttle'\n\nimport getRootFontSize from '@/utils/getRootFontSize'\n\ninterface RootFontSizeContextType {\n rootFontSize: number\n}\n\nconst RootFontSizeContext = createContext<RootFontSizeContextType>({\n rootFontSize: getRootFontSize(),\n})\n\nexport const useRootFontSize = () => useContext(RootFontSizeContext)\n\nexport const RootFontSizeProvider: React.FC<React.PropsWithChildren> = ({ children }) => {\n const [fontSize, setFontSize] = useState(getRootFontSize())\n\n useEffect(() => {\n const handleResize = () => {\n const newFontSize = getRootFontSize()\n // Only when a breakpoint is crossed, call setState\n if (newFontSize !== fontSize) {\n setFontSize(newFontSize)\n }\n }\n const throttledHandleResize = _throttle(handleResize, 1000)\n\n window.addEventListener('resize', throttledHandleResize)\n return () => window.removeEventListener('resize', throttledHandleResize)\n }, [fontSize])\n\n return <RootFontSizeContext.Provider value={{ rootFontSize: fontSize }}>{children}</RootFontSizeContext.Provider>\n}\n"],"names":[],"mappings":";AAAA,MAAM,kBAAkB,MAAc;AACpC,QAAM,QAAQ,OAAO;AACrB,UAAQ,MAAA;AAAA,IACN,KAAK,SAAS;AACZ,aAAO;AAAA,IACT,KAAK,SAAS;AACZ,aAAO;AAAA,IACT,KAAK,SAAS;AACZ,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EAAA;AAEb;ACHA,MAAM,sBAAsB,cAAuC;AAAA,EACjE,cAAc,gBAAA;AAChB,CAAC;AAEM,MAAM,kBAAkB,MAAM,WAAW,mBAAmB;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"classNames-Dy-RXSjS.js","sources":["../src/utils/classNames.ts"],"sourcesContent":["import cn, { Argument } from 'classnames'\nimport { twMerge } from 'tailwind-merge'\n\nexport default function classNames(...args: Argument[]) {\n return twMerge(cn(args))\n}\n"],"names":["cn"],"mappings":";;AAGA,SAAwB,cAAc,MAAkB;AACtD,SAAO,QAAQA,aAAG,IAAI,CAAC;AACzB;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { MenuItemProps } from '@mui/material/MenuItem';
|
|
3
|
-
export interface DropdownMenuProps {
|
|
4
|
-
trigger: React.ReactNode;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
align?: 'start' | 'center' | 'end';
|
|
7
|
-
side?: 'top' | 'bottom' | 'left' | 'right';
|
|
8
|
-
className?: string;
|
|
9
|
-
contentClassName?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface DropdownMenuItemProps extends MenuItemProps {
|
|
12
|
-
children: React.ReactNode;
|
|
13
|
-
}
|
|
14
|
-
export declare const DropdownMenu: React.FC<DropdownMenuProps> & {
|
|
15
|
-
Item: typeof DropdownMenuItem;
|
|
16
|
-
};
|
|
17
|
-
export declare const DropdownMenuItem: React.FC<DropdownMenuItemProps>;
|
|
18
|
-
export default DropdownMenu;
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { useState } from "react";
|
|
3
|
-
import Menu from "@mui/material/Menu";
|
|
4
|
-
import MenuItem from "@mui/material/MenuItem";
|
|
5
|
-
import { c as classNames } from "../../classNames-Dy-RXSjS.js";
|
|
6
|
-
const anchorOriginMap = {
|
|
7
|
-
"bottom-start": { vertical: "bottom", horizontal: "left" },
|
|
8
|
-
"bottom-center": { vertical: "bottom", horizontal: "center" },
|
|
9
|
-
"bottom-end": { vertical: "bottom", horizontal: "right" },
|
|
10
|
-
"top-start": { vertical: "top", horizontal: "left" },
|
|
11
|
-
"top-center": { vertical: "top", horizontal: "center" },
|
|
12
|
-
"top-end": { vertical: "top", horizontal: "right" },
|
|
13
|
-
"left-start": { vertical: "top", horizontal: "left" },
|
|
14
|
-
"left-center": { vertical: "center", horizontal: "left" },
|
|
15
|
-
"left-end": { vertical: "bottom", horizontal: "left" },
|
|
16
|
-
"right-start": { vertical: "top", horizontal: "right" },
|
|
17
|
-
"right-center": { vertical: "center", horizontal: "right" },
|
|
18
|
-
"right-end": { vertical: "bottom", horizontal: "right" }
|
|
19
|
-
};
|
|
20
|
-
const transformOriginMap = {
|
|
21
|
-
"bottom-start": { vertical: "top", horizontal: "left" },
|
|
22
|
-
"bottom-center": { vertical: "top", horizontal: "center" },
|
|
23
|
-
"bottom-end": { vertical: "top", horizontal: "right" },
|
|
24
|
-
"top-start": { vertical: "bottom", horizontal: "left" },
|
|
25
|
-
"top-center": { vertical: "bottom", horizontal: "center" },
|
|
26
|
-
"top-end": { vertical: "bottom", horizontal: "right" },
|
|
27
|
-
"left-start": { vertical: "top", horizontal: "right" },
|
|
28
|
-
"left-center": { vertical: "center", horizontal: "right" },
|
|
29
|
-
"left-end": { vertical: "bottom", horizontal: "right" },
|
|
30
|
-
"right-start": { vertical: "top", horizontal: "left" },
|
|
31
|
-
"right-center": { vertical: "center", horizontal: "left" },
|
|
32
|
-
"right-end": { vertical: "bottom", horizontal: "left" }
|
|
33
|
-
};
|
|
34
|
-
const PAPER_SLOT_PROPS = {
|
|
35
|
-
paper: {
|
|
36
|
-
className: classNames(
|
|
37
|
-
"bg-white dark:bg-gray-250 text-gray-800 dark:text-gray-700",
|
|
38
|
-
"min-w-[8rem] overflow-hidden rounded-xl border border-gray-250 dark:border-gray-275",
|
|
39
|
-
"p-1.5 shadow-lg"
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
const DropdownMenu = ({ trigger, children, align = "start", side = "bottom", className, contentClassName }) => {
|
|
44
|
-
const [anchorEl, setAnchorEl] = useState(null);
|
|
45
|
-
const open = Boolean(anchorEl);
|
|
46
|
-
const handleClick = (event) => {
|
|
47
|
-
setAnchorEl(event.currentTarget);
|
|
48
|
-
};
|
|
49
|
-
const handleClose = () => {
|
|
50
|
-
setAnchorEl(null);
|
|
51
|
-
};
|
|
52
|
-
const anchorKey = `${side}-${align}`;
|
|
53
|
-
const anchorOrigin = anchorOriginMap[anchorKey] || anchorOriginMap["bottom-start"];
|
|
54
|
-
const transformOrigin = transformOriginMap[anchorKey] || transformOriginMap["bottom-start"];
|
|
55
|
-
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
56
|
-
/* @__PURE__ */ jsx("div", { onClick: handleClick, className: "inline-flex", children: trigger }),
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
58
|
-
Menu,
|
|
59
|
-
{
|
|
60
|
-
anchorEl,
|
|
61
|
-
open,
|
|
62
|
-
onClose: handleClose,
|
|
63
|
-
anchorOrigin,
|
|
64
|
-
transformOrigin,
|
|
65
|
-
className: contentClassName,
|
|
66
|
-
slotProps: PAPER_SLOT_PROPS,
|
|
67
|
-
children: React__default.Children.map(children, (child) => {
|
|
68
|
-
if (React__default.isValidElement(child)) {
|
|
69
|
-
return React__default.cloneElement(child, {
|
|
70
|
-
onClick: (e) => {
|
|
71
|
-
var _a, _b;
|
|
72
|
-
(_b = (_a = child.props).onClick) == null ? void 0 : _b.call(_a, e);
|
|
73
|
-
handleClose();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
return child;
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
)
|
|
81
|
-
] });
|
|
82
|
-
};
|
|
83
|
-
const DropdownMenuItem = ({ children, className, ...props }) => {
|
|
84
|
-
return /* @__PURE__ */ jsx(
|
|
85
|
-
MenuItem,
|
|
86
|
-
{
|
|
87
|
-
className: classNames(
|
|
88
|
-
"hover:bg-gray-150 dark:hover:bg-gray-300",
|
|
89
|
-
"focus:bg-gray-150 dark:focus:bg-gray-300",
|
|
90
|
-
"flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none",
|
|
91
|
-
className
|
|
92
|
-
),
|
|
93
|
-
...props,
|
|
94
|
-
children
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
};
|
|
98
|
-
DropdownMenu.Item = DropdownMenuItem;
|
|
99
|
-
export {
|
|
100
|
-
DropdownMenu,
|
|
101
|
-
DropdownMenuItem,
|
|
102
|
-
DropdownMenu as default
|
|
103
|
-
};
|
|
104
|
-
//# sourceMappingURL=DropdownMenu.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.es.js","sources":["../../../src/components/molecules/DropdownMenu.tsx"],"sourcesContent":["import React, { useState } from 'react'\nimport Menu, { MenuProps } from '@mui/material/Menu'\nimport MenuItem, { MenuItemProps } from '@mui/material/MenuItem'\n\nimport classNames from '@/utils/classNames'\n\nexport interface DropdownMenuProps {\n trigger: React.ReactNode\n children: React.ReactNode\n align?: 'start' | 'center' | 'end'\n side?: 'top' | 'bottom' | 'left' | 'right'\n className?: string\n contentClassName?: string\n}\n\nexport interface DropdownMenuItemProps extends MenuItemProps {\n children: React.ReactNode\n}\n\ntype MenuOrigin = {\n vertical: 'top' | 'bottom' | 'center'\n horizontal: 'left' | 'right' | 'center'\n}\n\nconst anchorOriginMap: Record<string, MenuOrigin> = {\n 'bottom-start': { vertical: 'bottom', horizontal: 'left' },\n 'bottom-center': { vertical: 'bottom', horizontal: 'center' },\n 'bottom-end': { vertical: 'bottom', horizontal: 'right' },\n 'top-start': { vertical: 'top', horizontal: 'left' },\n 'top-center': { vertical: 'top', horizontal: 'center' },\n 'top-end': { vertical: 'top', horizontal: 'right' },\n 'left-start': { vertical: 'top', horizontal: 'left' },\n 'left-center': { vertical: 'center', horizontal: 'left' },\n 'left-end': { vertical: 'bottom', horizontal: 'left' },\n 'right-start': { vertical: 'top', horizontal: 'right' },\n 'right-center': { vertical: 'center', horizontal: 'right' },\n 'right-end': { vertical: 'bottom', horizontal: 'right' },\n}\n\nconst transformOriginMap: Record<string, MenuOrigin> = {\n 'bottom-start': { vertical: 'top', horizontal: 'left' },\n 'bottom-center': { vertical: 'top', horizontal: 'center' },\n 'bottom-end': { vertical: 'top', horizontal: 'right' },\n 'top-start': { vertical: 'bottom', horizontal: 'left' },\n 'top-center': { vertical: 'bottom', horizontal: 'center' },\n 'top-end': { vertical: 'bottom', horizontal: 'right' },\n 'left-start': { vertical: 'top', horizontal: 'right' },\n 'left-center': { vertical: 'center', horizontal: 'right' },\n 'left-end': { vertical: 'bottom', horizontal: 'right' },\n 'right-start': { vertical: 'top', horizontal: 'left' },\n 'right-center': { vertical: 'center', horizontal: 'left' },\n 'right-end': { vertical: 'bottom', horizontal: 'left' },\n}\n\nconst PAPER_SLOT_PROPS = {\n paper: {\n className: classNames(\n 'bg-white dark:bg-gray-250 text-gray-800 dark:text-gray-700',\n 'min-w-[8rem] overflow-hidden rounded-xl border border-gray-250 dark:border-gray-275',\n 'p-1.5 shadow-lg',\n ),\n },\n}\n\nexport const DropdownMenu: React.FC<DropdownMenuProps> & {\n Item: typeof DropdownMenuItem\n} = ({ trigger, children, align = 'start', side = 'bottom', className, contentClassName }) => {\n const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null)\n const open = Boolean(anchorEl)\n\n const handleClick = (event: React.MouseEvent<HTMLElement>) => {\n setAnchorEl(event.currentTarget)\n }\n\n const handleClose = () => {\n setAnchorEl(null)\n }\n\n const anchorKey = `${side}-${align}`\n const anchorOrigin = anchorOriginMap[anchorKey] || anchorOriginMap['bottom-start']\n const transformOrigin = transformOriginMap[anchorKey] || transformOriginMap['bottom-start']\n\n return (\n <div className={className}>\n <div onClick={handleClick} className=\"inline-flex\">\n {trigger}\n </div>\n <Menu\n anchorEl={anchorEl}\n open={open}\n onClose={handleClose}\n anchorOrigin={anchorOrigin}\n transformOrigin={transformOrigin}\n className={contentClassName}\n slotProps={PAPER_SLOT_PROPS}\n >\n {React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n return React.cloneElement(child as React.ReactElement<any>, {\n onClick: (e: React.MouseEvent) => {\n child.props.onClick?.(e)\n handleClose()\n },\n })\n }\n return child\n })}\n </Menu>\n </div>\n )\n}\n\nexport const DropdownMenuItem: React.FC<DropdownMenuItemProps> = ({ children, className, ...props }) => {\n return (\n <MenuItem\n className={classNames(\n 'hover:bg-gray-150 dark:hover:bg-gray-300',\n 'focus:bg-gray-150 dark:focus:bg-gray-300',\n 'flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm outline-none select-none',\n className,\n )}\n {...props}\n >\n {children}\n </MenuItem>\n )\n}\n\nDropdownMenu.Item = DropdownMenuItem\n\nexport default DropdownMenu\n"],"names":["React"],"mappings":"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"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export type ThumbsFeedbackValue = 'up' | 'down' | null;
|
|
3
|
-
export interface ThumbsFeedbackProps {
|
|
4
|
-
value: ThumbsFeedbackValue;
|
|
5
|
-
onChange: (value: ThumbsFeedbackValue) => void;
|
|
6
|
-
className?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
/** If true, clicking the active thumb clears the selection. Defaults to true. */
|
|
9
|
-
allowClear?: boolean;
|
|
10
|
-
size?: 'sm' | 'md';
|
|
11
|
-
}
|
|
12
|
-
declare const ThumbsFeedback: React.FC<ThumbsFeedbackProps>;
|
|
13
|
-
export default ThumbsFeedback;
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { faThumbsUp as faThumbsUp$1, faThumbsDown as faThumbsDown$1 } from "@fortawesome/free-regular-svg-icons";
|
|
3
|
-
import { faThumbsUp, faThumbsDown } from "@fortawesome/free-solid-svg-icons";
|
|
4
|
-
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
5
|
-
import { c as classNames } from "../../classNames-Dy-RXSjS.js";
|
|
6
|
-
const sizeClassName = {
|
|
7
|
-
sm: "h-3.5 w-3.5",
|
|
8
|
-
md: "h-4 w-4"
|
|
9
|
-
};
|
|
10
|
-
const ThumbsFeedback = ({
|
|
11
|
-
value,
|
|
12
|
-
onChange,
|
|
13
|
-
className,
|
|
14
|
-
disabled = false,
|
|
15
|
-
allowClear = true,
|
|
16
|
-
size = "md"
|
|
17
|
-
}) => {
|
|
18
|
-
const iconSize = sizeClassName[size];
|
|
19
|
-
const onThumbsUp = () => {
|
|
20
|
-
if (disabled) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
if (value === "up") {
|
|
24
|
-
if (allowClear) onChange(null);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
onChange("up");
|
|
28
|
-
};
|
|
29
|
-
const onThumbsDown = () => {
|
|
30
|
-
if (disabled) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
if (value === "down") {
|
|
34
|
-
if (allowClear) onChange(null);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
onChange("down");
|
|
38
|
-
};
|
|
39
|
-
return /* @__PURE__ */ jsxs("div", { className: classNames("inline-flex items-center gap-1 mt-2.5", className), role: "group", "aria-label": "Feedback", children: [
|
|
40
|
-
/* @__PURE__ */ jsx(
|
|
41
|
-
"button",
|
|
42
|
-
{
|
|
43
|
-
type: "button",
|
|
44
|
-
disabled,
|
|
45
|
-
"aria-pressed": value === "up",
|
|
46
|
-
"aria-label": "Thumbs up",
|
|
47
|
-
onClick: onThumbsUp,
|
|
48
|
-
className: classNames(
|
|
49
|
-
"inline-flex items-center justify-center rounded p-0.5 transition-colors",
|
|
50
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1",
|
|
51
|
-
"dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-gray-150",
|
|
52
|
-
disabled && "cursor-not-allowed opacity-40"
|
|
53
|
-
),
|
|
54
|
-
children: /* @__PURE__ */ jsx(
|
|
55
|
-
FontAwesomeIcon,
|
|
56
|
-
{
|
|
57
|
-
icon: value === "up" ? faThumbsUp : faThumbsUp$1,
|
|
58
|
-
className: classNames(
|
|
59
|
-
iconSize,
|
|
60
|
-
value === "up" ? "text-gray-500" : "text-gray-500 hover:text-gray-650 dark:hover:text-gray-650"
|
|
61
|
-
)
|
|
62
|
-
}
|
|
63
|
-
)
|
|
64
|
-
}
|
|
65
|
-
),
|
|
66
|
-
/* @__PURE__ */ jsx(
|
|
67
|
-
"button",
|
|
68
|
-
{
|
|
69
|
-
type: "button",
|
|
70
|
-
disabled,
|
|
71
|
-
"aria-pressed": value === "down",
|
|
72
|
-
"aria-label": "Thumbs down",
|
|
73
|
-
onClick: onThumbsDown,
|
|
74
|
-
className: classNames(
|
|
75
|
-
"inline-flex items-center justify-center rounded p-0.5 transition-colors",
|
|
76
|
-
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1",
|
|
77
|
-
"dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-gray-150",
|
|
78
|
-
disabled && "cursor-not-allowed opacity-40"
|
|
79
|
-
),
|
|
80
|
-
children: /* @__PURE__ */ jsx(
|
|
81
|
-
FontAwesomeIcon,
|
|
82
|
-
{
|
|
83
|
-
icon: value === "down" ? faThumbsDown : faThumbsDown$1,
|
|
84
|
-
className: classNames(
|
|
85
|
-
iconSize,
|
|
86
|
-
"-scale-x-100",
|
|
87
|
-
value === "down" ? "text-gray-500" : "text-gray-500 hover:text-gray-650 dark:hover:text-gray-650"
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
)
|
|
93
|
-
] });
|
|
94
|
-
};
|
|
95
|
-
export {
|
|
96
|
-
ThumbsFeedback as default
|
|
97
|
-
};
|
|
98
|
-
//# sourceMappingURL=ThumbsFeedback.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThumbsFeedback.es.js","sources":["../../../src/components/molecules/ThumbsFeedback.tsx"],"sourcesContent":["import React from 'react'\nimport {\n faThumbsDown as faThumbsDownRegular,\n faThumbsUp as faThumbsUpRegular,\n} from '@fortawesome/free-regular-svg-icons'\nimport { faThumbsDown, faThumbsUp } from '@fortawesome/free-solid-svg-icons'\nimport { FontAwesomeIcon } from '@fortawesome/react-fontawesome'\n\nimport classNames from '@/utils/classNames'\n\nexport type ThumbsFeedbackValue = 'up' | 'down' | null\n\nexport interface ThumbsFeedbackProps {\n value: ThumbsFeedbackValue\n onChange: (value: ThumbsFeedbackValue) => void\n className?: string\n disabled?: boolean\n /** If true, clicking the active thumb clears the selection. Defaults to true. */\n allowClear?: boolean\n size?: 'sm' | 'md'\n}\n\nconst sizeClassName = {\n sm: 'h-3.5 w-3.5',\n md: 'h-4 w-4',\n} as const\n\nconst ThumbsFeedback: React.FC<ThumbsFeedbackProps> = ({\n value,\n onChange,\n className,\n disabled = false,\n allowClear = true,\n size = 'md',\n}) => {\n const iconSize = sizeClassName[size]\n\n const onThumbsUp = () => {\n if (disabled) {\n return\n }\n if (value === 'up') {\n if (allowClear) onChange(null)\n return\n }\n onChange('up')\n }\n\n const onThumbsDown = () => {\n if (disabled) {\n return\n }\n if (value === 'down') {\n if (allowClear) onChange(null)\n return\n }\n onChange('down')\n }\n\n return (\n <div className={classNames('inline-flex items-center gap-1 mt-2.5', className)} role=\"group\" aria-label=\"Feedback\">\n <button\n type=\"button\"\n disabled={disabled}\n aria-pressed={value === 'up'}\n aria-label=\"Thumbs up\"\n onClick={onThumbsUp}\n className={classNames(\n 'inline-flex items-center justify-center rounded p-0.5 transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1',\n 'dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-gray-150',\n disabled && 'cursor-not-allowed opacity-40',\n )}\n >\n <FontAwesomeIcon\n icon={value === 'up' ? faThumbsUp : faThumbsUpRegular}\n className={classNames(\n iconSize,\n value === 'up' ? 'text-gray-500' : 'text-gray-500 hover:text-gray-650 dark:hover:text-gray-650',\n )}\n />\n </button>\n <button\n type=\"button\"\n disabled={disabled}\n aria-pressed={value === 'down'}\n aria-label=\"Thumbs down\"\n onClick={onThumbsDown}\n className={classNames(\n 'inline-flex items-center justify-center rounded p-0.5 transition-colors',\n 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1',\n 'dark:focus-visible:ring-indigo-400 dark:focus-visible:ring-offset-gray-150',\n disabled && 'cursor-not-allowed opacity-40',\n )}\n >\n <FontAwesomeIcon\n icon={value === 'down' ? faThumbsDown : faThumbsDownRegular}\n className={classNames(\n iconSize,\n '-scale-x-100',\n value === 'down' ? 'text-gray-500' : 'text-gray-500 hover:text-gray-650 dark:hover:text-gray-650',\n )}\n />\n </button>\n </div>\n )\n}\n\nexport default ThumbsFeedback\n"],"names":["faThumbsUpRegular","faThumbsDownRegular"],"mappings":";;;;;AAsBA,MAAM,gBAAgB;AAAA,EACpB,IAAI;AAAA,EACJ,IAAI;AACN;AAEA,MAAM,iBAAgD,CAAC;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,aAAa;AAAA,EACb,OAAO;AACT,MAAM;AACJ,QAAM,WAAW,cAAc,IAAI;AAEnC,QAAM,aAAa,MAAM;AACvB,QAAI,UAAU;AACZ;AAAA,IACF;AACA,QAAI,UAAU,MAAM;AAClB,UAAI,qBAAqB,IAAI;AAC7B;AAAA,IACF;AACA,aAAS,IAAI;AAAA,EACf;AAEA,QAAM,eAAe,MAAM;AACzB,QAAI,UAAU;AACZ;AAAA,IACF;AACA,QAAI,UAAU,QAAQ;AACpB,UAAI,qBAAqB,IAAI;AAC7B;AAAA,IACF;AACA,aAAS,MAAM;AAAA,EACjB;AAEA,SACE,qBAAC,OAAA,EAAI,WAAW,WAAW,yCAAyC,SAAS,GAAG,MAAK,SAAQ,cAAW,YACtG,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA,gBAAc,UAAU;AAAA,QACxB,cAAW;AAAA,QACX,SAAS;AAAA,QACT,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY;AAAA,QAAA;AAAA,QAGd,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAM,UAAU,OAAO,aAAaA;AAAAA,YACpC,WAAW;AAAA,cACT;AAAA,cACA,UAAU,OAAO,kBAAkB;AAAA,YAAA;AAAA,UACrC;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,IAEF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL;AAAA,QACA,gBAAc,UAAU;AAAA,QACxB,cAAW;AAAA,QACX,SAAS;AAAA,QACT,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA,YAAY;AAAA,QAAA;AAAA,QAGd,UAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAM,UAAU,SAAS,eAAeC;AAAAA,YACxC,WAAW;AAAA,cACT;AAAA,cACA;AAAA,cACA,UAAU,SAAS,kBAAkB;AAAA,YAAA;AAAA,UACvC;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,EACF,GACF;AAEJ;"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface SandboxToolCallProps {
|
|
3
|
-
command?: string;
|
|
4
|
-
exitCode?: number | null;
|
|
5
|
-
argsJson?: string;
|
|
6
|
-
resultText?: string;
|
|
7
|
-
resultJson?: string;
|
|
8
|
-
viewMode?: 'terminal' | 'code';
|
|
9
|
-
hasContent?: boolean;
|
|
10
|
-
onViewModeChange?: (viewMode: 'terminal' | 'code') => void;
|
|
11
|
-
dataTestPrefix?: string;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
declare const SandboxToolCall: React.FC<SandboxToolCallProps>;
|
|
15
|
-
export default SandboxToolCall;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IconProp } from '../../atoms/IconProvider';
|
|
3
|
-
import { AgentStepStatus } from './AgentStepRow';
|
|
4
|
-
export interface ToolCallCardProps {
|
|
5
|
-
icon?: IconProp;
|
|
6
|
-
iconClassName?: string;
|
|
7
|
-
iconVariant?: 'primary' | 'muted';
|
|
8
|
-
toolName: string;
|
|
9
|
-
expanded?: boolean;
|
|
10
|
-
onToggle?: () => void;
|
|
11
|
-
awaiting?: boolean;
|
|
12
|
-
awaitingText?: string;
|
|
13
|
-
status?: AgentStepStatus;
|
|
14
|
-
exitCode?: number | null;
|
|
15
|
-
showExpandChevron?: boolean;
|
|
16
|
-
showResponseLine?: boolean;
|
|
17
|
-
responseIcon?: any;
|
|
18
|
-
approvalSlot?: React.ReactNode;
|
|
19
|
-
requestSlot?: React.ReactNode;
|
|
20
|
-
responseSlot?: React.ReactNode;
|
|
21
|
-
dataTestPrefix?: string;
|
|
22
|
-
className?: string;
|
|
23
|
-
highlightCard?: boolean;
|
|
24
|
-
}
|
|
25
|
-
declare const ToolCallCard: React.FC<ToolCallCardProps>;
|
|
26
|
-
export default ToolCallCard;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface ToolCallContentBlockProps {
|
|
3
|
-
title: string;
|
|
4
|
-
content: string;
|
|
5
|
-
isJson?: boolean;
|
|
6
|
-
copyValue?: string;
|
|
7
|
-
maxHeight?: string;
|
|
8
|
-
resizable?: boolean;
|
|
9
|
-
fullscreen?: boolean;
|
|
10
|
-
onFullscreenChange?: (fullscreen: boolean) => void;
|
|
11
|
-
contentHeightRem?: number;
|
|
12
|
-
contentRef?: (node: HTMLDivElement | null) => void;
|
|
13
|
-
dataTestPrefix?: string;
|
|
14
|
-
className?: string;
|
|
15
|
-
}
|
|
16
|
-
declare const ToolCallContentBlock: React.FC<ToolCallContentBlockProps>;
|
|
17
|
-
export default ToolCallContentBlock;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createLightColorPlugin: (plugin: any) => any;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { lightPalette } from "./colors.es.js";
|
|
2
|
-
function flattenColors(colors, prefix = "") {
|
|
3
|
-
const result = {};
|
|
4
|
-
for (const [key, value] of Object.entries(colors)) {
|
|
5
|
-
const newKey = prefix ? `${prefix}-${key}` : key;
|
|
6
|
-
if (typeof value === "string") {
|
|
7
|
-
result[newKey] = value;
|
|
8
|
-
} else if (typeof value === "object" && value !== null) {
|
|
9
|
-
Object.assign(result, flattenColors(value, newKey));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return result;
|
|
13
|
-
}
|
|
14
|
-
function generateColorUtilities(property, prefix, colors) {
|
|
15
|
-
const utilities = {};
|
|
16
|
-
for (const [colorKey, colorValue] of Object.entries(colors)) {
|
|
17
|
-
utilities[`.${prefix}-light-${colorKey}`] = {
|
|
18
|
-
[property]: colorValue
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
return utilities;
|
|
22
|
-
}
|
|
23
|
-
function generateBorderUtilities(colors) {
|
|
24
|
-
const utilities = {};
|
|
25
|
-
Object.assign(utilities, generateColorUtilities("border-color", "border", colors));
|
|
26
|
-
const directions = {
|
|
27
|
-
t: "border-top-color",
|
|
28
|
-
r: "border-right-color",
|
|
29
|
-
b: "border-bottom-color",
|
|
30
|
-
l: "border-left-color",
|
|
31
|
-
x: ["border-left-color", "border-right-color"],
|
|
32
|
-
y: ["border-top-color", "border-bottom-color"]
|
|
33
|
-
};
|
|
34
|
-
for (const [dirKey, properties] of Object.entries(directions)) {
|
|
35
|
-
for (const [colorKey, colorValue] of Object.entries(colors)) {
|
|
36
|
-
const className = `.border-${dirKey}-light-${colorKey}`;
|
|
37
|
-
if (Array.isArray(properties)) {
|
|
38
|
-
utilities[className] = {};
|
|
39
|
-
properties.forEach((prop) => {
|
|
40
|
-
utilities[className][prop] = colorValue;
|
|
41
|
-
});
|
|
42
|
-
} else {
|
|
43
|
-
utilities[className] = {
|
|
44
|
-
[properties]: colorValue
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return utilities;
|
|
50
|
-
}
|
|
51
|
-
function generateDivideUtilities(colors) {
|
|
52
|
-
const utilities = {};
|
|
53
|
-
for (const [colorKey, colorValue] of Object.entries(colors)) {
|
|
54
|
-
utilities[`.divide-light-${colorKey} > :not([hidden]) ~ :not([hidden])`] = {
|
|
55
|
-
"border-color": colorValue
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return utilities;
|
|
59
|
-
}
|
|
60
|
-
function generateRingUtilities(colors) {
|
|
61
|
-
const utilities = {};
|
|
62
|
-
for (const [colorKey, colorValue] of Object.entries(colors)) {
|
|
63
|
-
utilities[`.ring-light-${colorKey}`] = {
|
|
64
|
-
"--tw-ring-color": colorValue
|
|
65
|
-
};
|
|
66
|
-
utilities[`.ring-offset-light-${colorKey}`] = {
|
|
67
|
-
"--tw-ring-offset-color": colorValue
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
return utilities;
|
|
71
|
-
}
|
|
72
|
-
const createLightColorPlugin = (plugin) => {
|
|
73
|
-
return plugin(function({ addUtilities }) {
|
|
74
|
-
const flatColors = flattenColors(lightPalette);
|
|
75
|
-
const utilities = {
|
|
76
|
-
...generateColorUtilities("background-color", "bg", flatColors),
|
|
77
|
-
...generateColorUtilities("color", "text", flatColors),
|
|
78
|
-
...generateBorderUtilities(flatColors),
|
|
79
|
-
...generateDivideUtilities(flatColors),
|
|
80
|
-
...generateRingUtilities(flatColors),
|
|
81
|
-
...generateColorUtilities("fill", "fill", flatColors),
|
|
82
|
-
...generateColorUtilities("stroke", "stroke", flatColors),
|
|
83
|
-
...generateColorUtilities("accent-color", "accent", flatColors),
|
|
84
|
-
...generateColorUtilities("caret-color", "caret", flatColors)
|
|
85
|
-
};
|
|
86
|
-
addUtilities(utilities);
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
export {
|
|
90
|
-
createLightColorPlugin
|
|
91
|
-
};
|
|
92
|
-
//# sourceMappingURL=lightColorPlugin.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lightColorPlugin.es.js","sources":["../../../src/components/theme/lightColorPlugin.ts"],"sourcesContent":["import { lightPalette } from './colors'\n\ntype ColorValue = string | Record<string, any>\ntype FlattenedColors = Record<string, string>\ntype UtilityObject = Record<string, Record<string, string>>\ntype DirectionProperties = string | string[]\n\nfunction flattenColors(colors: ColorValue, prefix = ''): FlattenedColors {\n const result: FlattenedColors = {}\n\n for (const [key, value] of Object.entries(colors)) {\n const newKey = prefix ? `${prefix}-${key}` : key\n\n if (typeof value === 'string') {\n result[newKey] = value\n } else if (typeof value === 'object' && value !== null) {\n Object.assign(result, flattenColors(value, newKey))\n }\n }\n\n return result\n}\n\nfunction generateColorUtilities(property: string, prefix: string, colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.${prefix}-light-${colorKey}`] = {\n [property]: colorValue,\n }\n }\n\n return utilities\n}\n\nfunction generateBorderUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n Object.assign(utilities, generateColorUtilities('border-color', 'border', colors))\n\n const directions: Record<string, DirectionProperties> = {\n t: 'border-top-color',\n r: 'border-right-color',\n b: 'border-bottom-color',\n l: 'border-left-color',\n x: ['border-left-color', 'border-right-color'],\n y: ['border-top-color', 'border-bottom-color'],\n }\n\n for (const [dirKey, properties] of Object.entries(directions)) {\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n const className = `.border-${dirKey}-light-${colorKey}`\n\n if (Array.isArray(properties)) {\n utilities[className] = {}\n properties.forEach((prop) => {\n utilities[className][prop] = colorValue\n })\n } else {\n utilities[className] = {\n [properties]: colorValue,\n }\n }\n }\n }\n\n return utilities\n}\n\nfunction generateDivideUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.divide-light-${colorKey} > :not([hidden]) ~ :not([hidden])`] = {\n 'border-color': colorValue,\n }\n }\n\n return utilities\n}\n\nfunction generateRingUtilities(colors: FlattenedColors): UtilityObject {\n const utilities: UtilityObject = {}\n\n for (const [colorKey, colorValue] of Object.entries(colors)) {\n utilities[`.ring-light-${colorKey}`] = {\n '--tw-ring-color': colorValue,\n }\n\n utilities[`.ring-offset-light-${colorKey}`] = {\n '--tw-ring-offset-color': colorValue,\n }\n }\n\n return utilities\n}\nexport const createLightColorPlugin = (plugin: any) => {\n return plugin(function ({ addUtilities }: any) {\n const flatColors = flattenColors(lightPalette)\n\n const utilities = {\n ...generateColorUtilities('background-color', 'bg', flatColors),\n ...generateColorUtilities('color', 'text', flatColors),\n ...generateBorderUtilities(flatColors),\n ...generateDivideUtilities(flatColors),\n ...generateRingUtilities(flatColors),\n ...generateColorUtilities('fill', 'fill', flatColors),\n ...generateColorUtilities('stroke', 'stroke', flatColors),\n ...generateColorUtilities('accent-color', 'accent', flatColors),\n ...generateColorUtilities('caret-color', 'caret', flatColors),\n }\n\n addUtilities(utilities)\n })\n}\n"],"names":[],"mappings":"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"}
|