@dynamic-labs-sdk/droplet 1.31.0 → 1.31.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/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
package/dist/index.esm.js
CHANGED
|
@@ -865,11 +865,29 @@ const Collapsible = ({ ...props }) => /* @__PURE__ */ jsx(CollapsiblePrimitive.R
|
|
|
865
865
|
"data-slot": "collapsible",
|
|
866
866
|
...props
|
|
867
867
|
});
|
|
868
|
-
const
|
|
868
|
+
const PRESS_SCALE_CANCEL_CLASS_NAME = "active:scale-100";
|
|
869
|
+
const PRESS_SCALE_CLASS_NAME_PATTERN = /(^|[\s:])active:scale-/;
|
|
870
|
+
const hasPressScale = (className) => className !== void 0 && PRESS_SCALE_CLASS_NAME_PATTERN.test(className);
|
|
871
|
+
const hasChildPressScale = (children) => {
|
|
872
|
+
if (!isValidElement(children)) return false;
|
|
873
|
+
return hasPressScale(children.props.className);
|
|
874
|
+
};
|
|
875
|
+
/**
|
|
876
|
+
* The clickable header that opens and closes a `Collapsible`.
|
|
877
|
+
*
|
|
878
|
+
* Pass `asChild` to render your own element. The trigger suppresses the press-scale a
|
|
879
|
+
* `Button` child would otherwise bring, unless an `active:scale-*` is set explicitly on the
|
|
880
|
+
* trigger or on that child.
|
|
881
|
+
*/
|
|
882
|
+
const CollapsibleTrigger = ({ className, children, ...props }) => {
|
|
883
|
+
const keepsCallerPressScale = hasPressScale(className) || hasChildPressScale(children);
|
|
884
|
+
let pressScaleClassName = PRESS_SCALE_CANCEL_CLASS_NAME;
|
|
885
|
+
if (keepsCallerPressScale) pressScaleClassName = "";
|
|
869
886
|
return /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleTrigger, {
|
|
870
887
|
"data-slot": "collapsible-trigger",
|
|
871
|
-
className: cn("touch-manipulation", className),
|
|
872
|
-
...props
|
|
888
|
+
className: cn("touch-manipulation", pressScaleClassName, className),
|
|
889
|
+
...props,
|
|
890
|
+
children
|
|
873
891
|
});
|
|
874
892
|
};
|
|
875
893
|
const CollapsibleContent = ({ className, ...props }) => /* @__PURE__ */ jsx(CollapsiblePrimitive.CollapsibleContent, {
|
|
@@ -913,13 +931,23 @@ const DialogContent = ({ className, children, tray = "auto", ...props }) => {
|
|
|
913
931
|
})]
|
|
914
932
|
});
|
|
915
933
|
};
|
|
934
|
+
/**
|
|
935
|
+
* The close button is pinned to the top-right corner, matching Sheet's `top-3 right-3`.
|
|
936
|
+
* A fixed inset keeps it in the corner whatever the header's height, so a title plus a
|
|
937
|
+
* wrapping description cannot push it down over the text.
|
|
938
|
+
*
|
|
939
|
+
* top-3 (12px) puts the 28px button's centre at 26px; the 17px leading-none title starts
|
|
940
|
+
* after the header's 16px padding, so its centre is 24.5px. 1.5px low is imperceptible and
|
|
941
|
+
* consistency with Sheet is worth more than the half-pixel.
|
|
942
|
+
*/
|
|
943
|
+
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-[\"\"]";
|
|
916
944
|
const DialogHeader = ({ className, showCloseButton = true, children, ...props }) => /* @__PURE__ */ jsxs("div", {
|
|
917
945
|
"data-slot": "dialog-header",
|
|
918
|
-
className: cn("relative flex flex-col gap-0.5 px-4 py-4 border-b border-[var(--border-hairline)] bg-card sm:text-left", className),
|
|
946
|
+
className: 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),
|
|
919
947
|
...props,
|
|
920
948
|
children: [children, showCloseButton && /* @__PURE__ */ jsxs(Close, {
|
|
921
949
|
"data-slot": "dialog-close",
|
|
922
|
-
className:
|
|
950
|
+
className: CLOSE_BUTTON_CLASS_NAME,
|
|
923
951
|
children: [/* @__PURE__ */ jsx(HugeiconsIcon, {
|
|
924
952
|
icon: Cancel01Icon,
|
|
925
953
|
size: 14
|
|
@@ -1359,6 +1387,7 @@ const Icon = (props) => {
|
|
|
1359
1387
|
|
|
1360
1388
|
//#endregion
|
|
1361
1389
|
//#region src/components/ui/field/field.tsx
|
|
1390
|
+
const LABEL_GAP_CLASS_NAME = "mb-[calc(var(--spacing-label-gap)-var(--spacing-field-gap))]";
|
|
1362
1391
|
/**
|
|
1363
1392
|
* A generic labeled form-field wrapper.
|
|
1364
1393
|
*
|
|
@@ -1400,10 +1429,12 @@ const Field = ({ label, description, error, required, htmlFor, children, classNa
|
|
|
1400
1429
|
...error ? { "aria-invalid": true } : {}
|
|
1401
1430
|
}) : null;
|
|
1402
1431
|
return /* @__PURE__ */ jsxs("div", {
|
|
1403
|
-
className: cn("grid gap-
|
|
1432
|
+
className: cn("grid gap-field-gap", className),
|
|
1404
1433
|
children: [
|
|
1405
1434
|
label && /* @__PURE__ */ jsxs(Label, {
|
|
1406
1435
|
htmlFor: controlId,
|
|
1436
|
+
"data-slot": "field-label",
|
|
1437
|
+
className: LABEL_GAP_CLASS_NAME,
|
|
1407
1438
|
children: [label, required && /* @__PURE__ */ jsx("span", {
|
|
1408
1439
|
"aria-hidden": true,
|
|
1409
1440
|
className: "ml-0.5 text-[var(--text-danger)]",
|