@namroodinc/liquid-editorial 0.6.8 → 0.7.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 +110 -4
- package/UPGRADING.md +129 -0
- package/dist/chunks/CollectionView-BIuOL917.cjs +2 -0
- package/dist/chunks/CollectionView-BIuOL917.cjs.map +1 -0
- package/dist/chunks/CollectionView-Cr12UFWa.js +179 -0
- package/dist/chunks/CollectionView-Cr12UFWa.js.map +1 -0
- package/dist/chunks/{ColourField-DC6cLb9h.js → ColourField-B-tjjBfA.js} +2 -2
- package/dist/chunks/{ColourField-DC6cLb9h.js.map → ColourField-B-tjjBfA.js.map} +1 -1
- package/dist/chunks/{ColourField-NnFxLEsh.cjs → ColourField-ynUP1pfN.cjs} +2 -2
- package/dist/chunks/{ColourField-NnFxLEsh.cjs.map → ColourField-ynUP1pfN.cjs.map} +1 -1
- package/dist/chunks/FormEditor-C_4JbAnS.cjs +2 -0
- package/dist/chunks/FormEditor-C_4JbAnS.cjs.map +1 -0
- package/dist/chunks/{FormEditor-BkBhcYI5.js → FormEditor-ucTbDyQt.js} +177 -161
- package/dist/chunks/FormEditor-ucTbDyQt.js.map +1 -0
- package/dist/chunks/LoadState-B7GTDlWv.js +71 -0
- package/dist/chunks/LoadState-B7GTDlWv.js.map +1 -0
- package/dist/chunks/LoadState-C7tQ6fIP.cjs +2 -0
- package/dist/chunks/LoadState-C7tQ6fIP.cjs.map +1 -0
- package/dist/chunks/NumberField-1EYJdwDY.cjs +2 -0
- package/dist/chunks/NumberField-1EYJdwDY.cjs.map +1 -0
- package/dist/chunks/NumberField-DizR4NJv.js +178 -0
- package/dist/chunks/NumberField-DizR4NJv.js.map +1 -0
- package/dist/chunks/Slider-BfvNPjRJ.cjs +2 -0
- package/dist/chunks/Slider-BfvNPjRJ.cjs.map +1 -0
- package/dist/chunks/Slider-Cab6NqhK.js +168 -0
- package/dist/chunks/Slider-Cab6NqhK.js.map +1 -0
- package/dist/chunks/Wizard-B_CPW1V6.cjs +2 -0
- package/dist/chunks/Wizard-B_CPW1V6.cjs.map +1 -0
- package/dist/chunks/Wizard-C1iR5z44.js +99 -0
- package/dist/chunks/Wizard-C1iR5z44.js.map +1 -0
- package/dist/chunks/decimal-Ca7qJExZ.cjs +2 -0
- package/dist/chunks/decimal-Ca7qJExZ.cjs.map +1 -0
- package/dist/chunks/decimal-hq_W9D3s.js +15 -0
- package/dist/chunks/decimal-hq_W9D3s.js.map +1 -0
- package/dist/components/CollectionView/empty.d.cts +15 -0
- package/dist/components/CollectionView/empty.d.cts.map +1 -0
- package/dist/components/CollectionView/empty.d.ts +15 -0
- package/dist/components/CollectionView/empty.d.ts.map +1 -0
- package/dist/components/CollectionView/filters.d.cts +6 -0
- package/dist/components/CollectionView/filters.d.cts.map +1 -0
- package/dist/components/CollectionView/filters.d.ts +6 -0
- package/dist/components/CollectionView/filters.d.ts.map +1 -0
- package/dist/components/CollectionView/index.cjs +1 -0
- package/dist/components/CollectionView/index.d.cts +6 -0
- package/dist/components/CollectionView/index.d.cts.map +1 -0
- package/dist/components/CollectionView/index.d.ts +6 -0
- package/dist/components/CollectionView/index.d.ts.map +1 -0
- package/dist/components/CollectionView/index.js +2 -0
- package/dist/components/CollectionView/style.css +70 -0
- package/dist/components/CollectionView/toolbar.d.cts +5 -0
- package/dist/components/CollectionView/toolbar.d.cts.map +1 -0
- package/dist/components/CollectionView/toolbar.d.ts +5 -0
- package/dist/components/CollectionView/toolbar.d.ts.map +1 -0
- package/dist/components/CollectionView/types.d.cts +40 -0
- package/dist/components/CollectionView/types.d.cts.map +1 -0
- package/dist/components/CollectionView/types.d.ts +40 -0
- package/dist/components/CollectionView/types.d.ts.map +1 -0
- package/dist/components/ColourField/index.cjs +1 -1
- package/dist/components/ColourField/index.js +1 -1
- package/dist/components/EditLayout/style.css +1 -1
- package/dist/components/EditSection/index.cjs +2 -0
- package/dist/components/EditSection/index.cjs.map +1 -0
- package/dist/components/EditSection/index.d.cts +9 -0
- package/dist/components/EditSection/index.d.cts.map +1 -0
- package/dist/components/EditSection/index.d.ts +9 -0
- package/dist/components/EditSection/index.d.ts.map +1 -0
- package/dist/components/EditSection/index.js +22 -0
- package/dist/components/EditSection/index.js.map +1 -0
- package/dist/components/EditSection/style.css +31 -0
- package/dist/components/FormEditor/README.md +49 -7
- package/dist/components/FormEditor/index.cjs +1 -1
- package/dist/components/FormEditor/index.js +1 -1
- package/dist/components/FormEditor/model.d.cts +5 -0
- package/dist/components/FormEditor/model.d.cts.map +1 -1
- package/dist/components/FormEditor/model.d.ts +5 -0
- package/dist/components/FormEditor/model.d.ts.map +1 -1
- package/dist/components/ImageCropper/index.cjs +1 -1
- package/dist/components/ImageCropper/index.js +1 -1
- package/dist/components/LoadState/error.d.cts +13 -0
- package/dist/components/LoadState/error.d.cts.map +1 -0
- package/dist/components/LoadState/error.d.ts +13 -0
- package/dist/components/LoadState/error.d.ts.map +1 -0
- package/dist/components/LoadState/index.cjs +1 -0
- package/dist/components/LoadState/index.d.cts +15 -0
- package/dist/components/LoadState/index.d.cts.map +1 -0
- package/dist/components/LoadState/index.d.ts +15 -0
- package/dist/components/LoadState/index.d.ts.map +1 -0
- package/dist/components/LoadState/index.js +1 -0
- package/dist/components/LoadState/types.d.cts +3 -0
- package/dist/components/LoadState/types.d.cts.map +1 -0
- package/dist/components/LoadState/types.d.ts +3 -0
- package/dist/components/LoadState/types.d.ts.map +1 -0
- package/dist/components/LoadState/useRetryAttempt.d.cts +15 -0
- package/dist/components/LoadState/useRetryAttempt.d.cts.map +1 -0
- package/dist/components/LoadState/useRetryAttempt.d.ts +15 -0
- package/dist/components/LoadState/useRetryAttempt.d.ts.map +1 -0
- package/dist/components/MetaList/index.cjs +2 -0
- package/dist/components/MetaList/index.cjs.map +1 -0
- package/dist/components/MetaList/index.d.cts +7 -0
- package/dist/components/MetaList/index.d.cts.map +1 -0
- package/dist/components/MetaList/index.d.ts +7 -0
- package/dist/components/MetaList/index.d.ts.map +1 -0
- package/dist/components/MetaList/index.js +13 -0
- package/dist/components/MetaList/index.js.map +1 -0
- package/dist/components/MetaList/style.css +19 -0
- package/dist/components/NumberField/index.cjs +1 -2
- package/dist/components/NumberField/index.d.cts +10 -3
- package/dist/components/NumberField/index.d.cts.map +1 -1
- package/dist/components/NumberField/index.d.ts +10 -3
- package/dist/components/NumberField/index.d.ts.map +1 -1
- package/dist/components/NumberField/index.js +1 -128
- package/dist/components/NumberField/step.d.cts +29 -0
- package/dist/components/NumberField/step.d.cts.map +1 -0
- package/dist/components/NumberField/step.d.ts +29 -0
- package/dist/components/NumberField/step.d.ts.map +1 -0
- package/dist/components/PageHeader/index.cjs +2 -0
- package/dist/components/PageHeader/index.cjs.map +1 -0
- package/dist/components/PageHeader/index.d.cts +9 -0
- package/dist/components/PageHeader/index.d.cts.map +1 -0
- package/dist/components/PageHeader/index.d.ts +9 -0
- package/dist/components/PageHeader/index.d.ts.map +1 -0
- package/dist/components/PageHeader/index.js +27 -0
- package/dist/components/PageHeader/index.js.map +1 -0
- package/dist/components/PageHeader/style.css +39 -0
- package/dist/components/Slider/index.cjs +1 -1
- package/dist/components/Slider/index.d.cts.map +1 -1
- package/dist/components/Slider/index.d.ts.map +1 -1
- package/dist/components/Slider/index.js +1 -1
- package/dist/components/Slider/scale.d.cts +0 -2
- package/dist/components/Slider/scale.d.cts.map +1 -1
- package/dist/components/Slider/scale.d.ts +0 -2
- package/dist/components/Slider/scale.d.ts.map +1 -1
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.cjs.map +1 -1
- package/dist/components/Stepper/index.d.cts +8 -0
- package/dist/components/Stepper/index.d.cts.map +1 -1
- package/dist/components/Stepper/index.d.ts +8 -0
- package/dist/components/Stepper/index.d.ts.map +1 -1
- package/dist/components/Stepper/index.js +15 -14
- package/dist/components/Stepper/index.js.map +1 -1
- package/dist/components/Stepper/style.css +53 -0
- package/dist/components/Wizard/actions.d.cts +13 -0
- package/dist/components/Wizard/actions.d.cts.map +1 -0
- package/dist/components/Wizard/actions.d.ts +13 -0
- package/dist/components/Wizard/actions.d.ts.map +1 -0
- package/dist/components/Wizard/index.cjs +1 -0
- package/dist/components/Wizard/index.d.cts +7 -0
- package/dist/components/Wizard/index.d.cts.map +1 -0
- package/dist/components/Wizard/index.d.ts +7 -0
- package/dist/components/Wizard/index.d.ts.map +1 -0
- package/dist/components/Wizard/index.js +2 -0
- package/dist/components/Wizard/review-table.d.cts +13 -0
- package/dist/components/Wizard/review-table.d.cts.map +1 -0
- package/dist/components/Wizard/review-table.d.ts +13 -0
- package/dist/components/Wizard/review-table.d.ts.map +1 -0
- package/dist/components/Wizard/style.css +13 -0
- package/dist/components/Wizard/types.d.cts +35 -0
- package/dist/components/Wizard/types.d.cts.map +1 -0
- package/dist/components/Wizard/types.d.ts +35 -0
- package/dist/components/Wizard/types.d.ts.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +36 -30
- package/dist/internal/decimal.d.cts +7 -0
- package/dist/internal/decimal.d.cts.map +1 -0
- package/dist/internal/decimal.d.ts +7 -0
- package/dist/internal/decimal.d.ts.map +1 -0
- package/dist/styles.css +5 -0
- package/package.json +1 -1
- package/dist/chunks/FormEditor-B4mtAxaU.cjs +0 -2
- package/dist/chunks/FormEditor-B4mtAxaU.cjs.map +0 -1
- package/dist/chunks/FormEditor-BkBhcYI5.js.map +0 -1
- package/dist/chunks/Slider-k8weRl34.cjs +0 -2
- package/dist/chunks/Slider-k8weRl34.cjs.map +0 -1
- package/dist/chunks/Slider-vdMFLX-H.js +0 -174
- package/dist/chunks/Slider-vdMFLX-H.js.map +0 -1
- package/dist/components/NumberField/index.cjs.map +0 -1
- package/dist/components/NumberField/index.js.map +0 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { PaginationProps } from "../Pagination/index.js";
|
|
2
|
+
import type { SelectOption } from "../Select/index.js";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import type { LoadStatus } from "../LoadState/types.js";
|
|
5
|
+
export type CollectionEmptyKind = "empty" | "no-match";
|
|
6
|
+
export interface CollectionViewProps {
|
|
7
|
+
title: string;
|
|
8
|
+
count: number;
|
|
9
|
+
query: string;
|
|
10
|
+
onQueryChange: (query: string) => void;
|
|
11
|
+
status: LoadStatus;
|
|
12
|
+
error?: Error | null;
|
|
13
|
+
onRetry: () => void;
|
|
14
|
+
pagination: PaginationProps;
|
|
15
|
+
filter?: {
|
|
16
|
+
value: string;
|
|
17
|
+
onChange: (value: string) => void;
|
|
18
|
+
options: SelectOption[];
|
|
19
|
+
label: string;
|
|
20
|
+
};
|
|
21
|
+
mine?: {
|
|
22
|
+
isPressed: boolean;
|
|
23
|
+
onChange: (value: boolean) => void;
|
|
24
|
+
label: string;
|
|
25
|
+
};
|
|
26
|
+
view?: {
|
|
27
|
+
value: "grid" | "table";
|
|
28
|
+
onChange: (value: "grid" | "table") => void;
|
|
29
|
+
};
|
|
30
|
+
selection?: {
|
|
31
|
+
count: number;
|
|
32
|
+
onClear: () => void;
|
|
33
|
+
actions: ReactNode;
|
|
34
|
+
reason?: string;
|
|
35
|
+
isPending: boolean;
|
|
36
|
+
};
|
|
37
|
+
actions?: ReactNode;
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/CollectionView/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;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|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/ColourField-ynUP1pfN.cjs");exports.ColourField=e.t,exports.ColourPanel=e.n;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as ColourField, n as ColourPanel } from "../../chunks/ColourField-
|
|
1
|
+
export { t as ColourField, n as ColourPanel } from "../../chunks/ColourField-B-tjjBfA.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react/jsx-runtime");function t({title:t,actions:n,children:r}){return(0,e.jsxs)(`section`,{className:`ds-edit-section`,"aria-label":t,children:[(0,e.jsxs)(`header`,{className:`ds-edit-section__header`,children:[(0,e.jsx)(`h2`,{className:`ds-edit-section__title`,children:t}),n&&(0,e.jsx)(`div`,{className:`ds-edit-section__actions`,children:n})]}),r]})}exports.EditSection=t;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["react_jsx_runtime","EditSection","title","actions","children"],"sources":["../../../src/components/EditSection/index.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport \"./style.css\";\n\n/** An unframed section in the editor's body. */\nexport interface EditSectionProps {\n title: string;\n actions?: ReactNode;\n children: ReactNode;\n}\n\nexport function EditSection({ title, actions, children }: EditSectionProps) {\n return (\n <section\n className=\"ds-edit-section\"\n aria-label={title}\n >\n <header className=\"ds-edit-section__header\">\n <h2 className=\"ds-edit-section__title\">{title}</h2>\n {/* One flex item, so several actions stay grouped at the end. */}\n {actions && <div className=\"ds-edit-section__actions\">{actions}</div>}\n </header>\n {children}\n </section>\n );\n}\n"],"mappings":"A,sGAUA,SAAgBC,EAAY,CAAE,QAAO,UAAS,YAA8B,CAC1E,OACE,EAAAD,EAAA,KAAA,CAAC,UAAD,CACE,UAAU,kBACV,aAAYE,EAFd,SAAA,EAIE,EAAAF,EAAA,KAAA,CAAC,SAAD,CAAQ,UAAU,0BAAlB,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,yBAA0B,SAAAE,CAAU,CAAA,EAEjDC,IAAW,EAAAH,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,2BAA4B,SAAAG,CAAa,CAAA,CAC9D,CACP,CAAA,EAAAC,CACM,C,EAEb,C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** An unframed section in the editor's body. */
|
|
3
|
+
export interface EditSectionProps {
|
|
4
|
+
title: string;
|
|
5
|
+
actions?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function EditSection({ title, actions, children }: EditSectionProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/EditSection/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,aAAa,CAAC;AAErB,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAczE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** An unframed section in the editor's body. */
|
|
3
|
+
export interface EditSectionProps {
|
|
4
|
+
title: string;
|
|
5
|
+
actions?: ReactNode;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export declare function EditSection({ title, actions, children }: EditSectionProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/EditSection/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,aAAa,CAAC;AAErB,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,gBAAgB,+BAczE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as e, jsxs as t } from "react/jsx-runtime";
|
|
2
|
+
//#region src/components/EditSection/index.tsx
|
|
3
|
+
function n({ title: n, actions: r, children: i }) {
|
|
4
|
+
return /* @__PURE__ */ t("section", {
|
|
5
|
+
className: "ds-edit-section",
|
|
6
|
+
"aria-label": n,
|
|
7
|
+
children: [/* @__PURE__ */ t("header", {
|
|
8
|
+
className: "ds-edit-section__header",
|
|
9
|
+
children: [/* @__PURE__ */ e("h2", {
|
|
10
|
+
className: "ds-edit-section__title",
|
|
11
|
+
children: n
|
|
12
|
+
}), r && /* @__PURE__ */ e("div", {
|
|
13
|
+
className: "ds-edit-section__actions",
|
|
14
|
+
children: r
|
|
15
|
+
})]
|
|
16
|
+
}), i]
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { n as EditSection };
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["EditSection","title","actions","children"],"sources":["../../../src/components/EditSection/index.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\nimport \"./style.css\";\n\n/** An unframed section in the editor's body. */\nexport interface EditSectionProps {\n title: string;\n actions?: ReactNode;\n children: ReactNode;\n}\n\nexport function EditSection({ title, actions, children }: EditSectionProps) {\n return (\n <section\n className=\"ds-edit-section\"\n aria-label={title}\n >\n <header className=\"ds-edit-section__header\">\n <h2 className=\"ds-edit-section__title\">{title}</h2>\n {/* One flex item, so several actions stay grouped at the end. */}\n {actions && <div className=\"ds-edit-section__actions\">{actions}</div>}\n </header>\n {children}\n </section>\n );\n}\n"],"mappings":";;AAUA,SAAgBA,EAAY,EAAE,UAAO,YAAS,eAA8B;CAC1E,OACE,kBAAC,WAAD;EACE,WAAU;EACV,cAAYC;EAFd,UAAA,CAIE,kBAAC,UAAD;GAAQ,WAAU;GAAlB,UAAA,CACE,kBAAC,MAAD;IAAI,WAAU;IAA0B,UAAAA;GAAU,CAAA,GAEjDC,KAAW,kBAAC,OAAD;IAAK,WAAU;IAA4B,UAAAA;GAAa,CAAA,CAC9D;EACP,CAAA,GAAAC,CACM;;AAEb"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
@layer components {
|
|
2
|
+
.ds-edit-section {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--space-6);
|
|
6
|
+
min-inline-size: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.ds-edit-section__header {
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--space-6);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* reset.css is optional, so the heading clears its own UA margin. */
|
|
18
|
+
.ds-edit-section__title {
|
|
19
|
+
margin: 0;
|
|
20
|
+
font-size: var(--font-size-md);
|
|
21
|
+
font-weight: var(--font-weight-bold);
|
|
22
|
+
line-height: var(--line-height-tight);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ds-edit-section__actions {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
flex-wrap: wrap;
|
|
29
|
+
gap: var(--space-2);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -43,7 +43,8 @@ export function ArticleForm({ save }: { save: (values: FormValues) => void }) {
|
|
|
43
43
|
const [errors, setErrors] = useState<FormErrors>({});
|
|
44
44
|
const [submitted, setSubmitted] = useState(false);
|
|
45
45
|
return (
|
|
46
|
-
|
|
46
|
+
// noValidate: validateFormValues decides, not the browser's own bubbles.
|
|
47
|
+
<form noValidate onSubmit={(event) => {
|
|
47
48
|
event.preventDefault();
|
|
48
49
|
const nextErrors = validateFormValues(schema, values);
|
|
49
50
|
setErrors(nextErrors);
|
|
@@ -161,7 +162,7 @@ are not automatically schema options.
|
|
|
161
162
|
| `shortText` | `inputType: "text" \| "email"` (`text`), `maxLength`, `readOnly: false`, `autoFocus: false` | String; empty text remains `""`. |
|
|
162
163
|
| `longText` | `rows: 3`, `maxLength`, `readOnly: false`, `autoFocus: false` | String. |
|
|
163
164
|
| `richText` | `placeholder: "Write something…"`, `expandedWidth: "wide" \| "full"` (`wide`; any other runtime value throws); no autofocus | TipTap JSON document rooted at `doc`. |
|
|
164
|
-
| `number` | `min`, `max`, `step: number \| "any"` (`"any"`), `hasSteppers:
|
|
165
|
+
| `number` | `min`, `max`, `step: number \| "any"` (`"any"`), `hasSteppers: true`, `decreaseLabel` / `increaseLabel` (`"Decrease {label}"` / `"Increase {label}"`), `prefix`, `suffix` (strings), `autoFocus: false` | Finite number. |
|
|
165
166
|
| `boolean` | `autoFocus: false`; always a Switch | Boolean; `false` satisfies required. |
|
|
166
167
|
| `dateTime` | Native browser date-and-time input; `autoFocus: false`; label gets `(UTC)` | UTC ISO string ending in `Z`, including milliseconds. |
|
|
167
168
|
| `select` | Required `options: SelectOption[]`, `autoFocus: false` | String. Optional fields add an empty choice, using `placeholder` or `"None"`. |
|
|
@@ -177,10 +178,32 @@ are not automatically schema options.
|
|
|
177
178
|
| `divider` | No additional options | No stored value. |
|
|
178
179
|
|
|
179
180
|
Sliders require finite `min < max` and a positive finite step. A range slider's
|
|
180
|
-
scale must fit at least one step.
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
scale must fit at least one step. Number fields require finite bounds with
|
|
182
|
+
`min <= max`, a positive finite step or `"any"`, and nonempty stepper labels;
|
|
183
|
+
FormEditor and `validateFormValues` throw otherwise. Numbers are checked against
|
|
184
|
+
bounds; step configures interaction rather than adding a step-alignment
|
|
185
|
+
validation rule. Steppers never leave the step grid, but a typed off-grid number
|
|
186
|
+
still fails the browser's own constraint validation, which blocks a wrapping
|
|
187
|
+
`<form>` submit unless it sets `noValidate`, as the example above does. Step
|
|
188
|
+
distances are compared at the operands' decimal precision, so a scale such as
|
|
189
|
+
`min: 0.2, max: 0.3, step: 0.1` is valid and its endpoints may be one step apart.
|
|
190
|
+
|
|
191
|
+
Number fields show the shared − / + buttons by default, named after their field
|
|
192
|
+
(for example, "Increase Priority"). Translate those names with `decreaseLabel`
|
|
193
|
+
and `increaseLabel`. Set `hasSteppers: false` to hide the buttons. The buttons
|
|
194
|
+
stay out of the tab order and never take focus, so a tap does not open the soft
|
|
195
|
+
keyboard; ArrowUp and ArrowDown in the input step the same way.
|
|
196
|
+
|
|
197
|
+
A numeric `step` keeps stepped values on the grid `min + k × step` (from 0 without
|
|
198
|
+
`min`), so they never fail the browser's step validation: an off-grid value moves
|
|
199
|
+
to the neighbouring grid value, and `max` stops at the last grid value inside it.
|
|
200
|
+
With the default `step: "any"`, typing accepts any precision and the buttons move
|
|
201
|
+
by 1, or by the largest power of ten below the range when `min` and `max` are at
|
|
202
|
+
most 1 apart (0.1 for 0–1); results keep the typed precision. An empty field
|
|
203
|
+
counts as 0, but its first press lands on a bound at or beyond 0, so an empty
|
|
204
|
+
`min: 1` field gives 1. Out-of-range values only step back towards their range.
|
|
205
|
+
The FormEditor **NumberSteppers** story demonstrates these cases, affixes,
|
|
206
|
+
translated names, the opt-out and disabled controls.
|
|
184
207
|
|
|
185
208
|
Typed number ranges and calendar date ranges are deferred from FormEditor.
|
|
186
209
|
The standalone NumberRangeField and DateRangeField APIs remain separate from
|
|
@@ -387,7 +410,7 @@ export const catalogue = {
|
|
|
387
410
|
{ id: "headline", type: "shortText", label: "Headline", maxLength: 120 },
|
|
388
411
|
{ id: "summary", type: "longText", label: "Summary", rows: 4 },
|
|
389
412
|
{ id: "body", type: "richText", label: "Body" },
|
|
390
|
-
{ id: "priority", type: "number", label: "Priority", min: 0,
|
|
413
|
+
{ id: "priority", type: "number", label: "Priority", min: 0 }, // steppers by default
|
|
391
414
|
{ id: "featured", type: "boolean", label: "Featured" },
|
|
392
415
|
{ id: "publishAt", type: "dateTime", label: "Publish at" },
|
|
393
416
|
{ id: "status", type: "select", label: "Status", options: [{ value: "draft", label: "Draft" }] },
|
|
@@ -487,6 +510,9 @@ by default). FormEditor dividers span the grid and use its gap instead of margin
|
|
|
487
510
|
and EntryPicker's pure `selectionLimit`), so a display change stays in step.
|
|
488
511
|
2. **Adapters:** `control.tsx` maps existing fields to shared components;
|
|
489
512
|
`additional-control.tsx` and `choice-control.tsx` handle the expanded controls.
|
|
513
|
+
Number fields pass `hasSteppers` through, so NumberField owns the default and
|
|
514
|
+
the stepping rules in `NumberField/step.ts`; the adapter only supplies
|
|
515
|
+
field-named, overridable stepper labels.
|
|
490
516
|
Translate clear events and Field bindings here; rich text forwards
|
|
491
517
|
`expandedWidth` to RichTextEditor, whose `expansion.tsx` moves one rendering
|
|
492
518
|
host into a headerless Modal; Modal and the shared `src/internal` helpers own
|
|
@@ -520,3 +546,19 @@ When adding or changing a field:
|
|
|
520
546
|
their decision document. Keep this architecture map current.
|
|
521
547
|
- Run library validation and package/browser checks. The release workflow owns
|
|
522
548
|
versions. Finish with verification results and suggested Git commit text.
|
|
549
|
+
|
|
550
|
+
## Form layout and presentation companions
|
|
551
|
+
|
|
552
|
+
FormEditor's default field gap is `lg` (`var(--space-6)`, normally 24px).
|
|
553
|
+
Compose groups and sections with the same gap. EditSection, EditLayout and Wizard
|
|
554
|
+
use it for their outer form layouts; compact label/hint, option, table, metadata
|
|
555
|
+
and toolbar spacing is separate. General Grid/Stack defaults do not change.
|
|
556
|
+
|
|
557
|
+
CollectionView/CollectionEmpty, EditSection, PageHeader, MetaList,
|
|
558
|
+
LoadState/LoadError and Wizard/ReviewTable own presentation, not field values.
|
|
559
|
+
They require no FormEditor adapter. Applications retain data, routing, validation
|
|
560
|
+
and submission. Wizard accepts required `isOpen` and an optional stable
|
|
561
|
+
`modalComponent` to bridge application dialog coordination. Each Wizard step's
|
|
562
|
+
content mounts fresh when the step changes, so a FormEditor per step starts with
|
|
563
|
+
its own touched and error state; keep its `value` in application state above the
|
|
564
|
+
wizard so values survive Back, Next and review Edit links.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../Container/index.cjs");const e=require("../../chunks/FormEditor-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../Container/index.cjs");const e=require("../../chunks/FormEditor-C_4JbAnS.cjs");exports.FormEditor=e.t,exports.validateFormValues=e.n;
|
|
@@ -64,8 +64,13 @@ export type FormField = FormFieldBase & (({
|
|
|
64
64
|
type: "number";
|
|
65
65
|
min?: number;
|
|
66
66
|
max?: number;
|
|
67
|
+
/** Positive, or `"any"` (the default) to accept typed decimals. */
|
|
67
68
|
step?: number | "any";
|
|
69
|
+
/** Show NumberField's − / + buttons, its default; false keeps typing and arrow keys. */
|
|
68
70
|
hasSteppers?: boolean;
|
|
71
|
+
/** Stepper names; default to "Decrease {label}" and "Increase {label}". */
|
|
72
|
+
decreaseLabel?: string;
|
|
73
|
+
increaseLabel?: string;
|
|
69
74
|
prefix?: string;
|
|
70
75
|
suffix?: string;
|
|
71
76
|
autoFocus?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.cts","sourceRoot":"","sources":["../../../src/components/FormEditor/model.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UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC;;;;;;;EAW/D;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAM3F;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAenE;AA+DD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,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"}
|
|
@@ -64,8 +64,13 @@ export type FormField = FormFieldBase & (({
|
|
|
64
64
|
type: "number";
|
|
65
65
|
min?: number;
|
|
66
66
|
max?: number;
|
|
67
|
+
/** Positive, or `"any"` (the default) to accept typed decimals. */
|
|
67
68
|
step?: number | "any";
|
|
69
|
+
/** Show NumberField's − / + buttons, its default; false keeps typing and arrow keys. */
|
|
68
70
|
hasSteppers?: boolean;
|
|
71
|
+
/** Stepper names; default to "Decrease {label}" and "Increase {label}". */
|
|
72
|
+
decreaseLabel?: string;
|
|
73
|
+
increaseLabel?: string;
|
|
69
74
|
prefix?: string;
|
|
70
75
|
suffix?: string;
|
|
71
76
|
autoFocus?: boolean;
|
|
@@ -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,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIxE,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,
|
|
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,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIxE,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,EAA6B,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAG9E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEpE,iFAAiF;AACjF,QAAA,MAAM,WAAW,6BAAkE,CAAC;AAEpF,UAAU,aAAa;IACrB,EAAE,EAA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AG,eAAe,CAEjF;AAiED,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAInD;AAED,qGAAqG;AACrG,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC;;;;;;;EAW/D;AAED,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,OAAO,GAAG,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAM3F;AAED,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAenE;AA+DD,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../ButtonGroup/index.cjs"),n=require("../Field/index.cjs"),r=require("../../chunks/binding-tMjrUzkU.cjs"),i=require("../../chunks/Slider-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../ButtonGroup/index.cjs"),n=require("../Field/index.cjs"),r=require("../../chunks/binding-tMjrUzkU.cjs"),i=require("../../chunks/Slider-BfvNPjRJ.cjs"),a=require("../Grid/index.cjs");let o=require("react"),s=require("react/jsx-runtime");var c=1,l={zoom:1,rotation:0,x:.5,y:.5};function u(e,t,n){let r=[e,t];for(let e=Math.round(n/90)%4;e>0;e--)r=[1-r[1],r[0]];return r}function d(e,t,n,r){let i=n%180!=0,a=i?e.height:e.width,o=i?e.width:e.height;return{width:a,height:o,scale:Math.max(t.width/a,t.height/o)*r}}function f(e){let t=(e,t)=>e!=null&&Number.isFinite(e)?e:t,n=e=>Math.min(1,Math.max(0,t(e,.5))),r=(Math.round(t(e?.rotation,0)/90)*90%360+360)%360,[i,a]=u(n(e?.cx),n(e?.cy),r);return{zoom:t(e?.zoom,1),rotation:r,x:i,y:a}}var p=(0,o.forwardRef)(function({src:p,alt:m=``,aspect:h,maxZoom:g=3,rotatable:_=!0,onChange:v,defaultState:y,className:b,...x},S){let C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),[E,D]=(0,o.useState)({width:0,height:0}),[O,k]=(0,o.useState)(null),[A,j]=(0,o.useState)(()=>f(y)),[M,N]=(0,o.useState)({src:p,aspect:h});(M.src!==p||M.aspect!==h)&&(N({src:p,aspect:h}),j(e=>M.src===p?{...l,rotation:e.rotation}:f(y)));let P=(0,o.useCallback)(e=>{let{naturalWidth:t,naturalHeight:n}=e;t&&n&&k(e=>e?.src===p&&e.width===t&&e.height===n?e:{src:p,width:t,height:n})},[p]);(0,o.useEffect)(()=>{let e=w.current;e?.complete&&P(e)},[P]),(0,o.useLayoutEffect)(()=>{let e=C.current;if(!e)return;let t=()=>{let t=e.clientWidth,n=e.clientHeight;D(e=>e.width===t&&e.height===n?e:{width:t,height:n})};t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[h]);let F=O?.src===p&&E.width>0&&E.height>0?O:null,I=(0,o.useCallback)(e=>{let t=Math.min(Math.max(c,g),Math.max(c,e.zoom)),{x:n,y:r}=e;if(F){let i=d(F,E,e.rotation,t),a=Math.min(.5,E.width/i.scale/i.width/2),o=Math.min(.5,E.height/i.scale/i.height/2);n=Math.min(1-a,Math.max(a,n)),r=Math.min(1-o,Math.max(o,r))}return t===e.zoom&&n===e.x&&r===e.y?e:{...e,zoom:t,x:n,y:r}},[E,g,F]),L=(0,o.useMemo)(()=>I(A),[I,A]);(0,o.useEffect)(()=>{j(L)},[L]);let R=(0,o.useMemo)(()=>F?d(F,E,L.rotation,L.zoom):null,[F,E,L.rotation,L.zoom]),z=R?.scale??0,B=R?(.5-L.x)*R.width*z:0,V=R?(.5-L.y)*R.height*z:0,H=R?Math.max(0,(R.width*z-E.width)/2):0,U=R?Math.max(0,(R.height*z-E.height)/2):0,W=`Drag the picture to reposition it. Nothing is written until you save — ${H===0&&U===0?`at this zoom the whole picture is in frame.`:`the veiled edges are what gets trimmed.`}`;(0,o.useEffect)(()=>{if(!R)return;let e=Math.min(R.width,Math.round(E.width/R.scale)),t=Math.min(R.height,Math.round(E.height/R.scale)),[n,r]=u(L.x,L.y,360-L.rotation);v?.({x:Math.max(0,Math.min(R.width-e,Math.round(L.x*R.width-E.width/R.scale/2))),y:Math.max(0,Math.min(R.height-t,Math.round(L.y*R.height-E.height/R.scale/2))),width:e,height:t},{offsetX:B,offsetY:V,zoom:L.zoom,rotation:L.rotation,cx:n,cy:r})},[R,L,E,B,V]);let G=(e,t)=>j(n=>{if(!F)return n;let{width:r,height:i,scale:a}=d(F,E,n.rotation,n.zoom);return I({...n,x:n.x-e/(r*a),y:n.y-t/(i*a)})}),K=e=>j(t=>({...l,rotation:(t.rotation+e+360)%360})),q=e=>{e.button===0&&(T.current={pointerId:e.pointerId,x:e.clientX,y:e.clientY},e.currentTarget.setPointerCapture(e.pointerId))},J=e=>{let t=T.current;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.x,r=e.clientY-t.y;T.current={...t,x:e.clientX,y:e.clientY},G(n,r)},Y=e=>{T.current?.pointerId===e.pointerId&&(T.current=null,e.currentTarget.releasePointerCapture?.(e.pointerId))};return(0,s.jsxs)(a.Stack,{ref:S,className:[`ds-cropper`,b].filter(Boolean).join(` `),...r.n(x),children:[(0,s.jsxs)(`div`,{role:`application`,"aria-label":`Crop area — drag to reposition, arrow keys to nudge`,tabIndex:0,className:`ds-cropper__stage`,style:{"--cropper-aspect":String(h)},onPointerDown:q,onPointerMove:J,onPointerUp:Y,onPointerCancel:Y,onKeyDown:e=>{let t=e.shiftKey?24:8,n={ArrowLeft:[-t,0],ArrowRight:[t,0],ArrowUp:[0,-t],ArrowDown:[0,t]}[e.key];n&&(e.preventDefault(),G(n[0],n[1]))},children:[(0,s.jsx)(`img`,{ref:w,src:p,alt:m,draggable:!1,className:`ds-cropper__image`,onLoad:e=>P(e.currentTarget),style:{inlineSize:F?F.width*z:void 0,blockSize:F?F.height*z:void 0,transform:`translate(calc(-50% + ${B}px), calc(-50% + ${V}px)) rotate(${L.rotation}deg)`}}),(0,s.jsx)(`div`,{className:`ds-cropper__frame`,ref:C,"aria-hidden":`true`,children:(0,s.jsx)(`div`,{className:`ds-cropper__guides`})})]}),(0,s.jsx)(n.Field,{label:`Zoom`,hint:W,children:n=>(0,s.jsxs)(a.Stack,{direction:`horizontal`,gap:`md`,align:`center`,wrap:!0,children:[(0,s.jsx)(a.Stack,{style:{flex:`1 1 50%`,minInlineSize:0},children:(0,s.jsx)(i.n,{...n,min:c,max:Math.max(c,g),step:.01,value:L.zoom,suffix:`×`,onValueChange:e=>j(t=>I({...t,zoom:e}))})}),(0,s.jsxs)(t.ButtonGroup,{"aria-label":`Crop actions`,children:[_&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(e.Button,{size:`sm`,iconStart:`rotate-ccw`,"aria-label":`Rotate left`,onClick:()=>K(-90)}),(0,s.jsx)(e.Button,{size:`sm`,iconStart:`rotate-cw`,"aria-label":`Rotate right`,onClick:()=>K(90)})]}),(0,s.jsx)(e.Button,{size:`sm`,onClick:()=>j(l),children:`Reset`})]})]})})]})});async function m(e,t,{outputWidth:n,rotation:r=0,type:i=`image/png`,quality:a=.92}={}){let o=new Image;o.crossOrigin=`anonymous`,o.src=e,await o.decode();let s=r%180!=0,c=document.createElement(`canvas`);c.width=s?o.naturalHeight:o.naturalWidth,c.height=s?o.naturalWidth:o.naturalHeight;let l=c.getContext(`2d`);if(!l)throw Error(`Canvas 2D context unavailable`);l.translate(c.width/2,c.height/2),l.rotate(r*Math.PI/180),l.drawImage(o,-o.naturalWidth/2,-o.naturalHeight/2);let u=n??t.width,d=Math.round(t.height/t.width*u),f=document.createElement(`canvas`);f.width=u,f.height=d;let p=f.getContext(`2d`);if(!p)throw Error(`Canvas 2D context unavailable`);return p.drawImage(c,t.x,t.y,t.width,t.height,0,0,u,d),new Promise((e,t)=>{f.toBlob(n=>n?e(n):t(Error(`Could not encode the crop`)),i,a)})}exports.ImageCropper=p,exports.cropToBlob=m;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,7 +2,7 @@ import { Button as e } from "../Button/index.js";
|
|
|
2
2
|
import { ButtonGroup as t } from "../ButtonGroup/index.js";
|
|
3
3
|
import { Field as n } from "../Field/index.js";
|
|
4
4
|
import { n as r } from "../../chunks/binding-Bshy43sG.js";
|
|
5
|
-
import { n as i } from "../../chunks/Slider-
|
|
5
|
+
import { n as i } from "../../chunks/Slider-Cab6NqhK.js";
|
|
6
6
|
import { Stack as a } from "../Grid/index.js";
|
|
7
7
|
import { forwardRef as o, useCallback as s, useEffect as c, useLayoutEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
8
8
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RetryState } from "./types.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* Persistent load feedback; the owning view controls when it is shown. A first
|
|
4
|
+
* failure stays quiet, while a retry's progress and repeated failure are announced.
|
|
5
|
+
*/
|
|
6
|
+
export interface LoadErrorProps {
|
|
7
|
+
error?: Error | null;
|
|
8
|
+
onRetry?: () => void;
|
|
9
|
+
/** Set while the owner keeps this banner mounted through a retry, so Retry keeps focus. */
|
|
10
|
+
retryState?: RetryState;
|
|
11
|
+
}
|
|
12
|
+
export declare function LoadError({ error, onRetry, retryState }: LoadErrorProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=error.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.cts","sourceRoot":"","sources":["../../../src/components/LoadState/error.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAO1C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,2FAA2F;IAC3F,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,cAAc,+BAuBvE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { RetryState } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Persistent load feedback; the owning view controls when it is shown. A first
|
|
4
|
+
* failure stays quiet, while a retry's progress and repeated failure are announced.
|
|
5
|
+
*/
|
|
6
|
+
export interface LoadErrorProps {
|
|
7
|
+
error?: Error | null;
|
|
8
|
+
onRetry?: () => void;
|
|
9
|
+
/** Set while the owner keeps this banner mounted through a retry, so Retry keeps focus. */
|
|
10
|
+
retryState?: RetryState;
|
|
11
|
+
}
|
|
12
|
+
export declare function LoadError({ error, onRetry, retryState }: LoadErrorProps): import("react").JSX.Element;
|
|
13
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../src/components/LoadState/error.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAO1C;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,2FAA2F;IAC3F,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,wBAAgB,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,cAAc,+BAuBvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/LoadState-C7tQ6fIP.cjs");exports.LoadError=e.n,exports.LoadState=e.t;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LoadStatus } from "./types.cjs";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export interface LoadStateProps {
|
|
4
|
+
status: LoadStatus;
|
|
5
|
+
error?: Error | null;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
/** Rendered once loaded. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** The loading and failed states every API-backed view shares; children render once ready. */
|
|
11
|
+
export declare function LoadState({ status, error, onRetry, children }: LoadStateProps): import("react").JSX.Element;
|
|
12
|
+
export { LoadError } from "./error.cjs";
|
|
13
|
+
export type { LoadErrorProps } from "./error.cjs";
|
|
14
|
+
export type { LoadStatus, RetryState } from "./types.cjs";
|
|
15
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/LoadState/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,cAAc,+BAgB7E;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { LoadStatus } from "./types.js";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export interface LoadStateProps {
|
|
4
|
+
status: LoadStatus;
|
|
5
|
+
error?: Error | null;
|
|
6
|
+
onRetry?: () => void;
|
|
7
|
+
/** Rendered once loaded. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/** The loading and failed states every API-backed view shares; children render once ready. */
|
|
11
|
+
export declare function LoadState({ status, error, onRetry, children }: LoadStateProps): import("react").JSX.Element;
|
|
12
|
+
export { LoadError } from "./error.js";
|
|
13
|
+
export type { LoadErrorProps } from "./error.js";
|
|
14
|
+
export type { LoadStatus, RetryState } from "./types.js";
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/LoadState/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,cAAc,+BAgB7E;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as LoadError, t as LoadState } from "../../chunks/LoadState-B7GTDlWv.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../../src/components/LoadState/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/LoadState/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AACvD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RetryState } from "./types.cjs";
|
|
2
|
+
import type { LoadStatus } from "./types.cjs";
|
|
3
|
+
/**
|
|
4
|
+
* A retry started from failure feedback. The owner keeps that feedback mounted
|
|
5
|
+
* while the retry loads, so Retry keeps focus, and reports a repeated failure.
|
|
6
|
+
* Success, or any load the retry didn't start, clears it. A retry that reports
|
|
7
|
+
* no load within RETRY_START_WINDOW_MS, for example because the owner keeps
|
|
8
|
+
* `error` while refetching, lapses, so a later unrelated load shows a skeleton.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useRetryAttempt(status: LoadStatus, error: Error | null | undefined, onRetry?: () => void): {
|
|
11
|
+
state: RetryState | undefined;
|
|
12
|
+
error: Error | null | undefined;
|
|
13
|
+
retry: (() => void) | undefined;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useRetryAttempt.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRetryAttempt.d.cts","sourceRoot":"","sources":["../../../src/components/LoadState/useRetryAttempt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAe1C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC/B,OAAO,CAAC,EAAE,MAAM,IAAI;;;;EA0CrB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RetryState } from "./types.js";
|
|
2
|
+
import type { LoadStatus } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* A retry started from failure feedback. The owner keeps that feedback mounted
|
|
5
|
+
* while the retry loads, so Retry keeps focus, and reports a repeated failure.
|
|
6
|
+
* Success, or any load the retry didn't start, clears it. A retry that reports
|
|
7
|
+
* no load within RETRY_START_WINDOW_MS, for example because the owner keeps
|
|
8
|
+
* `error` while refetching, lapses, so a later unrelated load shows a skeleton.
|
|
9
|
+
*/
|
|
10
|
+
export declare function useRetryAttempt(status: LoadStatus, error: Error | null | undefined, onRetry?: () => void): {
|
|
11
|
+
state: RetryState | undefined;
|
|
12
|
+
error: Error | null | undefined;
|
|
13
|
+
retry: (() => void) | undefined;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=useRetryAttempt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRetryAttempt.d.ts","sourceRoot":"","sources":["../../../src/components/LoadState/useRetryAttempt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAe1C;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,EAC/B,OAAO,CAAC,EAAE,MAAM,IAAI;;;;EA0CrB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react/jsx-runtime");function n({items:n}){return(0,t.jsx)(`dl`,{className:`ds-meta-list`,children:n.map(([n,r],i)=>(0,t.jsxs)(e.Fragment,{children:[(0,t.jsx)(`dt`,{children:n}),(0,t.jsx)(`dd`,{children:r})]},i))})}exports.MetaList=n;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["Fragment","react","react_jsx_runtime","MetaList","items","term","description","index"],"sources":["../../../src/components/MetaList/index.tsx"],"sourcesContent":["import { Fragment } from \"react\";\nimport type { ReactNode } from \"react\";\nimport \"./style.css\";\n\nexport interface MetaListProps {\n items: readonly [term: string, description: ReactNode][];\n}\n\n/** Read-only facts about an item: IDs, dates, sizes. */\nexport function MetaList({ items }: MetaListProps) {\n return (\n <dl className=\"ds-meta-list\">\n {/* Terms may repeat, and rows hold no state of their own, so position is the key. */}\n {items.map(([term, description], index) => (\n <Fragment key={index}>\n <dt>{term}</dt>\n <dd>{description}</dd>\n </Fragment>\n ))}\n </dl>\n );\n}\n"],"mappings":"A,yHASA,SAAgBG,EAAS,CAAE,SAAwB,CACjD,OACE,EAAAD,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,eAEX,SAAAE,EAAM,KAAK,CAACC,EAAMC,GAAc,KAC/B,EAAAJ,EAAA,KAAA,CAACF,EAAAA,SAAD,CAAA,SAAA,EACE,EAAAE,EAAA,IAAA,CAAC,KAAD,CAAA,SAAKG,CAAS,CAAA,GACd,EAAAH,EAAA,IAAA,CAAC,KAAD,CAAA,SAAKI,CAAgB,CAAA,CACb,CAAA,EAHKC,CAGL,CACX,CACC,CAAA,CAER,C"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface MetaListProps {
|
|
3
|
+
items: readonly [term: string, description: ReactNode][];
|
|
4
|
+
}
|
|
5
|
+
/** Read-only facts about an item: IDs, dates, sizes. */
|
|
6
|
+
export declare function MetaList({ items }: MetaListProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/MetaList/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC;CAC1D;AAED,wDAAwD;AACxD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,aAAa,+BAYhD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface MetaListProps {
|
|
3
|
+
items: readonly [term: string, description: ReactNode][];
|
|
4
|
+
}
|
|
5
|
+
/** Read-only facts about an item: IDs, dates, sizes. */
|
|
6
|
+
export declare function MetaList({ items }: MetaListProps): import("react").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MetaList/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC;CAC1D;AAED,wDAAwD;AACxD,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,aAAa,+BAYhD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Fragment as e } from "react";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/MetaList/index.tsx
|
|
4
|
+
function r({ items: r }) {
|
|
5
|
+
return /* @__PURE__ */ t("dl", {
|
|
6
|
+
className: "ds-meta-list",
|
|
7
|
+
children: r.map(([r, i], a) => /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("dt", { children: r }), /* @__PURE__ */ t("dd", { children: i })] }, a))
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { r as MetaList };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=index.js.map
|