@usefui/components 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +230 -9
- package/dist/index.d.ts +230 -9
- package/dist/index.js +1131 -309
- package/dist/index.mjs +1085 -276
- 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 +37 -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 +27 -0
- package/src/text-area/index.tsx +62 -0
- package/src/text-area/styles/index.ts +124 -0
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,22 @@ 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;
|
|
1639
1975
|
|
|
1640
|
-
font-size: var(--fontsize-
|
|
1641
|
-
|
|
1976
|
+
font-size: var(--fontsize-medium-20);
|
|
1977
|
+
|
|
1642
1978
|
line-height: 1.1;
|
|
1643
1979
|
letter-spacing: calc(
|
|
1644
1980
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
1645
1981
|
);
|
|
1646
1982
|
|
|
1647
1983
|
border: var(--measurement-small-10) solid transparent;
|
|
1648
|
-
border-radius: var(--measurement-medium-30);
|
|
1649
1984
|
backdrop-filter: blur(var(--measurement-small-10));
|
|
1650
1985
|
color: var(--font-color-alpha-60);
|
|
1651
1986
|
width: fit-content;
|
|
@@ -1663,29 +1998,37 @@ var FieldDefaultStyles = css7`
|
|
|
1663
1998
|
&:focus,
|
|
1664
1999
|
&:active {
|
|
1665
2000
|
color: var(--font-color);
|
|
1666
|
-
|
|
1667
2001
|
svg,
|
|
1668
2002
|
span,
|
|
1669
2003
|
img {
|
|
1670
2004
|
opacity: 1;
|
|
1671
2005
|
}
|
|
1672
2006
|
}
|
|
2007
|
+
|
|
1673
2008
|
&::placeholder {
|
|
1674
2009
|
color: var(--font-color-alpha-30);
|
|
1675
2010
|
}
|
|
2011
|
+
|
|
1676
2012
|
&:disabled {
|
|
1677
2013
|
cursor: not-allowed;
|
|
1678
2014
|
opacity: 0.6;
|
|
1679
2015
|
}
|
|
1680
2016
|
`;
|
|
1681
|
-
var FieldVariantsStyles =
|
|
2017
|
+
var FieldVariantsStyles = css8`
|
|
1682
2018
|
&[data-variant="primary"] {
|
|
1683
2019
|
background-color: var(--font-color-alpha-10);
|
|
2020
|
+
border-color: var(--font-color-alpha-10);
|
|
2021
|
+
|
|
2022
|
+
&:focus,
|
|
2023
|
+
&:active {
|
|
2024
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
2025
|
+
}
|
|
1684
2026
|
|
|
1685
2027
|
&[data-error="true"] {
|
|
1686
2028
|
color: var(--color-red);
|
|
1687
2029
|
background-color: var(--alpha-red-10);
|
|
1688
2030
|
border-color: var(--alpha-red-10);
|
|
2031
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
1689
2032
|
}
|
|
1690
2033
|
}
|
|
1691
2034
|
|
|
@@ -1696,7 +2039,12 @@ var FieldVariantsStyles = css7`
|
|
|
1696
2039
|
&:hover,
|
|
1697
2040
|
&:focus,
|
|
1698
2041
|
&:active {
|
|
1699
|
-
|
|
2042
|
+
border-color: var(--font-color-alpha-20);
|
|
2043
|
+
}
|
|
2044
|
+
|
|
2045
|
+
&:focus,
|
|
2046
|
+
&:active {
|
|
2047
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--font-color-alpha-10);
|
|
1700
2048
|
}
|
|
1701
2049
|
|
|
1702
2050
|
&[data-error="true"] {
|
|
@@ -1707,6 +2055,7 @@ var FieldVariantsStyles = css7`
|
|
|
1707
2055
|
&:focus,
|
|
1708
2056
|
&:active {
|
|
1709
2057
|
background-color: var(--alpha-red-10);
|
|
2058
|
+
box-shadow: 0 0 0 var(--measurement-small-30) var(--alpha-red-10);
|
|
1710
2059
|
}
|
|
1711
2060
|
}
|
|
1712
2061
|
}
|
|
@@ -1730,39 +2079,51 @@ var FieldVariantsStyles = css7`
|
|
|
1730
2079
|
}
|
|
1731
2080
|
}
|
|
1732
2081
|
`;
|
|
1733
|
-
var FieldSizeStyles =
|
|
2082
|
+
var FieldSizeStyles = css8`
|
|
1734
2083
|
&[data-size="small"] {
|
|
1735
|
-
|
|
2084
|
+
font-size: var(--fontsize-small-60);
|
|
2085
|
+
|
|
1736
2086
|
padding: 0 var(--measurement-medium-30);
|
|
1737
2087
|
min-width: var(--measurement-medium-60);
|
|
1738
2088
|
min-height: var(--measurement-medium-80);
|
|
1739
2089
|
}
|
|
1740
2090
|
&[data-size="medium"] {
|
|
1741
|
-
gap: var(--measurement-medium-30);
|
|
1742
2091
|
padding: 0 var(--measurement-medium-30);
|
|
1743
2092
|
min-width: var(--measurement-medium-90);
|
|
1744
2093
|
min-height: var(--measurement-medium-90);
|
|
1745
2094
|
width: fit-content;
|
|
1746
2095
|
}
|
|
1747
2096
|
&[data-size="large"] {
|
|
1748
|
-
padding: var(--measurement-medium-
|
|
2097
|
+
padding: var(--measurement-medium-50);
|
|
1749
2098
|
min-width: var(--measurement-medium-90);
|
|
1750
2099
|
min-height: var(--measurement-medium-90);
|
|
1751
2100
|
}
|
|
1752
2101
|
`;
|
|
1753
|
-
var
|
|
2102
|
+
var FieldShapeStyles = css8`
|
|
2103
|
+
&[data-shape="square"] {
|
|
2104
|
+
border-radius: 0;
|
|
2105
|
+
}
|
|
2106
|
+
&[data-shape="smooth"] {
|
|
2107
|
+
border-radius: var(--measurement-medium-20);
|
|
2108
|
+
}
|
|
2109
|
+
&[data-shape="round"] {
|
|
2110
|
+
border-radius: var(--measurement-large-90);
|
|
2111
|
+
}
|
|
2112
|
+
`;
|
|
2113
|
+
var Fieldset = styled10.fieldset`
|
|
1754
2114
|
all: unset;
|
|
1755
2115
|
display: grid;
|
|
1756
2116
|
gap: var(--measurement-medium-10);
|
|
1757
2117
|
`;
|
|
1758
|
-
var Sup =
|
|
2118
|
+
var Sup = styled10.sup`
|
|
1759
2119
|
color: var(--color-red);
|
|
1760
2120
|
`;
|
|
1761
|
-
var Input =
|
|
2121
|
+
var Input = styled10.input`
|
|
1762
2122
|
&[data-raw="false"] {
|
|
1763
2123
|
${FieldDefaultStyles}
|
|
1764
2124
|
${FieldVariantsStyles}
|
|
1765
2125
|
${FieldSizeStyles}
|
|
2126
|
+
${FieldShapeStyles}
|
|
1766
2127
|
|
|
1767
2128
|
&[data-error="true"] {
|
|
1768
2129
|
&::placeholder {
|
|
@@ -1771,7 +2132,7 @@ var Input = styled8.input`
|
|
|
1771
2132
|
}
|
|
1772
2133
|
}
|
|
1773
2134
|
`;
|
|
1774
|
-
var Label =
|
|
2135
|
+
var Label = styled10.label`
|
|
1775
2136
|
&[data-raw="false"] {
|
|
1776
2137
|
font-weight: 500;
|
|
1777
2138
|
line-height: 1.1;
|
|
@@ -1780,7 +2141,7 @@ var Label = styled8.label`
|
|
|
1780
2141
|
);
|
|
1781
2142
|
}
|
|
1782
2143
|
`;
|
|
1783
|
-
var Def =
|
|
2144
|
+
var Def = styled10.dfn`
|
|
1784
2145
|
&[data-raw="false"] {
|
|
1785
2146
|
font-style: normal;
|
|
1786
2147
|
font-size: var(--fontsize-medium-10);
|
|
@@ -1807,13 +2168,14 @@ var Field = (props) => {
|
|
|
1807
2168
|
raw,
|
|
1808
2169
|
sizing = "medium" /* Medium */,
|
|
1809
2170
|
variant = "primary" /* Primary */,
|
|
2171
|
+
shape = "smooth",
|
|
1810
2172
|
error,
|
|
1811
2173
|
hint,
|
|
1812
2174
|
...restProps
|
|
1813
2175
|
} = props;
|
|
1814
|
-
const metaId =
|
|
2176
|
+
const metaId = React19.useId();
|
|
1815
2177
|
const { id } = useField();
|
|
1816
|
-
return /* @__PURE__ */
|
|
2178
|
+
return /* @__PURE__ */ React19.createElement(React19.Fragment, null, /* @__PURE__ */ React19.createElement(
|
|
1817
2179
|
Input,
|
|
1818
2180
|
{
|
|
1819
2181
|
id,
|
|
@@ -1823,10 +2185,11 @@ var Field = (props) => {
|
|
|
1823
2185
|
"data-error": Boolean(error),
|
|
1824
2186
|
"data-variant": variant,
|
|
1825
2187
|
"data-size": sizing,
|
|
2188
|
+
"data-shape": shape,
|
|
1826
2189
|
"data-raw": Boolean(raw),
|
|
1827
2190
|
...restProps
|
|
1828
2191
|
}
|
|
1829
|
-
), (error ?? hint) && /* @__PURE__ */
|
|
2192
|
+
), (error ?? hint) && /* @__PURE__ */ React19.createElement(
|
|
1830
2193
|
FieldMeta,
|
|
1831
2194
|
{
|
|
1832
2195
|
raw,
|
|
@@ -1837,20 +2200,20 @@ var Field = (props) => {
|
|
|
1837
2200
|
};
|
|
1838
2201
|
Field.displayName = "Field";
|
|
1839
2202
|
var FieldRoot = ({ children }) => {
|
|
1840
|
-
return /* @__PURE__ */
|
|
2203
|
+
return /* @__PURE__ */ React19.createElement(FieldProvider, null, children);
|
|
1841
2204
|
};
|
|
1842
2205
|
FieldRoot.displayName = "Field.Root";
|
|
1843
2206
|
var FieldWrapper = ({
|
|
1844
2207
|
children,
|
|
1845
2208
|
...restProps
|
|
1846
2209
|
}) => {
|
|
1847
|
-
return /* @__PURE__ */
|
|
2210
|
+
return /* @__PURE__ */ React19.createElement(Fieldset, { ...restProps }, children);
|
|
1848
2211
|
};
|
|
1849
2212
|
FieldWrapper.displayName = "Field.Wrapper";
|
|
1850
2213
|
var FieldLabel = (props) => {
|
|
1851
2214
|
const { raw, optional = false, children, ...restProps } = props;
|
|
1852
2215
|
const { id } = useField();
|
|
1853
|
-
return /* @__PURE__ */
|
|
2216
|
+
return /* @__PURE__ */ React19.createElement(Label, { htmlFor: id, "data-raw": Boolean(raw), ...restProps }, children, !optional && /* @__PURE__ */ React19.createElement(Sup, null, "*"));
|
|
1854
2217
|
};
|
|
1855
2218
|
FieldLabel.displayName = "Field.Label";
|
|
1856
2219
|
var FieldMeta = (props) => {
|
|
@@ -1860,9 +2223,9 @@ var FieldMeta = (props) => {
|
|
|
1860
2223
|
children,
|
|
1861
2224
|
...restProps
|
|
1862
2225
|
} = props;
|
|
1863
|
-
const metaId =
|
|
2226
|
+
const metaId = React19.useId();
|
|
1864
2227
|
const { id } = useField();
|
|
1865
|
-
return /* @__PURE__ */
|
|
2228
|
+
return /* @__PURE__ */ React19.createElement(
|
|
1866
2229
|
Def,
|
|
1867
2230
|
{
|
|
1868
2231
|
id: metaId,
|
|
@@ -1881,22 +2244,22 @@ Field.Label = FieldLabel;
|
|
|
1881
2244
|
Field.Meta = FieldMeta;
|
|
1882
2245
|
|
|
1883
2246
|
// src/otp-field/index.tsx
|
|
1884
|
-
import
|
|
2247
|
+
import React21 from "react";
|
|
1885
2248
|
|
|
1886
2249
|
// src/otp-field/hooks/index.tsx
|
|
1887
|
-
import
|
|
1888
|
-
var OTPFieldContext =
|
|
2250
|
+
import React20 from "react";
|
|
2251
|
+
var OTPFieldContext = React20.createContext(
|
|
1889
2252
|
null
|
|
1890
2253
|
);
|
|
1891
2254
|
var useOTPField = () => {
|
|
1892
|
-
const context =
|
|
2255
|
+
const context = React20.useContext(OTPFieldContext);
|
|
1893
2256
|
if (!context) return null;
|
|
1894
2257
|
return context;
|
|
1895
2258
|
};
|
|
1896
2259
|
|
|
1897
2260
|
// src/otp-field/styles/index.ts
|
|
1898
|
-
import
|
|
1899
|
-
var OTPCell =
|
|
2261
|
+
import styled11 from "styled-components";
|
|
2262
|
+
var OTPCell = styled11.input`
|
|
1900
2263
|
width: var(--measurement-medium-90);
|
|
1901
2264
|
height: var(--measurement-medium-90);
|
|
1902
2265
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
@@ -1931,11 +2294,11 @@ var OTPCell = styled9.input`
|
|
|
1931
2294
|
// src/otp-field/index.tsx
|
|
1932
2295
|
var OTPField = ({ children, length, onComplete }) => {
|
|
1933
2296
|
const defaultLength = length ?? 6;
|
|
1934
|
-
const inputRefs =
|
|
1935
|
-
const [otp, setOtp] =
|
|
2297
|
+
const inputRefs = React21.useRef([]);
|
|
2298
|
+
const [otp, setOtp] = React21.useState(
|
|
1936
2299
|
Array.from({ length: defaultLength }, () => "")
|
|
1937
2300
|
);
|
|
1938
|
-
const [activeIndex, setActiveIndex] =
|
|
2301
|
+
const [activeIndex, setActiveIndex] = React21.useState(0);
|
|
1939
2302
|
const handleChange = (index, value) => {
|
|
1940
2303
|
const newOtp = [...otp];
|
|
1941
2304
|
newOtp[index] = value.substring(value.length - 1);
|
|
@@ -1996,13 +2359,13 @@ var OTPField = ({ children, length, onComplete }) => {
|
|
|
1996
2359
|
);
|
|
1997
2360
|
return () => clearTimeout(timeout);
|
|
1998
2361
|
};
|
|
1999
|
-
|
|
2362
|
+
React21.useEffect(() => {
|
|
2000
2363
|
const otpString = otp.join("");
|
|
2001
2364
|
if (otpString.length === defaultLength && onComplete) {
|
|
2002
2365
|
onComplete(otpString);
|
|
2003
2366
|
}
|
|
2004
2367
|
}, [otp, defaultLength, onComplete]);
|
|
2005
|
-
const contextValue =
|
|
2368
|
+
const contextValue = React21.useMemo(() => {
|
|
2006
2369
|
return {
|
|
2007
2370
|
otp,
|
|
2008
2371
|
activeIndex,
|
|
@@ -2025,11 +2388,11 @@ var OTPField = ({ children, length, onComplete }) => {
|
|
|
2025
2388
|
handleClick,
|
|
2026
2389
|
handlePaste
|
|
2027
2390
|
]);
|
|
2028
|
-
return /* @__PURE__ */
|
|
2391
|
+
return /* @__PURE__ */ React21.createElement(OTPFieldContext.Provider, { value: contextValue }, children);
|
|
2029
2392
|
};
|
|
2030
2393
|
OTPField.displayName = "OTPField";
|
|
2031
|
-
var OTPFieldGroup =
|
|
2032
|
-
return /* @__PURE__ */
|
|
2394
|
+
var OTPFieldGroup = React21.forwardRef(({ ...props }, ref) => {
|
|
2395
|
+
return /* @__PURE__ */ React21.createElement("span", { ref, className: "flex g-medium-10 align-center", ...props });
|
|
2033
2396
|
});
|
|
2034
2397
|
OTPFieldGroup.displayName = "OTPField.Group";
|
|
2035
2398
|
var OTPFieldSlot = ({
|
|
@@ -2048,7 +2411,7 @@ var OTPFieldSlot = ({
|
|
|
2048
2411
|
handleClick,
|
|
2049
2412
|
handlePaste
|
|
2050
2413
|
} = context;
|
|
2051
|
-
return /* @__PURE__ */
|
|
2414
|
+
return /* @__PURE__ */ React21.createElement(
|
|
2052
2415
|
OTPCell,
|
|
2053
2416
|
{
|
|
2054
2417
|
ref: (el) => inputRefs.current[index] = el,
|
|
@@ -2074,11 +2437,11 @@ OTPField.Group = OTPFieldGroup;
|
|
|
2074
2437
|
OTPField.Slot = OTPFieldSlot;
|
|
2075
2438
|
|
|
2076
2439
|
// src/overlay/index.tsx
|
|
2077
|
-
import
|
|
2440
|
+
import React22 from "react";
|
|
2078
2441
|
|
|
2079
2442
|
// src/overlay/styles/index.ts
|
|
2080
|
-
import
|
|
2081
|
-
var OverlayWrapper =
|
|
2443
|
+
import styled12 from "styled-components";
|
|
2444
|
+
var OverlayWrapper = styled12.div`
|
|
2082
2445
|
@keyframes animate-fade {
|
|
2083
2446
|
0% {
|
|
2084
2447
|
opacity: 0;
|
|
@@ -2106,15 +2469,15 @@ var OverlayWrapper = styled10.div`
|
|
|
2106
2469
|
// src/overlay/index.tsx
|
|
2107
2470
|
var Overlay = (props) => {
|
|
2108
2471
|
const { raw, visible, closeOnInteract, onClick, ...restProps } = props;
|
|
2109
|
-
const [mounted, setMounted] =
|
|
2472
|
+
const [mounted, setMounted] = React22.useState(Boolean(visible));
|
|
2110
2473
|
const handleClick = (event) => {
|
|
2111
2474
|
if (onClick) onClick(event);
|
|
2112
2475
|
if (closeOnInteract) setMounted(false);
|
|
2113
2476
|
};
|
|
2114
|
-
|
|
2477
|
+
React22.useEffect(() => {
|
|
2115
2478
|
if (visible !== mounted) setMounted(Boolean(visible));
|
|
2116
2479
|
}, [visible]);
|
|
2117
|
-
return /* @__PURE__ */
|
|
2480
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, mounted && /* @__PURE__ */ React22.createElement(
|
|
2118
2481
|
OverlayWrapper,
|
|
2119
2482
|
{
|
|
2120
2483
|
tabIndex: -1,
|
|
@@ -2128,14 +2491,14 @@ var Overlay = (props) => {
|
|
|
2128
2491
|
Overlay.displayName = "Overlay";
|
|
2129
2492
|
|
|
2130
2493
|
// src/page/index.tsx
|
|
2131
|
-
import
|
|
2494
|
+
import React23 from "react";
|
|
2132
2495
|
|
|
2133
2496
|
// src/page/styles/index.ts
|
|
2134
|
-
import
|
|
2497
|
+
import styled14 from "styled-components";
|
|
2135
2498
|
|
|
2136
2499
|
// src/scrollarea/styles/index.ts
|
|
2137
|
-
import
|
|
2138
|
-
var HiddenScrollbar =
|
|
2500
|
+
import styled13, { css as css9 } from "styled-components";
|
|
2501
|
+
var HiddenScrollbar = css9`
|
|
2139
2502
|
scrollbar-width: none;
|
|
2140
2503
|
|
|
2141
2504
|
&::-webkit-scrollbar {
|
|
@@ -2147,7 +2510,7 @@ var HiddenScrollbar = css8`
|
|
|
2147
2510
|
display: none;
|
|
2148
2511
|
}
|
|
2149
2512
|
`;
|
|
2150
|
-
var CustomScrollbar =
|
|
2513
|
+
var CustomScrollbar = css9`
|
|
2151
2514
|
height: ${({ $height }) => $height || "100%"};
|
|
2152
2515
|
width: ${({ $width }) => $width || "100%"};
|
|
2153
2516
|
overflow-y: auto;
|
|
@@ -2179,7 +2542,7 @@ var CustomScrollbar = css8`
|
|
|
2179
2542
|
scrollbar-width: thin;
|
|
2180
2543
|
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor || "var(--font-color-alpha-10)"} ${$trackColor || "transparent"}`};
|
|
2181
2544
|
`;
|
|
2182
|
-
var ScrollAreaWrapper =
|
|
2545
|
+
var ScrollAreaWrapper = styled13.div`
|
|
2183
2546
|
overflow: scroll;
|
|
2184
2547
|
|
|
2185
2548
|
&[data-scrollbar="true"] {
|
|
@@ -2191,11 +2554,11 @@ var ScrollAreaWrapper = styled11.div`
|
|
|
2191
2554
|
`;
|
|
2192
2555
|
|
|
2193
2556
|
// src/page/styles/index.ts
|
|
2194
|
-
var PageRootWrapper =
|
|
2557
|
+
var PageRootWrapper = styled14.div`
|
|
2195
2558
|
height: 100dvh;
|
|
2196
2559
|
width: 100%;
|
|
2197
2560
|
`;
|
|
2198
|
-
var PageNavWrapper =
|
|
2561
|
+
var PageNavWrapper = styled14.nav`
|
|
2199
2562
|
background-color: var(--body-color);
|
|
2200
2563
|
border: var(--measurement-small-10) solid transparent;
|
|
2201
2564
|
border-bottom-color: var(--font-color-alpha-10);
|
|
@@ -2204,7 +2567,7 @@ var PageNavWrapper = styled12.nav`
|
|
|
2204
2567
|
max-height: var(--measurement-large-20);
|
|
2205
2568
|
padding: var(--measurement-medium-30);
|
|
2206
2569
|
`;
|
|
2207
|
-
var PageMenuWrapper =
|
|
2570
|
+
var PageMenuWrapper = styled14.menu`
|
|
2208
2571
|
background-color: var(--body-color);
|
|
2209
2572
|
border: var(--measurement-small-10) solid transparent;
|
|
2210
2573
|
border-bottom-color: var(--font-color-alpha-10);
|
|
@@ -2214,19 +2577,19 @@ var PageMenuWrapper = styled12.menu`
|
|
|
2214
2577
|
margin: 0;
|
|
2215
2578
|
padding: var(--measurement-medium-60) var(--measurement-medium-30);
|
|
2216
2579
|
`;
|
|
2217
|
-
var PagePanelWrapper =
|
|
2580
|
+
var PagePanelWrapper = styled14.aside`
|
|
2218
2581
|
position: absolute;
|
|
2219
2582
|
bottom: 0;
|
|
2220
2583
|
width: 100%;
|
|
2221
2584
|
overflow: scroll;
|
|
2222
2585
|
${HiddenScrollbar}
|
|
2223
2586
|
`;
|
|
2224
|
-
var PageSectionWrapper =
|
|
2587
|
+
var PageSectionWrapper = styled14.div`
|
|
2225
2588
|
background: var(--body-color);
|
|
2226
2589
|
width: 100%;
|
|
2227
2590
|
height: 100%;
|
|
2228
2591
|
`;
|
|
2229
|
-
var PageBodyWrapper =
|
|
2592
|
+
var PageBodyWrapper = styled14.div`
|
|
2230
2593
|
--menus-height: calc(
|
|
2231
2594
|
var(--measurement-large-30) *
|
|
2232
2595
|
${({ $menus }) => $menus ? Number($menus) : 0}
|
|
@@ -2251,12 +2614,12 @@ var PageBodyWrapper = styled12.div`
|
|
|
2251
2614
|
// src/page/index.tsx
|
|
2252
2615
|
var Page = (props) => {
|
|
2253
2616
|
const { children } = props;
|
|
2254
|
-
return /* @__PURE__ */
|
|
2617
|
+
return /* @__PURE__ */ React23.createElement(PageRootWrapper, { className: "flex", ...props }, children);
|
|
2255
2618
|
};
|
|
2256
2619
|
Page.displayName = "Page";
|
|
2257
2620
|
var PageNavigation = (props) => {
|
|
2258
2621
|
const { children } = props;
|
|
2259
|
-
return /* @__PURE__ */
|
|
2622
|
+
return /* @__PURE__ */ React23.createElement(PageNavWrapper, { ...props }, children);
|
|
2260
2623
|
};
|
|
2261
2624
|
PageNavigation.displayName = "Page.Navigation";
|
|
2262
2625
|
var PageTools = (props) => {
|
|
@@ -2278,7 +2641,7 @@ var PageTools = (props) => {
|
|
|
2278
2641
|
const handleClick = (event) => {
|
|
2279
2642
|
if (onClick) onClick(event);
|
|
2280
2643
|
};
|
|
2281
|
-
return /* @__PURE__ */
|
|
2644
|
+
return /* @__PURE__ */ React23.createElement(Toolbar.Root, null, /* @__PURE__ */ React23.createElement(
|
|
2282
2645
|
Toolbar,
|
|
2283
2646
|
{
|
|
2284
2647
|
raw,
|
|
@@ -2290,27 +2653,27 @@ var PageTools = (props) => {
|
|
|
2290
2653
|
defaultOpen,
|
|
2291
2654
|
...props
|
|
2292
2655
|
},
|
|
2293
|
-
/* @__PURE__ */
|
|
2294
|
-
!fixed && /* @__PURE__ */
|
|
2656
|
+
/* @__PURE__ */ React23.createElement(Toolbar.Section, { showoncollapse }, children),
|
|
2657
|
+
!fixed && /* @__PURE__ */ React23.createElement(
|
|
2295
2658
|
Toolbar.Trigger,
|
|
2296
2659
|
{
|
|
2297
2660
|
title: shortcut ? `${bindkey ?? "ctrl"} + ${hotkey}` : "toolbar-trigger",
|
|
2298
2661
|
onClick: handleClick,
|
|
2299
2662
|
...triggerProps
|
|
2300
2663
|
},
|
|
2301
|
-
trigger ?? /* @__PURE__ */
|
|
2664
|
+
trigger ?? /* @__PURE__ */ React23.createElement("span", null, "\u2194")
|
|
2302
2665
|
)
|
|
2303
2666
|
));
|
|
2304
2667
|
};
|
|
2305
2668
|
PageTools.displayName = "Page.Tools";
|
|
2306
2669
|
var PageContent = (props) => {
|
|
2307
2670
|
const { children } = props;
|
|
2308
|
-
return /* @__PURE__ */
|
|
2671
|
+
return /* @__PURE__ */ React23.createElement(ScrollArea, { as: PageSectionWrapper, ...props }, children);
|
|
2309
2672
|
};
|
|
2310
2673
|
PageContent.displayName = "Page.Content";
|
|
2311
2674
|
var PageWrapper = (props) => {
|
|
2312
2675
|
const { children } = props;
|
|
2313
|
-
return /* @__PURE__ */
|
|
2676
|
+
return /* @__PURE__ */ React23.createElement(PageBodyWrapper, { ...props }, children);
|
|
2314
2677
|
};
|
|
2315
2678
|
PageWrapper.displayName = "Page.Wrapper";
|
|
2316
2679
|
var PagePanel = (props) => {
|
|
@@ -2333,7 +2696,7 @@ var PagePanel = (props) => {
|
|
|
2333
2696
|
const handleClick = (event) => {
|
|
2334
2697
|
if (onClick) onClick(event);
|
|
2335
2698
|
};
|
|
2336
|
-
return /* @__PURE__ */
|
|
2699
|
+
return /* @__PURE__ */ React23.createElement(Toolbar.Root, null, /* @__PURE__ */ React23.createElement(
|
|
2337
2700
|
PagePanelWrapper,
|
|
2338
2701
|
{
|
|
2339
2702
|
as: Toolbar,
|
|
@@ -2347,22 +2710,22 @@ var PagePanel = (props) => {
|
|
|
2347
2710
|
defaultOpen,
|
|
2348
2711
|
"aria-label": props["aria-label"]
|
|
2349
2712
|
},
|
|
2350
|
-
!fixed && /* @__PURE__ */
|
|
2713
|
+
!fixed && /* @__PURE__ */ React23.createElement(
|
|
2351
2714
|
Toolbar.Trigger,
|
|
2352
2715
|
{
|
|
2353
2716
|
title: shortcut ? `${bindkey ?? "ctrl"} + ${hotkey}` : "toolbar-trigger",
|
|
2354
2717
|
onClick: handleClick,
|
|
2355
2718
|
...triggerProps
|
|
2356
2719
|
},
|
|
2357
|
-
trigger ?? /* @__PURE__ */
|
|
2720
|
+
trigger ?? /* @__PURE__ */ React23.createElement("span", { style: { transform: "rotate(90deg)" } }, "\u2194")
|
|
2358
2721
|
),
|
|
2359
|
-
/* @__PURE__ */
|
|
2722
|
+
/* @__PURE__ */ React23.createElement(Toolbar.Section, { showoncollapse }, children)
|
|
2360
2723
|
));
|
|
2361
2724
|
};
|
|
2362
2725
|
PagePanel.displayName = "Page.Panel";
|
|
2363
2726
|
var PageMenu = (props) => {
|
|
2364
2727
|
const { children } = props;
|
|
2365
|
-
return /* @__PURE__ */
|
|
2728
|
+
return /* @__PURE__ */ React23.createElement(PageMenuWrapper, { ...props }, children);
|
|
2366
2729
|
};
|
|
2367
2730
|
PageMenu.displayName = "Page.Menu";
|
|
2368
2731
|
Page.Navigation = PageNavigation;
|
|
@@ -2373,14 +2736,14 @@ Page.Panel = PagePanel;
|
|
|
2373
2736
|
Page.Menu = PageMenu;
|
|
2374
2737
|
|
|
2375
2738
|
// src/portal/index.tsx
|
|
2376
|
-
import
|
|
2739
|
+
import React24 from "react";
|
|
2377
2740
|
import { createPortal } from "react-dom";
|
|
2378
2741
|
var Portal = (props) => {
|
|
2379
2742
|
if (typeof document === "undefined") return null;
|
|
2380
2743
|
const { container, children } = props;
|
|
2381
|
-
const [hasMounted, setHasMounted] =
|
|
2382
|
-
const [portalRoot, setPortalRoot] =
|
|
2383
|
-
|
|
2744
|
+
const [hasMounted, setHasMounted] = React24.useState(false);
|
|
2745
|
+
const [portalRoot, setPortalRoot] = React24.useState(null);
|
|
2746
|
+
React24.useEffect(() => {
|
|
2384
2747
|
setHasMounted(true);
|
|
2385
2748
|
setPortalRoot(document.querySelector(`#${container}`));
|
|
2386
2749
|
}, [container]);
|
|
@@ -2389,26 +2752,188 @@ var Portal = (props) => {
|
|
|
2389
2752
|
};
|
|
2390
2753
|
Portal.displayName = "Portal";
|
|
2391
2754
|
|
|
2755
|
+
// src/privacy-field/index.tsx
|
|
2756
|
+
import React25 from "react";
|
|
2757
|
+
|
|
2758
|
+
// src/privacy-field/styles/index.ts
|
|
2759
|
+
import styled15 from "styled-components";
|
|
2760
|
+
var Wrapper = styled15(Field.Wrapper)`
|
|
2761
|
+
position: relative;
|
|
2762
|
+
|
|
2763
|
+
input {
|
|
2764
|
+
width: 100% !important;
|
|
2765
|
+
}
|
|
2766
|
+
`;
|
|
2767
|
+
var Trigger = styled15(Button)`
|
|
2768
|
+
position: absolute !important;
|
|
2769
|
+
right: var(--measurement-medium-50);
|
|
2770
|
+
top: calc(var(--measurement-medium-50));
|
|
2771
|
+
`;
|
|
2772
|
+
|
|
2773
|
+
// src/privacy-field/index.tsx
|
|
2774
|
+
var PrivacyField = ({
|
|
2775
|
+
defaultType,
|
|
2776
|
+
textIcon,
|
|
2777
|
+
passwordIcon,
|
|
2778
|
+
...restProps
|
|
2779
|
+
}) => {
|
|
2780
|
+
const [type, setType] = React25.useState(
|
|
2781
|
+
defaultType ?? "password"
|
|
2782
|
+
);
|
|
2783
|
+
const handleChangeType = React25.useCallback(() => {
|
|
2784
|
+
if (type === "text") setType("password");
|
|
2785
|
+
if (type === "password") setType("text");
|
|
2786
|
+
}, [type, setType]);
|
|
2787
|
+
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));
|
|
2788
|
+
};
|
|
2789
|
+
PrivacyField.displayName = "PrivacyField";
|
|
2790
|
+
|
|
2791
|
+
// src/resizable/index.tsx
|
|
2792
|
+
import React26 from "react";
|
|
2793
|
+
|
|
2794
|
+
// src/resizable/styles/index.ts
|
|
2795
|
+
import styled16 from "styled-components";
|
|
2796
|
+
var SplitContainer = styled16.div`
|
|
2797
|
+
position: relative;
|
|
2798
|
+
`;
|
|
2799
|
+
var Panel = styled16.div`
|
|
2800
|
+
overflow: hidden;
|
|
2801
|
+
width: ${(props) => props.width}%;
|
|
2802
|
+
`;
|
|
2803
|
+
var Divider2 = styled16.div`
|
|
2804
|
+
width: var(--measurement-medium-10);
|
|
2805
|
+
height: 100%;
|
|
2806
|
+
top: 0;
|
|
2807
|
+
|
|
2808
|
+
border-radius: var(--measurement-medium-60);
|
|
2809
|
+
background-color: transparent;
|
|
2810
|
+
|
|
2811
|
+
/* background-color: ${(props) => props.$dragging ? "var(--font-color-alpha-10)" : "transparent"}; */
|
|
2812
|
+
|
|
2813
|
+
cursor: col-resize;
|
|
2814
|
+
transition: background-color 0.2s;
|
|
2815
|
+
position: relative;
|
|
2816
|
+
|
|
2817
|
+
/** Shows DragIndicator on hover */
|
|
2818
|
+
&:hover .drag-indicator-handle,
|
|
2819
|
+
&:active .drag-indicator-handle {
|
|
2820
|
+
opacity: 1;
|
|
2821
|
+
}
|
|
2822
|
+
|
|
2823
|
+
.drag-indicator-handle {
|
|
2824
|
+
height: ${(props) => props.$dragging ? "var(--measurement-large-10)" : "var(--measurement-medium-60)"};
|
|
2825
|
+
}
|
|
2826
|
+
`;
|
|
2827
|
+
var DragHandle = styled16.div`
|
|
2828
|
+
position: absolute;
|
|
2829
|
+
top: 0;
|
|
2830
|
+
bottom: 0;
|
|
2831
|
+
left: calc(var(--measurement-medium-10) * -1);
|
|
2832
|
+
right: calc(var(--measurement-medium-10) * -1);
|
|
2833
|
+
`;
|
|
2834
|
+
var DragIndicator = styled16.div`
|
|
2835
|
+
position: fixed;
|
|
2836
|
+
width: var(--measurement-medium-10);
|
|
2837
|
+
/* height: var(--measurement-medium-60); */
|
|
2838
|
+
background-color: var(--font-color-alpha-60);
|
|
2839
|
+
border-radius: var(--measurement-large-10);
|
|
2840
|
+
|
|
2841
|
+
opacity: 0;
|
|
2842
|
+
transition: all 0.2s;
|
|
2843
|
+
`;
|
|
2844
|
+
var DragOverlay = styled16.div`
|
|
2845
|
+
position: fixed;
|
|
2846
|
+
top: 0;
|
|
2847
|
+
left: 0;
|
|
2848
|
+
right: 0;
|
|
2849
|
+
bottom: 0;
|
|
2850
|
+
z-index: var(--depth-default-90);
|
|
2851
|
+
cursor: col-resize;
|
|
2852
|
+
`;
|
|
2853
|
+
|
|
2854
|
+
// src/resizable/index.tsx
|
|
2855
|
+
var Resizable = ({
|
|
2856
|
+
defaultWidth,
|
|
2857
|
+
left,
|
|
2858
|
+
right
|
|
2859
|
+
}) => {
|
|
2860
|
+
const containerRef = React26.useRef(null);
|
|
2861
|
+
const [leftWidth, setLeftWidth] = React26.useState(defaultWidth ?? 50);
|
|
2862
|
+
const [isDragging, setIsDragging] = React26.useState(false);
|
|
2863
|
+
const handleMouseDown = React26.useCallback(() => setIsDragging(true), []);
|
|
2864
|
+
const handleMouseUp = React26.useCallback(() => setIsDragging(false), []);
|
|
2865
|
+
const handleMouseMove = React26.useCallback(
|
|
2866
|
+
(e) => {
|
|
2867
|
+
if (!isDragging || !containerRef.current) return;
|
|
2868
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
2869
|
+
const newLeftWidth = (e.clientX - containerRect.left) / containerRect.width * 100;
|
|
2870
|
+
const threshold = { min: 30, max: 70 };
|
|
2871
|
+
const constrainedWidth = Math.min(
|
|
2872
|
+
Math.max(newLeftWidth, threshold.min),
|
|
2873
|
+
threshold.max
|
|
2874
|
+
);
|
|
2875
|
+
setLeftWidth(constrainedWidth);
|
|
2876
|
+
},
|
|
2877
|
+
[isDragging]
|
|
2878
|
+
);
|
|
2879
|
+
React26.useEffect(() => {
|
|
2880
|
+
if (isDragging) {
|
|
2881
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
2882
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
2883
|
+
document.body.style.cursor = "col-resize";
|
|
2884
|
+
document.body.style.userSelect = "none";
|
|
2885
|
+
} else {
|
|
2886
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
2887
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
2888
|
+
document.body.style.cursor = "";
|
|
2889
|
+
document.body.style.userSelect = "";
|
|
2890
|
+
}
|
|
2891
|
+
return () => {
|
|
2892
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
2893
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
2894
|
+
document.body.style.cursor = "";
|
|
2895
|
+
document.body.style.userSelect = "";
|
|
2896
|
+
};
|
|
2897
|
+
}, [isDragging, handleMouseMove, handleMouseUp]);
|
|
2898
|
+
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(
|
|
2899
|
+
Divider2,
|
|
2900
|
+
{
|
|
2901
|
+
$dragging: isDragging,
|
|
2902
|
+
onMouseDown: handleMouseDown,
|
|
2903
|
+
onTouchStart: handleMouseDown
|
|
2904
|
+
},
|
|
2905
|
+
/* @__PURE__ */ React26.createElement(
|
|
2906
|
+
DragHandle,
|
|
2907
|
+
{
|
|
2908
|
+
className: "flex align-center justify-center",
|
|
2909
|
+
id: "drag-handle"
|
|
2910
|
+
},
|
|
2911
|
+
/* @__PURE__ */ React26.createElement(DragIndicator, { className: "drag-indicator-handle" })
|
|
2912
|
+
)
|
|
2913
|
+
), /* @__PURE__ */ React26.createElement(Panel, { width: 100 - leftWidth }, right)), isDragging && /* @__PURE__ */ React26.createElement(DragOverlay, null));
|
|
2914
|
+
};
|
|
2915
|
+
Resizable.displayName = "Resizable";
|
|
2916
|
+
|
|
2392
2917
|
// src/sheet/index.tsx
|
|
2393
|
-
import
|
|
2918
|
+
import React28 from "react";
|
|
2394
2919
|
|
|
2395
2920
|
// src/sheet/hooks/index.tsx
|
|
2396
|
-
import
|
|
2397
|
-
var SheetContext =
|
|
2921
|
+
import React27 from "react";
|
|
2922
|
+
var SheetContext = React27.createContext({
|
|
2398
2923
|
id: {},
|
|
2399
2924
|
states: {},
|
|
2400
2925
|
methods: {}
|
|
2401
2926
|
});
|
|
2402
|
-
var useSheet = () =>
|
|
2927
|
+
var useSheet = () => React27.useContext(SheetContext);
|
|
2403
2928
|
var SheetProvider = ({ children }) => {
|
|
2404
2929
|
const context = useSheetProvider();
|
|
2405
|
-
return /* @__PURE__ */
|
|
2930
|
+
return /* @__PURE__ */ React27.createElement(SheetContext.Provider, { value: context }, children);
|
|
2406
2931
|
};
|
|
2407
2932
|
function useSheetProvider() {
|
|
2408
|
-
const containerId =
|
|
2409
|
-
const triggerId =
|
|
2410
|
-
const controlId =
|
|
2411
|
-
const [open, setOpen] =
|
|
2933
|
+
const containerId = React27.useId();
|
|
2934
|
+
const triggerId = React27.useId();
|
|
2935
|
+
const controlId = React27.useId();
|
|
2936
|
+
const [open, setOpen] = React27.useState(false);
|
|
2412
2937
|
return {
|
|
2413
2938
|
id: {
|
|
2414
2939
|
containerId,
|
|
@@ -2426,8 +2951,8 @@ function useSheetProvider() {
|
|
|
2426
2951
|
}
|
|
2427
2952
|
|
|
2428
2953
|
// src/sheet/styles/index.ts
|
|
2429
|
-
import
|
|
2430
|
-
var SheetStyles =
|
|
2954
|
+
import styled17, { css as css10 } from "styled-components";
|
|
2955
|
+
var SheetStyles = css10`
|
|
2431
2956
|
all: unset;
|
|
2432
2957
|
position: fixed;
|
|
2433
2958
|
background-color: var(--body-color);
|
|
@@ -2458,7 +2983,7 @@ var SheetStyles = css9`
|
|
|
2458
2983
|
animation-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
|
|
2459
2984
|
animation-fill-mode: backwards;
|
|
2460
2985
|
`;
|
|
2461
|
-
var SheetSizeStyles =
|
|
2986
|
+
var SheetSizeStyles = css10`
|
|
2462
2987
|
&[data-size="small"] {
|
|
2463
2988
|
width: var(--measurement-large-80);
|
|
2464
2989
|
}
|
|
@@ -2471,7 +2996,7 @@ var SheetSizeStyles = css9`
|
|
|
2471
2996
|
width: calc(var(--measurement-large-90) * 1.5);
|
|
2472
2997
|
}
|
|
2473
2998
|
`;
|
|
2474
|
-
var SheetSideStyles =
|
|
2999
|
+
var SheetSideStyles = css10`
|
|
2475
3000
|
top: 0;
|
|
2476
3001
|
|
|
2477
3002
|
&[data-side="right"] {
|
|
@@ -2486,7 +3011,7 @@ var SheetSideStyles = css9`
|
|
|
2486
3011
|
animation-name: slide-left;
|
|
2487
3012
|
}
|
|
2488
3013
|
`;
|
|
2489
|
-
var SheetWrapper =
|
|
3014
|
+
var SheetWrapper = styled17.dialog`
|
|
2490
3015
|
&[data-raw="false"] {
|
|
2491
3016
|
${SheetStyles}
|
|
2492
3017
|
${SheetSideStyles}
|
|
@@ -2496,7 +3021,7 @@ var SheetWrapper = styled13.dialog`
|
|
|
2496
3021
|
|
|
2497
3022
|
// src/sheet/index.tsx
|
|
2498
3023
|
var SheetRoot = ({ children }) => {
|
|
2499
|
-
return /* @__PURE__ */
|
|
3024
|
+
return /* @__PURE__ */ React28.createElement(SheetProvider, null, children);
|
|
2500
3025
|
};
|
|
2501
3026
|
SheetRoot.displayName = "Sheet.Root";
|
|
2502
3027
|
var Sheet = (props) => {
|
|
@@ -2517,16 +3042,16 @@ var Sheet = (props) => {
|
|
|
2517
3042
|
const { id, states, methods } = useSheet();
|
|
2518
3043
|
const { toggle } = methods;
|
|
2519
3044
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
2520
|
-
|
|
3045
|
+
React28.useEffect(() => {
|
|
2521
3046
|
if (open && toggle) return toggle();
|
|
2522
3047
|
}, [open]);
|
|
2523
|
-
|
|
3048
|
+
React28.useEffect(() => {
|
|
2524
3049
|
if (shortcut && shortcutControls && toggle) {
|
|
2525
3050
|
return toggle();
|
|
2526
3051
|
}
|
|
2527
3052
|
}, [shortcutControls]);
|
|
2528
3053
|
useDisabledScroll(lock && Boolean(states.open));
|
|
2529
|
-
return /* @__PURE__ */
|
|
3054
|
+
return /* @__PURE__ */ React28.createElement(React28.Fragment, null, states.open && /* @__PURE__ */ React28.createElement(React28.Fragment, null, /* @__PURE__ */ React28.createElement(
|
|
2530
3055
|
SheetWrapper,
|
|
2531
3056
|
{
|
|
2532
3057
|
role: "dialog",
|
|
@@ -2543,7 +3068,7 @@ var Sheet = (props) => {
|
|
|
2543
3068
|
...restProps
|
|
2544
3069
|
},
|
|
2545
3070
|
children
|
|
2546
|
-
), overlay && /* @__PURE__ */
|
|
3071
|
+
), overlay && /* @__PURE__ */ React28.createElement(
|
|
2547
3072
|
Overlay,
|
|
2548
3073
|
{
|
|
2549
3074
|
onClick: () => toggle && toggle(!states.open),
|
|
@@ -2569,7 +3094,7 @@ var SheetTrigger = (props) => {
|
|
|
2569
3094
|
if (onClick) onClick(event);
|
|
2570
3095
|
if (toggle) toggle(!states.open);
|
|
2571
3096
|
};
|
|
2572
|
-
return /* @__PURE__ */
|
|
3097
|
+
return /* @__PURE__ */ React28.createElement(
|
|
2573
3098
|
Button,
|
|
2574
3099
|
{
|
|
2575
3100
|
id: id.triggerId,
|
|
@@ -2589,13 +3114,13 @@ Sheet.Root = SheetRoot;
|
|
|
2589
3114
|
Sheet.Trigger = SheetTrigger;
|
|
2590
3115
|
|
|
2591
3116
|
// src/scrollarea/index.tsx
|
|
2592
|
-
import
|
|
3117
|
+
import React29 from "react";
|
|
2593
3118
|
var ScrollArea = ({
|
|
2594
3119
|
scrollbar = false,
|
|
2595
3120
|
children,
|
|
2596
3121
|
...restProps
|
|
2597
3122
|
}) => {
|
|
2598
|
-
return /* @__PURE__ */
|
|
3123
|
+
return /* @__PURE__ */ React29.createElement(
|
|
2599
3124
|
ScrollAreaWrapper,
|
|
2600
3125
|
{
|
|
2601
3126
|
"aria-hidden": "true",
|
|
@@ -2606,11 +3131,134 @@ var ScrollArea = ({
|
|
|
2606
3131
|
);
|
|
2607
3132
|
};
|
|
2608
3133
|
|
|
3134
|
+
// src/spinner/index.tsx
|
|
3135
|
+
import React30 from "react";
|
|
3136
|
+
|
|
3137
|
+
// src/spinner/styles/index.ts
|
|
3138
|
+
import styled18, { css as css11, keyframes as keyframes2 } from "styled-components";
|
|
3139
|
+
var Rotate = keyframes2`
|
|
3140
|
+
0% {
|
|
3141
|
+
transform: rotate(0deg);
|
|
3142
|
+
}
|
|
3143
|
+
100% {
|
|
3144
|
+
transform: rotate(360deg);
|
|
3145
|
+
}
|
|
3146
|
+
`;
|
|
3147
|
+
var FieldSizeStyles2 = css11`
|
|
3148
|
+
&[data-size="small"] {
|
|
3149
|
+
width: var(--measurement-medium-40);
|
|
3150
|
+
height: var(--measurement-medium-40);
|
|
3151
|
+
}
|
|
3152
|
+
&[data-size="medium"] {
|
|
3153
|
+
width: var(--measurement-medium-50);
|
|
3154
|
+
height: var(--measurement-medium-50);
|
|
3155
|
+
}
|
|
3156
|
+
&[data-size="large"] {
|
|
3157
|
+
width: var(--measurement-medium-60);
|
|
3158
|
+
height: var(--measurement-medium-60);
|
|
3159
|
+
}
|
|
3160
|
+
`;
|
|
3161
|
+
var RotatingSpinner = styled18.span`
|
|
3162
|
+
padding: 0;
|
|
3163
|
+
margin: 0;
|
|
3164
|
+
|
|
3165
|
+
display: inline-block;
|
|
3166
|
+
box-sizing: border-box;
|
|
3167
|
+
|
|
3168
|
+
border: var(--measurement-small-60) solid var(--font-color-alpha-30);
|
|
3169
|
+
border-bottom-color: transparent;
|
|
3170
|
+
border-radius: var(--measurement-large-90);
|
|
3171
|
+
|
|
3172
|
+
animation: ${Rotate} 1s linear infinite;
|
|
3173
|
+
|
|
3174
|
+
${FieldSizeStyles2}
|
|
3175
|
+
`;
|
|
3176
|
+
|
|
3177
|
+
// src/spinner/index.tsx
|
|
3178
|
+
var Spinner = (props) => {
|
|
3179
|
+
return /* @__PURE__ */ React30.createElement(RotatingSpinner, { "data-size": props.sizing ?? "medium" });
|
|
3180
|
+
};
|
|
3181
|
+
|
|
3182
|
+
// src/skeleton/index.tsx
|
|
3183
|
+
import React31 from "react";
|
|
3184
|
+
|
|
3185
|
+
// src/skeleton/styles/index.ts
|
|
3186
|
+
import styled19, { css as css12, keyframes as keyframes3 } from "styled-components";
|
|
3187
|
+
var SkeletonBlink = keyframes3`
|
|
3188
|
+
0% {
|
|
3189
|
+
opacity: 0.3;
|
|
3190
|
+
}
|
|
3191
|
+
100% {
|
|
3192
|
+
opacity: 0.1;
|
|
3193
|
+
}
|
|
3194
|
+
`;
|
|
3195
|
+
var SkeletonBaseStyles = css12`
|
|
3196
|
+
background: linear-gradient(
|
|
3197
|
+
45deg,
|
|
3198
|
+
var(--font-color-alpha-10),
|
|
3199
|
+
var(--font-color-alpha-20)
|
|
3200
|
+
);
|
|
3201
|
+
animation: ${SkeletonBlink} 1s ease-in-out alternate-reverse infinite;
|
|
3202
|
+
`;
|
|
3203
|
+
var SkeletonSizeStyles = css12`
|
|
3204
|
+
&[data-size="small"] {
|
|
3205
|
+
width: 100%;
|
|
3206
|
+
|
|
3207
|
+
min-width: var(--measurement-medium-60);
|
|
3208
|
+
min-height: var(--measurement-medium-70);
|
|
3209
|
+
}
|
|
3210
|
+
&[data-size="medium"] {
|
|
3211
|
+
width: 100%;
|
|
3212
|
+
min-width: var(--measurement-medium-90);
|
|
3213
|
+
min-height: var(--measurement-medium-80);
|
|
3214
|
+
}
|
|
3215
|
+
&[data-size="large"] {
|
|
3216
|
+
width: 100%;
|
|
3217
|
+
min-width: var(--measurement-medium-90);
|
|
3218
|
+
min-height: var(--measurement-medium-90);
|
|
3219
|
+
}
|
|
3220
|
+
`;
|
|
3221
|
+
var SkeletonShapeStyles = css12`
|
|
3222
|
+
&[data-shape="square"] {
|
|
3223
|
+
border-radius: 0;
|
|
3224
|
+
}
|
|
3225
|
+
&[data-shape="smooth"] {
|
|
3226
|
+
border-radius: var(--measurement-medium-20);
|
|
3227
|
+
}
|
|
3228
|
+
&[data-shape="round"] {
|
|
3229
|
+
border-radius: var(--measurement-large-90);
|
|
3230
|
+
}
|
|
3231
|
+
`;
|
|
3232
|
+
var SkeletonLoader = styled19.span`
|
|
3233
|
+
${SkeletonBaseStyles}
|
|
3234
|
+
${SkeletonSizeStyles}
|
|
3235
|
+
${SkeletonShapeStyles}
|
|
3236
|
+
`;
|
|
3237
|
+
|
|
3238
|
+
// src/skeleton/index.tsx
|
|
3239
|
+
var Skeleton = (props) => {
|
|
3240
|
+
const {
|
|
3241
|
+
sizing = "medium" /* Medium */,
|
|
3242
|
+
shape = "smooth",
|
|
3243
|
+
...restProps
|
|
3244
|
+
} = props;
|
|
3245
|
+
return /* @__PURE__ */ React31.createElement(
|
|
3246
|
+
SkeletonLoader,
|
|
3247
|
+
{
|
|
3248
|
+
"data-size": sizing,
|
|
3249
|
+
"data-shape": shape,
|
|
3250
|
+
tabIndex: 0,
|
|
3251
|
+
...restProps
|
|
3252
|
+
}
|
|
3253
|
+
);
|
|
3254
|
+
};
|
|
3255
|
+
Skeleton.displayName = "Skeleton";
|
|
3256
|
+
|
|
2609
3257
|
// src/switch/index.tsx
|
|
2610
|
-
import
|
|
3258
|
+
import React33 from "react";
|
|
2611
3259
|
|
|
2612
3260
|
// src/switch/hooks/index.tsx
|
|
2613
|
-
import
|
|
3261
|
+
import React32, { useState as useState6, createContext as createContext6, useContext as useContext6 } from "react";
|
|
2614
3262
|
var defaultComponentAPI6 = {
|
|
2615
3263
|
id: "",
|
|
2616
3264
|
states: {},
|
|
@@ -2620,11 +3268,11 @@ var SwitchContext = createContext6(defaultComponentAPI6);
|
|
|
2620
3268
|
var useSwitch = () => useContext6(SwitchContext);
|
|
2621
3269
|
var SwitchProvider = ({ children }) => {
|
|
2622
3270
|
const context = useSwitchProvider();
|
|
2623
|
-
return /* @__PURE__ */
|
|
3271
|
+
return /* @__PURE__ */ React32.createElement(SwitchContext.Provider, { value: context }, children);
|
|
2624
3272
|
};
|
|
2625
3273
|
function useSwitchProvider() {
|
|
2626
3274
|
const [checked, setChecked] = useState6(false);
|
|
2627
|
-
const switchId =
|
|
3275
|
+
const switchId = React32.useId();
|
|
2628
3276
|
return {
|
|
2629
3277
|
id: switchId,
|
|
2630
3278
|
states: {
|
|
@@ -2637,8 +3285,8 @@ function useSwitchProvider() {
|
|
|
2637
3285
|
}
|
|
2638
3286
|
|
|
2639
3287
|
// src/switch/styles/index.ts
|
|
2640
|
-
import
|
|
2641
|
-
var SwitchDefaultStyles =
|
|
3288
|
+
import styled20, { css as css13 } from "styled-components";
|
|
3289
|
+
var SwitchDefaultStyles = css13`
|
|
2642
3290
|
all: unset;
|
|
2643
3291
|
|
|
2644
3292
|
border: var(--measurement-small-10) solid transparent;
|
|
@@ -2652,7 +3300,7 @@ var SwitchDefaultStyles = css10`
|
|
|
2652
3300
|
opacity: 0.6;
|
|
2653
3301
|
}
|
|
2654
3302
|
`;
|
|
2655
|
-
var SwitchVariantsStyles =
|
|
3303
|
+
var SwitchVariantsStyles = css13`
|
|
2656
3304
|
&[data-variant="primary"] {
|
|
2657
3305
|
&[aria-checked="true"] {
|
|
2658
3306
|
background-color: var(--color-green);
|
|
@@ -2683,7 +3331,7 @@ var SwitchVariantsStyles = css10`
|
|
|
2683
3331
|
}
|
|
2684
3332
|
}
|
|
2685
3333
|
`;
|
|
2686
|
-
var SwitchSizeStyles =
|
|
3334
|
+
var SwitchSizeStyles = css13`
|
|
2687
3335
|
&[data-size="small"] {
|
|
2688
3336
|
width: calc(var(--measurement-medium-60) * 1.33);
|
|
2689
3337
|
height: var(--measurement-medium-50);
|
|
@@ -2732,14 +3380,14 @@ var SwitchSizeStyles = css10`
|
|
|
2732
3380
|
}
|
|
2733
3381
|
}
|
|
2734
3382
|
`;
|
|
2735
|
-
var TriggerWrapper =
|
|
3383
|
+
var TriggerWrapper = styled20.button`
|
|
2736
3384
|
&[data-raw="false"] {
|
|
2737
3385
|
${SwitchDefaultStyles}
|
|
2738
3386
|
${SwitchVariantsStyles}
|
|
2739
3387
|
${SwitchSizeStyles}
|
|
2740
3388
|
}
|
|
2741
3389
|
`;
|
|
2742
|
-
var Thumb =
|
|
3390
|
+
var Thumb = styled20.span`
|
|
2743
3391
|
&[data-raw="false"] {
|
|
2744
3392
|
all: unset;
|
|
2745
3393
|
display: block;
|
|
@@ -2773,10 +3421,10 @@ var Switch = (props) => {
|
|
|
2773
3421
|
if (onClick) onClick(event);
|
|
2774
3422
|
if (toggleSwitch) toggleSwitch();
|
|
2775
3423
|
};
|
|
2776
|
-
|
|
3424
|
+
React33.useEffect(() => {
|
|
2777
3425
|
if (defaultChecked && toggleSwitch) toggleSwitch();
|
|
2778
3426
|
}, [defaultChecked]);
|
|
2779
|
-
return /* @__PURE__ */
|
|
3427
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2780
3428
|
TriggerWrapper,
|
|
2781
3429
|
{
|
|
2782
3430
|
type: "button",
|
|
@@ -2792,19 +3440,19 @@ var Switch = (props) => {
|
|
|
2792
3440
|
"data-raw": Boolean(raw),
|
|
2793
3441
|
...restProps
|
|
2794
3442
|
},
|
|
2795
|
-
/* @__PURE__ */
|
|
3443
|
+
/* @__PURE__ */ React33.createElement("title", null, "Switch"),
|
|
2796
3444
|
children
|
|
2797
3445
|
);
|
|
2798
3446
|
};
|
|
2799
3447
|
Switch.displayName = "Switch";
|
|
2800
3448
|
var SwitchRoot = ({ children }) => {
|
|
2801
|
-
return /* @__PURE__ */
|
|
3449
|
+
return /* @__PURE__ */ React33.createElement(SwitchProvider, null, children);
|
|
2802
3450
|
};
|
|
2803
3451
|
SwitchRoot.displayName = "Switch.Root";
|
|
2804
3452
|
var SwitchThumb = (props) => {
|
|
2805
3453
|
const { raw, sizing } = props;
|
|
2806
3454
|
const { id, states } = useSwitch();
|
|
2807
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ React33.createElement(
|
|
2808
3456
|
Thumb,
|
|
2809
3457
|
{
|
|
2810
3458
|
role: "presentation",
|
|
@@ -2824,11 +3472,11 @@ Switch.Root = SwitchRoot;
|
|
|
2824
3472
|
Switch.Thumb = SwitchThumb;
|
|
2825
3473
|
|
|
2826
3474
|
// src/table/index.tsx
|
|
2827
|
-
import
|
|
3475
|
+
import React34 from "react";
|
|
2828
3476
|
|
|
2829
3477
|
// src/table/styles/index.ts
|
|
2830
|
-
import
|
|
2831
|
-
var CellStyles =
|
|
3478
|
+
import styled21, { css as css14 } from "styled-components";
|
|
3479
|
+
var CellStyles = css14`
|
|
2832
3480
|
box-sizing: border-box;
|
|
2833
3481
|
border: none;
|
|
2834
3482
|
line-height: 1;
|
|
@@ -2838,11 +3486,11 @@ var CellStyles = css11`
|
|
|
2838
3486
|
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
2839
3487
|
);
|
|
2840
3488
|
`;
|
|
2841
|
-
var TableLayer =
|
|
3489
|
+
var TableLayer = styled21.div`
|
|
2842
3490
|
border-radius: var(--measurement-medium-30);
|
|
2843
3491
|
border: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2844
3492
|
`;
|
|
2845
|
-
var TableWrapper =
|
|
3493
|
+
var TableWrapper = styled21.table`
|
|
2846
3494
|
border-collapse: collapse;
|
|
2847
3495
|
|
|
2848
3496
|
tbody {
|
|
@@ -2853,7 +3501,7 @@ var TableWrapper = styled15.table`
|
|
|
2853
3501
|
}
|
|
2854
3502
|
}
|
|
2855
3503
|
`;
|
|
2856
|
-
var RowWrapper =
|
|
3504
|
+
var RowWrapper = styled21.tr`
|
|
2857
3505
|
border-bottom: var(--measurement-small-10) solid var(--font-color-alpha-10);
|
|
2858
3506
|
|
|
2859
3507
|
transition: background-color linear 0.1s;
|
|
@@ -2862,7 +3510,7 @@ var RowWrapper = styled15.tr`
|
|
|
2862
3510
|
background-color: var(--font-color-alpha-10);
|
|
2863
3511
|
}
|
|
2864
3512
|
`;
|
|
2865
|
-
var HeadCellWrapper =
|
|
3513
|
+
var HeadCellWrapper = styled21.th`
|
|
2866
3514
|
font-size: var(--fontsize-medium-10);
|
|
2867
3515
|
${CellStyles}
|
|
2868
3516
|
|
|
@@ -2870,7 +3518,7 @@ var HeadCellWrapper = styled15.th`
|
|
|
2870
3518
|
color: var(--font-color-alpha-60);
|
|
2871
3519
|
}
|
|
2872
3520
|
`;
|
|
2873
|
-
var CellWrapper =
|
|
3521
|
+
var CellWrapper = styled21.td`
|
|
2874
3522
|
${CellStyles}
|
|
2875
3523
|
`;
|
|
2876
3524
|
|
|
@@ -2879,43 +3527,43 @@ var Table = ({
|
|
|
2879
3527
|
children,
|
|
2880
3528
|
...restProps
|
|
2881
3529
|
}) => {
|
|
2882
|
-
return /* @__PURE__ */
|
|
3530
|
+
return /* @__PURE__ */ React34.createElement(ScrollArea, { as: TableLayer, role: "presentation", tabIndex: -1 }, /* @__PURE__ */ React34.createElement(TableWrapper, { ...restProps, cellSpacing: "0", cellPadding: "0" }, children));
|
|
2883
3531
|
};
|
|
2884
3532
|
Table.displayName = "Table";
|
|
2885
3533
|
var TableHead = ({
|
|
2886
3534
|
children,
|
|
2887
3535
|
...restProps
|
|
2888
3536
|
}) => {
|
|
2889
|
-
return /* @__PURE__ */
|
|
3537
|
+
return /* @__PURE__ */ React34.createElement("thead", { ...restProps }, children);
|
|
2890
3538
|
};
|
|
2891
3539
|
TableHead.displayName = "Table.Head";
|
|
2892
3540
|
var TableBody = ({
|
|
2893
3541
|
children,
|
|
2894
3542
|
...restProps
|
|
2895
3543
|
}) => {
|
|
2896
|
-
return /* @__PURE__ */
|
|
3544
|
+
return /* @__PURE__ */ React34.createElement("tbody", { ...restProps }, children);
|
|
2897
3545
|
};
|
|
2898
3546
|
TableBody.displayName = "Table.Body";
|
|
2899
3547
|
var TableHeadCell = ({
|
|
2900
3548
|
children,
|
|
2901
3549
|
...restProps
|
|
2902
3550
|
}) => {
|
|
2903
|
-
return /* @__PURE__ */
|
|
3551
|
+
return /* @__PURE__ */ React34.createElement(HeadCellWrapper, { colSpan: 1, ...restProps }, /* @__PURE__ */ React34.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
2904
3552
|
};
|
|
2905
3553
|
TableHeadCell.displayName = "Table.HeadCell";
|
|
2906
3554
|
var TableRow = ({ children, ...restProps }) => {
|
|
2907
|
-
return /* @__PURE__ */
|
|
3555
|
+
return /* @__PURE__ */ React34.createElement(RowWrapper, { className: "p-medium-30", ...restProps }, children);
|
|
2908
3556
|
};
|
|
2909
3557
|
TableRow.displayName = "Table.Row";
|
|
2910
3558
|
var TableCell = ({ children, ...restProps }) => {
|
|
2911
|
-
return /* @__PURE__ */
|
|
3559
|
+
return /* @__PURE__ */ React34.createElement(CellWrapper, { ...restProps }, /* @__PURE__ */ React34.createElement("div", { className: "flex align-center g-medium-30" }, children));
|
|
2912
3560
|
};
|
|
2913
3561
|
TableCell.displayName = "Table.Cell";
|
|
2914
3562
|
var TableFooter = ({
|
|
2915
3563
|
children,
|
|
2916
3564
|
...restProps
|
|
2917
3565
|
}) => {
|
|
2918
|
-
return /* @__PURE__ */
|
|
3566
|
+
return /* @__PURE__ */ React34.createElement("tfoot", { ...restProps }, children);
|
|
2919
3567
|
};
|
|
2920
3568
|
TableFooter.displayName = "Table.Footer";
|
|
2921
3569
|
Table.Head = TableHead;
|
|
@@ -2926,10 +3574,10 @@ Table.Cell = TableCell;
|
|
|
2926
3574
|
Table.Footer = TableFooter;
|
|
2927
3575
|
|
|
2928
3576
|
// src/tabs/index.tsx
|
|
2929
|
-
import
|
|
3577
|
+
import React36, { Children } from "react";
|
|
2930
3578
|
|
|
2931
3579
|
// src/tabs/hooks/index.tsx
|
|
2932
|
-
import
|
|
3580
|
+
import React35, { createContext as createContext7, useContext as useContext7, useState as useState7 } from "react";
|
|
2933
3581
|
var defaultComponentAPI7 = {
|
|
2934
3582
|
id: "",
|
|
2935
3583
|
states: {},
|
|
@@ -2939,11 +3587,11 @@ var TabsContext = createContext7(defaultComponentAPI7);
|
|
|
2939
3587
|
var useTabs = () => useContext7(TabsContext);
|
|
2940
3588
|
var TabsProvider = ({ children }) => {
|
|
2941
3589
|
const context = useTabsProvider();
|
|
2942
|
-
return /* @__PURE__ */
|
|
3590
|
+
return /* @__PURE__ */ React35.createElement(TabsContext.Provider, { value: context }, children);
|
|
2943
3591
|
};
|
|
2944
3592
|
function useTabsProvider() {
|
|
2945
3593
|
const [value, setValue] = useState7(null);
|
|
2946
|
-
const tabsId =
|
|
3594
|
+
const tabsId = React35.useId();
|
|
2947
3595
|
return {
|
|
2948
3596
|
id: tabsId,
|
|
2949
3597
|
states: {
|
|
@@ -2957,8 +3605,8 @@ function useTabsProvider() {
|
|
|
2957
3605
|
}
|
|
2958
3606
|
|
|
2959
3607
|
// src/tabs/styles/index.ts
|
|
2960
|
-
import
|
|
2961
|
-
var TabWrapper =
|
|
3608
|
+
import styled22 from "styled-components";
|
|
3609
|
+
var TabWrapper = styled22.div`
|
|
2962
3610
|
button {
|
|
2963
3611
|
&[aria-selected="true"] {
|
|
2964
3612
|
color: var(--font-color) !important;
|
|
@@ -2973,20 +3621,20 @@ var Tabs = (props) => {
|
|
|
2973
3621
|
const { applyValue } = methods;
|
|
2974
3622
|
const childArray = Children.toArray(children);
|
|
2975
3623
|
const firstChild = childArray[0];
|
|
2976
|
-
|
|
2977
|
-
if (
|
|
3624
|
+
React36.useEffect(() => {
|
|
3625
|
+
if (React36.isValidElement(firstChild)) {
|
|
2978
3626
|
if (childArray.length > 0 && applyValue)
|
|
2979
3627
|
applyValue(firstChild.props.value);
|
|
2980
3628
|
}
|
|
2981
3629
|
}, []);
|
|
2982
|
-
|
|
3630
|
+
React36.useEffect(() => {
|
|
2983
3631
|
if (defaultOpen && applyValue) applyValue(defaultOpen);
|
|
2984
3632
|
}, []);
|
|
2985
|
-
return /* @__PURE__ */
|
|
3633
|
+
return /* @__PURE__ */ React36.createElement(TabWrapper, { role: "tablist", ...restProps }, children);
|
|
2986
3634
|
};
|
|
2987
3635
|
Tabs.displayName = "Tabs";
|
|
2988
3636
|
var TabsRoot = ({ children }) => {
|
|
2989
|
-
return /* @__PURE__ */
|
|
3637
|
+
return /* @__PURE__ */ React36.createElement(TabsProvider, null, children);
|
|
2990
3638
|
};
|
|
2991
3639
|
TabsRoot.displayName = "Tabs.Root";
|
|
2992
3640
|
var TabsTrigger = (props) => {
|
|
@@ -3002,7 +3650,7 @@ var TabsTrigger = (props) => {
|
|
|
3002
3650
|
if (applyValue) applyValue(value);
|
|
3003
3651
|
if (onClick) onClick(event);
|
|
3004
3652
|
};
|
|
3005
|
-
return /* @__PURE__ */
|
|
3653
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3006
3654
|
Button,
|
|
3007
3655
|
{
|
|
3008
3656
|
type: "button",
|
|
@@ -3030,7 +3678,7 @@ var TabsContent = (props) => {
|
|
|
3030
3678
|
trigger: getTabsId && getTabsId({ value, type: "trigger" }),
|
|
3031
3679
|
content: getTabsId && getTabsId({ value, type: "content" })
|
|
3032
3680
|
};
|
|
3033
|
-
return /* @__PURE__ */
|
|
3681
|
+
return /* @__PURE__ */ React36.createElement(
|
|
3034
3682
|
"div",
|
|
3035
3683
|
{
|
|
3036
3684
|
tabIndex: 0,
|
|
@@ -3050,23 +3698,171 @@ Tabs.Root = TabsRoot;
|
|
|
3050
3698
|
Tabs.Trigger = TabsTrigger;
|
|
3051
3699
|
Tabs.Content = TabsContent;
|
|
3052
3700
|
|
|
3701
|
+
// src/text-area/index.tsx
|
|
3702
|
+
import React37 from "react";
|
|
3703
|
+
|
|
3704
|
+
// src/text-area/styles/index.ts
|
|
3705
|
+
import styled23, { css as css15 } from "styled-components";
|
|
3706
|
+
var CustomScrollbar2 = css15`
|
|
3707
|
+
height: ${({ $height }) => $height ?? "100%"};
|
|
3708
|
+
width: ${({ $width }) => $width ?? "100%"};
|
|
3709
|
+
overflow-y: auto;
|
|
3710
|
+
overflow-x: hidden;
|
|
3711
|
+
|
|
3712
|
+
&::-webkit-scrollbar {
|
|
3713
|
+
cursor: pointer;
|
|
3714
|
+
|
|
3715
|
+
width: var(--measurement-medium-10);
|
|
3716
|
+
}
|
|
3717
|
+
|
|
3718
|
+
&::-webkit-scrollbar-track {
|
|
3719
|
+
background: ${({ $trackColor }) => $trackColor ?? "transparent"};
|
|
3720
|
+
border-radius: var(--measurement-medium-30);
|
|
3721
|
+
border: none;
|
|
3722
|
+
}
|
|
3723
|
+
|
|
3724
|
+
&::-webkit-scrollbar-thumb {
|
|
3725
|
+
background: ${({ $thumbColor }) => $thumbColor ?? "var(--font-color-alpha-10)"};
|
|
3726
|
+
border-radius: var(--measurement-medium-30);
|
|
3727
|
+
transition: background-color 0.2s ease;
|
|
3728
|
+
}
|
|
3729
|
+
|
|
3730
|
+
&::-webkit-scrollbar-thumb:hover {
|
|
3731
|
+
background: ${({ $thumbHoverColor, $thumbColor }) => $thumbHoverColor ?? $thumbColor ?? "var(--font-color-alpha-20)"};
|
|
3732
|
+
}
|
|
3733
|
+
|
|
3734
|
+
// Firefox
|
|
3735
|
+
scrollbar-width: thin;
|
|
3736
|
+
scrollbar-color: ${({ $thumbColor, $trackColor }) => `${$thumbColor ?? "var(--font-color-alpha-10)"} ${$trackColor ?? "transparent"}`};
|
|
3737
|
+
`;
|
|
3738
|
+
var TextAreaContainer = styled23.textarea`
|
|
3739
|
+
&[data-raw="false"] {
|
|
3740
|
+
resize: vertical;
|
|
3741
|
+
max-height: var(--measurement-large-60);
|
|
3742
|
+
min-height: auto;
|
|
3743
|
+
width: 100%;
|
|
3744
|
+
|
|
3745
|
+
overflow-y: auto;
|
|
3746
|
+
|
|
3747
|
+
outline: none;
|
|
3748
|
+
cursor: pointer;
|
|
3749
|
+
display: flex;
|
|
3750
|
+
align-items: center;
|
|
3751
|
+
justify-content: center;
|
|
3752
|
+
|
|
3753
|
+
font-size: var(--fontsize-small-80);
|
|
3754
|
+
padding: var(--measurement-medium-30) var(--measurement-medium-30)
|
|
3755
|
+
var(--measurement-large-10) var(--measurement-medium-30);
|
|
3756
|
+
|
|
3757
|
+
font-weight: 500;
|
|
3758
|
+
line-height: 1.1;
|
|
3759
|
+
letter-spacing: calc(
|
|
3760
|
+
var(--fontsize-small-10) - ((var(--fontsize-small-10) * 1.066))
|
|
3761
|
+
);
|
|
3762
|
+
|
|
3763
|
+
border: var(--measurement-small-10) solid transparent;
|
|
3764
|
+
border-radius: var(--measurement-medium-30);
|
|
3765
|
+
backdrop-filter: blur(var(--measurement-small-10));
|
|
3766
|
+
color: var(--font-color-alpha-60);
|
|
3767
|
+
|
|
3768
|
+
transition: all ease-in-out 0.2s;
|
|
3769
|
+
|
|
3770
|
+
svg,
|
|
3771
|
+
span,
|
|
3772
|
+
img {
|
|
3773
|
+
opacity: 0.6;
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
&:hover,
|
|
3777
|
+
&:focus,
|
|
3778
|
+
&:active {
|
|
3779
|
+
color: var(--font-color);
|
|
3780
|
+
|
|
3781
|
+
svg,
|
|
3782
|
+
span,
|
|
3783
|
+
img {
|
|
3784
|
+
opacity: 1;
|
|
3785
|
+
}
|
|
3786
|
+
}
|
|
3787
|
+
&::placeholder {
|
|
3788
|
+
color: var(--font-color-alpha-30);
|
|
3789
|
+
}
|
|
3790
|
+
&:disabled {
|
|
3791
|
+
cursor: not-allowed;
|
|
3792
|
+
opacity: 0.6;
|
|
3793
|
+
}
|
|
3794
|
+
|
|
3795
|
+
&::placeholder {
|
|
3796
|
+
color: var(--font-color-alpha-30);
|
|
3797
|
+
}
|
|
3798
|
+
|
|
3799
|
+
&:focus-visible {
|
|
3800
|
+
outline: none;
|
|
3801
|
+
}
|
|
3802
|
+
|
|
3803
|
+
&:disabled {
|
|
3804
|
+
cursor: not-allowed;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
&[data-error="true"] {
|
|
3808
|
+
&::placeholder {
|
|
3809
|
+
color: var(--alpha-red-30);
|
|
3810
|
+
}
|
|
3811
|
+
}
|
|
3812
|
+
|
|
3813
|
+
${CustomScrollbar2}
|
|
3814
|
+
${FieldVariantsStyles}
|
|
3815
|
+
}
|
|
3816
|
+
`;
|
|
3817
|
+
|
|
3818
|
+
// src/text-area/index.tsx
|
|
3819
|
+
var Textarea = ({ onChange, ...props }) => {
|
|
3820
|
+
const textareaRef = React37.useRef(null);
|
|
3821
|
+
const adjustHeight = () => {
|
|
3822
|
+
const textarea = textareaRef.current;
|
|
3823
|
+
if (textarea) {
|
|
3824
|
+
textarea.style.height = "auto";
|
|
3825
|
+
textarea.style.height = `${Math.min(
|
|
3826
|
+
textarea.scrollHeight,
|
|
3827
|
+
parseInt(getComputedStyle(textarea).maxHeight)
|
|
3828
|
+
)}px`;
|
|
3829
|
+
}
|
|
3830
|
+
};
|
|
3831
|
+
const handleChange = (e) => {
|
|
3832
|
+
adjustHeight();
|
|
3833
|
+
onChange?.(e);
|
|
3834
|
+
};
|
|
3835
|
+
React37.useEffect(() => adjustHeight(), [props.value]);
|
|
3836
|
+
return /* @__PURE__ */ React37.createElement(Field.Wrapper, { className: "w-100 h-auto" }, /* @__PURE__ */ React37.createElement(
|
|
3837
|
+
TextAreaContainer,
|
|
3838
|
+
{
|
|
3839
|
+
ref: textareaRef,
|
|
3840
|
+
onChange: handleChange,
|
|
3841
|
+
"data-variant": props.variant ?? "secondary",
|
|
3842
|
+
"data-raw": String(Boolean(props?.raw)),
|
|
3843
|
+
...props
|
|
3844
|
+
}
|
|
3845
|
+
));
|
|
3846
|
+
};
|
|
3847
|
+
Textarea.displayName = "Textarea";
|
|
3848
|
+
|
|
3053
3849
|
// src/toggle/index.tsx
|
|
3054
|
-
import
|
|
3850
|
+
import React38 from "react";
|
|
3055
3851
|
var Toggle = (props) => {
|
|
3056
3852
|
const { defaultChecked, onClick, disabled, children, ...restProps } = props;
|
|
3057
|
-
const [checked, setChecked] =
|
|
3853
|
+
const [checked, setChecked] = React38.useState(
|
|
3058
3854
|
defaultChecked ?? false
|
|
3059
3855
|
);
|
|
3060
3856
|
const handleClick = (event) => {
|
|
3061
3857
|
if (onClick) onClick(event);
|
|
3062
3858
|
if (!disabled) setChecked((prevChecked) => !prevChecked);
|
|
3063
3859
|
};
|
|
3064
|
-
|
|
3860
|
+
React38.useEffect(() => {
|
|
3065
3861
|
if (defaultChecked !== void 0) {
|
|
3066
3862
|
setChecked(Boolean(defaultChecked));
|
|
3067
3863
|
}
|
|
3068
3864
|
}, [defaultChecked]);
|
|
3069
|
-
return /* @__PURE__ */
|
|
3865
|
+
return /* @__PURE__ */ React38.createElement(
|
|
3070
3866
|
Button,
|
|
3071
3867
|
{
|
|
3072
3868
|
role: "switch",
|
|
@@ -3084,10 +3880,10 @@ var Toggle = (props) => {
|
|
|
3084
3880
|
Toggle.displayName = "Toggle";
|
|
3085
3881
|
|
|
3086
3882
|
// src/toolbar/index.tsx
|
|
3087
|
-
import
|
|
3883
|
+
import React40 from "react";
|
|
3088
3884
|
|
|
3089
3885
|
// src/toolbar/hooks/index.tsx
|
|
3090
|
-
import
|
|
3886
|
+
import React39, { useState as useState8, createContext as createContext8, useContext as useContext8 } from "react";
|
|
3091
3887
|
var defaultComponentAPI8 = {
|
|
3092
3888
|
id: "",
|
|
3093
3889
|
states: {},
|
|
@@ -3097,11 +3893,11 @@ var ToolbarContext = createContext8(defaultComponentAPI8);
|
|
|
3097
3893
|
var useToolbar = () => useContext8(ToolbarContext);
|
|
3098
3894
|
var ToolbarProvider = ({ children }) => {
|
|
3099
3895
|
const context = useToolbarProvider();
|
|
3100
|
-
return /* @__PURE__ */
|
|
3896
|
+
return /* @__PURE__ */ React39.createElement(ToolbarContext.Provider, { value: context }, children);
|
|
3101
3897
|
};
|
|
3102
3898
|
function useToolbarProvider() {
|
|
3103
3899
|
const [expanded, setExpanded] = useState8(false);
|
|
3104
|
-
const toolbarId =
|
|
3900
|
+
const toolbarId = React39.useId();
|
|
3105
3901
|
return {
|
|
3106
3902
|
id: toolbarId,
|
|
3107
3903
|
states: {
|
|
@@ -3114,8 +3910,8 @@ function useToolbarProvider() {
|
|
|
3114
3910
|
}
|
|
3115
3911
|
|
|
3116
3912
|
// src/toolbar/styles/index.ts
|
|
3117
|
-
import
|
|
3118
|
-
var ToolbarDefaultStyles =
|
|
3913
|
+
import styled24, { css as css16 } from "styled-components";
|
|
3914
|
+
var ToolbarDefaultStyles = css16`
|
|
3119
3915
|
margin: 0;
|
|
3120
3916
|
display: grid;
|
|
3121
3917
|
grid-template-rows: min-content;
|
|
@@ -3149,7 +3945,7 @@ var ToolbarDefaultStyles = css12`
|
|
|
3149
3945
|
}
|
|
3150
3946
|
}
|
|
3151
3947
|
`;
|
|
3152
|
-
var ToolbarSizeStyles =
|
|
3948
|
+
var ToolbarSizeStyles = css16`
|
|
3153
3949
|
&[data-size="small"] {
|
|
3154
3950
|
&[aria-orientation="vertical"] {
|
|
3155
3951
|
max-width: var(--measurement-large-70);
|
|
@@ -3195,7 +3991,7 @@ var ToolbarSizeStyles = css12`
|
|
|
3195
3991
|
}
|
|
3196
3992
|
}
|
|
3197
3993
|
`;
|
|
3198
|
-
var ToolbarSideStyles =
|
|
3994
|
+
var ToolbarSideStyles = css16`
|
|
3199
3995
|
&[data-side="top"] {
|
|
3200
3996
|
border-bottom-color: var(--font-color-alpha-10);
|
|
3201
3997
|
}
|
|
@@ -3227,7 +4023,7 @@ var ToolbarSideStyles = css12`
|
|
|
3227
4023
|
}
|
|
3228
4024
|
}
|
|
3229
4025
|
`;
|
|
3230
|
-
var ToolbarWrapper =
|
|
4026
|
+
var ToolbarWrapper = styled24.menu`
|
|
3231
4027
|
&[data-raw="false"] {
|
|
3232
4028
|
${ToolbarDefaultStyles}
|
|
3233
4029
|
${ToolbarSizeStyles}
|
|
@@ -3235,7 +4031,7 @@ var ToolbarWrapper = styled17.menu`
|
|
|
3235
4031
|
${ToolbarSideStyles}
|
|
3236
4032
|
}
|
|
3237
4033
|
`;
|
|
3238
|
-
var ToolbarTriggerWrapper =
|
|
4034
|
+
var ToolbarTriggerWrapper = styled24.menu`
|
|
3239
4035
|
&[data-raw="false"] {
|
|
3240
4036
|
all: unset;
|
|
3241
4037
|
align-self: flex-end;
|
|
@@ -3260,13 +4056,13 @@ var Toolbar = (props) => {
|
|
|
3260
4056
|
const { toggleToolbar } = methods;
|
|
3261
4057
|
const shortcutControls = useKeyPress(String(hotkey), true, bindkey);
|
|
3262
4058
|
const orientation = side && ["left", "right"].includes(side) ? "vertical" : "horizontal";
|
|
3263
|
-
|
|
4059
|
+
React40.useEffect(() => {
|
|
3264
4060
|
if (defaultOpen && toggleToolbar) return toggleToolbar(true);
|
|
3265
4061
|
}, [defaultOpen]);
|
|
3266
|
-
|
|
4062
|
+
React40.useEffect(() => {
|
|
3267
4063
|
if (shortcut && shortcutControls && toggleToolbar) toggleToolbar();
|
|
3268
4064
|
}, [shortcutControls]);
|
|
3269
|
-
return /* @__PURE__ */
|
|
4065
|
+
return /* @__PURE__ */ React40.createElement(
|
|
3270
4066
|
ToolbarWrapper,
|
|
3271
4067
|
{
|
|
3272
4068
|
id,
|
|
@@ -3286,7 +4082,7 @@ var Toolbar = (props) => {
|
|
|
3286
4082
|
};
|
|
3287
4083
|
Toolbar.displayName = "Toolbar";
|
|
3288
4084
|
var ToolbarRoot = ({ children }) => {
|
|
3289
|
-
return /* @__PURE__ */
|
|
4085
|
+
return /* @__PURE__ */ React40.createElement(ToolbarProvider, null, children);
|
|
3290
4086
|
};
|
|
3291
4087
|
ToolbarRoot.displayName = "Toolbar.Root";
|
|
3292
4088
|
var ToolbarTrigger = (props) => {
|
|
@@ -3304,7 +4100,7 @@ var ToolbarTrigger = (props) => {
|
|
|
3304
4100
|
if (onClick) onClick(event);
|
|
3305
4101
|
if (toggleToolbar) toggleToolbar(!states.expanded);
|
|
3306
4102
|
};
|
|
3307
|
-
return /* @__PURE__ */
|
|
4103
|
+
return /* @__PURE__ */ React40.createElement(ToolbarTriggerWrapper, { "data-raw": Boolean(raw) }, /* @__PURE__ */ React40.createElement(
|
|
3308
4104
|
Button,
|
|
3309
4105
|
{
|
|
3310
4106
|
id: `${id}-trigger`,
|
|
@@ -3322,13 +4118,13 @@ var ToolbarSection = (props) => {
|
|
|
3322
4118
|
const { showoncollapse, children, ...restProps } = props;
|
|
3323
4119
|
const { states } = useToolbar();
|
|
3324
4120
|
const { expanded } = states;
|
|
3325
|
-
if (showoncollapse) return /* @__PURE__ */
|
|
3326
|
-
return /* @__PURE__ */
|
|
4121
|
+
if (showoncollapse) return /* @__PURE__ */ React40.createElement("section", { ...restProps }, children);
|
|
4122
|
+
return /* @__PURE__ */ React40.createElement("section", { ...restProps }, expanded && children);
|
|
3327
4123
|
};
|
|
3328
4124
|
ToolbarSection.displayName = "Toolbar.Section";
|
|
3329
4125
|
var ToolbarItem = (props) => {
|
|
3330
4126
|
const { showfirstchild, onClick, children, ...restProps } = props;
|
|
3331
|
-
const childArray =
|
|
4127
|
+
const childArray = React40.Children.toArray(children);
|
|
3332
4128
|
const { id, states, methods } = useToolbar();
|
|
3333
4129
|
const { expanded } = states;
|
|
3334
4130
|
const { toggleToolbar } = methods;
|
|
@@ -3337,7 +4133,7 @@ var ToolbarItem = (props) => {
|
|
|
3337
4133
|
if (onClick) onClick(event);
|
|
3338
4134
|
if (toggleToolbar && !expanded) toggleToolbar(true);
|
|
3339
4135
|
};
|
|
3340
|
-
return /* @__PURE__ */
|
|
4136
|
+
return /* @__PURE__ */ React40.createElement(
|
|
3341
4137
|
"div",
|
|
3342
4138
|
{
|
|
3343
4139
|
tabIndex: -1,
|
|
@@ -3358,11 +4154,11 @@ Toolbar.Item = ToolbarItem;
|
|
|
3358
4154
|
Toolbar.Section = ToolbarSection;
|
|
3359
4155
|
|
|
3360
4156
|
// src/tooltip/index.tsx
|
|
3361
|
-
import
|
|
4157
|
+
import React41 from "react";
|
|
3362
4158
|
|
|
3363
4159
|
// src/tooltip/styles/index.ts
|
|
3364
|
-
import
|
|
3365
|
-
var FadeIn2 =
|
|
4160
|
+
import styled25, { keyframes as keyframes4 } from "styled-components";
|
|
4161
|
+
var FadeIn2 = keyframes4`
|
|
3366
4162
|
0% {
|
|
3367
4163
|
opacity: 0;
|
|
3368
4164
|
}
|
|
@@ -3370,11 +4166,11 @@ var FadeIn2 = keyframes2`
|
|
|
3370
4166
|
opacity: 1;
|
|
3371
4167
|
}
|
|
3372
4168
|
`;
|
|
3373
|
-
var ContentBox =
|
|
4169
|
+
var ContentBox = styled25.div`
|
|
3374
4170
|
display: inline-block;
|
|
3375
4171
|
position: relative;
|
|
3376
4172
|
`;
|
|
3377
|
-
var ContentWrapper2 =
|
|
4173
|
+
var ContentWrapper2 = styled25.span`
|
|
3378
4174
|
&[data-raw="false"] {
|
|
3379
4175
|
width: fit-content;
|
|
3380
4176
|
max-width: var(--measurement-large-60);
|
|
@@ -3405,15 +4201,15 @@ var Tooltip = ({
|
|
|
3405
4201
|
children,
|
|
3406
4202
|
...restProps
|
|
3407
4203
|
}) => {
|
|
3408
|
-
const [visible, setVisible] =
|
|
3409
|
-
const [triggerProps, setTriggerProps] =
|
|
3410
|
-
const [contentProps, setContentProps] =
|
|
3411
|
-
const mounted =
|
|
3412
|
-
const containerRef =
|
|
3413
|
-
const contentRef =
|
|
3414
|
-
const timeoutRef =
|
|
4204
|
+
const [visible, setVisible] = React41.useState(false);
|
|
4205
|
+
const [triggerProps, setTriggerProps] = React41.useState(null);
|
|
4206
|
+
const [contentProps, setContentProps] = React41.useState(null);
|
|
4207
|
+
const mounted = React41.useRef(false);
|
|
4208
|
+
const containerRef = React41.useRef(null);
|
|
4209
|
+
const contentRef = React41.useRef(null);
|
|
4210
|
+
const timeoutRef = React41.useRef(null);
|
|
3415
4211
|
const contentRect = () => contentRef?.current?.getBoundingClientRect();
|
|
3416
|
-
const bodyRect =
|
|
4212
|
+
const bodyRect = React41.useCallback(() => {
|
|
3417
4213
|
if (typeof document !== "undefined") {
|
|
3418
4214
|
return document.body.getBoundingClientRect();
|
|
3419
4215
|
}
|
|
@@ -3434,14 +4230,14 @@ var Tooltip = ({
|
|
|
3434
4230
|
};
|
|
3435
4231
|
const hasEnoughHorizontalSpace = Number(dimensions.body_width) - Number(dimensions.content_left) > Number(dimensions.content_width) * 1.1;
|
|
3436
4232
|
const hasEnoughVerticalSpace = Number(dimensions.body_height) - Number(dimensions.content_bottom) > Number(dimensions.content_height) * 0.9;
|
|
3437
|
-
const showTooltip =
|
|
4233
|
+
const showTooltip = React41.useCallback(() => {
|
|
3438
4234
|
timeoutRef.current = setTimeout(() => setVisible(true), delay);
|
|
3439
4235
|
}, [delay]);
|
|
3440
|
-
const hideTooltip =
|
|
4236
|
+
const hideTooltip = React41.useCallback(() => {
|
|
3441
4237
|
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
3442
4238
|
setVisible(false);
|
|
3443
4239
|
}, []);
|
|
3444
|
-
const handleMouseEnter =
|
|
4240
|
+
const handleMouseEnter = React41.useCallback(() => {
|
|
3445
4241
|
const rect = containerRef.current?.getBoundingClientRect();
|
|
3446
4242
|
if (rect) {
|
|
3447
4243
|
setTriggerProps({
|
|
@@ -3455,11 +4251,11 @@ var Tooltip = ({
|
|
|
3455
4251
|
showTooltip();
|
|
3456
4252
|
}
|
|
3457
4253
|
}, [showTooltip]);
|
|
3458
|
-
const handleMouseLeave =
|
|
4254
|
+
const handleMouseLeave = React41.useCallback(
|
|
3459
4255
|
() => hideTooltip(),
|
|
3460
4256
|
[hideTooltip]
|
|
3461
4257
|
);
|
|
3462
|
-
|
|
4258
|
+
React41.useEffect(() => {
|
|
3463
4259
|
mounted.current = true;
|
|
3464
4260
|
setContentProps && setContentProps({
|
|
3465
4261
|
top: Number(contentRect()?.top),
|
|
@@ -3473,7 +4269,7 @@ var Tooltip = ({
|
|
|
3473
4269
|
mounted.current = false;
|
|
3474
4270
|
};
|
|
3475
4271
|
}, [visible]);
|
|
3476
|
-
return /* @__PURE__ */
|
|
4272
|
+
return /* @__PURE__ */ React41.createElement(
|
|
3477
4273
|
ContentBox,
|
|
3478
4274
|
{
|
|
3479
4275
|
ref: containerRef,
|
|
@@ -3483,7 +4279,7 @@ var Tooltip = ({
|
|
|
3483
4279
|
...restProps
|
|
3484
4280
|
},
|
|
3485
4281
|
children,
|
|
3486
|
-
visible && /* @__PURE__ */
|
|
4282
|
+
visible && /* @__PURE__ */ React41.createElement(
|
|
3487
4283
|
ContentWrapper2,
|
|
3488
4284
|
{
|
|
3489
4285
|
ref: contentRef,
|
|
@@ -3498,7 +4294,7 @@ var Tooltip = ({
|
|
|
3498
4294
|
"data-side": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */,
|
|
3499
4295
|
"data-align": hasEnoughHorizontalSpace ? "left" /* Left */ : "right" /* Right */
|
|
3500
4296
|
},
|
|
3501
|
-
/* @__PURE__ */
|
|
4297
|
+
/* @__PURE__ */ React41.createElement("div", null, content)
|
|
3502
4298
|
)
|
|
3503
4299
|
);
|
|
3504
4300
|
};
|
|
@@ -3511,7 +4307,14 @@ export {
|
|
|
3511
4307
|
AvataStatusEnum,
|
|
3512
4308
|
Avatar,
|
|
3513
4309
|
Badge,
|
|
4310
|
+
Breadcrumb,
|
|
4311
|
+
BreadcrumbItem,
|
|
4312
|
+
BreadcrumbSeparator,
|
|
3514
4313
|
Button,
|
|
4314
|
+
Card,
|
|
4315
|
+
CardBody,
|
|
4316
|
+
CardGrid,
|
|
4317
|
+
CardMeta,
|
|
3515
4318
|
Checkbox,
|
|
3516
4319
|
CheckboxIndicator,
|
|
3517
4320
|
CheckboxRoot,
|
|
@@ -3519,6 +4322,7 @@ export {
|
|
|
3519
4322
|
CollapsibleContent,
|
|
3520
4323
|
CollapsibleRoot,
|
|
3521
4324
|
CollapsibleTrigger,
|
|
4325
|
+
CopyButton,
|
|
3522
4326
|
Dialog,
|
|
3523
4327
|
DialogControl,
|
|
3524
4328
|
DialogMenu,
|
|
@@ -3548,10 +4352,14 @@ export {
|
|
|
3548
4352
|
PageTools,
|
|
3549
4353
|
PageWrapper,
|
|
3550
4354
|
Portal,
|
|
4355
|
+
PrivacyField,
|
|
4356
|
+
Resizable,
|
|
3551
4357
|
ScrollArea,
|
|
3552
4358
|
Sheet,
|
|
3553
4359
|
SheetRoot,
|
|
3554
4360
|
SheetTrigger,
|
|
4361
|
+
Skeleton,
|
|
4362
|
+
Spinner,
|
|
3555
4363
|
Switch,
|
|
3556
4364
|
SwitchRoot,
|
|
3557
4365
|
SwitchThumb,
|
|
@@ -3566,6 +4374,7 @@ export {
|
|
|
3566
4374
|
TabsContent,
|
|
3567
4375
|
TabsRoot,
|
|
3568
4376
|
TabsTrigger,
|
|
4377
|
+
Textarea,
|
|
3569
4378
|
Toggle,
|
|
3570
4379
|
Toolbar,
|
|
3571
4380
|
ToolbarItem,
|