@lobehub/ui 5.18.0 → 5.19.1

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.
Files changed (64) hide show
  1. package/es/Accordion/Accordion.mjs +2 -2
  2. package/es/Accordion/Accordion.mjs.map +1 -1
  3. package/es/Accordion/AccordionItem.mjs +2 -2
  4. package/es/Accordion/AccordionItem.mjs.map +1 -1
  5. package/es/Checkbox/Checkbox.mjs +2 -2
  6. package/es/Checkbox/Checkbox.mjs.map +1 -1
  7. package/es/Checkbox/CheckboxGroup.mjs +2 -2
  8. package/es/Checkbox/CheckboxGroup.mjs.map +1 -1
  9. package/es/CodeEditor/CodeEditor.mjs +2 -2
  10. package/es/CodeEditor/CodeEditor.mjs.map +1 -1
  11. package/es/ColorSwatches/ColorSwatches.mjs +2 -2
  12. package/es/ColorSwatches/ColorSwatches.mjs.map +1 -1
  13. package/es/DraggablePanel/DraggablePanel.mjs +2 -2
  14. package/es/DraggablePanel/DraggablePanel.mjs.map +1 -1
  15. package/es/DraggablePanel/components/DraggablePanelHeader.mjs +2 -2
  16. package/es/DraggablePanel/components/DraggablePanelHeader.mjs.map +1 -1
  17. package/es/DraggableSideNav/DraggableSideNav.mjs +2 -2
  18. package/es/DraggableSideNav/DraggableSideNav.mjs.map +1 -1
  19. package/es/EditableText/EditableText.mjs +2 -2
  20. package/es/EditableText/EditableText.mjs.map +1 -1
  21. package/es/EmojiPicker/EmojiPicker.mjs +3 -3
  22. package/es/EmojiPicker/EmojiPicker.mjs.map +1 -1
  23. package/es/HotkeyInput/HotkeyInput.mjs +2 -2
  24. package/es/HotkeyInput/HotkeyInput.mjs.map +1 -1
  25. package/es/ImageSelect/ImageSelect.mjs +2 -2
  26. package/es/ImageSelect/ImageSelect.mjs.map +1 -1
  27. package/es/SearchBar/SearchBar.mjs +2 -2
  28. package/es/SearchBar/SearchBar.mjs.map +1 -1
  29. package/es/SliderWithInput/SliderWithInput.mjs +2 -1
  30. package/es/SliderWithInput/SliderWithInput.mjs.map +1 -1
  31. package/es/Toc/TocMobile.mjs +2 -2
  32. package/es/Toc/TocMobile.mjs.map +1 -1
  33. package/es/base-ui/Button/Button.mjs +2 -0
  34. package/es/base-ui/Button/Button.mjs.map +1 -1
  35. package/es/base-ui/Button/style.d.mts +3 -0
  36. package/es/base-ui/Button/style.mjs +119 -17
  37. package/es/base-ui/Button/style.mjs.map +1 -1
  38. package/es/base-ui/Button/type.d.mts +1 -1
  39. package/es/base-ui/FloatingPanel/FloatingPanel.d.mts +8 -0
  40. package/es/base-ui/FloatingPanel/FloatingPanel.mjs +325 -0
  41. package/es/base-ui/FloatingPanel/FloatingPanel.mjs.map +1 -0
  42. package/es/base-ui/FloatingPanel/index.d.mts +2 -0
  43. package/es/base-ui/FloatingPanel/style.mjs +177 -0
  44. package/es/base-ui/FloatingPanel/style.mjs.map +1 -0
  45. package/es/base-ui/FloatingPanel/type.d.mts +75 -0
  46. package/es/base-ui/Segmented/Segmented.mjs +2 -2
  47. package/es/base-ui/Segmented/Segmented.mjs.map +1 -1
  48. package/es/base-ui/Segmented/style.mjs +1 -1
  49. package/es/base-ui/Segmented/style.mjs.map +1 -1
  50. package/es/base-ui/Switch/atoms.mjs +2 -2
  51. package/es/base-ui/Switch/atoms.mjs.map +1 -1
  52. package/es/base-ui/Tabs/Tabs.mjs +2 -2
  53. package/es/base-ui/Tabs/Tabs.mjs.map +1 -1
  54. package/es/base-ui/Tabs/style.mjs +1 -1
  55. package/es/base-ui/Tabs/style.mjs.map +1 -1
  56. package/es/base-ui/index.d.mts +5 -3
  57. package/es/base-ui/index.mjs +3 -2
  58. package/es/chat/EditableMessage/EditableMessage.mjs +3 -3
  59. package/es/chat/EditableMessage/EditableMessage.mjs.map +1 -1
  60. package/es/chat/MessageModal/MessageModal.mjs +3 -3
  61. package/es/chat/MessageModal/MessageModal.mjs.map +1 -1
  62. package/es/mobile/TabBar/TabBar.mjs +2 -2
  63. package/es/mobile/TabBar/TabBar.mjs.map +1 -1
  64. package/package.json +1 -1
