@namroodinc/liquid-editorial 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/UPGRADING.md +22 -0
  2. package/dist/chunks/{Board-CNVy8gHI.cjs → Board-CQ1GTuRB.cjs} +2 -2
  3. package/dist/chunks/{Board-CNVy8gHI.cjs.map → Board-CQ1GTuRB.cjs.map} +1 -1
  4. package/dist/chunks/{Board-BCS7sDXg.js → Board-DUX76d2R.js} +2 -2
  5. package/dist/chunks/{Board-BCS7sDXg.js.map → Board-DUX76d2R.js.map} +1 -1
  6. package/dist/chunks/{ColourField-BTj9NHgI.js → ColourField-BG5oGj9f.js} +2 -2
  7. package/dist/chunks/{ColourField-BTj9NHgI.js.map → ColourField-BG5oGj9f.js.map} +1 -1
  8. package/dist/chunks/{ColourField-DuoVeXjG.cjs → ColourField-DFvRASVe.cjs} +2 -2
  9. package/dist/chunks/{ColourField-DuoVeXjG.cjs.map → ColourField-DFvRASVe.cjs.map} +1 -1
  10. package/dist/chunks/{DatePicker-BYpGsfL4.cjs → DatePicker-ClOqS6oH.cjs} +2 -2
  11. package/dist/chunks/{DatePicker-BYpGsfL4.cjs.map → DatePicker-ClOqS6oH.cjs.map} +1 -1
  12. package/dist/chunks/{DatePicker-Cb5WspIC.js → DatePicker-LqaePc57.js} +2 -2
  13. package/dist/chunks/{DatePicker-Cb5WspIC.js.map → DatePicker-LqaePc57.js.map} +1 -1
  14. package/dist/chunks/{EntryPicker-CCCoJxbd.cjs → EntryPicker-B4dAsObz.cjs} +2 -2
  15. package/dist/chunks/{EntryPicker-CCCoJxbd.cjs.map → EntryPicker-B4dAsObz.cjs.map} +1 -1
  16. package/dist/chunks/{EntryPicker-DLCP4S-q.js → EntryPicker-DDXHytMN.js} +2 -2
  17. package/dist/chunks/{EntryPicker-DLCP4S-q.js.map → EntryPicker-DDXHytMN.js.map} +1 -1
  18. package/dist/chunks/{FormEditor-ArvjKtJJ.cjs → FormEditor-BGzE-rqk.cjs} +2 -2
  19. package/dist/chunks/{FormEditor-ArvjKtJJ.cjs.map → FormEditor-BGzE-rqk.cjs.map} +1 -1
  20. package/dist/chunks/{FormEditor-DnNBv9Xf.js → FormEditor-ChH4e5sB.js} +6 -6
  21. package/dist/chunks/{FormEditor-DnNBv9Xf.js.map → FormEditor-ChH4e5sB.js.map} +1 -1
  22. package/dist/chunks/{Icon-CD3oeiNA.cjs → Icon-3ucBRgrd.cjs} +2 -2
  23. package/dist/chunks/Icon-3ucBRgrd.cjs.map +1 -0
  24. package/dist/chunks/{Icon-CYXOo0Kt.js → Icon-dPXyBYe5.js} +39 -36
  25. package/dist/chunks/Icon-dPXyBYe5.js.map +1 -0
  26. package/dist/chunks/{Message-CIKSTXp8.cjs → Message-Ce2zjtfz.cjs} +2 -2
  27. package/dist/chunks/{Message-CIKSTXp8.cjs.map → Message-Ce2zjtfz.cjs.map} +1 -1
  28. package/dist/chunks/{Message-C73sJfdo.js → Message-DNaudg1u.js} +2 -2
  29. package/dist/chunks/{Message-C73sJfdo.js.map → Message-DNaudg1u.js.map} +1 -1
  30. package/dist/chunks/{RichTextEditor-CvbboqJY.js → RichTextEditor-BFblqw8m.js} +43 -39
  31. package/dist/chunks/RichTextEditor-BFblqw8m.js.map +1 -0
  32. package/dist/chunks/RichTextEditor-DU9CVeRD.cjs +2 -0
  33. package/dist/chunks/RichTextEditor-DU9CVeRD.cjs.map +1 -0
  34. package/dist/chunks/{use-picker-session-DUO4G8Cs.js → use-picker-session-BSpOwnQ-.js} +2 -2
  35. package/dist/chunks/{use-picker-session-DUO4G8Cs.js.map → use-picker-session-BSpOwnQ-.js.map} +1 -1
  36. package/dist/chunks/{use-picker-session-Bue5MJHQ.cjs → use-picker-session-ouqHBmVA.cjs} +2 -2
  37. package/dist/chunks/{use-picker-session-Bue5MJHQ.cjs.map → use-picker-session-ouqHBmVA.cjs.map} +1 -1
  38. package/dist/components/AssetCard/index.cjs +1 -1
  39. package/dist/components/AssetCard/index.js +1 -1
  40. package/dist/components/AssetGrid/index.cjs +1 -1
  41. package/dist/components/AssetGrid/index.js +1 -1
  42. package/dist/components/Banner/index.cjs +1 -1
  43. package/dist/components/Banner/index.js +1 -1
  44. package/dist/components/Board/index.cjs +1 -1
  45. package/dist/components/Board/index.js +1 -1
  46. package/dist/components/Button/index.cjs +1 -1
  47. package/dist/components/Button/index.js +1 -1
  48. package/dist/components/ColourField/index.cjs +1 -1
  49. package/dist/components/ColourField/index.js +1 -1
  50. package/dist/components/DatePicker/index.cjs +1 -1
  51. package/dist/components/DatePicker/index.js +1 -1
  52. package/dist/components/EditLayout/index.cjs +1 -1
  53. package/dist/components/EditLayout/index.js +1 -1
  54. package/dist/components/EntryPicker/index.cjs +1 -1
  55. package/dist/components/EntryPicker/index.js +1 -1
  56. package/dist/components/FormEditor/README.md +6 -4
  57. package/dist/components/FormEditor/index.cjs +1 -1
  58. package/dist/components/FormEditor/index.js +1 -1
  59. package/dist/components/Icon/icons.d.cts +3 -0
  60. package/dist/components/Icon/icons.d.cts.map +1 -1
  61. package/dist/components/Icon/icons.d.ts +3 -0
  62. package/dist/components/Icon/icons.d.ts.map +1 -1
  63. package/dist/components/Icon/index.cjs +1 -1
  64. package/dist/components/Icon/index.js +1 -1
  65. package/dist/components/RichTextEditor/index.cjs +1 -1
  66. package/dist/components/RichTextEditor/index.js +1 -1
  67. package/dist/components/RichTextEditor/storyblock-view.d.cts.map +1 -1
  68. package/dist/components/RichTextEditor/storyblock-view.d.ts.map +1 -1
  69. package/dist/components/RichTextEditor/style.css +66 -17
  70. package/dist/components/SearchField/index.cjs +1 -1
  71. package/dist/components/SearchField/index.js +1 -1
  72. package/dist/components/Select/index.cjs +1 -1
  73. package/dist/components/Select/index.js +1 -1
  74. package/dist/components/SideNav/index.cjs +1 -1
  75. package/dist/components/SideNav/index.js +1 -1
  76. package/dist/components/SortableList/index.cjs +1 -1
  77. package/dist/components/SortableList/index.js +1 -1
  78. package/dist/components/Stepper/index.cjs +1 -1
  79. package/dist/components/Stepper/index.js +1 -1
  80. package/dist/components/SubNav/index.cjs +1 -1
  81. package/dist/components/SubNav/index.js +1 -1
  82. package/dist/components/Table/index.cjs +1 -1
  83. package/dist/components/Table/index.js +1 -1
  84. package/dist/components/Toast/index.cjs +1 -1
  85. package/dist/components/Toast/index.js +1 -1
  86. package/dist/components/TopNav/index.cjs +1 -1
  87. package/dist/components/TopNav/index.js +1 -1
  88. package/dist/index.cjs +1 -1
  89. package/dist/index.js +7 -7
  90. package/package.json +1 -1
  91. package/dist/chunks/Icon-CD3oeiNA.cjs.map +0 -1
  92. package/dist/chunks/Icon-CYXOo0Kt.js.map +0 -1
  93. package/dist/chunks/RichTextEditor--kMao88d.cjs +0 -2
  94. package/dist/chunks/RichTextEditor--kMao88d.cjs.map +0 -1
  95. package/dist/chunks/RichTextEditor-CvbboqJY.js.map +0 -1
@@ -1,19 +1,19 @@
1
1
  import { Button as e } from "../components/Button/index.js";
2
2
  import { Field as t } from "../components/Field/index.js";
3
3
  import { TextArea as n, TextField as r } from "../components/TextField/index.js";
4
- import { n as i, r as a, t as o } from "./RichTextEditor-CvbboqJY.js";
5
- import { n as s, r as c } from "./use-picker-session-DUO4G8Cs.js";
4
+ import { n as i, r as a, t as o } from "./RichTextEditor-BFblqw8m.js";
5
+ import { n as s, r as c } from "./use-picker-session-BSpOwnQ-.js";
6
6
  import { Checkbox as l, ChoiceGroup as u, Radio as d } from "../components/Choice/index.js";
7
7
  import { Container as f } from "../components/Container/index.js";
8
- import { t as p } from "./EntryPicker-DLCP4S-q.js";
8
+ import { t as p } from "./EntryPicker-DDXHytMN.js";
9
9
  import { n as m } from "./decimal-hq_W9D3s.js";
10
10
  import { t as h } from "./NumberField-C90eJGny.js";
11
11
  import { Select as g } from "../components/Select/index.js";
12
12
  import { Switch as _ } from "../components/Switch/index.js";
13
13
  import { i as v } from "./colour-CYEF4Q_n.js";
14
14
  import { i as y, n as b, r as x, t as S } from "./Slider-Cab6NqhK.js";
15
- import { t as C } from "./ColourField-BTj9NHgI.js";
16
- import { a as ee, n as te } from "./DatePicker-Cb5WspIC.js";
15
+ import { t as C } from "./ColourField-BG5oGj9f.js";
16
+ import { a as ee, n as te } from "./DatePicker-LqaePc57.js";
17
17
  import { TagsInput as ne } from "../components/TagsInput/index.js";
18
18
  import { CheckboxCard as re, RadioCard as ie, SelectionCardGroup as w } from "../components/SelectionCard/index.js";
19
19
  import { useMemo as T, useState as E } from "react";
