@dynamic-labs-sdk/droplet 1.30.3 → 1.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/collapsible/collapsible.d.ts +10 -2
- package/dist/components/ui/collapsible/collapsible.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.stories.d.ts +6 -0
- package/dist/components/ui/dialog/dialog.stories.d.ts.map +1 -1
- package/dist/components/ui/field/field.d.ts +7 -6
- package/dist/components/ui/field/field.d.ts.map +1 -1
- package/dist/components/ui/field/field.stories.d.ts +1 -4
- package/dist/components/ui/field/field.stories.d.ts.map +1 -1
- package/dist/index.cjs +37 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +37 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/styles/globals.css +13 -0
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
import { type ComponentProps, type ReactElement } from 'react';
|
|
1
|
+
import { type ComponentProps, type FC, type ReactElement } from 'react';
|
|
2
2
|
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
3
3
|
declare const Collapsible: ({ ...props }: ComponentProps<typeof CollapsiblePrimitive.Root>) => ReactElement;
|
|
4
|
-
|
|
4
|
+
export type CollapsibleTriggerProps = ComponentProps<typeof CollapsiblePrimitive.CollapsibleTrigger>;
|
|
5
|
+
/**
|
|
6
|
+
* The clickable header that opens and closes a `Collapsible`.
|
|
7
|
+
*
|
|
8
|
+
* Pass `asChild` to render your own element. The trigger suppresses the press-scale a
|
|
9
|
+
* `Button` child would otherwise bring, unless an `active:scale-*` is set explicitly on the
|
|
10
|
+
* trigger or on that child.
|
|
11
|
+
*/
|
|
12
|
+
declare const CollapsibleTrigger: FC<CollapsibleTriggerProps>;
|
|
5
13
|
declare const CollapsibleContent: ({ className, ...props }: ComponentProps<typeof CollapsiblePrimitive.CollapsibleContent>) => ReactElement;
|
|
6
14
|
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|
|
7
15
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/collapsible/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/collapsible/collapsible.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,EAAE,EACP,KAAK,YAAY,EAGlB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,oBAAoB,MAAM,6BAA6B,CAAC;AAIpE,QAAA,MAAM,WAAW,iBAEd,cAAc,CAAC,OAAO,oBAAoB,CAAC,IAAI,CAAC,KAAG,YAErD,CAAC;AA8BF,MAAM,MAAM,uBAAuB,GAAG,cAAc,CAClD,OAAO,oBAAoB,CAAC,kBAAkB,CAC/C,CAAC;AAEF;;;;;;GAMG;AACH,QAAA,MAAM,kBAAkB,EAAE,EAAE,CAAC,uBAAuB,CAsBnD,CAAC;AAEF,QAAA,MAAM,kBAAkB,4BAGrB,cAAc,CACf,OAAO,oBAAoB,CAAC,kBAAkB,CAC/C,KAAG,YAWH,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dialog/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAEL,OAAO,EACP,WAAW,EACX,OAAO,EAGP,KAAK,EAEN,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE;;;;;GAKG;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,4BAGb,cAAc,CAAC,KAAK,CAAC,KAAG,YAM1B,CAAC;AAEF,QAAA,MAAM,YAAY,uDAKf,cAAc,CAAC,KAAK,CAAC,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,KAAG,YAgB1D,CAAC;AAEF,QAAA,MAAM,WAAW,4BAGd,cAAc,CAAC,OAAO,KAAK,CAAC,KAAG,YASjC,CAAC;AAEF,QAAA,MAAM,iBAAiB,4BAGpB,cAAc,CAAC,OAAO,WAAW,CAAC,KAAG,YAMvC,CAAC;AAEF,OAAO,EACL,MAAM,EACN,UAAU,EACV,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAC"}
|
|
@@ -12,4 +12,10 @@ export default meta;
|
|
|
12
12
|
type Story = StoryObj<typeof meta>;
|
|
13
13
|
export declare const Default: Story;
|
|
14
14
|
export declare const LocalDraftState: Story;
|
|
15
|
+
/**
|
|
16
|
+
* A visible description long enough to wrap, giving the Dialog a two-line header. This is the
|
|
17
|
+
* case that shows the close button holding the top-right corner instead of following the
|
|
18
|
+
* header's vertical centre, which the one-line and `sr-only` stories cannot exercise.
|
|
19
|
+
*/
|
|
20
|
+
export declare const WrappingDescription: Story;
|
|
15
21
|
//# sourceMappingURL=dialog.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dialog/dialog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAiB5D,QAAA,MAAM,IAAI;;;;;;;CAKqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAoCrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAwD7B,CAAC"}
|
|
1
|
+
{"version":3,"file":"dialog.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dialog/dialog.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAiB5D,QAAA,MAAM,IAAI;;;;;;;CAKqB,CAAC;AAEhC,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAoCrB,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAwD7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,KA6BjC,CAAC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
2
|
type FieldProps = {
|
|
3
3
|
/** The form control(s) to render inside the field wrapper. */
|
|
4
4
|
children: ReactNode;
|
|
5
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Extra class names merged onto the outer grid wrapper. The label, the
|
|
7
|
+
* control(s), the description and the error stay direct children of that
|
|
8
|
+
* wrapper, so column, flex and direct-child utilities apply to each of them.
|
|
9
|
+
*/
|
|
6
10
|
className?: string;
|
|
7
11
|
/** Secondary helper text rendered below the control. */
|
|
8
12
|
description?: ReactNode;
|
|
@@ -51,10 +55,7 @@ type FieldProps = {
|
|
|
51
55
|
* </Field>
|
|
52
56
|
* ```
|
|
53
57
|
*/
|
|
54
|
-
declare const Field:
|
|
55
|
-
({ label, description, error, required, htmlFor, children, className, }: FieldProps): ReactElement;
|
|
56
|
-
displayName: string;
|
|
57
|
-
};
|
|
58
|
+
declare const Field: FC<FieldProps>;
|
|
58
59
|
export { Field };
|
|
59
60
|
export type { FieldProps };
|
|
60
61
|
//# sourceMappingURL=field.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/field/field.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,
|
|
1
|
+
{"version":3,"file":"field.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/field/field.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAY,KAAK,EAAE,EAAE,KAAK,SAAS,EAAuC,MAAM,OAAO,CAAC;AAK/F,KAAK,UAAU,GAAG;IAChB,8DAA8D;IAC9D,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAYF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,KAAK,EAAE,EAAE,CAAC,UAAU,CAkFzB,CAAC;AAIF,OAAO,EAAE,KAAK,EAAE,CAAC;AACjB,YAAY,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -4,10 +4,7 @@ declare const meta: {
|
|
|
4
4
|
args: {
|
|
5
5
|
children: null;
|
|
6
6
|
};
|
|
7
|
-
component:
|
|
8
|
-
({ label, description, error, required, htmlFor, children, className, }: import("./field").FieldProps): React.ReactElement;
|
|
9
|
-
displayName: string;
|
|
10
|
-
};
|
|
7
|
+
component: React.FC<import("./field").FieldProps>;
|
|
11
8
|
parameters: {
|
|
12
9
|
layout: string;
|
|
13
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/field/field.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"field.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/field/field.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAM5D,QAAA,MAAM,IAAI;;;;;;;;;;CAOoB,CAAC;AAE/B,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,KAQrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAQtB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,KAevB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,KAkC5B,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -900,11 +900,29 @@ const Collapsible = ({ ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)
|
|
|
900
900
|
"data-slot": "collapsible",
|
|
901
901
|
...props
|
|
902
902
|
});
|
|
903
|
-
const
|
|
903
|
+
const PRESS_SCALE_CANCEL_CLASS_NAME = "active:scale-100";
|
|
904
|
+
const PRESS_SCALE_CLASS_NAME_PATTERN = /(^|[\s:])active:scale-/;
|
|
905
|
+
const hasPressScale = (className) => className !== void 0 && PRESS_SCALE_CLASS_NAME_PATTERN.test(className);
|
|
906
|
+
const hasChildPressScale = (children) => {
|
|
907
|
+
if (!(0, react.isValidElement)(children)) return false;
|
|
908
|
+
return hasPressScale(children.props.className);
|
|
909
|
+
};
|
|
910
|
+
/**
|
|
911
|
+
* The clickable header that opens and closes a `Collapsible`.
|
|
912
|
+
*
|
|
913
|
+
* Pass `asChild` to render your own element. The trigger suppresses the press-scale a
|
|
914
|
+
* `Button` child would otherwise bring, unless an `active:scale-*` is set explicitly on the
|
|
915
|
+
* trigger or on that child.
|
|
916
|
+
*/
|
|
917
|
+
const CollapsibleTrigger = ({ className, children, ...props }) => {
|
|
918
|
+
const keepsCallerPressScale = hasPressScale(className) || hasChildPressScale(children);
|
|
919
|
+
let pressScaleClassName = PRESS_SCALE_CANCEL_CLASS_NAME;
|
|
920
|
+
if (keepsCallerPressScale) pressScaleClassName = "";
|
|
904
921
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_collapsible.CollapsibleTrigger, {
|
|
905
922
|
"data-slot": "collapsible-trigger",
|
|
906
|
-
className: require_toggle_row.cn("touch-manipulation", className),
|
|
907
|
-
...props
|
|
923
|
+
className: require_toggle_row.cn("touch-manipulation", pressScaleClassName, className),
|
|
924
|
+
...props,
|
|
925
|
+
children
|
|
908
926
|
});
|
|
909
927
|
};
|
|
910
928
|
const CollapsibleContent = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_collapsible.CollapsibleContent, {
|
|
@@ -948,13 +966,23 @@ const DialogContent = ({ className, children, tray = "auto", ...props }) => {
|
|
|
948
966
|
})]
|
|
949
967
|
});
|
|
950
968
|
};
|
|
969
|
+
/**
|
|
970
|
+
* The close button is pinned to the top-right corner, matching Sheet's `top-3 right-3`.
|
|
971
|
+
* A fixed inset keeps it in the corner whatever the header's height, so a title plus a
|
|
972
|
+
* wrapping description cannot push it down over the text.
|
|
973
|
+
*
|
|
974
|
+
* top-3 (12px) puts the 28px button's centre at 26px; the 17px leading-none title starts
|
|
975
|
+
* after the header's 16px padding, so its centre is 24.5px. 1.5px low is imperceptible and
|
|
976
|
+
* consistency with Sheet is worth more than the half-pixel.
|
|
977
|
+
*/
|
|
978
|
+
const CLOSE_BUTTON_CLASS_NAME = "absolute top-3 right-3 inline-flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground opacity-70 transition-[opacity,background-color] duration-150 ease-out motion-reduce:transition-none hover:opacity-100 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50 focus:outline-hidden cursor-pointer touch-manipulation before:absolute before:-inset-[8px] before:content-[\"\"]";
|
|
951
979
|
const DialogHeader = ({ className, showCloseButton = true, children, ...props }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
952
980
|
"data-slot": "dialog-header",
|
|
953
|
-
className: require_toggle_row.cn("relative flex flex-col gap-0.5 px-4 py-4 border-b border-[var(--border-hairline)] bg-card sm:text-left", className),
|
|
981
|
+
className: require_toggle_row.cn("relative flex flex-col gap-0.5 px-4 py-4 border-b border-[var(--border-hairline)] bg-card sm:text-left", showCloseButton && "pr-12", className),
|
|
954
982
|
...props,
|
|
955
983
|
children: [children, showCloseButton && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_radix_ui_react_dialog.Close, {
|
|
956
984
|
"data-slot": "dialog-close",
|
|
957
|
-
className:
|
|
985
|
+
className: CLOSE_BUTTON_CLASS_NAME,
|
|
958
986
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_hugeicons_react.HugeiconsIcon, {
|
|
959
987
|
icon: _hugeicons_core_free_icons.Cancel01Icon,
|
|
960
988
|
size: 14
|
|
@@ -1394,6 +1422,7 @@ const Icon = (props) => {
|
|
|
1394
1422
|
|
|
1395
1423
|
//#endregion
|
|
1396
1424
|
//#region src/components/ui/field/field.tsx
|
|
1425
|
+
const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-field-gap))]";
|
|
1397
1426
|
/**
|
|
1398
1427
|
* A generic labeled form-field wrapper.
|
|
1399
1428
|
*
|
|
@@ -1435,10 +1464,12 @@ const Field = ({ label, description, error, required, htmlFor, children, classNa
|
|
|
1435
1464
|
...error ? { "aria-invalid": true } : {}
|
|
1436
1465
|
}) : null;
|
|
1437
1466
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1438
|
-
className: require_toggle_row.cn("grid gap-
|
|
1467
|
+
className: require_toggle_row.cn("grid gap-field-gap", className),
|
|
1439
1468
|
children: [
|
|
1440
1469
|
label && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_toggle_row.Label, {
|
|
1441
1470
|
htmlFor: controlId,
|
|
1471
|
+
"data-slot": "field-label",
|
|
1472
|
+
className: LABEL_GAP_CLASS_NAME,
|
|
1442
1473
|
children: [label, required && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1443
1474
|
"aria-hidden": true,
|
|
1444
1475
|
className: "ml-0.5 text-[var(--text-danger)]",
|