@usefui/components 1.5.1 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/index.d.mts +237 -9
- package/dist/index.d.ts +237 -9
- package/dist/index.js +1095 -311
- package/dist/index.mjs +1049 -278
- package/package.json +6 -6
- package/src/avatar/index.tsx +1 -1
- package/src/badge/index.tsx +3 -3
- package/src/breadcrumb/Breadcrumb.stories.tsx +36 -0
- package/src/breadcrumb/index.tsx +117 -0
- package/src/breadcrumb/styles/index.ts +19 -0
- package/src/button/Button.stories.tsx +80 -8
- package/src/button/index.tsx +67 -5
- package/src/button/styles/index.ts +82 -10
- package/src/card/Card.stories.tsx +57 -0
- package/src/card/index.tsx +55 -0
- package/src/card/styles/index.ts +72 -0
- package/src/copy-button/CopyButton.stories.tsx +29 -0
- package/src/copy-button/index.tsx +101 -0
- package/src/dialog/index.tsx +1 -1
- package/src/dropdown/index.tsx +1 -1
- package/src/field/Field.stories.tsx +39 -8
- package/src/field/index.tsx +5 -0
- package/src/field/styles/index.ts +38 -12
- package/src/index.ts +8 -0
- package/src/page/index.tsx +1 -1
- package/src/privacy-field/PrivacyField.stories.tsx +29 -0
- package/src/privacy-field/index.tsx +56 -0
- package/src/privacy-field/styles/index.ts +17 -0
- package/src/resizable/Resizable.stories.tsx +40 -0
- package/src/resizable/index.tsx +108 -0
- package/src/resizable/styles/index.ts +65 -0
- package/src/skeleton/Skeleton.stories.tsx +32 -0
- package/src/skeleton/index.tsx +43 -0
- package/src/skeleton/styles/index.ts +56 -0
- package/src/spinner/Spinner.stories.tsx +27 -0
- package/src/spinner/index.tsx +19 -0
- package/src/spinner/styles/index.ts +43 -0
- package/src/text-area/Textarea.stories.tsx +32 -0
- package/src/text-area/index.tsx +78 -0
- package/src/text-area/styles/index.ts +84 -0
- package/src/tooltip/index.tsx +4 -3
package/dist/index.mjs
CHANGED
|
@@ -62,6 +62,11 @@ var ButtonDefaultStyles = css`
|
|
|
62
62
|
opacity: 0.6;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
svg,
|
|
66
|
+
span {
|
|
67
|
+
transition: all 0.2s ease-in-out;
|
|
68
|
+
}
|
|
69
|
+
|
|
65
70
|
&:hover,
|
|
66
71
|
&:focus,
|
|
67
72
|
&:active {
|
|
@@ -114,19 +119,19 @@ var ButtonVariantsStyles = css`
|
|
|
114
119
|
}
|
|
115
120
|
&[data-variant="secondary"] {
|
|
116
121
|
color: var(--font-color-alpha-60);
|
|
117
|
-
background-color:
|
|
122
|
+
background-color: transparent;
|
|
118
123
|
border-color: var(--font-color-alpha-10);
|
|
119
124
|
|
|
120
125
|
&:hover,
|
|
121
126
|
&:focus,
|
|
122
127
|
&:active {
|
|
123
128
|
color: var(--font-color);
|
|
124
|
-
|
|
129
|
+
background-color: var(--font-color-alpha-10);
|
|
130
|
+
border-color: transparent;
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
&[data-variant="tertiary"] {
|
|
128
|
-
color: var(--font-color-alpha-
|
|
129
|
-
border-color: var(--font-color-alpha-10);
|
|
134
|
+
color: var(--font-color-alpha-80);
|
|
130
135
|
background-color: transparent;
|
|
131
136
|
|
|
132
137
|
&:hover,
|
|
@@ -134,7 +139,6 @@ var ButtonVariantsStyles = css`
|
|
|
134
139
|
&:active {
|
|
135
140
|
color: var(--font-color);
|
|
136
141
|
background-color: var(--font-color-alpha-10);
|
|
137
|
-
border-color: transparent;
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
&[data-variant="border"] {
|
|
@@ -146,6 +150,27 @@ var ButtonVariantsStyles = css`
|
|
|
146
150
|
&:focus,
|
|
147
151
|
&:active {
|
|
148
152
|
color: var(--font-color);
|
|
153
|
+
border-color: var(--font-color-alpha-20);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
&[data-variant="danger"] {
|
|
157
|
+
color: var(--color-mono-white);
|
|
158
|
+
background-color: var(--color-red);
|
|
159
|
+
|
|
160
|
+
&:hover,
|
|
161
|
+
&:focus,
|
|
162
|
+
&:active {
|
|
163
|
+
background-color: var(--shade-red-10);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
&[data-variant="warning"] {
|
|
167
|
+
color: var(--color-mono-dark);
|
|
168
|
+
background-color: var(--color-orange);
|
|
169
|
+
|
|
170
|
+
&:hover,
|
|
171
|
+
&:focus,
|
|
172
|
+
&:active {
|
|
173
|
+
background-color: var(--shade-orange-10);
|
|
149
174
|
}
|
|
150
175
|
}
|
|
151
176
|
&[data-variant="mono"] {
|
|
@@ -176,8 +201,7 @@ var ButtonVariantsStyles = css`
|
|
|
176
201
|
`;
|
|
177
202
|
var ButtonSizeStyles = css`
|
|
178
203
|
&[data-size="small"] {
|
|
179
|
-
|
|
180
|
-
font-size: var(--fontsize-medium-10);
|
|
204
|
+
font-size: var(--fontsize-small-60);
|
|
181
205
|
|
|
182
206
|
gap: var(--measurement-medium-10);
|
|
183
207
|
padding: var(--measurement-medium-10) var(--measurement-medium-30);
|
|
@@ -190,39 +214,83 @@ var ButtonSizeStyles = css`
|
|
|
190
214
|
}
|
|
191
215
|
}
|
|
192
216
|
&[data-size="medium"] {
|
|
193
|
-
border-radius: var(--measurement-medium-30);
|
|
194
217
|
padding: var(--measurement-medium-10) var(--measurement-medium-60);
|
|
195
218
|
min-width: var(--measurement-medium-90);
|
|
196
219
|
min-height: var(--measurement-medium-80);
|
|
197
220
|
}
|
|
198
221
|
&[data-size="large"] {
|
|
199
|
-
border-radius: var(--measurement-medium-30);
|
|
200
222
|
padding: var(--measurement-medium-10) var(--measurement-medium-60);
|
|
201
223
|
min-width: var(--measurement-medium-90);
|
|
202
224
|
min-height: var(--measurement-medium-90);
|
|
203
225
|
}
|
|
204
226
|
`;
|
|
227
|
+
var ButtonShapeStyles = css`
|
|
228
|
+
&[data-shape="square"] {
|
|
229
|
+
border-radius: 0;
|
|
230
|
+
}
|
|
231
|
+
&[data-shape="smooth"] {
|
|
232
|
+
border-radius: var(--measurement-medium-20);
|
|
233
|
+
}
|
|
234
|
+
&[data-shape="round"] {
|
|
235
|
+
border-radius: var(--measurement-large-90);
|
|
236
|
+
}
|
|
237
|
+
`;
|
|
205
238
|
var ButtonWrapper = styled.button`
|
|
206
239
|
&[data-raw="false"] {
|
|
207
240
|
${ButtonDefaultStyles}
|
|
208
241
|
${ButtonSizeStyles}
|
|
242
|
+
${ButtonShapeStyles}
|
|
209
243
|
${ButtonVariantsStyles}
|
|
210
|
-
|
|
211
244
|
&[data-rawIcon="false"] {
|
|
212
245
|
${ButtonIconStyles}
|
|
213
246
|
}
|
|
214
247
|
}
|
|
215
248
|
`;
|
|
249
|
+
var ButtonOverlay = styled.div`
|
|
250
|
+
position: absolute;
|
|
251
|
+
inset: -1px;
|
|
252
|
+
pointer-events: none;
|
|
253
|
+
opacity: ${(props) => props.$isHovering ? 1 : 0};
|
|
254
|
+
background: transparent;
|
|
255
|
+
transition: opacity 0.2s ease-in-out;
|
|
256
|
+
|
|
257
|
+
${ButtonShapeStyles}
|
|
258
|
+
`;
|
|
259
|
+
var ButtonMaskElement = styled.div`
|
|
260
|
+
position: absolute;
|
|
261
|
+
inset: 0;
|
|
262
|
+
background: transparent;
|
|
263
|
+
border: var(--measurement-small-10) solid var(--font-color-alpha-20);
|
|
264
|
+
clip-path: inset(0 round var(--measurement-medium-30));
|
|
265
|
+
|
|
266
|
+
mask-image: radial-gradient(
|
|
267
|
+
circle at ${(props) => props.$mouseX}% ${(props) => props.$mouseY}%,
|
|
268
|
+
var(--body-color),
|
|
269
|
+
transparent 100%
|
|
270
|
+
);
|
|
271
|
+
-webkit-mask-image: radial-gradient(
|
|
272
|
+
circle at ${(props) => props.$mouseX}% ${(props) => props.$mouseY}%,
|
|
273
|
+
var(--body-color),
|
|
274
|
+
transparent 100%
|
|
275
|
+
);
|
|
276
|
+
|
|
277
|
+
${ButtonShapeStyles}
|
|
278
|
+
`;
|
|
216
279
|
|
|
217
280
|
// src/button/index.tsx
|
|
218
281
|
var Button = React2.forwardRef(
|
|
219
282
|
(props, forwardedRef) => {
|
|
220
283
|
const {
|
|
221
284
|
name,
|
|
222
|
-
variant = "
|
|
285
|
+
variant = "primary" /* Primary */,
|
|
223
286
|
sizing = "medium" /* Medium */,
|
|
287
|
+
shape = "smooth",
|
|
288
|
+
animation,
|
|
224
289
|
raw,
|
|
225
290
|
rawicon,
|
|
291
|
+
onMouseMove,
|
|
292
|
+
onMouseEnter,
|
|
293
|
+
onMouseLeave,
|
|
226
294
|
children,
|
|
227
295
|
...restProps
|
|
228
296
|
} = props;
|
|
@@ -233,6 +301,37 @@ var Button = React2.forwardRef(
|
|
|
233
301
|
const buttonDescription = `${ariaLabel}:${buttonType}`;
|
|
234
302
|
const buttonStateDescription = `disabled:${disabledState}`;
|
|
235
303
|
const ButtonFullDesc = `${buttonDescription}/${buttonStateDescription}`;
|
|
304
|
+
const isReflective = animation === "reflective" && variant !== "ghost";
|
|
305
|
+
const [position, setPosition] = React2.useState({ x: 0, y: 0 });
|
|
306
|
+
const [isHovering, setIsHovering] = React2.useState(false);
|
|
307
|
+
const handleMouseMove = React2.useCallback(
|
|
308
|
+
(e) => {
|
|
309
|
+
if (onMouseMove) onMouseMove(e);
|
|
310
|
+
if (!isReflective) return;
|
|
311
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
312
|
+
setPosition({
|
|
313
|
+
x: (e.clientX - rect.left) / rect.width * 100,
|
|
314
|
+
y: (e.clientY - rect.top) / rect.height * 100
|
|
315
|
+
});
|
|
316
|
+
},
|
|
317
|
+
[]
|
|
318
|
+
);
|
|
319
|
+
const handleMouseEnter = React2.useCallback(
|
|
320
|
+
(e) => {
|
|
321
|
+
if (onMouseEnter) onMouseEnter(e);
|
|
322
|
+
if (!isReflective) return;
|
|
323
|
+
setIsHovering(true);
|
|
324
|
+
},
|
|
325
|
+
[]
|
|
326
|
+
);
|
|
327
|
+
const handleMouseLeave = React2.useCallback(
|
|
328
|
+
(e) => {
|
|
329
|
+
if (onMouseLeave) onMouseLeave(e);
|
|
330
|
+
if (!isReflective) return;
|
|
331
|
+
setIsHovering(false);
|
|
332
|
+
},
|
|
333
|
+
[]
|
|
334
|
+
);
|
|
236
335
|
return /* @__PURE__ */ React2.createElement(
|
|
237
336
|
ButtonWrapper,
|
|
238
337
|
{
|
|
@@ -245,11 +344,24 @@ var Button = React2.forwardRef(
|
|
|
245
344
|
"aria-disabled": disabledState,
|
|
246
345
|
"data-variant": variant,
|
|
247
346
|
"data-size": sizing,
|
|
347
|
+
"data-shape": shape,
|
|
348
|
+
"data-animation": animation,
|
|
248
349
|
"data-raw": Boolean(raw),
|
|
249
350
|
"data-rawicon": Boolean(rawicon),
|
|
250
351
|
tabIndex: 0,
|
|
352
|
+
onMouseMove: handleMouseMove,
|
|
353
|
+
onMouseEnter: handleMouseEnter,
|
|
354
|
+
onMouseLeave: handleMouseLeave,
|
|
251
355
|
...restProps
|
|
252
356
|
},
|
|
357
|
+
isReflective && /* @__PURE__ */ React2.createElement(ButtonOverlay, { $isHovering: isHovering, "data-shape": shape }, /* @__PURE__ */ React2.createElement(
|
|
358
|
+
ButtonMaskElement,
|
|
359
|
+
{
|
|
360
|
+
$mouseX: position.x,
|
|
361
|
+
$mouseY: position.y,
|
|
362
|
+
"data-shape": shape
|
|
363
|
+
}
|
|
364
|
+
)),
|
|
253
365
|
children
|
|
254
366
|
);
|
|
255
367
|
}
|
|
@@ -604,11 +716,172 @@ var Badge = (props) => {
|
|
|
604
716
|
};
|
|
605
717
|
Badge.displayName = "Badge";
|
|
606
718
|
|
|
607
|
-
// src/
|
|
719
|
+
// src/breadcrumb/index.tsx
|
|
720
|
+
import React6 from "react";
|
|
721
|
+
|
|
722
|
+
// src/breadcrumb/styles/index.ts
|
|
723
|
+
import styled4 from "styled-components";
|
|
724
|
+
var ItemWrapper = styled4.span`
|
|
725
|
+
width: 100%;
|
|
726
|
+
line-clamp: 2;
|
|
727
|
+
word-break: break-all;
|
|
728
|
+
|
|
729
|
+
&[data-current="true"] {
|
|
730
|
+
opacity: 1 !important;
|
|
731
|
+
}
|
|
732
|
+
`;
|
|
733
|
+
var SeparatorItem = styled4.span`
|
|
734
|
+
color: var(--font-color-alpha-10) !important;
|
|
735
|
+
user-select: none;
|
|
736
|
+
pointer-events: none;
|
|
737
|
+
`;
|
|
738
|
+
|
|
739
|
+
// src/breadcrumb/index.tsx
|
|
740
|
+
var SEGMENT_SEPARATOR = "/";
|
|
741
|
+
var BreadcrumbItem = (props) => {
|
|
742
|
+
const { isLastItem = false, children, ...restProps } = props;
|
|
743
|
+
return /* @__PURE__ */ React6.createElement(Button, { sizing: "small", variant: "ghost", ...restProps }, /* @__PURE__ */ React6.createElement(ItemWrapper, { "data-current": isLastItem }, children));
|
|
744
|
+
};
|
|
745
|
+
BreadcrumbItem.displayName = "Breadcrumb.Item";
|
|
746
|
+
var BreadcrumbSeparator = (props) => {
|
|
747
|
+
const { children } = props;
|
|
748
|
+
return /* @__PURE__ */ React6.createElement(SeparatorItem, null, children ?? SEGMENT_SEPARATOR);
|
|
749
|
+
};
|
|
750
|
+
BreadcrumbSeparator.displayName = "Breadcrumb.Separator";
|
|
751
|
+
var Breadcrumb = (props) => {
|
|
752
|
+
const { path, navigate, capitalizeItems = true, children } = props;
|
|
753
|
+
const segments = path.split(SEGMENT_SEPARATOR).filter(Boolean);
|
|
754
|
+
const items = segments.map((segment, index) => {
|
|
755
|
+
const href = `/${segments.slice(0, index + 1).join(SEGMENT_SEPARATOR)}`;
|
|
756
|
+
const isLastItem = index === segments.length - 1;
|
|
757
|
+
return {
|
|
758
|
+
href,
|
|
759
|
+
label: segment,
|
|
760
|
+
isLastItem
|
|
761
|
+
};
|
|
762
|
+
});
|
|
763
|
+
const breadcrumbLabel = (segment) => {
|
|
764
|
+
return capitalizeItems ? segment.charAt(0).toUpperCase() + segment.slice(1).replace(/-/g, " ") : segment.replace(/-/g, " ");
|
|
765
|
+
};
|
|
766
|
+
const handleNavigate = React6.useCallback((href) => {
|
|
767
|
+
if (navigate) navigate(href);
|
|
768
|
+
}, []);
|
|
769
|
+
if (path === SEGMENT_SEPARATOR) return null;
|
|
770
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "flex align-center g-medium-30" }, children && /* @__PURE__ */ React6.createElement(React6.Fragment, null, children, /* @__PURE__ */ React6.createElement(Breadcrumb.Separator, null)), items.map((item, key) => /* @__PURE__ */ React6.createElement(React6.Fragment, { key }, /* @__PURE__ */ React6.createElement(
|
|
771
|
+
Breadcrumb.Item,
|
|
772
|
+
{
|
|
773
|
+
isLastItem: item.isLastItem,
|
|
774
|
+
disabled: !navigate,
|
|
775
|
+
onClick: () => handleNavigate(item.href)
|
|
776
|
+
},
|
|
777
|
+
breadcrumbLabel(item.label)
|
|
778
|
+
), !item.isLastItem && /* @__PURE__ */ React6.createElement(Breadcrumb.Separator, null))));
|
|
779
|
+
};
|
|
780
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
781
|
+
Breadcrumb.Item = BreadcrumbItem;
|
|
782
|
+
Breadcrumb.Separator = BreadcrumbSeparator;
|
|
783
|
+
|
|
784
|
+
// src/card/index.tsx
|
|
608
785
|
import React7 from "react";
|
|
609
786
|
|
|
787
|
+
// src/card/styles/index.ts
|
|
788
|
+
import styled5, { css as css4 } from "styled-components";
|
|
789
|
+
var GridDefaultStyles = css4`
|
|
790
|
+
display: grid;
|
|
791
|
+
grid-gap: var(--measurement-medium-30) var(--measurement-medium-30);
|
|
792
|
+
box-sizing: border-box;
|
|
793
|
+
|
|
794
|
+
@media (max-width: 768px) {
|
|
795
|
+
grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
|
|
796
|
+
}
|
|
797
|
+
`;
|
|
798
|
+
var GridSizeStyles = css4`
|
|
799
|
+
&[data-size="small"] {
|
|
800
|
+
grid-template-columns: repeat(
|
|
801
|
+
auto-fill,
|
|
802
|
+
minmax(var(--measurement-large-80), 1fr)
|
|
803
|
+
);
|
|
804
|
+
}
|
|
805
|
+
&[data-size="medium"] {
|
|
806
|
+
grid-template-columns: repeat(
|
|
807
|
+
auto-fill,
|
|
808
|
+
minmax(var(--measurement-large-90), 1fr)
|
|
809
|
+
);
|
|
810
|
+
}
|
|
811
|
+
&[data-size="large"] {
|
|
812
|
+
grid-template-columns: repeat(
|
|
813
|
+
auto-fill,
|
|
814
|
+
minmax(calc(var(--measurement-large-90) * 1.2), 1fr)
|
|
815
|
+
);
|
|
816
|
+
}
|
|
817
|
+
`;
|
|
818
|
+
var CardShapeStyles = css4`
|
|
819
|
+
&[data-shape="square"] {
|
|
820
|
+
border-radius: 0;
|
|
821
|
+
}
|
|
822
|
+
&[data-shape="smooth"] {
|
|
823
|
+
border-radius: var(--measurement-medium-30);
|
|
824
|
+
}
|
|
825
|
+
&[data-shape="round"] {
|
|
826
|
+
border-radius: var(--measurement-medium-60);
|
|
827
|
+
}
|
|
828
|
+
`;
|
|
829
|
+
var CardDefaultStyles = css4`
|
|
830
|
+
${CardShapeStyles}
|
|
831
|
+
|
|
832
|
+
box-sizing: border-box;
|
|
833
|
+
`;
|
|
834
|
+
var CardContainer = styled5.div`
|
|
835
|
+
width: 100%;
|
|
836
|
+
background-color: var(--font-color-alpha-10);
|
|
837
|
+
|
|
838
|
+
${CardDefaultStyles}
|
|
839
|
+
`;
|
|
840
|
+
var CardWrapper = styled5.div`
|
|
841
|
+
display: flex;
|
|
842
|
+
flex-direction: column;
|
|
843
|
+
gap: var(--measurement-large-10);
|
|
844
|
+
padding: var(--measurement-medium-60);
|
|
845
|
+
background-color: var(--contrast-color);
|
|
846
|
+
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
847
|
+
|
|
848
|
+
${CardDefaultStyles}
|
|
849
|
+
`;
|
|
850
|
+
var CardsGrid = styled5.div`
|
|
851
|
+
${GridDefaultStyles}
|
|
852
|
+
${GridSizeStyles}
|
|
853
|
+
`;
|
|
854
|
+
|
|
855
|
+
// src/card/index.tsx
|
|
856
|
+
var CardGrid = (props) => {
|
|
857
|
+
const { sizing = "medium", children } = props;
|
|
858
|
+
return /* @__PURE__ */ React7.createElement(CardsGrid, { "data-size": sizing }, children);
|
|
859
|
+
};
|
|
860
|
+
CardGrid.displayName = "Card.Grid";
|
|
861
|
+
var CardMeta = (props) => {
|
|
862
|
+
const { children } = props;
|
|
863
|
+
return /* @__PURE__ */ React7.createElement("div", { className: "p-y-medium-20 p-x-medium-30", ...props }, children);
|
|
864
|
+
};
|
|
865
|
+
CardMeta.displayName = "Card.Meta";
|
|
866
|
+
var CardBody = (props) => {
|
|
867
|
+
const { shape = "smooth", children } = props;
|
|
868
|
+
return /* @__PURE__ */ React7.createElement(CardWrapper, { "data-shape": shape }, children);
|
|
869
|
+
};
|
|
870
|
+
CardBody.displayName = "Card.Body";
|
|
871
|
+
var Card = (props) => {
|
|
872
|
+
const { shape = "smooth", children } = props;
|
|
873
|
+
return /* @__PURE__ */ React7.createElement(CardContainer, { "data-shape": shape }, " ", children);
|
|
874
|
+
};
|
|
875
|
+
Card.displayName = "Card";
|
|
876
|
+
Card.Grid = CardGrid;
|
|
877
|
+
Card.Meta = CardMeta;
|
|
878
|
+
Card.Body = CardBody;
|
|
879
|
+
|
|
880
|
+
// src/checkbox/index.tsx
|
|
881
|
+
import React9 from "react";
|
|
882
|
+
|
|
610
883
|
// src/checkbox/hooks/index.tsx
|
|
611
|
-
import
|
|
884
|
+
import React8, { useState as useState2, createContext as createContext2, useContext as useContext2 } from "react";
|
|
612
885
|
var defaultComponentAPI2 = {
|
|
613
886
|
id: "",
|
|
614
887
|
states: {},
|
|
@@ -618,11 +891,11 @@ var CheckboxContext = createContext2(defaultComponentAPI2);
|
|
|
618
891
|
var useCheckbox = () => useContext2(CheckboxContext);
|
|
619
892
|
var CheckboxProvider = ({ children }) => {
|
|
620
893
|
const context = useCheckboxProvider();
|
|
621
|
-
return /* @__PURE__ */
|
|
894
|
+
return /* @__PURE__ */ React8.createElement(CheckboxContext.Provider, { value: context }, children);
|
|
622
895
|
};
|
|
623
896
|
function useCheckboxProvider() {
|
|
624
897
|
const [checked, setChecked] = useState2(false);
|
|
625
|
-
const checkboxId =
|
|
898
|
+
const checkboxId = React8.useId();
|
|
626
899
|
return {
|
|
627
900
|
id: checkboxId,
|
|
628
901
|
states: {
|
|
@@ -636,8 +909,8 @@ function useCheckboxProvider() {
|
|
|
636
909
|
}
|
|
637
910
|
|
|
638
911
|
// src/checkbox/styles/index.ts
|
|
639
|
-
import
|
|
640
|
-
var CheckboxDefaultStyles =
|
|
912
|
+
import styled6, { css as css5 } from "styled-components";
|
|
913
|
+
var CheckboxDefaultStyles = css5`
|
|
641
914
|
position: relative;
|
|
642
915
|
display: flex;
|
|
643
916
|
align-items: center;
|
|
@@ -645,7 +918,7 @@ var CheckboxDefaultStyles = css4`
|
|
|
645
918
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
646
919
|
transition: all ease-in-out 0.2s;
|
|
647
920
|
`;
|
|
648
|
-
var CheckboxVariantsStyles =
|
|
921
|
+
var CheckboxVariantsStyles = css5`
|
|
649
922
|
&[data-variant="primary"] {
|
|
650
923
|
background-color: var(--font-color-alpha-10);
|
|
651
924
|
border: var(--measurement-small-10) solid transparent;
|
|
@@ -717,7 +990,7 @@ var CheckboxVariantsStyles = css4`
|
|
|
717
990
|
}
|
|
718
991
|
}
|
|
719
992
|
`;
|
|
720
|
-
var CheckboxSizeStyles =
|
|
993
|
+
var CheckboxSizeStyles = css5`
|
|
721
994
|
&[data-size="small"] {
|
|
722
995
|
width: var(--measurement-medium-60);
|
|
723
996
|
height: var(--measurement-medium-60);
|
|
@@ -734,7 +1007,7 @@ var CheckboxSizeStyles = css4`
|
|
|
734
1007
|
border-radius: var(--measurement-medium-20);
|
|
735
1008
|
}
|
|
736
1009
|
`;
|
|
737
|
-
var CheckboxWrapper =
|
|
1010
|
+
var CheckboxWrapper = styled6.div`
|
|
738
1011
|
cursor: pointer;
|
|
739
1012
|
|
|
740
1013
|
&[data-raw="false"] {
|
|
@@ -752,7 +1025,7 @@ var CheckboxWrapper = styled4.div`
|
|
|
752
1025
|
}
|
|
753
1026
|
}
|
|
754
1027
|
`;
|
|
755
|
-
var NativeInput =
|
|
1028
|
+
var NativeInput = styled6.input`
|
|
756
1029
|
&[data-raw="false"] {
|
|
757
1030
|
appearance: none;
|
|
758
1031
|
background: none;
|
|
@@ -769,7 +1042,7 @@ var NativeInput = styled4.input`
|
|
|
769
1042
|
}
|
|
770
1043
|
}
|
|
771
1044
|
`;
|
|
772
|
-
var Indicator =
|
|
1045
|
+
var Indicator = styled6.span`
|
|
773
1046
|
line-height: 0;
|
|
774
1047
|
pointer-events: none;
|
|
775
1048
|
`;
|
|
@@ -796,10 +1069,10 @@ var Checkbox = (props) => {
|
|
|
796
1069
|
if (toggleChecked) toggleChecked();
|
|
797
1070
|
if (onClick) onClick(event);
|
|
798
1071
|
};
|
|
799
|
-
|
|
1072
|
+
React9.useEffect(() => {
|
|
800
1073
|
if (defaultChecked && applyChecked) applyChecked(defaultChecked);
|
|
801
1074
|
}, []);
|
|
802
|
-
return /* @__PURE__ */
|
|
1075
|
+
return /* @__PURE__ */ React9.createElement(
|
|
803
1076
|
CheckboxWrapper,
|
|
804
1077
|
{
|
|
805
1078
|
role: "checkbox",
|
|
@@ -811,7 +1084,7 @@ var Checkbox = (props) => {
|
|
|
811
1084
|
"data-variant": variant,
|
|
812
1085
|
"aria-label": props["aria-label"] ?? `${name}-checkbox`
|
|
813
1086
|
},
|
|
814
|
-
/* @__PURE__ */
|
|
1087
|
+
/* @__PURE__ */ React9.createElement(
|
|
815
1088
|
NativeInput,
|
|
816
1089
|
{
|
|
817
1090
|
type: "checkbox",
|
|
@@ -837,13 +1110,13 @@ var Checkbox = (props) => {
|
|
|
837
1110
|
Checkbox.displayName = "Checkbox";
|
|
838
1111
|
var CheckboxRoot = (props) => {
|
|
839
1112
|
const { children, ...restProps } = props;
|
|
840
|
-
return /* @__PURE__ */
|
|
1113
|
+
return /* @__PURE__ */ React9.createElement(CheckboxProvider, { ...restProps }, children);
|
|
841
1114
|
};
|
|
842
1115
|
CheckboxRoot.displayName = "Checkbox.Root";
|
|
843
1116
|
var CheckboxIndicator = (props) => {
|
|
844
1117
|
const { states } = useCheckbox();
|
|
845
1118
|
const { children, ...restProps } = props;
|
|
846
|
-
return /* @__PURE__ */
|
|
1119
|
+
return /* @__PURE__ */ React9.createElement(React9.Fragment, null, states.checked && /* @__PURE__ */ React9.createElement(Indicator, { ...restProps }, children ?? /* @__PURE__ */ React9.createElement(
|
|
847
1120
|
"svg",
|
|
848
1121
|
{
|
|
849
1122
|
tabIndex: -1,
|
|
@@ -855,8 +1128,8 @@ var CheckboxIndicator = (props) => {
|
|
|
855
1128
|
viewBox: "0 0 10 10",
|
|
856
1129
|
fill: "none"
|
|
857
1130
|
},
|
|
858
|
-
/* @__PURE__ */
|
|
859
|
-
/* @__PURE__ */
|
|
1131
|
+
/* @__PURE__ */ React9.createElement("title", null, "Checked"),
|
|
1132
|
+
/* @__PURE__ */ React9.createElement(
|
|
860
1133
|
"path",
|
|
861
1134
|
{
|
|
862
1135
|
d: "M2 5.5L4.12132 7.62132L8.36396 3.37868",
|
|
@@ -872,10 +1145,10 @@ Checkbox.Root = CheckboxRoot;
|
|
|
872
1145
|
Checkbox.Indicator = CheckboxIndicator;
|
|
873
1146
|
|
|
874
1147
|
// src/collapsible/index.tsx
|
|
875
|
-
import
|
|
1148
|
+
import React11 from "react";
|
|
876
1149
|
|
|
877
1150
|
// src/collapsible/hooks/index.tsx
|
|
878
|
-
import
|
|
1151
|
+
import React10, { useState as useState3, createContext as createContext3, useContext as useContext3 } from "react";
|
|
879
1152
|
var defaultComponentAPI3 = {
|
|
880
1153
|
id: "",
|
|
881
1154
|
states: {},
|
|
@@ -887,12 +1160,12 @@ var CollapsibleProvider = ({
|
|
|
887
1160
|
children
|
|
888
1161
|
}) => {
|
|
889
1162
|
const context = useCollapsibleProvider();
|
|
890
|
-
return /* @__PURE__ */
|
|
1163
|
+
return /* @__PURE__ */ React10.createElement(CollapsibleContext.Provider, { value: context }, children);
|
|
891
1164
|
};
|
|
892
1165
|
function useCollapsibleProvider() {
|
|
893
1166
|
const [expanded, setExpanded] = useState3(false);
|
|
894
1167
|
const [defaultOpen, setDefaultOpen] = useState3(false);
|
|
895
|
-
const collapsibleId =
|
|
1168
|
+
const collapsibleId = React10.useId();
|
|
896
1169
|
const toggleCollapsible = () => {
|
|
897
1170
|
setExpanded(!expanded);
|
|
898
1171
|
setDefaultOpen(false);
|
|
@@ -921,7 +1194,7 @@ var applyDataState = (condition) => condition ? "open" : "closed";
|
|
|
921
1194
|
var Collapsible = (props) => {
|
|
922
1195
|
const { children, ...restProps } = props;
|
|
923
1196
|
const collapsibleContext = useCollapsible();
|
|
924
|
-
return /* @__PURE__ */
|
|
1197
|
+
return /* @__PURE__ */ React11.createElement(
|
|
925
1198
|
"div",
|
|
926
1199
|
{
|
|
927
1200
|
"data-state": applyDataState(Boolean(collapsibleContext.states.expanded)),
|
|
@@ -932,7 +1205,7 @@ var Collapsible = (props) => {
|
|
|
932
1205
|
};
|
|
933
1206
|
Collapsible.displayName = "Collapsible";
|
|
934
1207
|
var CollapsibleRoot = ({ children }) => {
|
|
935
|
-
return /* @__PURE__ */
|
|
1208
|
+
return /* @__PURE__ */ React11.createElement(CollapsibleProvider, null, children);
|
|
936
1209
|
};
|
|
937
1210
|
CollapsibleRoot.displayName = "Collapsible.Root";
|
|
938
1211
|
var CollapsibleTrigger = (props) => {
|
|
@@ -943,7 +1216,7 @@ var CollapsibleTrigger = (props) => {
|
|
|
943
1216
|
if (toggleCollapsible) toggleCollapsible();
|
|
944
1217
|
if (onClick) onClick(event);
|
|
945
1218
|
};
|
|
946
|
-
return /* @__PURE__ */
|
|
1219
|
+
return /* @__PURE__ */ React11.createElement(
|
|
947
1220
|
Button,
|
|
948
1221
|
{
|
|
949
1222
|
disabled,
|
|
@@ -962,13 +1235,13 @@ var CollapsibleContent = (props) => {
|
|
|
962
1235
|
const { defaultOpen = false, showFirstChild, children, ...restProps } = props;
|
|
963
1236
|
const { id, states, methods } = useCollapsible();
|
|
964
1237
|
const { applyDefaultOpen } = methods;
|
|
965
|
-
const childArray =
|
|
1238
|
+
const childArray = React11.Children.toArray(children);
|
|
966
1239
|
const displayChildren = states.expanded ?? states.defaultOpen;
|
|
967
1240
|
const displayFirstChild = showFirstChild && childArray.length > 1 && !states.expanded;
|
|
968
|
-
|
|
1241
|
+
React11.useEffect(() => {
|
|
969
1242
|
if (defaultOpen && applyDefaultOpen) applyDefaultOpen();
|
|
970
1243
|
}, []);
|
|
971
|
-
return /* @__PURE__ */
|
|
1244
|
+
return /* @__PURE__ */ React11.createElement(
|
|
972
1245
|
"div",
|
|
973
1246
|
{
|
|
974
1247
|
id,
|
|
@@ -985,11 +1258,74 @@ Collapsible.Root = CollapsibleRoot;
|
|
|
985
1258
|
Collapsible.Trigger = CollapsibleTrigger;
|
|
986
1259
|
Collapsible.Content = CollapsibleContent;
|
|
987
1260
|
|
|
988
|
-
// src/
|
|
1261
|
+
// src/copy-button/index.tsx
|
|
989
1262
|
import React12 from "react";
|
|
1263
|
+
var CopyButton = ({
|
|
1264
|
+
value,
|
|
1265
|
+
delay,
|
|
1266
|
+
tooltip,
|
|
1267
|
+
children,
|
|
1268
|
+
...restProps
|
|
1269
|
+
}) => {
|
|
1270
|
+
const timerRef = React12.useRef(null);
|
|
1271
|
+
const [copied, setCopied] = React12.useState(false);
|
|
1272
|
+
const tooltipLabels = React12.useMemo(() => {
|
|
1273
|
+
return {
|
|
1274
|
+
copy: tooltip?.copyLabel ?? "Copy",
|
|
1275
|
+
copied: tooltip?.copiedLabel ?? "Copied!"
|
|
1276
|
+
};
|
|
1277
|
+
}, [tooltip]);
|
|
1278
|
+
const copyToClipboard = async () => {
|
|
1279
|
+
if (value == null) return;
|
|
1280
|
+
try {
|
|
1281
|
+
await navigator.clipboard.writeText(value);
|
|
1282
|
+
setCopied(true);
|
|
1283
|
+
} catch {
|
|
1284
|
+
const ta = document.createElement("textarea");
|
|
1285
|
+
ta.value = value;
|
|
1286
|
+
ta.style.position = "fixed";
|
|
1287
|
+
ta.style.opacity = "0";
|
|
1288
|
+
document.body.appendChild(ta);
|
|
1289
|
+
ta.select();
|
|
1290
|
+
try {
|
|
1291
|
+
document.execCommand("copy");
|
|
1292
|
+
setCopied(true);
|
|
1293
|
+
} finally {
|
|
1294
|
+
document.body.removeChild(ta);
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
if (timerRef.current != null) window.clearTimeout(timerRef.current);
|
|
1298
|
+
timerRef.current = window.setTimeout(() => setCopied(false), delay ?? 1e3);
|
|
1299
|
+
};
|
|
1300
|
+
React12.useEffect(() => {
|
|
1301
|
+
return () => {
|
|
1302
|
+
if (timerRef.current != null) {
|
|
1303
|
+
window.clearTimeout(timerRef.current);
|
|
1304
|
+
timerRef.current = null;
|
|
1305
|
+
}
|
|
1306
|
+
};
|
|
1307
|
+
}, []);
|
|
1308
|
+
return /* @__PURE__ */ React12.createElement(Tooltip, { content: copied ? tooltipLabels.copied : tooltipLabels.copy }, /* @__PURE__ */ React12.createElement(
|
|
1309
|
+
Button,
|
|
1310
|
+
{
|
|
1311
|
+
"data-testId": "copy-code",
|
|
1312
|
+
"aria-label": "copy-code",
|
|
1313
|
+
disabled: value == null,
|
|
1314
|
+
"aria-disabled": value == null,
|
|
1315
|
+
variant: restProps?.variant ?? "ghost",
|
|
1316
|
+
onClick: copyToClipboard,
|
|
1317
|
+
...restProps
|
|
1318
|
+
},
|
|
1319
|
+
children
|
|
1320
|
+
));
|
|
1321
|
+
};
|
|
1322
|
+
CopyButton.displayName = "CopyButton";
|
|
1323
|
+
|
|
1324
|
+
// src/dialog/index.tsx
|
|
1325
|
+
import React15 from "react";
|
|
990
1326
|
|
|
991
1327
|
// src/dialog/hooks/index.tsx
|
|
992
|
-
import
|
|
1328
|
+
import React13, { useState as useState4, createContext as createContext4, useContext as useContext4 } from "react";
|
|
993
1329
|
var defaultComponentAPI4 = {
|
|
994
1330
|
id: "",
|
|
995
1331
|
states: {},
|
|
@@ -999,11 +1335,11 @@ var DialogContext = createContext4(defaultComponentAPI4);
|
|
|
999
1335
|
var useDialog = () => useContext4(DialogContext);
|
|
1000
1336
|
var DialogProvider = ({ children }) => {
|
|
1001
1337
|
const context = useDialogProvider();
|
|
1002
|
-
return /* @__PURE__ */
|
|
1338
|
+
return /* @__PURE__ */ React13.createElement(DialogContext.Provider, { value: context }, children);
|
|
1003
1339
|
};
|
|
1004
1340
|
function useDialogProvider() {
|
|
1005
1341
|
const [open, setOpen] = useState4(false);
|
|
1006
|
-
const dialogId =
|
|
1342
|
+
const dialogId = React13.useId();
|
|
1007
1343
|
return {
|
|
1008
1344
|
id: dialogId,
|
|
1009
1345
|
states: {
|
|
@@ -1019,7 +1355,7 @@ function useDialogProvider() {
|
|
|
1019
1355
|
// ../hooks/dist/index.mjs
|
|
1020
1356
|
import { useEffect, useRef } from "react";
|
|
1021
1357
|
import { useEffect as useEffect2, useState as useState5, useCallback } from "react";
|
|
1022
|
-
import
|
|
1358
|
+
import React14 from "react";
|
|
1023
1359
|
function useEventListener(eventName, handler, element) {
|
|
1024
1360
|
const savedHandler = useRef(handler);
|
|
1025
1361
|
useEffect(() => {
|
|
@@ -1078,7 +1414,7 @@ function useKeyPress(targetKey, hotkey, bindKey) {
|
|
|
1078
1414
|
}
|
|
1079
1415
|
var useDisabledScroll = (state) => {
|
|
1080
1416
|
const overflow = state ? "hidden" : "";
|
|
1081
|
-
|
|
1417
|
+
React14.useEffect(() => {
|
|
1082
1418
|
document.body.style.overflowY = overflow;
|
|
1083
1419
|
}, [state]);
|
|
1084
1420
|
return {
|
|
@@ -1088,8 +1424,8 @@ var useDisabledScroll = (state) => {
|
|
|
1088
1424
|
};
|
|
1089
1425
|
|
|
1090
1426
|
// src/dialog/styles/index.ts
|
|
1091
|
-
import
|
|
1092
|
-
var DialogDefaultStyles =
|
|
1427
|
+
import styled7, { css as css6 } from "styled-components";
|
|
1428
|
+
var DialogDefaultStyles = css6`
|
|
1093
1429
|
position: fixed;
|
|
1094
1430
|
top: 15dvh;
|
|
1095
1431
|
padding: var(--measurement-medium-60);
|
|
@@ -1102,7 +1438,7 @@ var DialogDefaultStyles = css5`
|
|
|
1102
1438
|
transition: all ease-in-out 0.2s;
|
|
1103
1439
|
z-index: var(--depth-default-100);
|
|
1104
1440
|
`;
|
|
1105
|
-
var DialogSizeStyles =
|
|
1441
|
+
var DialogSizeStyles = css6`
|
|
1106
1442
|
--base-size: var(--measurement-medium-60);
|
|
1107
1443
|
--computed-size: calc(100% - (var(--base-size) * 2));
|
|
1108
1444
|
--max-height: 75dvh;
|
|
@@ -1123,7 +1459,7 @@ var DialogSizeStyles = css5`
|
|
|
1123
1459
|
padding: var(--measurement-medium-80);
|
|
1124
1460
|
}
|
|
1125
1461
|
`;
|
|
1126
|
-
var Menu =
|
|
1462
|
+
var Menu = styled7.menu`
|
|
1127
1463
|
margin: 0;
|
|
1128
1464
|
padding: 0;
|
|
1129
1465
|
|
|
@@ -1133,7 +1469,7 @@ var Menu = styled5.menu`
|
|
|
1133
1469
|
gap: var(--measurement-medium-30);
|
|
1134
1470
|
}
|
|
1135
1471
|
`;
|
|
1136
|
-
var DialogWrapper =
|
|
1472
|
+
var DialogWrapper = styled7.dialog`
|
|
1137
1473
|
@keyframes slide-in {
|
|
1138
1474
|
0% {
|
|
1139
1475
|
opacity: 0;
|
|
@@ -1173,11 +1509,11 @@ var Dialog = (props) => {
|
|
|
1173
1509
|
const { getDialogId, toggleDialog } = methods;
|
|
1174
1510
|
const triggerId = getDialogId && getDialogId("trigger");
|
|
1175
1511
|
const contentId = getDialogId && getDialogId("content");
|
|
1176
|
-
|
|
1512
|
+
React15.useEffect(() => {
|
|
1177
1513
|
if (open && toggleDialog) toggleDialog();
|
|
1178
1514
|
}, []);
|
|
1179
1515
|
if (lock) useDisabledScroll(Boolean(states.open));
|
|
1180
|
-
return /* @__PURE__ */
|
|
1516
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, states.open && /* @__PURE__ */ React15.createElement(
|
|
1181
1517
|
ScrollArea,
|
|
1182
1518
|
{
|
|
1183
1519
|
as: DialogWrapper,
|
|
@@ -1196,7 +1532,7 @@ var Dialog = (props) => {
|
|
|
1196
1532
|
};
|
|
1197
1533
|
Dialog.displayName = "Dialog";
|
|
1198
1534
|
var DialogRoot = ({ children }) => {
|
|
1199
|
-
return /* @__PURE__ */
|
|
1535
|
+
return /* @__PURE__ */ React15.createElement(DialogProvider, null, children);
|
|
1200
1536
|
};
|
|
1201
1537
|
DialogRoot.displayName = "Dialog.Root";
|
|
1202
1538
|
var DialogOverlay = (props) => {
|
|
@@ -1207,7 +1543,7 @@ var DialogOverlay = (props) => {
|
|
|
1207
1543
|
if (closeOnInteract && toggleDialog) toggleDialog();
|
|
1208
1544
|
if (onClick) onClick(event);
|
|
1209
1545
|
};
|
|
1210
|
-
return /* @__PURE__ */
|
|
1546
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1211
1547
|
Overlay,
|
|
1212
1548
|
{
|
|
1213
1549
|
visible: Boolean(states.open),
|
|
@@ -1228,7 +1564,7 @@ var DialogTrigger = (props) => {
|
|
|
1228
1564
|
if (toggleDialog) toggleDialog();
|
|
1229
1565
|
if (onClick) onClick(event);
|
|
1230
1566
|
};
|
|
1231
|
-
return /* @__PURE__ */
|
|
1567
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1232
1568
|
Button,
|
|
1233
1569
|
{
|
|
1234
1570
|
id: String(triggerId),
|
|
@@ -1244,7 +1580,7 @@ var DialogTrigger = (props) => {
|
|
|
1244
1580
|
DialogTrigger.displayName = "Dialog.Trigger";
|
|
1245
1581
|
var DialogMenu = (props) => {
|
|
1246
1582
|
const { raw, children, ...restProps } = props;
|
|
1247
|
-
return /* @__PURE__ */
|
|
1583
|
+
return /* @__PURE__ */ React15.createElement(Menu, { "data-raw": Boolean(raw), ...restProps }, children);
|
|
1248
1584
|
};
|
|
1249
1585
|
DialogMenu.displayName = "Dialog.Menu";
|
|
1250
1586
|
var DialogControl = (props) => {
|
|
@@ -1257,7 +1593,7 @@ var DialogControl = (props) => {
|
|
|
1257
1593
|
if (toggleDialog) toggleDialog();
|
|
1258
1594
|
if (onClick) onClick(event);
|
|
1259
1595
|
};
|
|
1260
|
-
return /* @__PURE__ */
|
|
1596
|
+
return /* @__PURE__ */ React15.createElement(
|
|
1261
1597
|
Button,
|
|
1262
1598
|
{
|
|
1263
1599
|
id: String(innerControlId),
|
|
@@ -1278,8 +1614,8 @@ Dialog.Menu = DialogMenu;
|
|
|
1278
1614
|
Dialog.Overlay = DialogOverlay;
|
|
1279
1615
|
|
|
1280
1616
|
// src/divider/index.ts
|
|
1281
|
-
import
|
|
1282
|
-
var Divider =
|
|
1617
|
+
import styled8 from "styled-components";
|
|
1618
|
+
var Divider = styled8.hr`
|
|
1283
1619
|
height: var(--measurement-small-10);
|
|
1284
1620
|
margin: var(--measurement-medium-30) 0;
|
|
1285
1621
|
background: var(--font-color-alpha-10);
|
|
@@ -1287,10 +1623,10 @@ var Divider = styled6.hr`
|
|
|
1287
1623
|
`;
|
|
1288
1624
|
|
|
1289
1625
|
// src/dropdown/index.tsx
|
|
1290
|
-
import
|
|
1626
|
+
import React17 from "react";
|
|
1291
1627
|
|
|
1292
1628
|
// src/dropdown/hooks/index.tsx
|
|
1293
|
-
import
|
|
1629
|
+
import React16 from "react";
|
|
1294
1630
|
var DEFAULT_API = {
|
|
1295
1631
|
id: "",
|
|
1296
1632
|
states: {},
|
|
@@ -1306,26 +1642,26 @@ var DEFAULT_DIMENSIONS = {
|
|
|
1306
1642
|
width: 0,
|
|
1307
1643
|
height: 0
|
|
1308
1644
|
};
|
|
1309
|
-
var DropdownMenuContext =
|
|
1310
|
-
var useDropdownMenu = () =>
|
|
1645
|
+
var DropdownMenuContext = React16.createContext(DEFAULT_API);
|
|
1646
|
+
var useDropdownMenu = () => React16.useContext(DropdownMenuContext);
|
|
1311
1647
|
var DropdownMenuProvider = ({
|
|
1312
1648
|
children
|
|
1313
1649
|
}) => {
|
|
1314
1650
|
const context = useDropdownMenuProvider();
|
|
1315
|
-
return /* @__PURE__ */
|
|
1651
|
+
return /* @__PURE__ */ React16.createElement(DropdownMenuContext.Provider, { value: context }, children);
|
|
1316
1652
|
};
|
|
1317
1653
|
function useDropdownMenuProvider() {
|
|
1318
|
-
const [open, setOpen] =
|
|
1319
|
-
const [contentProps, setContentProps] =
|
|
1654
|
+
const [open, setOpen] = React16.useState(false);
|
|
1655
|
+
const [contentProps, setContentProps] = React16.useState({
|
|
1320
1656
|
...DEFAULT_POSITIONS,
|
|
1321
1657
|
...DEFAULT_DIMENSIONS
|
|
1322
1658
|
});
|
|
1323
|
-
const [triggerProps, setTriggerProps] =
|
|
1659
|
+
const [triggerProps, setTriggerProps] = React16.useState({
|
|
1324
1660
|
...DEFAULT_POSITIONS,
|
|
1325
1661
|
...DEFAULT_DIMENSIONS
|
|
1326
1662
|
});
|
|
1327
|
-
const triggerId =
|
|
1328
|
-
const dropdownId =
|
|
1663
|
+
const triggerId = React16.useId();
|
|
1664
|
+
const dropdownId = React16.useId();
|
|
1329
1665
|
const composedId = `${triggerId}|${dropdownId}`;
|
|
1330
1666
|
return {
|
|
1331
1667
|
id: composedId,
|
|
@@ -1343,7 +1679,7 @@ function useDropdownMenuProvider() {
|
|
|
1343
1679
|
}
|
|
1344
1680
|
|
|
1345
1681
|
// src/dropdown/styles/index.ts
|
|
1346
|
-
import
|
|
1682
|
+
import styled9, { css as css7, keyframes } from "styled-components";
|
|
1347
1683
|
var FadeIn = keyframes`
|
|
1348
1684
|
0% {
|
|
1349
1685
|
opacity: 0;
|
|
@@ -1352,7 +1688,7 @@ var FadeIn = keyframes`
|
|
|
1352
1688
|
opacity: 1;
|
|
1353
1689
|
}
|
|
1354
1690
|
`;
|
|
1355
|
-
var ContentWrapperSizes =
|
|
1691
|
+
var ContentWrapperSizes = css7`
|
|
1356
1692
|
--small: var(--measurement-large-60);
|
|
1357
1693
|
--medium: var(--measurement-large-80);
|
|
1358
1694
|
--large: var(--measurement-large-90);
|
|
@@ -1374,10 +1710,10 @@ var ContentWrapperSizes = css6`
|
|
|
1374
1710
|
max-width: var(--large);
|
|
1375
1711
|
}
|
|
1376
1712
|
`;
|
|
1377
|
-
var RootWrapper =
|
|
1713
|
+
var RootWrapper = styled9.div`
|
|
1378
1714
|
position: relative;
|
|
1379
1715
|
`;
|
|
1380
|
-
var ContentWrapper =
|
|
1716
|
+
var ContentWrapper = styled9.ul`
|
|
1381
1717
|
--small: var(--measurement-large-60);
|
|
1382
1718
|
--medium: var(--measurement-large-80);
|
|
1383
1719
|
--large: var(--measurement-large-90);
|
|
@@ -1401,7 +1737,7 @@ var ContentWrapper = styled7.ul`
|
|
|
1401
1737
|
${ContentWrapperSizes}
|
|
1402
1738
|
}
|
|
1403
1739
|
`;
|
|
1404
|
-
var
|
|
1740
|
+
var ItemWrapper2 = styled9.li`
|
|
1405
1741
|
list-style: none;
|
|
1406
1742
|
padding: 0;
|
|
1407
1743
|
margin: 0;
|
|
@@ -1433,7 +1769,7 @@ var ItemWrapper = styled7.li`
|
|
|
1433
1769
|
|
|
1434
1770
|
// src/dropdown/index.tsx
|
|
1435
1771
|
var DropdownMenu = ({ children }) => {
|
|
1436
|
-
const DropdownContentRef =
|
|
1772
|
+
const DropdownContentRef = React17.useRef(null);
|
|
1437
1773
|
const { states, methods } = useDropdownMenu();
|
|
1438
1774
|
const { toggleOpen } = methods;
|
|
1439
1775
|
const handleClickOutside = () => {
|
|
@@ -1441,15 +1777,15 @@ var DropdownMenu = ({ children }) => {
|
|
|
1441
1777
|
};
|
|
1442
1778
|
useClickOutside(DropdownContentRef, handleClickOutside);
|
|
1443
1779
|
useDisabledScroll(Boolean(states.open));
|
|
1444
|
-
return /* @__PURE__ */
|
|
1780
|
+
return /* @__PURE__ */ React17.createElement(RootWrapper, { ref: DropdownContentRef }, children);
|
|
1445
1781
|
};
|
|
1446
1782
|
DropdownMenu.displayName = "DropdownMenu";
|
|
1447
1783
|
var DropdownMenuRoot = ({ children }) => {
|
|
1448
|
-
return /* @__PURE__ */
|
|
1784
|
+
return /* @__PURE__ */ React17.createElement(DropdownMenuProvider, null, children);
|
|
1449
1785
|
};
|
|
1450
1786
|
DropdownMenuRoot.displayName = "DropdownMenu.Root";
|
|
1451
1787
|
var DropdownMenuTrigger = (props) => {
|
|
1452
|
-
const triggerRef =
|
|
1788
|
+
const triggerRef = React17.useRef(null);
|
|
1453
1789
|
const triggerRect = () => triggerRef.current?.getBoundingClientRect();
|
|
1454
1790
|
const { variant = "ghost", onClick, children, ...restProps } = props;
|
|
1455
1791
|
const { id, states, methods } = useDropdownMenu();
|
|
@@ -1467,7 +1803,7 @@ var DropdownMenuTrigger = (props) => {
|
|
|
1467
1803
|
height: Number(triggerRect()?.height)
|
|
1468
1804
|
});
|
|
1469
1805
|
};
|
|
1470
|
-
return /* @__PURE__ */
|
|
1806
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1471
1807
|
Button,
|
|
1472
1808
|
{
|
|
1473
1809
|
ref: triggerRef,
|
|
@@ -1482,12 +1818,12 @@ var DropdownMenuTrigger = (props) => {
|
|
|
1482
1818
|
);
|
|
1483
1819
|
};
|
|
1484
1820
|
DropdownMenuTrigger.displayName = "DropdownMenu.Trigger";
|
|
1485
|
-
var DropdownMenuContent =
|
|
1821
|
+
var DropdownMenuContent = React17.forwardRef((props, _) => {
|
|
1486
1822
|
const { raw, sizing = "medium", defaultOpen, children, ...restProps } = props;
|
|
1487
1823
|
const { id, states, methods } = useDropdownMenu();
|
|
1488
1824
|
const { toggleOpen, setContentProps } = methods;
|
|
1489
|
-
const mounted =
|
|
1490
|
-
const contentRef =
|
|
1825
|
+
const mounted = React17.useRef(false);
|
|
1826
|
+
const contentRef = React17.useRef(null);
|
|
1491
1827
|
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
1492
1828
|
const bodyRect = () => {
|
|
1493
1829
|
if (typeof document !== "undefined") {
|
|
@@ -1511,10 +1847,10 @@ var DropdownMenuContent = React14.forwardRef((props, _) => {
|
|
|
1511
1847
|
};
|
|
1512
1848
|
const hasEnoughHorizontalSpace = dimensions.body_width - dimensions.content_left > dimensions.content_width * 1.1;
|
|
1513
1849
|
const hasEnoughVerticalSpace = dimensions.body_height - dimensions.content_bottom > dimensions.content_height - dimensions.content_height * 0.9;
|
|
1514
|
-
|
|
1850
|
+
React17.useEffect(() => {
|
|
1515
1851
|
if (defaultOpen && toggleOpen) toggleOpen();
|
|
1516
1852
|
}, []);
|
|
1517
|
-
|
|
1853
|
+
React17.useEffect(() => {
|
|
1518
1854
|
mounted.current = true;
|
|
1519
1855
|
setContentProps && setContentProps({
|
|
1520
1856
|
top: Number(contentRect()?.top),
|
|
@@ -1528,7 +1864,7 @@ var DropdownMenuContent = React14.forwardRef((props, _) => {
|
|
|
1528
1864
|
mounted.current = false;
|
|
1529
1865
|
};
|
|
1530
1866
|
}, [states.open]);
|
|
1531
|
-
return /* @__PURE__ */
|
|
1867
|
+
return /* @__PURE__ */ React17.createElement(React17.Fragment, null, states.open && /* @__PURE__ */ React17.createElement(
|
|
1532
1868
|
ContentWrapper,
|
|
1533
1869
|
{
|
|
1534
1870
|
ref: contentRef,
|
|
@@ -1582,8 +1918,8 @@ var DropdownMenuItem = (props) => {
|
|
|
1582
1918
|
EventsHandler.toggle();
|
|
1583
1919
|
}
|
|
1584
1920
|
};
|
|
1585
|
-
return /* @__PURE__ */
|
|
1586
|
-
|
|
1921
|
+
return /* @__PURE__ */ React17.createElement(
|
|
1922
|
+
ItemWrapper2,
|
|
1587
1923
|
{
|
|
1588
1924
|
role: "menuitem",
|
|
1589
1925
|
tabIndex: 0,
|
|
@@ -1604,10 +1940,10 @@ DropdownMenu.Content = DropdownMenuContent;
|
|
|
1604
1940
|
DropdownMenu.Item = DropdownMenuItem;
|
|
1605
1941
|
|
|
1606
1942
|
// src/field/index.tsx
|
|
1607
|
-
import
|
|
1943
|
+
import React19 from "react";
|
|
1608
1944
|
|
|
1609
1945
|
// src/field/hooks/index.tsx
|
|
1610
|
-
import
|
|
1946
|
+
import React18, { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1611
1947
|
var defaultComponentAPI5 = {
|
|
1612
1948
|
id: "",
|
|
1613
1949
|
states: {},
|
|
@@ -1617,10 +1953,10 @@ var FieldContext = createContext5(defaultComponentAPI5);
|
|
|
1617
1953
|
var useField = () => useContext5(FieldContext);
|
|
1618
1954
|
var FieldProvider = ({ children }) => {
|
|
1619
1955
|
const context = useFieldProvider();
|
|
1620
|
-
return /* @__PURE__ */
|
|
1956
|
+
return /* @__PURE__ */ React18.createElement(FieldContext.Provider, { value: context }, children);
|
|
1621
1957
|
};
|
|
1622
1958
|
function useFieldProvider() {
|
|
1623
|
-
const fieldId =
|
|
1959
|
+
const fieldId = React18.useId();
|
|
1624
1960
|
return {
|
|
1625
1961
|
id: fieldId,
|
|
1626
1962
|
states: {},
|
|
@@ -1629,23 +1965,23 @@ function useFieldProvider() {
|
|
|
1629
1965
|
}
|
|
1630
1966
|
|
|
1631
1967
|
// src/field/styles/index.ts
|
|
1632
|
-
import
|
|
1633
|
-
var FieldDefaultStyles =
|
|
1968
|
+
import styled10, { css as css8 } from "styled-components";
|
|
1969
|
+
var FieldDefaultStyles = css8`
|
|
1634
1970
|
outline: none;
|
|
1635
|
-
cursor:
|
|
1971
|
+
cursor: text;
|
|
1636
1972
|
display: flex;
|
|
1637
1973
|
align-items: center;
|
|
1638
1974
|
justify-content: center;
|
|
1975
|
+
box-sizing: border-box;
|
|
1976
|
+
|
|
1977
|
+
font-size: var(--fontsize-medium-20);
|
|
1639
1978
|
|
|
1640
|
-
font-size: var(--fontsize-small-80);
|
|
1641
|
-
font-weight: 500;
|
|
1642
1979
|
line-height: 1.1;
|
|
1643
1980
|
letter-spacing: calc(
|
|
1644
1981
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
1645
1982
|
);
|
|
1646
1983
|
|
|
1647
1984
|
border: var(--measurement-small-10) solid transparent;
|
|
1648
|
-
border-radius: var(--measurement-medium-30);
|
|
1649
1985
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
1650
1986
|
color: var(--font-color-alpha-60);
|
|
1651
1987
|
width: fit-content;
|
|
@@ -1663,29 +1999,37 @@ var FieldDefaultStyles = css7`
|
|
|
1663
1999
|
&:focus,
|
|
1664
2000
|
&:active {
|
|
1665
2001
|
color: var(--font-color);
|
|
1666
|
-
|
|
1667
2002
|
svg,
|
|
1668
2003
|
span,
|
|
1669
2004
|
img {
|
|
1670
2005
|
opacity: 1;
|
|
1671
2006
|
}
|
|
1672
2007
|
}
|
|
2008
|
+
|
|
1673
2009
|
&::placeholder {
|
|
1674
2010
|
color: var(--font-color-alpha-30);
|
|
1675
2011
|
}
|
|
2012
|
+
|
|
1676
2013
|
&:disabled {
|
|
1677
2014
|
cursor: not-allowed;
|
|
1678
2015
|
opacity: 0.6;
|
|
1679
2016
|
}
|
|
1680
2017
|
`;
|
|
1681
|
-
var FieldVariantsStyles =
|
|
2018
|
+
var FieldVariantsStyles = css8`
|
|
1682
2019
|
&[data-variant="primary"] {
|
|
1683
2020
|
background-color: var(--font-color-alpha-10);
|
|
2021
|
+
border-color: var(--font-color-alpha-10);
|
|
2022
|
+
|
|
2023
|
+
&:focus,
|
|
2024
|
+
&:active {
|
|
2025
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
2026
|
+
}
|
|
1684
2027
|
|
|
1685
2028
|
&[data-error="true"] {
|
|
1686
2029
|
color: var(--color-red);
|
|
1687
2030
|
background-color: var(--alpha-red-10);
|
|
1688
2031
|
border-color: var(--alpha-red-10);
|
|
2032
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
1689
2033
|
}
|
|
1690
2034
|
}
|
|
1691
2035
|
|
|
@@ -1696,7 +2040,12 @@ var FieldVariantsStyles = css7`
|
|
|
1696
2040
|
&:hover,
|
|
1697
2041
|
&:focus,
|
|
1698
2042
|
&:active {
|
|
1699
|
-
|
|
2043
|
+
border-color: var(--font-color-alpha-20);
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
&:focus,
|
|
2047
|
+
&:active {
|
|
2048
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
1700
2049
|
}
|
|
1701
2050
|
|
|
1702
2051
|
&[data-error="true"] {
|
|
@@ -1707,6 +2056,7 @@ var FieldVariantsStyles = css7`
|
|
|
1707
2056
|
&:focus,
|
|
1708
2057
|
&:active {
|
|
1709
2058
|
background-color: var(--alpha-red-10);
|
|
2059
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
1710
2060
|
}
|
|
1711
2061
|
}
|
|
1712
2062
|
}
|
|
@@ -1730,39 +2080,51 @@ var FieldVariantsStyles = css7`
|
|
|
1730
2080
|
}
|
|
1731
2081
|
}
|
|
1732
2082
|
`;
|
|
1733
|
-
var FieldSizeStyles =
|
|
2083
|
+
var FieldSizeStyles = css8`
|
|
1734
2084
|
&[data-size="small"] {
|
|
1735
|
-
|
|
2085
|
+
font-size: var(--fontsize-small-60);
|
|
2086
|
+
|
|
1736
2087
|
padding: 0 var(--measurement-medium-30);
|
|
1737
2088
|
min-width: var(--measurement-medium-60);
|
|
1738
2089
|
min-height: var(--measurement-medium-80);
|
|
1739
2090
|
}
|
|
1740
2091
|
&[data-size="medium"] {
|
|
1741
|
-
gap: var(--measurement-medium-30);
|
|
1742
2092
|
padding: 0 var(--measurement-medium-30);
|
|
1743
2093
|
min-width: var(--measurement-medium-90);
|
|
1744
2094
|
min-height: var(--measurement-medium-90);
|
|
1745
2095
|
width: fit-content;
|
|
1746
2096
|
}
|
|
1747
2097
|
&[data-size="large"] {
|
|
1748
|
-
padding: var(--measurement-medium-
|
|
2098
|
+
padding: var(--measurement-medium-50);
|
|
1749
2099
|
min-width: var(--measurement-medium-90);
|
|
1750
2100
|
min-height: var(--measurement-medium-90);
|
|
1751
2101
|
}
|
|
1752
2102
|
`;
|
|
1753
|
-
var
|
|
2103
|
+
var FieldShapeStyles = css8`
|
|
2104
|
+
&[data-shape="square"] {
|
|
2105
|
+
border-radius: 0;
|
|
2106
|
+
}
|
|
2107
|
+
&[data-shape="smooth"] {
|
|
2108
|
+
border-radius: var(--measurement-medium-20);
|
|
2109
|
+
}
|
|
2110
|
+
&[data-shape="round"] {
|
|
2111
|
+
border-radius: var(--measurement-large-90);
|
|
2112
|
+
}
|
|
2113
|
+
`;
|
|
2114
|
+
var Fieldset = styled10.fieldset`
|
|
1754
2115
|
all: unset;
|
|
1755
2116
|
display: grid;
|
|
1756
2117
|
gap: var(--measurement-medium-10);
|
|
1757
2118
|
`;
|
|
1758
|
-
var Sup =
|
|
2119
|
+
var Sup = styled10.sup`
|
|
1759
2120
|
color: var(--color-red);
|
|
1760
2121
|
`;
|
|
1761
|
-
var Input =
|
|
2122
|
+
var Input = styled10.input`
|
|
1762
2123
|
&[data-raw="false"] {
|
|
1763
2124
|
${FieldDefaultStyles}
|
|
1764
2125
|
${FieldVariantsStyles}
|
|
1765
2126
|
${FieldSizeStyles}
|
|
2127
|
+
${FieldShapeStyles}
|
|
1766
2128
|
|
|
1767
2129
|
&[data-error="true"] {
|
|
1768
2130
|
&::placeholder {
|
|
@@ -1771,7 +2133,7 @@ var Input = styled8.input`
|
|
|
1771
2133
|
}
|
|
1772
2134
|
}
|
|
1773
2135
|
`;
|
|
1774
|
-
var Label =
|
|
2136
|
+
var Label = styled10.label`
|
|
1775
2137
|
&[data-raw="false"] {
|
|
1776
2138
|
font-weight: 500;
|
|
1777
2139
|
line-height: 1.1;
|
|
@@ -1780,7 +2142,7 @@ var Label = styled8.label`
|
|
|
1780
2142
|
);
|
|
1781
2143
|
}
|
|
1782
2144
|
`;
|
|
1783
|
-
var Def =
|
|
2145
|
+
var Def = styled10.dfn`
|
|
1784
2146
|
&[data-raw="false"] {
|
|
1785
2147
|
font-style: normal;
|
|
1786
2148
|
font-size: var(--fontsize-medium-10);
|
|
@@ -1807,13 +2169,14 @@ var Field = (props) => {
|
|
|
1807
2169
|
raw,
|
|
1808
2170
|
sizing = "medium" /* Medium */,
|
|
1809
2171
|
variant = "primary" /* Primary */,
|
|
2172
|
+
shape = "smooth",
|
|
1810
2173
|
error,
|
|
1811
2174
|
hint,
|
|
1812
2175
|
...restProps
|
|
1813
2176
|
} = props;
|
|
1814
|
-
const metaId =
|
|
2177
|
+
const metaId = React19.useId();
|
|
1815
2178
|
const { id } = useField();
|
|
1816
|
-
return /* @__PURE__ */
|
|
2179
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
1817
2180
|
Input,
|
|
1818
2181
|
{
|
|
1819
2182
|
id,
|
|
@@ -1823,10 +2186,11 @@ var Field = (props) => {
|
|
|
1823
2186
|
"data-error": Boolean(error),
|
|
1824
2187
|
"data-variant": variant,
|
|
1825
2188
|
"data-size": sizing,
|
|
2189
|
+
"data-shape": shape,
|
|
1826
2190
|
"data-raw": Boolean(raw),
|
|
1827
2191
|
...restProps
|
|
1828
2192
|
}
|
|
1829
|
-
), (error ?? hint) && /* @__PURE__ */
|
|
2193
|
+
), (error ?? hint) && /* @__PURE__ */ React19.createElement(
|
|
1830
2194
|
FieldMeta,
|
|
1831
2195
|
{
|
|
1832
2196
|
raw,
|
|
@@ -1837,20 +2201,20 @@ var Field = (props) => {
|
|
|
1837
2201
|
};
|
|
1838
2202
|
Field.displayName = "Field";
|
|
1839
2203
|
var FieldRoot = ({ children }) => {
|
|
1840
|
-
return /* @__PURE__ */
|
|
2204
|
+
return /* @__PURE__ */ React19.createElement(FieldProvider, null, children);
|
|
1841
2205
|
};
|
|
1842
2206
|
FieldRoot.displayName = "Field.Root";
|
|
1843
2207
|
var FieldWrapper = ({
|
|
1844
2208
|
children,
|
|
1845
2209
|
...restProps
|
|
1846
2210
|
}) => {
|
|
1847
|
-
return /* @__PURE__ */
|
|
2211
|
+
return /* @__PURE__ */ React19.createElement(Fieldset, { ...restProps }, children);
|
|
1848
2212
|
};
|
|
1849
2213
|
FieldWrapper.displayName = "Field.Wrapper";
|
|
1850
2214
|
var FieldLabel = (props) => {
|
|
1851
2215
|
const { raw, optional = false, children, ...restProps } = props;
|
|
1852
2216
|
const { id } = useField();
|
|
1853
|
-
return /* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ React19.createElement(Label, { htmlFor: id, "data-raw": Boolean(raw), ...restProps }, children, !optional && /* @__PURE__ */ React19.createElement(Sup, null, "*"));
|
|
1854
2218
|
};
|
|
1855
2219
|
FieldLabel.displayName = "Field.Label";
|
|
1856
2220
|
var FieldMeta = (props) => {
|
|
@@ -1860,9 +2224,9 @@ var FieldMeta = (props) => {
|
|
|
1860
2224
|
children,
|
|
1861
2225
|
...restProps
|
|
1862
2226
|
} = props;
|
|
1863
|
-
const metaId =
|
|
2227
|
+
const metaId = React19.useId();
|
|
1864
2228
|
const { id } = useField();
|
|
1865
|
-
return /* @__PURE__ */
|
|
2229
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1866
2230
|
Def,
|
|
1867
2231
|
{
|
|
1868
2232
|
id: metaId,
|
|
@@ -1881,22 +2245,22 @@ Field.Label = FieldLabel;
|
|
|
1881
2245
|
Field.Meta = FieldMeta;
|
|
1882
2246
|
|
|
1883
2247
|
// src/otp-field/index.tsx
|
|
1884
|
-
import
|
|
2248
|
+
import React21 from "react";
|
|
1885
2249
|
|
|
1886
2250
|
// src/otp-field/hooks/index.tsx
|
|
1887
|
-
import
|
|
1888
|
-
var OTPFieldContext =
|
|
2251
|
+
import React20 from "react";
|
|
2252
|
+
var OTPFieldContext = React20.createContext(
|
|
1889
2253
|
null
|
|
1890
2254
|
);
|
|
1891
2255
|
var useOTPField = () => {
|
|
1892
|
-
const context =
|
|
2256
|
+
const context = React20.useContext(OTPFieldContext);
|
|
1893
2257
|
if (!context) return null;
|
|
1894
2258
|
return context;
|
|
1895
2259
|
};
|
|
1896
2260
|
|
|
1897
2261
|
// src/otp-field/styles/index.ts
|
|
1898
|
-
import
|
|
1899
|
-
var OTPCell =
|
|
2262
|
+
import styled11 from "styled-components";
|
|
2263
|
+
var OTPCell = styled11.input`
|
|
1900
2264
|
width: var(--measurement-medium-90);
|
|
1901
2265
|
height: var(--measurement-medium-90);
|
|
1902
2266
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
@@ -1931,11 +2295,11 @@ var OTPCell = styled9.input`
|
|
|
1931
2295
|
// src/otp-field/index.tsx
|
|
1932
2296
|
var OTPField = ({ children, length, onComplete }) => {
|
|
1933
2297
|
const defaultLength = length ?? 6;
|
|
1934
|
-
const inputRefs =
|
|
1935
|
-
const [otp, setOtp] =
|
|
2298
|
+
const inputRefs = React21.useRef([]);
|
|
2299
|
+
const [otp, setOtp] = React21.useState(
|
|
1936
2300
|
Array.from({ length: defaultLength }, () => "")
|
|
1937
2301
|
);
|
|
1938
|
-
const [activeIndex, setActiveIndex] =
|
|
2302
|
+
const [activeIndex, setActiveIndex] = React21.useState(0);
|
|
1939
2303
|
const handleChange = (index, value) => {
|
|
1940
2304
|
const newOtp = [...otp];
|
|
1941
2305
|
newOtp[index] = value.substring(value.length - 1);
|
|
@@ -1996,13 +2360,13 @@ var OTPField = ({ children, length, onComplete }) => {
|
|
|
1996
2360
|
);
|
|
1997
2361
|
return () => clearTimeout(timeout);
|
|
1998
2362
|
};
|
|
1999
|
-
|
|
2363
|
+
React21.useEffect(() => {
|
|
2000
2364
|
const otpString = otp.join("");
|
|
2001
2365
|
if (otpString.length === defaultLength && onComplete) {
|
|
2002
2366
|
onComplete(otpString);
|
|
2003
2367
|
}
|
|
2004
2368
|
}, [otp, defaultLength, onComplete]);
|
|
2005
|
-
const contextValue =
|
|
2369
|
+
const contextValue = React21.useMemo(() => {
|
|
2006
2370
|
return {
|
|
2007
2371
|
otp,
|
|
2008
2372
|
activeIndex,
|
|
@@ -2025,11 +2389,11 @@ var OTPField = ({ children, length, onComplete }) => {
|
|
|
2025
2389
|
handleClick,
|
|
2026
2390
|
handlePaste
|
|
2027
2391
|
]);
|
|
2028
|
-
return /* @__PURE__ */
|
|
2392
|
+
return /* @__PURE__ */ React21.createElement(OTPFieldContext.Provider, { value: contextValue }, children);
|
|
2029
2393
|
};
|
|
2030
2394
|
OTPField.displayName = "OTPField";
|
|
2031
|
-
var OTPFieldGroup =
|
|
2032
|
-
return /* @__PURE__ */
|
|
2395
|
+
var OTPFieldGroup = React21.forwardRef(({ ...props }, ref) => {
|
|
2396
|
+
return /* @__PURE__ */ React21.createElement("span", { ref, className: "flex g-medium-10 align-center", ...props });
|
|
2033
2397
|
});
|
|
2034
2398
|
OTPFieldGroup.displayName = "OTPField.Group";
|
|
2035
2399
|
var OTPFieldSlot = ({
|
|
@@ -2048,7 +2412,7 @@ var OTPFieldSlot = ({
|
|
|
2048
2412
|
handleClick,
|
|
2049
2413
|
handlePaste
|
|
2050
2414
|
} = context;
|
|
2051
|
-
return /* @__PURE__ */
|
|
2415
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2052
2416
|
OTPCell,
|
|
2053
2417
|
{
|
|
2054
2418
|
ref: (el) => inputRefs.current[index] = el,
|
|
@@ -2074,11 +2438,11 @@ OTPField.Group = OTPFieldGroup;
|
|
|
2074
2438
|
OTPField.Slot = OTPFieldSlot;
|
|
2075
2439
|
|
|
2076
2440
|
// src/overlay/index.tsx
|
|
2077
|
-
import
|
|
2441
|
+
import React22 from "react";
|
|
2078
2442
|
|
|
2079
2443
|
// src/overlay/styles/index.ts
|
|
2080
|
-
import
|
|
2081
|
-
var OverlayWrapper =
|
|
2444
|
+
import styled12 from "styled-components";
|
|
2445
|
+
var OverlayWrapper = styled12.div`
|
|
2082
2446
|
@keyframes animate-fade {
|
|
2083
2447
|
0% {
|
|
2084
2448
|
opacity: 0;
|
|
@@ -2106,15 +2470,15 @@ var OverlayWrapper = styled10.div`
|
|
|
2106
2470
|
// src/overlay/index.tsx
|
|
2107
2471
|
var Overlay = (props) => {
|
|
2108
2472
|
const { raw, visible, closeOnInteract, onClick, ...restProps } = props;
|
|
2109
|
-
const [mounted, setMounted] =
|
|
2473
|
+
const [mounted, setMounted] = React22.useState(Boolean(visible));
|
|
2110
2474
|
const handleClick = (event) => {
|
|
2111
2475
|
if (onClick) onClick(event);
|
|
2112
2476
|
if (closeOnInteract) setMounted(false);
|
|
2113
2477
|
};
|
|
2114
|
-
|
|
2478
|
+
React22.useEffect(() => {
|
|
2115
2479
|
if (visible !== mounted) setMounted(Boolean(visible));
|
|
2116
2480
|
}, [visible]);
|
|
2117
|
-
return /* @__PURE__ */
|
|
2481
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, mounted && /* @__PURE__ */ React22.createElement(
|
|
2118
2482
|
OverlayWrapper,
|
|
2119
2483
|
{
|
|
2120
2484
|
tabIndex: -1,
|
|
@@ -2128,14 +2492,14 @@ var Overlay = (props) => {
|
|
|
2128
2492
|
Overlay.displayName = "Overlay";
|
|
2129
2493
|
|
|
2130
2494
|
// src/page/index.tsx
|
|
2131
|
-
import
|
|
2495
|
+
import React23 from "react";
|
|
2132
2496
|
|
|
2133
2497
|
// src/page/styles/index.ts
|
|
2134
|
-
import
|
|
2498
|
+
import styled14 from "styled-components";
|
|
2135
2499
|
|
|
2136
2500
|
// src/scrollarea/styles/index.ts
|
|
2137
|
-
import
|
|
2138
|
-
var HiddenScrollbar =
|
|
2501
|
+
import styled13, { css as css9 } from "styled-components";
|
|
2502
|
+
var HiddenScrollbar = css9`
|
|
2139
2503
|
scrollbar-width: none;
|
|
2140
2504
|
|
|
2141
2505
|
&::-webkit-scrollbar {
|
|
@@ -2147,7 +2511,7 @@ var HiddenScrollbar = css8`
|
|
|
2147
2511
|
display: none;
|
|
2148
2512
|
}
|
|
2149
2513
|
`;
|
|
2150
|
-
var CustomScrollbar =
|
|
2514
|
+
var CustomScrollbar = css9`
|
|
2151
2515
|
height: ${({ $height }) => $height || "100%"};
|
|
2152
2516
|
width: ${({ $width }) => $width || "100%"};
|
|
2153
2517
|
overflow-y: auto;
|
|
@@ -2179,7 +2543,7 @@ var CustomScrollbar = css8`
|
|
|
2179
2543
|
scrollbar-width: thin;
|
|
2180
2544
|
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor || "var(--font-color-alpha-10)"} ${$trackColor || "transparent"}`};
|
|
2181
2545
|
`;
|
|
2182
|
-
var ScrollAreaWrapper =
|
|
2546
|
+
var ScrollAreaWrapper = styled13.div`
|
|
2183
2547
|
overflow: scroll;
|
|
2184
2548
|
|
|
2185
2549
|
&[data-scrollbar="true"] {
|
|
@@ -2191,11 +2555,11 @@ var ScrollAreaWrapper = styled11.div`
|
|
|
2191
2555
|
`;
|
|
2192
2556
|
|
|
2193
2557
|
// src/page/styles/index.ts
|
|
2194
|
-
var PageRootWrapper =
|
|
2558
|
+
var PageRootWrapper = styled14.div`
|
|
2195
2559
|
height: 100dvh;
|
|
2196
2560
|
width: 100%;
|
|
2197
2561
|
`;
|
|
2198
|
-
var PageNavWrapper =
|
|
2562
|
+
var PageNavWrapper = styled14.nav`
|
|
2199
2563
|
background-color: var(--body-color);
|
|
2200
2564
|
border: var(--measurement-small-10) solid transparent;
|
|
2201
2565
|
border-bottom-color: var(--font-color-alpha-10);
|
|
@@ -2204,7 +2568,7 @@ var PageNavWrapper = styled12.nav`
|
|
|
2204
2568
|
max-height: var(--measurement-large-20);
|
|
2205
2569
|
padding: var(--measurement-medium-30);
|
|
2206
2570
|
`;
|
|
2207
|
-
var PageMenuWrapper =
|
|
2571
|
+
var PageMenuWrapper = styled14.menu`
|
|
2208
2572
|
background-color: var(--body-color);
|
|
2209
2573
|
border: var(--measurement-small-10) solid transparent;
|
|
2210
2574
|
border-bottom-color: var(--font-color-alpha-10);
|
|
@@ -2214,19 +2578,19 @@ var PageMenuWrapper = styled12.menu`
|
|
|
2214
2578
|
margin: 0;
|
|
2215
2579
|
padding: var(--measurement-medium-60) var(--measurement-medium-30);
|
|
2216
2580
|
`;
|
|
2217
|
-
var PagePanelWrapper =
|
|
2581
|
+
var PagePanelWrapper = styled14.aside`
|
|
2218
2582
|
position: absolute;
|
|
2219
2583
|
bottom: 0;
|
|
2220
2584
|
width: 100%;
|
|
2221
2585
|
overflow: scroll;
|
|
2222
2586
|
${HiddenScrollbar}
|
|
2223
2587
|
`;
|
|
2224
|
-
var PageSectionWrapper =
|
|
2588
|
+
var PageSectionWrapper = styled14.div`
|
|
2225
2589
|
background: var(--body-color);
|
|
2226
2590
|
width: 100%;
|
|
2227
2591
|
height: 100%;
|
|
2228
2592
|
`;
|
|
2229
|
-
var PageBodyWrapper =
|
|
2593
|
+
var PageBodyWrapper = styled14.div`
|
|
2230
2594
|
--menus-height: calc(
|
|
2231
2595
|
var(--measurement-large-30) *
|
|
2232
2596
|
${({ $menus }) => $menus ? Number($menus) : 0}
|
|
@@ -2251,12 +2615,12 @@ var PageBodyWrapper = styled12.div`
|
|
|
2251
2615
|
// src/page/index.tsx
|
|
2252
2616
|
var Page = (props) => {
|
|
2253
2617
|
const { children } = props;
|
|
2254
|
-
return /* @__PURE__ */
|
|
2618
|
+
return /* @__PURE__ */ React23.createElement(PageRootWrapper, { className: "flex", ...props }, children);
|
|
2255
2619
|
};
|
|
2256
2620
|
Page.displayName = "Page";
|
|
2257
2621
|
var PageNavigation = (props) => {
|
|
2258
2622
|
const { children } = props;
|
|
2259
|
-
return /* @__PURE__ */
|
|
2623
|
+
return /* @__PURE__ */ React23.createElement(PageNavWrapper, { ...props }, children);
|
|
2260
2624
|
};
|
|
2261
2625
|
PageNavigation.displayName = "Page.Navigation";
|
|
2262
2626
|
var PageTools = (props) => {
|
|
@@ -2278,7 +2642,7 @@ var PageTools = (props) => {
|
|
|
2278
2642
|
const handleClick = (event) => {
|
|
2279
2643
|
if (onClick) onClick(event);
|
|
2280
2644
|
};
|
|
2281
|
-
return /* @__PURE__ */
|
|
2645
|
+
return /* @__PURE__ */ React23.createElement(Toolbar.Root, null, /* @__PURE__ */ React23.createElement(
|
|
2282
2646
|
Toolbar,
|
|
2283
2647
|
{
|
|
2284
2648
|
raw,
|
|
@@ -2290,27 +2654,27 @@ var PageTools = (props) => {
|
|
|
2290
2654
|
defaultOpen,
|
|
2291
2655
|
...props
|
|
2292
2656
|
},
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
!fixed && /* @__PURE__ */
|
|
2657
|
+
/* @__PURE__ */ React23.createElement(Toolbar.Section, { showoncollapse }, children),
|
|
2658
|
+
!fixed && /* @__PURE__ */ React23.createElement(
|
|
2295
2659
|
Toolbar.Trigger,
|
|
2296
2660
|
{
|
|
2297
2661
|
title: shortcut ? `${bindkey ?? "ctrl"} + ${hotkey}` : "toolbar-trigger",
|
|
2298
2662
|
onClick: handleClick,
|
|
2299
2663
|
...triggerProps
|
|
2300
2664
|
},
|
|
2301
|
-
trigger ?? /* @__PURE__ */
|
|
2665
|
+
trigger ?? /* @__PURE__ */ React23.createElement("span", null, "\u2194")
|
|
2302
2666
|
)
|
|
2303
2667
|
));
|
|
2304
2668
|
};
|
|
2305
2669
|
PageTools.displayName = "Page.Tools";
|
|
2306
2670
|
var PageContent = (props) => {
|
|
2307
2671
|
const { children } = props;
|
|
2308
|
-
return /* @__PURE__ */
|
|
2672
|
+
return /* @__PURE__ */ React23.createElement(ScrollArea, { as: PageSectionWrapper, ...props }, children);
|
|
2309
2673
|
};
|
|
2310
2674
|
PageContent.displayName = "Page.Content";
|
|
2311
2675
|
var PageWrapper = (props) => {
|
|
2312
2676
|
const { children } = props;
|
|
2313
|
-
return /* @__PURE__ */
|
|
2677
|
+
return /* @__PURE__ */ React23.createElement(PageBodyWrapper, { ...props }, children);
|
|
2314
2678
|
};
|
|
2315
2679
|
PageWrapper.displayName = "Page.Wrapper";
|
|
2316
2680
|
var PagePanel = (props) => {
|
|
@@ -2333,7 +2697,7 @@ var PagePanel = (props) => {
|
|
|
2333
2697
|
const handleClick = (event) => {
|
|
2334
2698
|
if (onClick) onClick(event);
|
|
2335
2699
|
};
|
|
2336
|
-
return /* @__PURE__ */
|
|
2700
|
+
return /* @__PURE__ */ React23.createElement(Toolbar.Root, null, /* @__PURE__ */ React23.createElement(
|
|
2337
2701
|
PagePanelWrapper,
|
|
2338
2702
|
{
|
|
2339
2703
|
as: Toolbar,
|
|
@@ -2347,22 +2711,22 @@ var PagePanel = (props) => {
|
|
|
2347
2711
|
defaultOpen,
|
|
2348
2712
|
"aria-label": props["aria-label"]
|
|
2349
2713
|
},
|
|
2350
|
-
!fixed && /* @__PURE__ */
|
|
2714
|
+
!fixed && /* @__PURE__ */ React23.createElement(
|
|
2351
2715
|
Toolbar.Trigger,
|
|
2352
2716
|
{
|
|
2353
2717
|
title: shortcut ? `${bindkey ?? "ctrl"} + ${hotkey}` : "toolbar-trigger",
|
|
2354
2718
|
onClick: handleClick,
|
|
2355
2719
|
...triggerProps
|
|
2356
2720
|
},
|
|
2357
|
-
trigger ?? /* @__PURE__ */
|
|
2721
|
+
trigger ?? /* @__PURE__ */ React23.createElement("span", { style: { transform: "rotate(90deg)" } }, "\u2194")
|
|
2358
2722
|
),
|
|
2359
|
-
/* @__PURE__ */
|
|
2723
|
+
/* @__PURE__ */ React23.createElement(Toolbar.Section, { showoncollapse }, children)
|
|
2360
2724
|
));
|
|
2361
2725
|
};
|
|
2362
2726
|
PagePanel.displayName = "Page.Panel";
|
|
2363
2727
|
var PageMenu = (props) => {
|
|
2364
2728
|
const { children } = props;
|
|
2365
|
-
return /* @__PURE__ */
|
|
2729
|
+
return /* @__PURE__ */ React23.createElement(PageMenuWrapper, { ...props }, children);
|
|
2366
2730
|
};
|
|
2367
2731
|
PageMenu.displayName = "Page.Menu";
|
|
2368
2732
|
Page.Navigation = PageNavigation;
|
|
@@ -2373,14 +2737,14 @@ Page.Panel = PagePanel;
|
|
|
2373
2737
|
Page.Menu = PageMenu;
|
|
2374
2738
|
|
|
2375
2739
|
// src/portal/index.tsx
|
|
2376
|
-
import
|
|
2740
|
+
import React24 from "react";
|
|
2377
2741
|
import { createPortal } from "react-dom";
|
|
2378
2742
|
var Portal = (props) => {
|
|
2379
2743
|
if (typeof document === "undefined") return null;
|
|
2380
2744
|
const { container, children } = props;
|
|
2381
|
-
const [hasMounted, setHasMounted] =
|
|
2382
|
-
const [portalRoot, setPortalRoot] =
|
|
2383
|
-
|
|
2745
|
+
const [hasMounted, setHasMounted] = React24.useState(false);
|
|
2746
|
+
const [portalRoot, setPortalRoot] = React24.useState(null);
|
|
2747
|
+
React24.useEffect(() => {
|
|
2384
2748
|
setHasMounted(true);
|
|
2385
2749
|
setPortalRoot(document.querySelector(`#${container}`));
|
|
2386
2750
|
}, [container]);
|
|
@@ -2389,26 +2753,188 @@ var Portal = (props) => {
|
|
|
2389
2753
|
};
|
|
2390
2754
|
Portal.displayName = "Portal";
|
|
2391
2755
|
|
|
2756
|
+
// src/privacy-field/index.tsx
|
|
2757
|
+
import React25 from "react";
|
|
2758
|
+
|
|
2759
|
+
// src/privacy-field/styles/index.ts
|
|
2760
|
+
import styled15 from "styled-components";
|
|
2761
|
+
var Wrapper = styled15(Field.Wrapper)`
|
|
2762
|
+
position: relative;
|
|
2763
|
+
|
|
2764
|
+
input {
|
|
2765
|
+
width: 100% !important;
|
|
2766
|
+
}
|
|
2767
|
+
`;
|
|
2768
|
+
var Trigger = styled15(Button)`
|
|
2769
|
+
position: absolute !important;
|
|
2770
|
+
right: var(--measurement-medium-50);
|
|
2771
|
+
top: calc(var(--measurement-medium-50));
|
|
2772
|
+
`;
|
|
2773
|
+
|
|
2774
|
+
// src/privacy-field/index.tsx
|
|
2775
|
+
var PrivacyField = ({
|
|
2776
|
+
defaultType,
|
|
2777
|
+
textIcon,
|
|
2778
|
+
passwordIcon,
|
|
2779
|
+
...restProps
|
|
2780
|
+
}) => {
|
|
2781
|
+
const [type, setType] = React25.useState(
|
|
2782
|
+
defaultType ?? "password"
|
|
2783
|
+
);
|
|
2784
|
+
const handleChangeType = React25.useCallback(() => {
|
|
2785
|
+
if (type === "text") setType("password");
|
|
2786
|
+
if (type === "password") setType("text");
|
|
2787
|
+
}, [type, setType]);
|
|
2788
|
+
return /* @__PURE__ */ React25.createElement(Wrapper, { className: "flex" }, /* @__PURE__ */ React25.createElement(Field, { autoComplete: "off", type, ...restProps }), /* @__PURE__ */ React25.createElement(Trigger, { variant: "ghost", sizing: "small", onClick: handleChangeType }, type === "text" && textIcon, type === "password" && passwordIcon));
|
|
2789
|
+
};
|
|
2790
|
+
PrivacyField.displayName = "PrivacyField";
|
|
2791
|
+
|
|
2792
|
+
// src/resizable/index.tsx
|
|
2793
|
+
import React26 from "react";
|
|
2794
|
+
|
|
2795
|
+
// src/resizable/styles/index.ts
|
|
2796
|
+
import styled16 from "styled-components";
|
|
2797
|
+
var SplitContainer = styled16.div`
|
|
2798
|
+
position: relative;
|
|
2799
|
+
`;
|
|
2800
|
+
var Panel = styled16.div`
|
|
2801
|
+
overflow: hidden;
|
|
2802
|
+
width: ${(props) => props.width}%;
|
|
2803
|
+
`;
|
|
2804
|
+
var Divider2 = styled16.div`
|
|
2805
|
+
width: var(--measurement-medium-10);
|
|
2806
|
+
height: 100%;
|
|
2807
|
+
top: 0;
|
|
2808
|
+
|
|
2809
|
+
border-radius: var(--measurement-medium-60);
|
|
2810
|
+
background-color: transparent;
|
|
2811
|
+
|
|
2812
|
+
/* background-color: ${(props) => props.$dragging ? "var(--font-color-alpha-10)" : "transparent"}; */
|
|
2813
|
+
|
|
2814
|
+
cursor: col-resize;
|
|
2815
|
+
transition: background-color 0.2s;
|
|
2816
|
+
position: relative;
|
|
2817
|
+
|
|
2818
|
+
/** Shows DragIndicator on hover */
|
|
2819
|
+
&:hover .drag-indicator-handle,
|
|
2820
|
+
&:active .drag-indicator-handle {
|
|
2821
|
+
opacity: 1;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
.drag-indicator-handle {
|
|
2825
|
+
height: ${(props) => props.$dragging ? "var(--measurement-large-10)" : "var(--measurement-medium-60)"};
|
|
2826
|
+
}
|
|
2827
|
+
`;
|
|
2828
|
+
var DragHandle = styled16.div`
|
|
2829
|
+
position: absolute;
|
|
2830
|
+
top: 0;
|
|
2831
|
+
bottom: 0;
|
|
2832
|
+
left: calc(var(--measurement-medium-10) * -1);
|
|
2833
|
+
right: calc(var(--measurement-medium-10) * -1);
|
|
2834
|
+
`;
|
|
2835
|
+
var DragIndicator = styled16.div`
|
|
2836
|
+
position: fixed;
|
|
2837
|
+
width: var(--measurement-medium-10);
|
|
2838
|
+
/* height: var(--measurement-medium-60); */
|
|
2839
|
+
background-color: var(--font-color-alpha-60);
|
|
2840
|
+
border-radius: var(--measurement-large-10);
|
|
2841
|
+
|
|
2842
|
+
opacity: 0;
|
|
2843
|
+
transition: all 0.2s;
|
|
2844
|
+
`;
|
|
2845
|
+
var DragOverlay = styled16.div`
|
|
2846
|
+
position: fixed;
|
|
2847
|
+
top: 0;
|
|
2848
|
+
left: 0;
|
|
2849
|
+
right: 0;
|
|
2850
|
+
bottom: 0;
|
|
2851
|
+
z-index: var(--depth-default-90);
|
|
2852
|
+
cursor: col-resize;
|
|
2853
|
+
`;
|
|
2854
|
+
|
|
2855
|
+
// src/resizable/index.tsx
|
|
2856
|
+
var Resizable = ({
|
|
2857
|
+
defaultWidth,
|
|
2858
|
+
left,
|
|
2859
|
+
right
|
|
2860
|
+
}) => {
|
|
2861
|
+
const containerRef = React26.useRef(null);
|
|
2862
|
+
const [leftWidth, setLeftWidth] = React26.useState(defaultWidth ?? 50);
|
|
2863
|
+
const [isDragging, setIsDragging] = React26.useState(false);
|
|
2864
|
+
const handleMouseDown = React26.useCallback(() => setIsDragging(true), []);
|
|
2865
|
+
const handleMouseUp = React26.useCallback(() => setIsDragging(false), []);
|
|
2866
|
+
const handleMouseMove = React26.useCallback(
|
|
2867
|
+
(e) => {
|
|
2868
|
+
if (!isDragging || !containerRef.current) return;
|
|
2869
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2870
|
+
const newLeftWidth = (e.clientX - containerRect.left) / containerRect.width * 100;
|
|
2871
|
+
const threshold = { min: 30, max: 70 };
|
|
2872
|
+
const constrainedWidth = Math.min(
|
|
2873
|
+
Math.max(newLeftWidth, threshold.min),
|
|
2874
|
+
threshold.max
|
|
2875
|
+
);
|
|
2876
|
+
setLeftWidth(constrainedWidth);
|
|
2877
|
+
},
|
|
2878
|
+
[isDragging]
|
|
2879
|
+
);
|
|
2880
|
+
React26.useEffect(() => {
|
|
2881
|
+
if (isDragging) {
|
|
2882
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
2883
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
2884
|
+
document.body.style.cursor = "col-resize";
|
|
2885
|
+
document.body.style.userSelect = "none";
|
|
2886
|
+
} else {
|
|
2887
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
2888
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
2889
|
+
document.body.style.cursor = "";
|
|
2890
|
+
document.body.style.userSelect = "";
|
|
2891
|
+
}
|
|
2892
|
+
return () => {
|
|
2893
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
2894
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
2895
|
+
document.body.style.cursor = "";
|
|
2896
|
+
document.body.style.userSelect = "";
|
|
2897
|
+
};
|
|
2898
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
2899
|
+
return /* @__PURE__ */ React26.createElement(React26.Fragment, null, /* @__PURE__ */ React26.createElement(SplitContainer, { ref: containerRef, className: "h-100 flex" }, /* @__PURE__ */ React26.createElement(Panel, { width: leftWidth }, left), /* @__PURE__ */ React26.createElement(
|
|
2900
|
+
Divider2,
|
|
2901
|
+
{
|
|
2902
|
+
$dragging: isDragging,
|
|
2903
|
+
onMouseDown: handleMouseDown,
|
|
2904
|
+
onTouchStart: handleMouseDown
|
|
2905
|
+
},
|
|
2906
|
+
/* @__PURE__ */ React26.createElement(
|
|
2907
|
+
DragHandle,
|
|
2908
|
+
{
|
|
2909
|
+
className: "flex align-center justify-center",
|
|
2910
|
+
id: "drag-handle"
|
|
2911
|
+
},
|
|
2912
|
+
/* @__PURE__ */ React26.createElement(DragIndicator, { className: "drag-indicator-handle" })
|
|
2913
|
+
)
|
|
2914
|
+
), /* @__PURE__ */ React26.createElement(Panel, { width: 100 - leftWidth }, right)), isDragging && /* @__PURE__ */ React26.createElement(DragOverlay, null));
|
|
2915
|
+
};
|
|
2916
|
+
Resizable.displayName = "Resizable";
|
|
2917
|
+
|
|
2392
2918
|
// src/sheet/index.tsx
|
|
2393
|
-
import
|
|
2919
|
+
import React28 from "react";
|
|
2394
2920
|
|
|
2395
2921
|
// src/sheet/hooks/index.tsx
|
|
2396
|
-
import
|
|
2397
|
-
var SheetContext =
|
|
2922
|
+
import React27 from "react";
|
|
2923
|
+
var SheetContext = React27.createContext({
|
|
2398
2924
|
id: {},
|
|
2399
2925
|
states: {},
|
|
2400
2926
|
methods: {}
|
|
2401
2927
|
});
|
|
2402
|
-
var useSheet = () =>
|
|
2928
|
+
var useSheet = () => React27.useContext(SheetContext);
|
|
2403
2929
|
var SheetProvider = ({ children }) => {
|
|
2404
2930
|
const context = useSheetProvider();
|
|
2405
|
-
return /* @__PURE__ */
|
|
2931
|
+
return /* @__PURE__ */ React27.createElement(SheetContext.Provider, { value: context }, children);
|
|
2406
2932
|
};
|
|
2407
2933
|
function useSheetProvider() {
|
|
2408
|
-
const containerId =
|
|
2409
|
-
const triggerId =
|
|
2410
|
-
const controlId =
|
|
2411
|
-
const [open, setOpen] =
|
|
2934
|
+
const containerId = React27.useId();
|
|
2935
|
+
const triggerId = React27.useId();
|
|
2936
|
+
const controlId = React27.useId();
|
|
2937
|
+
const [open, setOpen] = React27.useState(false);
|
|
2412
2938
|
return {
|
|
2413
2939
|
id: {
|
|
2414
2940
|
containerId,
|
|
@@ -2426,8 +2952,8 @@ function useSheetProvider() {
|
|
|
2426
2952
|
}
|
|
2427
2953
|
|
|
2428
2954
|
// src/sheet/styles/index.ts
|
|
2429
|
-
import
|
|
2430
|
-
var SheetStyles =
|
|
2955
|
+
import styled17, { css as css10 } from "styled-components";
|
|
2956
|
+
var SheetStyles = css10`
|
|
2431
2957
|
all: unset;
|
|
2432
2958
|
position: fixed;
|
|
2433
2959
|
background-color: var(--body-color);
|
|
@@ -2458,7 +2984,7 @@ var SheetStyles = css9`
|
|
|
2458
2984
|
animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
|
|
2459
2985
|
animation-fill-mode: backwards;
|
|
2460
2986
|
`;
|
|
2461
|
-
var SheetSizeStyles =
|
|
2987
|
+
var SheetSizeStyles = css10`
|
|
2462
2988
|
&[data-size="small"] {
|
|
2463
2989
|
width: var(--measurement-large-80);
|
|
2464
2990
|
}
|
|
@@ -2471,7 +2997,7 @@ var SheetSizeStyles = css9`
|
|
|
2471
2997
|
width: calc(var(--measurement-large-90) * 1.5);
|
|
2472
2998
|
}
|
|
2473
2999
|
`;
|
|
2474
|
-
var SheetSideStyles =
|
|
3000
|
+
var SheetSideStyles = css10`
|
|
2475
3001
|
top: 0;
|
|
2476
3002
|
|
|
2477
3003
|
&[data-side="right"] {
|
|
@@ -2486,7 +3012,7 @@ var SheetSideStyles = css9`
|
|
|
2486
3012
|
animation-name: slide-left;
|
|
2487
3013
|
}
|
|
2488
3014
|
`;
|
|
2489
|
-
var SheetWrapper =
|
|
3015
|
+
var SheetWrapper = styled17.dialog`
|
|
2490
3016
|
&[data-raw="false"] {
|
|
2491
3017
|
${SheetStyles}
|
|
2492
3018
|
${SheetSideStyles}
|
|
@@ -2496,7 +3022,7 @@ var SheetWrapper = styled13.dialog`
|
|
|
2496
3022
|
|
|
2497
3023
|
// src/sheet/index.tsx
|
|
2498
3024
|
var SheetRoot = ({ children }) => {
|
|
2499
|
-
return /* @__PURE__ */
|
|
3025
|
+
return /* @__PURE__ */ React28.createElement(SheetProvider, null, children);
|
|
2500
3026
|
};
|
|
2501
3027
|
SheetRoot.displayName = "Sheet.Root";
|
|
2502
3028
|
var Sheet = (props) => {
|
|
@@ -2517,16 +3043,16 @@ var Sheet = (props) => {
|
|
|
2517
3043
|
const { id, states, methods } = useSheet();
|
|
2518
3044
|
const { toggle } = methods;
|
|
2519
3045
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
2520
|
-
|
|
3046
|
+
React28.useEffect(() => {
|
|
2521
3047
|
if (open && toggle) return toggle();
|
|
2522
3048
|
}, [open]);
|
|
2523
|
-
|
|
3049
|
+
React28.useEffect(() => {
|
|
2524
3050
|
if (shortcut && shortcutControls && toggle) {
|
|
2525
3051
|
return toggle();
|
|
2526
3052
|
}
|
|
2527
3053
|
}, [shortcutControls]);
|
|
2528
3054
|
useDisabledScroll(lock && Boolean(states.open));
|
|
2529
|
-
return /* @__PURE__ */
|
|
3055
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, states.open && /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(
|
|
2530
3056
|
SheetWrapper,
|
|
2531
3057
|
{
|
|
2532
3058
|
role: "dialog",
|
|
@@ -2543,7 +3069,7 @@ var Sheet = (props) => {
|
|
|
2543
3069
|
...restProps
|
|
2544
3070
|
},
|
|
2545
3071
|
children
|
|
2546
|
-
), overlay && /* @__PURE__ */
|
|
3072
|
+
), overlay && /* @__PURE__ */ React28.createElement(
|
|
2547
3073
|
Overlay,
|
|
2548
3074
|
{
|
|
2549
3075
|
onClick: () => toggle && toggle(!states.open),
|
|
@@ -2569,7 +3095,7 @@ var SheetTrigger = (props) => {
|
|
|
2569
3095
|
if (onClick) onClick(event);
|
|
2570
3096
|
if (toggle) toggle(!states.open);
|
|
2571
3097
|
};
|
|
2572
|
-
return /* @__PURE__ */
|
|
3098
|
+
return /* @__PURE__ */ React28.createElement(
|
|
2573
3099
|
Button,
|
|
2574
3100
|
{
|
|
2575
3101
|
id: id.triggerId,
|
|
@@ -2589,13 +3115,13 @@ Sheet.Root = SheetRoot;
|
|
|
2589
3115
|
Sheet.Trigger = SheetTrigger;
|
|
2590
3116
|
|
|
2591
3117
|
// src/scrollarea/index.tsx
|
|
2592
|
-
import
|
|
3118
|
+
import React29 from "react";
|
|
2593
3119
|
var ScrollArea = ({
|
|
2594
3120
|
scrollbar = false,
|
|
2595
3121
|
children,
|
|
2596
3122
|
...restProps
|
|
2597
3123
|
}) => {
|
|
2598
|
-
return /* @__PURE__ */
|
|
3124
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2599
3125
|
ScrollAreaWrapper,
|
|
2600
3126
|
{
|
|
2601
3127
|
"aria-hidden": "true",
|
|
@@ -2606,11 +3132,134 @@ var ScrollArea = ({
|
|
|
2606
3132
|
);
|
|
2607
3133
|
};
|
|
2608
3134
|
|
|
3135
|
+
// src/spinner/index.tsx
|
|
3136
|
+
import React30 from "react";
|
|
3137
|
+
|
|
3138
|
+
// src/spinner/styles/index.ts
|
|
3139
|
+
import styled18, { css as css11, keyframes as keyframes2 } from "styled-components";
|
|
3140
|
+
var Rotate = keyframes2`
|
|
3141
|
+
0% {
|
|
3142
|
+
transform: rotate(0deg);
|
|
3143
|
+
}
|
|
3144
|
+
100% {
|
|
3145
|
+
transform: rotate(360deg);
|
|
3146
|
+
}
|
|
3147
|
+
`;
|
|
3148
|
+
var FieldSizeStyles2 = css11`
|
|
3149
|
+
&[data-size="small"] {
|
|
3150
|
+
width: var(--measurement-medium-40);
|
|
3151
|
+
height: var(--measurement-medium-40);
|
|
3152
|
+
}
|
|
3153
|
+
&[data-size="medium"] {
|
|
3154
|
+
width: var(--measurement-medium-50);
|
|
3155
|
+
height: var(--measurement-medium-50);
|
|
3156
|
+
}
|
|
3157
|
+
&[data-size="large"] {
|
|
3158
|
+
width: var(--measurement-medium-60);
|
|
3159
|
+
height: var(--measurement-medium-60);
|
|
3160
|
+
}
|
|
3161
|
+
`;
|
|
3162
|
+
var RotatingSpinner = styled18.span`
|
|
3163
|
+
padding: 0;
|
|
3164
|
+
margin: 0;
|
|
3165
|
+
|
|
3166
|
+
display: inline-block;
|
|
3167
|
+
box-sizing: border-box;
|
|
3168
|
+
|
|
3169
|
+
border: var(--measurement-small-60) solid var(--font-color-alpha-30);
|
|
3170
|
+
border-bottom-color: transparent;
|
|
3171
|
+
border-radius: var(--measurement-large-90);
|
|
3172
|
+
|
|
3173
|
+
animation: ${Rotate} 1s linear infinite;
|
|
3174
|
+
|
|
3175
|
+
${FieldSizeStyles2}
|
|
3176
|
+
`;
|
|
3177
|
+
|
|
3178
|
+
// src/spinner/index.tsx
|
|
3179
|
+
var Spinner = (props) => {
|
|
3180
|
+
return /* @__PURE__ */ React30.createElement(RotatingSpinner, { "data-size": props.sizing ?? "medium" });
|
|
3181
|
+
};
|
|
3182
|
+
|
|
3183
|
+
// src/skeleton/index.tsx
|
|
3184
|
+
import React31 from "react";
|
|
3185
|
+
|
|
3186
|
+
// src/skeleton/styles/index.ts
|
|
3187
|
+
import styled19, { css as css12, keyframes as keyframes3 } from "styled-components";
|
|
3188
|
+
var SkeletonBlink = keyframes3`
|
|
3189
|
+
0% {
|
|
3190
|
+
opacity: 0.3;
|
|
3191
|
+
}
|
|
3192
|
+
100% {
|
|
3193
|
+
opacity: 0.1;
|
|
3194
|
+
}
|
|
3195
|
+
`;
|
|
3196
|
+
var SkeletonBaseStyles = css12`
|
|
3197
|
+
background: linear-gradient(
|
|
3198
|
+
45deg,
|
|
3199
|
+
var(--font-color-alpha-10),
|
|
3200
|
+
var(--font-color-alpha-20)
|
|
3201
|
+
);
|
|
3202
|
+
animation: ${SkeletonBlink} 1s ease-in-out alternate-reverse infinite;
|
|
3203
|
+
`;
|
|
3204
|
+
var SkeletonSizeStyles = css12`
|
|
3205
|
+
&[data-size="small"] {
|
|
3206
|
+
width: 100%;
|
|
3207
|
+
|
|
3208
|
+
min-width: var(--measurement-medium-60);
|
|
3209
|
+
min-height: var(--measurement-medium-70);
|
|
3210
|
+
}
|
|
3211
|
+
&[data-size="medium"] {
|
|
3212
|
+
width: 100%;
|
|
3213
|
+
min-width: var(--measurement-medium-90);
|
|
3214
|
+
min-height: var(--measurement-medium-80);
|
|
3215
|
+
}
|
|
3216
|
+
&[data-size="large"] {
|
|
3217
|
+
width: 100%;
|
|
3218
|
+
min-width: var(--measurement-medium-90);
|
|
3219
|
+
min-height: var(--measurement-medium-90);
|
|
3220
|
+
}
|
|
3221
|
+
`;
|
|
3222
|
+
var SkeletonShapeStyles = css12`
|
|
3223
|
+
&[data-shape="square"] {
|
|
3224
|
+
border-radius: 0;
|
|
3225
|
+
}
|
|
3226
|
+
&[data-shape="smooth"] {
|
|
3227
|
+
border-radius: var(--measurement-medium-20);
|
|
3228
|
+
}
|
|
3229
|
+
&[data-shape="round"] {
|
|
3230
|
+
border-radius: var(--measurement-large-90);
|
|
3231
|
+
}
|
|
3232
|
+
`;
|
|
3233
|
+
var SkeletonLoader = styled19.span`
|
|
3234
|
+
${SkeletonBaseStyles}
|
|
3235
|
+
${SkeletonSizeStyles}
|
|
3236
|
+
${SkeletonShapeStyles}
|
|
3237
|
+
`;
|
|
3238
|
+
|
|
3239
|
+
// src/skeleton/index.tsx
|
|
3240
|
+
var Skeleton = (props) => {
|
|
3241
|
+
const {
|
|
3242
|
+
sizing = "medium" /* Medium */,
|
|
3243
|
+
shape = "smooth",
|
|
3244
|
+
...restProps
|
|
3245
|
+
} = props;
|
|
3246
|
+
return /* @__PURE__ */ React31.createElement(
|
|
3247
|
+
SkeletonLoader,
|
|
3248
|
+
{
|
|
3249
|
+
"data-size": sizing,
|
|
3250
|
+
"data-shape": shape,
|
|
3251
|
+
tabIndex: 0,
|
|
3252
|
+
...restProps
|
|
3253
|
+
}
|
|
3254
|
+
);
|
|
3255
|
+
};
|
|
3256
|
+
Skeleton.displayName = "Skeleton";
|
|
3257
|
+
|
|
2609
3258
|
// src/switch/index.tsx
|
|
2610
|
-
import
|
|
3259
|
+
import React33 from "react";
|
|
2611
3260
|
|
|
2612
3261
|
// src/switch/hooks/index.tsx
|
|
2613
|
-
import
|
|
3262
|
+
import React32, { useState as useState6, createContext as createContext6, useContext as useContext6 } from "react";
|
|
2614
3263
|
var defaultComponentAPI6 = {
|
|
2615
3264
|
id: "",
|
|
2616
3265
|
states: {},
|
|
@@ -2620,11 +3269,11 @@ var SwitchContext = createContext6(defaultComponentAPI6);
|
|
|
2620
3269
|
var useSwitch = () => useContext6(SwitchContext);
|
|
2621
3270
|
var SwitchProvider = ({ children }) => {
|
|
2622
3271
|
const context = useSwitchProvider();
|
|
2623
|
-
return /* @__PURE__ */
|
|
3272
|
+
return /* @__PURE__ */ React32.createElement(SwitchContext.Provider, { value: context }, children);
|
|
2624
3273
|
};
|
|
2625
3274
|
function useSwitchProvider() {
|
|
2626
3275
|
const [checked, setChecked] = useState6(false);
|
|
2627
|
-
const switchId =
|
|
3276
|
+
const switchId = React32.useId();
|
|
2628
3277
|
return {
|
|
2629
3278
|
id: switchId,
|
|
2630
3279
|
states: {
|
|
@@ -2637,8 +3286,8 @@ function useSwitchProvider() {
|
|
|
2637
3286
|
}
|
|
2638
3287
|
|
|
2639
3288
|
// src/switch/styles/index.ts
|
|
2640
|
-
import
|
|
2641
|
-
var SwitchDefaultStyles =
|
|
3289
|
+
import styled20, { css as css13 } from "styled-components";
|
|
3290
|
+
var SwitchDefaultStyles = css13`
|
|
2642
3291
|
all: unset;
|
|
2643
3292
|
|
|
2644
3293
|
border: var(--measurement-small-10) solid transparent;
|
|
@@ -2652,7 +3301,7 @@ var SwitchDefaultStyles = css10`
|
|
|
2652
3301
|
opacity: 0.6;
|
|
2653
3302
|
}
|
|
2654
3303
|
`;
|
|
2655
|
-
var SwitchVariantsStyles =
|
|
3304
|
+
var SwitchVariantsStyles = css13`
|
|
2656
3305
|
&[data-variant="primary"] {
|
|
2657
3306
|
&[aria-checked="true"] {
|
|
2658
3307
|
background-color: var(--color-green);
|
|
@@ -2683,7 +3332,7 @@ var SwitchVariantsStyles = css10`
|
|
|
2683
3332
|
}
|
|
2684
3333
|
}
|
|
2685
3334
|
`;
|
|
2686
|
-
var SwitchSizeStyles =
|
|
3335
|
+
var SwitchSizeStyles = css13`
|
|
2687
3336
|
&[data-size="small"] {
|
|
2688
3337
|
width: calc(var(--measurement-medium-60) * 1.33);
|
|
2689
3338
|
height: var(--measurement-medium-50);
|
|
@@ -2732,14 +3381,14 @@ var SwitchSizeStyles = css10`
|
|
|
2732
3381
|
}
|
|
2733
3382
|
}
|
|
2734
3383
|
`;
|
|
2735
|
-
var TriggerWrapper =
|
|
3384
|
+
var TriggerWrapper = styled20.button`
|
|
2736
3385
|
&[data-raw="false"] {
|
|
2737
3386
|
${SwitchDefaultStyles}
|
|
2738
3387
|
${SwitchVariantsStyles}
|
|
2739
3388
|
${SwitchSizeStyles}
|
|
2740
3389
|
}
|
|
2741
3390
|
`;
|
|
2742
|
-
var Thumb =
|
|
3391
|
+
var Thumb = styled20.span`
|
|
2743
3392
|
&[data-raw="false"] {
|
|
2744
3393
|
all: unset;
|
|
2745
3394
|
display: block;
|
|
@@ -2773,10 +3422,10 @@ var Switch = (props) => {
|
|
|
2773
3422
|
if (onClick) onClick(event);
|
|
2774
3423
|
if (toggleSwitch) toggleSwitch();
|
|
2775
3424
|
};
|
|
2776
|
-
|
|
3425
|
+
React33.useEffect(() => {
|
|
2777
3426
|
if (defaultChecked && toggleSwitch) toggleSwitch();
|
|
2778
3427
|
}, [defaultChecked]);
|
|
2779
|
-
return /* @__PURE__ */
|
|
3428
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2780
3429
|
TriggerWrapper,
|
|
2781
3430
|
{
|
|
2782
3431
|
type: "button",
|
|
@@ -2792,19 +3441,19 @@ var Switch = (props) => {
|
|
|
2792
3441
|
"data-raw": Boolean(raw),
|
|
2793
3442
|
...restProps
|
|
2794
3443
|
},
|
|
2795
|
-
/* @__PURE__ */
|
|
3444
|
+
/* @__PURE__ */ React33.createElement("title", null, "Switch"),
|
|
2796
3445
|
children
|
|
2797
3446
|
);
|
|
2798
3447
|
};
|
|
2799
3448
|
Switch.displayName = "Switch";
|
|
2800
3449
|
var SwitchRoot = ({ children }) => {
|
|
2801
|
-
return /* @__PURE__ */
|
|
3450
|
+
return /* @__PURE__ */ React33.createElement(SwitchProvider, null, children);
|
|
2802
3451
|
};
|
|
2803
3452
|
SwitchRoot.displayName = "Switch.Root";
|
|
2804
3453
|
var SwitchThumb = (props) => {
|
|
2805
3454
|
const { raw, sizing } = props;
|
|
2806
3455
|
const { id, states } = useSwitch();
|
|
2807
|
-
return /* @__PURE__ */
|
|
3456
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2808
3457
|
Thumb,
|
|
2809
3458
|
{
|
|
2810
3459
|
role: "presentation",
|
|
@@ -2824,11 +3473,11 @@ Switch.Root = SwitchRoot;
|
|
|
2824
3473
|
Switch.Thumb = SwitchThumb;
|
|
2825
3474
|
|
|
2826
3475
|
// src/table/index.tsx
|
|
2827
|
-
import
|
|
3476
|
+
import React34 from "react";
|
|
2828
3477
|
|
|
2829
3478
|
// src/table/styles/index.ts
|
|
2830
|
-
import
|
|
2831
|
-
var CellStyles =
|
|
3479
|
+
import styled21, { css as css14 } from "styled-components";
|
|
3480
|
+
var CellStyles = css14`
|
|
2832
3481
|
box-sizing: border-box;
|
|
2833
3482
|
border: none;
|
|
2834
3483
|
line-height: 1;
|
|
@@ -2838,11 +3487,11 @@ var CellStyles = css11`
|
|
|
2838
3487
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
2839
3488
|
);
|
|
2840
3489
|
`;
|
|
2841
|
-
var TableLayer =
|
|
3490
|
+
var TableLayer = styled21.div`
|
|
2842
3491
|
border-radius: var(--measurement-medium-30);
|
|
2843
3492
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2844
3493
|
`;
|
|
2845
|
-
var TableWrapper =
|
|
3494
|
+
var TableWrapper = styled21.table`
|
|
2846
3495
|
border-collapse: collapse;
|
|
2847
3496
|
|
|
2848
3497
|
tbody {
|
|
@@ -2853,7 +3502,7 @@ var TableWrapper = styled15.table`
|
|
|
2853
3502
|
}
|
|
2854
3503
|
}
|
|
2855
3504
|
`;
|
|
2856
|
-
var RowWrapper =
|
|
3505
|
+
var RowWrapper = styled21.tr`
|
|
2857
3506
|
border-bottom: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2858
3507
|
|
|
2859
3508
|
transition: background-color linear 0.1s;
|
|
@@ -2862,7 +3511,7 @@ var RowWrapper = styled15.tr`
|
|
|
2862
3511
|
background-color: var(--font-color-alpha-10);
|
|
2863
3512
|
}
|
|
2864
3513
|
`;
|
|
2865
|
-
var HeadCellWrapper =
|
|
3514
|
+
var HeadCellWrapper = styled21.th`
|
|
2866
3515
|
font-size: var(--fontsize-medium-10);
|
|
2867
3516
|
${CellStyles}
|
|
2868
3517
|
|
|
@@ -2870,7 +3519,7 @@ var HeadCellWrapper = styled15.th`
|
|
|
2870
3519
|
color: var(--font-color-alpha-60);
|
|
2871
3520
|
}
|
|
2872
3521
|
`;
|
|
2873
|
-
var CellWrapper =
|
|
3522
|
+
var CellWrapper = styled21.td`
|
|
2874
3523
|
${CellStyles}
|
|
2875
3524
|
`;
|
|
2876
3525
|
|
|
@@ -2879,43 +3528,43 @@ var Table = ({
|
|
|
2879
3528
|
children,
|
|
2880
3529
|
...restProps
|
|
2881
3530
|
}) => {
|
|
2882
|
-
return /* @__PURE__ */
|
|
3531
|
+
return /* @__PURE__ */ React34.createElement(ScrollArea, { as: TableLayer, role: "presentation", tabIndex: -1 }, /* @__PURE__ */ React34.createElement(TableWrapper, { ...restProps, cellSpacing: "0", cellPadding: "0" }, children));
|
|
2883
3532
|
};
|
|
2884
3533
|
Table.displayName = "Table";
|
|
2885
3534
|
var TableHead = ({
|
|
2886
3535
|
children,
|
|
2887
3536
|
...restProps
|
|
2888
3537
|
}) => {
|
|
2889
|
-
return /* @__PURE__ */
|
|
3538
|
+
return /* @__PURE__ */ React34.createElement("thead", { ...restProps }, children);
|
|
2890
3539
|
};
|
|
2891
3540
|
TableHead.displayName = "Table.Head";
|
|
2892
3541
|
var TableBody = ({
|
|
2893
3542
|
children,
|
|
2894
3543
|
...restProps
|
|
2895
3544
|
}) => {
|
|
2896
|
-
return /* @__PURE__ */
|
|
3545
|
+
return /* @__PURE__ */ React34.createElement("tbody", { ...restProps }, children);
|
|
2897
3546
|
};
|
|
2898
3547
|
TableBody.displayName = "Table.Body";
|
|
2899
3548
|
var TableHeadCell = ({
|
|
2900
3549
|
children,
|
|
2901
3550
|
...restProps
|
|
2902
3551
|
}) => {
|
|
2903
|
-
return /* @__PURE__ */
|
|
3552
|
+
return /* @__PURE__ */ React34.createElement(HeadCellWrapper, { colSpan: 1, ...restProps }, /* @__PURE__ */ React34.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
2904
3553
|
};
|
|
2905
3554
|
TableHeadCell.displayName = "Table.HeadCell";
|
|
2906
3555
|
var TableRow = ({ children, ...restProps }) => {
|
|
2907
|
-
return /* @__PURE__ */
|
|
3556
|
+
return /* @__PURE__ */ React34.createElement(RowWrapper, { className: "p-medium-30", ...restProps }, children);
|
|
2908
3557
|
};
|
|
2909
3558
|
TableRow.displayName = "Table.Row";
|
|
2910
3559
|
var TableCell = ({ children, ...restProps }) => {
|
|
2911
|
-
return /* @__PURE__ */
|
|
3560
|
+
return /* @__PURE__ */ React34.createElement(CellWrapper, { ...restProps }, /* @__PURE__ */ React34.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
2912
3561
|
};
|
|
2913
3562
|
TableCell.displayName = "Table.Cell";
|
|
2914
3563
|
var TableFooter = ({
|
|
2915
3564
|
children,
|
|
2916
3565
|
...restProps
|
|
2917
3566
|
}) => {
|
|
2918
|
-
return /* @__PURE__ */
|
|
3567
|
+
return /* @__PURE__ */ React34.createElement("tfoot", { ...restProps }, children);
|
|
2919
3568
|
};
|
|
2920
3569
|
TableFooter.displayName = "Table.Footer";
|
|
2921
3570
|
Table.Head = TableHead;
|
|
@@ -2926,10 +3575,10 @@ Table.Cell = TableCell;
|
|
|
2926
3575
|
Table.Footer = TableFooter;
|
|
2927
3576
|
|
|
2928
3577
|
// src/tabs/index.tsx
|
|
2929
|
-
import
|
|
3578
|
+
import React36, { Children } from "react";
|
|
2930
3579
|
|
|
2931
3580
|
// src/tabs/hooks/index.tsx
|
|
2932
|
-
import
|
|
3581
|
+
import React35, { createContext as createContext7, useContext as useContext7, useState as useState7 } from "react";
|
|
2933
3582
|
var defaultComponentAPI7 = {
|
|
2934
3583
|
id: "",
|
|
2935
3584
|
states: {},
|
|
@@ -2939,11 +3588,11 @@ var TabsContext = createContext7(defaultComponentAPI7);
|
|
|
2939
3588
|
var useTabs = () => useContext7(TabsContext);
|
|
2940
3589
|
var TabsProvider = ({ children }) => {
|
|
2941
3590
|
const context = useTabsProvider();
|
|
2942
|
-
return /* @__PURE__ */
|
|
3591
|
+
return /* @__PURE__ */ React35.createElement(TabsContext.Provider, { value: context }, children);
|
|
2943
3592
|
};
|
|
2944
3593
|
function useTabsProvider() {
|
|
2945
3594
|
const [value, setValue] = useState7(null);
|
|
2946
|
-
const tabsId =
|
|
3595
|
+
const tabsId = React35.useId();
|
|
2947
3596
|
return {
|
|
2948
3597
|
id: tabsId,
|
|
2949
3598
|
states: {
|
|
@@ -2957,8 +3606,8 @@ function useTabsProvider() {
|
|
|
2957
3606
|
}
|
|
2958
3607
|
|
|
2959
3608
|
// src/tabs/styles/index.ts
|
|
2960
|
-
import
|
|
2961
|
-
var TabWrapper =
|
|
3609
|
+
import styled22 from "styled-components";
|
|
3610
|
+
var TabWrapper = styled22.div`
|
|
2962
3611
|
button {
|
|
2963
3612
|
&[aria-selected="true"] {
|
|
2964
3613
|
color: var(--font-color) !important;
|
|
@@ -2973,20 +3622,20 @@ var Tabs = (props) => {
|
|
|
2973
3622
|
const { applyValue } = methods;
|
|
2974
3623
|
const childArray = Children.toArray(children);
|
|
2975
3624
|
const firstChild = childArray[0];
|
|
2976
|
-
|
|
2977
|
-
if (
|
|
3625
|
+
React36.useEffect(() => {
|
|
3626
|
+
if (React36.isValidElement(firstChild)) {
|
|
2978
3627
|
if (childArray.length > 0 && applyValue)
|
|
2979
3628
|
applyValue(firstChild.props.value);
|
|
2980
3629
|
}
|
|
2981
3630
|
}, []);
|
|
2982
|
-
|
|
3631
|
+
React36.useEffect(() => {
|
|
2983
3632
|
if (defaultOpen && applyValue) applyValue(defaultOpen);
|
|
2984
3633
|
}, []);
|
|
2985
|
-
return /* @__PURE__ */
|
|
3634
|
+
return /* @__PURE__ */ React36.createElement(TabWrapper, { role: "tablist", ...restProps }, children);
|
|
2986
3635
|
};
|
|
2987
3636
|
Tabs.displayName = "Tabs";
|
|
2988
3637
|
var TabsRoot = ({ children }) => {
|
|
2989
|
-
return /* @__PURE__ */
|
|
3638
|
+
return /* @__PURE__ */ React36.createElement(TabsProvider, null, children);
|
|
2990
3639
|
};
|
|
2991
3640
|
TabsRoot.displayName = "Tabs.Root";
|
|
2992
3641
|
var TabsTrigger = (props) => {
|
|
@@ -3002,7 +3651,7 @@ var TabsTrigger = (props) => {
|
|
|
3002
3651
|
if (applyValue) applyValue(value);
|
|
3003
3652
|
if (onClick) onClick(event);
|
|
3004
3653
|
};
|
|
3005
|
-
return /* @__PURE__ */
|
|
3654
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3006
3655
|
Button,
|
|
3007
3656
|
{
|
|
3008
3657
|
type: "button",
|
|
@@ -3030,7 +3679,7 @@ var TabsContent = (props) => {
|
|
|
3030
3679
|
trigger: getTabsId && getTabsId({ value, type: "trigger" }),
|
|
3031
3680
|
content: getTabsId && getTabsId({ value, type: "content" })
|
|
3032
3681
|
};
|
|
3033
|
-
return /* @__PURE__ */
|
|
3682
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3034
3683
|
"div",
|
|
3035
3684
|
{
|
|
3036
3685
|
tabIndex: 0,
|
|
@@ -3050,23 +3699,131 @@ Tabs.Root = TabsRoot;
|
|
|
3050
3699
|
Tabs.Trigger = TabsTrigger;
|
|
3051
3700
|
Tabs.Content = TabsContent;
|
|
3052
3701
|
|
|
3702
|
+
// src/text-area/index.tsx
|
|
3703
|
+
import React37 from "react";
|
|
3704
|
+
|
|
3705
|
+
// src/text-area/styles/index.ts
|
|
3706
|
+
import styled23, { css as css15 } from "styled-components";
|
|
3707
|
+
var CustomScrollbar2 = css15`
|
|
3708
|
+
height: ${({ $height }) => $height ?? "100%"};
|
|
3709
|
+
width: ${({ $width }) => $width ?? "100%"};
|
|
3710
|
+
overflow-y: auto;
|
|
3711
|
+
overflow-x: hidden;
|
|
3712
|
+
|
|
3713
|
+
&::-webkit-scrollbar {
|
|
3714
|
+
cursor: pointer;
|
|
3715
|
+
|
|
3716
|
+
width: var(--measurement-medium-10);
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
&::-webkit-scrollbar-track {
|
|
3720
|
+
background: ${({ $trackColor }) => $trackColor ?? "transparent"};
|
|
3721
|
+
border-radius: var(--measurement-medium-30);
|
|
3722
|
+
border: none;
|
|
3723
|
+
}
|
|
3724
|
+
|
|
3725
|
+
&::-webkit-scrollbar-thumb {
|
|
3726
|
+
background: ${({ $thumbColor }) => $thumbColor ?? "var(--font-color-alpha-10)"};
|
|
3727
|
+
border-radius: var(--measurement-medium-30);
|
|
3728
|
+
transition: background-color 0.2s ease;
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
3732
|
+
background: ${({ $thumbHoverColor, $thumbColor }) => $thumbHoverColor ?? $thumbColor ?? "var(--font-color-alpha-20)"};
|
|
3733
|
+
}
|
|
3734
|
+
|
|
3735
|
+
// Firefox
|
|
3736
|
+
scrollbar-width: thin;
|
|
3737
|
+
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor ?? "var(--font-color-alpha-10)"} ${$trackColor ?? "transparent"}`};
|
|
3738
|
+
`;
|
|
3739
|
+
var TextareaSizeStyles = css15`
|
|
3740
|
+
padding: var(--measurement-medium-30);
|
|
3741
|
+
max-height: var(--measurement-large-60);
|
|
3742
|
+
|
|
3743
|
+
&[data-size="small"] {
|
|
3744
|
+
min-height: var(--measurement-large-30);
|
|
3745
|
+
}
|
|
3746
|
+
&[data-size="medium"] {
|
|
3747
|
+
min-height: var(--measurement-large-50);
|
|
3748
|
+
}
|
|
3749
|
+
&[data-size="large"] {
|
|
3750
|
+
min-height: var(--measurement-large-60);
|
|
3751
|
+
max-height: var(--measurement-large-80);
|
|
3752
|
+
}
|
|
3753
|
+
`;
|
|
3754
|
+
var TextareaResizableStyles = css15`
|
|
3755
|
+
&[data-resizable="true"] {
|
|
3756
|
+
resize: vertical;
|
|
3757
|
+
}
|
|
3758
|
+
&[data-resizable="false"] {
|
|
3759
|
+
resize: none;
|
|
3760
|
+
}
|
|
3761
|
+
`;
|
|
3762
|
+
var TextAreaContainer = styled23.textarea`
|
|
3763
|
+
&[data-raw="false"] {
|
|
3764
|
+
${FieldDefaultStyles}
|
|
3765
|
+
${FieldShapeStyles}
|
|
3766
|
+
|
|
3767
|
+
${TextareaSizeStyles}
|
|
3768
|
+
${TextareaResizableStyles}
|
|
3769
|
+
|
|
3770
|
+
${CustomScrollbar2}
|
|
3771
|
+
${FieldVariantsStyles}
|
|
3772
|
+
}
|
|
3773
|
+
`;
|
|
3774
|
+
|
|
3775
|
+
// src/text-area/index.tsx
|
|
3776
|
+
var Textarea = (props) => {
|
|
3777
|
+
const { raw, shape, sizing, variant, resizable, onChange } = props;
|
|
3778
|
+
const textareaRef = React37.useRef(null);
|
|
3779
|
+
const adjustHeight = () => {
|
|
3780
|
+
const textarea = textareaRef.current;
|
|
3781
|
+
if (textarea) {
|
|
3782
|
+
textarea.style.height = "auto";
|
|
3783
|
+
textarea.style.height = `${Math.min(
|
|
3784
|
+
textarea.scrollHeight,
|
|
3785
|
+
parseInt(getComputedStyle(textarea).maxHeight)
|
|
3786
|
+
)}px`;
|
|
3787
|
+
}
|
|
3788
|
+
};
|
|
3789
|
+
const handleChange = (e) => {
|
|
3790
|
+
adjustHeight();
|
|
3791
|
+
onChange?.(e);
|
|
3792
|
+
};
|
|
3793
|
+
React37.useEffect(() => adjustHeight(), [props.value]);
|
|
3794
|
+
return /* @__PURE__ */ React37.createElement(
|
|
3795
|
+
TextAreaContainer,
|
|
3796
|
+
{
|
|
3797
|
+
ref: textareaRef,
|
|
3798
|
+
onChange: handleChange,
|
|
3799
|
+
"data-variant": variant ?? "secondary",
|
|
3800
|
+
"data-shape": shape ?? "smooth",
|
|
3801
|
+
"data-size": sizing ?? "medium" /* Medium */,
|
|
3802
|
+
"data-resizable": resizable,
|
|
3803
|
+
"data-raw": String(Boolean(raw)),
|
|
3804
|
+
...props
|
|
3805
|
+
}
|
|
3806
|
+
);
|
|
3807
|
+
};
|
|
3808
|
+
Textarea.displayName = "Textarea";
|
|
3809
|
+
|
|
3053
3810
|
// src/toggle/index.tsx
|
|
3054
|
-
import
|
|
3811
|
+
import React38 from "react";
|
|
3055
3812
|
var Toggle = (props) => {
|
|
3056
3813
|
const { defaultChecked, onClick, disabled, children, ...restProps } = props;
|
|
3057
|
-
const [checked, setChecked] =
|
|
3814
|
+
const [checked, setChecked] = React38.useState(
|
|
3058
3815
|
defaultChecked ?? false
|
|
3059
3816
|
);
|
|
3060
3817
|
const handleClick = (event) => {
|
|
3061
3818
|
if (onClick) onClick(event);
|
|
3062
3819
|
if (!disabled) setChecked((prevChecked) => !prevChecked);
|
|
3063
3820
|
};
|
|
3064
|
-
|
|
3821
|
+
React38.useEffect(() => {
|
|
3065
3822
|
if (defaultChecked !== void 0) {
|
|
3066
3823
|
setChecked(Boolean(defaultChecked));
|
|
3067
3824
|
}
|
|
3068
3825
|
}, [defaultChecked]);
|
|
3069
|
-
return /* @__PURE__ */
|
|
3826
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3070
3827
|
Button,
|
|
3071
3828
|
{
|
|
3072
3829
|
role: "switch",
|
|
@@ -3084,10 +3841,10 @@ var Toggle = (props) => {
|
|
|
3084
3841
|
Toggle.displayName = "Toggle";
|
|
3085
3842
|
|
|
3086
3843
|
// src/toolbar/index.tsx
|
|
3087
|
-
import
|
|
3844
|
+
import React40 from "react";
|
|
3088
3845
|
|
|
3089
3846
|
// src/toolbar/hooks/index.tsx
|
|
3090
|
-
import
|
|
3847
|
+
import React39, { useState as useState8, createContext as createContext8, useContext as useContext8 } from "react";
|
|
3091
3848
|
var defaultComponentAPI8 = {
|
|
3092
3849
|
id: "",
|
|
3093
3850
|
states: {},
|
|
@@ -3097,11 +3854,11 @@ var ToolbarContext = createContext8(defaultComponentAPI8);
|
|
|
3097
3854
|
var useToolbar = () => useContext8(ToolbarContext);
|
|
3098
3855
|
var ToolbarProvider = ({ children }) => {
|
|
3099
3856
|
const context = useToolbarProvider();
|
|
3100
|
-
return /* @__PURE__ */
|
|
3857
|
+
return /* @__PURE__ */ React39.createElement(ToolbarContext.Provider, { value: context }, children);
|
|
3101
3858
|
};
|
|
3102
3859
|
function useToolbarProvider() {
|
|
3103
3860
|
const [expanded, setExpanded] = useState8(false);
|
|
3104
|
-
const toolbarId =
|
|
3861
|
+
const toolbarId = React39.useId();
|
|
3105
3862
|
return {
|
|
3106
3863
|
id: toolbarId,
|
|
3107
3864
|
states: {
|
|
@@ -3114,8 +3871,8 @@ function useToolbarProvider() {
|
|
|
3114
3871
|
}
|
|
3115
3872
|
|
|
3116
3873
|
// src/toolbar/styles/index.ts
|
|
3117
|
-
import
|
|
3118
|
-
var ToolbarDefaultStyles =
|
|
3874
|
+
import styled24, { css as css16 } from "styled-components";
|
|
3875
|
+
var ToolbarDefaultStyles = css16`
|
|
3119
3876
|
margin: 0;
|
|
3120
3877
|
display: grid;
|
|
3121
3878
|
grid-template-rows: min-content;
|
|
@@ -3149,7 +3906,7 @@ var ToolbarDefaultStyles = css12`
|
|
|
3149
3906
|
}
|
|
3150
3907
|
}
|
|
3151
3908
|
`;
|
|
3152
|
-
var ToolbarSizeStyles =
|
|
3909
|
+
var ToolbarSizeStyles = css16`
|
|
3153
3910
|
&[data-size="small"] {
|
|
3154
3911
|
&[aria-orientation="vertical"] {
|
|
3155
3912
|
max-width: var(--measurement-large-70);
|
|
@@ -3195,7 +3952,7 @@ var ToolbarSizeStyles = css12`
|
|
|
3195
3952
|
}
|
|
3196
3953
|
}
|
|
3197
3954
|
`;
|
|
3198
|
-
var ToolbarSideStyles =
|
|
3955
|
+
var ToolbarSideStyles = css16`
|
|
3199
3956
|
&[data-side="top"] {
|
|
3200
3957
|
border-bottom-color: var(--font-color-alpha-10);
|
|
3201
3958
|
}
|
|
@@ -3227,7 +3984,7 @@ var ToolbarSideStyles = css12`
|
|
|
3227
3984
|
}
|
|
3228
3985
|
}
|
|
3229
3986
|
`;
|
|
3230
|
-
var ToolbarWrapper =
|
|
3987
|
+
var ToolbarWrapper = styled24.menu`
|
|
3231
3988
|
&[data-raw="false"] {
|
|
3232
3989
|
${ToolbarDefaultStyles}
|
|
3233
3990
|
${ToolbarSizeStyles}
|
|
@@ -3235,7 +3992,7 @@ var ToolbarWrapper = styled17.menu`
|
|
|
3235
3992
|
${ToolbarSideStyles}
|
|
3236
3993
|
}
|
|
3237
3994
|
`;
|
|
3238
|
-
var ToolbarTriggerWrapper =
|
|
3995
|
+
var ToolbarTriggerWrapper = styled24.menu`
|
|
3239
3996
|
&[data-raw="false"] {
|
|
3240
3997
|
all: unset;
|
|
3241
3998
|
align-self: flex-end;
|
|
@@ -3260,13 +4017,13 @@ var Toolbar = (props) => {
|
|
|
3260
4017
|
const { toggleToolbar } = methods;
|
|
3261
4018
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
3262
4019
|
const orientation = side && ["left", "right"].includes(side) ? "vertical" : "horizontal";
|
|
3263
|
-
|
|
4020
|
+
React40.useEffect(() => {
|
|
3264
4021
|
if (defaultOpen && toggleToolbar) return toggleToolbar(true);
|
|
3265
4022
|
}, [defaultOpen]);
|
|
3266
|
-
|
|
4023
|
+
React40.useEffect(() => {
|
|
3267
4024
|
if (shortcut && shortcutControls && toggleToolbar) toggleToolbar();
|
|
3268
4025
|
}, [shortcutControls]);
|
|
3269
|
-
return /* @__PURE__ */
|
|
4026
|
+
return /* @__PURE__ */ React40.createElement(
|
|
3270
4027
|
ToolbarWrapper,
|
|
3271
4028
|
{
|
|
3272
4029
|
id,
|
|
@@ -3286,7 +4043,7 @@ var Toolbar = (props) => {
|
|
|
3286
4043
|
};
|
|
3287
4044
|
Toolbar.displayName = "Toolbar";
|
|
3288
4045
|
var ToolbarRoot = ({ children }) => {
|
|
3289
|
-
return /* @__PURE__ */
|
|
4046
|
+
return /* @__PURE__ */ React40.createElement(ToolbarProvider, null, children);
|
|
3290
4047
|
};
|
|
3291
4048
|
ToolbarRoot.displayName = "Toolbar.Root";
|
|
3292
4049
|
var ToolbarTrigger = (props) => {
|
|
@@ -3304,7 +4061,7 @@ var ToolbarTrigger = (props) => {
|
|
|
3304
4061
|
if (onClick) onClick(event);
|
|
3305
4062
|
if (toggleToolbar) toggleToolbar(!states.expanded);
|
|
3306
4063
|
};
|
|
3307
|
-
return /* @__PURE__ */
|
|
4064
|
+
return /* @__PURE__ */ React40.createElement(ToolbarTriggerWrapper, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React40.createElement(
|
|
3308
4065
|
Button,
|
|
3309
4066
|
{
|
|
3310
4067
|
id: `${id}-trigger`,
|
|
@@ -3322,13 +4079,13 @@ var ToolbarSection = (props) => {
|
|
|
3322
4079
|
const { showoncollapse, children, ...restProps } = props;
|
|
3323
4080
|
const { states } = useToolbar();
|
|
3324
4081
|
const { expanded } = states;
|
|
3325
|
-
if (showoncollapse) return /* @__PURE__ */
|
|
3326
|
-
return /* @__PURE__ */
|
|
4082
|
+
if (showoncollapse) return /* @__PURE__ */ React40.createElement("section", { ...restProps }, children);
|
|
4083
|
+
return /* @__PURE__ */ React40.createElement("section", { ...restProps }, expanded && children);
|
|
3327
4084
|
};
|
|
3328
4085
|
ToolbarSection.displayName = "Toolbar.Section";
|
|
3329
4086
|
var ToolbarItem = (props) => {
|
|
3330
4087
|
const { showfirstchild, onClick, children, ...restProps } = props;
|
|
3331
|
-
const childArray =
|
|
4088
|
+
const childArray = React40.Children.toArray(children);
|
|
3332
4089
|
const { id, states, methods } = useToolbar();
|
|
3333
4090
|
const { expanded } = states;
|
|
3334
4091
|
const { toggleToolbar } = methods;
|
|
@@ -3337,7 +4094,7 @@ var ToolbarItem = (props) => {
|
|
|
3337
4094
|
if (onClick) onClick(event);
|
|
3338
4095
|
if (toggleToolbar && !expanded) toggleToolbar(true);
|
|
3339
4096
|
};
|
|
3340
|
-
return /* @__PURE__ */
|
|
4097
|
+
return /* @__PURE__ */ React40.createElement(
|
|
3341
4098
|
"div",
|
|
3342
4099
|
{
|
|
3343
4100
|
tabIndex: -1,
|
|
@@ -3358,11 +4115,11 @@ Toolbar.Item = ToolbarItem;
|
|
|
3358
4115
|
Toolbar.Section = ToolbarSection;
|
|
3359
4116
|
|
|
3360
4117
|
// src/tooltip/index.tsx
|
|
3361
|
-
import
|
|
4118
|
+
import React41 from "react";
|
|
3362
4119
|
|
|
3363
4120
|
// src/tooltip/styles/index.ts
|
|
3364
|
-
import
|
|
3365
|
-
var FadeIn2 =
|
|
4121
|
+
import styled25, { keyframes as keyframes4 } from "styled-components";
|
|
4122
|
+
var FadeIn2 = keyframes4`
|
|
3366
4123
|
0% {
|
|
3367
4124
|
opacity: 0;
|
|
3368
4125
|
}
|
|
@@ -3370,11 +4127,11 @@ var FadeIn2 = keyframes2`
|
|
|
3370
4127
|
opacity: 1;
|
|
3371
4128
|
}
|
|
3372
4129
|
`;
|
|
3373
|
-
var ContentBox =
|
|
4130
|
+
var ContentBox = styled25.div`
|
|
3374
4131
|
display: inline-block;
|
|
3375
4132
|
position: relative;
|
|
3376
4133
|
`;
|
|
3377
|
-
var ContentWrapper2 =
|
|
4134
|
+
var ContentWrapper2 = styled25.span`
|
|
3378
4135
|
&[data-raw="false"] {
|
|
3379
4136
|
width: fit-content;
|
|
3380
4137
|
max-width: var(--measurement-large-60);
|
|
@@ -3405,19 +4162,20 @@ var Tooltip = ({
|
|
|
3405
4162
|
children,
|
|
3406
4163
|
...restProps
|
|
3407
4164
|
}) => {
|
|
3408
|
-
const [visible, setVisible] =
|
|
3409
|
-
const [triggerProps, setTriggerProps] =
|
|
3410
|
-
const [contentProps, setContentProps] =
|
|
3411
|
-
const mounted =
|
|
3412
|
-
const containerRef =
|
|
3413
|
-
const contentRef =
|
|
3414
|
-
const timeoutRef =
|
|
4165
|
+
const [visible, setVisible] = React41.useState(false);
|
|
4166
|
+
const [triggerProps, setTriggerProps] = React41.useState(null);
|
|
4167
|
+
const [contentProps, setContentProps] = React41.useState(null);
|
|
4168
|
+
const mounted = React41.useRef(false);
|
|
4169
|
+
const containerRef = React41.useRef(null);
|
|
4170
|
+
const contentRef = React41.useRef(null);
|
|
4171
|
+
const timeoutRef = React41.useRef(null);
|
|
3415
4172
|
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
3416
|
-
const bodyRect =
|
|
4173
|
+
const bodyRect = () => {
|
|
3417
4174
|
if (typeof document !== "undefined") {
|
|
3418
|
-
return document
|
|
4175
|
+
return document?.body?.getBoundingClientRect();
|
|
3419
4176
|
}
|
|
3420
|
-
|
|
4177
|
+
return void 0;
|
|
4178
|
+
};
|
|
3421
4179
|
const positions = {
|
|
3422
4180
|
btt: `calc((${triggerProps?.top}px - ${contentProps?.height}px) - (var(--measurement-medium-10)))`,
|
|
3423
4181
|
ttb: `calc((${triggerProps?.top}px + ${triggerProps?.height}px) + var(--measurement-medium-10))`,
|
|
@@ -3434,14 +4192,14 @@ var Tooltip = ({
|
|
|
3434
4192
|
};
|
|
3435
4193
|
const hasEnoughHorizontalSpace = Number(dimensions.body_width) - Number(dimensions.content_left) > Number(dimensions.content_width) * 1.1;
|
|
3436
4194
|
const hasEnoughVerticalSpace = Number(dimensions.body_height) - Number(dimensions.content_bottom) > Number(dimensions.content_height) * 0.9;
|
|
3437
|
-
const showTooltip =
|
|
4195
|
+
const showTooltip = React41.useCallback(() => {
|
|
3438
4196
|
timeoutRef.current = setTimeout(() => setVisible(true), delay);
|
|
3439
4197
|
}, [delay]);
|
|
3440
|
-
const hideTooltip =
|
|
4198
|
+
const hideTooltip = React41.useCallback(() => {
|
|
3441
4199
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
3442
4200
|
setVisible(false);
|
|
3443
4201
|
}, []);
|
|
3444
|
-
const handleMouseEnter =
|
|
4202
|
+
const handleMouseEnter = React41.useCallback(() => {
|
|
3445
4203
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
3446
4204
|
if (rect) {
|
|
3447
4205
|
setTriggerProps({
|
|
@@ -3455,11 +4213,11 @@ var Tooltip = ({
|
|
|
3455
4213
|
showTooltip();
|
|
3456
4214
|
}
|
|
3457
4215
|
}, [showTooltip]);
|
|
3458
|
-
const handleMouseLeave =
|
|
4216
|
+
const handleMouseLeave = React41.useCallback(
|
|
3459
4217
|
() => hideTooltip(),
|
|
3460
4218
|
[hideTooltip]
|
|
3461
4219
|
);
|
|
3462
|
-
|
|
4220
|
+
React41.useEffect(() => {
|
|
3463
4221
|
mounted.current = true;
|
|
3464
4222
|
setContentProps && setContentProps({
|
|
3465
4223
|
top: Number(contentRect()?.top),
|
|
@@ -3473,7 +4231,7 @@ var Tooltip = ({
|
|
|
3473
4231
|
mounted.current = false;
|
|
3474
4232
|
};
|
|
3475
4233
|
}, [visible]);
|
|
3476
|
-
return /* @__PURE__ */
|
|
4234
|
+
return /* @__PURE__ */ React41.createElement(
|
|
3477
4235
|
ContentBox,
|
|
3478
4236
|
{
|
|
3479
4237
|
ref: containerRef,
|
|
@@ -3483,7 +4241,7 @@ var Tooltip = ({
|
|
|
3483
4241
|
...restProps
|
|
3484
4242
|
},
|
|
3485
4243
|
children,
|
|
3486
|
-
visible && /* @__PURE__ */
|
|
4244
|
+
visible && /* @__PURE__ */ React41.createElement(
|
|
3487
4245
|
ContentWrapper2,
|
|
3488
4246
|
{
|
|
3489
4247
|
ref: contentRef,
|
|
@@ -3498,7 +4256,7 @@ var Tooltip = ({
|
|
|
3498
4256
|
"data-side": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
|
|
3499
4257
|
"data-align": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */
|
|
3500
4258
|
},
|
|
3501
|
-
/* @__PURE__ */
|
|
4259
|
+
/* @__PURE__ */ React41.createElement("div", null, content)
|
|
3502
4260
|
)
|
|
3503
4261
|
);
|
|
3504
4262
|
};
|
|
@@ -3511,7 +4269,14 @@ export {
|
|
|
3511
4269
|
AvataStatusEnum,
|
|
3512
4270
|
Avatar,
|
|
3513
4271
|
Badge,
|
|
4272
|
+
Breadcrumb,
|
|
4273
|
+
BreadcrumbItem,
|
|
4274
|
+
BreadcrumbSeparator,
|
|
3514
4275
|
Button,
|
|
4276
|
+
Card,
|
|
4277
|
+
CardBody,
|
|
4278
|
+
CardGrid,
|
|
4279
|
+
CardMeta,
|
|
3515
4280
|
Checkbox,
|
|
3516
4281
|
CheckboxIndicator,
|
|
3517
4282
|
CheckboxRoot,
|
|
@@ -3519,6 +4284,7 @@ export {
|
|
|
3519
4284
|
CollapsibleContent,
|
|
3520
4285
|
CollapsibleRoot,
|
|
3521
4286
|
CollapsibleTrigger,
|
|
4287
|
+
CopyButton,
|
|
3522
4288
|
Dialog,
|
|
3523
4289
|
DialogControl,
|
|
3524
4290
|
DialogMenu,
|
|
@@ -3548,10 +4314,14 @@ export {
|
|
|
3548
4314
|
PageTools,
|
|
3549
4315
|
PageWrapper,
|
|
3550
4316
|
Portal,
|
|
4317
|
+
PrivacyField,
|
|
4318
|
+
Resizable,
|
|
3551
4319
|
ScrollArea,
|
|
3552
4320
|
Sheet,
|
|
3553
4321
|
SheetRoot,
|
|
3554
4322
|
SheetTrigger,
|
|
4323
|
+
Skeleton,
|
|
4324
|
+
Spinner,
|
|
3555
4325
|
Switch,
|
|
3556
4326
|
SwitchRoot,
|
|
3557
4327
|
SwitchThumb,
|
|
@@ -3566,6 +4336,7 @@ export {
|
|
|
3566
4336
|
TabsContent,
|
|
3567
4337
|
TabsRoot,
|
|
3568
4338
|
TabsTrigger,
|
|
4339
|
+
Textarea,
|
|
3569
4340
|
Toggle,
|
|
3570
4341
|
Toolbar,
|
|
3571
4342
|
ToolbarItem,
|