@@ -690,4 +690,4 @@ function Pe({ schema: e, value: t, defaultValue: n = {}, onValueChange: r, picke
690
690
  //#endregion
691
691
  export { xe as n, Pe as t };
692
692
 
693
- //# sourceMappingURL=FormEditor-DnNBv9Xf.js.map
693
+ //# sourceMappingURL=FormEditor-ChH4e5sB.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormEditor-DnNBv9Xf.js","names":["_Fragment","documentError","emptyDocument","RichTextEditor","selectionCount","selectionLimit","EntryPicker","preciseSum","NumberField","parseColour","sliderScale","Slider","clampToScale","RangeSlider","ColourField","isIsoDate","DateField","Fragment$1","expandedWidths","fieldWidths","fieldTypes","assertModel","ids","field","model","assertTypeOptions","assertMeasures","assertLimitOptions","assertChoices","assertSlider","assertNumber","limitedTypes","supportsLimit","fieldLimitProps","fieldLimit","stored","selected","source","textValue","stringList","pickerLimits","mode","max","fieldCount","caps","pickerCopy","cap","min","step","bound","label","kind","values","option","value","linkCopy","fieldLabel","defaults","selectedIds","isLink","link","key","parseUtcDateTime","match","canonical","date","hasRichText","node","requiredError","textError","richTextError","error","choiceError","item","listError","numberError","dateError","sliderValue","scale","rangeSliderValue","range","start","end","low","high","a","b","rangeError","colourError","linkError","itemLabel","itemsLabel","validators","fieldError","validateFormValues","Option","props","isDisabled","invalid","onChange","Card","RadioCard","CheckboxCard","Choice","Radio","Checkbox","ChoiceControl","multiple","Group","SelectionCardGroup","ChoiceGroup","accessibility","required","Button","SliderControl","shown","next","RangeSliderControl","AdditionalControl","raw","event","TagsInput","pickerValue","links","NumberControl","SelectControl","isClearable","Select","PickerControl","FormControl","shared","TextField","TextArea","Switch","FormEditorField","validation","useMemo","isErrorVisible","Container","Field","groupTypes","loadedValidationTypes","FormEditor","rest","internal","setInternal","useState","defaultValue","changed","setChanged","current","schema","commit","fieldId","previous","onValueChange","layout","columns","minColumnWidth","className","style","fieldDisabled","isLocked","isLoaded","showAllErrors","pickerItems","pickerSources","embedSources","errors"],"sources":["../../src/components/RichTextEditor/expanded-width.ts","../../src/components/FormEditor/model.ts","../../src/components/FormEditor/choice-control.tsx","../../src/components/FormEditor/additional-control.tsx","../../src/components/FormEditor/control.tsx","../../src/components/FormEditor/index.tsx"],"sourcesContent":["/** Expanded writing measures: `wide` caps at the shared wide Modal width; `full` fills the viewport inside the scrim's gutters. */\nexport const expandedWidths = [\"wide\", \"full\"] as const;\n\nexport type RichTextEditorExpandedWidth = (typeof expandedWidths)[number];\n","import type { ReactNode } from \"react\";\nimport type { SelectOption } from \"../Select\";\nimport type { EntryPickerMode, EntryPickerProps, EntryPickerSource } from \"../EntryPicker\";\nimport { selectionCount, selectionLimit } from \"../EntryPicker/limit\";\nimport type { JSONContent } from \"@tiptap/react\";\nimport { documentError } from \"../RichTextEditor/document\";\nimport type { RichTextDocument } from \"../RichTextEditor\";\nimport { expandedWidths, type RichTextEditorExpandedWidth } from \"../RichTextEditor/expanded-width\";\nimport { isIsoDate } from \"../DatePicker/date\";\nimport type { RangeSliderValue } from \"../Slider\";\nimport { clampToScale, sliderScale, type SliderScale } from \"../Slider/scale\";\nimport { preciseSum } from \"../../internal/decimal\";\nimport { parseColour } from \"../ColourField/colour\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport type { ContainerWidth } from \"../Container\";\nimport type { FieldLimit, FieldLimitOptions } from \"../Field/types\";\n\n/** The shared measures a field may cap at; checked against Container's scale. */\nconst fieldWidths = [\"sm\", \"md\", \"lg\"] as const satisfies readonly ContainerWidth[];\n\ninterface FormFieldBase {\n id: string;\n label: string;\n hint?: ReactNode;\n /** Maximum width of the whole field, using Container's measures and its `lg` default. */\n width?: (typeof fieldWidths)[number];\n placeholder?: string;\n required?: boolean;\n isDisabled?: boolean;\n}\n\ninterface SliderOptions {\n multiple?: never;\n min?: number;\n max?: number;\n step?: number;\n prefix?: string;\n suffix?: string;\n hasValueLabel?: boolean;\n}\n\ninterface ChoiceOptions {\n multiple?: never;\n autoFocus?: never;\n options: SelectOption[];\n appearance?: \"default\" | \"card\";\n /** Maximum options per row inside this group; independent of FormEditor columns. */\n columns?: 1 | 2 | 3;\n}\n\nexport type FormField = FormFieldBase &\n (\n | ({\n type: \"shortText\";\n inputType?: \"text\" | \"email\";\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n } & FieldLimitOptions)\n | ({\n type: \"longText\";\n rows?: number;\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n } & FieldLimitOptions)\n | { type: \"boolean\" | \"dateTime\"; autoFocus?: boolean; multiple?: never }\n | {\n type: \"richText\";\n expandedWidth?: RichTextEditorExpandedWidth;\n autoFocus?: never;\n multiple?: never;\n }\n | {\n type: \"number\";\n min?: number;\n max?: number;\n /** Positive, or `\"any\"` (the default) to accept typed decimals. */\n step?: number | \"any\";\n /** Show NumberField's − / + buttons, its default; false keeps typing and arrow keys. */\n hasSteppers?: boolean;\n /** Stepper names; default to \"Decrease {label}\" and \"Increase {label}\". */\n decreaseLabel?: string;\n increaseLabel?: string;\n prefix?: string;\n suffix?: string;\n autoFocus?: boolean;\n multiple?: never;\n }\n | { type: \"select\"; options: SelectOption[]; autoFocus?: boolean; multiple?: never }\n | ({ type: \"slider\"; autoFocus?: boolean } & SliderOptions)\n | ({ type: \"rangeSlider\"; autoFocus?: never } & SliderOptions)\n | ({ type: \"radioGroup\" } & ChoiceOptions)\n | ({ type: \"checkboxGroup\" } & ChoiceOptions)\n | {\n type: \"colour\";\n multiple?: never;\n presets?: string[];\n showPresets?: boolean;\n picker?: \"custom\" | \"native\";\n placement?: PopoverPlacement;\n readOnly?: boolean;\n autoFocus?: boolean;\n }\n | ({ type: \"tags\"; max?: number; multiple?: never; autoFocus?: never } & FieldLimitOptions)\n | {\n type: \"date\";\n min?: string;\n max?: string;\n placement?: PopoverPlacement;\n multiple?: never;\n autoFocus?: never;\n }\n | ({\n type: \"asset\" | \"reference\";\n multiple?: boolean;\n autoFocus?: never;\n picker?: Pick<\n EntryPickerProps,\n \"label\" | \"addLabel\" | \"emptyLabel\" | \"itemLabel\" | \"itemsLabel\" | \"max\" | \"isReorderable\"\n >;\n } & FieldLimitOptions)\n );\n\nexport type FieldOf<T extends FormField[\"type\"]> = Extract<FormField, { type: T }>;\n\n/** Layout only: no label, value, disabled state, or validation. */\nexport interface FormDivider {\n id: string;\n type: \"divider\";\n}\n\nexport type FormItem = FormField | FormDivider;\n\nexport interface FormSchema {\n fields: readonly FormItem[];\n}\n\nexport interface AssetValue {\n assetId: string;\n}\nexport interface ReferenceValue {\n entryId: string;\n}\nexport type FormFieldValue =\n | string\n | number\n | boolean\n | RichTextDocument\n | AssetValue\n | ReferenceValue\n | string[]\n | RangeSliderValue\n | AssetValue[]\n | ReferenceValue[];\nexport type FormValues = Record<string, FormFieldValue | undefined>;\nexport type FormErrors = Partial<Record<string, string>>;\n\nconst fieldTypes = new Set([\n \"shortText\",\n \"longText\",\n \"richText\",\n \"number\",\n \"boolean\",\n \"dateTime\",\n \"asset\",\n \"reference\",\n \"select\",\n \"slider\",\n \"rangeSlider\",\n \"colour\",\n \"radioGroup\",\n \"checkboxGroup\",\n \"tags\",\n \"date\",\n \"divider\",\n]);\n\nexport function assertModel(model: FormSchema) {\n const ids = new Set<string>();\n for (const field of model.fields) {\n if (!field.id?.trim() || ids.has(field.id)) {\n throw new Error(\"Form field IDs must be nonempty and unique.\");\n }\n if (!fieldTypes.has(field.type)) {\n throw new Error(`Unsupported form field type: ${field.type}`);\n }\n // Removed in decision 0091; untyped schemas would otherwise lose its content silently.\n if (\"labelHint\" in field) {\n throw new Error(`Field ${field.id} uses the removed labelHint; move its content into hint.`);\n }\n if (field.type !== \"divider\") {\n assertTypeOptions(field);\n assertMeasures(field);\n assertLimitOptions(field);\n }\n ids.add(field.id);\n }\n}\n\n/** Options only some field types carry, checked before shared measures and limits. */\nfunction assertTypeOptions(field: FormField) {\n switch (field.type) {\n case \"select\":\n case \"radioGroup\":\n case \"checkboxGroup\":\n return assertChoices(field);\n case \"slider\":\n case \"rangeSlider\":\n return assertSlider(field);\n case \"number\":\n return assertNumber(field);\n }\n}\n\nconst limitedTypes = new Set([\"shortText\", \"longText\", \"tags\", \"asset\", \"reference\"]);\n\nfunction supportsLimit(\n field: FormField,\n): field is FieldOf<\"shortText\" | \"longText\" | \"tags\" | \"asset\" | \"reference\"> {\n return limitedTypes.has(field.type);\n}\n\nfunction assertLimitOptions(field: FormField) {\n if (!supportsLimit(field)) {\n return;\n }\n if (field.limitDisplay !== undefined && ![\"used\", \"remaining\"].includes(field.limitDisplay)) {\n throw new Error(`Field ${field.id} needs a limitDisplay of used or remaining.`);\n }\n if (\n field.limitVisibility !== undefined &&\n ![\"always\", \"nearLimit\"].includes(field.limitVisibility)\n ) {\n throw new Error(`Field ${field.id} needs a limitVisibility of always or nearLimit.`);\n }\n if (field.showLimitRing !== undefined && typeof field.showLimitRing !== \"boolean\") {\n throw new Error(`Field ${field.id} needs a boolean showLimitRing.`);\n }\n}\n\n/**\n * Explicit limits for complete server markup. Counts come from the helpers the\n * adapters display with (`textValue`, `stringList`, the owning field's selected\n * IDs, `pickerLimits` and EntryPicker's `selectionLimit`), so the counter cannot\n * drift from them.\n */\nexport function fieldLimitProps(\n field: FormField,\n stored: FormFieldValue | undefined,\n selected: string[] | undefined,\n source?: EntryPickerSource,\n): FieldLimitOptions & { limit?: FieldLimit } {\n if (!supportsLimit(field)) {\n return {};\n }\n return {\n limitDisplay: field.limitDisplay,\n limitVisibility: field.limitVisibility,\n showLimitRing: field.showLimitRing,\n limit: fieldLimit(field, stored, selected ?? [], source),\n };\n}\n\nfunction fieldLimit(\n field: FieldOf<\"shortText\" | \"longText\" | \"tags\" | \"asset\" | \"reference\">,\n stored: FormFieldValue | undefined,\n selected: string[],\n source: EntryPickerSource | undefined,\n): FieldLimit | undefined {\n switch (field.type) {\n case \"shortText\":\n case \"longText\":\n return field.maxLength === undefined\n ? undefined\n : { count: textValue(stored).length, max: field.maxLength };\n case \"tags\":\n return field.max === undefined\n ? undefined\n : { count: stringList(stored).length, max: field.max };\n default: {\n // A scalar field holds one link in either runtime mode, a neutral slot of one.\n const { mode, max } = pickerLimits(field, source);\n return selectionLimit(mode, selected.length, max);\n }\n }\n}\n\n/**\n * The label's count badge: a picker's selected IDs, unless it holds one item\n * and its reading already shows that, or a checkbox group's checked options.\n */\nexport function fieldCount(\n field: FormField,\n stored: FormFieldValue | undefined,\n selected: string[] | undefined,\n source?: EntryPickerSource,\n) {\n if (selected !== undefined && (field.type === \"asset\" || field.type === \"reference\")) {\n const { mode, max } = pickerLimits(field, source);\n return selectionCount(mode, selected.length, max);\n }\n return field.type === \"checkboxGroup\" ? stringList(stored).length : undefined;\n}\n\n/** The text a shortText or longText adapter displays. */\nexport function textValue(stored: unknown): string {\n return typeof stored === \"string\" ? stored : \"\";\n}\n\n/**\n * The mode and cap a picker field renders with. Runtime sources may tighten\n * interaction, never what the schema stores or validates: a scalar field in\n * runtime multiple mode is capped at one, and a schema cap is never lifted. A\n * non-finite source cap (Infinity, NaN) means no cap of its own, as EntryPicker\n * reads it, so it can't erase the schema's through Math.min.\n */\nexport function pickerLimits(\n field: FieldOf<\"asset\" | \"reference\">,\n source?: EntryPickerSource,\n): { mode: EntryPickerMode; max: number | undefined } {\n const mode = source?.mode ?? (field.multiple ? \"multiple\" : \"single\");\n if (!field.multiple) {\n return { mode, max: mode === \"multiple\" ? 1 : undefined };\n }\n const caps = [pickerCopy(field).max, source?.max].filter(\n (cap): cap is number => cap !== undefined && Number.isFinite(cap),\n );\n return { mode, max: caps.length > 0 ? Math.min(...caps) : undefined };\n}\n\n/** Runtime schemas can carry any string; the types only cover typed schemas. */\nfunction assertMeasures(field: FormField) {\n if (field.width !== undefined && !fieldWidths.includes(field.width)) {\n throw new Error(`Field ${field.id} needs a width of sm, md or lg.`);\n }\n if (\n field.type === \"richText\" &&\n field.expandedWidth !== undefined &&\n !expandedWidths.includes(field.expandedWidth)\n ) {\n throw new Error(`Rich text field ${field.id} needs an expandedWidth of wide or full.`);\n }\n}\n\nfunction assertSlider(field: FieldOf<\"slider\" | \"rangeSlider\">) {\n const { min, max, step } = sliderScale(field);\n if (![min, max, step].every(Number.isFinite) || min >= max || step <= 0) {\n throw new Error(`Slider field ${field.id} needs finite min < max and a positive step.`);\n }\n if (field.type === \"rangeSlider\" && step > preciseSum(max, -min)) {\n throw new Error(`Range slider ${field.id} needs room for at least one step.`);\n }\n}\n\nfunction assertNumber(field: FieldOf<\"number\">) {\n const { min, max, step = \"any\" } = field;\n if (\n [min, max].some((bound) => bound !== undefined && !Number.isFinite(bound)) ||\n (min !== undefined && max !== undefined && min > max) ||\n (step !== \"any\" && !(Number.isFinite(step) && step > 0))\n ) {\n throw new Error(\n `Number field ${field.id} needs finite min <= max and a positive step or \"any\".`,\n );\n }\n const labels = [field.decreaseLabel, field.increaseLabel];\n if (labels.some((label) => label !== undefined && (typeof label !== \"string\" || !label.trim()))) {\n throw new Error(`Number field ${field.id} needs nonempty stepper labels.`);\n }\n}\n\nfunction assertChoices(field: FieldOf<\"select\" | \"radioGroup\" | \"checkboxGroup\">) {\n if (!Array.isArray(field.options)) {\n const kind = field.type === \"select\" ? \"Select\" : \"Choice\";\n throw new Error(`${kind} field ${field.id} needs an options array.`);\n }\n if (field.type === \"select\") {\n return;\n }\n const values = field.options.map((option) => option.value);\n if (\n values.some((value) => typeof value !== \"string\" || !value.trim()) ||\n new Set(values).size !== values.length\n ) {\n throw new Error(`Choice field ${field.id} needs nonempty, unique option values.`);\n }\n}\n\nconst linkCopy = {\n asset: { key: \"assetId\", itemLabel: \"asset\", itemsLabel: \"assets\" },\n reference: { key: \"entryId\", itemLabel: \"entry\", itemsLabel: \"entries\" },\n} as const;\n\n/** The field's visible and accessible name. A picker's `label` overrides it. */\nexport function fieldLabel(field: FormField): string {\n return field.type === \"asset\" || field.type === \"reference\"\n ? (field.picker?.label ?? field.label)\n : field.label;\n}\n\n/** Picker action and item copy, with asset or entry wording for any option left out or undefined. */\nexport function pickerCopy(field: FieldOf<\"asset\" | \"reference\">) {\n const defaults = linkCopy[field.type];\n const {\n addLabel = `Choose ${fieldLabel(field)}`,\n emptyLabel,\n itemLabel = defaults.itemLabel,\n itemsLabel = defaults.itemsLabel,\n max,\n isReorderable,\n } = field.picker ?? {};\n return { addLabel, emptyLabel, itemLabel, itemsLabel, max, isReorderable };\n}\n\n/** The picked IDs, in stored order, skipping anything that isn't a link. */\nexport function selectedIds(field: FieldOf<\"asset\" | \"reference\">, value: unknown): string[] {\n const { key } = linkCopy[field.type];\n const links = Array.isArray(value) ? value : value === undefined ? [] : [value];\n return links.flatMap((link) =>\n isLink(link, key) ? [(link as Record<string, string>)[key]] : [],\n );\n}\n\n/** Accept UTC ISO strings without rolling invalid dates into the next month. */\nexport function parseUtcDateTime(value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return;\n }\n const match = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(?::(\\d{2})(?:\\.(\\d{1,3}))?)?(?:Z|\\+00:00)$/.exec(\n value,\n );\n if (!match) {\n return;\n }\n const canonical = `${match[1]}:${match[2] ?? \"00\"}.${(match[3] ?? \"\").padEnd(3, \"0\")}Z`;\n const date = new Date(canonical);\n if (Number.isFinite(date.getTime()) && date.toISOString() === canonical) {\n return canonical;\n }\n}\n\nfunction isLink(value: unknown, key: \"assetId\" | \"entryId\"): boolean {\n return (\n !!value &&\n typeof value === \"object\" &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === \"string\" &&\n (value as Record<string, string>)[key].trim().length > 0\n );\n}\n\nfunction hasRichText(node: JSONContent): boolean {\n return (\n !!node.text?.trim() ||\n node.type === \"horizontalRule\" ||\n node.type === \"storyblock\" ||\n !!node.content?.some(hasRichText)\n );\n}\n\nfunction requiredError(field: FormField): string {\n return `${fieldLabel(field)} is required.`;\n}\n\nfunction textError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter text.\";\n }\n if (field.required && !value.trim()) {\n return requiredError(field);\n }\n if (\n (field.type === \"shortText\" || field.type === \"longText\") &&\n field.maxLength !== undefined &&\n value.length > field.maxLength\n ) {\n return `Enter no more than ${field.maxLength} characters.`;\n }\n}\n\nfunction richTextError(field: FormField, value: unknown): string | undefined {\n const error = documentError(value);\n if (error) {\n return error;\n }\n if (field.required && !hasRichText(value as RichTextDocument)) {\n return requiredError(field);\n }\n}\n\nfunction choiceError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Choose an available option.\";\n }\n if (value === \"\") {\n return field.required ? requiredError(field) : undefined;\n }\n // An empty list means the choices are still loading, so a stored value stays valid until they arrive.\n if (\n (field.type === \"select\" || field.type === \"radioGroup\") &&\n field.options.length > 0 &&\n !field.options.some((option) => option.value === value)\n ) {\n return \"Choose an available option.\";\n }\n}\n\nexport function stringList(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((item): item is string => typeof item === \"string\")\n : [];\n}\n\nfunction listError(field: FormField, value: unknown): string | undefined {\n if (\n !Array.isArray(value) ||\n !value.every((item) => typeof item === \"string\" && item.trim()) ||\n new Set(value).size !== value.length\n ) {\n return \"Enter a list of unique, nonempty text values.\";\n }\n if (field.required && !value.length) {\n return requiredError(field);\n }\n if (field.type === \"tags\" && field.max !== undefined && value.length > field.max) {\n return `Enter no more than ${field.max} tags.`;\n }\n if (\n field.type === \"checkboxGroup\" &&\n field.options.length &&\n value.some((item) => !field.options.some((option) => option.value === item))\n ) {\n return \"Choose available options.\";\n }\n}\n\nfunction numberError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n return \"Enter a finite number.\";\n }\n const { min, max }: { min?: number; max?: number } =\n field.type === \"slider\" || field.type === \"rangeSlider\"\n ? sliderScale(field)\n : field.type === \"number\"\n ? field\n : {};\n if (min !== undefined && value < min) {\n return `Enter a number of at least ${min}.`;\n }\n if (max !== undefined && value > max) {\n return `Enter a number no greater than ${max}.`;\n }\n}\n\nfunction dateError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (!value) {\n return field.required ? requiredError(field) : undefined;\n }\n if (!isIsoDate(value)) {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (field.type !== \"date\") {\n return;\n }\n if (field.min && value < field.min) {\n return `Choose a date on or after ${field.min}.`;\n }\n if (field.max && value > field.max) {\n return `Choose a date on or before ${field.max}.`;\n }\n}\n\n/**\n * Display positions for loaded values: out-of-scale numbers clamp and reversed\n * endpoints swap, without overwriting the stored data that validation reports.\n * A value that is not a finite number has no position, so the control is unset.\n */\nexport function sliderValue(value: unknown, scale: SliderScale): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value)\n ? clampToScale(value, scale)\n : undefined;\n}\n\n/** A range with neither endpoint usable is unset; one usable endpoint pairs with the scale's end. */\nexport function rangeSliderValue(value: unknown, scale: SliderScale): RangeSliderValue | undefined {\n const range = value as Partial<Record<\"min\" | \"max\", unknown>> | null;\n const start = sliderValue(range?.min, scale);\n const end = sliderValue(range?.max, scale);\n if (start === undefined && end === undefined) {\n return undefined;\n }\n const [low, high] = [start ?? scale.min, end ?? scale.max].sort((a, b) => a - b);\n return { min: low, max: high };\n}\n\nfunction rangeError(field: FormField, value: unknown): string | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return \"Enter a range.\";\n }\n const range = value as Record<string, unknown>;\n const start = range.min;\n const end = range.max;\n const error = numberError(field, start) ?? numberError(field, end);\n if (error) {\n return error;\n }\n if ((start as number) > (end as number)) {\n return \"The start must not be greater than the end.\";\n }\n if (\n field.type === \"rangeSlider\" &&\n preciseSum(end as number, -(start as number)) < sliderScale(field).step\n ) {\n return \"Keep the range endpoints at least one step apart.\";\n }\n}\n\nfunction colourError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid colour.\";\n }\n if (!value.trim()) {\n return field.required ? requiredError(field) : undefined;\n }\n return parseColour(value) ? undefined : \"Enter a valid colour.\";\n}\n\nfunction linkError(field: FormField, value: unknown): string | undefined {\n if (field.type !== \"asset\" && field.type !== \"reference\") {\n return;\n }\n const { key, itemLabel, itemsLabel } = linkCopy[field.type];\n if (!field.multiple) {\n return isLink(value, key) ? undefined : `Choose an ${itemLabel}.`;\n }\n if (!Array.isArray(value) || !value.every((item) => isLink(item, key))) {\n return `Choose a list of ${itemsLabel}.`;\n }\n if (field.required && value.length === 0) {\n return requiredError(field);\n }\n const max = field.picker?.max;\n if (max !== undefined && value.length > max) {\n return `Choose no more than ${max} ${pickerCopy(field).itemsLabel}.`;\n }\n}\n\nconst validators: Record<\n FormField[\"type\"],\n (field: FormField, value: unknown) => string | undefined\n> = {\n shortText: textError,\n longText: textError,\n richText: richTextError,\n number: numberError,\n slider: numberError,\n rangeSlider: rangeError,\n date: dateError,\n colour: colourError,\n radioGroup: choiceError,\n checkboxGroup: listError,\n tags: listError,\n boolean: (_field, value) => (typeof value === \"boolean\" ? undefined : \"Choose a boolean value.\"),\n dateTime: (_field, value) =>\n parseUtcDateTime(value) ? undefined : \"Enter a valid UTC date and time.\",\n select: choiceError,\n asset: linkError,\n reference: linkError,\n};\n\nexport function fieldError(field: FormField, value: unknown): string | undefined {\n if (value === undefined) {\n return field.required ? requiredError(field) : undefined;\n }\n return validators[field.type](field, value);\n}\n\n/** Validate data loaded from JSON as well as values emitted by FormEditor. */\nexport function validateFormValues(model: FormSchema, values: Record<string, unknown>): FormErrors {\n assertModel(model);\n return Object.fromEntries(\n model.fields.flatMap((field): [string, string][] => {\n if (field.type === \"divider\") {\n return [];\n }\n const error = fieldError(\n field,\n Object.hasOwn(values, field.id) ? values[field.id] : undefined,\n );\n return error ? [[field.id, error]] : [];\n }),\n );\n}\n","import { Button } from \"../Button\";\nimport { Checkbox, ChoiceGroup, Radio } from \"../Choice\";\nimport { CheckboxCard, RadioCard, SelectionCardGroup } from \"../SelectionCard\";\nimport type { SelectOption } from \"../Select\";\nimport type { ControlProps } from \"./control\";\nimport { stringList, type FieldOf } from \"./model\";\n\ntype ChoiceField = FieldOf<\"radioGroup\" | \"checkboxGroup\">;\n\nfunction Option({\n field,\n option,\n name,\n checked,\n isDisabled,\n invalid,\n onChange,\n}: {\n field: ChoiceField;\n option: SelectOption;\n name: string;\n checked: boolean;\n isDisabled: boolean;\n invalid: true | undefined;\n onChange: () => void;\n}) {\n const props = {\n name,\n value: option.value,\n checked,\n disabled: isDisabled || option.isDisabled,\n \"aria-invalid\": invalid,\n onChange: () => {\n if (!isDisabled && !option.isDisabled) {\n onChange();\n }\n },\n };\n if (field.appearance === \"card\") {\n const Card = field.type === \"radioGroup\" ? RadioCard : CheckboxCard;\n return (\n <Card\n {...props}\n title={option.label}\n description={option.description}\n />\n );\n }\n const Choice = field.type === \"radioGroup\" ? Radio : Checkbox;\n return (\n <Choice {...props}>\n <span>\n {option.label}\n {option.description && (\n <span className=\"ds-form-editor__option-description\">{option.description}</span>\n )}\n </span>\n </Choice>\n );\n}\n\nexport function ChoiceControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<ChoiceField>) {\n const multiple = field.type === \"checkboxGroup\";\n // Option values are nonempty, so a stored \"\" selects nothing.\n const selected = multiple\n ? stringList(stored)\n : typeof stored === \"string\" && stored\n ? [stored]\n : [];\n const Group = field.appearance === \"card\" ? SelectionCardGroup : ChoiceGroup;\n return (\n <>\n <Group\n {...accessibility}\n label={field.label}\n columns={field.columns ?? (field.appearance === \"card\" ? 2 : 1)}\n >\n {field.options.map((option) => (\n <Option\n key={option.value}\n field={field}\n option={option}\n name={accessibility.id}\n checked={selected.includes(option.value)}\n isDisabled={isDisabled}\n invalid={accessibility[\"aria-invalid\"]}\n onChange={() => {\n if (multiple) {\n onChange(\n selected.includes(option.value)\n ? selected.filter((value) => value !== option.value)\n : [...selected, option.value],\n );\n } else {\n onChange(option.value);\n }\n }}\n />\n ))}\n </Group>\n {!multiple && !required && selected.length > 0 && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isDisabled={isDisabled}\n onClick={() => onChange(undefined)}\n >\n Clear {field.label}\n </Button>\n )}\n </>\n );\n}\n","import { ColourField } from \"../ColourField\";\nimport { parseColour } from \"../ColourField/colour\";\nimport { DateField } from \"../DatePicker\";\nimport { RangeSlider, Slider } from \"../Slider\";\nimport { sliderScale } from \"../Slider/scale\";\nimport { TagsInput } from \"../TagsInput\";\nimport { ChoiceControl } from \"./choice-control\";\nimport type { ControlProps } from \"./control\";\nimport { rangeSliderValue, sliderValue, stringList, type FieldOf } from \"./model\";\n\ntype AdditionalField = FieldOf<\n \"slider\" | \"rangeSlider\" | \"date\" | \"colour\" | \"tags\" | \"radioGroup\" | \"checkboxGroup\"\n>;\n\nfunction SliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"slider\">>) {\n const scale = sliderScale(field);\n const shown = sliderValue(stored, scale);\n return (\n <Slider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={shown ?? scale.min}\n onValueChange={onChange}\n // An unset thumb rests at the minimum, where a click or a key toward it fires\n // no change event. Committing stores the position the slider shows.\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nfunction RangeSliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"rangeSlider\">>) {\n const scale = sliderScale(field);\n const shown = rangeSliderValue(stored, scale);\n return (\n <RangeSlider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n minLabel={`${field.label} minimum`}\n maxLabel={`${field.label} maximum`}\n isDisabled={isDisabled}\n // Unset thumbs rest at both ends without a fill, so nothing looks chosen; a click\n // or key that leaves them there stores the full range they show.\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n hasFill={shown !== undefined}\n value={shown ?? { min: scale.min, max: scale.max }}\n onValueChange={onChange}\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nexport function AdditionalControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<AdditionalField>) {\n const props = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"radioGroup\":\n case \"checkboxGroup\":\n return (\n <ChoiceControl\n field={field}\n {...props}\n />\n );\n case \"rangeSlider\":\n return (\n <RangeSliderControl\n field={field}\n {...props}\n />\n );\n case \"slider\":\n return (\n <SliderControl\n field={field}\n {...props}\n />\n );\n case \"colour\":\n return (\n <ColourField\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n presets={field.presets}\n showPresets={field.showPresets}\n picker={field.picker}\n placement={field.placement}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={typeof stored === \"string\" ? stored : \"\"}\n onInput={(event) => {\n const raw = event.currentTarget.value;\n if (raw.trim() && !parseColour(raw)) {\n onChange(raw);\n }\n }}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n case \"tags\":\n return (\n <TagsInput\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n max={field.max}\n isDisabled={isDisabled}\n value={stringList(stored)}\n onValueChange={onChange}\n />\n );\n case \"date\":\n return (\n <DateField\n {...accessibility}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n placement={field.placement}\n isDisabled={isDisabled}\n isClearable\n clearLabel={`Clear ${field.label}`}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n }\n}\n","import type { RichTextEmbedSources } from \"../RichTextEditor\";\nimport { EntryPicker, type EntryItem, type EntryPickerSource } from \"../EntryPicker\";\nimport type { FieldRenderProps } from \"../Field\";\nimport { NumberField } from \"../NumberField\";\nimport { RichTextEditor, type RichTextDocument } from \"../RichTextEditor\";\nimport { emptyDocument } from \"../RichTextEditor/document\";\nimport { Select } from \"../Select\";\nimport { Switch } from \"../Switch\";\nimport { TextArea, TextField } from \"../TextField\";\nimport { AdditionalControl } from \"./additional-control\";\nimport {\n parseUtcDateTime,\n pickerCopy,\n pickerLimits,\n textValue,\n type FieldOf,\n type FormField,\n type FormFieldValue,\n} from \"./model\";\n\nfunction pickerValue(\n field: FieldOf<\"asset\" | \"reference\">,\n ids: string[],\n): FormFieldValue | undefined {\n if (field.type === \"asset\") {\n const links = ids.map((assetId) => ({ assetId }));\n return field.multiple ? links : links[0];\n }\n const links = ids.map((entryId) => ({ entryId }));\n return field.multiple ? links : links[0];\n}\n\ntype Accessibility = FieldRenderProps;\n\nexport interface ControlProps<F extends FormField> {\n field: F;\n stored: FormFieldValue | undefined;\n isDisabled: boolean;\n required: boolean | undefined;\n accessibility: Omit<Accessibility, \"required\">;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nfunction NumberControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"number\">>) {\n return (\n <NumberField\n {...accessibility}\n required={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n step={field.step ?? \"any\"}\n hasSteppers={field.hasSteppers}\n prefix={field.prefix}\n suffix={field.suffix}\n autoFocus={field.autoFocus}\n decreaseLabel={field.decreaseLabel ?? `Decrease ${field.label}`}\n increaseLabel={field.increaseLabel ?? `Increase ${field.label}`}\n value={typeof stored === \"number\" && Number.isFinite(stored) ? stored : \"\"}\n onValueChange={(next) => {\n if (next === \"\" || Number.isFinite(next)) {\n onChange(next === \"\" ? undefined : next);\n }\n }}\n />\n );\n}\n\nfunction SelectControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"select\">>) {\n // Optional selects lead with an empty choice; picking it removes the key.\n const isClearable = !required && !field.options.some((option) => option.value === \"\");\n return (\n <Select\n {...accessibility}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n isInvalid={accessibility[\"aria-invalid\"]}\n options={\n isClearable\n ? [{ value: \"\", label: field.placeholder ?? \"None\" }, ...field.options]\n : field.options\n }\n placeholder={field.placeholder}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n}\n\nfunction PickerControl({\n field,\n selected,\n items,\n source,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"asset\" | \"reference\">> & {\n items: EntryItem[];\n source?: EntryPickerSource;\n selected: string[];\n}) {\n return (\n <EntryPicker\n {...accessibility}\n {...source}\n items={items}\n value={selected}\n {...pickerCopy(field)}\n {...pickerLimits(field, source)}\n isDisabled={isDisabled}\n onValueChange={(ids) => onChange(pickerValue(field, ids))}\n />\n );\n}\n\ninterface FormControlProps {\n embeds?: RichTextEmbedSources;\n field: FormField;\n stored: FormFieldValue | undefined;\n /** Picker fields' stored IDs, derived once by the owning field. */\n selected: string[] | undefined;\n items: EntryItem[];\n source?: EntryPickerSource;\n isDisabled: boolean;\n accessibility: Accessibility;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nexport function FormControl({\n embeds,\n field,\n stored,\n selected,\n items,\n source,\n isDisabled,\n accessibility: { required, ...accessibility },\n onChange,\n}: FormControlProps) {\n const shared = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"shortText\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n type={field.inputType}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={textValue(stored)}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"longText\":\n return (\n <TextArea\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n rows={field.rows}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={textValue(stored)}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"number\":\n return (\n <NumberControl\n field={field}\n {...shared}\n />\n );\n case \"boolean\":\n return (\n <Switch\n {...accessibility}\n isDisabled={isDisabled}\n autoFocus={field.autoFocus}\n isSelected={stored === true}\n onSelectedChange={onChange}\n />\n );\n case \"dateTime\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n type=\"datetime-local\"\n step=\"0.001\"\n autoFocus={field.autoFocus}\n value={parseUtcDateTime(stored)?.slice(0, -1) ?? \"\"}\n onChange={(event) => onChange(parseUtcDateTime(`${event.target.value}Z`))}\n />\n );\n case \"richText\":\n return (\n <RichTextEditor\n {...accessibility}\n expandedWidth={field.expandedWidth}\n embeds={embeds}\n label={field.label}\n isRequired={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n format=\"json\"\n value={stored === undefined ? emptyDocument : (stored as RichTextDocument)}\n onChange={onChange}\n />\n );\n case \"select\":\n return (\n <SelectControl\n field={field}\n {...shared}\n />\n );\n case \"asset\":\n case \"reference\":\n return (\n <PickerControl\n field={field}\n items={items}\n source={source}\n selected={selected ?? []}\n {...shared}\n />\n );\n default:\n return (\n <AdditionalControl\n field={field}\n {...shared}\n />\n );\n }\n}\n","import { useMemo, useState, type CSSProperties, type HTMLAttributes } from \"react\";\nimport type { RichTextEmbedSources } from \"../RichTextEditor\";\nimport { Container } from \"../Container\";\nimport type { EntryItem, EntryPickerSource } from \"../EntryPicker\";\nimport { Field } from \"../Field\";\nimport type { GridColumns } from \"../Grid\";\nimport { FormControl } from \"./control\";\nimport {\n assertModel,\n fieldCount,\n fieldError,\n fieldLabel,\n fieldLimitProps,\n selectedIds,\n type FormField,\n type FormSchema,\n type FormErrors,\n type FormFieldValue,\n type FormValues,\n} from \"./model\";\nimport \"./style.css\";\n\nexport { validateFormValues } from \"./model\";\nexport type {\n AssetValue,\n FormField,\n FormDivider,\n FormItem,\n FormSchema,\n FormErrors,\n FormFieldValue,\n FormValues,\n ReferenceValue,\n} from \"./model\";\n\nexport interface FormChange {\n fieldId: string;\n}\n\nexport interface FormEditorProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"defaultValue\" | \"onChange\"\n> {\n schema: FormSchema;\n value?: FormValues;\n defaultValue?: FormValues;\n onValueChange?: (values: FormValues, change: FormChange) => void;\n /** Available assets or entries, keyed by field ID. Loading belongs to the app. */\n pickerItems?: Record<string, EntryItem[]>;\n pickerSources?: Record<string, EntryPickerSource>;\n embedSources?: Record<string, RichTextEmbedSources>;\n /** App-provided messages take precedence over built-in validation. */\n errors?: FormErrors;\n isDisabled?: boolean;\n showAllErrors?: boolean;\n /** Columns at the widest. The form drops one whenever a field would be narrower than `minColumnWidth`. */\n columns?: GridColumns;\n /** Narrowest a field may get before the form drops a column. */\n minColumnWidth?: string;\n}\n\ninterface FormEditorFieldProps {\n field: FormField;\n stored: FormFieldValue | undefined;\n items: EntryItem[];\n source?: EntryPickerSource;\n embeds?: RichTextEmbedSources;\n isDisabled: boolean;\n error: string | undefined;\n isErrorVisible: boolean;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\n/** Validates only when its message can show, and only when its own field or value changes. */\nfunction FormEditorField({\n field,\n stored,\n items,\n source,\n embeds,\n isDisabled,\n error,\n isErrorVisible,\n onChange,\n}: FormEditorFieldProps) {\n const validation = useMemo(\n () => (error === undefined && isErrorVisible ? fieldError(field, stored) : undefined),\n [error, isErrorVisible, field, stored],\n );\n const selected = useMemo(\n () =>\n field.type === \"asset\" || field.type === \"reference\" ? selectedIds(field, stored) : undefined,\n [field, stored],\n );\n return (\n <Container\n width={field.width}\n padded={false}\n center={false}\n className=\"ds-form-editor__field\"\n >\n <Field\n {...fieldLimitProps(field, stored, selected, source)}\n label={field.type === \"dateTime\" ? `${field.label} (UTC)` : fieldLabel(field)}\n hint={field.hint}\n error={error ?? validation}\n isRequired={field.required}\n count={fieldCount(field, stored, selected, source)}\n isGroup={selected !== undefined || groupTypes.has(field.type)}\n >\n {(accessibility) => (\n <FormControl\n field={field}\n stored={stored}\n selected={selected}\n items={items}\n source={source}\n embeds={embeds}\n isDisabled={isDisabled}\n accessibility={accessibility}\n onChange={onChange}\n />\n )}\n </Field>\n </Container>\n );\n}\n\nconst groupTypes = new Set([\"radioGroup\", \"checkboxGroup\", \"rangeSlider\"]);\nconst loadedValidationTypes = new Set([\"slider\", \"rangeSlider\", \"date\", \"colour\"]);\n\n/** Ordered form controls. Loading, submission, and persistence belong to the app. */\nexport function FormEditor({\n schema,\n value,\n defaultValue = {},\n onValueChange,\n pickerItems = {},\n pickerSources = {},\n embedSources = {},\n errors = {},\n isDisabled = false,\n showAllErrors = false,\n columns = 1,\n minColumnWidth = \"16rem\",\n className,\n style,\n ...rest\n}: FormEditorProps) {\n const [internal, setInternal] = useState<FormValues>(defaultValue);\n const [changed, setChanged] = useState<Set<string>>(() => new Set());\n const current = value ?? internal;\n useMemo(() => assertModel(schema), [schema]);\n\n const commit = (fieldId: string, next: FormFieldValue | undefined) => {\n const values = { ...current };\n if (next === undefined) {\n delete values[fieldId];\n } else {\n values[fieldId] = next;\n }\n if (value === undefined) {\n setInternal(values);\n }\n setChanged((previous) => new Set(previous).add(fieldId));\n onValueChange?.(values, { fieldId });\n };\n\n const layout =\n columns === \"auto\"\n ? { \"--form-editor-min-column\": minColumnWidth }\n : { \"--form-editor-columns\": columns, \"--form-editor-min-column\": minColumnWidth };\n\n return (\n <div\n className={[\"ds-form-editor\", columns === \"auto\" && \"ds-form-editor--auto\", className]\n .filter(Boolean)\n .join(\" \")}\n style={{ ...layout, ...style } as CSSProperties}\n {...rest}\n >\n {schema.fields.map((field) => {\n if (field.type === \"divider\") {\n return (\n <hr\n key={field.id}\n className=\"ds-form-editor__divider\"\n />\n );\n }\n const stored = Object.hasOwn(current, field.id) ? current[field.id] : undefined;\n const fieldDisabled = isDisabled || Boolean(field.isDisabled);\n const isLocked = fieldDisabled || (\"readOnly\" in field && Boolean(field.readOnly));\n // Explain loaded invalid values alongside the controls' invalid styling. Blank\n // strings are empty, so their required message waits like any other field's.\n const isLoaded = typeof stored === \"string\" ? stored.trim() !== \"\" : stored !== undefined;\n const isErrorVisible =\n showAllErrors ||\n changed.has(field.id) ||\n (isLoaded && loadedValidationTypes.has(field.type)) ||\n (field.type === \"number\" && typeof stored === \"number\");\n return (\n <FormEditorField\n key={field.id}\n field={field}\n stored={stored}\n items={pickerItems[field.id] ?? []}\n source={pickerSources[field.id]}\n embeds={embedSources[field.id]}\n isDisabled={fieldDisabled}\n error={errors[field.id]}\n isErrorVisible={isErrorVisible}\n onChange={(next) => {\n // A disabled rich-text editor reports only an embed commit its\n // creating source completes, never selection or plugin changes.\n if (\n !isLocked ||\n (field.type === \"richText\" &&\n (embedSources[field.id]?.entry?.isCreating ||\n embedSources[field.id]?.asset?.isCreating))\n ) {\n commit(field.id, next);\n }\n }}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,IAAakB,KAAiB,CAAC,QAAQ,MAAM,GCiBvCC,KAAc;CAAC;CAAM;CAAM;AAAI,GA8I/BC,qBAAa,IAAI,IAAI;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,SAAgBC,EAAY,GAAmB;CAC7C,IAAMC,oBAAM,IAAI,IAAY;CAC5B,KAAK,IAAMC,KAASC,EAAM,QAAQ;EAChC,IAAI,CAACD,EAAM,IAA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I,IAAgBhE,KAAc,EAAQ1E,EAAM,YAC5C2I,IAAWD,KAAkB,cAAc1I,KAAS,EAAQA,EAAM,UAGlE4I,IAAW,OAAOhI,KAAW,WAAWA,EAAO,KAAK,MAAM,KAAKA,MAAW,KAAA,GAC1EsG,IACJ2B,KACAhB,EAAQ,IAAI7H,EAAM,EAAE,KACnB4I,KAAYtB,GAAsB,IAAItH,EAAM,IAAI,KAChDA,EAAM,SAAS,YAAY,OAAOY,KAAW;GAChD,OACE,kBAACmG,IAAD;IAES;IACC;IACR,OAAO+B,EAAY9I,EAAM,OAAO,CAAC;IACjC,QAAQ+I,EAAc/I,EAAM;IAC5B,QAAQgJ,EAAahJ,EAAM;IAC3B,YAAY0I;IACZ,OAAOO,EAAOjJ,EAAM;IACJ;IAChB,WAAW,MAAS;KAGlB,CACE,CAAC2I,KACA3I,EAAM,SAAS,eACbgJ,EAAahJ,EAAM,GAAG,EAAE,OAAO,cAC9BgJ,EAAahJ,EAAM,GAAG,EAAE,OAAO,gBAEnCiI,EAAOjI,EAAM,IAAI6F,CAAI;IAEzB;GACD,GArBM7F,EAAM,EAqBZ;EAEL,CAAC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"FormEditor-ChH4e5sB.js","names":["_Fragment","documentError","emptyDocument","RichTextEditor","selectionCount","selectionLimit","EntryPicker","preciseSum","NumberField","parseColour","sliderScale","Slider","clampToScale","RangeSlider","ColourField","isIsoDate","DateField","Fragment$1","expandedWidths","fieldWidths","fieldTypes","assertModel","ids","field","model","assertTypeOptions","assertMeasures","assertLimitOptions","assertChoices","assertSlider","assertNumber","limitedTypes","supportsLimit","fieldLimitProps","fieldLimit","stored","selected","source","textValue","stringList","pickerLimits","mode","max","fieldCount","caps","pickerCopy","cap","min","step","bound","label","kind","values","option","value","linkCopy","fieldLabel","defaults","selectedIds","isLink","link","key","parseUtcDateTime","match","canonical","date","hasRichText","node","requiredError","textError","richTextError","error","choiceError","item","listError","numberError","dateError","sliderValue","scale","rangeSliderValue","range","start","end","low","high","a","b","rangeError","colourError","linkError","itemLabel","itemsLabel","validators","fieldError","validateFormValues","Option","props","isDisabled","invalid","onChange","Card","RadioCard","CheckboxCard","Choice","Radio","Checkbox","ChoiceControl","multiple","Group","SelectionCardGroup","ChoiceGroup","accessibility","required","Button","SliderControl","shown","next","RangeSliderControl","AdditionalControl","raw","event","TagsInput","pickerValue","links","NumberControl","SelectControl","isClearable","Select","PickerControl","FormControl","shared","TextField","TextArea","Switch","FormEditorField","validation","useMemo","isErrorVisible","Container","Field","groupTypes","loadedValidationTypes","FormEditor","rest","internal","setInternal","useState","defaultValue","changed","setChanged","current","schema","commit","fieldId","previous","onValueChange","layout","columns","minColumnWidth","className","style","fieldDisabled","isLocked","isLoaded","showAllErrors","pickerItems","pickerSources","embedSources","errors"],"sources":["../../src/components/RichTextEditor/expanded-width.ts","../../src/components/FormEditor/model.ts","../../src/components/FormEditor/choice-control.tsx","../../src/components/FormEditor/additional-control.tsx","../../src/components/FormEditor/control.tsx","../../src/components/FormEditor/index.tsx"],"sourcesContent":["/** Expanded writing measures: `wide` caps at the shared wide Modal width; `full` fills the viewport inside the scrim's gutters. */\nexport const expandedWidths = [\"wide\", \"full\"] as const;\n\nexport type RichTextEditorExpandedWidth = (typeof expandedWidths)[number];\n","import type { ReactNode } from \"react\";\nimport type { SelectOption } from \"../Select\";\nimport type { EntryPickerMode, EntryPickerProps, EntryPickerSource } from \"../EntryPicker\";\nimport { selectionCount, selectionLimit } from \"../EntryPicker/limit\";\nimport type { JSONContent } from \"@tiptap/react\";\nimport { documentError } from \"../RichTextEditor/document\";\nimport type { RichTextDocument } from \"../RichTextEditor\";\nimport { expandedWidths, type RichTextEditorExpandedWidth } from \"../RichTextEditor/expanded-width\";\nimport { isIsoDate } from \"../DatePicker/date\";\nimport type { RangeSliderValue } from \"../Slider\";\nimport { clampToScale, sliderScale, type SliderScale } from \"../Slider/scale\";\nimport { preciseSum } from \"../../internal/decimal\";\nimport { parseColour } from \"../ColourField/colour\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport type { ContainerWidth } from \"../Container\";\nimport type { FieldLimit, FieldLimitOptions } from \"../Field/types\";\n\n/** The shared measures a field may cap at; checked against Container's scale. */\nconst fieldWidths = [\"sm\", \"md\", \"lg\"] as const satisfies readonly ContainerWidth[];\n\ninterface FormFieldBase {\n id: string;\n label: string;\n hint?: ReactNode;\n /** Maximum width of the whole field, using Container's measures and its `lg` default. */\n width?: (typeof fieldWidths)[number];\n placeholder?: string;\n required?: boolean;\n isDisabled?: boolean;\n}\n\ninterface SliderOptions {\n multiple?: never;\n min?: number;\n max?: number;\n step?: number;\n prefix?: string;\n suffix?: string;\n hasValueLabel?: boolean;\n}\n\ninterface ChoiceOptions {\n multiple?: never;\n autoFocus?: never;\n options: SelectOption[];\n appearance?: \"default\" | \"card\";\n /** Maximum options per row inside this group; independent of FormEditor columns. */\n columns?: 1 | 2 | 3;\n}\n\nexport type FormField = FormFieldBase &\n (\n | ({\n type: \"shortText\";\n inputType?: \"text\" | \"email\";\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n } & FieldLimitOptions)\n | ({\n type: \"longText\";\n rows?: number;\n maxLength?: number;\n readOnly?: boolean;\n autoFocus?: boolean;\n multiple?: never;\n } & FieldLimitOptions)\n | { type: \"boolean\" | \"dateTime\"; autoFocus?: boolean; multiple?: never }\n | {\n type: \"richText\";\n expandedWidth?: RichTextEditorExpandedWidth;\n autoFocus?: never;\n multiple?: never;\n }\n | {\n type: \"number\";\n min?: number;\n max?: number;\n /** Positive, or `\"any\"` (the default) to accept typed decimals. */\n step?: number | \"any\";\n /** Show NumberField's − / + buttons, its default; false keeps typing and arrow keys. */\n hasSteppers?: boolean;\n /** Stepper names; default to \"Decrease {label}\" and \"Increase {label}\". */\n decreaseLabel?: string;\n increaseLabel?: string;\n prefix?: string;\n suffix?: string;\n autoFocus?: boolean;\n multiple?: never;\n }\n | { type: \"select\"; options: SelectOption[]; autoFocus?: boolean; multiple?: never }\n | ({ type: \"slider\"; autoFocus?: boolean } & SliderOptions)\n | ({ type: \"rangeSlider\"; autoFocus?: never } & SliderOptions)\n | ({ type: \"radioGroup\" } & ChoiceOptions)\n | ({ type: \"checkboxGroup\" } & ChoiceOptions)\n | {\n type: \"colour\";\n multiple?: never;\n presets?: string[];\n showPresets?: boolean;\n picker?: \"custom\" | \"native\";\n placement?: PopoverPlacement;\n readOnly?: boolean;\n autoFocus?: boolean;\n }\n | ({ type: \"tags\"; max?: number; multiple?: never; autoFocus?: never } & FieldLimitOptions)\n | {\n type: \"date\";\n min?: string;\n max?: string;\n placement?: PopoverPlacement;\n multiple?: never;\n autoFocus?: never;\n }\n | ({\n type: \"asset\" | \"reference\";\n multiple?: boolean;\n autoFocus?: never;\n picker?: Pick<\n EntryPickerProps,\n \"label\" | \"addLabel\" | \"emptyLabel\" | \"itemLabel\" | \"itemsLabel\" | \"max\" | \"isReorderable\"\n >;\n } & FieldLimitOptions)\n );\n\nexport type FieldOf<T extends FormField[\"type\"]> = Extract<FormField, { type: T }>;\n\n/** Layout only: no label, value, disabled state, or validation. */\nexport interface FormDivider {\n id: string;\n type: \"divider\";\n}\n\nexport type FormItem = FormField | FormDivider;\n\nexport interface FormSchema {\n fields: readonly FormItem[];\n}\n\nexport interface AssetValue {\n assetId: string;\n}\nexport interface ReferenceValue {\n entryId: string;\n}\nexport type FormFieldValue =\n | string\n | number\n | boolean\n | RichTextDocument\n | AssetValue\n | ReferenceValue\n | string[]\n | RangeSliderValue\n | AssetValue[]\n | ReferenceValue[];\nexport type FormValues = Record<string, FormFieldValue | undefined>;\nexport type FormErrors = Partial<Record<string, string>>;\n\nconst fieldTypes = new Set([\n \"shortText\",\n \"longText\",\n \"richText\",\n \"number\",\n \"boolean\",\n \"dateTime\",\n \"asset\",\n \"reference\",\n \"select\",\n \"slider\",\n \"rangeSlider\",\n \"colour\",\n \"radioGroup\",\n \"checkboxGroup\",\n \"tags\",\n \"date\",\n \"divider\",\n]);\n\nexport function assertModel(model: FormSchema) {\n const ids = new Set<string>();\n for (const field of model.fields) {\n if (!field.id?.trim() || ids.has(field.id)) {\n throw new Error(\"Form field IDs must be nonempty and unique.\");\n }\n if (!fieldTypes.has(field.type)) {\n throw new Error(`Unsupported form field type: ${field.type}`);\n }\n // Removed in decision 0091; untyped schemas would otherwise lose its content silently.\n if (\"labelHint\" in field) {\n throw new Error(`Field ${field.id} uses the removed labelHint; move its content into hint.`);\n }\n if (field.type !== \"divider\") {\n assertTypeOptions(field);\n assertMeasures(field);\n assertLimitOptions(field);\n }\n ids.add(field.id);\n }\n}\n\n/** Options only some field types carry, checked before shared measures and limits. */\nfunction assertTypeOptions(field: FormField) {\n switch (field.type) {\n case \"select\":\n case \"radioGroup\":\n case \"checkboxGroup\":\n return assertChoices(field);\n case \"slider\":\n case \"rangeSlider\":\n return assertSlider(field);\n case \"number\":\n return assertNumber(field);\n }\n}\n\nconst limitedTypes = new Set([\"shortText\", \"longText\", \"tags\", \"asset\", \"reference\"]);\n\nfunction supportsLimit(\n field: FormField,\n): field is FieldOf<\"shortText\" | \"longText\" | \"tags\" | \"asset\" | \"reference\"> {\n return limitedTypes.has(field.type);\n}\n\nfunction assertLimitOptions(field: FormField) {\n if (!supportsLimit(field)) {\n return;\n }\n if (field.limitDisplay !== undefined && ![\"used\", \"remaining\"].includes(field.limitDisplay)) {\n throw new Error(`Field ${field.id} needs a limitDisplay of used or remaining.`);\n }\n if (\n field.limitVisibility !== undefined &&\n ![\"always\", \"nearLimit\"].includes(field.limitVisibility)\n ) {\n throw new Error(`Field ${field.id} needs a limitVisibility of always or nearLimit.`);\n }\n if (field.showLimitRing !== undefined && typeof field.showLimitRing !== \"boolean\") {\n throw new Error(`Field ${field.id} needs a boolean showLimitRing.`);\n }\n}\n\n/**\n * Explicit limits for complete server markup. Counts come from the helpers the\n * adapters display with (`textValue`, `stringList`, the owning field's selected\n * IDs, `pickerLimits` and EntryPicker's `selectionLimit`), so the counter cannot\n * drift from them.\n */\nexport function fieldLimitProps(\n field: FormField,\n stored: FormFieldValue | undefined,\n selected: string[] | undefined,\n source?: EntryPickerSource,\n): FieldLimitOptions & { limit?: FieldLimit } {\n if (!supportsLimit(field)) {\n return {};\n }\n return {\n limitDisplay: field.limitDisplay,\n limitVisibility: field.limitVisibility,\n showLimitRing: field.showLimitRing,\n limit: fieldLimit(field, stored, selected ?? [], source),\n };\n}\n\nfunction fieldLimit(\n field: FieldOf<\"shortText\" | \"longText\" | \"tags\" | \"asset\" | \"reference\">,\n stored: FormFieldValue | undefined,\n selected: string[],\n source: EntryPickerSource | undefined,\n): FieldLimit | undefined {\n switch (field.type) {\n case \"shortText\":\n case \"longText\":\n return field.maxLength === undefined\n ? undefined\n : { count: textValue(stored).length, max: field.maxLength };\n case \"tags\":\n return field.max === undefined\n ? undefined\n : { count: stringList(stored).length, max: field.max };\n default: {\n // A scalar field holds one link in either runtime mode, a neutral slot of one.\n const { mode, max } = pickerLimits(field, source);\n return selectionLimit(mode, selected.length, max);\n }\n }\n}\n\n/**\n * The label's count badge: a picker's selected IDs, unless it holds one item\n * and its reading already shows that, or a checkbox group's checked options.\n */\nexport function fieldCount(\n field: FormField,\n stored: FormFieldValue | undefined,\n selected: string[] | undefined,\n source?: EntryPickerSource,\n) {\n if (selected !== undefined && (field.type === \"asset\" || field.type === \"reference\")) {\n const { mode, max } = pickerLimits(field, source);\n return selectionCount(mode, selected.length, max);\n }\n return field.type === \"checkboxGroup\" ? stringList(stored).length : undefined;\n}\n\n/** The text a shortText or longText adapter displays. */\nexport function textValue(stored: unknown): string {\n return typeof stored === \"string\" ? stored : \"\";\n}\n\n/**\n * The mode and cap a picker field renders with. Runtime sources may tighten\n * interaction, never what the schema stores or validates: a scalar field in\n * runtime multiple mode is capped at one, and a schema cap is never lifted. A\n * non-finite source cap (Infinity, NaN) means no cap of its own, as EntryPicker\n * reads it, so it can't erase the schema's through Math.min.\n */\nexport function pickerLimits(\n field: FieldOf<\"asset\" | \"reference\">,\n source?: EntryPickerSource,\n): { mode: EntryPickerMode; max: number | undefined } {\n const mode = source?.mode ?? (field.multiple ? \"multiple\" : \"single\");\n if (!field.multiple) {\n return { mode, max: mode === \"multiple\" ? 1 : undefined };\n }\n const caps = [pickerCopy(field).max, source?.max].filter(\n (cap): cap is number => cap !== undefined && Number.isFinite(cap),\n );\n return { mode, max: caps.length > 0 ? Math.min(...caps) : undefined };\n}\n\n/** Runtime schemas can carry any string; the types only cover typed schemas. */\nfunction assertMeasures(field: FormField) {\n if (field.width !== undefined && !fieldWidths.includes(field.width)) {\n throw new Error(`Field ${field.id} needs a width of sm, md or lg.`);\n }\n if (\n field.type === \"richText\" &&\n field.expandedWidth !== undefined &&\n !expandedWidths.includes(field.expandedWidth)\n ) {\n throw new Error(`Rich text field ${field.id} needs an expandedWidth of wide or full.`);\n }\n}\n\nfunction assertSlider(field: FieldOf<\"slider\" | \"rangeSlider\">) {\n const { min, max, step } = sliderScale(field);\n if (![min, max, step].every(Number.isFinite) || min >= max || step <= 0) {\n throw new Error(`Slider field ${field.id} needs finite min < max and a positive step.`);\n }\n if (field.type === \"rangeSlider\" && step > preciseSum(max, -min)) {\n throw new Error(`Range slider ${field.id} needs room for at least one step.`);\n }\n}\n\nfunction assertNumber(field: FieldOf<\"number\">) {\n const { min, max, step = \"any\" } = field;\n if (\n [min, max].some((bound) => bound !== undefined && !Number.isFinite(bound)) ||\n (min !== undefined && max !== undefined && min > max) ||\n (step !== \"any\" && !(Number.isFinite(step) && step > 0))\n ) {\n throw new Error(\n `Number field ${field.id} needs finite min <= max and a positive step or \"any\".`,\n );\n }\n const labels = [field.decreaseLabel, field.increaseLabel];\n if (labels.some((label) => label !== undefined && (typeof label !== \"string\" || !label.trim()))) {\n throw new Error(`Number field ${field.id} needs nonempty stepper labels.`);\n }\n}\n\nfunction assertChoices(field: FieldOf<\"select\" | \"radioGroup\" | \"checkboxGroup\">) {\n if (!Array.isArray(field.options)) {\n const kind = field.type === \"select\" ? \"Select\" : \"Choice\";\n throw new Error(`${kind} field ${field.id} needs an options array.`);\n }\n if (field.type === \"select\") {\n return;\n }\n const values = field.options.map((option) => option.value);\n if (\n values.some((value) => typeof value !== \"string\" || !value.trim()) ||\n new Set(values).size !== values.length\n ) {\n throw new Error(`Choice field ${field.id} needs nonempty, unique option values.`);\n }\n}\n\nconst linkCopy = {\n asset: { key: \"assetId\", itemLabel: \"asset\", itemsLabel: \"assets\" },\n reference: { key: \"entryId\", itemLabel: \"entry\", itemsLabel: \"entries\" },\n} as const;\n\n/** The field's visible and accessible name. A picker's `label` overrides it. */\nexport function fieldLabel(field: FormField): string {\n return field.type === \"asset\" || field.type === \"reference\"\n ? (field.picker?.label ?? field.label)\n : field.label;\n}\n\n/** Picker action and item copy, with asset or entry wording for any option left out or undefined. */\nexport function pickerCopy(field: FieldOf<\"asset\" | \"reference\">) {\n const defaults = linkCopy[field.type];\n const {\n addLabel = `Choose ${fieldLabel(field)}`,\n emptyLabel,\n itemLabel = defaults.itemLabel,\n itemsLabel = defaults.itemsLabel,\n max,\n isReorderable,\n } = field.picker ?? {};\n return { addLabel, emptyLabel, itemLabel, itemsLabel, max, isReorderable };\n}\n\n/** The picked IDs, in stored order, skipping anything that isn't a link. */\nexport function selectedIds(field: FieldOf<\"asset\" | \"reference\">, value: unknown): string[] {\n const { key } = linkCopy[field.type];\n const links = Array.isArray(value) ? value : value === undefined ? [] : [value];\n return links.flatMap((link) =>\n isLink(link, key) ? [(link as Record<string, string>)[key]] : [],\n );\n}\n\n/** Accept UTC ISO strings without rolling invalid dates into the next month. */\nexport function parseUtcDateTime(value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return;\n }\n const match = /^(\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2})(?::(\\d{2})(?:\\.(\\d{1,3}))?)?(?:Z|\\+00:00)$/.exec(\n value,\n );\n if (!match) {\n return;\n }\n const canonical = `${match[1]}:${match[2] ?? \"00\"}.${(match[3] ?? \"\").padEnd(3, \"0\")}Z`;\n const date = new Date(canonical);\n if (Number.isFinite(date.getTime()) && date.toISOString() === canonical) {\n return canonical;\n }\n}\n\nfunction isLink(value: unknown, key: \"assetId\" | \"entryId\"): boolean {\n return (\n !!value &&\n typeof value === \"object\" &&\n key in value &&\n typeof (value as Record<string, unknown>)[key] === \"string\" &&\n (value as Record<string, string>)[key].trim().length > 0\n );\n}\n\nfunction hasRichText(node: JSONContent): boolean {\n return (\n !!node.text?.trim() ||\n node.type === \"horizontalRule\" ||\n node.type === \"storyblock\" ||\n !!node.content?.some(hasRichText)\n );\n}\n\nfunction requiredError(field: FormField): string {\n return `${fieldLabel(field)} is required.`;\n}\n\nfunction textError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter text.\";\n }\n if (field.required && !value.trim()) {\n return requiredError(field);\n }\n if (\n (field.type === \"shortText\" || field.type === \"longText\") &&\n field.maxLength !== undefined &&\n value.length > field.maxLength\n ) {\n return `Enter no more than ${field.maxLength} characters.`;\n }\n}\n\nfunction richTextError(field: FormField, value: unknown): string | undefined {\n const error = documentError(value);\n if (error) {\n return error;\n }\n if (field.required && !hasRichText(value as RichTextDocument)) {\n return requiredError(field);\n }\n}\n\nfunction choiceError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Choose an available option.\";\n }\n if (value === \"\") {\n return field.required ? requiredError(field) : undefined;\n }\n // An empty list means the choices are still loading, so a stored value stays valid until they arrive.\n if (\n (field.type === \"select\" || field.type === \"radioGroup\") &&\n field.options.length > 0 &&\n !field.options.some((option) => option.value === value)\n ) {\n return \"Choose an available option.\";\n }\n}\n\nexport function stringList(value: unknown): string[] {\n return Array.isArray(value)\n ? value.filter((item): item is string => typeof item === \"string\")\n : [];\n}\n\nfunction listError(field: FormField, value: unknown): string | undefined {\n if (\n !Array.isArray(value) ||\n !value.every((item) => typeof item === \"string\" && item.trim()) ||\n new Set(value).size !== value.length\n ) {\n return \"Enter a list of unique, nonempty text values.\";\n }\n if (field.required && !value.length) {\n return requiredError(field);\n }\n if (field.type === \"tags\" && field.max !== undefined && value.length > field.max) {\n return `Enter no more than ${field.max} tags.`;\n }\n if (\n field.type === \"checkboxGroup\" &&\n field.options.length &&\n value.some((item) => !field.options.some((option) => option.value === item))\n ) {\n return \"Choose available options.\";\n }\n}\n\nfunction numberError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"number\" || !Number.isFinite(value)) {\n return \"Enter a finite number.\";\n }\n const { min, max }: { min?: number; max?: number } =\n field.type === \"slider\" || field.type === \"rangeSlider\"\n ? sliderScale(field)\n : field.type === \"number\"\n ? field\n : {};\n if (min !== undefined && value < min) {\n return `Enter a number of at least ${min}.`;\n }\n if (max !== undefined && value > max) {\n return `Enter a number no greater than ${max}.`;\n }\n}\n\nfunction dateError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (!value) {\n return field.required ? requiredError(field) : undefined;\n }\n if (!isIsoDate(value)) {\n return \"Enter a valid calendar date (YYYY-MM-DD).\";\n }\n if (field.type !== \"date\") {\n return;\n }\n if (field.min && value < field.min) {\n return `Choose a date on or after ${field.min}.`;\n }\n if (field.max && value > field.max) {\n return `Choose a date on or before ${field.max}.`;\n }\n}\n\n/**\n * Display positions for loaded values: out-of-scale numbers clamp and reversed\n * endpoints swap, without overwriting the stored data that validation reports.\n * A value that is not a finite number has no position, so the control is unset.\n */\nexport function sliderValue(value: unknown, scale: SliderScale): number | undefined {\n return typeof value === \"number\" && Number.isFinite(value)\n ? clampToScale(value, scale)\n : undefined;\n}\n\n/** A range with neither endpoint usable is unset; one usable endpoint pairs with the scale's end. */\nexport function rangeSliderValue(value: unknown, scale: SliderScale): RangeSliderValue | undefined {\n const range = value as Partial<Record<\"min\" | \"max\", unknown>> | null;\n const start = sliderValue(range?.min, scale);\n const end = sliderValue(range?.max, scale);\n if (start === undefined && end === undefined) {\n return undefined;\n }\n const [low, high] = [start ?? scale.min, end ?? scale.max].sort((a, b) => a - b);\n return { min: low, max: high };\n}\n\nfunction rangeError(field: FormField, value: unknown): string | undefined {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) {\n return \"Enter a range.\";\n }\n const range = value as Record<string, unknown>;\n const start = range.min;\n const end = range.max;\n const error = numberError(field, start) ?? numberError(field, end);\n if (error) {\n return error;\n }\n if ((start as number) > (end as number)) {\n return \"The start must not be greater than the end.\";\n }\n if (\n field.type === \"rangeSlider\" &&\n preciseSum(end as number, -(start as number)) < sliderScale(field).step\n ) {\n return \"Keep the range endpoints at least one step apart.\";\n }\n}\n\nfunction colourError(field: FormField, value: unknown): string | undefined {\n if (typeof value !== \"string\") {\n return \"Enter a valid colour.\";\n }\n if (!value.trim()) {\n return field.required ? requiredError(field) : undefined;\n }\n return parseColour(value) ? undefined : \"Enter a valid colour.\";\n}\n\nfunction linkError(field: FormField, value: unknown): string | undefined {\n if (field.type !== \"asset\" && field.type !== \"reference\") {\n return;\n }\n const { key, itemLabel, itemsLabel } = linkCopy[field.type];\n if (!field.multiple) {\n return isLink(value, key) ? undefined : `Choose an ${itemLabel}.`;\n }\n if (!Array.isArray(value) || !value.every((item) => isLink(item, key))) {\n return `Choose a list of ${itemsLabel}.`;\n }\n if (field.required && value.length === 0) {\n return requiredError(field);\n }\n const max = field.picker?.max;\n if (max !== undefined && value.length > max) {\n return `Choose no more than ${max} ${pickerCopy(field).itemsLabel}.`;\n }\n}\n\nconst validators: Record<\n FormField[\"type\"],\n (field: FormField, value: unknown) => string | undefined\n> = {\n shortText: textError,\n longText: textError,\n richText: richTextError,\n number: numberError,\n slider: numberError,\n rangeSlider: rangeError,\n date: dateError,\n colour: colourError,\n radioGroup: choiceError,\n checkboxGroup: listError,\n tags: listError,\n boolean: (_field, value) => (typeof value === \"boolean\" ? undefined : \"Choose a boolean value.\"),\n dateTime: (_field, value) =>\n parseUtcDateTime(value) ? undefined : \"Enter a valid UTC date and time.\",\n select: choiceError,\n asset: linkError,\n reference: linkError,\n};\n\nexport function fieldError(field: FormField, value: unknown): string | undefined {\n if (value === undefined) {\n return field.required ? requiredError(field) : undefined;\n }\n return validators[field.type](field, value);\n}\n\n/** Validate data loaded from JSON as well as values emitted by FormEditor. */\nexport function validateFormValues(model: FormSchema, values: Record<string, unknown>): FormErrors {\n assertModel(model);\n return Object.fromEntries(\n model.fields.flatMap((field): [string, string][] => {\n if (field.type === \"divider\") {\n return [];\n }\n const error = fieldError(\n field,\n Object.hasOwn(values, field.id) ? values[field.id] : undefined,\n );\n return error ? [[field.id, error]] : [];\n }),\n );\n}\n","import { Button } from \"../Button\";\nimport { Checkbox, ChoiceGroup, Radio } from \"../Choice\";\nimport { CheckboxCard, RadioCard, SelectionCardGroup } from \"../SelectionCard\";\nimport type { SelectOption } from \"../Select\";\nimport type { ControlProps } from \"./control\";\nimport { stringList, type FieldOf } from \"./model\";\n\ntype ChoiceField = FieldOf<\"radioGroup\" | \"checkboxGroup\">;\n\nfunction Option({\n field,\n option,\n name,\n checked,\n isDisabled,\n invalid,\n onChange,\n}: {\n field: ChoiceField;\n option: SelectOption;\n name: string;\n checked: boolean;\n isDisabled: boolean;\n invalid: true | undefined;\n onChange: () => void;\n}) {\n const props = {\n name,\n value: option.value,\n checked,\n disabled: isDisabled || option.isDisabled,\n \"aria-invalid\": invalid,\n onChange: () => {\n if (!isDisabled && !option.isDisabled) {\n onChange();\n }\n },\n };\n if (field.appearance === \"card\") {\n const Card = field.type === \"radioGroup\" ? RadioCard : CheckboxCard;\n return (\n <Card\n {...props}\n title={option.label}\n description={option.description}\n />\n );\n }\n const Choice = field.type === \"radioGroup\" ? Radio : Checkbox;\n return (\n <Choice {...props}>\n <span>\n {option.label}\n {option.description && (\n <span className=\"ds-form-editor__option-description\">{option.description}</span>\n )}\n </span>\n </Choice>\n );\n}\n\nexport function ChoiceControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<ChoiceField>) {\n const multiple = field.type === \"checkboxGroup\";\n // Option values are nonempty, so a stored \"\" selects nothing.\n const selected = multiple\n ? stringList(stored)\n : typeof stored === \"string\" && stored\n ? [stored]\n : [];\n const Group = field.appearance === \"card\" ? SelectionCardGroup : ChoiceGroup;\n return (\n <>\n <Group\n {...accessibility}\n label={field.label}\n columns={field.columns ?? (field.appearance === \"card\" ? 2 : 1)}\n >\n {field.options.map((option) => (\n <Option\n key={option.value}\n field={field}\n option={option}\n name={accessibility.id}\n checked={selected.includes(option.value)}\n isDisabled={isDisabled}\n invalid={accessibility[\"aria-invalid\"]}\n onChange={() => {\n if (multiple) {\n onChange(\n selected.includes(option.value)\n ? selected.filter((value) => value !== option.value)\n : [...selected, option.value],\n );\n } else {\n onChange(option.value);\n }\n }}\n />\n ))}\n </Group>\n {!multiple && !required && selected.length > 0 && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isDisabled={isDisabled}\n onClick={() => onChange(undefined)}\n >\n Clear {field.label}\n </Button>\n )}\n </>\n );\n}\n","import { ColourField } from \"../ColourField\";\nimport { parseColour } from \"../ColourField/colour\";\nimport { DateField } from \"../DatePicker\";\nimport { RangeSlider, Slider } from \"../Slider\";\nimport { sliderScale } from \"../Slider/scale\";\nimport { TagsInput } from \"../TagsInput\";\nimport { ChoiceControl } from \"./choice-control\";\nimport type { ControlProps } from \"./control\";\nimport { rangeSliderValue, sliderValue, stringList, type FieldOf } from \"./model\";\n\ntype AdditionalField = FieldOf<\n \"slider\" | \"rangeSlider\" | \"date\" | \"colour\" | \"tags\" | \"radioGroup\" | \"checkboxGroup\"\n>;\n\nfunction SliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"slider\">>) {\n const scale = sliderScale(field);\n const shown = sliderValue(stored, scale);\n return (\n <Slider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={shown ?? scale.min}\n onValueChange={onChange}\n // An unset thumb rests at the minimum, where a click or a key toward it fires\n // no change event. Committing stores the position the slider shows.\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nfunction RangeSliderControl({\n field,\n stored,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"rangeSlider\">>) {\n const scale = sliderScale(field);\n const shown = rangeSliderValue(stored, scale);\n return (\n <RangeSlider\n {...accessibility}\n {...scale}\n prefix={field.prefix}\n suffix={field.suffix}\n hasValueLabel={field.hasValueLabel}\n minLabel={`${field.label} minimum`}\n maxLabel={`${field.label} maximum`}\n isDisabled={isDisabled}\n // Unset thumbs rest at both ends without a fill, so nothing looks chosen; a click\n // or key that leaves them there stores the full range they show.\n valueText={shown === undefined ? (field.placeholder ?? \"Not set\") : undefined}\n hasFill={shown !== undefined}\n value={shown ?? { min: scale.min, max: scale.max }}\n onValueChange={onChange}\n onValueCommit={(next) => {\n if (shown === undefined) {\n onChange(next);\n }\n }}\n />\n );\n}\n\nexport function AdditionalControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<AdditionalField>) {\n const props = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"radioGroup\":\n case \"checkboxGroup\":\n return (\n <ChoiceControl\n field={field}\n {...props}\n />\n );\n case \"rangeSlider\":\n return (\n <RangeSliderControl\n field={field}\n {...props}\n />\n );\n case \"slider\":\n return (\n <SliderControl\n field={field}\n {...props}\n />\n );\n case \"colour\":\n return (\n <ColourField\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n presets={field.presets}\n showPresets={field.showPresets}\n picker={field.picker}\n placement={field.placement}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n isDisabled={isDisabled}\n value={typeof stored === \"string\" ? stored : \"\"}\n onInput={(event) => {\n const raw = event.currentTarget.value;\n if (raw.trim() && !parseColour(raw)) {\n onChange(raw);\n }\n }}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n case \"tags\":\n return (\n <TagsInput\n {...accessibility}\n required={required}\n placeholder={field.placeholder}\n max={field.max}\n isDisabled={isDisabled}\n value={stringList(stored)}\n onValueChange={onChange}\n />\n );\n case \"date\":\n return (\n <DateField\n {...accessibility}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n placement={field.placement}\n isDisabled={isDisabled}\n isClearable\n clearLabel={`Clear ${field.label}`}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n }\n}\n","import type { RichTextEmbedSources } from \"../RichTextEditor\";\nimport { EntryPicker, type EntryItem, type EntryPickerSource } from \"../EntryPicker\";\nimport type { FieldRenderProps } from \"../Field\";\nimport { NumberField } from \"../NumberField\";\nimport { RichTextEditor, type RichTextDocument } from \"../RichTextEditor\";\nimport { emptyDocument } from \"../RichTextEditor/document\";\nimport { Select } from \"../Select\";\nimport { Switch } from \"../Switch\";\nimport { TextArea, TextField } from \"../TextField\";\nimport { AdditionalControl } from \"./additional-control\";\nimport {\n parseUtcDateTime,\n pickerCopy,\n pickerLimits,\n textValue,\n type FieldOf,\n type FormField,\n type FormFieldValue,\n} from \"./model\";\n\nfunction pickerValue(\n field: FieldOf<\"asset\" | \"reference\">,\n ids: string[],\n): FormFieldValue | undefined {\n if (field.type === \"asset\") {\n const links = ids.map((assetId) => ({ assetId }));\n return field.multiple ? links : links[0];\n }\n const links = ids.map((entryId) => ({ entryId }));\n return field.multiple ? links : links[0];\n}\n\ntype Accessibility = FieldRenderProps;\n\nexport interface ControlProps<F extends FormField> {\n field: F;\n stored: FormFieldValue | undefined;\n isDisabled: boolean;\n required: boolean | undefined;\n accessibility: Omit<Accessibility, \"required\">;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nfunction NumberControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"number\">>) {\n return (\n <NumberField\n {...accessibility}\n required={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n min={field.min}\n max={field.max}\n step={field.step ?? \"any\"}\n hasSteppers={field.hasSteppers}\n prefix={field.prefix}\n suffix={field.suffix}\n autoFocus={field.autoFocus}\n decreaseLabel={field.decreaseLabel ?? `Decrease ${field.label}`}\n increaseLabel={field.increaseLabel ?? `Increase ${field.label}`}\n value={typeof stored === \"number\" && Number.isFinite(stored) ? stored : \"\"}\n onValueChange={(next) => {\n if (next === \"\" || Number.isFinite(next)) {\n onChange(next === \"\" ? undefined : next);\n }\n }}\n />\n );\n}\n\nfunction SelectControl({\n field,\n stored,\n isDisabled,\n required,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"select\">>) {\n // Optional selects lead with an empty choice; picking it removes the key.\n const isClearable = !required && !field.options.some((option) => option.value === \"\");\n return (\n <Select\n {...accessibility}\n aria-required={required || undefined}\n isDisabled={isDisabled}\n isInvalid={accessibility[\"aria-invalid\"]}\n options={\n isClearable\n ? [{ value: \"\", label: field.placeholder ?? \"None\" }, ...field.options]\n : field.options\n }\n placeholder={field.placeholder}\n autoFocus={field.autoFocus}\n value={typeof stored === \"string\" ? stored : \"\"}\n onValueChange={(next) => onChange(next === \"\" ? undefined : next)}\n />\n );\n}\n\nfunction PickerControl({\n field,\n selected,\n items,\n source,\n isDisabled,\n accessibility,\n onChange,\n}: ControlProps<FieldOf<\"asset\" | \"reference\">> & {\n items: EntryItem[];\n source?: EntryPickerSource;\n selected: string[];\n}) {\n return (\n <EntryPicker\n {...accessibility}\n {...source}\n items={items}\n value={selected}\n {...pickerCopy(field)}\n {...pickerLimits(field, source)}\n isDisabled={isDisabled}\n onValueChange={(ids) => onChange(pickerValue(field, ids))}\n />\n );\n}\n\ninterface FormControlProps {\n embeds?: RichTextEmbedSources;\n field: FormField;\n stored: FormFieldValue | undefined;\n /** Picker fields' stored IDs, derived once by the owning field. */\n selected: string[] | undefined;\n items: EntryItem[];\n source?: EntryPickerSource;\n isDisabled: boolean;\n accessibility: Accessibility;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\nexport function FormControl({\n embeds,\n field,\n stored,\n selected,\n items,\n source,\n isDisabled,\n accessibility: { required, ...accessibility },\n onChange,\n}: FormControlProps) {\n const shared = { stored, isDisabled, required, accessibility, onChange };\n switch (field.type) {\n case \"shortText\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n type={field.inputType}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={textValue(stored)}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"longText\":\n return (\n <TextArea\n {...accessibility}\n required={required}\n disabled={isDisabled}\n placeholder={field.placeholder}\n rows={field.rows}\n maxLength={field.maxLength}\n readOnly={field.readOnly}\n autoFocus={field.autoFocus}\n value={textValue(stored)}\n onChange={(event) => onChange(event.target.value)}\n />\n );\n case \"number\":\n return (\n <NumberControl\n field={field}\n {...shared}\n />\n );\n case \"boolean\":\n return (\n <Switch\n {...accessibility}\n isDisabled={isDisabled}\n autoFocus={field.autoFocus}\n isSelected={stored === true}\n onSelectedChange={onChange}\n />\n );\n case \"dateTime\":\n return (\n <TextField\n {...accessibility}\n required={required}\n disabled={isDisabled}\n type=\"datetime-local\"\n step=\"0.001\"\n autoFocus={field.autoFocus}\n value={parseUtcDateTime(stored)?.slice(0, -1) ?? \"\"}\n onChange={(event) => onChange(parseUtcDateTime(`${event.target.value}Z`))}\n />\n );\n case \"richText\":\n return (\n <RichTextEditor\n {...accessibility}\n expandedWidth={field.expandedWidth}\n embeds={embeds}\n label={field.label}\n isRequired={required}\n isDisabled={isDisabled}\n placeholder={field.placeholder}\n format=\"json\"\n value={stored === undefined ? emptyDocument : (stored as RichTextDocument)}\n onChange={onChange}\n />\n );\n case \"select\":\n return (\n <SelectControl\n field={field}\n {...shared}\n />\n );\n case \"asset\":\n case \"reference\":\n return (\n <PickerControl\n field={field}\n items={items}\n source={source}\n selected={selected ?? []}\n {...shared}\n />\n );\n default:\n return (\n <AdditionalControl\n field={field}\n {...shared}\n />\n );\n }\n}\n","import { useMemo, useState, type CSSProperties, type HTMLAttributes } from \"react\";\nimport type { RichTextEmbedSources } from \"../RichTextEditor\";\nimport { Container } from \"../Container\";\nimport type { EntryItem, EntryPickerSource } from \"../EntryPicker\";\nimport { Field } from \"../Field\";\nimport type { GridColumns } from \"../Grid\";\nimport { FormControl } from \"./control\";\nimport {\n assertModel,\n fieldCount,\n fieldError,\n fieldLabel,\n fieldLimitProps,\n selectedIds,\n type FormField,\n type FormSchema,\n type FormErrors,\n type FormFieldValue,\n type FormValues,\n} from \"./model\";\nimport \"./style.css\";\n\nexport { validateFormValues } from \"./model\";\nexport type {\n AssetValue,\n FormField,\n FormDivider,\n FormItem,\n FormSchema,\n FormErrors,\n FormFieldValue,\n FormValues,\n ReferenceValue,\n} from \"./model\";\n\nexport interface FormChange {\n fieldId: string;\n}\n\nexport interface FormEditorProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n \"defaultValue\" | \"onChange\"\n> {\n schema: FormSchema;\n value?: FormValues;\n defaultValue?: FormValues;\n onValueChange?: (values: FormValues, change: FormChange) => void;\n /** Available assets or entries, keyed by field ID. Loading belongs to the app. */\n pickerItems?: Record<string, EntryItem[]>;\n pickerSources?: Record<string, EntryPickerSource>;\n embedSources?: Record<string, RichTextEmbedSources>;\n /** App-provided messages take precedence over built-in validation. */\n errors?: FormErrors;\n isDisabled?: boolean;\n showAllErrors?: boolean;\n /** Columns at the widest. The form drops one whenever a field would be narrower than `minColumnWidth`. */\n columns?: GridColumns;\n /** Narrowest a field may get before the form drops a column. */\n minColumnWidth?: string;\n}\n\ninterface FormEditorFieldProps {\n field: FormField;\n stored: FormFieldValue | undefined;\n items: EntryItem[];\n source?: EntryPickerSource;\n embeds?: RichTextEmbedSources;\n isDisabled: boolean;\n error: string | undefined;\n isErrorVisible: boolean;\n onChange: (value: FormFieldValue | undefined) => void;\n}\n\n/** Validates only when its message can show, and only when its own field or value changes. */\nfunction FormEditorField({\n field,\n stored,\n items,\n source,\n embeds,\n isDisabled,\n error,\n isErrorVisible,\n onChange,\n}: FormEditorFieldProps) {\n const validation = useMemo(\n () => (error === undefined && isErrorVisible ? fieldError(field, stored) : undefined),\n [error, isErrorVisible, field, stored],\n );\n const selected = useMemo(\n () =>\n field.type === \"asset\" || field.type === \"reference\" ? selectedIds(field, stored) : undefined,\n [field, stored],\n );\n return (\n <Container\n width={field.width}\n padded={false}\n center={false}\n className=\"ds-form-editor__field\"\n >\n <Field\n {...fieldLimitProps(field, stored, selected, source)}\n label={field.type === \"dateTime\" ? `${field.label} (UTC)` : fieldLabel(field)}\n hint={field.hint}\n error={error ?? validation}\n isRequired={field.required}\n count={fieldCount(field, stored, selected, source)}\n isGroup={selected !== undefined || groupTypes.has(field.type)}\n >\n {(accessibility) => (\n <FormControl\n field={field}\n stored={stored}\n selected={selected}\n items={items}\n source={source}\n embeds={embeds}\n isDisabled={isDisabled}\n accessibility={accessibility}\n onChange={onChange}\n />\n )}\n </Field>\n </Container>\n );\n}\n\nconst groupTypes = new Set([\"radioGroup\", \"checkboxGroup\", \"rangeSlider\"]);\nconst loadedValidationTypes = new Set([\"slider\", \"rangeSlider\", \"date\", \"colour\"]);\n\n/** Ordered form controls. Loading, submission, and persistence belong to the app. */\nexport function FormEditor({\n schema,\n value,\n defaultValue = {},\n onValueChange,\n pickerItems = {},\n pickerSources = {},\n embedSources = {},\n errors = {},\n isDisabled = false,\n showAllErrors = false,\n columns = 1,\n minColumnWidth = \"16rem\",\n className,\n style,\n ...rest\n}: FormEditorProps) {\n const [internal, setInternal] = useState<FormValues>(defaultValue);\n const [changed, setChanged] = useState<Set<string>>(() => new Set());\n const current = value ?? internal;\n useMemo(() => assertModel(schema), [schema]);\n\n const commit = (fieldId: string, next: FormFieldValue | undefined) => {\n const values = { ...current };\n if (next === undefined) {\n delete values[fieldId];\n } else {\n values[fieldId] = next;\n }\n if (value === undefined) {\n setInternal(values);\n }\n setChanged((previous) => new Set(previous).add(fieldId));\n onValueChange?.(values, { fieldId });\n };\n\n const layout =\n columns === \"auto\"\n ? { \"--form-editor-min-column\": minColumnWidth }\n : { \"--form-editor-columns\": columns, \"--form-editor-min-column\": minColumnWidth };\n\n return (\n <div\n className={[\"ds-form-editor\", columns === \"auto\" && \"ds-form-editor--auto\", className]\n .filter(Boolean)\n .join(\" \")}\n style={{ ...layout, ...style } as CSSProperties}\n {...rest}\n >\n {schema.fields.map((field) => {\n if (field.type === \"divider\") {\n return (\n <hr\n key={field.id}\n className=\"ds-form-editor__divider\"\n />\n );\n }\n const stored = Object.hasOwn(current, field.id) ? current[field.id] : undefined;\n const fieldDisabled = isDisabled || Boolean(field.isDisabled);\n const isLocked = fieldDisabled || (\"readOnly\" in field && Boolean(field.readOnly));\n // Explain loaded invalid values alongside the controls' invalid styling. Blank\n // strings are empty, so their required message waits like any other field's.\n const isLoaded = typeof stored === \"string\" ? stored.trim() !== \"\" : stored !== undefined;\n const isErrorVisible =\n showAllErrors ||\n changed.has(field.id) ||\n (isLoaded && loadedValidationTypes.has(field.type)) ||\n (field.type === \"number\" && typeof stored === \"number\");\n return (\n <FormEditorField\n key={field.id}\n field={field}\n stored={stored}\n items={pickerItems[field.id] ?? []}\n source={pickerSources[field.id]}\n embeds={embedSources[field.id]}\n isDisabled={fieldDisabled}\n error={errors[field.id]}\n isErrorVisible={isErrorVisible}\n onChange={(next) => {\n // A disabled rich-text editor reports only an embed commit its\n // creating source completes, never selection or plugin changes.\n if (\n !isLocked ||\n (field.type === \"richText\" &&\n (embedSources[field.id]?.entry?.isCreating ||\n embedSources[field.id]?.asset?.isCreating))\n ) {\n commit(field.id, next);\n }\n }}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,IAAakB,KAAiB,CAAC,QAAQ,MAAM,GCiBvCC,KAAc;CAAC;CAAM;CAAM;AAAI,GA8I/BC,qBAAa,IAAI,IAAI;CACz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AAAQ,EAAO,OAAO,KAAK,MAAU;GAC5B,IAAIhI,EAAM,SAAS,WACjB,OACE,kBAAC,MAAD,EAEE,WAAU,0BACX,GAFMA,EAAM,EAEZ;GAGL,IAAMY,IAAS,OAAO,OAAOmH,GAAS/H,EAAM,EAAE,IAAI+H,EAAQ/H,EAAM,MAAM,KAAA,GAChE0I,IAAgBhE,KAAc,EAAQ1E,EAAM,YAC5C2I,IAAWD,KAAkB,cAAc1I,KAAS,EAAQA,EAAM,UAGlE4I,IAAW,OAAOhI,KAAW,WAAWA,EAAO,KAAK,MAAM,KAAKA,MAAW,KAAA,GAC1EsG,IACJ2B,KACAhB,EAAQ,IAAI7H,EAAM,EAAE,KACnB4I,KAAYtB,GAAsB,IAAItH,EAAM,IAAI,KAChDA,EAAM,SAAS,YAAY,OAAOY,KAAW;GAChD,OACE,kBAACmG,IAAD;IAES;IACC;IACR,OAAO+B,EAAY9I,EAAM,OAAO,CAAC;IACjC,QAAQ+I,EAAc/I,EAAM;IAC5B,QAAQgJ,EAAahJ,EAAM;IAC3B,YAAY0I;IACZ,OAAOO,EAAOjJ,EAAM;IACJ;IAChB,WAAW,MAAS;KAGlB,CACE,CAAC2I,KACA3I,EAAM,SAAS,eACbgJ,EAAahJ,EAAM,GAAG,EAAE,OAAO,cAC9BgJ,EAAahJ,EAAM,GAAG,EAAE,OAAO,gBAEnCiI,EAAOjI,EAAM,IAAI6F,CAAI;IAEzB;GACD,GArBM7F,EAAM,EAqBZ;EAEL,CAAC;CACE,CAAA;AAET"}
@@ -1,2 +1,2 @@
1
- let e=require("react"),t=require("lucide-react"),n=require("react/jsx-runtime");var r={"align-left":t.AlignLeft,"align-justify":t.AlignJustify,"align-right":t.AlignRight,"alert-triangle":t.AlertTriangle,archive:t.Archive,blocks:t.Blocks,film:t.Film,"audio-lines":t.AudioLines,bold:t.Bold,code:t.Code,"heading-2":t.Heading2,"heading-3":t.Heading3,italic:t.Italic,"link-off":t.Link2Off,list:t.List,"list-ordered":t.ListOrdered,quote:t.Quote,redo:t.Redo2,strikethrough:t.Strikethrough,undo:t.Undo2,"arrow-left":t.ArrowLeft,"arrow-right":t.ArrowRight,calendar:t.Calendar,check:t.Check,"chevron-down":t.ChevronDown,"chevron-left":t.ChevronLeft,"chevron-up":t.ChevronUp,minus:t.Minus,"chevron-right":t.ChevronRight,clock:t.Clock,copy:t.Copy,download:t.Download,eye:t.Eye,"external-link":t.ExternalLink,filter:t.Filter,bell:t.Bell,"chevrons-left":t.ChevronsLeft,"chevrons-right":t.ChevronsRight,"file-text":t.FileText,folder:t.FolderClosed,globe:t.Globe,home:t.Home,"layout-grid":t.LayoutGrid,menu:t.Menu,"maximize-2":t.Maximize2,"minimize-2":t.Minimize2,users:t.Users,"grip-horizontal":t.GripHorizontal,"grip-vertical":t.GripVertical,image:t.Image,info:t.Info,link:t.Link,"key-round":t.KeyRound,spinner:t.Loader2,"more-horizontal":t.MoreHorizontal,pencil:t.Pencil,pipette:t.Pipette,plus:t.Plus,"rotate-ccw":t.RotateCcw,"rotate-cw":t.RotateCw,search:t.Search,settings:t.Settings,trash:t.Trash2,upload:t.Upload,user:t.User,x:t.X},i=Object.keys(r),a=(0,e.forwardRef)(function({name:e,size:t=16,className:i,...a},o){let s=r[e];return(0,n.jsx)(s,{ref:o,width:t,height:t,className:[`ds-icon`,i].filter(Boolean).join(` `),role:a[`aria-label`]?`img`:void 0,"aria-hidden":!a[`aria-label`]||void 0,focusable:`false`,...a})});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
2
- //# sourceMappingURL=Icon-CD3oeiNA.cjs.map
1
+ let e=require("react"),t=require("lucide-react"),n=require("react/jsx-runtime");var r={"align-left":t.AlignLeft,"align-justify":t.AlignJustify,"align-right":t.AlignRight,"alert-triangle":t.AlertTriangle,archive:t.Archive,blocks:t.Blocks,film:t.Film,"audio-lines":t.AudioLines,bold:t.Bold,code:t.Code,"heading-2":t.Heading2,"heading-3":t.Heading3,italic:t.Italic,"link-off":t.Link2Off,list:t.List,"list-ordered":t.ListOrdered,quote:t.Quote,redo:t.Redo2,strikethrough:t.Strikethrough,undo:t.Undo2,"arrow-left":t.ArrowLeft,"arrow-right":t.ArrowRight,calendar:t.Calendar,check:t.Check,"chevron-down":t.ChevronDown,"chevron-left":t.ChevronLeft,"chevron-up":t.ChevronUp,minus:t.Minus,"chevron-right":t.ChevronRight,clock:t.Clock,copy:t.Copy,download:t.Download,eye:t.Eye,"external-link":t.ExternalLink,filter:t.Filter,bell:t.Bell,"chevrons-left":t.ChevronsLeft,"chevrons-right":t.ChevronsRight,"file-text":t.FileText,folder:t.FolderClosed,globe:t.Globe,home:t.Home,"layout-grid":t.LayoutGrid,menu:t.Menu,"maximize-2":t.Maximize2,"minimize-2":t.Minimize2,users:t.Users,"grip-horizontal":t.GripHorizontal,"grip-vertical":t.GripVertical,image:t.Image,info:t.Info,link:t.Link,"log-in":t.LogIn,"log-out":t.LogOut,"key-round":t.KeyRound,spinner:t.Loader2,"more-horizontal":t.MoreHorizontal,pencil:t.Pencil,pipette:t.Pipette,plus:t.Plus,"rotate-ccw":t.RotateCcw,"rotate-cw":t.RotateCw,search:t.Search,settings:t.Settings,"toggle-left":t.ToggleLeft,trash:t.Trash2,upload:t.Upload,user:t.User,x:t.X},i=Object.keys(r),a=(0,e.forwardRef)(function({name:e,size:t=16,className:i,...a},o){let s=r[e];return(0,n.jsx)(s,{ref:o,width:t,height:t,className:[`ds-icon`,i].filter(Boolean).join(` `),role:a[`aria-label`]?`img`:void 0,"aria-hidden":!a[`aria-label`]||void 0,focusable:`false`,...a})});Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return a}});
2
+ //# sourceMappingURL=Icon-3ucBRgrd.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon-3ucBRgrd.cjs","names":["AlignLeft","AlignJustify","AlignRight","AlertTriangle","Archive","Blocks","Film","AudioLines","Bold","Code","Heading2","Heading3","Italic","Link2Off","List","ListOrdered","Quote","Redo2","Strikethrough","Undo2","ArrowLeft","ArrowRight","Calendar","Check","ChevronDown","ChevronLeft","ChevronUp","Minus","ChevronRight","Clock","Copy","Download","Eye","ExternalLink","Filter","Bell","ChevronsLeft","ChevronsRight","FileText","FolderClosed","Globe","Home","LayoutGrid","Menu","Maximize2","Minimize2","Users","GripHorizontal","GripVertical","Image","Info","Link","LogIn","LogOut","KeyRound","Loader2","MoreHorizontal","Pencil","Pipette","Plus","RotateCcw","RotateCw","Search","Settings","ToggleLeft","Trash2","Upload","User","X","forwardRef","react","lucide_react","react_jsx_runtime","icons","iconNames","Icon","rest","Glyph","name","size","className"],"sources":["../../src/components/Icon/icons.ts","../../src/components/Icon/index.tsx"],"sourcesContent":["import {\n AlignLeft,\n AlignJustify,\n AlignRight,\n AlertTriangle,\n Blocks,\n Film,\n AudioLines,\n Bold,\n Code,\n Heading2,\n Heading3,\n Italic,\n Link2Off,\n List,\n ListOrdered,\n Quote,\n Redo2,\n Strikethrough,\n Undo2,\n Archive,\n ArrowLeft,\n ArrowRight,\n Calendar,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronUp,\n Minus,\n ChevronRight,\n Clock,\n Copy,\n Download,\n Eye,\n ExternalLink,\n Filter,\n Bell,\n ChevronsLeft,\n ChevronsRight,\n FileText,\n FolderClosed,\n Globe,\n Home,\n LayoutGrid,\n Menu,\n Maximize2,\n Minimize2,\n Users,\n GripHorizontal,\n GripVertical,\n Image,\n Info,\n Link,\n LogIn,\n LogOut,\n KeyRound,\n Loader2,\n MoreHorizontal,\n Pencil,\n Pipette,\n Plus,\n RotateCcw,\n RotateCw,\n Search,\n Settings,\n ToggleLeft,\n Trash2,\n Upload,\n User,\n X,\n} from \"lucide-react\";\n\n/**\n * The finite icon set. Adding a glyph means adding a line here — a visible\n * decision rather than an import someone typed at a call site.\n */\nexport const icons = {\n \"align-left\": AlignLeft,\n \"align-justify\": AlignJustify,\n \"align-right\": AlignRight,\n \"alert-triangle\": AlertTriangle,\n archive: Archive,\n blocks: Blocks,\n film: Film,\n \"audio-lines\": AudioLines,\n bold: Bold,\n code: Code,\n \"heading-2\": Heading2,\n \"heading-3\": Heading3,\n italic: Italic,\n \"link-off\": Link2Off,\n list: List,\n \"list-ordered\": ListOrdered,\n quote: Quote,\n redo: Redo2,\n strikethrough: Strikethrough,\n undo: Undo2,\n \"arrow-left\": ArrowLeft,\n \"arrow-right\": ArrowRight,\n calendar: Calendar,\n check: Check,\n \"chevron-down\": ChevronDown,\n \"chevron-left\": ChevronLeft,\n \"chevron-up\": ChevronUp,\n minus: Minus,\n \"chevron-right\": ChevronRight,\n clock: Clock,\n copy: Copy,\n download: Download,\n eye: Eye,\n \"external-link\": ExternalLink,\n filter: Filter,\n bell: Bell,\n \"chevrons-left\": ChevronsLeft,\n \"chevrons-right\": ChevronsRight,\n \"file-text\": FileText,\n folder: FolderClosed,\n globe: Globe,\n home: Home,\n \"layout-grid\": LayoutGrid,\n menu: Menu,\n \"maximize-2\": Maximize2,\n \"minimize-2\": Minimize2,\n users: Users,\n \"grip-horizontal\": GripHorizontal,\n \"grip-vertical\": GripVertical,\n image: Image,\n info: Info,\n link: Link,\n \"log-in\": LogIn,\n \"log-out\": LogOut,\n \"key-round\": KeyRound,\n spinner: Loader2,\n \"more-horizontal\": MoreHorizontal,\n pencil: Pencil,\n pipette: Pipette,\n plus: Plus,\n \"rotate-ccw\": RotateCcw,\n \"rotate-cw\": RotateCw,\n search: Search,\n settings: Settings,\n \"toggle-left\": ToggleLeft,\n trash: Trash2,\n upload: Upload,\n user: User,\n x: X,\n} as const;\n\nexport type IconName = keyof typeof icons;\n\nexport const iconNames = Object.keys(icons) as IconName[];\n","import { forwardRef, type SVGProps } from \"react\";\nimport { icons, type IconName } from \"./icons\";\nimport \"./style.css\";\n\nexport type IconSize = 16 | 20 | 24;\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, \"ref\"> {\n /** Glyph name from the curated set in `icons.ts`. */\n name: IconName;\n /** 16 inside controls, 20 standalone, 24 for empty states. No other sizes. */\n size?: IconSize;\n}\n\n/**\n * A glyph that clarifies an action or a status. Inherits `currentColor`, so it\n * takes its colour from the control it sits in — it never carries its own.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(function Icon(\n { name, size = 16, className, ...rest },\n ref,\n) {\n const Glyph = icons[name];\n return (\n <Glyph\n ref={ref}\n width={size}\n height={size}\n className={[\"ds-icon\", className].filter(Boolean).join(\" \")}\n role={rest[\"aria-label\"] ? \"img\" : undefined}\n aria-hidden={rest[\"aria-label\"] ? undefined : true}\n focusable=\"false\"\n {...rest}\n />\n );\n});\n"],"mappings":"A,gFA4EA,IAAayE,EAAQ,CACnB,aAAczE,EAAAA,UACd,gBAAiBC,EAAAA,aACjB,cAAeC,EAAAA,WACf,iBAAkBC,EAAAA,cAClB,QAASC,EAAAA,QACT,OAAQC,EAAAA,OACR,KAAMC,EAAAA,KACN,cAAeC,EAAAA,WACf,KAAMC,EAAAA,KACN,KAAMC,EAAAA,KACN,YAAaC,EAAAA,SACb,YAAaC,EAAAA,SACb,OAAQC,EAAAA,OACR,WAAYC,EAAAA,SACZ,KAAMC,EAAAA,KACN,eAAgBC,EAAAA,YAChB,MAAOC,EAAAA,MACP,KAAMC,EAAAA,MACN,cAAeC,EAAAA,cACf,KAAMC,EAAAA,MACN,aAAcC,EAAAA,UACd,cAAeC,EAAAA,WACf,SAAUC,EAAAA,SACV,MAAOC,EAAAA,MACP,eAAgBC,EAAAA,YAChB,eAAgBC,EAAAA,YAChB,aAAcC,EAAAA,UACd,MAAOC,EAAAA,MACP,gBAAiBC,EAAAA,aACjB,MAAOC,EAAAA,MACP,KAAMC,EAAAA,KACN,SAAUC,EAAAA,SACV,IAAKC,EAAAA,IACL,gBAAiBC,EAAAA,aACjB,OAAQC,EAAAA,OACR,KAAMC,EAAAA,KACN,gBAAiBC,EAAAA,aACjB,iBAAkBC,EAAAA,cAClB,YAAaC,EAAAA,SACb,OAAQC,EAAAA,aACR,MAAOC,EAAAA,MACP,KAAMC,EAAAA,KACN,cAAeC,EAAAA,WACf,KAAMC,EAAAA,KACN,aAAcC,EAAAA,UACd,aAAcC,EAAAA,UACd,MAAOC,EAAAA,MACP,kBAAmBC,EAAAA,eACnB,gBAAiBC,EAAAA,aACjB,MAAOC,EAAAA,MACP,KAAMC,EAAAA,KACN,KAAMC,EAAAA,KACN,SAAUC,EAAAA,MACV,UAAWC,EAAAA,OACX,YAAaC,EAAAA,SACb,QAASC,EAAAA,QACT,kBAAmBC,EAAAA,eACnB,OAAQC,EAAAA,OACR,QAASC,EAAAA,QACT,KAAMC,EAAAA,KACN,aAAcC,EAAAA,UACd,YAAaC,EAAAA,SACb,OAAQC,EAAAA,OACR,SAAUC,EAAAA,SACV,cAAeC,EAAAA,WACf,MAAOC,EAAAA,OACP,OAAQC,EAAAA,OACR,KAAMC,EAAAA,KACN,EAAGC,EAAAA,CACL,EAIaM,EAAY,OAAO,KAAKD,CAAK,ECrI7BE,GAAA,EAAON,EAAAA,WAAAA,CAAqC,SACvD,CAAE,OAAM,OAAO,GAAI,YAAW,GAAGO,GACjC,EACA,CACA,IAAMC,EAAQJ,EAAMK,GACpB,OACE,EAAAN,EAAA,IAAA,CAACK,EAAD,CACO,MACL,MAAOE,EACP,OAAQA,EACR,UAAW,CAAC,UAAWC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC1D,KAAMJ,EAAK,cAAgB,MAAQ,IAAA,GACnC,cAAa,GAAK,eAAgB,IAAA,GAClC,UAAU,QACV,GAAIA,CACL,CAAA,CAEL,CAAC,E"}
@@ -1,6 +1,6 @@
1
1
  import { forwardRef as e } from "react";