@@ -0,0 +1,177 @@
1
+ import { createStaticStyles } from "antd-style";
2
+ //#region src/base-ui/FloatingPanel/style.ts
3
+ const styles = createStaticStyles(({ css, cssVar }) => ({
4
+ body: css`
5
+ overflow: hidden auto;
6
+ flex: 1;
7
+ min-height: 0;
8
+ padding: 0;
9
+ `,
10
+ close: css`
11
+ position: static;
12
+
13
+ width: 32px;
14
+ height: 32px;
15
+ margin-inline-end: -4px;
16
+ border-radius: 8px;
17
+ `,
18
+ actions: css`
19
+ display: flex;
20
+ flex: none;
21
+ gap: 4px;
22
+ align-items: center;
23
+ `,
24
+ footer: css`
25
+ flex: none;
26
+ border-block-start: 1px solid ${cssVar.colorBorderSecondary};
27
+ `,
28
+ header: css`
29
+ flex: none;
30
+ min-height: 48px;
31
+ border-block-end: 1px solid ${cssVar.colorBorderSecondary};
32
+ `,
33
+ headerActions: css`
34
+ display: flex;
35
+ flex: none;
36
+ gap: 4px;
37
+ align-items: center;
38
+ `,
39
+ panel: css`
40
+ transform-origin: 100% 100%;
41
+
42
+ width: calc(100dvw - 32px);
43
+ max-height: calc(100dvh - 32px);
44
+ border-radius: 12px;
45
+
46
+ box-shadow:
47
+ 0 6px 24px 0 rgb(0 0 0 / 8%),
48
+ 0 2px 6px 0 rgb(0 0 0 / 4%);
49
+ `,
50
+ panelTop: css`
51
+ transform-origin: 100% 0;
52
+ `,
53
+ resizeHandle: css`
54
+ touch-action: none;
55
+ position: absolute;
56
+ z-index: 1;
57
+ background: transparent;
58
+
59
+ &::after {
60
+ content: '';
61
+
62
+ position: absolute;
63
+
64
+ border-radius: 999px;
65
+
66
+ opacity: 0;
67
+ background: ${cssVar.colorPrimary};
68
+
69
+ transition: opacity 120ms ease;
70
+ }
71
+
72
+ &:hover::after,
73
+ &:focus-visible::after {
74
+ opacity: 0.55;
75
+ }
76
+ `,
77
+ resizeHandleBottom: css`
78
+ cursor: ns-resize;
79
+ inset-block-end: -4px;
80
+ inset-inline: 16px;
81
+ height: 8px;
82
+
83
+ &::after {
84
+ inset-block-end: 3px;
85
+ inset-inline: 0;
86
+ height: 2px;
87
+ }
88
+ `,
89
+ resizeHandleBottomLeft: css`
90
+ cursor: nesw-resize;
91
+
92
+ inset-block-end: -5px;
93
+ inset-inline-start: -5px;
94
+
95
+ width: 16px;
96
+ height: 16px;
97
+ `,
98
+ resizeHandleBottomRight: css`
99
+ cursor: nwse-resize;
100
+
101
+ inset-block-end: -5px;
102
+ inset-inline-end: -5px;
103
+
104
+ width: 16px;
105
+ height: 16px;
106
+ `,
107
+ resizeHandleLeft: css`
108
+ cursor: ew-resize;
109
+ inset-block: 16px;
110
+ inset-inline-start: -4px;
111
+ width: 8px;
112
+
113
+ &::after {
114
+ inset-block: 0;
115
+ inset-inline-start: 3px;
116
+ width: 2px;
117
+ }
118
+ `,
119
+ resizeHandleRight: css`
120
+ cursor: ew-resize;
121
+ inset-block: 16px;
122
+ inset-inline-end: -4px;
123
+ width: 8px;
124
+
125
+ &::after {
126
+ inset-block: 0;
127
+ inset-inline-end: 3px;
128
+ width: 2px;
129
+ }
130
+ `,
131
+ resizeHandleTop: css`
132
+ cursor: ns-resize;
133
+ inset-block-start: -4px;
134
+ inset-inline: 16px;
135
+ height: 8px;
136
+
137
+ &::after {
138
+ inset-block-start: 3px;
139
+ inset-inline: 0;
140
+ height: 2px;
141
+ }
142
+ `,
143
+ resizeHandleTopLeft: css`
144
+ cursor: nwse-resize;
145
+
146
+ inset-block-start: -5px;
147
+ inset-inline-start: -5px;
148
+
149
+ width: 16px;
150
+ height: 16px;
151
+ `,
152
+ resizeHandleTopRight: css`
153
+ cursor: nesw-resize;
154
+
155
+ inset-block-start: -5px;
156
+ inset-inline-end: -5px;
157
+
158
+ width: 16px;
159
+ height: 16px;
160
+ `,
161
+ title: css`
162
+ overflow: hidden;
163
+ flex: 1;
164
+
165
+ min-width: 0;
166
+
167
+ text-overflow: ellipsis;
168
+ white-space: nowrap;
169
+ `,
170
+ wrapper: css`
171
+ overflow: hidden;
172
+ `
173
+ }));
174
+ //#endregion
175
+ export { styles };
176
+
177
+ //# sourceMappingURL=style.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/FloatingPanel/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n body: css`\n overflow: hidden auto;\n flex: 1;\n min-height: 0;\n padding: 0;\n `,\n close: css`\n position: static;\n\n width: 32px;\n height: 32px;\n margin-inline-end: -4px;\n border-radius: 8px;\n `,\n actions: css`\n display: flex;\n flex: none;\n gap: 4px;\n align-items: center;\n `,\n footer: css`\n flex: none;\n border-block-start: 1px solid ${cssVar.colorBorderSecondary};\n `,\n header: css`\n flex: none;\n min-height: 48px;\n border-block-end: 1px solid ${cssVar.colorBorderSecondary};\n `,\n headerActions: css`\n display: flex;\n flex: none;\n gap: 4px;\n align-items: center;\n `,\n panel: css`\n transform-origin: 100% 100%;\n\n width: calc(100dvw - 32px);\n max-height: calc(100dvh - 32px);\n border-radius: 12px;\n\n box-shadow:\n 0 6px 24px 0 rgb(0 0 0 / 8%),\n 0 2px 6px 0 rgb(0 0 0 / 4%);\n `,\n panelTop: css`\n transform-origin: 100% 0;\n `,\n resizeHandle: css`\n touch-action: none;\n position: absolute;\n z-index: 1;\n background: transparent;\n\n &::after {\n content: '';\n\n position: absolute;\n\n border-radius: 999px;\n\n opacity: 0;\n background: ${cssVar.colorPrimary};\n\n transition: opacity 120ms ease;\n }\n\n &:hover::after,\n &:focus-visible::after {\n opacity: 0.55;\n }\n `,\n resizeHandleBottom: css`\n cursor: ns-resize;\n inset-block-end: -4px;\n inset-inline: 16px;\n height: 8px;\n\n &::after {\n inset-block-end: 3px;\n inset-inline: 0;\n height: 2px;\n }\n `,\n resizeHandleBottomLeft: css`\n cursor: nesw-resize;\n\n inset-block-end: -5px;\n inset-inline-start: -5px;\n\n width: 16px;\n height: 16px;\n `,\n resizeHandleBottomRight: css`\n cursor: nwse-resize;\n\n inset-block-end: -5px;\n inset-inline-end: -5px;\n\n width: 16px;\n height: 16px;\n `,\n resizeHandleLeft: css`\n cursor: ew-resize;\n inset-block: 16px;\n inset-inline-start: -4px;\n width: 8px;\n\n &::after {\n inset-block: 0;\n inset-inline-start: 3px;\n width: 2px;\n }\n `,\n resizeHandleRight: css`\n cursor: ew-resize;\n inset-block: 16px;\n inset-inline-end: -4px;\n width: 8px;\n\n &::after {\n inset-block: 0;\n inset-inline-end: 3px;\n width: 2px;\n }\n `,\n resizeHandleTop: css`\n cursor: ns-resize;\n inset-block-start: -4px;\n inset-inline: 16px;\n height: 8px;\n\n &::after {\n inset-block-start: 3px;\n inset-inline: 0;\n height: 2px;\n }\n `,\n resizeHandleTopLeft: css`\n cursor: nwse-resize;\n\n inset-block-start: -5px;\n inset-inline-start: -5px;\n\n width: 16px;\n height: 16px;\n `,\n resizeHandleTopRight: css`\n cursor: nesw-resize;\n\n inset-block-start: -5px;\n inset-inline-end: -5px;\n\n width: 16px;\n height: 16px;\n `,\n title: css`\n overflow: hidden;\n flex: 1;\n\n min-width: 0;\n\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n wrapper: css`\n overflow: hidden;\n `,\n}));\n"],"mappings":";;AAEA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,MAAM,GAAG;;;;;;CAMT,OAAO,GAAG;;;;;;;;CAQV,SAAS,GAAG;;;;;;CAMZ,QAAQ,GAAG;;oCAEuB,OAAO,qBAAqB;;CAE9D,QAAQ,GAAG;;;kCAGqB,OAAO,qBAAqB;;CAE5D,eAAe,GAAG;;;;;;CAMlB,OAAO,GAAG;;;;;;;;;;;CAWV,UAAU,GAAG;;;CAGb,cAAc,GAAG;;;;;;;;;;;;;;oBAcC,OAAO,aAAa;;;;;;;;;;CAUtC,oBAAoB,GAAG;;;;;;;;;;;;CAYvB,wBAAwB,GAAG;;;;;;;;;CAS3B,yBAAyB,GAAG;;;;;;;;;CAS5B,kBAAkB,GAAG;;;;;;;;;;;;CAYrB,mBAAmB,GAAG;;;;;;;;;;;;CAYtB,iBAAiB,GAAG;;;;;;;;;;;;CAYpB,qBAAqB,GAAG;;;;;;;;;CASxB,sBAAsB,GAAG;;;;;;;;;CASzB,OAAO,GAAG;;;;;;;;;CASV,SAAS,GAAG;;;CAGb,EAAE"}
@@ -0,0 +1,75 @@
1
+ import { ModalRootProps } from "../Modal/atoms.mjs";
2
+ import { CSSProperties, ReactNode } from "react";
3
+ import { MotionProps } from "motion/react";
4
+
5
+ //#region src/base-ui/FloatingPanel/type.d.ts
6
+ type FloatingPanelPlacement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
7
+ type FloatingPanelOffset = number | string | {
8
+ x?: number | string;
9
+ y?: number | string;
10
+ };
11
+ interface FloatingPanelSize {
12
+ height: number;
13
+ width: number;
14
+ }
15
+ interface FloatingPanelProps {
16
+ actions?: ReactNode;
17
+ afterClose?: () => void;
18
+ ariaLabel?: string;
19
+ children?: ReactNode;
20
+ className?: string;
21
+ classNames?: {
22
+ backdrop?: string;
23
+ actions?: string;
24
+ body?: string;
25
+ close?: string;
26
+ footer?: string;
27
+ header?: string;
28
+ panel?: string;
29
+ resizeHandle?: string;
30
+ title?: string;
31
+ wrapper?: string;
32
+ };
33
+ closable?: boolean;
34
+ closeIcon?: ReactNode;
35
+ closeLabel?: string;
36
+ defaultOpen?: boolean;
37
+ footer?: ReactNode;
38
+ getContainer?: false | HTMLElement | null;
39
+ height?: number | string;
40
+ keyboard?: boolean;
41
+ mask?: boolean;
42
+ maskClosable?: boolean;
43
+ maxHeight?: number;
44
+ maxWidth?: number;
45
+ minHeight?: number;
46
+ minWidth?: number;
47
+ modal?: boolean;
48
+ motionProps?: MotionProps;
49
+ offset?: FloatingPanelOffset;
50
+ onClose?: () => void;
51
+ onOpenChange?: ModalRootProps['onOpenChange'];
52
+ onResize?: (size: FloatingPanelSize) => void;
53
+ onResizeEnd?: (size: FloatingPanelSize) => void;
54
+ open?: boolean;
55
+ placement?: FloatingPanelPlacement;
56
+ resizable?: boolean;
57
+ styles?: {
58
+ actions?: CSSProperties;
59
+ backdrop?: CSSProperties;
60
+ body?: CSSProperties;
61
+ close?: CSSProperties;
62
+ footer?: CSSProperties;
63
+ header?: CSSProperties;
64
+ panel?: CSSProperties;
65
+ resizeHandle?: CSSProperties;
66
+ title?: CSSProperties;
67
+ wrapper?: CSSProperties;
68
+ };
69
+ title?: ReactNode;
70
+ width?: number | string;
71
+ zIndex?: number;
72
+ }
73
+ //#endregion
74
+ export { FloatingPanelOffset, FloatingPanelPlacement, FloatingPanelProps };
75
+ //# sourceMappingURL=type.d.mts.map
@@ -3,14 +3,14 @@ import { SegmentedIndicator, SegmentedItem, SegmentedItemIcon, SegmentedItemLabe
3
3
  import { useCallback, useEffect, useLayoutEffect, useMemo, useRef } from "react";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { cx } from "antd-style";
6
- import useMergeState from "use-merge-value";
6
+ import useControlledState from "use-merge-value";
7
7
  //#region src/base-ui/Segmented/Segmented.tsx
8
8
  const normalizeOption = (option) => typeof option === "string" ? {
9
9
  label: option,
10
10
  value: option
11
11
  } : option;
12
12
  const Segmented = ({ block = false, className, classNames, defaultValue, disabled = false, glass = false, id, name, onChange, options, ref, shadow = false, size = "middle", style, styles: customStyles, value, variant = "filled", vertical = false }) => {
13
- const [innerValue, setInnerValue] = useMergeState(defaultValue, {
13
+ const [innerValue, setInnerValue] = useControlledState(defaultValue, {
14
14
  defaultValue,
15
15
  onChange: (next) => {
16
16
  if (next != null) onChange?.(next);
@@ -1 +1 @@
1
- {"version":3,"file":"Segmented.mjs","names":["useControlledState"],"sources":["../../../src/base-ui/Segmented/Segmented.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport {\n type CSSProperties,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport {\n SegmentedIndicator,\n SegmentedItem,\n SegmentedItemIcon,\n SegmentedItemLabel,\n SegmentedRoot,\n} from './atoms';\nimport type { SegmentedOption, SegmentedProps } from './type';\n\nconst normalizeOption = <Value extends string>(\n option: SegmentedOption<Value> | Value,\n): SegmentedOption<Value> =>\n typeof option === 'string' ? { label: option, value: option } : option;\n\nconst Segmented = <Value extends string = string>({\n block = false,\n className,\n classNames,\n defaultValue,\n disabled = false,\n glass = false,\n id,\n name,\n onChange,\n options,\n ref,\n shadow = false,\n size = 'middle',\n style,\n styles: customStyles,\n value,\n variant = 'filled',\n vertical = false,\n}: SegmentedProps<Value>) => {\n const [innerValue, setInnerValue] = useControlledState<Value | undefined>(defaultValue, {\n defaultValue,\n onChange: (next) => {\n if (next != null) onChange?.(next);\n },\n value,\n });\n\n const listRef = useRef<HTMLDivElement | null>(null);\n\n const mergedRef = useCallback(\n (node: HTMLDivElement | null) => {\n listRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.RefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n\n const normalizedOptions = useMemo(\n () => (options ?? []).map((o) => normalizeOption<Value>(o)),\n [options],\n );\n\n const updateIndicator = useCallback(() => {\n const list = listRef.current;\n if (!list) return;\n const active = list.querySelector<HTMLElement>('[data-segmented-item][data-pressed]');\n if (!active) {\n list.style.setProperty('--active-item-width', '0px');\n list.style.setProperty('--active-item-height', '0px');\n return;\n }\n list.style.setProperty('--active-item-left', `${active.offsetLeft}px`);\n list.style.setProperty('--active-item-top', `${active.offsetTop}px`);\n list.style.setProperty('--active-item-width', `${active.offsetWidth}px`);\n list.style.setProperty('--active-item-height', `${active.offsetHeight}px`);\n }, []);\n\n useLayoutEffect(() => {\n updateIndicator();\n }, [innerValue, normalizedOptions, vertical, size, block, updateIndicator]);\n\n useEffect(() => {\n const list = listRef.current;\n if (!list || typeof ResizeObserver === 'undefined') return;\n const ro = new ResizeObserver(() => updateIndicator());\n ro.observe(list);\n return () => ro.disconnect();\n }, [updateIndicator]);\n\n const groupValue = useMemo<Value[]>(() => (innerValue != null ? [innerValue] : []), [innerValue]);\n\n const rootStyle: CSSProperties = { ...style, ...customStyles?.root };\n\n return (\n <SegmentedRoot<Value>\n block={block}\n className={cx(classNames?.root, className)}\n disabled={disabled}\n glass={glass}\n id={id}\n orientation={vertical ? 'vertical' : 'horizontal'}\n ref={mergedRef}\n shadow={shadow}\n style={rootStyle}\n value={groupValue}\n variant={variant}\n onValueChange={(next) => {\n const picked = next[0];\n if (picked != null) setInnerValue(picked);\n }}\n >\n <SegmentedIndicator className={classNames?.indicator} style={customStyles?.indicator} />\n {normalizedOptions.map((opt) => (\n <SegmentedItem<Value>\n aria-label={typeof opt.label === 'string' ? opt.label : undefined}\n block={block}\n className={cx(classNames?.item, opt.className)}\n data-segmented-item=\"\"\n disabled={disabled || opt.disabled}\n key={opt.value}\n name={name}\n size={size}\n style={customStyles?.item}\n title={opt.title}\n value={opt.value}\n >\n {opt.icon != null && (\n <SegmentedItemIcon className={classNames?.itemIcon} style={customStyles?.itemIcon}>\n {opt.icon}\n </SegmentedItemIcon>\n )}\n {opt.label != null && (\n <SegmentedItemLabel className={classNames?.itemLabel} style={customStyles?.itemLabel}>\n {opt.label}\n </SegmentedItemLabel>\n )}\n </SegmentedItem>\n ))}\n </SegmentedRoot>\n );\n};\n\nSegmented.displayName = 'Segmented';\n\nexport default Segmented;\n"],"mappings":";;;;;;;AAsBA,MAAM,mBACJ,WAEA,OAAO,WAAW,WAAW;CAAE,OAAO;CAAQ,OAAO;CAAQ,GAAG;AAElE,MAAM,aAA4C,EAChD,QAAQ,OACR,WACA,YACA,cACA,WAAW,OACX,QAAQ,OACR,IACA,MACA,UACA,SACA,KACA,SAAS,OACT,OAAO,UACP,OACA,QAAQ,cACR,OACA,UAAU,UACV,WAAW,YACgB;CAC3B,MAAM,CAAC,YAAY,iBAAiBA,cAAsC,cAAc;EACtF;EACA,WAAW,SAAS;AAClB,OAAI,QAAQ,KAA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AC,eAAD;EACS;EACP,WAAW,GAAG,YAAY,MAAM,UAAU;EAChC;EACH;EACH;EACJ,aAAa,WAAW,aAAa;EACrC,KAAK;EACG;EACR,OAAO;EACP,OAAO;EACE;EACT,gBAAgB,SAAS;GACvB,MAAM,SAAS,KAAK;AACpB,OAAI,UAAU,KAAM,eAAc,OAAO;;YAd7C,CAiBE,oBAAC,oBAAD;GAAoB,WAAW,YAAY;GAAW,OAAO,cAAc;GAAa,CAAA,EACvF,kBAAkB,KAAK,QACtB,qBAAC,eAAD;GACE,cAAY,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ,KAAA;GACjD;GACP,WAAW,GAAG,YAAY,MAAM,IAAI,UAAU;GAC9C,uBAAoB;GACpB,UAAU,YAAY,IAAI;GAEpB;GACA;GACN,OAAO,cAAc;GACrB,OAAO,IAAI;GACX,OAAO,IAAI;aAXb,CAaG,IAAI,QAAQ,QACX,oBAAC,mBAAD;IAAmB,WAAW,YAAY;IAAU,OAAO,cAAc;cACtE,IAAI;IACa,CAAA,EAErB,IAAI,SAAS,QACZ,oBAAC,oBAAD;IAAoB,WAAW,YAAY;IAAW,OAAO,cAAc;cACxE,IAAI;IACc,CAAA,CAET;KAjBT,IAAI,MAiBK,CAChB,CACY;;;AAIpB,UAAU,cAAc"}
1
+ {"version":3,"file":"Segmented.mjs","names":[],"sources":["../../../src/base-ui/Segmented/Segmented.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport {\n type CSSProperties,\n useCallback,\n useEffect,\n useLayoutEffect,\n useMemo,\n useRef,\n} from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport {\n SegmentedIndicator,\n SegmentedItem,\n SegmentedItemIcon,\n SegmentedItemLabel,\n SegmentedRoot,\n} from './atoms';\nimport type { SegmentedOption, SegmentedProps } from './type';\n\nconst normalizeOption = <Value extends string>(\n option: SegmentedOption<Value> | Value,\n): SegmentedOption<Value> =>\n typeof option === 'string' ? { label: option, value: option } : option;\n\nconst Segmented = <Value extends string = string>({\n block = false,\n className,\n classNames,\n defaultValue,\n disabled = false,\n glass = false,\n id,\n name,\n onChange,\n options,\n ref,\n shadow = false,\n size = 'middle',\n style,\n styles: customStyles,\n value,\n variant = 'filled',\n vertical = false,\n}: SegmentedProps<Value>) => {\n const [innerValue, setInnerValue] = useControlledState<Value | undefined>(defaultValue, {\n defaultValue,\n onChange: (next) => {\n if (next != null) onChange?.(next);\n },\n value,\n });\n\n const listRef = useRef<HTMLDivElement | null>(null);\n\n const mergedRef = useCallback(\n (node: HTMLDivElement | null) => {\n listRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) (ref as React.RefObject<HTMLDivElement | null>).current = node;\n },\n [ref],\n );\n\n const normalizedOptions = useMemo(\n () => (options ?? []).map((o) => normalizeOption<Value>(o)),\n [options],\n );\n\n const updateIndicator = useCallback(() => {\n const list = listRef.current;\n if (!list) return;\n const active = list.querySelector<HTMLElement>('[data-segmented-item][data-pressed]');\n if (!active) {\n list.style.setProperty('--active-item-width', '0px');\n list.style.setProperty('--active-item-height', '0px');\n return;\n }\n list.style.setProperty('--active-item-left', `${active.offsetLeft}px`);\n list.style.setProperty('--active-item-top', `${active.offsetTop}px`);\n list.style.setProperty('--active-item-width', `${active.offsetWidth}px`);\n list.style.setProperty('--active-item-height', `${active.offsetHeight}px`);\n }, []);\n\n useLayoutEffect(() => {\n updateIndicator();\n }, [innerValue, normalizedOptions, vertical, size, block, updateIndicator]);\n\n useEffect(() => {\n const list = listRef.current;\n if (!list || typeof ResizeObserver === 'undefined') return;\n const ro = new ResizeObserver(() => updateIndicator());\n ro.observe(list);\n return () => ro.disconnect();\n }, [updateIndicator]);\n\n const groupValue = useMemo<Value[]>(() => (innerValue != null ? [innerValue] : []), [innerValue]);\n\n const rootStyle: CSSProperties = { ...style, ...customStyles?.root };\n\n return (\n <SegmentedRoot<Value>\n block={block}\n className={cx(classNames?.root, className)}\n disabled={disabled}\n glass={glass}\n id={id}\n orientation={vertical ? 'vertical' : 'horizontal'}\n ref={mergedRef}\n shadow={shadow}\n style={rootStyle}\n value={groupValue}\n variant={variant}\n onValueChange={(next) => {\n const picked = next[0];\n if (picked != null) setInnerValue(picked);\n }}\n >\n <SegmentedIndicator className={classNames?.indicator} style={customStyles?.indicator} />\n {normalizedOptions.map((opt) => (\n <SegmentedItem<Value>\n aria-label={typeof opt.label === 'string' ? opt.label : undefined}\n block={block}\n className={cx(classNames?.item, opt.className)}\n data-segmented-item=\"\"\n disabled={disabled || opt.disabled}\n key={opt.value}\n name={name}\n size={size}\n style={customStyles?.item}\n title={opt.title}\n value={opt.value}\n >\n {opt.icon != null && (\n <SegmentedItemIcon className={classNames?.itemIcon} style={customStyles?.itemIcon}>\n {opt.icon}\n </SegmentedItemIcon>\n )}\n {opt.label != null && (\n <SegmentedItemLabel className={classNames?.itemLabel} style={customStyles?.itemLabel}>\n {opt.label}\n </SegmentedItemLabel>\n )}\n </SegmentedItem>\n ))}\n </SegmentedRoot>\n );\n};\n\nSegmented.displayName = 'Segmented';\n\nexport default Segmented;\n"],"mappings":";;;;;;;AAsBA,MAAM,mBACJ,WAEA,OAAO,WAAW,WAAW;CAAE,OAAO;CAAQ,OAAO;CAAQ,GAAG;AAElE,MAAM,aAA4C,EAChD,QAAQ,OACR,WACA,YACA,cACA,WAAW,OACX,QAAQ,OACR,IACA,MACA,UACA,SACA,KACA,SAAS,OACT,OAAO,UACP,OACA,QAAQ,cACR,OACA,UAAU,UACV,WAAW,YACgB;CAC3B,MAAM,CAAC,YAAY,iBAAiB,mBAAsC,cAAc;EACtF;EACA,WAAW,SAAS;AAClB,OAAI,QAAQ,KAAM,YAAW,KAAK;;EAEpC;EACD,CAAC;CAEF,MAAM,UAAU,OAA8B,KAAK;CAEnD,MAAM,YAAY,aACf,SAAgC;AAC/B,UAAQ,UAAU;AAClB,MAAI,OAAO,QAAQ,WAAY,KAAI,KAAK;WAC/B,IAAM,KAA+C,UAAU;IAE1E,CAAC,IAAI,CACN;CAED,MAAM,oBA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E,oBAAC,oBAAD;GAAoB,WAAW,YAAY;GAAW,OAAO,cAAc;GAAa,CAAA,EACvF,kBAAkB,KAAK,QACtB,qBAAC,eAAD;GACE,cAAY,OAAO,IAAI,UAAU,WAAW,IAAI,QAAQ,KAAA;GACjD;GACP,WAAW,GAAG,YAAY,MAAM,IAAI,UAAU;GAC9C,uBAAoB;GACpB,UAAU,YAAY,IAAI;GAEpB;GACA;GACN,OAAO,cAAc;GACrB,OAAO,IAAI;GACX,OAAO,IAAI;aAXb,CAaG,IAAI,QAAQ,QACX,oBAAC,mBAAD;IAAmB,WAAW,YAAY;IAAU,OAAO,cAAc;cACtE,IAAI;IACa,CAAA,EAErB,IAAI,SAAS,QACZ,oBAAC,oBAAD;IAAoB,WAAW,YAAY;IAAW,OAAO,cAAc;cACxE,IAAI;IACc,CAAA,CAET;KAjBT,IAAI,MAiBK,CAChB,CACY;;;AAIpB,UAAU,cAAc"}
@@ -136,7 +136,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
136
136
  `,
137
137
  listFilled: css`
138
138
  border: 1px solid ${cssVar.colorFillQuaternary};
139
- background: ${cssVar.colorFillTertiary};
139
+ background: ${cssVar.colorBgLayout};
140
140
  `,
141
141
  listGlass: staticStylish.blur,
142
142
  listOutlined: css`
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../../src/base-ui/Segmented/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n indicator: css`\n pointer-events: none;\n\n position: absolute;\n z-index: 0;\n inset-block-start: var(--active-item-top);\n inset-inline-start: var(--active-item-left);\n\n width: var(--active-item-width);\n height: var(--active-item-height);\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n box-shadow: ${cssVar.boxShadowTertiary};\n\n transition-timing-function: ${cssVar.motionEaseOut};\n transition-duration: 240ms;\n transition-property: inset-inline-start, inset-block-start, width, height;\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n item: css`\n cursor: pointer;\n user-select: none;\n\n position: relative;\n z-index: 1;\n\n display: inline-flex;\n flex-shrink: 0;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 0;\n\n font-weight: 500;\n color: ${cssVar.colorTextSecondary};\n white-space: nowrap;\n\n background: transparent;\n outline: none;\n\n transition:\n color 120ms ${cssVar.motionEaseOut},\n transform 120ms ${cssVar.motionEaseOut};\n\n &:hover:not([data-disabled], [data-pressed]) {\n color: ${cssVar.colorText};\n }\n\n &:active:not([data-disabled]) {\n transform: scale(0.98);\n }\n\n &:focus-visible {\n border-radius: ${cssVar.borderRadius};\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: -2px;\n }\n\n &[data-pressed] {\n color: ${cssVar.colorText};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n itemBlock: css`\n flex: 1 1 0;\n `,\n itemIcon: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n `,\n itemLabel: css`\n display: inline-flex;\n align-items: center;\n `,\n itemLarge: css`\n height: 36px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n itemMiddle: css`\n height: 32px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadius};\n font-size: 13px;\n `,\n itemSmall: css`\n height: 26px;\n padding-inline: 10px;\n border-radius: ${cssVar.borderRadius};\n font-size: 12px;\n `,\n list: css`\n position: relative;\n\n display: inline-flex;\n flex-wrap: nowrap;\n gap: 4px;\n align-items: center;\n align-self: flex-start;\n\n box-sizing: border-box;\n padding: 3px;\n border-radius: ${cssVar.borderRadiusLG};\n\n &[data-orientation='vertical'] {\n flex-direction: column;\n align-items: stretch;\n align-self: stretch;\n }\n `,\n listBlock: css`\n display: flex;\n align-self: stretch;\n width: 100%;\n `,\n listFilled: css`\n border: 1px solid ${cssVar.colorFillQuaternary};\n background: ${cssVar.colorFillTertiary};\n `,\n listGlass: lobeStaticStylish.blur,\n listOutlined: css`\n border: 1px solid ${cssVar.colorBorderSecondary};\n background: transparent;\n `,\n listShadow: lobeStaticStylish.shadow,\n root: css`\n display: inline-flex;\n\n &[data-block='true'] {\n display: flex;\n width: 100%;\n }\n `,\n}));\n\nexport const listVariants = cva(styles.list, {\n defaultVariants: {\n block: false,\n glass: false,\n shadow: false,\n variant: 'filled',\n },\n variants: {\n block: {\n false: null,\n true: styles.listBlock,\n },\n glass: {\n false: null,\n true: styles.listGlass,\n },\n shadow: {\n false: null,\n true: styles.listShadow,\n },\n variant: {\n filled: styles.listFilled,\n outlined: styles.listOutlined,\n },\n },\n});\n\nexport const itemVariants = cva(styles.item, {\n defaultVariants: {\n block: false,\n size: 'middle',\n },\n variants: {\n block: {\n false: null,\n true: styles.itemBlock,\n },\n size: {\n large: styles.itemLarge,\n middle: styles.itemMiddle,\n small: styles.itemSmall,\n },\n },\n});\n"],"mappings":";;;;AAKA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,WAAW,GAAG;;;;;;;;;;qBAUK,OAAO,aAAa;;kBAEvB,OAAO,gBAAgB;kBACvB,OAAO,kBAAkB;;kCAET,OAAO,cAAc;;;;;;;;CAQrD,MAAM,GAAG;;;;;;;;;;;;;;;;;aAiBE,OAAO,mBAAmB;;;;;;;oBAOnB,OAAO,cAAc;wBACjB,OAAO,cAAc;;;eAG9B,OAAO,UAAU;;;;;;;;uBAQT,OAAO,aAAa;2BAChB,OAAO,mBAAmB;;;;;eAKtC,OAAO,UAAU;;;;;eAKjB,OAAO,kBAAkB;;;;;;;CAOtC,WAAW,GAAG;;;CAGd,UAAU,GAAG;;;;;CAKb,WAAW,GAAG;;;;CAId,WAAW,GAAG;;;qBAGK,OAAO,aAAa;;;CAGvC,YAAY,GAAG;;;qBAGI,OAAO,aAAa;;;CAGvC,WAAW,GAAG;;;qBAGK,OAAO,aAAa;;;CAGvC,MAAM,GAAG;;;;;;;;;;;qBAWU,OAAO,eAAe;;;;;;;;CAQzC,WAAW,GAAG;;;;;CAKd,YAAY,GAAG;wBACO,OAAO,oBAAoB;kBACjC,OAAO,kBAAkB;;CAEzC,WAAWA,cAAkB;CAC7B,cAAc,GAAG;wBACK,OAAO,qBAAqB;;;CAGlD,YAAYA,cAAkB;CAC9B,MAAM,GAAG;;;;;;;;CAQV,EAAE;AAEH,MAAa,eAAe,IAAI,OAAO,MAAM;CAC3C,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,QAAQ;EACR,SAAS;EACV;CACD,UAAU;EACR,OAAO;GACL,OAAO;GACP,MAAM,OAAO;GACd;EACD,OAAO;GACL,OAAO;GACP,MAAM,OAAO;GACd;EACD,QAAQ;GACN,OAAO;GACP,MAAM,OAAO;GACd;EACD,SAAS;GACP,QAAQ,OAAO;GACf,UAAU,OAAO;GAClB;EACF;CACF,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,MAAM;CAC3C,iBAAiB;EACf,OAAO;EACP,MAAM;EACP;CACD,UAAU;EACR,OAAO;GACL,OAAO;GACP,MAAM,OAAO;GACd;EACD,MAAM;GACJ,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,OAAO,OAAO;GACf;EACF;CACF,CAAC"}
1
+ {"version":3,"file":"style.mjs","names":["lobeStaticStylish"],"sources":["../../../src/base-ui/Segmented/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nimport { lobeStaticStylish } from '@/styles';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n indicator: css`\n pointer-events: none;\n\n position: absolute;\n z-index: 0;\n inset-block-start: var(--active-item-top);\n inset-inline-start: var(--active-item-left);\n\n width: var(--active-item-width);\n height: var(--active-item-height);\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n box-shadow: ${cssVar.boxShadowTertiary};\n\n transition-timing-function: ${cssVar.motionEaseOut};\n transition-duration: 240ms;\n transition-property: inset-inline-start, inset-block-start, width, height;\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n item: css`\n cursor: pointer;\n user-select: none;\n\n position: relative;\n z-index: 1;\n\n display: inline-flex;\n flex-shrink: 0;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 0;\n\n font-weight: 500;\n color: ${cssVar.colorTextSecondary};\n white-space: nowrap;\n\n background: transparent;\n outline: none;\n\n transition:\n color 120ms ${cssVar.motionEaseOut},\n transform 120ms ${cssVar.motionEaseOut};\n\n &:hover:not([data-disabled], [data-pressed]) {\n color: ${cssVar.colorText};\n }\n\n &:active:not([data-disabled]) {\n transform: scale(0.98);\n }\n\n &:focus-visible {\n border-radius: ${cssVar.borderRadius};\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: -2px;\n }\n\n &[data-pressed] {\n color: ${cssVar.colorText};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n itemBlock: css`\n flex: 1 1 0;\n `,\n itemIcon: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n `,\n itemLabel: css`\n display: inline-flex;\n align-items: center;\n `,\n itemLarge: css`\n height: 36px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n itemMiddle: css`\n height: 32px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadius};\n font-size: 13px;\n `,\n itemSmall: css`\n height: 26px;\n padding-inline: 10px;\n border-radius: ${cssVar.borderRadius};\n font-size: 12px;\n `,\n list: css`\n position: relative;\n\n display: inline-flex;\n flex-wrap: nowrap;\n gap: 4px;\n align-items: center;\n align-self: flex-start;\n\n box-sizing: border-box;\n padding: 3px;\n border-radius: ${cssVar.borderRadiusLG};\n\n &[data-orientation='vertical'] {\n flex-direction: column;\n align-items: stretch;\n align-self: stretch;\n }\n `,\n listBlock: css`\n display: flex;\n align-self: stretch;\n width: 100%;\n `,\n listFilled: css`\n border: 1px solid ${cssVar.colorFillQuaternary};\n background: ${cssVar.colorBgLayout};\n `,\n listGlass: lobeStaticStylish.blur,\n listOutlined: css`\n border: 1px solid ${cssVar.colorBorderSecondary};\n background: transparent;\n `,\n listShadow: lobeStaticStylish.shadow,\n root: css`\n display: inline-flex;\n\n &[data-block='true'] {\n display: flex;\n width: 100%;\n }\n `,\n}));\n\nexport const listVariants = cva(styles.list, {\n defaultVariants: {\n block: false,\n glass: false,\n shadow: false,\n variant: 'filled',\n },\n variants: {\n block: {\n false: null,\n true: styles.listBlock,\n },\n glass: {\n false: null,\n true: styles.listGlass,\n },\n shadow: {\n false: null,\n true: styles.listShadow,\n },\n variant: {\n filled: styles.listFilled,\n outlined: styles.listOutlined,\n },\n },\n});\n\nexport const itemVariants = cva(styles.item, {\n defaultVariants: {\n block: false,\n size: 'middle',\n },\n variants: {\n block: {\n false: null,\n true: styles.itemBlock,\n },\n size: {\n large: styles.itemLarge,\n middle: styles.itemMiddle,\n small: styles.itemSmall,\n },\n },\n});\n"],"mappings":";;;;AAKA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,WAAW,GAAG;;;;;;;;;;qBAUK,OAAO,aAAa;;kBAEvB,OAAO,gBAAgB;kBACvB,OAAO,kBAAkB;;kCAET,OAAO,cAAc;;;;;;;;CAQrD,MAAM,GAAG;;;;;;;;;;;;;;;;;aAiBE,OAAO,mBAAmB;;;;;;;oBAOnB,OAAO,cAAc;wBACjB,OAAO,cAAc;;;eAG9B,OAAO,UAAU;;;;;;;;uBAQT,OAAO,aAAa;2BAChB,OAAO,mBAAmB;;;;;eAKtC,OAAO,UAAU;;;;;eAKjB,OAAO,kBAAkB;;;;;;;CAOtC,WAAW,GAAG;;;CAGd,UAAU,GAAG;;;;;CAKb,WAAW,GAAG;;;;CAId,WAAW,GAAG;;;qBAGK,OAAO,aAAa;;;CAGvC,YAAY,GAAG;;;qBAGI,OAAO,aAAa;;;CAGvC,WAAW,GAAG;;;qBAGK,OAAO,aAAa;;;CAGvC,MAAM,GAAG;;;;;;;;;;;qBAWU,OAAO,eAAe;;;;;;;;CAQzC,WAAW,GAAG;;;;;CAKd,YAAY,GAAG;wBACO,OAAO,oBAAoB;kBACjC,OAAO,cAAc;;CAErC,WAAWA,cAAkB;CAC7B,cAAc,GAAG;wBACK,OAAO,qBAAqB;;;CAGlD,YAAYA,cAAkB;CAC9B,MAAM,GAAG;;;;;;;;CAQV,EAAE;AAEH,MAAa,eAAe,IAAI,OAAO,MAAM;CAC3C,iBAAiB;EACf,OAAO;EACP,OAAO;EACP,QAAQ;EACR,SAAS;EACV;CACD,UAAU;EACR,OAAO;GACL,OAAO;GACP,MAAM,OAAO;GACd;EACD,OAAO;GACL,OAAO;GACP,MAAM,OAAO;GACd;EACD,QAAQ;GACN,OAAO;GACP,MAAM,OAAO;GACd;EACD,SAAS;GACP,QAAQ,OAAO;GACf,UAAU,OAAO;GAClB;EACF;CACF,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,MAAM;CAC3C,iBAAiB;EACf,OAAO;EACP,MAAM;EACP;CACD,UAAU;EACR,OAAO;GACL,OAAO;GACP,MAAM,OAAO;GACd;EACD,MAAM;GACJ,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,OAAO,OAAO;GACf;EACF;CACF,CAAC"}
@@ -5,7 +5,7 @@ import { createContext, use, useMemo, useRef, useState } from "react";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { cx } from "antd-style";
7
7
  import { useReducedMotion } from "motion/react";
8
- import useMergeState from "use-merge-value";
8
+ import useControlledState from "use-merge-value";
9
9
  import { Switch } from "@base-ui/react/switch";
10
10
  //#region src/base-ui/Switch/atoms.tsx
11
11
  const SwitchContext = createContext(null);
@@ -18,7 +18,7 @@ const SwitchRoot = ({ checked, className, defaultChecked, onCheckedChange, onCli
18
18
  const Motion = useMotionComponent();
19
19
  const [isPressed, setIsPressed] = useState(false);
20
20
  const lastEventRef = useRef(null);
21
- const [isChecked, setIsChecked] = useMergeState(defaultChecked ?? false, {
21
+ const [isChecked, setIsChecked] = useControlledState(defaultChecked ?? false, {
22
22
  defaultValue: defaultChecked,
23
23
  onChange: (value) => {
24
24
  if (lastEventRef.current) onCheckedChange?.(value, lastEventRef.current);
@@ -1 +1 @@
1
- {"version":3,"file":"atoms.mjs","names":["useControlledState"],"sources":["../../../src/base-ui/Switch/atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Switch } from '@base-ui/react/switch';\nimport { cx } from 'antd-style';\nimport { useReducedMotion } from 'motion/react';\nimport type { KeyboardEvent, MouseEvent } from 'react';\nimport { createContext, use, useMemo, useRef, useState } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { rootVariants, styles, thumbVariants } from './style';\nimport type {\n SwitchChangeEventHandler,\n SwitchContextType,\n SwitchIconPosition,\n SwitchIconProps,\n SwitchRootProps,\n SwitchThumbProps,\n} from './type';\n\nconst SwitchContext = createContext<SwitchContextType | null>(null);\n\nexport const useSwitchContext = () => {\n const context = use(SwitchContext);\n if (!context) {\n throw new Error('useSwitchContext must be used within a SwitchRoot');\n }\n return context;\n};\n\ntype SwitchRootInternalProps = Omit<SwitchRootProps, 'onCheckedChange' | 'onClick'> & {\n onCheckedChange?: SwitchChangeEventHandler;\n onClick?: SwitchChangeEventHandler;\n};\n\nexport const SwitchRoot = ({\n checked,\n className,\n defaultChecked,\n onCheckedChange,\n onClick,\n size = 'default',\n children,\n disabled,\n readOnly,\n required,\n inputRef,\n id,\n name,\n ...rest\n}: SwitchRootInternalProps) => {\n const Motion = useMotionComponent();\n const [isPressed, setIsPressed] = useState(false);\n const lastEventRef = useRef<MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>>(\n null,\n );\n\n const [isChecked, setIsChecked] = useControlledState(defaultChecked ?? false, {\n defaultValue: defaultChecked,\n onChange: (value: boolean) => {\n if (lastEventRef.current) {\n onCheckedChange?.(value, lastEventRef.current);\n }\n },\n value: checked,\n });\n\n const baseClassName = rootVariants({ size });\n\n const contextValue = useMemo(\n () => ({\n isChecked: Boolean(isChecked),\n isPressed,\n setIsChecked: (value: boolean) => setIsChecked(value),\n setIsPressed,\n }),\n [isChecked, isPressed, setIsChecked],\n );\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n lastEventRef.current = event;\n onClick?.(!isChecked, event);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n lastEventRef.current = event;\n }\n (rest as any).onKeyDown?.(event);\n };\n\n return (\n <SwitchContext value={contextValue}>\n <Switch.Root\n checked={isChecked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n id={id}\n inputRef={inputRef}\n name={name}\n readOnly={readOnly}\n required={required}\n render={\n <Motion.button\n {...rest}\n className={cx(baseClassName, className)}\n initial={false}\n whileTap=\"tap\"\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onTap={() => setIsPressed(false)}\n onTapCancel={() => setIsPressed(false)}\n onTapStart={() => setIsPressed(true)}\n />\n }\n onCheckedChange={setIsChecked}\n >\n {children}\n </Switch.Root>\n </SwitchContext>\n );\n};\n\nSwitchRoot.displayName = 'SwitchRoot';\n\nexport const SwitchThumb = ({\n className,\n pressedAnimation,\n size = 'default',\n transition = { damping: 24, stiffness: 360, type: 'spring' },\n children,\n ...rest\n}: SwitchThumbProps) => {\n const Motion = useMotionComponent();\n const { isPressed } = useSwitchContext();\n const shouldReduceMotion = useReducedMotion();\n const baseClassName = thumbVariants({ size });\n\n const defaultPressedAnimation = {\n width: size === 'small' ? 16 : 22,\n };\n\n const effectiveAnimate =\n !shouldReduceMotion && isPressed ? pressedAnimation || defaultPressedAnimation : undefined;\n const effectiveTransition = shouldReduceMotion ? { duration: 0 } : transition;\n\n return (\n <Switch.Thumb\n render={\n <Motion.span\n layout\n animate={effectiveAnimate}\n className={cx(baseClassName, className)}\n transition={effectiveTransition}\n {...rest}\n >\n {children}\n </Motion.span>\n }\n />\n );\n};\n\nSwitchThumb.displayName = 'SwitchThumb';\n\nconst getIconPositionClass = (position: SwitchIconPosition, size: 'default' | 'small') => {\n if (position === 'thumb') return styles.iconThumb;\n if (position === 'left') return size === 'small' ? styles.iconLeftSmall : styles.iconLeft;\n return size === 'small' ? styles.iconRightSmall : styles.iconRight;\n};\n\nexport const SwitchIcon = ({\n children,\n className,\n position,\n size = 'default',\n transition = { bounce: 0, type: 'spring' },\n ...rest\n}: SwitchIconProps) => {\n const Motion = useMotionComponent();\n const { isChecked } = useSwitchContext();\n const shouldReduceMotion = useReducedMotion();\n\n const isAnimated = useMemo(() => {\n if (position === 'right') return !isChecked;\n if (position === 'left') return isChecked;\n if (position === 'thumb') return true;\n return false;\n }, [position, isChecked]);\n\n const positionClass = getIconPositionClass(position, size);\n const effectiveTransition = shouldReduceMotion ? { duration: 0 } : transition;\n\n return (\n <Motion.span\n animate={isAnimated ? { opacity: 1, scale: 1 } : { opacity: 0, scale: 0 }}\n className={cx(styles.icon, positionClass, className)}\n transition={effectiveTransition}\n {...rest}\n >\n {children}\n </Motion.span>\n );\n};\n\nSwitchIcon.displayName = 'SwitchIcon';\n\nexport { styles as switchStyles } from './style';\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,gBAAgB,cAAwC,KAAK;AAEnE,MAAa,yBAAyB;CACpC,MAAM,UAAU,IAAI,cAAc;AAClC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAoD;AAEtE,QAAO;;AAQT,MAAa,cAAc,EACzB,SACA,WACA,gBACA,iBACA,SACA,OAAO,WACP,UACA,UACA,UACA,UACA,UACA,IACA,MACA,GAAG,WAC0B;CAC7B,MAAM,SAAS,oBAAoB;CACnC,MAAM,CAAC,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atoms.tsx"],"sourcesContent":["'use client';\n\nimport { Switch } from '@base-ui/react/switch';\nimport { cx } from 'antd-style';\nimport { useReducedMotion } from 'motion/react';\nimport type { KeyboardEvent, MouseEvent } from 'react';\nimport { createContext, use, useMemo, useRef, useState } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { useMotionComponent } from '@/MotionProvider';\n\nimport { rootVariants, styles, thumbVariants } from './style';\nimport type {\n SwitchChangeEventHandler,\n SwitchContextType,\n SwitchIconPosition,\n SwitchIconProps,\n SwitchRootProps,\n SwitchThumbProps,\n} from './type';\n\nconst SwitchContext = createContext<SwitchContextType | null>(null);\n\nexport const useSwitchContext = () => {\n const context = use(SwitchContext);\n if (!context) {\n throw new Error('useSwitchContext must be used within a SwitchRoot');\n }\n return context;\n};\n\ntype SwitchRootInternalProps = Omit<SwitchRootProps, 'onCheckedChange' | 'onClick'> & {\n onCheckedChange?: SwitchChangeEventHandler;\n onClick?: SwitchChangeEventHandler;\n};\n\nexport const SwitchRoot = ({\n checked,\n className,\n defaultChecked,\n onCheckedChange,\n onClick,\n size = 'default',\n children,\n disabled,\n readOnly,\n required,\n inputRef,\n id,\n name,\n ...rest\n}: SwitchRootInternalProps) => {\n const Motion = useMotionComponent();\n const [isPressed, setIsPressed] = useState(false);\n const lastEventRef = useRef<MouseEvent<HTMLButtonElement> | KeyboardEvent<HTMLButtonElement>>(\n null,\n );\n\n const [isChecked, setIsChecked] = useControlledState(defaultChecked ?? false, {\n defaultValue: defaultChecked,\n onChange: (value: boolean) => {\n if (lastEventRef.current) {\n onCheckedChange?.(value, lastEventRef.current);\n }\n },\n value: checked,\n });\n\n const baseClassName = rootVariants({ size });\n\n const contextValue = useMemo(\n () => ({\n isChecked: Boolean(isChecked),\n isPressed,\n setIsChecked: (value: boolean) => setIsChecked(value),\n setIsPressed,\n }),\n [isChecked, isPressed, setIsChecked],\n );\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n lastEventRef.current = event;\n onClick?.(!isChecked, event);\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n lastEventRef.current = event;\n }\n (rest as any).onKeyDown?.(event);\n };\n\n return (\n <SwitchContext value={contextValue}>\n <Switch.Root\n checked={isChecked}\n defaultChecked={defaultChecked}\n disabled={disabled}\n id={id}\n inputRef={inputRef}\n name={name}\n readOnly={readOnly}\n required={required}\n render={\n <Motion.button\n {...rest}\n className={cx(baseClassName, className)}\n initial={false}\n whileTap=\"tap\"\n onClick={handleClick}\n onKeyDown={handleKeyDown}\n onTap={() => setIsPressed(false)}\n onTapCancel={() => setIsPressed(false)}\n onTapStart={() => setIsPressed(true)}\n />\n }\n onCheckedChange={setIsChecked}\n >\n {children}\n </Switch.Root>\n </SwitchContext>\n );\n};\n\nSwitchRoot.displayName = 'SwitchRoot';\n\nexport const SwitchThumb = ({\n className,\n pressedAnimation,\n size = 'default',\n transition = { damping: 24, stiffness: 360, type: 'spring' },\n children,\n ...rest\n}: SwitchThumbProps) => {\n const Motion = useMotionComponent();\n const { isPressed } = useSwitchContext();\n const shouldReduceMotion = useReducedMotion();\n const baseClassName = thumbVariants({ size });\n\n const defaultPressedAnimation = {\n width: size === 'small' ? 16 : 22,\n };\n\n const effectiveAnimate =\n !shouldReduceMotion && isPressed ? pressedAnimation || defaultPressedAnimation : undefined;\n const effectiveTransition = shouldReduceMotion ? { duration: 0 } : transition;\n\n return (\n <Switch.Thumb\n render={\n <Motion.span\n layout\n animate={effectiveAnimate}\n className={cx(baseClassName, className)}\n transition={effectiveTransition}\n {...rest}\n >\n {children}\n </Motion.span>\n }\n />\n );\n};\n\nSwitchThumb.displayName = 'SwitchThumb';\n\nconst getIconPositionClass = (position: SwitchIconPosition, size: 'default' | 'small') => {\n if (position === 'thumb') return styles.iconThumb;\n if (position === 'left') return size === 'small' ? styles.iconLeftSmall : styles.iconLeft;\n return size === 'small' ? styles.iconRightSmall : styles.iconRight;\n};\n\nexport const SwitchIcon = ({\n children,\n className,\n position,\n size = 'default',\n transition = { bounce: 0, type: 'spring' },\n ...rest\n}: SwitchIconProps) => {\n const Motion = useMotionComponent();\n const { isChecked } = useSwitchContext();\n const shouldReduceMotion = useReducedMotion();\n\n const isAnimated = useMemo(() => {\n if (position === 'right') return !isChecked;\n if (position === 'left') return isChecked;\n if (position === 'thumb') return true;\n return false;\n }, [position, isChecked]);\n\n const positionClass = getIconPositionClass(position, size);\n const effectiveTransition = shouldReduceMotion ? { duration: 0 } : transition;\n\n return (\n <Motion.span\n animate={isAnimated ? { opacity: 1, scale: 1 } : { opacity: 0, scale: 0 }}\n className={cx(styles.icon, positionClass, className)}\n transition={effectiveTransition}\n {...rest}\n >\n {children}\n </Motion.span>\n );\n};\n\nSwitchIcon.displayName = 'SwitchIcon';\n\nexport { styles as switchStyles } from './style';\n"],"mappings":";;;;;;;;;;AAqBA,MAAM,gBAAgB,cAAwC,KAAK;AAEnE,MAAa,yBAAyB;CACpC,MAAM,UAAU,IAAI,cAAc;AAClC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAoD;AAEtE,QAAO;;AAQT,MAAa,cAAc,EACzB,SACA,WACA,gBACA,iBACA,SACA,OAAO,WACP,UACA,UACA,UACA,UACA,UACA,IACA,MACA,GAAG,WAC0B;CAC7B,MAAM,SAAS,oBAAoB;CACnC,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CACjD,MAAM,eAAe,OACnB,KACD;CAED,MAAM,CAAC,WAAW,gBAAgB,mBAAmB,kBAAkB,OAAO;EAC5E,cAAc;EACd,WAAW,UAAmB;AAC5B,OAAI,aAAa,QACf,mBAAkB,OAAO,aAAa,QAAQ;;EAGlD,OAAO;EACR,CAAC;CAEF,MAAM,gBAAgB,aAAa,EAAE,MAAM,CAAC;CAE5C,MAAM,eAAe,eACZ;EACL,WAAW,QAAQ,UAAU;EAC7B;EACA,eAAe,UAAmB,aAAa,MAAM;EACrD;EACD,GACD;EAAC;EAAW;EAAW;EAAa,C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O;AACxC,KAAI,aAAa,OAAQ,QAAO,SAAS,UAAU,OAAO,gBAAgB,OAAO;AACjF,QAAO,SAAS,UAAU,OAAO,iBAAiB,OAAO;;AAG3D,MAAa,cAAc,EACzB,UACA,WACA,UACA,OAAO,WACP,aAAa;CAAE,QAAQ;CAAG,MAAM;CAAU,EAC1C,GAAG,WACkB;CACrB,MAAM,SAAS,oBAAoB;CACnC,MAAM,EAAE,cAAc,kBAAkB;CACxC,MAAM,qBAAqB,kBAAkB;CAE7C,MAAM,aAAa,cAAc;AAC/B,MAAI,aAAa,QAAS,QAAO,CAAC;AAClC,MAAI,aAAa,OAAQ,QAAO;AAChC,MAAI,aAAa,QAAS,QAAO;AACjC,SAAO;IACN,CAAC,UAAU,UAAU,CAAC;CAEzB,MAAM,gBAAgB,qBAAqB,UAAU,KAAK;CAC1D,MAAM,sBAAsB,qBAAqB,EAAE,UAAU,GAAG,GAAG;AAEnE,QACE,oBAAC,OAAO,MAAR;EACE,SAAS,aAAa;GAAE,SAAS;GAAG,OAAO;GAAG,GAAG;GAAE,SAAS;GAAG,OAAO;GAAG;EACzE,WAAW,GAAG,OAAO,MAAM,eAAe,UAAU;EACpD,YAAY;EACZ,GAAI;EAEH;EACW,CAAA;;AAIlB,WAAW,cAAc"}
@@ -3,10 +3,10 @@ import { styles } from "./style.mjs";
3
3
  import { TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab } from "./atoms.mjs";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { cx } from "antd-style";
6
- import useMergeState from "use-merge-value";
6
+ import useControlledState from "use-merge-value";
7
7
  //#region src/base-ui/Tabs/Tabs.tsx
8
8
  const Tabs = ({ activeKey, className, classNames, defaultActiveKey, items, onChange, orientation = "horizontal", ref, size = "middle", style, styles: customStyles, variant = "rounded" }) => {
9
- const [value, setValue] = useMergeState(defaultActiveKey ?? null, {
9
+ const [value, setValue] = useControlledState(defaultActiveKey ?? null, {
10
10
  defaultValue: defaultActiveKey,
11
11
  onChange: (next) => {
12
12
  if (next != null) onChange?.(next);
@@ -1 +1 @@
1
- {"version":3,"file":"Tabs.mjs","names":["useControlledState"],"sources":["../../../src/base-ui/Tabs/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { type FC } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab } from './atoms';\nimport { styles } from './style';\nimport type { TabsProps } from './type';\n\nconst Tabs: FC<TabsProps> = ({\n activeKey,\n className,\n classNames,\n defaultActiveKey,\n items,\n onChange,\n orientation = 'horizontal',\n ref,\n size = 'middle',\n style,\n styles: customStyles,\n variant = 'rounded',\n}) => {\n const [value, setValue] = useControlledState<string | null>(defaultActiveKey ?? null, {\n defaultValue: defaultActiveKey,\n onChange: (next) => {\n if (next != null) onChange?.(next);\n },\n value: activeKey,\n });\n\n const hasPanels = items?.some((item) => item.children != null);\n\n return (\n <TabsRoot\n className={cx(styles.root, classNames?.root, className)}\n orientation={orientation}\n ref={ref}\n size={size}\n style={{ ...style, ...customStyles?.root }}\n value={value}\n variant={variant}\n onValueChange={(next) => setValue(next ?? null)}\n >\n <TabsList className={cx(classNames?.list)} style={customStyles?.list}>\n <TabsIndicator className={cx(classNames?.indicator)} style={customStyles?.indicator} />\n {items?.map((item) => (\n <TabsTab\n className={cx(classNames?.tab)}\n disabled={item.disabled}\n key={item.key}\n style={customStyles?.tab}\n value={item.key}\n >\n {item.icon}\n {item.label}\n </TabsTab>\n ))}\n </TabsList>\n {hasPanels &&\n items?.map((item) => (\n <TabsPanel\n className={cx(classNames?.panel)}\n key={item.key}\n style={customStyles?.panel}\n value={item.key}\n >\n {item.children}\n </TabsPanel>\n ))}\n </TabsRoot>\n );\n};\n\nTabs.displayName = 'Tabs';\n\nexport default Tabs;\n"],"mappings":";;;;;;;AAUA,MAAM,QAAuB,EAC3B,WACA,WACA,YACA,kBACA,OACA,UACA,cAAc,cACd,KACA,OAAO,UACP,OACA,QAAQ,cACR,UAAU,gBACN;CACJ,MAAM,CAAC,OAAO,YAAYA,cAAkC,oBAAoB,MAAM;EACpF,cAAc;EACd,WAAW,SAAS;AAClB,OAAI,QAAQ,KAAM,YAAW,KAAK;;EAEpC,OAAO;EACR,CAAC;CAEF,MAAM,YAAY,OAAO,MAAM,SAAS,KAAK,YAAY,KAAK;AAE9D,QACE,qBAAC,UAAD;EACE,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM,UAAU;EAC1C;EACR;EACC;EACN,OAAO;GAAE,GAAG;GAAO,GAAG,cAAc;GAAM;EACnC;EACE;EACT,gBAAgB,SAAS,SAAS,QAAQ,KAAK;YARjD,CAUE,qBAAC,UAAD;GAAU,WAAW,GAAG,YAAY,KAAK;GAAE,OAAO,cAAc;aAAhE,CACE,oBAAC,eAAD;IAAe,WAAW,GAAG,YAAY,UAAU;IAAE,OAAO,cAAc;IAAa,CAAA,EACtF,OAAO,KAAK,SACX,qBAAC,SAAD;IACE,WAAW,GAAG,YAAY,IAAI;IAC9B,UAAU,KAAK;IAEf,OAAO,cAAc;IACrB,OAAO,KAAK;cALd,CAOG,KAAK,MACL,KAAK,MACE;MANH,KAAK,IAMF,CACV,CACO;MACV,aACC,OAAO,KAAK,SACV,oBAAC,WAAD;GACE,WAAW,GAAG,YAAY,MAAM;GAEhC,OAAO,cAAc;GACrB,OAAO,KAAK;aAEX,KAAK;GACI,EALL,KAAK,IAKA,CACZ,CACK;;;AAIf,KAAK,cAAc"}
1
+ {"version":3,"file":"Tabs.mjs","names":[],"sources":["../../../src/base-ui/Tabs/Tabs.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { type FC } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport { TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab } from './atoms';\nimport { styles } from './style';\nimport type { TabsProps } from './type';\n\nconst Tabs: FC<TabsProps> = ({\n activeKey,\n className,\n classNames,\n defaultActiveKey,\n items,\n onChange,\n orientation = 'horizontal',\n ref,\n size = 'middle',\n style,\n styles: customStyles,\n variant = 'rounded',\n}) => {\n const [value, setValue] = useControlledState<string | null>(defaultActiveKey ?? null, {\n defaultValue: defaultActiveKey,\n onChange: (next) => {\n if (next != null) onChange?.(next);\n },\n value: activeKey,\n });\n\n const hasPanels = items?.some((item) => item.children != null);\n\n return (\n <TabsRoot\n className={cx(styles.root, classNames?.root, className)}\n orientation={orientation}\n ref={ref}\n size={size}\n style={{ ...style, ...customStyles?.root }}\n value={value}\n variant={variant}\n onValueChange={(next) => setValue(next ?? null)}\n >\n <TabsList className={cx(classNames?.list)} style={customStyles?.list}>\n <TabsIndicator className={cx(classNames?.indicator)} style={customStyles?.indicator} />\n {items?.map((item) => (\n <TabsTab\n className={cx(classNames?.tab)}\n disabled={item.disabled}\n key={item.key}\n style={customStyles?.tab}\n value={item.key}\n >\n {item.icon}\n {item.label}\n </TabsTab>\n ))}\n </TabsList>\n {hasPanels &&\n items?.map((item) => (\n <TabsPanel\n className={cx(classNames?.panel)}\n key={item.key}\n style={customStyles?.panel}\n value={item.key}\n >\n {item.children}\n </TabsPanel>\n ))}\n </TabsRoot>\n );\n};\n\nTabs.displayName = 'Tabs';\n\nexport default Tabs;\n"],"mappings":";;;;;;;AAUA,MAAM,QAAuB,EAC3B,WACA,WACA,YACA,kBACA,OACA,UACA,cAAc,cACd,KACA,OAAO,UACP,OACA,QAAQ,cACR,UAAU,gBACN;CACJ,MAAM,CAAC,OAAO,YAAY,mBAAkC,oBAAoB,MAAM;EACpF,cAAc;EACd,WAAW,SAAS;AAClB,OAAI,QAAQ,KAAM,YAAW,KAAK;;EAEpC,OAAO;EACR,CAAC;CAEF,MAAM,YAAY,OAAO,MAAM,SAAS,KAAK,YAAY,KAAK;AAE9D,QACE,qBAAC,UAAD;EACE,WAAW,GAAG,OAAO,MAAM,YAAY,MAAM,UAAU;EAC1C;EACR;EACC;EACN,OAAO;GAAE,GAAG;GAAO,GAAG,cAAc;GAAM;EACnC;EACE;EACT,gBAAgB,SAAS,SAAS,QAAQ,KAAK;YARjD,CAUE,qBAAC,UAAD;GAAU,WAAW,GAAG,YAAY,KAAK;GAAE,OAAO,cAAc;aAAhE,CACE,oBAAC,eAAD;IAAe,WAAW,GAAG,YAAY,UAAU;IAAE,OAAO,cAAc;IAAa,CAAA,EACtF,OAAO,KAAK,SACX,qBAAC,SAAD;IACE,WAAW,GAAG,YAAY,IAAI;IAC9B,UAAU,KAAK;IAEf,OAAO,cAAc;IACrB,OAAO,KAAK;cALd,CAOG,KAAK,MACL,KAAK,MACE;MANH,KAAK,IAMF,CACV,CACO;MACV,aACC,OAAO,KAAK,SACV,oBAAC,WAAD;GACE,WAAW,GAAG,YAAY,MAAM;GAEhC,OAAO,cAAc;GACrB,OAAO,KAAK;aAEX,KAAK;GACI,EALL,KAAK,IAKA,CACZ,CACK;;;AAIf,KAAK,cAAc"}
@@ -66,7 +66,7 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
66
66
  padding: 3px;
67
67
  border-radius: ${cssVar.borderRadiusLG};
68
68
 
69
- background: ${cssVar.colorFillTertiary};
69
+ background: ${cssVar.colorBgLayout};
70
70
 
71
71
  &[data-orientation='vertical'] {
72
72
  align-self: stretch;
@@ -1 +1 @@
1
- {"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Tabs/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n indicator: css`\n pointer-events: none;\n\n position: absolute;\n z-index: 0;\n\n transition-timing-function: ${cssVar.motionEaseOut};\n transition-duration: 240ms;\n transition-property: inset-inline-start, inset-block-start, width, height, transform;\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n indicatorPoint: css`\n inset-block-end: 6px;\n inset-inline-start: calc(var(--active-tab-left) + var(--active-tab-width) / 2 - 2.5px);\n\n width: 5px;\n height: 5px;\n border-radius: 50%;\n\n background: ${cssVar.colorPrimary};\n `,\n indicatorRounded: css`\n inset-block-start: var(--active-tab-top);\n inset-inline-start: var(--active-tab-left);\n\n width: var(--active-tab-width);\n height: var(--active-tab-height);\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n box-shadow: ${cssVar.boxShadowTertiary};\n `,\n indicatorSquare: css`\n inset-block-end: 0;\n inset-inline-start: var(--active-tab-left);\n\n width: var(--active-tab-width);\n height: 2px;\n\n background: ${cssVar.colorPrimary};\n `,\n list: css`\n position: relative;\n\n display: inline-flex;\n flex-wrap: nowrap;\n gap: 2px;\n align-items: center;\n\n &[data-orientation='vertical'] {\n flex-direction: column;\n align-items: stretch;\n }\n `,\n listRounded: css`\n gap: 4px;\n align-self: flex-start;\n\n padding: 3px;\n border-radius: ${cssVar.borderRadiusLG};\n\n background: ${cssVar.colorFillTertiary};\n\n &[data-orientation='vertical'] {\n align-self: stretch;\n }\n `,\n listSquare: css`\n gap: 16px;\n box-shadow: inset 0 -1px 0 ${cssVar.colorBorderSecondary};\n\n &[data-orientation='vertical'] {\n box-shadow: inset -1px 0 0 ${cssVar.colorBorderSecondary};\n }\n `,\n panel: css`\n padding-block-start: 12px;\n outline: none;\n\n &:focus-visible {\n border-radius: ${cssVar.borderRadius};\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 2px;\n }\n `,\n root: css`\n display: flex;\n flex-direction: column;\n width: 100%;\n\n &[data-orientation='vertical'] {\n flex-direction: row;\n }\n `,\n tab: css`\n cursor: pointer;\n user-select: none;\n\n position: relative;\n z-index: 1;\n\n display: inline-flex;\n flex-shrink: 0;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 0;\n\n font-weight: 500;\n color: ${cssVar.colorTextSecondary};\n white-space: nowrap;\n\n background: transparent;\n outline: none;\n\n transition:\n color 120ms ${cssVar.motionEaseOut},\n transform 120ms ${cssVar.motionEaseOut};\n\n &:hover:not([data-disabled]) {\n color: ${cssVar.colorText};\n }\n\n &:active:not([data-disabled]) {\n transform: scale(0.98);\n }\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: -2px;\n }\n\n &[data-active] {\n color: ${cssVar.colorPrimary};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n tabLarge: css`\n height: 36px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n tabMiddle: css`\n height: 32px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadius};\n font-size: 13px;\n `,\n tabPoint: css`\n height: auto;\n padding-block: 8px 14px;\n `,\n tabSmall: css`\n height: 26px;\n padding-inline: 10px;\n border-radius: ${cssVar.borderRadius};\n font-size: 12px;\n `,\n tabSquare: css`\n height: auto;\n padding-block: 8px;\n border-radius: 0;\n `,\n}));\n\nexport const tabVariants = cva(styles.tab, {\n defaultVariants: {\n size: 'middle',\n variant: 'rounded',\n },\n variants: {\n size: {\n large: styles.tabLarge,\n middle: styles.tabMiddle,\n small: styles.tabSmall,\n },\n variant: {\n point: styles.tabPoint,\n rounded: null,\n square: styles.tabSquare,\n },\n },\n});\n\nexport const indicatorVariants = cva(styles.indicator, {\n defaultVariants: {\n variant: 'rounded',\n },\n variants: {\n variant: {\n point: styles.indicatorPoint,\n rounded: styles.indicatorRounded,\n square: styles.indicatorSquare,\n },\n },\n});\n\nexport const listVariants = cva(styles.list, {\n defaultVariants: {\n variant: 'rounded',\n },\n variants: {\n variant: {\n point: null,\n rounded: styles.listRounded,\n square: styles.listSquare,\n },\n },\n});\n"],"mappings":";;;AAGA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,WAAW,GAAG;;;;;;kCAMkB,OAAO,cAAc;;;;;;;;CAQrD,gBAAgB,GAAG;;;;;;;;kBAQH,OAAO,aAAa;;CAEpC,kBAAkB,GAAG;;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CAC3C,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,OAAO;EACP,SAAS,OAAO;EAChB,QAAQ,OAAO;EAChB,EACF;CACF,CAAC"}
1
+ {"version":3,"file":"style.mjs","names":[],"sources":["../../../src/base-ui/Tabs/style.ts"],"sourcesContent":["import { createStaticStyles } from 'antd-style';\nimport { cva } from 'class-variance-authority';\n\nexport const styles = createStaticStyles(({ css, cssVar }) => ({\n indicator: css`\n pointer-events: none;\n\n position: absolute;\n z-index: 0;\n\n transition-timing-function: ${cssVar.motionEaseOut};\n transition-duration: 240ms;\n transition-property: inset-inline-start, inset-block-start, width, height, transform;\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n indicatorPoint: css`\n inset-block-end: 6px;\n inset-inline-start: calc(var(--active-tab-left) + var(--active-tab-width) / 2 - 2.5px);\n\n width: 5px;\n height: 5px;\n border-radius: 50%;\n\n background: ${cssVar.colorPrimary};\n `,\n indicatorRounded: css`\n inset-block-start: var(--active-tab-top);\n inset-inline-start: var(--active-tab-left);\n\n width: var(--active-tab-width);\n height: var(--active-tab-height);\n border-radius: ${cssVar.borderRadius};\n\n background: ${cssVar.colorBgElevated};\n box-shadow: ${cssVar.boxShadowTertiary};\n `,\n indicatorSquare: css`\n inset-block-end: 0;\n inset-inline-start: var(--active-tab-left);\n\n width: var(--active-tab-width);\n height: 2px;\n\n background: ${cssVar.colorPrimary};\n `,\n list: css`\n position: relative;\n\n display: inline-flex;\n flex-wrap: nowrap;\n gap: 2px;\n align-items: center;\n\n &[data-orientation='vertical'] {\n flex-direction: column;\n align-items: stretch;\n }\n `,\n listRounded: css`\n gap: 4px;\n align-self: flex-start;\n\n padding: 3px;\n border-radius: ${cssVar.borderRadiusLG};\n\n background: ${cssVar.colorBgLayout};\n\n &[data-orientation='vertical'] {\n align-self: stretch;\n }\n `,\n listSquare: css`\n gap: 16px;\n box-shadow: inset 0 -1px 0 ${cssVar.colorBorderSecondary};\n\n &[data-orientation='vertical'] {\n box-shadow: inset -1px 0 0 ${cssVar.colorBorderSecondary};\n }\n `,\n panel: css`\n padding-block-start: 12px;\n outline: none;\n\n &:focus-visible {\n border-radius: ${cssVar.borderRadius};\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: 2px;\n }\n `,\n root: css`\n display: flex;\n flex-direction: column;\n width: 100%;\n\n &[data-orientation='vertical'] {\n flex-direction: row;\n }\n `,\n tab: css`\n cursor: pointer;\n user-select: none;\n\n position: relative;\n z-index: 1;\n\n display: inline-flex;\n flex-shrink: 0;\n gap: 6px;\n align-items: center;\n justify-content: center;\n\n box-sizing: border-box;\n border: 0;\n\n font-weight: 500;\n color: ${cssVar.colorTextSecondary};\n white-space: nowrap;\n\n background: transparent;\n outline: none;\n\n transition:\n color 120ms ${cssVar.motionEaseOut},\n transform 120ms ${cssVar.motionEaseOut};\n\n &:hover:not([data-disabled]) {\n color: ${cssVar.colorText};\n }\n\n &:active:not([data-disabled]) {\n transform: scale(0.98);\n }\n\n &:focus-visible {\n outline: 2px solid ${cssVar.colorPrimaryBorder};\n outline-offset: -2px;\n }\n\n &[data-active] {\n color: ${cssVar.colorPrimary};\n }\n\n &[data-disabled] {\n cursor: not-allowed;\n color: ${cssVar.colorTextDisabled};\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition-duration: 0s;\n }\n `,\n tabLarge: css`\n height: 36px;\n padding-inline: 16px;\n border-radius: ${cssVar.borderRadius};\n font-size: 14px;\n `,\n tabMiddle: css`\n height: 32px;\n padding-inline: 12px;\n border-radius: ${cssVar.borderRadius};\n font-size: 13px;\n `,\n tabPoint: css`\n height: auto;\n padding-block: 8px 14px;\n `,\n tabSmall: css`\n height: 26px;\n padding-inline: 10px;\n border-radius: ${cssVar.borderRadius};\n font-size: 12px;\n `,\n tabSquare: css`\n height: auto;\n padding-block: 8px;\n border-radius: 0;\n `,\n}));\n\nexport const tabVariants = cva(styles.tab, {\n defaultVariants: {\n size: 'middle',\n variant: 'rounded',\n },\n variants: {\n size: {\n large: styles.tabLarge,\n middle: styles.tabMiddle,\n small: styles.tabSmall,\n },\n variant: {\n point: styles.tabPoint,\n rounded: null,\n square: styles.tabSquare,\n },\n },\n});\n\nexport const indicatorVariants = cva(styles.indicator, {\n defaultVariants: {\n variant: 'rounded',\n },\n variants: {\n variant: {\n point: styles.indicatorPoint,\n rounded: styles.indicatorRounded,\n square: styles.indicatorSquare,\n },\n },\n});\n\nexport const listVariants = cva(styles.list, {\n defaultVariants: {\n variant: 'rounded',\n },\n variants: {\n variant: {\n point: null,\n rounded: styles.listRounded,\n square: styles.listSquare,\n },\n },\n});\n"],"mappings":";;;AAGA,MAAa,SAAS,oBAAoB,EAAE,KAAK,cAAc;CAC7D,WAAW,GAAG;;;;;;kCAMkB,OAAO,cAAc;;;;;;;;CAQrD,gBAAgB,GAAG;;;;;;;;kBAQH,OAAO,aAAa;;CAEpC,kBAAkB,GAAG;;;;;;qBAMF,OAAO,aAAa;;kBAEvB,OAAO,gBAAgB;kBACvB,OAAO,kBAAkB;;CAEzC,iBAAiB,GAAG;;;;;;;kBAOJ,OAAO,aAAa;;CAEpC,MAAM,GAAG;;;;;;;;;;;;;CAaT,aAAa,GAAG;;;;;qBAKG,OAAO,eAAe;;kBAEzB,OAAO,cAAc;;;;;;CAMrC,YAAY,GAAG;;iCAEgB,OAAO,qBAAqB;;;mCAG1B,OAAO,qBAAqB;;;CAG7D,OAAO,GAAG;;;;;uBAKW,OAAO,aAAa;2BAChB,OAAO,mBAAmB;;;;CAInD,MAAM,GAAG;;;;;;;;;CAST,KAAK,GAAG;;;;;;;;;;;;;;;;;aAiBG,OAAO,mBAAmB;;;;;;;oBAOnB,OAAO,cAAc;wBACjB,OAAO,cAAc;;;eAG9B,OAAO,UAAU;;;;;;;;2BAQL,OAAO,mBAAmB;;;;;eAKtC,OAAO,aAAa;;;;;eAKpB,OAAO,kBAAkB;;;;;;;CAOtC,UAAU,GAAG;;;qBAGM,OAAO,aAAa;;;CAGvC,WAAW,GAAG;;;qBAGK,OAAO,aAAa;;;CAGvC,UAAU,GAAG;;;;CAIb,UAAU,GAAG;;;qBAGM,OAAO,aAAa;;;CAGvC,WAAW,GAAG;;;;;CAKf,EAAE;AAEH,MAAa,cAAc,IAAI,OAAO,KAAK;CACzC,iBAAiB;EACf,MAAM;EACN,SAAS;EACV;CACD,UAAU;EACR,MAAM;GACJ,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,OAAO,OAAO;GACf;EACD,SAAS;GACP,OAAO,OAAO;GACd,SAAS;GACT,QAAQ,OAAO;GAChB;EACF;CACF,CAAC;AAEF,MAAa,oBAAoB,IAAI,OAAO,WAAW;CACrD,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,OAAO,OAAO;EACd,SAAS,OAAO;EAChB,QAAQ,OAAO;EAChB,EACF;CACF,CAAC;AAEF,MAAa,eAAe,IAAI,OAAO,MAAM;CAC3C,iBAAiB,EACf,SAAS,WACV;CACD,UAAU,EACR,SAAS;EACP,OAAO;EACP,SAAS,OAAO;EAChB,QAAQ,OAAO;EAChB,EACF;CACF,CAAC"}
@@ -26,14 +26,16 @@ import { ButtonIconPosition, ButtonProps, ButtonShape, ButtonSize, ButtonType }
26
26
  import { Button } from "./Button/Button.mjs";
27
27
  import { SplitButtonMenuProps, SplitButtonProps, _default } from "./Button/SplitButton.mjs";
28
28
  import { styles } from "./Button/style.mjs";
29
- import { FloatingSheetProps } from "./FloatingSheet/type.mjs";
30
- import { FloatingSheet } from "./FloatingSheet/FloatingSheet.mjs";
31
29
  import { ModalBackdrop, ModalBackdropProps, ModalClose, ModalCloseProps, ModalContent, ModalContentProps, ModalDescription, ModalDescriptionProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps, ModalPopup, ModalPopupProps, ModalPortal, ModalPortalProps, ModalRoot, ModalRootProps, ModalTitle, ModalTitleProps, ModalTrigger, ModalTriggerProps, ModalViewport, ModalViewportProps, useModalActions, useModalOpen } from "./Modal/atoms.mjs";
32
30
  import { backdropTransition, modalMotionConfig } from "./Modal/constants.mjs";
33
31
  import { BaseModalProps, ImperativeModalProps, ModalComponentProps, ModalConfirmConfig, ModalContextValue, ModalInstance } from "./Modal/type.mjs";
34
32
  import { ModalContext, useModalContext } from "./Modal/context.mjs";
35
33
  import { ModalHost, ModalHostProps, ModalSystem, confirmModal, createModal, createModalSystem } from "./Modal/imperative.mjs";
36
34
  import { Modal } from "./Modal/Modal.mjs";
35
+ import { FloatingPanelOffset, FloatingPanelPlacement, FloatingPanelProps } from "./FloatingPanel/type.mjs";
36
+ import { FloatingPanel } from "./FloatingPanel/FloatingPanel.mjs";
37
+ import { FloatingSheetProps } from "./FloatingSheet/type.mjs";
38
+ import { FloatingSheet } from "./FloatingSheet/FloatingSheet.mjs";
37
39
  import { SegmentedClassNames, SegmentedOption, SegmentedOptions, SegmentedOrientation, SegmentedProps, SegmentedSize, SegmentedStyles, SegmentedVariant } from "./Segmented/type.mjs";
38
40
  import { SegmentedIndicator, SegmentedIndicatorProps, SegmentedItem, SegmentedItemIcon, SegmentedItemLabel, SegmentedItemProps, SegmentedRoot, SegmentedRootProps } from "./Segmented/atoms.mjs";
39
41
  import { Segmented } from "./Segmented/Segmented.mjs";
@@ -48,4 +50,4 @@ import { TabsClassNames, TabsIndicatorProps, TabsItem, TabsListProps, TabsOrient
48
50
  import { styles as styles$2 } from "./Tabs/style.mjs";
49
51
  import { TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab, useTabsContext } from "./Tabs/atoms.mjs";
50
52
  import { Tabs } from "./Tabs/Tabs.mjs";
51
- export { BaseModalProps, Button, ButtonIconPosition, ButtonProps, ButtonShape, ButtonSize, ButtonType, type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, ContextMenuTrigger, DropdownItem, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPlacement, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, DropdownMenuTriggerProps, FloatingSheet, FloatingSheetProps, IconSpaceMode, ImperativeModalProps, Modal, ModalBackdrop, ModalBackdropProps, ModalClose, ModalCloseProps, ModalComponentProps, ModalConfirmConfig, ModalContent, ModalContentProps, ModalContext, ModalContextValue, ModalDescription, ModalDescriptionProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps, ModalHost, ModalHostProps, ModalInstance, ModalPopup, ModalPopupProps, ModalPortal, ModalPortalProps, ModalRoot, ModalRootProps, ModalSystem, ModalTitle, ModalTitleProps, ModalTrigger, ModalTriggerProps, ModalViewport, ModalViewportProps, PopoverArrow, PopoverArrowAtomProps, PopoverArrowIcon, PopoverBackdrop, PopoverBackdropProps, PopoverContextValue, PopoverGroup, PopoverPlacement, PopoverPopup, PopoverPopupAtomProps, PopoverPopupProps, PopoverPortal, PopoverPortalAtomProps, PopoverPortalProps, PopoverPositioner, PopoverPositionerAtomProps, PopoverPositionerProps, PopoverProps, PopoverProvider, PopoverRoot, PopoverTrigger, PopoverTriggerComponentProps, PopoverTriggerElement, PopoverTriggerElementProps, PopoverViewport, PopoverViewportAtomProps, ScrollArea, ScrollAreaContent, ScrollAreaContentProps, ScrollAreaCorner, ScrollAreaCornerProps, ScrollAreaProps, ScrollAreaRoot, ScrollAreaRootProps, ScrollAreaScrollbar, ScrollAreaScrollbarProps, ScrollAreaThumb, ScrollAreaThumbProps, ScrollAreaViewport, ScrollAreaViewportProps, Segmented, SegmentedClassNames, SegmentedIndicator, SegmentedIndicatorProps, SegmentedItem, SegmentedItemIcon, SegmentedItemLabel, SegmentedItemProps, SegmentedOption, SegmentedOptions, SegmentedOrientation, SegmentedProps, SegmentedRoot, SegmentedRootProps, SegmentedSize, SegmentedStyles, SegmentedVariant, Select, SelectArrow, SelectArrowProps, SelectBackdrop, SelectBehaviorVariant, SelectClassNames, SelectGroup, SelectGroupLabel, SelectGroupLabelProps, SelectGroupProps, SelectIcon, SelectIconProps, SelectIndicatorVariant, SelectItem, SelectItemIndicator, SelectItemIndicatorProps, SelectItemProps, SelectItemText, SelectItemTextProps, SelectList, SelectListProps, SelectOption, SelectOptionGroup, SelectOptions, SelectPopup, SelectPopupProps, SelectPortal, SelectPortalProps, SelectPositioner, SelectPositionerProps, SelectProps, SelectRoot, SelectRootChangeEventDetails, SelectScrollDownArrow, SelectScrollDownArrowProps, SelectScrollUpArrow, SelectScrollUpArrowProps, SelectSeparator, SelectSize, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps, SelectVariant, _default as SplitButton, SplitButtonMenuProps, SplitButtonProps, Switch, SwitchChangeEventHandler, SwitchClassNames, SwitchClickEventHandler, SwitchContextType, SwitchIcon, SwitchIconPosition, SwitchIconProps, SwitchProps, SwitchRoot, SwitchRootProps, SwitchSize, SwitchStyles, SwitchThumb, SwitchThumbProps, Tabs, TabsClassNames, TabsIndicator, TabsIndicatorProps, TabsItem, TabsList, TabsListProps, TabsOrientation, TabsPanel, TabsPanelProps, TabsProps, TabsRoot, TabsRootProps, TabsSize, TabsStyles, TabsTab, TabsTabProps, TabsVariant, type ToastAPI, ToastHost, type ToastHostProps, type ToastInstance, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastProps, type ToastType, Tooltip, TooltipGroup, TooltipGroupProps, TooltipPlacement, TooltipPopupComponentProps, TooltipPortalProps, TooltipPositionerProps, TooltipProps, TooltipTriggerComponentProps, backdropTransition, styles as buttonStyles, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles$1 as switchStyles, styles$2 as tabsStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useTabsContext, useToast };
53
+ export { BaseModalProps, Button, ButtonIconPosition, ButtonProps, ButtonShape, ButtonSize, ButtonType, type ContextMenuCheckboxItem, ContextMenuHost, type ContextMenuItem, ContextMenuTrigger, DropdownItem, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuCheckboxItemProps, DropdownMenuFooter, DropdownMenuFooterProps, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuGroupLabelProps, DropdownMenuHeader, DropdownMenuHeaderProps, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemContentProps, DropdownMenuItemDesc, DropdownMenuItemDescProps, DropdownMenuItemExtra, DropdownMenuItemExtraProps, DropdownMenuItemIcon, DropdownMenuItemIconProps, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuItemLabelGroupProps, DropdownMenuItemLabelProps, DropdownMenuItemProps, DropdownMenuPlacement, DropdownMenuPopup, DropdownMenuPopupProps, DropdownMenuPortal, DropdownMenuPortalProps, DropdownMenuPositioner, DropdownMenuPositionerProps, DropdownMenuProps, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuScrollViewportProps, DropdownMenuSeparator, DropdownMenuSeparatorProps, DropdownMenuSubmenuArrow, DropdownMenuSubmenuArrowProps, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSubmenuTriggerProps, DropdownMenuSwitchItem, DropdownMenuSwitchItemProps, DropdownMenuSwitchItem$1 as DropdownMenuSwitchItemType, DropdownMenuTrigger, DropdownMenuTriggerProps, FloatingPanel, FloatingPanelOffset, FloatingPanelPlacement, FloatingPanelProps, FloatingSheet, FloatingSheetProps, IconSpaceMode, ImperativeModalProps, Modal, ModalBackdrop, ModalBackdropProps, ModalClose, ModalCloseProps, ModalComponentProps, ModalConfirmConfig, ModalContent, ModalContentProps, ModalContext, ModalContextValue, ModalDescription, ModalDescriptionProps, ModalFooter, ModalFooterProps, ModalHeader, ModalHeaderProps, ModalHost, ModalHostProps, ModalInstance, ModalPopup, ModalPopupProps, ModalPortal, ModalPortalProps, ModalRoot, ModalRootProps, ModalSystem, ModalTitle, ModalTitleProps, ModalTrigger, ModalTriggerProps, ModalViewport, ModalViewportProps, PopoverArrow, PopoverArrowAtomProps, PopoverArrowIcon, PopoverBackdrop, PopoverBackdropProps, PopoverContextValue, PopoverGroup, PopoverPlacement, PopoverPopup, PopoverPopupAtomProps, PopoverPopupProps, PopoverPortal, PopoverPortalAtomProps, PopoverPortalProps, PopoverPositioner, PopoverPositionerAtomProps, PopoverPositionerProps, PopoverProps, PopoverProvider, PopoverRoot, PopoverTrigger, PopoverTriggerComponentProps, PopoverTriggerElement, PopoverTriggerElementProps, PopoverViewport, PopoverViewportAtomProps, ScrollArea, ScrollAreaContent, ScrollAreaContentProps, ScrollAreaCorner, ScrollAreaCornerProps, ScrollAreaProps, ScrollAreaRoot, ScrollAreaRootProps, ScrollAreaScrollbar, ScrollAreaScrollbarProps, ScrollAreaThumb, ScrollAreaThumbProps, ScrollAreaViewport, ScrollAreaViewportProps, Segmented, SegmentedClassNames, SegmentedIndicator, SegmentedIndicatorProps, SegmentedItem, SegmentedItemIcon, SegmentedItemLabel, SegmentedItemProps, SegmentedOption, SegmentedOptions, SegmentedOrientation, SegmentedProps, SegmentedRoot, SegmentedRootProps, SegmentedSize, SegmentedStyles, SegmentedVariant, Select, SelectArrow, SelectArrowProps, SelectBackdrop, SelectBehaviorVariant, SelectClassNames, SelectGroup, SelectGroupLabel, SelectGroupLabelProps, SelectGroupProps, SelectIcon, SelectIconProps, SelectIndicatorVariant, SelectItem, SelectItemIndicator, SelectItemIndicatorProps, SelectItemProps, SelectItemText, SelectItemTextProps, SelectList, SelectListProps, SelectOption, SelectOptionGroup, SelectOptions, SelectPopup, SelectPopupProps, SelectPortal, SelectPortalProps, SelectPositioner, SelectPositionerProps, SelectProps, SelectRoot, SelectRootChangeEventDetails, SelectScrollDownArrow, SelectScrollDownArrowProps, SelectScrollUpArrow, SelectScrollUpArrowProps, SelectSeparator, SelectSize, SelectTrigger, SelectTriggerProps, SelectValue, SelectValueProps, SelectVariant, _default as SplitButton, SplitButtonMenuProps, SplitButtonProps, Switch, SwitchChangeEventHandler, SwitchClassNames, SwitchClickEventHandler, SwitchContextType, SwitchIcon, SwitchIconPosition, SwitchIconProps, SwitchProps, SwitchRoot, SwitchRootProps, SwitchSize, SwitchStyles, SwitchThumb, SwitchThumbProps, Tabs, TabsClassNames, TabsIndicator, TabsIndicatorProps, TabsItem, TabsList, TabsListProps, TabsOrientation, TabsPanel, TabsPanelProps, TabsProps, TabsRoot, TabsRootProps, TabsSize, TabsStyles, TabsTab, TabsTabProps, TabsVariant, type ToastAPI, ToastHost, type ToastHostProps, type ToastInstance, type ToastOptions, type ToastPosition, type ToastPromiseOptions, type ToastProps, type ToastType, Tooltip, TooltipGroup, TooltipGroupProps, TooltipPlacement, TooltipPopupComponentProps, TooltipPortalProps, TooltipPositionerProps, TooltipProps, TooltipTriggerComponentProps, backdropTransition, styles as buttonStyles, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles$1 as switchStyles, styles$2 as tabsStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useTabsContext, useToast };
@@ -21,12 +21,13 @@ import { ToastHost, toast, useToast } from "./Toast/imperative.mjs";
21
21
  import { styles } from "./Button/style.mjs";
22
22
  import Button from "./Button/Button.mjs";
23
23
  import SplitButton from "./Button/SplitButton.mjs";
24
- import { FloatingSheet } from "./FloatingSheet/FloatingSheet.mjs";
25
24
  import { backdropTransition, modalMotionConfig } from "./Modal/constants.mjs";
26
25
  import { ModalBackdrop, ModalClose, ModalContent, ModalDescription, ModalFooter, ModalHeader, ModalPopup, ModalPortal, ModalRoot, ModalTitle, ModalTrigger, ModalViewport, useModalActions, useModalOpen } from "./Modal/atoms.mjs";
27
26
  import { ModalContext, useModalContext } from "./Modal/context.mjs";
28
27
  import { ModalHost, confirmModal, createModal, createModalSystem } from "./Modal/imperative.mjs";
29
28
  import Modal from "./Modal/Modal.mjs";
29
+ import { FloatingPanel } from "./FloatingPanel/FloatingPanel.mjs";
30
+ import { FloatingSheet } from "./FloatingSheet/FloatingSheet.mjs";
30
31
  import { SegmentedIndicator, SegmentedItem, SegmentedItemIcon, SegmentedItemLabel, SegmentedRoot } from "./Segmented/atoms.mjs";
31
32
  import Segmented from "./Segmented/Segmented.mjs";
32
33
  import { SelectArrow, SelectBackdrop, SelectGroup, SelectGroupLabel, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectList, SelectPopup, SelectPortal, SelectPositioner, SelectRoot, SelectScrollDownArrow, SelectScrollUpArrow, SelectSeparator, SelectTrigger, SelectValue } from "./Select/atoms.mjs";
@@ -34,4 +35,4 @@ import Select from "./Select/Select.mjs";
34
35
  import { styles as styles$2 } from "./Tabs/style.mjs";
35
36
  import { TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab, useTabsContext } from "./Tabs/atoms.mjs";
36
37
  import Tabs from "./Tabs/Tabs.mjs";
37
- export { Button, ContextMenuHost, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, FloatingSheet, Modal, ModalBackdrop, ModalClose, ModalContent, ModalContext, ModalDescription, ModalFooter, ModalHeader, ModalHost, ModalPopup, ModalPortal, ModalRoot, ModalTitle, ModalTrigger, ModalViewport, PopoverArrow, PopoverArrowIcon, PopoverBackdrop, PopoverGroup, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverProvider, PopoverRoot, PopoverTriggerElement, PopoverViewport, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, Segmented, SegmentedIndicator, SegmentedItem, SegmentedItemIcon, SegmentedItemLabel, SegmentedRoot, Select, SelectArrow, SelectBackdrop, SelectGroup, SelectGroupLabel, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectList, SelectPopup, SelectPortal, SelectPositioner, SelectRoot, SelectScrollDownArrow, SelectScrollUpArrow, SelectSeparator, SelectTrigger, SelectValue, SplitButton, Switch, SwitchIcon, SwitchRoot, SwitchThumb, Tabs, TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab, ToastHost, Tooltip, TooltipGroup, backdropTransition, styles as buttonStyles, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles$1 as switchStyles, styles$2 as tabsStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useTabsContext, useToast };
38
+ export { Button, ContextMenuHost, ContextMenuTrigger, DropdownMenu, DropdownMenuCheckboxItemIndicator, DropdownMenuCheckboxItemPrimitive, DropdownMenuFooter, DropdownMenuGroup, DropdownMenuGroupLabel, DropdownMenuHeader, DropdownMenuItem, DropdownMenuItemContent, DropdownMenuItemDesc, DropdownMenuItemExtra, DropdownMenuItemIcon, DropdownMenuItemLabel, DropdownMenuItemLabelGroup, DropdownMenuPopup, DropdownMenuPortal, DropdownMenuPositioner, DropdownMenuRoot, DropdownMenuScrollViewport, DropdownMenuSeparator, DropdownMenuSubmenuArrow, DropdownMenuSubmenuRoot, DropdownMenuSubmenuTrigger, DropdownMenuSwitchItem, DropdownMenuTrigger, FloatingPanel, FloatingSheet, Modal, ModalBackdrop, ModalClose, ModalContent, ModalContext, ModalDescription, ModalFooter, ModalHeader, ModalHost, ModalPopup, ModalPortal, ModalRoot, ModalTitle, ModalTrigger, ModalViewport, PopoverArrow, PopoverArrowIcon, PopoverBackdrop, PopoverGroup, PopoverPopup, PopoverPortal, PopoverPositioner, PopoverProvider, PopoverRoot, PopoverTriggerElement, PopoverViewport, ScrollArea, ScrollAreaContent, ScrollAreaCorner, ScrollAreaRoot, ScrollAreaScrollbar, ScrollAreaThumb, ScrollAreaViewport, Segmented, SegmentedIndicator, SegmentedItem, SegmentedItemIcon, SegmentedItemLabel, SegmentedRoot, Select, SelectArrow, SelectBackdrop, SelectGroup, SelectGroupLabel, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectList, SelectPopup, SelectPortal, SelectPositioner, SelectRoot, SelectScrollDownArrow, SelectScrollUpArrow, SelectSeparator, SelectTrigger, SelectValue, SplitButton, Switch, SwitchIcon, SwitchRoot, SwitchThumb, Tabs, TabsIndicator, TabsList, TabsPanel, TabsRoot, TabsTab, ToastHost, Tooltip, TooltipGroup, backdropTransition, styles as buttonStyles, closeContextMenu, confirmModal, createModal, createModalSystem, modalMotionConfig, parseTrigger, renderDropdownMenuItems, showContextMenu, styles$1 as switchStyles, styles$2 as tabsStyles, toast, updateContextMenuItems, useModalActions, useModalContext, useModalOpen, usePopoverContext, usePopoverPortalContainer, useSwitchContext, useTabsContext, useToast };
@@ -5,14 +5,14 @@ import MessageModal from "../MessageModal/MessageModal.mjs";
5
5
  import { memo } from "react";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { cx } from "antd-style";
8
- import useMergeState from "use-merge-value";
8
+ import useControlledState from "use-merge-value";
9
9
  //#region src/chat/EditableMessage/EditableMessage.tsx
10
10
  const EditableMessage = memo(({ value, onChange, classNames = {}, onEditingChange, editing, openModal, onOpenChange, placeholder, showEditWhenEmpty = false, styles: customStyles, className, style, height, variant, editButtonSize, text, fullFeaturedCodeBlock, model, fontSize, language = "markdown", markdownProps }) => {
11
- const [isEdit, setTyping] = useMergeState(false, {
11
+ const [isEdit, setTyping] = useControlledState(false, {
12
12
  onChange: onEditingChange,
13
13
  value: editing
14
14
  });
15
- const [expand, setExpand] = useMergeState(false, {
15
+ const [expand, setExpand] = useControlledState(false, {
16
16
  onChange: onOpenChange,
17
17
  value: openModal
18
18
  });
@@ -1 +1 @@
1
- {"version":3,"file":"EditableMessage.mjs","names":["useControlledState"],"sources":["../../../src/chat/EditableMessage/EditableMessage.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { memo } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport MessageInput from '@/chat/MessageInput';\nimport MessageModal from '@/chat/MessageModal';\nimport Markdown from '@/Markdown';\n\nimport { type EditableMessageProps } from './type';\n\nconst EditableMessage = memo<EditableMessageProps>(\n ({\n value,\n onChange,\n classNames = {},\n onEditingChange,\n editing,\n openModal,\n onOpenChange,\n placeholder,\n showEditWhenEmpty = false,\n styles: customStyles,\n className,\n style,\n height,\n variant,\n editButtonSize,\n text,\n fullFeaturedCodeBlock,\n model,\n fontSize,\n language = 'markdown',\n markdownProps,\n }) => {\n const [isEdit, setTyping] = useControlledState(false, {\n onChange: onEditingChange,\n value: editing,\n });\n\n const [expand, setExpand] = useControlledState<boolean>(false, {\n onChange: onOpenChange,\n value: openModal,\n });\n\n const isAutoSize = height === 'auto';\n\n const input = (\n <MessageInput\n shortcut\n className={cx(className, classNames?.input)}\n classNames={classNames}\n defaultValue={value}\n editButtonSize={editButtonSize}\n height={height}\n language={language}\n placeholder={placeholder}\n styles={customStyles}\n text={text}\n variant={variant}\n style={{\n ...style,\n ...customStyles?.input,\n }}\n onCancel={() => setTyping(false)}\n onConfirm={(text) => {\n onChange?.(text);\n setTyping(false);\n }}\n />\n );\n\n if (!value && showEditWhenEmpty) return input;\n\n return (\n <>\n {!expand && isEdit ? (\n input\n ) : (\n <Markdown\n className={cx(className, classNames?.markdown)}\n fontSize={fontSize}\n fullFeaturedCodeBlock={fullFeaturedCodeBlock}\n variant={'chat'}\n style={{\n height: isAutoSize ? 'unset' : height,\n ...style,\n ...customStyles?.markdown,\n }}\n {...markdownProps}\n >\n {value || placeholder || ''}\n </Markdown>\n )}\n {expand && (\n <MessageModal\n editing={isEdit}\n extra={model?.extra}\n footer={model?.footer}\n height={height}\n language={language}\n open={expand}\n placeholder={placeholder}\n text={text}\n value={value}\n onChange={onChange}\n onEditingChange={setTyping}\n onOpenChange={(e) => {\n setExpand(e);\n setTyping(false);\n }}\n />\n )}\n </>\n );\n },\n);\n\nEditableMessage.displayName = 'EditableMessage';\n\nexport default EditableMessage;\n"],"mappings":";;;;;;;;;AAYA,MAAM,kBAAkB,MACrB,EACC,OACA,UACA,aAAa,EAAE,EACf,iBACA,SACA,WACA,cACA,aACA,oBAAoB,OACpB,QAAQ,cACR,WACA,OACA,QACA,SACA,gBACA,MACA,uBACA,OACA,UACA,WAAW,YACX,oBACI;CACJ,MAAM,CAAC,QAAQ,aAAaA,cAAmB,OAAO;EACpD,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,CAAC,QAAQ,aAAaA,cAA4B,OAAO;EAC7D,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,aAAa,WAAW;CAE9B,MAAM,QACJ,oBAAC,cAAD;EACE,UAAA;EACA,WAAW,GAAG,WAAW,YAAY,MAAM;EAC/B;EACZ,cAAc;EACE;EACR;EACE;EACG;EACb,QAAQ;EACF;EACG;EACT,OAAO;GACL,GAAG;GACH,GAAG,cAAc;GAClB;EACD,gBAAgB,UAAU,MAAM;EAChC,YAAY,SAAS;AACnB,cAAW,KAAK;AAChB,aAAU,MAAM;;EAElB,CAAA;AAGJ,KAAI,CAAC,SAAS,kBAAmB,QAAO;AAExC,QACE,qBAAA,YAAA,EAAA,UAAA,CACG,CAAC,UAAU,SACV,QAEA,oBAAC,UAAD;EACE,WAAW,GAAG,WAAW,YAAY,SAAS;EACpC;EACa;EACvB,SAAS;EACT,OAAO;GACL,QAAQ,aAAa,UAAU;GAC/B,GAAG;GACH,GAAG,cAAc;GAClB;EACD,GAAI;YAEH,SAAS,eAAe;EAChB,CAAA,EAEZ,UACC,oBAAC,cAAD;EACE,SAAS;EACT,OAAO,OAAO;EACd,QAAQ,OAAO;EACP;EACE;EACV,MAAM;EACO;EACP;EACC;EACG;EACV,iBAAiB;EACjB,eAAe,MAAM;AACnB,aAAU,EAAE;AACZ,aAAU,MAAM;;EAElB,CAAA,CAEH,EAAA,CAAA;EAGR;AAED,gBAAgB,cAAc"}
1
+ {"version":3,"file":"EditableMessage.mjs","names":[],"sources":["../../../src/chat/EditableMessage/EditableMessage.tsx"],"sourcesContent":["'use client';\n\nimport { cx } from 'antd-style';\nimport { memo } from 'react';\nimport useControlledState from 'use-merge-value';\n\nimport MessageInput from '@/chat/MessageInput';\nimport MessageModal from '@/chat/MessageModal';\nimport Markdown from '@/Markdown';\n\nimport { type EditableMessageProps } from './type';\n\nconst EditableMessage = memo<EditableMessageProps>(\n ({\n value,\n onChange,\n classNames = {},\n onEditingChange,\n editing,\n openModal,\n onOpenChange,\n placeholder,\n showEditWhenEmpty = false,\n styles: customStyles,\n className,\n style,\n height,\n variant,\n editButtonSize,\n text,\n fullFeaturedCodeBlock,\n model,\n fontSize,\n language = 'markdown',\n markdownProps,\n }) => {\n const [isEdit, setTyping] = useControlledState(false, {\n onChange: onEditingChange,\n value: editing,\n });\n\n const [expand, setExpand] = useControlledState<boolean>(false, {\n onChange: onOpenChange,\n value: openModal,\n });\n\n const isAutoSize = height === 'auto';\n\n const input = (\n <MessageInput\n shortcut\n className={cx(className, classNames?.input)}\n classNames={classNames}\n defaultValue={value}\n editButtonSize={editButtonSize}\n height={height}\n language={language}\n placeholder={placeholder}\n styles={customStyles}\n text={text}\n variant={variant}\n style={{\n ...style,\n ...customStyles?.input,\n }}\n onCancel={() => setTyping(false)}\n onConfirm={(text) => {\n onChange?.(text);\n setTyping(false);\n }}\n />\n );\n\n if (!value && showEditWhenEmpty) return input;\n\n return (\n <>\n {!expand && isEdit ? (\n input\n ) : (\n <Markdown\n className={cx(className, classNames?.markdown)}\n fontSize={fontSize}\n fullFeaturedCodeBlock={fullFeaturedCodeBlock}\n variant={'chat'}\n style={{\n height: isAutoSize ? 'unset' : height,\n ...style,\n ...customStyles?.markdown,\n }}\n {...markdownProps}\n >\n {value || placeholder || ''}\n </Markdown>\n )}\n {expand && (\n <MessageModal\n editing={isEdit}\n extra={model?.extra}\n footer={model?.footer}\n height={height}\n language={language}\n open={expand}\n placeholder={placeholder}\n text={text}\n value={value}\n onChange={onChange}\n onEditingChange={setTyping}\n onOpenChange={(e) => {\n setExpand(e);\n setTyping(false);\n }}\n />\n )}\n </>\n );\n },\n);\n\nEditableMessage.displayName = 'EditableMessage';\n\nexport default EditableMessage;\n"],"mappings":";;;;;;;;;AAYA,MAAM,kBAAkB,MACrB,EACC,OACA,UACA,aAAa,EAAE,EACf,iBACA,SACA,WACA,cACA,aACA,oBAAoB,OACpB,QAAQ,cACR,WACA,OACA,QACA,SACA,gBACA,MACA,uBACA,OACA,UACA,WAAW,YACX,oBACI;CACJ,MAAM,CAAC,QAAQ,aAAa,mBAAmB,OAAO;EACpD,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,CAAC,QAAQ,aAAa,mBAA4B,OAAO;EAC7D,UAAU;EACV,OAAO;EACR,CAAC;CAEF,MAAM,aAAa,WAAW;CAE9B,MAAM,QACJ,oBAAC,cAAD;EACE,UAAA;EACA,WAAW,GAAG,WAAW,YAAY,MAAM;EAC/B;EACZ,cAAc;EACE;EACR;EACE;EACG;EACb,QAAQ;EACF;EACG;EACT,OAAO;GACL,GAAG;GACH,GAAG,cAAc;GAClB;EACD,gBAAgB,UAAU,MAAM;EAChC,YAAY,SAAS;AACnB,cAAW,KAAK;AAChB,aAAU,MAAM;;EAElB,CAAA;AAGJ,KAAI,CAAC,SAAS,kBAAmB,QAAO;AAExC,QACE,qBAAA,YAAA,EAAA,UAAA,CACG,CAAC,UAAU,SACV,QAEA,oBAAC,UAAD;EACE,WAAW,GAAG,WAAW,YAAY,SAAS;EACpC;EACa;EACvB,SAAS;EACT,OAAO;GACL,QAAQ,aAAa,UAAU;GAC/B,GAAG;GACH,GAAG,cAAc;GAClB;EACD,GAAI;YAEH,SAAS,eAAe;EAChB,CAAA,EAEZ,UACC,oBAAC,cAAD;EACE,SAAS;EACT,OAAO,OAAO;EACd,QAAQ,OAAO;EACP;EACE;EACV,MAAM;EACO;EACP;EACC;EACG;EACV,iBAAiB;EACjB,eAAe,MAAM;AACnB,aAAU,EAAE;AACZ,aAAU,MAAM;;EAElB,CAAA,CAEH,EAAA,CAAA;EAGR;AAED,gBAAgB,cAAc"}