@namroodinc/liquid-editorial 0.4.1 → 0.5.0
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/README.md +13 -5
- package/UPGRADING.md +142 -0
- package/dist/chunks/{Board-BaQ04nWg.cjs → Board-BPA6mVhf.cjs} +2 -2
- package/dist/chunks/{Board-BaQ04nWg.cjs.map → Board-BPA6mVhf.cjs.map} +1 -1
- package/dist/chunks/{Board-CUhF8pTX.js → Board-CcIF7jS0.js} +2 -2
- package/dist/chunks/{Board-CUhF8pTX.js.map → Board-CcIF7jS0.js.map} +1 -1
- package/dist/chunks/{ColourField-CJicr3OT.cjs → ColourField-BQ4a5tAV.cjs} +2 -2
- package/dist/chunks/{ColourField-CJicr3OT.cjs.map → ColourField-BQ4a5tAV.cjs.map} +1 -1
- package/dist/chunks/{ColourField-DjHRiFDU.js → ColourField-Doew1hLw.js} +3 -3
- package/dist/chunks/{ColourField-DjHRiFDU.js.map → ColourField-Doew1hLw.js.map} +1 -1
- package/dist/chunks/{DatePicker-aSlYLjtW.cjs → DatePicker-C0-609Zx.cjs} +2 -2
- package/dist/chunks/{DatePicker-aSlYLjtW.cjs.map → DatePicker-C0-609Zx.cjs.map} +1 -1
- package/dist/chunks/{DatePicker-D_6CQpUd.js → DatePicker-DmeWUsOS.js} +2 -2
- package/dist/chunks/{DatePicker-D_6CQpUd.js.map → DatePicker-DmeWUsOS.js.map} +1 -1
- package/dist/chunks/{FormEditor-CaskinQ1.js → FormEditor-DTnFO4oS.js} +170 -154
- package/dist/chunks/FormEditor-DTnFO4oS.js.map +1 -0
- package/dist/chunks/FormEditor-DfQLJnsO.cjs +2 -0
- package/dist/chunks/FormEditor-DfQLJnsO.cjs.map +1 -0
- package/dist/chunks/Icon-D1kx7-1c.js +81 -0
- package/dist/chunks/Icon-D1kx7-1c.js.map +1 -0
- package/dist/chunks/Icon-D38lQXNe.cjs +2 -0
- package/dist/chunks/Icon-D38lQXNe.cjs.map +1 -0
- package/dist/chunks/RichTextEditor-DEJ-u-ZR.js +483 -0
- package/dist/chunks/RichTextEditor-DEJ-u-ZR.js.map +1 -0
- package/dist/chunks/RichTextEditor-Ddk7qaqg.cjs +2 -0
- package/dist/chunks/RichTextEditor-Ddk7qaqg.cjs.map +1 -0
- package/dist/chunks/movableHost-CajG9_5Z.cjs +2 -0
- package/dist/chunks/movableHost-CajG9_5Z.cjs.map +1 -0
- package/dist/chunks/movableHost-NJj_FsAu.js +23 -0
- package/dist/chunks/movableHost-NJj_FsAu.js.map +1 -0
- package/dist/chunks/portalScope-AzzPM54i.js +105 -0
- package/dist/chunks/portalScope-AzzPM54i.js.map +1 -0
- package/dist/chunks/portalScope-BVA1-Ypu.cjs +2 -0
- package/dist/chunks/portalScope-BVA1-Ypu.cjs.map +1 -0
- package/dist/chunks/useModalDialog-BVaG--b3.js +87 -0
- package/dist/chunks/useModalDialog-BVaG--b3.js.map +1 -0
- package/dist/chunks/useModalDialog-Ctu270Dp.cjs +2 -0
- package/dist/chunks/useModalDialog-Ctu270Dp.cjs.map +1 -0
- package/dist/components/AssetCard/index.cjs +1 -1
- package/dist/components/AssetCard/index.js +1 -1
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.js +1 -1
- package/dist/components/Board/index.cjs +1 -1
- package/dist/components/Board/index.js +1 -1
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.js +1 -1
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.d.cts.map +1 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +59 -75
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Drawer/style.css +3 -0
- package/dist/components/EditLayout/index.cjs +1 -1
- package/dist/components/EditLayout/index.cjs.map +1 -1
- package/dist/components/EditLayout/index.d.cts.map +1 -1
- package/dist/components/EditLayout/index.d.ts.map +1 -1
- package/dist/components/EditLayout/index.js +107 -121
- package/dist/components/EditLayout/index.js.map +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.js +1 -1
- package/dist/components/FormEditor/README.md +74 -3
- package/dist/components/FormEditor/control.d.cts.map +1 -1
- package/dist/components/FormEditor/control.d.ts.map +1 -1
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.d.cts.map +1 -1
- package/dist/components/FormEditor/index.d.ts.map +1 -1
- package/dist/components/FormEditor/index.js +2 -1
- package/dist/components/FormEditor/model.d.cts +6 -0
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +6 -0
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/FormEditor/style.css +7 -0
- package/dist/components/Icon/icons.d.cts +2 -0
- package/dist/components/Icon/icons.d.cts.map +1 -1
- package/dist/components/Icon/icons.d.ts +2 -0
- package/dist/components/Icon/icons.d.ts.map +1 -1
- package/dist/components/Icon/index.cjs +1 -1
- package/dist/components/Icon/index.js +1 -1
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.d.cts +9 -1
- package/dist/components/Modal/index.d.cts.map +1 -1
- package/dist/components/Modal/index.d.ts +9 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +37 -45
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Modal/style.css +8 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.d.cts.map +1 -1
- package/dist/components/Popover/index.d.ts.map +1 -1
- package/dist/components/Popover/index.js +44 -37
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Popover/style.css +3 -0
- package/dist/components/RichTextEditor/expanded-width.d.cts +4 -0
- package/dist/components/RichTextEditor/expanded-width.d.cts.map +1 -0
- package/dist/components/RichTextEditor/expanded-width.d.ts +4 -0
- package/dist/components/RichTextEditor/expanded-width.d.ts.map +1 -0
- package/dist/components/RichTextEditor/expansion.d.cts +28 -0
- package/dist/components/RichTextEditor/expansion.d.cts.map +1 -0
- package/dist/components/RichTextEditor/expansion.d.ts +28 -0
- package/dist/components/RichTextEditor/expansion.d.ts.map +1 -0
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts +4 -4
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts +4 -4
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/RichTextEditor/style.css +85 -4
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.js +1 -1
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.js +1 -1
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.js +1 -1
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.js +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.js +1 -1
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.js +1 -1
- package/dist/components/Table/index.cjs +1 -1
- package/dist/components/Table/index.js +1 -1
- package/dist/components/Toast/index.cjs +1 -1
- package/dist/components/Toast/index.js +1 -1
- package/dist/components/TopNav/index.cjs +1 -1
- package/dist/components/TopNav/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -30
- package/dist/internal/dialogFocus.d.cts +8 -0
- package/dist/internal/dialogFocus.d.cts.map +1 -1
- package/dist/internal/dialogFocus.d.ts +8 -0
- package/dist/internal/dialogFocus.d.ts.map +1 -1
- package/dist/internal/movableHost.d.cts +20 -0
- package/dist/internal/movableHost.d.cts.map +1 -0
- package/dist/internal/movableHost.d.ts +20 -0
- package/dist/internal/movableHost.d.ts.map +1 -0
- package/dist/internal/portalScope.d.cts +23 -0
- package/dist/internal/portalScope.d.cts.map +1 -0
- package/dist/internal/portalScope.d.ts +23 -0
- package/dist/internal/portalScope.d.ts.map +1 -0
- package/dist/internal/useModalDialog.d.cts +22 -0
- package/dist/internal/useModalDialog.d.cts.map +1 -0
- package/dist/internal/useModalDialog.d.ts +22 -0
- package/dist/internal/useModalDialog.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/chunks/FormEditor-CaskinQ1.js.map +0 -1
- package/dist/chunks/FormEditor-DDylpJ9O.cjs +0 -2
- package/dist/chunks/FormEditor-DDylpJ9O.cjs.map +0 -1
- package/dist/chunks/Icon-BBoWP_Y6.cjs +0 -2
- package/dist/chunks/Icon-BBoWP_Y6.cjs.map +0 -1
- package/dist/chunks/Icon-XNismJDm.js +0 -79
- package/dist/chunks/Icon-XNismJDm.js.map +0 -1
- package/dist/chunks/RichTextEditor-C7nMfDmE.cjs +0 -2
- package/dist/chunks/RichTextEditor-C7nMfDmE.cjs.map +0 -1
- package/dist/chunks/RichTextEditor-DjR10XJ-.js +0 -370
- package/dist/chunks/RichTextEditor-DjR10XJ-.js.map +0 -1
- package/dist/chunks/dialogFocus-B9iqKl3I.cjs +0 -2
- package/dist/chunks/dialogFocus-B9iqKl3I.cjs.map +0 -1
- package/dist/chunks/dialogFocus-BFoyeTpA.js +0 -48
- package/dist/chunks/dialogFocus-BFoyeTpA.js.map +0 -1
- package/dist/chunks/dialogStack-6yv3NXFD.js +0 -43
- package/dist/chunks/dialogStack-6yv3NXFD.js.map +0 -1
- package/dist/chunks/dialogStack-C9SLVu6Q.cjs +0 -2
- package/dist/chunks/dialogStack-C9SLVu6Q.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,YAAY,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,cAAc,CAAC,cAAc,CAAC,EAC9B,cAAc,GAAG,UAAU,CAC5B;IACC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACjE,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1C,sEAAsE;IACtE,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0GAA0G;IAC1G,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAoED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,KAAK,EACL,YAAiB,EACjB,aAAa,EACb,WAAgB,EAChB,MAAW,EACX,UAAkB,EAClB,aAAqB,EACrB,OAAW,EACX,cAAwB,EACxB,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,eAAe,+BAwEjB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAOL,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,UAAU,EAChB,MAAM,SAAS,CAAC;AACjB,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7C,YAAY,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACX,QAAQ,EACR,UAAU,EACV,UAAU,EACV,cAAc,EACd,UAAU,EACV,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAC3C,cAAc,CAAC,cAAc,CAAC,EAC9B,cAAc,GAAG,UAAU,CAC5B;IACC,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,UAAU,CAAC;IACnB,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IACjE,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IAC1C,sEAAsE;IACtE,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0GAA0G;IAC1G,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAoED,qFAAqF;AACrF,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,KAAK,EACL,YAAiB,EACjB,aAAa,EACb,WAAgB,EAChB,MAAW,EACX,UAAkB,EAClB,aAAqB,EACrB,OAAW,EACX,cAAwB,EACxB,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,eAAe,+BAwEjB"}
|
|
@@ -2,13 +2,18 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import type { SelectOption } from "../Select/index.cjs";
|
|
3
3
|
import type { EntryPickerProps } from "../EntryPicker/index.cjs";
|
|
4
4
|
import type { RichTextDocument } from "../RichTextEditor/index.cjs";
|
|
5
|
+
import { type RichTextEditorExpandedWidth } from "../RichTextEditor/expanded-width.cjs";
|
|
5
6
|
import type { RangeSliderValue } from "../Slider/index.cjs";
|
|
6
7
|
import { type SliderScale } from "../Slider/scale.cjs";
|
|
7
8
|
import type { PopoverPlacement } from "../Popover/index.cjs";
|
|
9
|
+
/** The shared measures a field may cap at; checked against Container's scale. */
|
|
10
|
+
declare const fieldWidths: readonly ["sm", "md", "lg"];
|
|
8
11
|
interface FormFieldBase {
|
|
9
12
|
id: string;
|
|
10
13
|
label: string;
|
|
11
14
|
hint?: ReactNode;
|
|
15
|
+
/** Maximum width of the whole field, using Container's measures and its `lg` default. */
|
|
16
|
+
width?: (typeof fieldWidths)[number];
|
|
12
17
|
placeholder?: string;
|
|
13
18
|
required?: boolean;
|
|
14
19
|
isDisabled?: boolean;
|
|
@@ -50,6 +55,7 @@ export type FormField = FormFieldBase & ({
|
|
|
50
55
|
multiple?: never;
|
|
51
56
|
} | {
|
|
52
57
|
type: "richText";
|
|
58
|
+
expandedWidth?: RichTextEditorExpandedWidth;
|
|
53
59
|
autoFocus?: never;
|
|
54
60
|
multiple?: never;
|
|
55
61
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAkB,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAyC,KAAK,WA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,EAAE,CAInD;AAgED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAIlF;AAED,qGAAqG;AACrG,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,GAAG,gBAAgB,GAAG,SAAS,CASjG;AA6ED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAK/E;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAcjG"}
|
|
@@ -2,13 +2,18 @@ import type { ReactNode } from "react";
|
|
|
2
2
|
import type { SelectOption } from "../Select/index.js";
|
|
3
3
|
import type { EntryPickerProps } from "../EntryPicker/index.js";
|
|
4
4
|
import type { RichTextDocument } from "../RichTextEditor/index.js";
|
|
5
|
+
import { type RichTextEditorExpandedWidth } from "../RichTextEditor/expanded-width.js";
|
|
5
6
|
import type { RangeSliderValue } from "../Slider/index.js";
|
|
6
7
|
import { type SliderScale } from "../Slider/scale.js";
|
|
7
8
|
import type { PopoverPlacement } from "../Popover/index.js";
|
|
9
|
+
/** The shared measures a field may cap at; checked against Container's scale. */
|
|
10
|
+
declare const fieldWidths: readonly ["sm", "md", "lg"];
|
|
8
11
|
interface FormFieldBase {
|
|
9
12
|
id: string;
|
|
10
13
|
label: string;
|
|
11
14
|
hint?: ReactNode;
|
|
15
|
+
/** Maximum width of the whole field, using Container's measures and its `lg` default. */
|
|
16
|
+
width?: (typeof fieldWidths)[number];
|
|
12
17
|
placeholder?: string;
|
|
13
18
|
required?: boolean;
|
|
14
19
|
isDisabled?: boolean;
|
|
@@ -50,6 +55,7 @@ export type FormField = FormFieldBase & ({
|
|
|
50
55
|
multiple?: never;
|
|
51
56
|
} | {
|
|
52
57
|
type: "richText";
|
|
58
|
+
expandedWidth?: RichTextEditorExpandedWidth;
|
|
53
59
|
autoFocus?: never;
|
|
54
60
|
multiple?: never;
|
|
55
61
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/components/FormEditor/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/components/FormEditor/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAkB,KAAK,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAEpG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAyC,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE1F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,iFAAiF;AACjF,QAAA,MAAM,WAAW,6BAAkE,CAAC;AAEpF,UAAU,aAAa;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,yFAAyF;IACzF,KAAK,CAAC,EAAE,CAAC,OAAO,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E,OAAO,GAAG,MAAM,GAAG,SAAS,CAK/E;AAED,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,UAAU,CAcjG"}
|
|
@@ -25,6 +25,13 @@
|
|
|
25
25
|
grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--form-editor-min-column)), 1fr));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
/* Reuse Container's measure without containment, preserving content-sized
|
|
29
|
+
* forms, viewport-fixed drag overlays and descendant container queries. */
|
|
30
|
+
.ds-container.ds-form-editor__field {
|
|
31
|
+
container-type: normal;
|
|
32
|
+
container-name: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
.ds-form-editor__divider {
|
|
29
36
|
grid-column: 1 / -1;
|
|
30
37
|
inline-size: 100%;
|
|
@@ -41,6 +41,8 @@ export declare const icons: {
|
|
|
41
41
|
readonly home: import("lucide-react").LucideIcon;
|
|
42
42
|
readonly "layout-grid": import("lucide-react").LucideIcon;
|
|
43
43
|
readonly menu: import("lucide-react").LucideIcon;
|
|
44
|
+
readonly "maximize-2": import("lucide-react").LucideIcon;
|
|
45
|
+
readonly "minimize-2": import("lucide-react").LucideIcon;
|
|
44
46
|
readonly users: import("lucide-react").LucideIcon;
|
|
45
47
|
readonly "grip-horizontal": import("lucide-react").LucideIcon;
|
|
46
48
|
readonly "grip-vertical": import("lucide-react").LucideIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.cts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.d.cts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"AA8DA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DR,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAyB,QAAQ,EAAE,CAAC"}
|
|
@@ -41,6 +41,8 @@ export declare const icons: {
|
|
|
41
41
|
readonly home: import("lucide-react").LucideIcon;
|
|
42
42
|
readonly "layout-grid": import("lucide-react").LucideIcon;
|
|
43
43
|
readonly menu: import("lucide-react").LucideIcon;
|
|
44
|
+
readonly "maximize-2": import("lucide-react").LucideIcon;
|
|
45
|
+
readonly "minimize-2": import("lucide-react").LucideIcon;
|
|
44
46
|
readonly users: import("lucide-react").LucideIcon;
|
|
45
47
|
readonly "grip-horizontal": import("lucide-react").LucideIcon;
|
|
46
48
|
readonly "grip-vertical": import("lucide-react").LucideIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/icons.ts"],"names":[],"mappings":"AA8DA;;;GAGG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4DR,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,KAAK,CAAC;AAE1C,eAAO,MAAM,SAAS,EAAyB,QAAQ,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-D38lQXNe.cjs");exports.Icon=e.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as Icon } from "../../chunks/Icon-
|
|
1
|
+
export { t as Icon } from "../../chunks/Icon-D1kx7-1c.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/mergeRefs-Bc3qS0Tt.cjs"),n=require("../../chunks/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../../chunks/mergeRefs-Bc3qS0Tt.cjs"),n=require("../../chunks/useModalDialog-Ctu270Dp.cjs"),r=require("../../chunks/portalScope-BVA1-Ypu.cjs");let i=require("react"),a=require("react-dom"),o=require("react/jsx-runtime");var s=(0,i.forwardRef)(function({isOpen:s,onClose:c,title:l,description:u,size:d=`md`,hasHeader:f=!0,footer:p,className:m,children:h,...g},_){let v=(0,i.useRef)(null),y=(0,i.useRef)(null),b=(0,i.useId)(),x=(0,i.useId)(),{onScrimMouseDown:S}=n.t({isOpen:s,panelRef:v,onClose:c});return r.n(y,s),!s||typeof document>`u`?null:(0,a.createPortal)((0,o.jsx)(`div`,{ref:y,className:`ds-scrim`,onMouseDown:S,children:(0,o.jsxs)(`div`,{...g,ref:t.t(v,_),role:`dialog`,"aria-modal":`true`,"aria-labelledby":g[`aria-label`]?void 0:g[`aria-labelledby`]??b,"aria-describedby":u?x:g[`aria-describedby`],tabIndex:-1,"data-size":d,className:[`ds-modal`,m].filter(Boolean).join(` `),children:[(0,o.jsxs)(`header`,{className:`ds-modal__head`,hidden:!f,children:[(0,o.jsxs)(`div`,{className:`ds-modal__titles`,children:[(0,o.jsx)(`h2`,{id:b,className:`ds-modal__title`,children:l}),u&&(0,o.jsx)(`p`,{id:x,className:`ds-modal__description`,children:u})]}),f&&(0,o.jsx)(e.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,"aria-label":`Close`,className:`ds-modal__close`,onClick:c})]}),(0,o.jsx)(`div`,{className:`ds-modal__body`,children:h}),p&&(0,o.jsx)(`footer`,{className:`ds-modal__footer`,children:p})]})}),document.body)});exports.Modal=s;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","useId","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","useId","useModalDialog","createPortal","mergeRefs","Button","require_components_Button_index","require_mergeRefs","require_useModalDialog","require_portalScope","react","react_dom","react_jsx_runtime","Modal","rest","panelRef","scrimRef","titleId","descriptionId","isOpen","onScrimMouseDown","ref","description","size","className","hasHeader","title","onClose","footer"],"sources":["../../../src/components/Modal/index.tsx"],"sourcesContent":["import { forwardRef, useId, useRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type ModalSize = \"dialog\" | \"md\" | \"wide\" | \"full\";\n\nexport interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n /** Names the dialog. `aria-label` or `aria-labelledby` replace it as the name. */\n title: string;\n description?: string;\n /** `full` fills the viewport inside the scrim's gutters. */\n size?: ModalSize;\n /**\n * Show the title band and its Close button. Without it the title and\n * description still name and describe the dialog; give people another\n * visible way to close it.\n */\n hasHeader?: boolean;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A focused task on top of the page. Heavy frame, hairline rules, a quiet\n * footer band — the collection frame, floated. Focus is trapped while open.\n */\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\n {\n isOpen,\n onClose,\n title,\n description,\n size = \"md\",\n hasHeader = true,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const { onScrimMouseDown } = useModalDialog({ isOpen, panelRef, onClose });\n useInheritedPortalScope(scrimRef, isOpen);\n\n if (!isOpen || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={scrimRef}\n className=\"ds-scrim\"\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : rest[\"aria-describedby\"]}\n tabIndex={-1}\n data-size={size}\n className={[\"ds-modal\", className].filter(Boolean).join(\" \")}\n >\n <header\n className=\"ds-modal__head\"\n hidden={!hasHeader}\n >\n <div className=\"ds-modal__titles\">\n <h2\n id={titleId}\n className=\"ds-modal__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-modal__description\"\n >\n {description}\n </p>\n )}\n </div>\n {hasHeader && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n aria-label=\"Close\"\n className=\"ds-modal__close\"\n onClick={onClose}\n />\n )}\n </header>\n <div className=\"ds-modal__body\">{children}</div>\n {footer && <footer className=\"ds-modal__footer\">{footer}</footer>}\n </div>\n </div>,\n document.body,\n );\n});\n"],"mappings":"A,iVAkCA,IAAac,GAAA,EAAQd,EAAAA,WAAAA,CAAuC,SAC1D,CACE,SACA,UACA,QACA,cACA,OAAO,KACP,YAAY,GACZ,SACA,YACA,WACA,GAAGe,GAEL,EACA,CACA,IAAMC,GAAA,EAAWf,EAAAA,OAAAA,CAA8B,IAAI,EAC7CgB,GAAA,EAAWhB,EAAAA,OAAAA,CAA8B,IAAI,EAC7CiB,GAAA,EAAUhB,EAAAA,MAAAA,CAAM,EAChBiB,GAAA,EAAgBjB,EAAAA,MAAAA,CAAM,EACtB,CAAE,oBAAqBC,EAAAA,EAAe,CAAE,SAAQ,WAA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@ -1,12 +1,20 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
export type ModalSize = "dialog" | "md" | "wide";
|
|
2
|
+
export type ModalSize = "dialog" | "md" | "wide" | "full";
|
|
3
3
|
export interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
/** Escape, the scrim and the close button all call this. */
|
|
6
6
|
onClose: () => void;
|
|
7
|
+
/** Names the dialog. `aria-label` or `aria-labelledby` replace it as the name. */
|
|
7
8
|
title: string;
|
|
8
9
|
description?: string;
|
|
10
|
+
/** `full` fills the viewport inside the scrim's gutters. */
|
|
9
11
|
size?: ModalSize;
|
|
12
|
+
/**
|
|
13
|
+
* Show the title band and its Close button. Without it the title and
|
|
14
|
+
* description still name and describe the dialog; give people another
|
|
15
|
+
* visible way to close it.
|
|
16
|
+
*/
|
|
17
|
+
hasHeader?: boolean;
|
|
10
18
|
/** Actions, right-aligned. The confirming action goes last. */
|
|
11
19
|
footer?: ReactNode;
|
|
12
20
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvF,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC/E,MAAM,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,uGAiFhB,CAAC"}
|
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
export type ModalSize = "dialog" | "md" | "wide";
|
|
2
|
+
export type ModalSize = "dialog" | "md" | "wide" | "full";
|
|
3
3
|
export interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, "title"> {
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
/** Escape, the scrim and the close button all call this. */
|
|
6
6
|
onClose: () => void;
|
|
7
|
+
/** Names the dialog. `aria-label` or `aria-labelledby` replace it as the name. */
|
|
7
8
|
title: string;
|
|
8
9
|
description?: string;
|
|
10
|
+
/** `full` fills the viewport inside the scrim's gutters. */
|
|
9
11
|
size?: ModalSize;
|
|
12
|
+
/**
|
|
13
|
+
* Show the title band and its Close button. Without it the title and
|
|
14
|
+
* description still name and describe the dialog; give people another
|
|
15
|
+
* visible way to close it.
|
|
16
|
+
*/
|
|
17
|
+
hasHeader?: boolean;
|
|
10
18
|
/** Actions, right-aligned. The confirming action goes last. */
|
|
11
19
|
footer?: ReactNode;
|
|
12
20
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Modal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvF,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC/E,MAAM,EAAE,OAAO,CAAC;IAChB,4DAA4D;IAC5D,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+DAA+D;IAC/D,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,uGAiFhB,CAAC"}
|
|
@@ -1,77 +1,69 @@
|
|
|
1
1
|
import { Button as e } from "../Button/index.js";
|
|
2
2
|
import { t } from "../../chunks/mergeRefs-DGM402mE.js";
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import { forwardRef as
|
|
6
|
-
import { createPortal as
|
|
7
|
-
import { jsx as
|
|
3
|
+
import { t as n } from "../../chunks/useModalDialog-BVaG--b3.js";
|
|
4
|
+
import { n as r } from "../../chunks/portalScope-AzzPM54i.js";
|
|
5
|
+
import { forwardRef as i, useId as a, useRef as o } from "react";
|
|
6
|
+
import { createPortal as s } from "react-dom";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/Modal/index.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
let t = r(), s = (e) => {
|
|
18
|
-
t.isTopmost() && (e.key === "Escape" ? (e.preventDefault(), C.current()) : a(e, S.current));
|
|
19
|
-
};
|
|
20
|
-
document.addEventListener("keydown", s);
|
|
21
|
-
let c = n();
|
|
22
|
-
return () => {
|
|
23
|
-
document.removeEventListener("keydown", s), t.close(), c(), e?.focus();
|
|
24
|
-
};
|
|
25
|
-
}, [o]), !o || typeof document > "u" ? null : u(/* @__PURE__ */ d("div", {
|
|
9
|
+
var u = i(function({ isOpen: i, onClose: u, title: d, description: f, size: p = "md", hasHeader: m = !0, footer: h, className: g, children: _, ...v }, y) {
|
|
10
|
+
let b = o(null), x = o(null), S = a(), C = a(), { onScrimMouseDown: w } = n({
|
|
11
|
+
isOpen: i,
|
|
12
|
+
panelRef: b,
|
|
13
|
+
onClose: u
|
|
14
|
+
});
|
|
15
|
+
return r(x, i), !i || typeof document > "u" ? null : s(/* @__PURE__ */ c("div", {
|
|
16
|
+
ref: x,
|
|
26
17
|
className: "ds-scrim",
|
|
27
|
-
onMouseDown:
|
|
28
|
-
children: /* @__PURE__ */
|
|
29
|
-
...
|
|
30
|
-
ref: t(
|
|
18
|
+
onMouseDown: w,
|
|
19
|
+
children: /* @__PURE__ */ l("div", {
|
|
20
|
+
...v,
|
|
21
|
+
ref: t(b, y),
|
|
31
22
|
role: "dialog",
|
|
32
23
|
"aria-modal": "true",
|
|
33
|
-
"aria-labelledby":
|
|
34
|
-
"aria-describedby":
|
|
24
|
+
"aria-labelledby": v["aria-label"] ? void 0 : v["aria-labelledby"] ?? S,
|
|
25
|
+
"aria-describedby": f ? C : v["aria-describedby"],
|
|
35
26
|
tabIndex: -1,
|
|
36
|
-
"data-size":
|
|
37
|
-
className: ["ds-modal",
|
|
27
|
+
"data-size": p,
|
|
28
|
+
className: ["ds-modal", g].filter(Boolean).join(" "),
|
|
38
29
|
children: [
|
|
39
|
-
/* @__PURE__ */
|
|
30
|
+
/* @__PURE__ */ l("header", {
|
|
40
31
|
className: "ds-modal__head",
|
|
41
|
-
|
|
32
|
+
hidden: !m,
|
|
33
|
+
children: [/* @__PURE__ */ l("div", {
|
|
42
34
|
className: "ds-modal__titles",
|
|
43
|
-
children: [/* @__PURE__ */
|
|
44
|
-
id:
|
|
35
|
+
children: [/* @__PURE__ */ c("h2", {
|
|
36
|
+
id: S,
|
|
45
37
|
className: "ds-modal__title",
|
|
46
|
-
children:
|
|
47
|
-
}),
|
|
48
|
-
id:
|
|
38
|
+
children: d
|
|
39
|
+
}), f && /* @__PURE__ */ c("p", {
|
|
40
|
+
id: C,
|
|
49
41
|
className: "ds-modal__description",
|
|
50
|
-
children:
|
|
42
|
+
children: f
|
|
51
43
|
})]
|
|
52
|
-
}), /* @__PURE__ */
|
|
44
|
+
}), m && /* @__PURE__ */ c(e, {
|
|
53
45
|
variant: "simple",
|
|
54
46
|
size: "sm",
|
|
55
47
|
isIconOnly: !0,
|
|
56
48
|
iconStart: "x",
|
|
57
49
|
"aria-label": "Close",
|
|
58
50
|
className: "ds-modal__close",
|
|
59
|
-
onClick:
|
|
51
|
+
onClick: u
|
|
60
52
|
})]
|
|
61
53
|
}),
|
|
62
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ c("div", {
|
|
63
55
|
className: "ds-modal__body",
|
|
64
|
-
children:
|
|
56
|
+
children: _
|
|
65
57
|
}),
|
|
66
|
-
|
|
58
|
+
h && /* @__PURE__ */ c("footer", {
|
|
67
59
|
className: "ds-modal__footer",
|
|
68
|
-
children:
|
|
60
|
+
children: h
|
|
69
61
|
})
|
|
70
62
|
]
|
|
71
63
|
})
|
|
72
64
|
}), document.body);
|
|
73
65
|
});
|
|
74
66
|
//#endregion
|
|
75
|
-
export {
|
|
67
|
+
export { u as Modal };
|
|
76
68
|
|
|
77
69
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["useModalDialog","useInheritedPortalScope","Modal","forwardRef","rest","panelRef","useRef","scrimRef","titleId","useId","descriptionId","isOpen","createPortal","onScrimMouseDown","mergeRefs","ref","description","size","className","hasHeader","title","Button","onClose","footer"],"sources":["../../../src/components/Modal/index.tsx"],"sourcesContent":["import { forwardRef, useId, useRef, type HTMLAttributes, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { Button } from \"../Button\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { useModalDialog } from \"../../internal/useModalDialog\";\nimport { useInheritedPortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nexport type ModalSize = \"dialog\" | \"md\" | \"wide\" | \"full\";\n\nexport interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n isOpen: boolean;\n /** Escape, the scrim and the close button all call this. */\n onClose: () => void;\n /** Names the dialog. `aria-label` or `aria-labelledby` replace it as the name. */\n title: string;\n description?: string;\n /** `full` fills the viewport inside the scrim's gutters. */\n size?: ModalSize;\n /**\n * Show the title band and its Close button. Without it the title and\n * description still name and describe the dialog; give people another\n * visible way to close it.\n */\n hasHeader?: boolean;\n /** Actions, right-aligned. The confirming action goes last. */\n footer?: ReactNode;\n children?: ReactNode;\n}\n\n/**\n * A focused task on top of the page. Heavy frame, hairline rules, a quiet\n * footer band — the collection frame, floated. Focus is trapped while open.\n */\nexport const Modal = forwardRef<HTMLDivElement, ModalProps>(function Modal(\n {\n isOpen,\n onClose,\n title,\n description,\n size = \"md\",\n hasHeader = true,\n footer,\n className,\n children,\n ...rest\n },\n ref,\n) {\n const panelRef = useRef<HTMLDivElement | null>(null);\n const scrimRef = useRef<HTMLDivElement | null>(null);\n const titleId = useId();\n const descriptionId = useId();\n const { onScrimMouseDown } = useModalDialog({ isOpen, panelRef, onClose });\n useInheritedPortalScope(scrimRef, isOpen);\n\n if (!isOpen || typeof document === \"undefined\") {\n return null;\n }\n\n return createPortal(\n <div\n ref={scrimRef}\n className=\"ds-scrim\"\n onMouseDown={onScrimMouseDown}\n >\n <div\n {...rest}\n ref={mergeRefs(panelRef, ref)}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={rest[\"aria-label\"] ? undefined : (rest[\"aria-labelledby\"] ?? titleId)}\n aria-describedby={description ? descriptionId : rest[\"aria-describedby\"]}\n tabIndex={-1}\n data-size={size}\n className={[\"ds-modal\", className].filter(Boolean).join(\" \")}\n >\n <header\n className=\"ds-modal__head\"\n hidden={!hasHeader}\n >\n <div className=\"ds-modal__titles\">\n <h2\n id={titleId}\n className=\"ds-modal__title\"\n >\n {title}\n </h2>\n {description && (\n <p\n id={descriptionId}\n className=\"ds-modal__description\"\n >\n {description}\n </p>\n )}\n </div>\n {hasHeader && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n aria-label=\"Close\"\n className=\"ds-modal__close\"\n onClick={onClose}\n />\n )}\n </header>\n <div className=\"ds-modal__body\">{children}</div>\n {footer && <footer className=\"ds-modal__footer\">{footer}</footer>}\n </div>\n </div>,\n document.body,\n );\n});\n"],"mappings":";;;;;;;;AAkCA,IAAaE,IAAQC,EAAuC,SAC1D,EACE,WACA,YACA,UACA,gBACA,UAAO,MACP,eAAY,IACZ,WACA,cACA,aACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAWC,EAA8B,IAAI,GAC7CC,IAAWD,EAA8B,IAAI,GAC7CE,IAAUC,EAAM,GAChBC,IAAgBD,EAAM,GACtB,EAAE,wBAAqBT,EAAe;EAAE;EAAQ;EAAU;CAAQ,CAAC;CAOzE,OANAC,EAAwBM,GAAUI,CAAM,GAEpC,CAACA,KAAU,OAAO,WAAa,MAC1B,OAGFC,EACL,kBAAC,OAAD;EACE,KAAKL;EACL,WAAU;EACV,aAAaM;EAEb,UAAA,kBAAC,OAAD;GACE,GAAIT;GACJ,KAAKU,EAAUT,GAAUU,CAAG;GAC5B,MAAK;GACL,cAAW;GACX,mBAAiBX,EAAK,gBAAgB,KAAA,IAAaA,EAAK,sBAAsBI;GAC9E,oBAAkBQ,IAAcN,IAAgBN,EAAK;GACrD,UAAU;GACV,aAAWa;GACX,WAAW,CAAC,YAAYC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;GAT7D,UAAA;IAWE,kBAAC,UAAD;KACE,WAAU;KACV,QAAQ,CAACC;KAFX,UAAA,CAIE,kBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,kBAAC,MAAD;OACE,IAAIX;OACJ,WAAU;OAET,UAAAY;MACC,CAAA,GACHJ,KACC,kBAAC,KAAD;OACE,IAAIN;OACJ,WAAU;OAET,UAAAM;MACA,CAAA,CAEF;KACJ,CAAA,GAAAG,KACC,kBAACE,GAAD;MACE,SAAQ;MACR,MAAK;MACL,YAAA;MACA,WAAU;MACV,cAAW;MACX,WAAU;MACV,SAASC;KACV,CAAA,CAEG;;IACR,kBAAC,OAAD;KAAK,WAAU;KAAkB;IAAc,CAAA;IAC9CC,KAAU,kBAAC,UAAD;KAAQ,WAAU;KAAoB,UAAAA;IAAe,CAAA;GAC7D;;CACF,CAAA,GACL,SAAS,IACX;AACF,CAAC"}
|
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
display: flex;
|
|
20
20
|
flex-direction: column;
|
|
21
21
|
background: var(--color-surface);
|
|
22
|
+
|
|
23
|
+
/* Set here, not inherited, so a panel carrying a scoped theme matches it. */
|
|
24
|
+
color: var(--color-text);
|
|
22
25
|
border: var(--frame-width) solid var(--frame-color);
|
|
23
26
|
border-radius: var(--overlay-radius);
|
|
24
27
|
box-shadow: var(--shadow-lg);
|
|
@@ -38,9 +41,13 @@
|
|
|
38
41
|
max-inline-size: var(--modal-width-wide);
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
.ds-modal[data-size="full"] {
|
|
45
|
+
max-inline-size: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
41
48
|
.ds-modal__head {
|
|
49
|
+
align-items: center;
|
|
42
50
|
display: flex;
|
|
43
|
-
align-items: start;
|
|
44
51
|
gap: var(--space-4);
|
|
45
52
|
padding: var(--space-5) var(--space-6);
|
|
46
53
|
border-block-end: var(--rule-width) solid var(--rule-color);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-Bc3qS0Tt.cjs"),t=require("../../chunks/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/mergeRefs-Bc3qS0Tt.cjs"),t=require("../../chunks/portalScope-BVA1-Ypu.cjs");let n=require("react"),r=require("react-dom"),i=require("react/jsx-runtime");function a(...e){return e.filter(Boolean).join(` `)}var o=8;function s({anchorRef:s,anchorId:c,isOpen:l,align:u=`start`,placement:d=`bottom`,matchAnchorWidth:f=!1,offset:p=4,className:m,children:h,role:g,id:_,panelRef:v,...y}){let b=(0,n.useRef)(null),x=(0,n.useId)(),S=_??x,C=(0,n.useMemo)(()=>({get current(){return s.current??(c?document.getElementById(c):null)}}),[c,s]);t.r(b,l,()=>C.current);let w=(0,n.useCallback)(()=>{let e=s.current??(c?document.getElementById(c):null),t=b.current;if(!e||!t)return;let n=e.getBoundingClientRect();f&&(t.style.width=`${n.width}px`);let r=t.getBoundingClientRect(),i=r.height+Math.max(0,t.scrollHeight-t.clientHeight),a={width:r.width,height:i},l=document.documentElement.clientWidth,m=document.documentElement.clientHeight,h=Math.max(0,m-16),g=Math.max(0,Math.min(h,m-n.bottom-p-o)),_=Math.max(0,Math.min(h,n.top-p-o)),v=d===`top`?_>=a.height||_>g:g<a.height&&_>g,y=v?_:g,x=Math.min(a.height,y),S=v?n.top-p-x:n.bottom+p,C=Math.max(o,Math.min(S,m-o-x)),w=u===`end`?n.right-a.width:n.left,T=Math.max(o,Math.min(w,l-a.width-o));t.style.left=`${Math.round(T)}px`,t.style.top=`${Math.round(C)}px`,t.style.setProperty(`--popover-max-block-size`,`${Math.round(y)}px`),t.style.visibility=`visible`},[u,c,s,f,p,d]);if((0,n.useEffect)(()=>{if(!l)return;let e=b.current,n=s.current??(c?document.getElementById(c):null),r=e&&n?t.o(e,n):void 0;w();let i=()=>w(),a=({target:t})=>{t instanceof Node&&e?.contains(t)||w()},o=typeof ResizeObserver>`u`?void 0:new ResizeObserver(i);n&&o?.observe(n);let u=()=>{if(e&&o){o.observe(e);for(let t of e.children)o.observe(t)}};u();let d=new MutationObserver(u);return e&&d.observe(e,{childList:!0}),window.addEventListener(`resize`,i),window.addEventListener(`scroll`,a,!0),()=>{window.removeEventListener(`resize`,i),window.removeEventListener(`scroll`,a,!0),o?.disconnect(),d.disconnect(),r?.()}},[c,s,l,w]),!l||typeof document>`u`)return null;let T=(0,i.jsx)(`div`,{ref:e.t(b,v),id:S,role:g,className:a(`ds-popover`,m),...y,children:(0,i.jsx)(t.t.Provider,{value:C,children:h})});return(0,r.createPortal)(T,document.body)}exports.Popover=s;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useRef","useId","useCallback","registerPopup","mergeRefs","createPortal","require_mergeRefs","require_dialogFocus","react","react_dom","react_jsx_runtime","cx","parts","VIEWPORT_MARGIN","Popover","rest","floatingRef","generatedId","panelId","id","place","reference","anchorRef","anchorId","floating","anchor","matchAnchorWidth","box","naturalHeight","panel","viewportWidth","viewportHeight","viewportRoom","roomBelow","offset","roomAbove","placeAbove","placement","availableHeight","visibleHeight","preferredTop","top","preferredLeft","align","left","isOpen","unregister","update","scroll","target","observer","observeContent","child","mutations","panelRef","className"],"sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useId, useRef, type ReactNode, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { registerPopup } from \"../../internal/dialogFocus\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst VIEWPORT_MARGIN = 8;\n\nexport type PopoverAlign = \"start\" | \"end\";\nexport type PopoverPlacement = \"top\" | \"bottom\";\n\nexport interface PopoverProps {\n /** The control the panel hangs off. */\n anchorRef: RefObject<HTMLElement | null>;\n /** Optional DOM id fallback for composed controls whose refs are consumed by a field wrapper. */\n anchorId?: string;\n isOpen: boolean;\n /** Which edge of the anchor the panel lines up with. Flips when it must. */\n align?: PopoverAlign;\n /** Preferred side of the anchor. Flips when the other side has more room. */\n placement?: PopoverPlacement;\n /** Match the anchor's width — for listboxes that read as one field. */\n matchAnchorWidth?: boolean;\n /** Gap between anchor and panel. */\n offset?: number;\n className?: string;\n children: ReactNode;\n role?: string;\n id?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n /** `-1` lets a dialog panel hold focus when a click lands on its non-interactive content. */\n tabIndex?: number;\n panelRef?: RefObject<HTMLDivElement | null>;\n}\n\n/**\n * A panel anchored to a control. It is positioned against the viewport, so it\n * flips above the anchor when the space below runs out and slides inward\n * rather than being cut off at any edge.\n */\nexport function Popover({\n anchorRef,\n anchorId,\n isOpen,\n align = \"start\",\n placement = \"bottom\",\n matchAnchorWidth = false,\n offset = 4,\n className,\n children,\n role,\n id,\n panelRef,\n ...rest\n}: PopoverProps) {\n const floatingRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const panelId = id ?? generatedId;\n\n const place = useCallback(() => {\n const reference = anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n const floating = floatingRef.current;\n if (!reference || !floating) {\n return;\n }\n\n const anchor = reference.getBoundingClientRect();\n if (matchAnchorWidth) {\n floating.style.width = `${anchor.width}px`;\n }\n // Natural height is the capped box plus whatever it scrolls. Lifting the cap\n // to measure would clamp the panel's scroll position back to the top.\n const box = floating.getBoundingClientRect();\n const naturalHeight = box.height + Math.max(0, floating.scrollHeight - floating.clientHeight);\n const panel = { width: box.width, height: naturalHeight };\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n const viewportRoom = Math.max(0, viewportHeight - VIEWPORT_MARGIN * 2);\n const roomBelow = Math.max(\n 0,\n Math.min(viewportRoom, viewportHeight - anchor.bottom - offset - VIEWPORT_MARGIN),\n );\n const roomAbove = Math.max(0, Math.min(viewportRoom, anchor.top - offset - VIEWPORT_MARGIN));\n const placeAbove =\n placement === \"top\"\n ? roomAbove >= panel.height || roomAbove > roomBelow\n : roomBelow < panel.height && roomAbove > roomBelow;\n const availableHeight = placeAbove ? roomAbove : roomBelow;\n const visibleHeight = Math.min(panel.height, availableHeight);\n const preferredTop = placeAbove ? anchor.top - offset - visibleHeight : anchor.bottom + offset;\n const top = Math.max(\n VIEWPORT_MARGIN,\n Math.min(preferredTop, viewportHeight - VIEWPORT_MARGIN - visibleHeight),\n );\n const preferredLeft = align === \"end\" ? anchor.right - panel.width : anchor.left;\n const left = Math.max(\n VIEWPORT_MARGIN,\n Math.min(preferredLeft, viewportWidth - panel.width - VIEWPORT_MARGIN),\n );\n\n floating.style.left = `${Math.round(left)}px`;\n floating.style.top = `${Math.round(top)}px`;\n floating.style.setProperty(\"--popover-max-block-size\", `${Math.round(availableHeight)}px`);\n floating.style.visibility = \"visible\";\n }, [align, anchorId, anchorRef, matchAnchorWidth, offset, placement]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const floating = floatingRef.current;\n const reference = anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n // A dialog around the anchor leaves Tab in this portalled panel to the panel.\n const unregister = floating && reference ? registerPopup(floating, reference) : undefined;\n place();\n const update = () => place();\n // The panel's own scrolling never moves its anchor.\n const scroll = ({ target }: Event) => {\n if (target instanceof Node && floating?.contains(target)) {\n return;\n }\n place();\n };\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(update);\n if (reference) {\n observer?.observe(reference);\n }\n // Children can grow while the outer panel stays capped and scrollable. Size\n // changes arrive through the observer; new children only need observing.\n const observeContent = () => {\n if (!floating || !observer) {\n return;\n }\n observer.observe(floating);\n for (const child of floating.children) {\n observer.observe(child);\n }\n };\n observeContent();\n const mutations = new MutationObserver(observeContent);\n if (floating) {\n mutations.observe(floating, { childList: true });\n }\n window.addEventListener(\"resize\", update);\n window.addEventListener(\"scroll\", scroll, true);\n return () => {\n window.removeEventListener(\"resize\", update);\n window.removeEventListener(\"scroll\", scroll, true);\n observer?.disconnect();\n mutations.disconnect();\n unregister?.();\n };\n }, [anchorId, anchorRef, isOpen, place]);\n\n if (!isOpen || typeof document === \"undefined\") {\n return null;\n }\n\n const panel = (\n <div\n ref={mergeRefs(floatingRef, panelRef)}\n id={panelId}\n role={role}\n className={cx(\"ds-popover\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n\n return createPortal(panel, document.body);\n}\n"],"mappings":"A,0PAMA,SAASW,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAEA,IAAMC,EAAkB,EAmCxB,SAAgBC,EAAQ,CACtB,YACA,WACA,SACA,QAAQ,QACR,YAAY,SACZ,mBAAmB,GACnB,SAAS,EACT,YACA,WACA,OACA,KACA,WACA,GAAGC,GACY,CACf,IAAMC,GAAA,EAAchB,EAAAA,OAAAA,CAA8B,IAAI,EAChDiB,GAAA,EAAchB,EAAAA,MAAAA,CAAM,EACpBiB,EAAUC,GAAMF,EAEhBG,GAAA,EAAQlB,EAAAA,YAAAA,KAAkB,CAC9B,IAAMmB,EAAYC,EAAU,UAAYC,EAAW,SAAS,eAAeA,CAAQ,EAAI,MACjFC,EAAWR,EAAY,QAC7B,GAAI,CAACK,GAAa,CAACG,EACjB,OAGF,IAAMC,EAASJ,EAAU,sBAAsB,EAC3CK,IACF,EAAS,MAAM,MAAQ,GAAGD,EAAO,MAAM,KAIzC,IAAME,EAAMH,EAAS,sBAAsB,EACrCI,EAAgBD,EAAI,OAAS,KAAK,IAAI,EAAGH,EAAS,aAAeA,EAAS,YAAY,EACtFK,EAAQ,CAAE,M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GAAYH,EAAYlB,EAAAA,EAAcqB,EAAUH,CAAS,EAAI,IAAA,GAChFD,EAAM,EACN,IAAM2B,MAAe3B,EAAM,EAErB4B,GAAU,CAAE,YAAoB,CAChCC,aAAkB,MAAQzB,GAAU,SAASyB,CAAM,GAGvD7B,EAAM,CACR,EACM8B,EAAW,OAAO,eAAmB,IAAc,IAAA,GAAY,IAAI,eAAeH,CAAM,EAC1F1B,GACF6B,GAAU,QAAQ7B,CAAS,EAI7B,IAAM8B,MAAuB,CAC3B,GAAK3B,GAAa0B,EAGlB,GAAS,QAAQ1B,CAAQ,EACzB,IAAK,IAAM4B,KAAS5B,EAAS,SAC3B0B,EAAS,QAAQE,CAAK,CAFC,CAI3B,EACAD,EAAe,EACf,IAAME,EAAY,IAAI,iBAAiBF,CAAc,EAMrD,OALI3B,GACF6B,EAAU,QAAQ7B,EAAU,CAAE,UAAW,EAAK,CAAC,EAEjD,OAAO,iBAAiB,SAAUuB,CAAM,EACxC,OAAO,iBAAiB,SAAUC,EAAQ,EAAI,MACjC,CACX,OAAO,oBAAoB,SAAUD,CAAM,EAC3C,OAAO,oBAAoB,SAAUC,EAAQ,EAAI,EACjDE,GAAU,WAAW,EACrBG,EAAU,WAAW,EACrBP,IAAa,CACf,CACF,EAAG,CAACvB,EAAUD,EAAWuB,EAAQzB,CAAK,CAAC,EAEnC,CAACyB,GAAU,OAAO,SAAa,IACjC,OAAO,KAGT,IAAMhB,GACJ,EAAAnB,EAAA,IAAA,CAAC,MAAD,CACE,IAAKN,EAAAA,EAAUY,EAAasC,CAAQ,EACpC,GAAIpC,EACE,OACN,UAAWP,EAAG,aAAc4C,CAAS,EACrC,GAAIxC,EAEH,UACE,CAAA,EAGP,OAAA,EAAOV,EAAAA,aAAAA,CAAawB,EAAO,SAAS,IAAI,CAC1C,C"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useRef","useId","useMemo","useCallback","registerPopup","mergeRefs","PortalScopeContext","createPortal","require_mergeRefs","require_portalScope","react","react_dom","react_jsx_runtime","cx","parts","VIEWPORT_MARGIN","Popover","rest","floatingRef","generatedId","panelId","id","scopeAnchor","anchorRef","anchorId","isOpen","place","reference","floating","anchor","matchAnchorWidth","box","naturalHeight","panel","viewportWidth","viewportHeight","viewportRoom","roomBelow","offset","roomAbove","placeAbove","placement","availableHeight","visibleHeight","preferredTop","top","preferredLeft","align","left","unregister","update","scroll","target","observer","observeContent","child","mutations","panelRef","className"],"sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import {\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { mergeRefs } from \"../../internal/mergeRefs\";\nimport { registerPopup } from \"../../internal/dialogFocus\";\nimport { PortalScopeContext, usePortalScope } from \"../../internal/portalScope\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst VIEWPORT_MARGIN = 8;\n\nexport type PopoverAlign = \"start\" | \"end\";\nexport type PopoverPlacement = \"top\" | \"bottom\";\n\nexport interface PopoverProps {\n /** The control the panel hangs off. */\n anchorRef: RefObject<HTMLElement | null>;\n /** Optional DOM id fallback for composed controls whose refs are consumed by a field wrapper. */\n anchorId?: string;\n isOpen: boolean;\n /** Which edge of the anchor the panel lines up with. Flips when it must. */\n align?: PopoverAlign;\n /** Preferred side of the anchor. Flips when the other side has more room. */\n placement?: PopoverPlacement;\n /** Match the anchor's width — for listboxes that read as one field. */\n matchAnchorWidth?: boolean;\n /** Gap between anchor and panel. */\n offset?: number;\n className?: string;\n children: ReactNode;\n role?: string;\n id?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n /** `-1` lets a dialog panel hold focus when a click lands on its non-interactive content. */\n tabIndex?: number;\n panelRef?: RefObject<HTMLDivElement | null>;\n}\n\n/**\n * A panel anchored to a control. It is positioned against the viewport, so it\n * flips above the anchor when the space below runs out and slides inward\n * rather than being cut off at any edge.\n */\nexport function Popover({\n anchorRef,\n anchorId,\n isOpen,\n align = \"start\",\n placement = \"bottom\",\n matchAnchorWidth = false,\n offset = 4,\n className,\n children,\n role,\n id,\n panelRef,\n ...rest\n}: PopoverProps) {\n const floatingRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const panelId = id ?? generatedId;\n // The panel, and overlays opened from it, carry the anchor's theme, direction\n // and language to the body.\n const scopeAnchor = useMemo<RefObject<Element | null>>(\n () => ({\n get current() {\n return anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n },\n }),\n [anchorId, anchorRef],\n );\n usePortalScope(floatingRef, isOpen, () => scopeAnchor.current);\n\n const place = useCallback(() => {\n const reference = anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n const floating = floatingRef.current;\n if (!reference || !floating) {\n return;\n }\n\n const anchor = reference.getBoundingClientRect();\n if (matchAnchorWidth) {\n floating.style.width = `${anchor.width}px`;\n }\n // Natural height is the capped box plus whatever it scrolls. Lifting the cap\n // to measure would clamp the panel's scroll position back to the top.\n const box = floating.getBoundingClientRect();\n const naturalHeight = box.height + Math.max(0, floating.scrollHeight - floating.clientHeight);\n const panel = { width: box.width, height: naturalHeight };\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n const viewportRoom = Math.max(0, viewportHeight - VIEWPORT_MARGIN * 2);\n const roomBelow = Math.max(\n 0,\n Math.min(viewportRoom, viewportHeight - anchor.bottom - offset - VIEWPORT_MARGIN),\n );\n const roomAbove = Math.max(0, Math.min(viewportRoom, anchor.top - offset - VIEWPORT_MARGIN));\n const placeAbove =\n placement === \"top\"\n ? roomAbove >= panel.height || roomAbove > roomBelow\n : roomBelow < panel.height && roomAbove > roomBelow;\n const availableHeight = placeAbove ? roomAbove : roomBelow;\n const visibleHeight = Math.min(panel.height, availableHeight);\n const preferredTop = placeAbove ? anchor.top - offset - visibleHeight : anchor.bottom + offset;\n const top = Math.max(\n VIEWPORT_MARGIN,\n Math.min(preferredTop, viewportHeight - VIEWPORT_MARGIN - visibleHeight),\n );\n const preferredLeft = align === \"end\" ? anchor.right - panel.width : anchor.left;\n const left = Math.max(\n VIEWPORT_MARGIN,\n Math.min(preferredLeft, viewportWidth - panel.width - VIEWPORT_MARGIN),\n );\n\n floating.style.left = `${Math.round(left)}px`;\n floating.style.top = `${Math.round(top)}px`;\n floating.style.setProperty(\"--popover-max-block-size\", `${Math.round(availableHeight)}px`);\n floating.style.visibility = \"visible\";\n }, [align, anchorId, anchorRef, matchAnchorWidth, offset, placement]);\n\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n const floating = floatingRef.current;\n const reference = anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n // A dialog around the anchor leaves Tab in this portalled panel to the panel.\n const unregister = floating && reference ? registerPopup(floating, reference) : undefined;\n place();\n const update = () => place();\n // The panel's own scrolling never moves its anchor.\n const scroll = ({ target }: Event) => {\n if (target instanceof Node && floating?.contains(target)) {\n return;\n }\n place();\n };\n const observer = typeof ResizeObserver === \"undefined\" ? undefined : new ResizeObserver(update);\n if (reference) {\n observer?.observe(reference);\n }\n // Children can grow while the outer panel stays capped and scrollable. Size\n // changes arrive through the observer; new children only need observing.\n const observeContent = () => {\n if (!floating || !observer) {\n return;\n }\n observer.observe(floating);\n for (const child of floating.children) {\n observer.observe(child);\n }\n };\n observeContent();\n const mutations = new MutationObserver(observeContent);\n if (floating) {\n mutations.observe(floating, { childList: true });\n }\n window.addEventListener(\"resize\", update);\n window.addEventListener(\"scroll\", scroll, true);\n return () => {\n window.removeEventListener(\"resize\", update);\n window.removeEventListener(\"scroll\", scroll, true);\n observer?.disconnect();\n mutations.disconnect();\n unregister?.();\n };\n }, [anchorId, anchorRef, isOpen, place]);\n\n if (!isOpen || typeof document === \"undefined\") {\n return null;\n }\n\n const panel = (\n <div\n ref={mergeRefs(floatingRef, panelRef)}\n id={panelId}\n role={role}\n className={cx(\"ds-popover\", className)}\n {...rest}\n >\n <PortalScopeContext.Provider value={scopeAnchor}>{children}</PortalScopeContext.Provider>\n </div>\n );\n\n return createPortal(panel, document.body);\n}\n"],"mappings":"A,0PAeA,SAASa,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAEA,IAAMC,EAAkB,EAmCxB,SAAgBC,EAAQ,CACtB,YACA,WACA,SACA,QAAQ,QACR,YAAY,SACZ,mBAAmB,GACnB,SAAS,EACT,YACA,WACA,OACA,KACA,WACA,GAAGC,GACY,CACf,IAAMC,GAAA,EAAclB,EAAAA,OAAAA,CAA8B,IAAI,EAChDmB,GAAA,EAAclB,EAAAA,MAAAA,CAAM,EACpBmB,EAAUC,GAAMF,EAGhBG,GAAA,EAAcpB,EAAAA,QAAAA,MACX,CACL,IAAI,SAAU,CACZ,OAAOqB,EAAU,UAAYC,EAAW,SAAS,eAAeA,CAAQ,EAAI,KAC9E,CACF,GACA,CAACA,EAAUD,CAAS,CACtB,EACAd,EAAA,EAAeS,EAAaO,MAAcH,EAAY,OAAO,EAE7D,IAAMI,GAAA,EAAQvB,EAAAA,YAAAA,KAAkB,CAC9B,IAAMwB,EAAYJ,EAAU,UAAYC,EAAW,SAAS,eAAeA,CAAQ,EAAI,MACjFI,EAAWV,EAAY,QAC7B,GAAI,CAACS,GAAa,CAACC,EACjB,OAGF,IAAMC,EAASF,EAAU,sBAAsB,EAC3CG,IACF,EAAS,MAAM,MAAQ,GAAGD,EAAO,MAAM,KAIzC,IAAME,EAAMH,EAAS,sBAAsB,EACrCI,EAAgBD,EAAI,OAAS,KAAK,IAAI,EAAGH,EAAS,aAAeA,EAAS,YAAY,EACtFK,EAAQ,CAAE,MAAOF,EAAI,MAAO,OAAQC,CAAc,EAClDE,EAAgB,SAAS,gBAAgB,YACzCC,EAAiB,SAAS,gBAAgB,aAC1CC,EAAe,KAAK,IAAI,EAAGD,EAAiB,EAAmB,EAC/DE,EAAY,KAAK,IACrB,EACA,KAA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,EAAM,CACR,EACM2B,EAAW,OAAO,eAAmB,IAAc,IAAA,GAAY,IAAI,eAAeH,CAAM,EAC1FvB,GACF0B,GAAU,QAAQ1B,CAAS,EAI7B,IAAM2B,MAAuB,CAC3B,GAAK1B,GAAayB,EAGlB,GAAS,QAAQzB,CAAQ,EACzB,IAAK,IAAM2B,KAAS3B,EAAS,SAC3ByB,EAAS,QAAQE,CAAK,CAFC,CAI3B,EACAD,EAAe,EACf,IAAME,EAAY,IAAI,iBAAiBF,CAAc,EAMrD,OALI1B,GACF4B,EAAU,QAAQ5B,EAAU,CAAE,UAAW,EAAK,CAAC,EAEjD,OAAO,iBAAiB,SAAUsB,CAAM,EACxC,OAAO,iBAAiB,SAAUC,EAAQ,EAAI,MACjC,CACX,OAAO,oBAAoB,SAAUD,CAAM,EAC3C,OAAO,oBAAoB,SAAUC,EAAQ,EAAI,EACjDE,GAAU,WAAW,EACrBG,EAAU,WAAW,EACrBP,IAAa,CACf,CACF,EAAG,CAACzB,EAAUD,EAAWE,EAAQC,CAAK,CAAC,EAEnC,CAACD,GAAU,OAAO,SAAa,IACjC,OAAO,KAGT,IAAMQ,GACJ,EAAArB,EAAA,IAAA,CAAC,MAAD,CACE,IAAKP,EAAAA,EAAUa,EAAauC,CAAQ,EACpC,GAAIrC,EACE,OACN,UAAWP,EAAG,aAAc6C,CAAS,EACrC,GAAIzC,EAEJ,UAAA,EAAAL,EAAA,IAAA,CAACN,EAAAA,EAAmB,SAApB,CAA6B,MAAOgB,EAAc,UAAsC,CAAA,CACrF,CAAA,EAGP,OAAA,EAAOf,EAAAA,aAAAA,CAAa0B,EAAO,SAAS,IAAI,CAC1C,C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Popover/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/Popover/index.tsx"],"names":[],"mappings":"A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sources":["../../../src/components/Popover/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Popover/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAKf,OAAO,aAAa,CAAC;AAQrB,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,CAAC;AAC3C,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,SAAS,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACzC,iGAAiG;IACjG,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,4EAA4E;IAC5E,KAAK,CAAC,EAAE,YAAY,CAAC;IACrB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EACtB,SAAS,EACT,QAAQ,EACR,MAAM,EACN,KAAe,EACf,SAAoB,EACpB,gBAAwB,EACxB,MAAU,EACV,SAAS,EACT,QAAQ,EACR,I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