2
- import { AlertTriangle as t, AlignJustify as n, AlignLeft as r, AlignRight as i, Archive as a, ArrowLeft as ee, ArrowRight as te, AudioLines as o, Bell as s, Blocks as c, Bold as l, Calendar as u, Check as d, ChevronDown as f, ChevronLeft as p, ChevronRight as m, ChevronUp as h, ChevronsLeft as g, ChevronsRight as _, Clock as v, Code as y, Copy as b, Download as x, ExternalLink as S, Eye as C, FileText as w, Film as T, Filter as E, FolderClosed as D, Globe as O, GripHorizontal as k, GripVertical as A, Heading2 as j, Heading3 as M, Home as N, Image as ne, Info as P, Italic as F, KeyRound as I, LayoutGrid as L, Link as R, Link2Off as z, List as B, ListOrdered as V, Loader2 as H, Maximize2 as U, Menu as W, Minimize2 as G, Minus as K, MoreHorizontal as q, Pencil as J, Pipette as Y, Plus as X, Quote as Z, Redo2 as re, RotateCcw as ie, RotateCw as ae, Search as oe, Settings as se, Strikethrough as Q, Trash2 as ce, Undo2 as le, Upload as ue, User as de, Users as fe, X as pe } from "lucide-react";
3
- import { jsx as me } from "react/jsx-runtime";
2
+ import { AlertTriangle as t, AlignJustify as n, AlignLeft as r, AlignRight as i, Archive as a, ArrowLeft as ee, ArrowRight as te, AudioLines as o, Bell as s, Blocks as c, Bold as l, Calendar as u, Check as d, ChevronDown as f, ChevronLeft as p, ChevronRight as m, ChevronUp as h, ChevronsLeft as g, ChevronsRight as _, Clock as v, Code as y, Copy as b, Download as x, ExternalLink as S, Eye as C, FileText as w, Film as T, Filter as E, FolderClosed as D, Globe as O, GripHorizontal as k, GripVertical as A, Heading2 as j, Heading3 as M, Home as N, Image as P, Info as F, Italic as I, KeyRound as L, LayoutGrid as R, Link as z, Link2Off as B, List as V, ListOrdered as ne, Loader2 as H, LogIn as U, LogOut as W, Maximize2 as G, Menu as K, Minimize2 as q, Minus as J, MoreHorizontal as Y, Pencil as X, Pipette as Z, Plus as re, Quote as ie, Redo2 as ae, RotateCcw as oe, RotateCw as se, Search as ce, Settings as le, Strikethrough as ue, ToggleLeft as de, Trash2 as fe, Undo2 as pe, Upload as me, User as Q, Users as he, X as ge } from "lucide-react";
3
+ import { jsx as _e } from "react/jsx-runtime";
4
4
  //#region src/components/Icon/icons.ts
5
5
  var $ = {
6
6
  "align-left": r,
@@ -15,14 +15,14 @@ var $ = {
15
15
  code: y,
16
16
  "heading-2": j,
17
17
  "heading-3": M,
18
- italic: F,
19
- "link-off": z,
20
- list: B,
21
- "list-ordered": V,
22
- quote: Z,
23
- redo: re,
24
- strikethrough: Q,
25
- undo: le,
18
+ italic: I,
19
+ "link-off": B,
20
+ list: V,
21
+ "list-ordered": ne,
22
+ quote: ie,
23
+ redo: ae,
24
+ strikethrough: ue,
25
+ undo: pe,
26
26
  "arrow-left": ee,
27
27
  "arrow-right": te,
28
28
  calendar: u,
@@ -30,7 +30,7 @@ var $ = {
30
30
  "chevron-down": f,
31
31
  "chevron-left": p,
32
32
  "chevron-up": h,
33
- minus: K,
33
+ minus: J,
34
34
  "chevron-right": m,
35
35
  clock: v,
36
36
  copy: b,
@@ -45,33 +45,36 @@ var $ = {
45
45
  folder: D,
46
46
  globe: O,
47
47
  home: N,
48
- "layout-grid": L,
49
- menu: W,
50
- "maximize-2": U,
51
- "minimize-2": G,
52
- users: fe,
48
+ "layout-grid": R,
49
+ menu: K,
50
+ "maximize-2": G,
51
+ "minimize-2": q,
52
+ users: he,
53
53
  "grip-horizontal": k,
54
54
  "grip-vertical": A,
55
- image: ne,
56
- info: P,
57
- link: R,
58
- "key-round": I,
55
+ image: P,
56
+ info: F,
57
+ link: z,
58
+ "log-in": U,
59
+ "log-out": W,
60
+ "key-round": L,
59
61
  spinner: H,
60
- "more-horizontal": q,
61
- pencil: J,
62
- pipette: Y,
63
- plus: X,
64
- "rotate-ccw": ie,
65
- "rotate-cw": ae,
66
- search: oe,
67
- settings: se,
68
- trash: ce,
69
- upload: ue,
70
- user: de,
71
- x: pe
72
- }, he = Object.keys($), ge = e(function({ name: e, size: t = 16, className: n, ...r }, i) {
62
+ "more-horizontal": Y,
63
+ pencil: X,
64
+ pipette: Z,
65
+ plus: re,
66
+ "rotate-ccw": oe,
67
+ "rotate-cw": se,
68
+ search: ce,
69
+ settings: le,
70
+ "toggle-left": de,
71
+ trash: fe,
72
+ upload: me,
73
+ user: Q,
74
+ x: ge
75
+ }, ve = Object.keys($), ye = e(function({ name: e, size: t = 16, className: n, ...r }, i) {
73
76
  let a = $[e];
74
- return /* @__PURE__ */ me(a, {
77
+ return /* @__PURE__ */ _e(a, {
75
78
  ref: i,
76
79
  width: t,
77
80
  height: t,
@@ -83,6 +86,6 @@ var $ = {
83
86
  });
84
87
  });
85
88
  //#endregion
86
- export { he as n, $ as r, ge as t };
89
+ export { ve as n, $ as r, ye as t };
87
90
 
88
- //# sourceMappingURL=Icon-CYXOo0Kt.js.map
91
+ //# sourceMappingURL=Icon-dPXyBYe5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon-dPXyBYe5.js","names":["icons","AlignLeft","AlignJustify","AlignRight","AlertTriangle","Archive","Blocks","Film","AudioLines","Bold","Code","Heading2","Heading3","Italic","Link2Off","List","ListOrdered","Quote","Redo2","Strikethrough","Undo2","ArrowLeft","ArrowRight","Calendar","Check","ChevronDown","ChevronLeft","ChevronUp","Minus","ChevronRight","Clock","Copy","Download","Eye","ExternalLink","Filter","Bell","ChevronsLeft","ChevronsRight","FileText","FolderClosed","Globe","Home","LayoutGrid","Menu","Maximize2","Minimize2","Users","GripHorizontal","GripVertical","Image","Info","Link","LogIn","LogOut","KeyRound","Loader2","MoreHorizontal","Pencil","Pipette","Plus","RotateCcw","RotateCw","Search","Settings","ToggleLeft","Trash2","Upload","User","X","iconNames","Icon","forwardRef","rest","Glyph","name","size","className"],"sources":["../../src/components/Icon/icons.ts","../../src/components/Icon/index.tsx"],"sourcesContent":["import {\n AlignLeft,\n AlignJustify,\n AlignRight,\n AlertTriangle,\n Blocks,\n Film,\n AudioLines,\n Bold,\n Code,\n Heading2,\n Heading3,\n Italic,\n Link2Off,\n List,\n ListOrdered,\n Quote,\n Redo2,\n Strikethrough,\n Undo2,\n Archive,\n ArrowLeft,\n ArrowRight,\n Calendar,\n Check,\n ChevronDown,\n ChevronLeft,\n ChevronUp,\n Minus,\n ChevronRight,\n Clock,\n Copy,\n Download,\n Eye,\n ExternalLink,\n Filter,\n Bell,\n ChevronsLeft,\n ChevronsRight,\n FileText,\n FolderClosed,\n Globe,\n Home,\n LayoutGrid,\n Menu,\n Maximize2,\n Minimize2,\n Users,\n GripHorizontal,\n GripVertical,\n Image,\n Info,\n Link,\n LogIn,\n LogOut,\n KeyRound,\n Loader2,\n MoreHorizontal,\n Pencil,\n Pipette,\n Plus,\n RotateCcw,\n RotateCw,\n Search,\n Settings,\n ToggleLeft,\n Trash2,\n Upload,\n User,\n X,\n} from \"lucide-react\";\n\n/**\n * The finite icon set. Adding a glyph means adding a line here — a visible\n * decision rather than an import someone typed at a call site.\n */\nexport const icons = {\n \"align-left\": AlignLeft,\n \"align-justify\": AlignJustify,\n \"align-right\": AlignRight,\n \"alert-triangle\": AlertTriangle,\n archive: Archive,\n blocks: Blocks,\n film: Film,\n \"audio-lines\": AudioLines,\n bold: Bold,\n code: Code,\n \"heading-2\": Heading2,\n \"heading-3\": Heading3,\n italic: Italic,\n \"link-off\": Link2Off,\n list: List,\n \"list-ordered\": ListOrdered,\n quote: Quote,\n redo: Redo2,\n strikethrough: Strikethrough,\n undo: Undo2,\n \"arrow-left\": ArrowLeft,\n \"arrow-right\": ArrowRight,\n calendar: Calendar,\n check: Check,\n \"chevron-down\": ChevronDown,\n \"chevron-left\": ChevronLeft,\n \"chevron-up\": ChevronUp,\n minus: Minus,\n \"chevron-right\": ChevronRight,\n clock: Clock,\n copy: Copy,\n download: Download,\n eye: Eye,\n \"external-link\": ExternalLink,\n filter: Filter,\n bell: Bell,\n \"chevrons-left\": ChevronsLeft,\n \"chevrons-right\": ChevronsRight,\n \"file-text\": FileText,\n folder: FolderClosed,\n globe: Globe,\n home: Home,\n \"layout-grid\": LayoutGrid,\n menu: Menu,\n \"maximize-2\": Maximize2,\n \"minimize-2\": Minimize2,\n users: Users,\n \"grip-horizontal\": GripHorizontal,\n \"grip-vertical\": GripVertical,\n image: Image,\n info: Info,\n link: Link,\n \"log-in\": LogIn,\n \"log-out\": LogOut,\n \"key-round\": KeyRound,\n spinner: Loader2,\n \"more-horizontal\": MoreHorizontal,\n pencil: Pencil,\n pipette: Pipette,\n plus: Plus,\n \"rotate-ccw\": RotateCcw,\n \"rotate-cw\": RotateCw,\n search: Search,\n settings: Settings,\n \"toggle-left\": ToggleLeft,\n trash: Trash2,\n upload: Upload,\n user: User,\n x: X,\n} as const;\n\nexport type IconName = keyof typeof icons;\n\nexport const iconNames = Object.keys(icons) as IconName[];\n","import { forwardRef, type SVGProps } from \"react\";\nimport { icons, type IconName } from \"./icons\";\nimport \"./style.css\";\n\nexport type IconSize = 16 | 20 | 24;\n\nexport interface IconProps extends Omit<SVGProps<SVGSVGElement>, \"ref\"> {\n /** Glyph name from the curated set in `icons.ts`. */\n name: IconName;\n /** 16 inside controls, 20 standalone, 24 for empty states. No other sizes. */\n size?: IconSize;\n}\n\n/**\n * A glyph that clarifies an action or a status. Inherits `currentColor`, so it\n * takes its colour from the control it sits in — it never carries its own.\n */\nexport const Icon = forwardRef<SVGSVGElement, IconProps>(function Icon(\n { name, size = 16, className, ...rest },\n ref,\n) {\n const Glyph = icons[name];\n return (\n <Glyph\n ref={ref}\n width={size}\n height={size}\n className={[\"ds-icon\", className].filter(Boolean).join(\" \")}\n role={rest[\"aria-label\"] ? \"img\" : undefined}\n aria-hidden={rest[\"aria-label\"] ? undefined : true}\n focusable=\"false\"\n {...rest}\n />\n );\n});\n"],"mappings":";;;;AA4EA,IAAaA,IAAQ;CACnB,cAAcC;CACd,iBAAiBC;CACjB,eAAeC;CACf,kBAAkBC;CAClB,SAASC;CACT,QAAQC;CACR,MAAMC;CACN,eAAeC;CACf,MAAMC;CACN,MAAMC;CACN,aAAaC;CACb,aAAaC;CACb,QAAQC;CACR,YAAYC;CACZ,MAAMC;CACN,gBAAgBC;CAChB,OAAOC;CACP,MAAMC;CACN,eAAeC;CACf,MAAMC;CACN,cAAcC;CACd,eAAeC;CACf,UAAUC;CACV,OAAOC;CACP,gBAAgBC;CAChB,gBAAgBC;CAChB,cAAcC;CACd,OAAOC;CACP,iBAAiBC;CACjB,OAAOC;CACP,MAAMC;CACN,UAAUC;CACV,KAAKC;CACL,iBAAiBC;CACjB,QAAQC;CACR,MAAMC;CACN,iBAAiBC;CACjB,kBAAkBC;CAClB,aAAaC;CACb,QAAQC;CACR,OAAOC;CACP,MAAMC;CACN,eAAeC;CACf,MAAMC;CACN,cAAcC;CACd,cAAcC;CACd,OAAOC;CACP,mBAAmBC;CACnB,iBAAiBC;CACjB,OAAOC;CACP,MAAMC;CACN,MAAMC;CACN,UAAUC;CACV,WAAWC;CACX,aAAaC;CACb,SAASC;CACT,mBAAmBC;CACnB,QAAQC;CACR,SAASC;CACT,MAAMC;CACN,cAAcC;CACd,aAAaC;CACb,QAAQC;CACR,UAAUC;CACV,eAAeC;CACf,OAAOC;CACP,QAAQC;CACR,MAAMC;CACN,GAAGC;AACL,GAIaC,KAAY,OAAO,KAAKtE,CAAK,GCrI7BuE,KAAOC,EAAqC,SACvD,EAAE,SAAM,UAAO,IAAI,cAAW,GAAGC,KACjC,GACA;CACA,IAAMC,IAAQ1E,EAAM2E;CACpB,OACE,mBAACD,GAAD;EACO;EACL,OAAOE;EACP,QAAQA;EACR,WAAW,CAAC,WAAWC,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;EAC1D,MAAMJ,EAAK,gBAAgB,QAAQ,KAAA;EACnC,eAAa,GAAK,iBAAgB,KAAA;EAClC,WAAU;EACV,GAAIA;CACL,CAAA;AAEL,CAAC"}
@@ -1,2 +1,2 @@
1
- const e=require("./Icon-CD3oeiNA.cjs"),t=require("../components/Button/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={neutral:`info`,info:`info`,success:`check`,warning:`alert-triangle`,danger:`alert-triangle`,review:`eye`},a=e=>e==null||typeof e==`boolean`||e===``;function o(e,t){return Array.isArray(e)?e.some(e=>o(e,t)):(0,n.isValidElement)(e)&&e.type===n.Fragment?o(e.props.children,t):t(e)}var s=e=>o(e,e=>!a(e)),c=e=>o(e,e=>!a(e)&&typeof e!=`number`);function l(t,n){if(t===void 0||t===`none`)return;let r=t===`auto`?i[n]:t;return Object.hasOwn(e.r,r)?r:void 0}var u=e=>e===`danger`||e===`warning`?`alert`:`status`,d=(0,n.forwardRef)(function({tone:i=`neutral`,appearance:a=`inline`,title:o,icon:d,actions:f,onDismiss:p,dismissLabel:m=`Dismiss`,classPrefix:h,role:g,className:_,children:v,...y},b){let[x]=(0,n.useState)(()=>u(i)),S=l(d,i),C=e=>[`ds-message__${e}`,h&&`${h}__${e}`].filter(Boolean).join(` `),w=a===`floating`?`span`:`div`;return(0,r.jsxs)(`div`,{ref:b,role:g??x,"data-tone":i===`neutral`?void 0:i,"data-appearance":a,className:[`ds-message`,_].filter(Boolean).join(` `),...y,children:[S&&(0,r.jsx)(e.t,{name:S,size:20,className:C(`icon`)}),(0,r.jsxs)(`div`,{className:`${C(`body`)} ds-field-surface`,children:[(0,r.jsx)(`span`,{className:C(`title`),children:o}),s(v)&&(0,r.jsx)(w,{className:C(`description`),children:v}),c(f)&&(0,r.jsx)(`div`,{className:C(`actions`),children:f})]}),p&&(0,r.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,className:`${C(`dismiss`)} ds-field-surface`,"aria-label":m,onClick:p})]})});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
2
- //# sourceMappingURL=Message-CIKSTXp8.cjs.map
1
+ const e=require("./Icon-3ucBRgrd.cjs"),t=require("../components/Button/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i={neutral:`info`,info:`info`,success:`check`,warning:`alert-triangle`,danger:`alert-triangle`,review:`eye`},a=e=>e==null||typeof e==`boolean`||e===``;function o(e,t){return Array.isArray(e)?e.some(e=>o(e,t)):(0,n.isValidElement)(e)&&e.type===n.Fragment?o(e.props.children,t):t(e)}var s=e=>o(e,e=>!a(e)),c=e=>o(e,e=>!a(e)&&typeof e!=`number`);function l(t,n){if(t===void 0||t===`none`)return;let r=t===`auto`?i[n]:t;return Object.hasOwn(e.r,r)?r:void 0}var u=e=>e===`danger`||e===`warning`?`alert`:`status`,d=(0,n.forwardRef)(function({tone:i=`neutral`,appearance:a=`inline`,title:o,icon:d,actions:f,onDismiss:p,dismissLabel:m=`Dismiss`,classPrefix:h,role:g,className:_,children:v,...y},b){let[x]=(0,n.useState)(()=>u(i)),S=l(d,i),C=e=>[`ds-message__${e}`,h&&`${h}__${e}`].filter(Boolean).join(` `),w=a===`floating`?`span`:`div`;return(0,r.jsxs)(`div`,{ref:b,role:g??x,"data-tone":i===`neutral`?void 0:i,"data-appearance":a,className:[`ds-message`,_].filter(Boolean).join(` `),...y,children:[S&&(0,r.jsx)(e.t,{name:S,size:20,className:C(`icon`)}),(0,r.jsxs)(`div`,{className:`${C(`body`)} ds-field-surface`,children:[(0,r.jsx)(`span`,{className:C(`title`),children:o}),s(v)&&(0,r.jsx)(w,{className:C(`description`),children:v}),c(f)&&(0,r.jsx)(`div`,{className:C(`actions`),children:f})]}),p&&(0,r.jsx)(t.Button,{variant:`simple`,size:`sm`,isIconOnly:!0,iconStart:`x`,className:`${C(`dismiss`)} ds-field-surface`,"aria-label":m,onClick:p})]})});Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return d}});
2
+ //# sourceMappingURL=Message-Ce2zjtfz.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Message-CIKSTXp8.cjs","names":["isValidElement","Fragment","icons","forwardRef","useState","Icon","Button","require_Icon","require_components_Button_index","react","react_jsx_runtime","TONE_ICON","isBlank","node","someLeaf","child","test","hasBody","leaf","hasActions","resolveIcon","icon","name","tone","toneRole","Message","rest","defaultRole","iconName","slotClass","slot","classPrefix","Description","appearance","role","className","title","children","actions","onDismiss","dismissLabel"],"sources":["../../src/internal/Message.tsx"],"sourcesContent":["import {\n forwardRef,\n Fragment,\n isValidElement,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../components/Button\";\nimport { Icon } from \"../components/Icon\";\nimport { icons, type IconName } from \"../components/Icon/icons\";\nimport \"../styles/message.css\";\n\nexport type MessageTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"review\";\n\nconst TONE_ICON: Record<MessageTone, IconName> = {\n neutral: \"info\",\n info: \"info\",\n success: \"check\",\n warning: \"alert-triangle\",\n danger: \"alert-triangle\",\n review: \"eye\",\n};\n\nexport interface MessageProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n tone?: MessageTone;\n appearance?: \"inline\" | \"floating\";\n title: string;\n /**\n * Omitted or `none` hides the icon; `auto` uses the tone's default glyph. A\n * name outside the curated icon set renders no icon rather than throwing.\n */\n icon?: IconName | \"auto\" | \"none\";\n actions?: ReactNode;\n /** Renders a dismiss control. The parent owns visibility. */\n onDismiss?: () => void;\n /** Accessible name of the dismiss control. Defaults to \"Dismiss\". */\n dismissLabel?: string;\n /** The public wrapper's block class, added beside each `ds-message__*` slot class. */\n classPrefix?: string;\n}\n\n/** Leftovers of conditional rendering: nothing visible, so no slot is reserved. */\nconst isBlank = (node: unknown) => node == null || typeof node === \"boolean\" || node === \"\";\n\n/** Whether `test` holds for any leaf, looking through arrays and fragments. */\nfunction someLeaf(node: ReactNode, test: (leaf: ReactNode) => boolean): boolean {\n if (Array.isArray(node)) {\n return node.some((child: ReactNode) => someLeaf(child, test));\n }\n if (isValidElement<{ children?: ReactNode }>(node) && node.type === Fragment) {\n return someLeaf(node.props.children, test);\n }\n return test(node);\n}\n\n// Numbers are content in the body (`0` items) but never an action: a `0` in the\n// actions slot comes from `count && <Button />`, so it reserves no row.\nconst hasBody = (node: ReactNode) => someLeaf(node, (leaf) => !isBlank(leaf));\nconst hasActions = (node: ReactNode) =>\n someLeaf(node, (leaf) => !isBlank(leaf) && typeof leaf !== \"number\");\n\nfunction resolveIcon(icon: MessageProps[\"icon\"], tone: MessageTone): IconName | undefined {\n if (icon === undefined || icon === \"none\") {\n return undefined;\n }\n const name = icon === \"auto\" ? TONE_ICON[tone] : icon;\n // Own keys only, so values such as \"constructor\" never reach Icon.\n return Object.hasOwn(icons, name) ? name : undefined;\n}\n\nconst toneRole = (tone: MessageTone) =>\n tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\";\n\n/** Shared notification structure. Public wrappers own delivery and content policy. */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n {\n tone = \"neutral\",\n appearance = \"inline\",\n title,\n icon,\n actions,\n onDismiss,\n dismissLabel = \"Dismiss\",\n classPrefix,\n role,\n className,\n children,\n ...rest\n },\n ref,\n) {\n // A live region must exist before its content changes, so the default role\n // comes from the tone the message mounts with and survives later tone changes.\n const [defaultRole] = useState(() => toneRole(tone));\n const iconName = resolveIcon(icon, tone);\n const slotClass = (slot: string) =>\n [`ds-message__${slot}`, classPrefix && `${classPrefix}__${slot}`].filter(Boolean).join(\" \");\n // Floating notifications retain Toast's text-only span; banners support rich blocks.\n const Description = appearance === \"floating\" ? \"span\" : \"div\";\n\n return (\n <div\n ref={ref}\n role={role ?? defaultRole}\n data-tone={tone === \"neutral\" ? undefined : tone}\n data-appearance={appearance}\n className={[\"ds-message\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {iconName && (\n <Icon\n name={iconName}\n size={20}\n className={slotClass(\"icon\")}\n />\n )}\n <div className={`${slotClass(\"body\")} ds-field-surface`}>\n <span className={slotClass(\"title\")}>{title}</span>\n {hasBody(children) && (\n <Description className={slotClass(\"description\")}>{children}</Description>\n )}\n {hasActions(actions) && <div className={slotClass(\"actions\")}>{actions}</div>}\n </div>\n {onDismiss && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n className={`${slotClass(\"dismiss\")} ds-field-surface`}\n aria-label={dismissLabel}\n onClick={onDismiss}\n />\n )}\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EtFE,EAAcC,IAAe,WAAa,OAAS,MAEzD,OACE,EAAAvB,EAAA,KAAA,CAAC,MAAD,CACO,MACL,KAAMwB,GAAQP,EACd,YAAWJ,IAAS,UAAY,IAAA,GAAYA,EAC5C,kBAAiBU,EACjB,UAAW,CAAC,aAAcE,CAAS,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,EAC7D,GAAIT,EANN,SAAA,CAQGE,IACC,EAAAlB,EAAA,IAAA,CAACL,EAAAA,EAAD,CACE,KAAMuB,EACN,KAAM,GACN,UAAWC,EAAU,MAAM,CAC5B,CAAA,GAEH,EAAAnB,EAAA,KAAA,CAAC,MAAD,CAAK,UAAW,GAAGmB,EAAU,MAAM,EAAE,mBAArC,SAAA,EACE,EAAAnB,EAAA,IAAA,CAAC,OAAD,CAAM,UAAWmB,EAAU,OAAO,EAAI,SAAAO,CAAY,CAAA,EACjDnB,EAAQoB,CAAQ,IACf,EAAA3B,EAAA,IAAA,CAACsB,EAAD,CAAa,UAAWH,EAAU,aAAa,EAAI,UAAsB,CAAA,EAE1EV,EAAWmB,CAAO,IAAK,EAAA5B,EAAA,IAAA,CAAC,MAAD,CAAK,UAAWmB,EAAU,SAAS,EAAI,SAAAS,CAAa,CAAA,CACzE,C,GACJC,IACC,EAAA7B,EAAA,IAAA,CAACJ,EAAAA,OAAD,CACE,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,IACV,UAAW,GAAGuB,EAAU,SAAS,EAAE,mBACnC,aAAYW,EACZ,QAASD,CACV,CAAA,CAEA,C,EAET,CAAC,E"}
1
+ {"version":3,"file":"Message-Ce2zjtfz.cjs","names":["isValidElement","Fragment","icons","forwardRef","useState","Icon","Button","require_Icon","require_components_Button_index","react","react_jsx_runtime","TONE_ICON","isBlank","node","someLeaf","child","test","hasBody","leaf","hasActions","resolveIcon","icon","name","tone","toneRole","Message","rest","defaultRole","iconName","slotClass","slot","classPrefix","Description","appearance","role","className","title","children","actions","onDismiss","dismissLabel"],"sources":["../../src/internal/Message.tsx"],"sourcesContent":["import {\n forwardRef,\n Fragment,\n isValidElement,\n useState,\n type HTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../components/Button\";\nimport { Icon } from \"../components/Icon\";\nimport { icons, type IconName } from \"../components/Icon/icons\";\nimport \"../styles/message.css\";\n\nexport type MessageTone = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"review\";\n\nconst TONE_ICON: Record<MessageTone, IconName> = {\n neutral: \"info\",\n info: \"info\",\n success: \"check\",\n warning: \"alert-triangle\",\n danger: \"alert-triangle\",\n review: \"eye\",\n};\n\nexport interface MessageProps extends Omit<HTMLAttributes<HTMLDivElement>, \"title\"> {\n tone?: MessageTone;\n appearance?: \"inline\" | \"floating\";\n title: string;\n /**\n * Omitted or `none` hides the icon; `auto` uses the tone's default glyph. A\n * name outside the curated icon set renders no icon rather than throwing.\n */\n icon?: IconName | \"auto\" | \"none\";\n actions?: ReactNode;\n /** Renders a dismiss control. The parent owns visibility. */\n onDismiss?: () => void;\n /** Accessible name of the dismiss control. Defaults to \"Dismiss\". */\n dismissLabel?: string;\n /** The public wrapper's block class, added beside each `ds-message__*` slot class. */\n classPrefix?: string;\n}\n\n/** Leftovers of conditional rendering: nothing visible, so no slot is reserved. */\nconst isBlank = (node: unknown) => node == null || typeof node === \"boolean\" || node === \"\";\n\n/** Whether `test` holds for any leaf, looking through arrays and fragments. */\nfunction someLeaf(node: ReactNode, test: (leaf: ReactNode) => boolean): boolean {\n if (Array.isArray(node)) {\n return node.some((child: ReactNode) => someLeaf(child, test));\n }\n if (isValidElement<{ children?: ReactNode }>(node) && node.type === Fragment) {\n return someLeaf(node.props.children, test);\n }\n return test(node);\n}\n\n// Numbers are content in the body (`0` items) but never an action: a `0` in the\n// actions slot comes from `count && <Button />`, so it reserves no row.\nconst hasBody = (node: ReactNode) => someLeaf(node, (leaf) => !isBlank(leaf));\nconst hasActions = (node: ReactNode) =>\n someLeaf(node, (leaf) => !isBlank(leaf) && typeof leaf !== \"number\");\n\nfunction resolveIcon(icon: MessageProps[\"icon\"], tone: MessageTone): IconName | undefined {\n if (icon === undefined || icon === \"none\") {\n return undefined;\n }\n const name = icon === \"auto\" ? TONE_ICON[tone] : icon;\n // Own keys only, so values such as \"constructor\" never reach Icon.\n return Object.hasOwn(icons, name) ? name : undefined;\n}\n\nconst toneRole = (tone: MessageTone) =>\n tone === \"danger\" || tone === \"warning\" ? \"alert\" : \"status\";\n\n/** Shared notification structure. Public wrappers own delivery and content policy. */\nexport const Message = forwardRef<HTMLDivElement, MessageProps>(function Message(\n {\n tone = \"neutral\",\n appearance = \"inline\",\n title,\n icon,\n actions,\n onDismiss,\n dismissLabel = \"Dismiss\",\n classPrefix,\n role,\n className,\n children,\n ...rest\n },\n ref,\n) {\n // A live region must exist before its content changes, so the default role\n // comes from the tone the message mounts with and survives later tone changes.\n const [defaultRole] = useState(() => toneRole(tone));\n const iconName = resolveIcon(icon, tone);\n const slotClass = (slot: string) =>\n [`ds-message__${slot}`, classPrefix && `${classPrefix}__${slot}`].filter(Boolean).join(\" \");\n // Floating notifications retain Toast's text-only span; banners support rich blocks.\n const Description = appearance === \"floating\" ? \"span\" : \"div\";\n\n return (\n <div\n ref={ref}\n role={role ?? defaultRole}\n data-tone={tone === \"neutral\" ? undefined : tone}\n data-appearance={appearance}\n className={[\"ds-message\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n {iconName && (\n <Icon\n name={iconName}\n size={20}\n className={slotClass(\"icon\")}\n />\n )}\n <div className={`${slotClass(\"body\")} ds-field-surface`}>\n <span className={slotClass(\"title\")}>{title}</span>\n {hasBody(children) && (\n <Description className={slotClass(\"description\")}>{children}</Description>\n )}\n {hasActions(actions) && <div className={slotClass(\"actions\")}>{actions}</div>}\n </div>\n {onDismiss && (\n <Button\n variant=\"simple\"\n size=\"sm\"\n isIconOnly\n iconStart=\"x\"\n className={`${slotClass(\"dismiss\")} ds-field-surface`}\n aria-label={dismissLabel}\n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