@epilot/zenith-react 0.2.0 → 0.3.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +278 -0
  2. package/codemods/README.md +5 -3
  3. package/codemods/migrate/volt/field-combobox.ts +37 -0
  4. package/codemods/migrate/volt/index.ts +2 -0
  5. package/codemods/migrate/volt/same-name.ts +2 -17
  6. package/codemods/radix-to-base-ui.ts +4 -1
  7. package/dist/_virtual/_zenith-runtime-family_autocomplete.js +7 -0
  8. package/dist/_virtual/_zenith-runtime-family_autocomplete.js.map +1 -0
  9. package/dist/components/callout/callout.js +0 -1
  10. package/dist/components/callout/callout.js.map +1 -1
  11. package/dist/components/command/command.js +263 -179
  12. package/dist/components/command/command.js.map +1 -1
  13. package/dist/components/field/field-combobox.js +213 -177
  14. package/dist/components/field/field-combobox.js.map +1 -1
  15. package/dist/components/field/field.js +281 -247
  16. package/dist/components/field/field.js.map +1 -1
  17. package/dist/components/list/list-sortable.js +86 -72
  18. package/dist/components/list/list-sortable.js.map +1 -1
  19. package/dist/components/list/list.js +206 -205
  20. package/dist/components/list/list.js.map +1 -1
  21. package/dist/components/tooltip/tooltip.js +10 -11
  22. package/dist/components/tooltip/tooltip.js.map +1 -1
  23. package/dist/index.d.ts +91 -256
  24. package/dist/index.js +120 -119
  25. package/dist/renderer/runtime-contract.generated.js +4 -4
  26. package/dist/renderer/runtime-contract.generated.js.map +1 -1
  27. package/package.json +39 -4
  28. package/dist/vendor/.bun/@radix-ui_primitive@1.1.3/vendor/@radix-ui/primitive/dist/index.js +0 -10
  29. package/dist/vendor/.bun/@radix-ui_primitive@1.1.3/vendor/@radix-ui/primitive/dist/index.js.map +0 -1
  30. package/dist/vendor/.bun/@radix-ui_react-compose-refs@1.1.2_0ac650c021fb1b59/vendor/@radix-ui/react-compose-refs/dist/index.js +0 -30
  31. package/dist/vendor/.bun/@radix-ui_react-compose-refs@1.1.2_0ac650c021fb1b59/vendor/@radix-ui/react-compose-refs/dist/index.js.map +0 -1
  32. package/dist/vendor/.bun/@radix-ui_react-context@1.1.2_0ac650c021fb1b59/vendor/@radix-ui/react-context/dist/index.js +0 -71
  33. package/dist/vendor/.bun/@radix-ui_react-context@1.1.2_0ac650c021fb1b59/vendor/@radix-ui/react-context/dist/index.js.map +0 -1
  34. package/dist/vendor/.bun/@radix-ui_react-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-dialog/dist/index.js +0 -258
  35. package/dist/vendor/.bun/@radix-ui_react-dialog@1.1.15_2b23df507bdda662/vendor/@radix-ui/react-dialog/dist/index.js.map +0 -1
  36. package/dist/vendor/.bun/@radix-ui_react-dismissable-layer@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-dismissable-layer/dist/index.js +0 -128
  37. package/dist/vendor/.bun/@radix-ui_react-dismissable-layer@1.1.11_2b23df507bdda662/vendor/@radix-ui/react-dismissable-layer/dist/index.js.map +0 -1
  38. package/dist/vendor/.bun/@radix-ui_react-focus-guards@1.1.3_0ac650c021fb1b59/vendor/@radix-ui/react-focus-guards/dist/index.js +0 -18
  39. package/dist/vendor/.bun/@radix-ui_react-focus-guards@1.1.3_0ac650c021fb1b59/vendor/@radix-ui/react-focus-guards/dist/index.js.map +0 -1
  40. package/dist/vendor/.bun/@radix-ui_react-focus-scope@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-focus-scope/dist/index.js +0 -138
  41. package/dist/vendor/.bun/@radix-ui_react-focus-scope@1.1.7_2b23df507bdda662/vendor/@radix-ui/react-focus-scope/dist/index.js.map +0 -1
  42. package/dist/vendor/.bun/@radix-ui_react-id@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-id/dist/index.js +0 -14
  43. package/dist/vendor/.bun/@radix-ui_react-id@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-id/dist/index.js.map +0 -1
  44. package/dist/vendor/.bun/@radix-ui_react-portal@1.1.9_2b23df507bdda662/vendor/@radix-ui/react-portal/dist/index.js +0 -17
  45. package/dist/vendor/.bun/@radix-ui_react-portal@1.1.9_2b23df507bdda662/vendor/@radix-ui/react-portal/dist/index.js.map +0 -1
  46. package/dist/vendor/.bun/@radix-ui_react-presence@1.1.5_2b23df507bdda662/vendor/@radix-ui/react-presence/dist/index.js +0 -72
  47. package/dist/vendor/.bun/@radix-ui_react-presence@1.1.5_2b23df507bdda662/vendor/@radix-ui/react-presence/dist/index.js.map +0 -1
  48. package/dist/vendor/.bun/@radix-ui_react-primitive@2.1.3_2b23df507bdda662/vendor/@radix-ui/react-primitive/dist/index.js +0 -37
  49. package/dist/vendor/.bun/@radix-ui_react-primitive@2.1.3_2b23df507bdda662/vendor/@radix-ui/react-primitive/dist/index.js.map +0 -1
  50. package/dist/vendor/.bun/@radix-ui_react-slot@1.2.3_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js +0 -51
  51. package/dist/vendor/.bun/@radix-ui_react-slot@1.2.3_0ac650c021fb1b59/vendor/@radix-ui/react-slot/dist/index.js.map +0 -1
  52. package/dist/vendor/.bun/@radix-ui_react-use-callback-ref@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-callback-ref/dist/index.js +0 -14
  53. package/dist/vendor/.bun/@radix-ui_react-use-callback-ref@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-callback-ref/dist/index.js.map +0 -1
  54. package/dist/vendor/.bun/@radix-ui_react-use-controllable-state@1.2.2_0ac650c021fb1b59/vendor/@radix-ui/react-use-controllable-state/dist/index.js +0 -55
  55. package/dist/vendor/.bun/@radix-ui_react-use-controllable-state@1.2.2_0ac650c021fb1b59/vendor/@radix-ui/react-use-controllable-state/dist/index.js.map +0 -1
  56. package/dist/vendor/.bun/@radix-ui_react-use-escape-keydown@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-escape-keydown/dist/index.js +0 -15
  57. package/dist/vendor/.bun/@radix-ui_react-use-escape-keydown@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-escape-keydown/dist/index.js.map +0 -1
  58. package/dist/vendor/.bun/@radix-ui_react-use-layout-effect@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
  59. package/dist/vendor/.bun/@radix-ui_react-use-layout-effect@1.1.1_0ac650c021fb1b59/vendor/@radix-ui/react-use-layout-effect/dist/index.js.map +0 -1
  60. package/dist/vendor/.bun/aria-hidden@1.2.6/vendor/aria-hidden/dist/es2015/index.js +0 -53
  61. package/dist/vendor/.bun/aria-hidden@1.2.6/vendor/aria-hidden/dist/es2015/index.js.map +0 -1
  62. package/dist/vendor/.bun/cmdk@1.1.1_2b23df507bdda662/vendor/cmdk/dist/chunk-NZJY6EH4.js +0 -18
  63. package/dist/vendor/.bun/cmdk@1.1.1_2b23df507bdda662/vendor/cmdk/dist/chunk-NZJY6EH4.js.map +0 -1
  64. package/dist/vendor/.bun/cmdk@1.1.1_2b23df507bdda662/vendor/cmdk/dist/index.js +0 -313
  65. package/dist/vendor/.bun/cmdk@1.1.1_2b23df507bdda662/vendor/cmdk/dist/index.js.map +0 -1
  66. package/dist/vendor/.bun/get-nonce@1.0.1/vendor/get-nonce/dist/es2015/index.js +0 -8
  67. package/dist/vendor/.bun/get-nonce@1.0.1/vendor/get-nonce/dist/es2015/index.js.map +0 -1
  68. package/dist/vendor/.bun/react-remove-scroll-bar@2.3.8_0ac650c021fb1b59/vendor/react-remove-scroll-bar/dist/es2015/component.js +0 -72
  69. package/dist/vendor/.bun/react-remove-scroll-bar@2.3.8_0ac650c021fb1b59/vendor/react-remove-scroll-bar/dist/es2015/component.js.map +0 -1
  70. package/dist/vendor/.bun/react-remove-scroll-bar@2.3.8_0ac650c021fb1b59/vendor/react-remove-scroll-bar/dist/es2015/constants.js +0 -8
  71. package/dist/vendor/.bun/react-remove-scroll-bar@2.3.8_0ac650c021fb1b59/vendor/react-remove-scroll-bar/dist/es2015/constants.js.map +0 -1
  72. package/dist/vendor/.bun/react-remove-scroll-bar@2.3.8_0ac650c021fb1b59/vendor/react-remove-scroll-bar/dist/es2015/utils.js +0 -26
  73. package/dist/vendor/.bun/react-remove-scroll-bar@2.3.8_0ac650c021fb1b59/vendor/react-remove-scroll-bar/dist/es2015/utils.js.map +0 -1
  74. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/Combination.js +0 -12
  75. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/Combination.js.map +0 -1
  76. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/SideEffect.js +0 -116
  77. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/SideEffect.js.map +0 -1
  78. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/UI.js +0 -32
  79. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/UI.js.map +0 -1
  80. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -17
  81. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/aggresiveCapture.js.map +0 -1
  82. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/handleScroll.js +0 -69
  83. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/handleScroll.js.map +0 -1
  84. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/medium.js +0 -6
  85. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/medium.js.map +0 -1
  86. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/sidecar.js +0 -8
  87. package/dist/vendor/.bun/react-remove-scroll@2.7.2_0ac650c021fb1b59/vendor/react-remove-scroll/dist/es2015/sidecar.js.map +0 -1
  88. package/dist/vendor/.bun/react-style-singleton@2.2.3_0ac650c021fb1b59/vendor/react-style-singleton/dist/es2015/component.js +0 -12
  89. package/dist/vendor/.bun/react-style-singleton@2.2.3_0ac650c021fb1b59/vendor/react-style-singleton/dist/es2015/component.js.map +0 -1
  90. package/dist/vendor/.bun/react-style-singleton@2.2.3_0ac650c021fb1b59/vendor/react-style-singleton/dist/es2015/hook.js +0 -16
  91. package/dist/vendor/.bun/react-style-singleton@2.2.3_0ac650c021fb1b59/vendor/react-style-singleton/dist/es2015/hook.js.map +0 -1
  92. package/dist/vendor/.bun/react-style-singleton@2.2.3_0ac650c021fb1b59/vendor/react-style-singleton/dist/es2015/singleton.js +0 -31
  93. package/dist/vendor/.bun/react-style-singleton@2.2.3_0ac650c021fb1b59/vendor/react-style-singleton/dist/es2015/singleton.js.map +0 -1
  94. package/dist/vendor/.bun/tslib@2.8.1/vendor/tslib/tslib.es6.js +0 -28
  95. package/dist/vendor/.bun/tslib@2.8.1/vendor/tslib/tslib.es6.js.map +0 -1
  96. package/dist/vendor/.bun/use-callback-ref@1.3.3_0ac650c021fb1b59/vendor/use-callback-ref/dist/es2015/assignRef.js +0 -7
  97. package/dist/vendor/.bun/use-callback-ref@1.3.3_0ac650c021fb1b59/vendor/use-callback-ref/dist/es2015/assignRef.js.map +0 -1
  98. package/dist/vendor/.bun/use-callback-ref@1.3.3_0ac650c021fb1b59/vendor/use-callback-ref/dist/es2015/useMergeRef.js +0 -27
  99. package/dist/vendor/.bun/use-callback-ref@1.3.3_0ac650c021fb1b59/vendor/use-callback-ref/dist/es2015/useMergeRef.js.map +0 -1
  100. package/dist/vendor/.bun/use-callback-ref@1.3.3_0ac650c021fb1b59/vendor/use-callback-ref/dist/es2015/useRef.js +0 -26
  101. package/dist/vendor/.bun/use-callback-ref@1.3.3_0ac650c021fb1b59/vendor/use-callback-ref/dist/es2015/useRef.js.map +0 -1
  102. package/dist/vendor/.bun/use-sidecar@1.1.3_0ac650c021fb1b59/vendor/use-sidecar/dist/es2015/exports.js +0 -19
  103. package/dist/vendor/.bun/use-sidecar@1.1.3_0ac650c021fb1b59/vendor/use-sidecar/dist/es2015/exports.js.map +0 -1
  104. package/dist/vendor/.bun/use-sidecar@1.1.3_0ac650c021fb1b59/vendor/use-sidecar/dist/es2015/medium.js +0 -68
  105. package/dist/vendor/.bun/use-sidecar@1.1.3_0ac650c021fb1b59/vendor/use-sidecar/dist/es2015/medium.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sources":["../../../src/components/field/field.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { boxModel, nativeControl } from \"../../styles/host-reset\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * Plain elements, not a primitive. v1's Field uses no Radix primitive at all — it is a custom\n * implementation with its own context, and v2 already had the same context (`FieldContext`,\n * carrying `inputRef`).\n */\nconst FieldRootBase = \"div\" as const\nconst FieldLabelBase = \"label\" as const\nconst FieldControlBase = \"input\" as const\nconst FieldDescriptionBase = \"p\" as const\nconst FieldErrorBase = \"div\" as const\n\nexport type FieldInputRef =\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement\n | HTMLButtonElement\n | null\n\nexport interface FieldContextValue {\n inputRef: React.RefObject<FieldInputRef>\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\nexport const useFieldContext = () => {\n const context = React.useContext(FieldContext)\n if (!context) {\n throw new Error(\"FieldInput must be used within a Field component\")\n }\n return context\n}\n\n/**\n * Field context when there is one, `null` otherwise — for parts that work both inside and outside\n * a Field.\n */\nexport const useOptionalFieldContext = (): FieldContextValue | null =>\n React.useContext(FieldContext)\n\nexport type FieldVariant = \"default\" | \"highlight\" | \"readonly\" | \"destructive\"\n\n/** The controls a Field wraps; their `:disabled` is what makes the field disabled. */\nconst FIELD_CONTROL_SLOTS = [\"field-input\", \"field-textarea\", \"select-trigger\"]\n/** FieldLabel, and the standalone Label when a caller uses it inside a Field. */\nconst FIELD_LABEL_SLOTS = [\"field-label\", \"label\"]\nconst DISABLED_LABEL = { cursor: \"not-allowed\", opacity: 0.5 }\n\n/**\n * One rule per (disabled condition, label slot). Each `:has()` names a single control rather than\n * any `:disabled` descendant, so an unrelated disabled button beside an enabled control (a clear\n * button with nothing to clear) does not dim the label. One key per selector: no comma lists.\n */\nconst disabledLabelRules = () =>\n Object.fromEntries(\n [\n \"&[data-disabled]\",\n ...FIELD_CONTROL_SLOTS.map(\n (slot) => `&:has([${SLOT_ATTR}=\"${slot}\"]:disabled)`\n ),\n ].flatMap((condition) =>\n FIELD_LABEL_SLOTS.map((label) => [\n `${condition} [${SLOT_ATTR}=\"${label}\"]`,\n DISABLED_LABEL,\n ])\n )\n )\n\n/**\n * Password managers (1Password, NordPass) inject a button next to the control, sometimes inline. In\n * a column the injection became a new row and the field grew (#5). It is placed in a second column\n * beside the control instead, centred on the control's row, with negative block margins as deep as\n * the field's padding so a button taller than the control does not stretch the row either.\n * Recognised as an element directly after a control that is not one of Zenith's own parts.\n */\nconst BESIDE_CONTROL = {\n alignSelf: \"center\",\n marginTop: `calc(-1 * ${tokens.fieldPaddingY})`,\n marginBottom: `calc(-1 * ${tokens.fieldPaddingY})`,\n}\n\n/** The parts that sit in the control's row: the controls, or a group holding one. */\nconst CONTROL_ROW_SLOTS = [...FIELD_CONTROL_SLOTS, \"field-input-group\"]\n\n/** Every part spans both columns, as it stacked before; a control takes the first column. */\nconst controlRowRules = () =>\n Object.fromEntries([\n [\"& > *\", { gridColumnStart: 1, gridColumnEnd: -1 }],\n ...CONTROL_ROW_SLOTS.flatMap((slot) => [\n [\n `& > [${SLOT_ATTR}=\"${slot}\"]`,\n { gridColumnStart: 1, gridColumnEnd: 2 },\n ],\n [\n `& > [${SLOT_ATTR}=\"${slot}\"] + :not([${SLOT_ATTR}])`,\n {\n gridColumnStart: 2,\n gridColumnEnd: 3,\n marginLeft: tokens.spacingElement1,\n ...BESIDE_CONTROL,\n },\n ],\n ]),\n ])\n\nconst useStyles = makeZenithStyles({\n root: {\n ...boxModel,\n position: \"relative\",\n // A grid, not a column, so an injected button can sit beside the control (see BESIDE_CONTROL).\n // The second column is empty and zero-wide unless something is injected.\n display: \"grid\",\n gridTemplateColumns: \"minmax(0, 1fr) auto\",\n width: \"100%\",\n // Density-bound (DENSITY-SPEC.md §2.3, WP9B1-ACCEPTANCE-WP9B2A): normal resolves to the same\n // spacingElement2/spacingElement3 values this used before binding — `spacingGroup1` (0.5rem)\n // is a half-step short of the 0.75rem v1 actually uses, which three components got wrong by\n // reaching for it directly; that pitfall is why fieldPaddingX's normal tier aliases\n // spacingElement3, not spacingGroup1 (packages/tokens/spec/density.yaml).\n paddingTop: tokens.fieldPaddingY,\n paddingBottom: tokens.fieldPaddingY,\n paddingLeft: tokens.fieldPaddingX,\n paddingRight: tokens.fieldPaddingX,\n // Row gap only: a column gap would narrow the control even while the second column is empty.\n rowGap: tokens.spacingElement1,\n ...shorthands.borderRadius(tokens.radiusLg),\n transitionProperty: \"all\",\n transitionDuration: \"75ms\",\n outlineOffset: \"2px\",\n outlineWidth: \"2px\",\n outlineStyle: \"none\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n \"&[data-focused='true'], &[data-focus-visible]\": {\n outlineStyle: \"solid\",\n outlineColor: tokens.focusRing,\n },\n \"&[data-invalid]\": {\n backgroundColor: tokens.errorSoft,\n },\n\n // Label's disabled styling, declared here because Field owns the elements these selectors are\n // rooted at. On Label they were written as \"[data-disabled] &\", \":disabled ~ &\" and\n // \"[data-disabled] ~ &\"; Griffel does not substitute `&` in that position and emits\n // `.hash<selector> .hash`, which never matches, so a label in a disabled field never dimmed.\n // See src/ancestor-selector.test.ts. The port of those rules still missed: they named the\n // `label` slot while FieldLabel emits `field-label`, and the `~` forms needed the label AFTER\n // the control, but it comes first. `:has()` reaches the control wherever it sits.\n ...disabledLabelRules(),\n ...controlRowRules(),\n },\n rootDefault: {\n backgroundColor: tokens.grayA3,\n \":hover\": {\n backgroundColor: tokens.grayA4,\n },\n },\n rootHighlight: {\n backgroundColor: tokens.accentA3,\n \":hover\": {\n backgroundColor: tokens.accentA4,\n },\n },\n rootReadonly: {\n backgroundColor: tokens.grayA3,\n },\n rootDestructive: {\n backgroundColor: tokens.errorSoft,\n \":hover\": {\n backgroundColor: tokens.errorA4,\n },\n },\n fieldSet: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n // Density-bound (DENSITY-SPEC.md §2.3): normal resolves to the same spacingLayout2 (32px)\n // this used before binding.\n ...shorthands.gap(tokens.fieldSetGap),\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n ...shorthands.margin(0),\n },\n fieldGroup: {\n ...boxModel,\n display: \"flex\",\n width: \"100%\",\n ...shorthands.gap(tokens.spacingElement2),\n },\n fieldGroupColumn: {\n flexDirection: \"column\",\n },\n fieldGroupRow: {\n flexDirection: \"row\",\n },\n fieldContent: {\n display: \"flex\",\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n flexDirection: \"column\",\n ...shorthands.gap(tokens.spacingElement2),\n lineHeight: \"1.375\",\n },\n label: {\n ...boxModel,\n minHeight: \"1rem\",\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n // No width: the label stretches across the field's column, so the whole label row is a hit\n // area for the control rather than only the text. Field reads as one box and is aimed at as one.\n display: \"flex\",\n ...shorthands.gap(tokens.spacingElement2),\n cursor: \"default\",\n color: tokens.grayA12,\n \"&[data-disabled]\": {\n opacity: 0.5,\n },\n },\n labelContent: {\n display: \"inline-flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement1),\n transitionProperty: \"opacity\",\n transitionDuration: \"150ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n },\n labelContentHover: {\n ...boxModel,\n width: 0,\n height: 0,\n overflowX: \"visible\",\n overflowY: \"visible\",\n opacity: 0,\n pointerEvents: \"none\",\n },\n description: {\n fontSize: tokens.textXs,\n lineHeight: \"1.5\",\n fontWeight: tokens.fontWeightNormal,\n ...shorthands.margin(0),\n \"& a\": {\n textDecorationLine: \"underline\",\n textUnderlineOffset: \"4px\",\n },\n },\n descriptionDefault: {\n color: tokens.grayA12,\n },\n descriptionHelper: {\n color: tokens.grayA11,\n },\n error: {\n color: tokens.errorOnSoft,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightNormal,\n },\n errorList: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.margin(0),\n paddingLeft: \"1.25rem\",\n listStyleType: \"disc\",\n },\n errorListItem: {\n color: tokens.errorOnSoft,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightNormal,\n marginTop: \"0.25rem\",\n marginBottom: \"0.25rem\",\n },\n input: {\n ...nativeControl,\n width: \"100%\",\n // Density-bound (DENSITY-SPEC.md §2.3): normal resolves to the same \"1.5rem\" this used before\n // binding. FieldComboboxInput (field-combobox.tsx) has its OWN separate makeZenithStyles call\n // and its own unrelated \"input\" key (width: \"100%\" only, no height) — this binding does not\n // reach it; review corrected an earlier claim that it did.\n height: tokens.fieldInputHeight,\n outlineStyle: \"none\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA12,\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n \"::placeholder\": {\n color: tokens.grayA8,\n },\n \":disabled\": {\n cursor: \"not-allowed\",\n },\n },\n inputGroup: {\n ...boxModel,\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement1),\n width: \"100%\",\n // Already a row, so an injected button lands beside the input; it must not stretch the row.\n [`& > [${SLOT_ATTR}=\"field-input\"] + :not([${SLOT_ATTR}])`]: BESIDE_CONTROL,\n },\n textarea: {\n ...nativeControl,\n width: \"100%\",\n outlineStyle: \"none\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA12,\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n \"::placeholder\": {\n color: tokens.grayA8,\n },\n \":disabled\": {\n cursor: \"not-allowed\",\n },\n },\n resizeNone: {\n resize: \"none\",\n },\n resizeVertical: {\n resize: \"vertical\",\n },\n resizeHorizontal: {\n resize: \"horizontal\",\n },\n addon: {\n ...boxModel,\n color: tokens.grayA11,\n display: \"flex\",\n height: \"auto\",\n cursor: \"text\",\n whiteSpace: \"nowrap\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightNormal,\n userSelect: \"none\",\n },\n addonStart: {\n order: -1,\n },\n addonEnd: {\n order: 1,\n },\n})\n\n// fieldVariants helper for v1 API compatibility\nexport const fieldVariants = ({\n variant = \"default\",\n}: { variant?: FieldVariant } = {}) => {\n return variant\n}\n\nexport type FieldProps = Omit<React.ComponentProps<\"div\">, \"className\"> & {\n className?: string\n variant?: FieldVariant\n}\n\nexport const Field = React.forwardRef<HTMLDivElement, FieldProps>(\n function Field(\n {\n className,\n variant = \"default\",\n children,\n onFocusCapture,\n onBlurCapture,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const inputRef = React.useRef<FieldInputRef>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n\n const handleFocusCapture: React.ComponentProps<\"div\">[\"onFocusCapture\"] = (\n event\n ) => {\n setIsFocused(true)\n onFocusCapture?.(event)\n }\n\n const handleBlurCapture: React.ComponentProps<\"div\">[\"onBlurCapture\"] = (\n event\n ) => {\n setIsFocused(false)\n onBlurCapture?.(event)\n }\n\n const variantStyle =\n variant === \"highlight\"\n ? styles.rootHighlight\n : variant === \"readonly\"\n ? styles.rootReadonly\n : variant === \"destructive\"\n ? styles.rootDestructive\n : styles.rootDefault\n\n return (\n <FieldContext.Provider value={{ inputRef }}>\n <FieldRootBase\n ref={ref}\n role=\"group\"\n data-slot=\"field\"\n {...{ [SLOT_ATTR]: \"field\" }}\n data-focused={isFocused ? \"true\" : \"false\"}\n className={mergeClasses(styles.root, variantStyle, className)}\n onFocusCapture={handleFocusCapture}\n onBlurCapture={handleBlurCapture}\n {...props}\n >\n {children}\n </FieldRootBase>\n </FieldContext.Provider>\n )\n }\n)\n\nexport type FieldSetProps = React.ComponentProps<\"fieldset\">\n\nexport const FieldSet = React.forwardRef<HTMLFieldSetElement, FieldSetProps>(\n function FieldSet({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <fieldset\n ref={ref}\n data-slot=\"field-set\"\n {...{ [SLOT_ATTR]: \"field-set\" }}\n className={mergeClasses(styles.fieldSet, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldGroupProps = React.ComponentProps<\"div\"> & {\n direction?: \"column\" | \"row\"\n}\n\nexport const FieldGroup = React.forwardRef<HTMLDivElement, FieldGroupProps>(\n function FieldGroup({ className, direction = \"column\", ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-group\"\n {...{ [SLOT_ATTR]: \"field-group\" }}\n className={mergeClasses(\n styles.fieldGroup,\n direction === \"row\" ? styles.fieldGroupRow : styles.fieldGroupColumn,\n className\n )}\n {...props}\n />\n )\n }\n)\n\nexport type FieldContentProps = React.ComponentProps<\"div\">\n\nexport const FieldContent = React.forwardRef<HTMLDivElement, FieldContentProps>(\n function FieldContent({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-content\"\n {...{ [SLOT_ATTR]: \"field-content\" }}\n className={mergeClasses(styles.fieldContent, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldLabelProps = Omit<\n React.ComponentProps<\"label\">,\n \"className\"\n> & {\n className?: string\n}\n\nexport const FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <FieldLabelBase\n ref={ref}\n data-slot=\"field-label\"\n {...{ [SLOT_ATTR]: \"field-label\" }}\n className={mergeClasses(styles.label, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldLabelContentProps = React.ComponentProps<\"div\"> & {\n showOnHover?: boolean\n}\n\nexport const FieldLabelContent = React.forwardRef<\n HTMLDivElement,\n FieldLabelContentProps\n>(function FieldLabelContent({ className, showOnHover = true, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-label-content\"\n {...{ [SLOT_ATTR]: \"field-label-content\" }}\n className={mergeClasses(\n styles.labelContent,\n showOnHover && styles.labelContentHover,\n className\n )}\n {...props}\n />\n )\n})\n\nexport type FieldDescriptionVariant = \"default\" | \"helper\"\n\nexport const fieldDescriptionVariants = ({\n variant = \"default\",\n}: { variant?: FieldDescriptionVariant } = {}) => {\n return variant\n}\n\nexport type FieldDescriptionProps = Omit<\n React.ComponentProps<\"p\">,\n \"className\"\n> & {\n className?: string\n variant?: FieldDescriptionVariant\n}\n\nexport const FieldDescription = React.forwardRef<\n HTMLParagraphElement,\n FieldDescriptionProps\n>(function FieldDescription({ className, variant = \"default\", ...props }, ref) {\n const styles = useStyles()\n\n const variantStyle =\n variant === \"helper\" ? styles.descriptionHelper : styles.descriptionDefault\n\n return (\n <FieldDescriptionBase\n ref={ref}\n data-slot=\"field-description\"\n {...{ [SLOT_ATTR]: \"field-description\" }}\n className={mergeClasses(styles.description, variantStyle, className)}\n {...props}\n />\n )\n})\n\nexport type FieldErrorProps = Omit<React.ComponentProps<\"div\">, \"className\"> & {\n className?: string\n errors?: Array<{ message?: string } | undefined>\n}\n\nexport const FieldError = React.forwardRef<HTMLDivElement, FieldErrorProps>(\n function FieldError({ className, children, errors, ...props }, ref) {\n const styles = useStyles()\n\n const content = React.useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ]\n\n if (uniqueErrors.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className={styles.errorList}>\n {uniqueErrors.map(\n (error, index) =>\n error?.message && (\n <li className={styles.errorListItem} key={index}>\n {error.message}\n </li>\n )\n )}\n </ul>\n )\n }, [children, errors, styles.errorList, styles.errorListItem])\n\n if (!content) {\n return null\n }\n\n return (\n <FieldErrorBase\n ref={ref}\n role=\"alert\"\n data-slot=\"field-error\"\n {...{ [SLOT_ATTR]: \"field-error\" }}\n className={mergeClasses(styles.error, className)}\n {...props}\n >\n {content}\n </FieldErrorBase>\n )\n }\n)\n\nexport type FieldInputProps = Omit<\n React.ComponentProps<\"input\">,\n \"className\"\n> & {\n className?: string\n}\n\nexport const FieldInput = React.forwardRef<HTMLInputElement, FieldInputProps>(\n function FieldInput({ className, ...props }, forwardedRef) {\n const styles = useStyles()\n const { inputRef } = useFieldContext()\n\n return (\n <FieldControlBase\n ref={(el: HTMLElement | null) => {\n inputRef.current = el as HTMLInputElement | null\n if (typeof forwardedRef === \"function\") {\n forwardedRef(el as HTMLInputElement)\n } else if (forwardedRef) {\n forwardedRef.current = el as HTMLInputElement | null\n }\n }}\n data-readonly={props.readOnly}\n data-slot=\"field-input\"\n {...{ [SLOT_ATTR]: \"field-input\" }}\n className={mergeClasses(styles.input, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldInputGroupProps = React.ComponentProps<\"div\">\n\nexport const FieldInputGroup = React.forwardRef<\n HTMLDivElement,\n FieldInputGroupProps\n>(function FieldInputGroup({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-input-group\"\n {...{ [SLOT_ATTR]: \"field-input-group\" }}\n className={mergeClasses(styles.inputGroup, className)}\n {...props}\n />\n )\n})\n\nexport type FieldTextareaResize = \"none\" | \"vertical\" | \"horizontal\"\n\nexport type FieldTextareaProps = React.ComponentProps<\"textarea\"> & {\n resize?: FieldTextareaResize\n}\n\nexport const FieldTextarea = React.forwardRef<\n HTMLTextAreaElement,\n FieldTextareaProps\n>(function FieldTextarea(\n { className, resize = \"none\", ...props },\n forwardedRef\n) {\n const styles = useStyles()\n const { inputRef } = useFieldContext()\n\n const resizeStyle =\n resize === \"vertical\"\n ? styles.resizeVertical\n : resize === \"horizontal\"\n ? styles.resizeHorizontal\n : styles.resizeNone\n\n return (\n <textarea\n {...props}\n ref={(el: HTMLTextAreaElement | null) => {\n inputRef.current = el\n if (typeof forwardedRef === \"function\") {\n forwardedRef(el)\n } else if (forwardedRef) {\n forwardedRef.current = el\n }\n }}\n data-readonly={props.readOnly}\n data-slot=\"field-textarea\"\n {...{ [SLOT_ATTR]: \"field-textarea\" }}\n data-resize={resize}\n className={mergeClasses(styles.textarea, resizeStyle, className)}\n />\n )\n})\n\nexport type FieldGroupAddonAlign = \"start\" | \"end\"\n\nexport const inputGroupAddonVariants = ({\n align = \"start\",\n}: { align?: FieldGroupAddonAlign } = {}) => {\n return align\n}\n\nexport type FieldGroupAddonProps = React.ComponentProps<\"div\"> & {\n align?: FieldGroupAddonAlign\n}\n\nexport const FieldGroupAddon = React.forwardRef<\n HTMLDivElement,\n FieldGroupAddonProps\n>(function FieldGroupAddon({ className, align = \"start\", ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"input-group-addon\"\n {...{ [SLOT_ATTR]: \"input-group-addon\" }}\n data-align={align}\n className={mergeClasses(\n styles.addon,\n align === \"end\" ? styles.addonEnd : styles.addonStart,\n className\n )}\n {...props}\n />\n )\n})\n"],"names":["FieldRootBase","FieldLabelBase","FieldControlBase","FieldDescriptionBase","FieldErrorBase","FieldContext","React","useFieldContext","context","useOptionalFieldContext","FIELD_CONTROL_SLOTS","FIELD_LABEL_SLOTS","DISABLED_LABEL","disabledLabelRules","slot","SLOT_ATTR","condition","label","BESIDE_CONTROL","tokens.fieldPaddingY","CONTROL_ROW_SLOTS","controlRowRules","tokens.spacingElement1","useStyles","makeZenithStyles","boxModel","tokens.fieldPaddingX","shorthands","tokens.radiusLg","tokens.focusRing","tokens.errorSoft","tokens.grayA3","tokens.grayA4","tokens.accentA3","tokens.accentA4","tokens.errorA4","tokens.fieldSetGap","tokens.spacingElement2","tokens.textXs","tokens.leadingXs","tokens.grayA12","tokens.fontWeightNormal","tokens.grayA11","tokens.errorOnSoft","nativeControl","tokens.fieldInputHeight","tokens.textSm","tokens.leadingSm","tokens.grayA8","fieldVariants","variant","Field","className","children","onFocusCapture","onBlurCapture","props","ref","styles","inputRef","isFocused","setIsFocused","handleFocusCapture","event","handleBlurCapture","variantStyle","jsx","mergeClasses","FieldSet","FieldGroup","direction","FieldContent","FieldLabel","FieldLabelContent","showOnHover","fieldDescriptionVariants","FieldDescription","FieldError","errors","content","uniqueErrors","error","_a","index","FieldInput","forwardedRef","el","FieldInputGroup","FieldTextarea","resize","resizeStyle","inputGroupAddonVariants","align","FieldGroupAddon"],"mappings":";;;;;;AAcA,MAAMA,IAAgB,OAChBC,IAAiB,SACjBC,KAAmB,SACnBC,KAAuB,KACvBC,KAAiB,OAajBC,IAAeC,EAAM,cAAwC,IAAI,GAE1DC,IAAkB,MAAM;AACnC,QAAMC,IAAUF,EAAM,WAAWD,CAAY;AAC7C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,kDAAkD;AAEpE,SAAOA;AACT,GAMaC,KAA0B,MACrCH,EAAM,WAAWD,CAAY,GAKzBK,IAAsB,CAAC,eAAe,kBAAkB,gBAAgB,GAExEC,KAAoB,C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OAAOD,KAAiB,aAC1BA,EAAaC,CAAE,IACND,MACTA,EAAa,UAAUC;AAAA,MAE3B;AAAA,MACA,iBAAe9B,EAAM;AAAA,MACrB,aAAU;AAAA,MACJ,CAACzC,CAAS,GAAG;AAAA,MACnB,eAAa0E;AAAA,MACb,WAAWtB,EAAaT,EAAO,UAAUgC,GAAatC,CAAS;AAAA,IAAA;AAAA,EAAA;AAGrE,CAAC,GAIYuC,KAA0B,CAAC;AAAA,EACtC,OAAAC,IAAQ;AACV,IAAsC,OAC7BA,GAOIC,KAAkBvF,EAAM,WAGnC,SAAyB,EAAE,WAAA8C,GAAW,OAAAwC,IAAQ,SAAS,GAAGpC,EAAA,GAASC,GAAK;AACxE,QAAMC,IAASnC,EAAA;AAEf,SACE,gBAAA2C;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAAT;AAAA,MACA,MAAK;AAAA,MACL,aAAU;AAAA,MACJ,CAAC1C,CAAS,GAAG;AAAA,MACnB,cAAY6E;AAAA,MACZ,WAAWzB;AAAA,QACTT,EAAO;AAAA,QACPkC,MAAU,QAAQlC,EAAO,WAAWA,EAAO;AAAA,QAC3CN;AAAA,MAAA;AAAA,MAED,GAAGI;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
1
+ {"version":3,"file":"field.js","sources":["../../../src/components/field/field.tsx"],"sourcesContent":["import * as React from \"react\"\n\nimport { mergeClasses, shorthands } from \"@epilot/zenith-runtime/v1\"\n\nimport { SLOT_ATTR } from \"../../renderer/contract\"\nimport { makeZenithStyles } from \"../../styles/make-styles\"\nimport { boxModel, nativeControl } from \"../../styles/host-reset\"\nimport * as tokens from \"../../tokens\"\n\n/**\n * Plain elements, not a primitive. v1's Field uses no Radix primitive at all — it is a custom\n * implementation with its own context, and v2 already had the same context (`FieldContext`,\n * carrying `inputRef`).\n */\nconst FieldRootBase = \"div\" as const\nconst FieldLabelBase = \"label\" as const\nconst FieldControlBase = \"input\" as const\nconst FieldDescriptionBase = \"p\" as const\nconst FieldErrorBase = \"div\" as const\n\nexport type FieldInputRef =\n | HTMLInputElement\n | HTMLTextAreaElement\n | HTMLSelectElement\n | HTMLButtonElement\n | null\n\nexport interface FieldContextValue {\n inputRef: React.RefObject<FieldInputRef>\n}\n\nconst FieldContext = React.createContext<FieldContextValue | null>(null)\n\n/**\n * A mounted FieldLabel: `key` is fixed for the label's lifetime and holds its place in the order;\n * `id` and `htmlFor` are what it renders now.\n */\ntype FieldLabelEntry = {\n key: string\n id: string\n htmlFor: string | undefined\n}\n\n/**\n * Which label names the Field's control, kept as Field state: the mounted FieldLabels in the order\n * they first mounted, and the control's id as the control reports it.\n */\nconst FieldNamingContext = React.createContext<{\n labels: readonly FieldLabelEntry[]\n controlId: string | undefined\n /** Adds the label at the end on its first call, then updates its entry in place. */\n setLabel: (entry: FieldLabelEntry) => void\n removeLabel: (key: string) => void\n setControlId: (id: string | undefined) => void\n} | null>(null)\n\n/**\n * @internal plumbing for parts the Field's label names besides its control: FieldComboboxList takes\n * it as its `aria-labelledby`. It is the label that names the control, the first FieldLabel whose\n * `htmlFor` is the control's id, else the first FieldLabel mounted; undefined outside a Field or\n * without one.\n */\nexport const useFieldLabelId = (): string | undefined => {\n const naming = React.useContext(FieldNamingContext)\n if (!naming?.labels.length) return undefined\n const { labels, controlId } = naming\n const named = controlId\n ? labels.find((label) => label.htmlFor === controlId)\n : undefined\n return (named ?? labels[0]).id\n}\n\n/**\n * @internal the control reports its id to its Field, so the label naming it follows an id that\n * changes. FieldComboboxTrigger calls it; outside a Field it does nothing.\n */\nexport const useReportFieldControlId = (id: string | undefined): void => {\n const setControlId = React.useContext(FieldNamingContext)?.setControlId\n useIsomorphicLayoutEffect(() => {\n if (!setControlId) return\n setControlId(id)\n return () => setControlId(undefined)\n }, [setControlId, id])\n}\n\nconst useIsomorphicLayoutEffect =\n typeof window === \"undefined\" ? React.useEffect : React.useLayoutEffect\n\nexport const useFieldContext = () => {\n const context = React.useContext(FieldContext)\n if (!context) {\n throw new Error(\"FieldInput must be used within a Field component\")\n }\n return context\n}\n\n/**\n * Field context when there is one, `null` otherwise — for parts that work both inside and outside\n * a Field.\n */\nexport const useOptionalFieldContext = (): FieldContextValue | null =>\n React.useContext(FieldContext)\n\nexport type FieldVariant = \"default\" | \"highlight\" | \"readonly\" | \"destructive\"\n\n/** The controls a Field wraps; their `:disabled` is what makes the field disabled. */\nconst FIELD_CONTROL_SLOTS = [\"field-input\", \"field-textarea\", \"select-trigger\"]\n/** FieldLabel, and the standalone Label when a caller uses it inside a Field. */\nconst FIELD_LABEL_SLOTS = [\"field-label\", \"label\"]\nconst DISABLED_LABEL = { cursor: \"not-allowed\", opacity: 0.5 }\n\n/**\n * One rule per (disabled condition, label slot). Each `:has()` names a single control rather than\n * any `:disabled` descendant, so an unrelated disabled button beside an enabled control (a clear\n * button with nothing to clear) does not dim the label. One key per selector: no comma lists.\n */\nconst disabledLabelRules = () =>\n Object.fromEntries(\n [\n \"&[data-disabled]\",\n ...FIELD_CONTROL_SLOTS.map(\n (slot) => `&:has([${SLOT_ATTR}=\"${slot}\"]:disabled)`\n ),\n ].flatMap((condition) =>\n FIELD_LABEL_SLOTS.map((label) => [\n `${condition} [${SLOT_ATTR}=\"${label}\"]`,\n DISABLED_LABEL,\n ])\n )\n )\n\n/**\n * Password managers (1Password, NordPass) inject a button next to the control, sometimes inline. In\n * a column the injection became a new row and the field grew (#5). It is placed in a second column\n * beside the control instead, centred on the control's row, with negative block margins as deep as\n * the field's padding so a button taller than the control does not stretch the row either.\n * Recognised as an element directly after a control that is not one of Zenith's own parts.\n */\nconst BESIDE_CONTROL = {\n alignSelf: \"center\",\n marginTop: `calc(-1 * ${tokens.fieldPaddingY})`,\n marginBottom: `calc(-1 * ${tokens.fieldPaddingY})`,\n}\n\n/** The parts that sit in the control's row: the controls, or a group holding one. */\nconst CONTROL_ROW_SLOTS = [...FIELD_CONTROL_SLOTS, \"field-input-group\"]\n\n/** Every part spans both columns, as it stacked before; a control takes the first column. */\nconst controlRowRules = () =>\n Object.fromEntries([\n [\"& > *\", { gridColumnStart: 1, gridColumnEnd: -1 }],\n ...CONTROL_ROW_SLOTS.flatMap((slot) => [\n [\n `& > [${SLOT_ATTR}=\"${slot}\"]`,\n { gridColumnStart: 1, gridColumnEnd: 2 },\n ],\n [\n `& > [${SLOT_ATTR}=\"${slot}\"] + :not([${SLOT_ATTR}])`,\n {\n gridColumnStart: 2,\n gridColumnEnd: 3,\n marginLeft: tokens.spacingElement1,\n ...BESIDE_CONTROL,\n },\n ],\n ]),\n ])\n\nconst useStyles = makeZenithStyles({\n root: {\n ...boxModel,\n position: \"relative\",\n // A grid, not a column, so an injected button can sit beside the control (see BESIDE_CONTROL).\n // The second column is empty and zero-wide unless something is injected.\n display: \"grid\",\n gridTemplateColumns: \"minmax(0, 1fr) auto\",\n width: \"100%\",\n // Density-bound (DENSITY-SPEC.md §2.3, WP9B1-ACCEPTANCE-WP9B2A): normal resolves to the same\n // spacingElement2/spacingElement3 values this used before binding — `spacingGroup1` (0.5rem)\n // is a half-step short of the 0.75rem v1 actually uses, which three components got wrong by\n // reaching for it directly; that pitfall is why fieldPaddingX's normal tier aliases\n // spacingElement3, not spacingGroup1 (packages/tokens/spec/density.yaml).\n paddingTop: tokens.fieldPaddingY,\n paddingBottom: tokens.fieldPaddingY,\n paddingLeft: tokens.fieldPaddingX,\n paddingRight: tokens.fieldPaddingX,\n // Row gap only: a column gap would narrow the control even while the second column is empty.\n rowGap: tokens.spacingElement1,\n ...shorthands.borderRadius(tokens.radiusLg),\n transitionProperty: \"all\",\n transitionDuration: \"75ms\",\n outlineOffset: \"2px\",\n outlineWidth: \"2px\",\n outlineStyle: \"none\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n \"&[data-focused='true'], &[data-focus-visible]\": {\n outlineStyle: \"solid\",\n outlineColor: tokens.focusRing,\n },\n \"&[data-invalid]\": {\n backgroundColor: tokens.errorSoft,\n },\n\n // Label's disabled styling, declared here because Field owns the elements these selectors are\n // rooted at. On Label they were written as \"[data-disabled] &\", \":disabled ~ &\" and\n // \"[data-disabled] ~ &\"; Griffel does not substitute `&` in that position and emits\n // `.hash<selector> .hash`, which never matches, so a label in a disabled field never dimmed.\n // See src/ancestor-selector.test.ts. The port of those rules still missed: they named the\n // `label` slot while FieldLabel emits `field-label`, and the `~` forms needed the label AFTER\n // the control, but it comes first. `:has()` reaches the control wherever it sits.\n ...disabledLabelRules(),\n ...controlRowRules(),\n },\n rootDefault: {\n backgroundColor: tokens.grayA3,\n \":hover\": {\n backgroundColor: tokens.grayA4,\n },\n },\n rootHighlight: {\n backgroundColor: tokens.accentA3,\n \":hover\": {\n backgroundColor: tokens.accentA4,\n },\n },\n rootReadonly: {\n backgroundColor: tokens.grayA3,\n },\n rootDestructive: {\n backgroundColor: tokens.errorSoft,\n \":hover\": {\n backgroundColor: tokens.errorA4,\n },\n },\n fieldSet: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n // Density-bound (DENSITY-SPEC.md §2.3): normal resolves to the same spacingLayout2 (32px)\n // this used before binding.\n ...shorthands.gap(tokens.fieldSetGap),\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n ...shorthands.margin(0),\n },\n fieldGroup: {\n ...boxModel,\n display: \"flex\",\n width: \"100%\",\n ...shorthands.gap(tokens.spacingElement2),\n },\n fieldGroupColumn: {\n flexDirection: \"column\",\n },\n fieldGroupRow: {\n flexDirection: \"row\",\n },\n fieldContent: {\n display: \"flex\",\n flexGrow: 1,\n flexShrink: 1,\n flexBasis: \"0%\",\n flexDirection: \"column\",\n ...shorthands.gap(tokens.spacingElement2),\n lineHeight: \"1.375\",\n },\n label: {\n ...boxModel,\n minHeight: \"1rem\",\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n // No width: the label stretches across the field's column, so the whole label row is a hit\n // area for the control rather than only the text. Field reads as one box and is aimed at as one.\n display: \"flex\",\n ...shorthands.gap(tokens.spacingElement2),\n cursor: \"default\",\n color: tokens.grayA12,\n \"&[data-disabled]\": {\n opacity: 0.5,\n },\n },\n labelContent: {\n display: \"inline-flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement1),\n transitionProperty: \"opacity\",\n transitionDuration: \"150ms\",\n \"@media (prefers-reduced-motion: reduce)\": {\n transitionDuration: \"0.01ms\",\n },\n },\n labelContentHover: {\n ...boxModel,\n width: 0,\n height: 0,\n overflowX: \"visible\",\n overflowY: \"visible\",\n opacity: 0,\n pointerEvents: \"none\",\n },\n description: {\n fontSize: tokens.textXs,\n lineHeight: \"1.5\",\n fontWeight: tokens.fontWeightNormal,\n ...shorthands.margin(0),\n \"& a\": {\n textDecorationLine: \"underline\",\n textUnderlineOffset: \"4px\",\n },\n },\n descriptionDefault: {\n color: tokens.grayA12,\n },\n descriptionHelper: {\n color: tokens.grayA11,\n },\n error: {\n color: tokens.errorOnSoft,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightNormal,\n },\n errorList: {\n ...boxModel,\n display: \"flex\",\n flexDirection: \"column\",\n ...shorthands.margin(0),\n paddingLeft: \"1.25rem\",\n listStyleType: \"disc\",\n },\n errorListItem: {\n color: tokens.errorOnSoft,\n fontSize: tokens.textXs,\n lineHeight: tokens.leadingXs,\n fontWeight: tokens.fontWeightNormal,\n marginTop: \"0.25rem\",\n marginBottom: \"0.25rem\",\n },\n input: {\n ...nativeControl,\n width: \"100%\",\n // Density-bound (DENSITY-SPEC.md §2.3): normal resolves to the same \"1.5rem\" this used before\n // binding. FieldComboboxInput (field-combobox.tsx) has its OWN separate makeZenithStyles call\n // and its own unrelated \"input\" key (width: \"100%\" only, no height) — this binding does not\n // reach it; review corrected an earlier claim that it did.\n height: tokens.fieldInputHeight,\n outlineStyle: \"none\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA12,\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n \"::placeholder\": {\n color: tokens.grayA8,\n },\n \":disabled\": {\n cursor: \"not-allowed\",\n },\n },\n inputGroup: {\n ...boxModel,\n display: \"flex\",\n alignItems: \"center\",\n ...shorthands.gap(tokens.spacingElement1),\n width: \"100%\",\n // Already a row, so an injected button lands beside the input; it must not stretch the row.\n [`& > [${SLOT_ATTR}=\"field-input\"] + :not([${SLOT_ATTR}])`]: BESIDE_CONTROL,\n },\n textarea: {\n ...nativeControl,\n width: \"100%\",\n outlineStyle: \"none\",\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n color: tokens.grayA12,\n backgroundColor: \"transparent\",\n ...shorthands.border(\"0\"),\n ...shorthands.padding(0),\n \"::placeholder\": {\n color: tokens.grayA8,\n },\n \":disabled\": {\n cursor: \"not-allowed\",\n },\n },\n resizeNone: {\n resize: \"none\",\n },\n resizeVertical: {\n resize: \"vertical\",\n },\n resizeHorizontal: {\n resize: \"horizontal\",\n },\n addon: {\n ...boxModel,\n color: tokens.grayA11,\n display: \"flex\",\n height: \"auto\",\n cursor: \"text\",\n whiteSpace: \"nowrap\",\n alignItems: \"center\",\n justifyContent: \"center\",\n ...shorthands.gap(tokens.spacingElement2),\n fontSize: tokens.textSm,\n lineHeight: tokens.leadingSm,\n fontWeight: tokens.fontWeightNormal,\n userSelect: \"none\",\n },\n addonStart: {\n order: -1,\n },\n addonEnd: {\n order: 1,\n },\n})\n\n// fieldVariants helper for v1 API compatibility\nexport const fieldVariants = ({\n variant = \"default\",\n}: { variant?: FieldVariant } = {}) => {\n return variant\n}\n\nexport type FieldProps = Omit<React.ComponentProps<\"div\">, \"className\"> & {\n className?: string\n variant?: FieldVariant\n}\n\nexport const Field = React.forwardRef<HTMLDivElement, FieldProps>(\n function Field(\n {\n className,\n variant = \"default\",\n children,\n onFocusCapture,\n onBlurCapture,\n ...props\n },\n ref\n ) {\n const styles = useStyles()\n const inputRef = React.useRef<FieldInputRef>(null)\n const [isFocused, setIsFocused] = React.useState(false)\n const [labels, setLabels] = React.useState<readonly FieldLabelEntry[]>([])\n const [controlId, setControlId] = React.useState<string>()\n const setLabel = React.useCallback((entry: FieldLabelEntry) => {\n setLabels((current) => {\n const at = current.findIndex((label) => label.key === entry.key)\n if (at === -1) return [...current, entry]\n const { id, htmlFor } = current[at]\n if (id === entry.id && htmlFor === entry.htmlFor) return current\n const next = current.slice()\n next[at] = entry\n return next\n })\n }, [])\n const removeLabel = React.useCallback((key: string) => {\n setLabels((current) => current.filter((label) => label.key !== key))\n }, [])\n const naming = React.useMemo(\n () => ({ labels, controlId, setLabel, removeLabel, setControlId }),\n [labels, controlId, setLabel, removeLabel]\n )\n\n const handleFocusCapture: React.ComponentProps<\"div\">[\"onFocusCapture\"] = (\n event\n ) => {\n setIsFocused(true)\n onFocusCapture?.(event)\n }\n\n const handleBlurCapture: React.ComponentProps<\"div\">[\"onBlurCapture\"] = (\n event\n ) => {\n setIsFocused(false)\n onBlurCapture?.(event)\n }\n\n const variantStyle =\n variant === \"highlight\"\n ? styles.rootHighlight\n : variant === \"readonly\"\n ? styles.rootReadonly\n : variant === \"destructive\"\n ? styles.rootDestructive\n : styles.rootDefault\n\n return (\n <FieldContext.Provider value={{ inputRef }}>\n <FieldNamingContext.Provider value={naming}>\n <FieldRootBase\n ref={ref}\n role=\"group\"\n data-slot=\"field\"\n {...{ [SLOT_ATTR]: \"field\" }}\n data-focused={isFocused ? \"true\" : \"false\"}\n className={mergeClasses(styles.root, variantStyle, className)}\n onFocusCapture={handleFocusCapture}\n onBlurCapture={handleBlurCapture}\n {...props}\n >\n {children}\n </FieldRootBase>\n </FieldNamingContext.Provider>\n </FieldContext.Provider>\n )\n }\n)\n\nexport type FieldSetProps = React.ComponentProps<\"fieldset\">\n\nexport const FieldSet = React.forwardRef<HTMLFieldSetElement, FieldSetProps>(\n function FieldSet({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <fieldset\n ref={ref}\n data-slot=\"field-set\"\n {...{ [SLOT_ATTR]: \"field-set\" }}\n className={mergeClasses(styles.fieldSet, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldGroupProps = React.ComponentProps<\"div\"> & {\n direction?: \"column\" | \"row\"\n}\n\nexport const FieldGroup = React.forwardRef<HTMLDivElement, FieldGroupProps>(\n function FieldGroup({ className, direction = \"column\", ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-group\"\n {...{ [SLOT_ATTR]: \"field-group\" }}\n className={mergeClasses(\n styles.fieldGroup,\n direction === \"row\" ? styles.fieldGroupRow : styles.fieldGroupColumn,\n className\n )}\n {...props}\n />\n )\n }\n)\n\nexport type FieldContentProps = React.ComponentProps<\"div\">\n\nexport const FieldContent = React.forwardRef<HTMLDivElement, FieldContentProps>(\n function FieldContent({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-content\"\n {...{ [SLOT_ATTR]: \"field-content\" }}\n className={mergeClasses(styles.fieldContent, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldLabelProps = Omit<\n React.ComponentProps<\"label\">,\n \"className\"\n> & {\n className?: string\n}\n\nexport const FieldLabel = React.forwardRef<HTMLLabelElement, FieldLabelProps>(\n function FieldLabel({ className, id: idProp, ...props }, ref) {\n const styles = useStyles()\n const generatedId = React.useId()\n const field = React.useContext(FieldNamingContext)\n // Inside a Field the label has an id, so a part it names besides the control can point at it.\n const id = idProp ?? (field ? generatedId : undefined)\n const setLabel = field?.setLabel\n const removeLabel = field?.removeLabel\n const htmlFor = props.htmlFor\n\n // The label takes its place in the Field's order when it first mounts (keyed by its own\n // generated id, which never changes) and keeps it while its `id` or `htmlFor` changes.\n useIsomorphicLayoutEffect(() => {\n if (setLabel && id) setLabel({ key: generatedId, id, htmlFor })\n }, [setLabel, generatedId, id, htmlFor])\n // Leaves only on unmount, removing its own entry and no other.\n useIsomorphicLayoutEffect(() => {\n if (!removeLabel) return\n return () => removeLabel(generatedId)\n }, [removeLabel, generatedId])\n\n return (\n <FieldLabelBase\n ref={ref}\n id={id}\n data-slot=\"field-label\"\n {...{ [SLOT_ATTR]: \"field-label\" }}\n className={mergeClasses(styles.label, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldLabelContentProps = React.ComponentProps<\"div\"> & {\n showOnHover?: boolean\n}\n\nexport const FieldLabelContent = React.forwardRef<\n HTMLDivElement,\n FieldLabelContentProps\n>(function FieldLabelContent({ className, showOnHover = true, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-label-content\"\n {...{ [SLOT_ATTR]: \"field-label-content\" }}\n className={mergeClasses(\n styles.labelContent,\n showOnHover && styles.labelContentHover,\n className\n )}\n {...props}\n />\n )\n})\n\nexport type FieldDescriptionVariant = \"default\" | \"helper\"\n\nexport const fieldDescriptionVariants = ({\n variant = \"default\",\n}: { variant?: FieldDescriptionVariant } = {}) => {\n return variant\n}\n\nexport type FieldDescriptionProps = Omit<\n React.ComponentProps<\"p\">,\n \"className\"\n> & {\n className?: string\n variant?: FieldDescriptionVariant\n}\n\nexport const FieldDescription = React.forwardRef<\n HTMLParagraphElement,\n FieldDescriptionProps\n>(function FieldDescription({ className, variant = \"default\", ...props }, ref) {\n const styles = useStyles()\n\n const variantStyle =\n variant === \"helper\" ? styles.descriptionHelper : styles.descriptionDefault\n\n return (\n <FieldDescriptionBase\n ref={ref}\n data-slot=\"field-description\"\n {...{ [SLOT_ATTR]: \"field-description\" }}\n className={mergeClasses(styles.description, variantStyle, className)}\n {...props}\n />\n )\n})\n\nexport type FieldErrorProps = Omit<React.ComponentProps<\"div\">, \"className\"> & {\n className?: string\n errors?: Array<{ message?: string } | undefined>\n}\n\nexport const FieldError = React.forwardRef<HTMLDivElement, FieldErrorProps>(\n function FieldError({ className, children, errors, ...props }, ref) {\n const styles = useStyles()\n\n const content = React.useMemo(() => {\n if (children) {\n return children\n }\n\n if (!errors?.length) {\n return null\n }\n\n const uniqueErrors = [\n ...new Map(errors.map((error) => [error?.message, error])).values(),\n ]\n\n if (uniqueErrors.length === 1) {\n return uniqueErrors[0]?.message\n }\n\n return (\n <ul className={styles.errorList}>\n {uniqueErrors.map(\n (error, index) =>\n error?.message && (\n <li className={styles.errorListItem} key={index}>\n {error.message}\n </li>\n )\n )}\n </ul>\n )\n }, [children, errors, styles.errorList, styles.errorListItem])\n\n if (!content) {\n return null\n }\n\n return (\n <FieldErrorBase\n ref={ref}\n role=\"alert\"\n data-slot=\"field-error\"\n {...{ [SLOT_ATTR]: \"field-error\" }}\n className={mergeClasses(styles.error, className)}\n {...props}\n >\n {content}\n </FieldErrorBase>\n )\n }\n)\n\nexport type FieldInputProps = Omit<\n React.ComponentProps<\"input\">,\n \"className\"\n> & {\n className?: string\n}\n\nexport const FieldInput = React.forwardRef<HTMLInputElement, FieldInputProps>(\n function FieldInput({ className, ...props }, forwardedRef) {\n const styles = useStyles()\n const { inputRef } = useFieldContext()\n\n return (\n <FieldControlBase\n ref={(el: HTMLElement | null) => {\n inputRef.current = el as HTMLInputElement | null\n if (typeof forwardedRef === \"function\") {\n forwardedRef(el as HTMLInputElement)\n } else if (forwardedRef) {\n forwardedRef.current = el as HTMLInputElement | null\n }\n }}\n data-readonly={props.readOnly}\n data-slot=\"field-input\"\n {...{ [SLOT_ATTR]: \"field-input\" }}\n className={mergeClasses(styles.input, className)}\n {...props}\n />\n )\n }\n)\n\nexport type FieldInputGroupProps = React.ComponentProps<\"div\">\n\nexport const FieldInputGroup = React.forwardRef<\n HTMLDivElement,\n FieldInputGroupProps\n>(function FieldInputGroup({ className, ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n data-slot=\"field-input-group\"\n {...{ [SLOT_ATTR]: \"field-input-group\" }}\n className={mergeClasses(styles.inputGroup, className)}\n {...props}\n />\n )\n})\n\nexport type FieldTextareaResize = \"none\" | \"vertical\" | \"horizontal\"\n\nexport type FieldTextareaProps = React.ComponentProps<\"textarea\"> & {\n resize?: FieldTextareaResize\n}\n\nexport const FieldTextarea = React.forwardRef<\n HTMLTextAreaElement,\n FieldTextareaProps\n>(function FieldTextarea(\n { className, resize = \"none\", ...props },\n forwardedRef\n) {\n const styles = useStyles()\n const { inputRef } = useFieldContext()\n\n const resizeStyle =\n resize === \"vertical\"\n ? styles.resizeVertical\n : resize === \"horizontal\"\n ? styles.resizeHorizontal\n : styles.resizeNone\n\n return (\n <textarea\n {...props}\n ref={(el: HTMLTextAreaElement | null) => {\n inputRef.current = el\n if (typeof forwardedRef === \"function\") {\n forwardedRef(el)\n } else if (forwardedRef) {\n forwardedRef.current = el\n }\n }}\n data-readonly={props.readOnly}\n data-slot=\"field-textarea\"\n {...{ [SLOT_ATTR]: \"field-textarea\" }}\n data-resize={resize}\n className={mergeClasses(styles.textarea, resizeStyle, className)}\n />\n )\n})\n\nexport type FieldGroupAddonAlign = \"start\" | \"end\"\n\nexport const inputGroupAddonVariants = ({\n align = \"start\",\n}: { align?: FieldGroupAddonAlign } = {}) => {\n return align\n}\n\nexport type FieldGroupAddonProps = React.ComponentProps<\"div\"> & {\n align?: FieldGroupAddonAlign\n}\n\nexport const FieldGroupAddon = React.forwardRef<\n HTMLDivElement,\n FieldGroupAddonProps\n>(function FieldGroupAddon({ className, align = \"start\", ...props }, ref) {\n const styles = useStyles()\n\n return (\n <div\n ref={ref}\n role=\"group\"\n data-slot=\"input-group-addon\"\n {...{ [SLOT_ATTR]: \"input-group-addon\" }}\n data-align={align}\n className={mergeClasses(\n styles.addon,\n align === \"end\" ? styles.addonEnd : styles.addonStart,\n className\n )}\n {...props}\n />\n )\n})\n"],"names":["FieldRootBase","FieldLabelBase","FieldControlBase","FieldDescriptionBase","FieldErrorBase","FieldContext","React","FieldNamingContext","useFieldLabelId","naming","labels","controlId","label","useReportFieldControlId","id","setControlId","_a","useIsomorphicLayoutEffect","useFieldContext","context","useOptionalFieldContext","FIELD_CONTROL_SLOTS","FIELD_LABEL_SLOTS","DISABLED_LABEL","disabledLabelRules","slot","SLOT_ATTR","condition","BESIDE_CONTROL","tokens.fieldPaddingY","CONTROL_ROW_SLOTS","controlRowRules","tokens.spacingElement1","useStyles","makeZenithStyles","boxModel","tokens.fieldPaddingX","shorthands","tokens.radiusLg","tokens.focusRing","tokens.errorSoft","tokens.grayA3","tokens.grayA4","tokens.accentA3","tokens.accentA4","tokens.errorA4","tokens.fieldSetGap","tokens.spacingElement2","tokens.textXs","tokens.leadingXs","tokens.grayA12","tokens.fontWeightNormal","tokens.grayA11","tokens.errorOnSoft","nativeControl","tokens.fieldInputHeight","tokens.textSm","tokens.leadingSm","tokens.grayA8","fieldVariants","variant","Field","className","children","onFocusCapture","onBlurCapture","props","ref","styles","inputRef","isFocused","setIsFocused","setLabels","setLabel","entry","current","at","htmlFor","next","removeLabel","key","handleFocusCapture","event","handleBlurCapture","variantStyle","jsx","mergeClasses","FieldSet","FieldGroup","direction","FieldContent","FieldLabel","idProp","generatedId","field","FieldLabelContent","showOnHover","fieldDescriptionVariants","FieldDescription","FieldError","errors","content","uniqueErrors","error","index","FieldInput","forwardedRef","el","FieldInputGroup","FieldTextarea","resize","resizeStyle","inputGroupAddonVariants","align","FieldGroupAddon"],"mappings":";;;;;;AAcA,MAAMA,KAAgB,OAChBC,KAAiB,SACjBC,KAAmB,SACnBC,KAAuB,KACvBC,KAAiB,OAajBC,IAAeC,EAAM,cAAwC,IAAI,GAgBjEC,IAAqBD,EAAM,cAOvB,IAAI,GAQDE,KAAkB,MAA0B;AACvD,QAAMC,IAASH,EAAM,WAAWC,CAAkB;AAClD,MAAI,EAACE,KAAA,QAAAA,EAAQ,OAAO,QAAQ;AAC5B,QAAM,EAAE,QAAAC,GAAQ,WAAAC,EAAA,IAAcF;AAI9B,WAHcE,IACVD,EAAO,KAAK,CAACE,MAAUA,EAAM,YAAYD,CAAS,IAClD,WACaD,EAAO,CAAC,GAAG;AAC9B,GAMaG,KAA0B,CAACC,MAAiC;;AACvE,QAAMC,KAAeC,IAAAV,EAAM,WAAWC,CAAkB,MAAnC,gBAAAS,EAAsC;AAC3D,EAAAC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L,aAAU;AAAA,MACJ,CAACzC,CAAS,GAAG;AAAA,MACnB,cAAYuF;AAAA,MACZ,WAAW3B;AAAA,QACTlB,EAAO;AAAA,QACP6C,MAAU,QAAQ7C,EAAO,WAAWA,EAAO;AAAA,QAC3CN;AAAA,MAAA;AAAA,MAED,GAAGI;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;"}
@@ -1,95 +1,109 @@
1
- import { jsx as s, jsxs as N } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { useSensors as A, useSensor as D, DndContext as R, closestCenter as j, DragOverlay as G, KeyboardSensor as K, PointerSensor as P } from "../../vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js";
4
- import { SortableContext as V, verticalListSortingStrategy as k, useSortable as q, arrayMove as B, sortableKeyboardCoordinates as M } from "../../vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js";
5
- import { useListStyles as _, ListItem as z, listContext as F, ListRoot as H, ListItemBody as L, canonicalDomDensity as J } from "./list.js";
6
- const Q = o.forwardRef(
7
- function(n, f) {
8
- const i = o.useId();
9
- process.env.NODE_ENV !== "production" && n.value === void 0 && console.warn(
1
+ import { jsx as r, jsxs as B } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { useSensors as F, useSensor as O, DndContext as P, closestCenter as j, DragOverlay as G, KeyboardSensor as K, PointerSensor as T } from "../../vendor/.bun/@dnd-kit_core@6.3.1_6f4b9a1cfb20c0ae/vendor/@dnd-kit/core/dist/core.esm.js";
4
+ import { SortableContext as _, verticalListSortingStrategy as k, useSortable as q, arrayMove as H, sortableKeyboardCoordinates as M } from "../../vendor/.bun/@dnd-kit_sortable@10.0.0_1d291640e1250bbe/vendor/@dnd-kit/sortable/dist/sortable.esm.js";
5
+ import { useListStyles as z, ListItem as J, listContext as Q, ListRoot as U, ListItemBody as C, canonicalDomDensity as W } from "./list.js";
6
+ const X = i.forwardRef(
7
+ function(e, a) {
8
+ const s = i.useId();
9
+ process.env.NODE_ENV !== "production" && e.value === void 0 && console.warn(
10
10
  "SortableList: a `ListItem` is missing a `value`. Give each item a unique `value` so it can be reordered — items without one are excluded from `onReorder`."
11
11
  );
12
12
  const {
13
- attributes: r,
14
- listeners: a,
15
- setNodeRef: I,
16
- setActivatorNodeRef: p,
17
- isDragging: l,
18
- isOver: d,
19
- activeIndex: c,
20
- overIndex: u
13
+ attributes: d,
14
+ listeners: u,
15
+ setNodeRef: y,
16
+ setActivatorNodeRef: g,
17
+ isDragging: v,
18
+ isOver: f,
19
+ activeIndex: m,
20
+ overIndex: n
21
21
  } = q({
22
- id: n.value ?? i,
22
+ id: e.value ?? s,
23
23
  animateLayoutChanges: () => !1
24
- }), e = d && !l && c !== -1 ? c < u ? "bottom" : "top" : null;
25
- return /* @__PURE__ */ s(
26
- L,
24
+ }), p = f && !v && m !== -1 ? m < n ? "bottom" : "top" : null;
25
+ return /* @__PURE__ */ r(
26
+ C,
27
27
  {
28
- ref: f,
29
- ...n,
30
- setNodeRef: I,
31
- setActivatorNodeRef: p,
32
- isDragging: l,
33
- dropEdge: e,
34
- listeners: a,
35
- attributes: r
28
+ ref: a,
29
+ ...e,
30
+ setNodeRef: y,
31
+ setActivatorNodeRef: g,
32
+ isDragging: v,
33
+ dropEdge: p,
34
+ listeners: u,
35
+ attributes: d
36
36
  }
37
37
  );
38
38
  }
39
- ), Y = o.forwardRef(function({
40
- striped: n = !1,
41
- showIndex: f = !1,
42
- onReorder: i,
43
- density: r,
44
- children: a,
45
- ...I
46
- }, p) {
47
- const l = _(), d = J(r), c = o.useId(), u = o.Children.toArray(a).filter(
48
- o.isValidElement
49
- ).filter((t) => t.type === z), e = u.map((t) => t.props.value).filter((t) => typeof t == "string"), [v, S] = o.useState(null), C = v ? e.indexOf(v) : -1, m = v != null ? u.find((t) => t.props.value === v) : void 0, O = A(
50
- D(P, { activationConstraint: { distance: 3 } }),
39
+ ), L = { x: 0, y: 0 }, Y = (o) => {
40
+ const e = o.ownerDocument.createElement("div");
41
+ e.style.cssText = "position:fixed;top:0;left:0;width:0;height:0;visibility:hidden", o.after(e);
42
+ const { left: a, top: s } = e.getBoundingClientRect();
43
+ return e.remove(), { x: a, y: s };
44
+ }, Z = (o) => ({ transform: e }) => ({
45
+ ...e,
46
+ x: e.x - o.x,
47
+ y: e.y - o.y
48
+ }), oe = i.forwardRef(function({
49
+ striped: e = !1,
50
+ showIndex: a = !1,
51
+ onReorder: s,
52
+ density: d,
53
+ children: u,
54
+ ...y
55
+ }, g) {
56
+ const v = z(), f = W(d), m = i.useId(), n = i.useRef(null);
57
+ i.useImperativeHandle(g, () => n.current, []);
58
+ const p = i.Children.toArray(u).filter(
59
+ i.isValidElement
60
+ ).filter((t) => t.type === J), l = p.map((t) => t.props.value).filter((t) => typeof t == "string"), [x, I] = i.useState(null), [E, w] = i.useState(L), N = x ? l.indexOf(x) : -1, c = x != null ? p.find((t) => t.props.value === x) : void 0, R = F(
61
+ O(T, { activationConstraint: { distance: 3 } }),
51
62
  // Without the sortable coordinate getter each arrow press moves a fixed 25px, not one row.
52
- D(K, {
63
+ O(K, {
53
64
  coordinateGetter: M
54
65
  })
55
- ), E = (t) => {
56
- S(t.active.id);
57
- }, w = (t) => {
58
- S(null);
59
- const { active: b, over: g } = t;
60
- if (!g || b.id === g.id) return;
61
- const x = e.indexOf(b.id), y = e.indexOf(g.id);
62
- x === -1 || y === -1 || i == null || i(B(e, x, y));
66
+ ), V = (t) => {
67
+ I(t.active.id), w(
68
+ n.current ? Y(n.current) : L
69
+ );
70
+ }, A = (t) => {
71
+ I(null);
72
+ const { active: b, over: S } = t;
73
+ if (!S || b.id === S.id) return;
74
+ const h = l.indexOf(b.id), D = l.indexOf(S.id);
75
+ h === -1 || D === -1 || s == null || s(H(l, h, D));
63
76
  };
64
- return /* @__PURE__ */ s(
65
- F.Provider,
77
+ return /* @__PURE__ */ r(
78
+ Q.Provider,
66
79
  {
67
80
  value: {
68
- striped: n,
69
- showIndex: f,
81
+ striped: e,
82
+ showIndex: a,
70
83
  sortable: !0,
71
- SortableItem: Q
84
+ SortableItem: X
72
85
  },
73
- children: /* @__PURE__ */ N(
74
- R,
86
+ children: /* @__PURE__ */ B(
87
+ P,
75
88
  {
76
- id: c,
77
- sensors: O,
89
+ id: m,
90
+ sensors: R,
78
91
  collisionDetection: j,
79
- onDragStart: E,
80
- onDragEnd: w,
81
- onDragCancel: () => S(null),
92
+ onDragStart: V,
93
+ onDragEnd: A,
94
+ onDragCancel: () => I(null),
82
95
  children: [
83
- /* @__PURE__ */ s(V, { items: e, strategy: k, children: /* @__PURE__ */ s(H, { ref: p, density: r, ...I, children: a }) }),
84
- /* @__PURE__ */ s(G, { children: m ? /* @__PURE__ */ s(
85
- L,
96
+ /* @__PURE__ */ r(_, { items: l, strategy: k, children: /* @__PURE__ */ r(U, { ref: n, density: d, ...y, children: u }) }),
97
+ /* @__PURE__ */ r(G, { modifiers: [Z(E)], children: c ? /* @__PURE__ */ r(
98
+ C,
86
99
  {
87
- value: m.props.value,
88
- status: m.props.status,
89
- index: C,
90
- className: l.dragOverlayItem,
91
- ...d !== void 0 ? { "data-density": d } : {},
92
- children: m.props.children
100
+ value: c.props.value,
101
+ textValue: c.props.textValue,
102
+ status: c.props.status,
103
+ index: N,
104
+ className: v.dragOverlayItem,
105
+ ...f !== void 0 ? { "data-density": f } : {},
106
+ children: c.props.children
93
107
  }
94
108
  ) : null })
95
109
  ]
@@ -99,6 +113,6 @@ const Q = o.forwardRef(
99
113
  );
100
114
  });
101
115
  export {
102
- Y as SortableList
116
+ oe as SortableList
103
117
  };
104
118
  //# sourceMappingURL=list-sortable.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-sortable.js","sources":["../../../src/components/list/list-sortable.tsx"],"sourcesContent":["import * as React from \"react\"\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n type DragEndEvent,\n type DragStartEvent,\n} from \"@dnd-kit/core\"\nimport {\n SortableContext,\n verticalListSortingStrategy,\n arrayMove,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\"\n\nimport {\n listContext,\n ListItem,\n ListItemBody,\n ListRoot,\n canonicalDomDensity,\n useListStyles,\n type ListItemDragListeners,\n type ListItemProps,\n type ListProps,\n} from \"./list\"\n\n// ── SortableListItem ───────────────────────────────────────────────────────\n\nconst SortableListItem = React.forwardRef<HTMLLIElement, ListItemProps>(\n function SortableListItem(props, ref) {\n const fallbackId = React.useId()\n\n if (process.env.NODE_ENV !== \"production\" && props.value === undefined) {\n console.warn(\n \"SortableList: a `ListItem` is missing a `value`. \" +\n \"Give each item a unique `value` so it can be reordered — \" +\n \"items without one are excluded from `onReorder`.\"\n )\n }\n\n const {\n attributes,\n listeners,\n setNodeRef,\n setActivatorNodeRef,\n isDragging,\n isOver,\n activeIndex,\n overIndex,\n } = useSortable({\n id: props.value ?? fallbackId,\n animateLayoutChanges: () => false,\n })\n\n const dropEdge: \"top\" | \"bottom\" | null =\n isOver && !isDragging && activeIndex !== -1\n ? activeIndex < overIndex\n ? \"bottom\"\n : \"top\"\n : null\n\n return (\n <ListItemBody\n ref={ref}\n {...props}\n setNodeRef={setNodeRef}\n setActivatorNodeRef={setActivatorNodeRef}\n isDragging={isDragging}\n dropEdge={dropEdge}\n listeners={listeners as ListItemDragListeners | undefined}\n attributes={attributes}\n />\n )\n }\n)\n\n// ── SortableList ───────────────────────────────────────────────────────────\n\nexport type SortableListProps = ListProps & {\n /** Called with the new order of `ListItem` values after a drag. */\n onReorder?: (values: string[]) => void\n}\n\nexport const SortableList = React.forwardRef<\n HTMLOListElement,\n SortableListProps\n>(function SortableList(\n {\n striped = false,\n showIndex = false,\n onReorder,\n density,\n children,\n ...props\n },\n ref\n) {\n const styles = useListStyles()\n const domDensity = canonicalDomDensity(density)\n // dnd-kit otherwise numbers its describedby/live-region ids from a module counter, which the\n // server and the client advance separately, so the handles' aria-describedby failed hydration.\n const dndId = React.useId()\n\n const listItems = (\n React.Children.toArray(children).filter(\n React.isValidElement\n ) as React.ReactElement<ListItemProps>[]\n ).filter((child) => child.type === ListItem)\n const values = listItems\n .map((child) => child.props.value)\n .filter((v): v is string => typeof v === \"string\")\n\n const [activeId, setActiveId] = React.useState<string | null>(null)\n const activeIndex = activeId ? values.indexOf(activeId) : -1\n const activeItem =\n activeId != null\n ? listItems.find((child) => child.props.value === activeId)\n : undefined\n\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 3 } }),\n // Without the sortable coordinate getter each arrow press moves a fixed 25px, not one row.\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n })\n )\n\n const handleDragStart = (event: DragStartEvent) => {\n setActiveId(event.active.id as string)\n }\n\n const handleDragEnd = (event: DragEndEvent) => {\n setActiveId(null)\n const { active, over } = event\n if (!over || active.id === over.id) return\n\n const oldIndex = values.indexOf(active.id as string)\n const newIndex = values.indexOf(over.id as string)\n if (oldIndex === -1 || newIndex === -1) return\n\n onReorder?.(arrayMove(values, oldIndex, newIndex))\n }\n\n return (\n <listContext.Provider\n value={{\n striped,\n showIndex,\n sortable: true,\n SortableItem: SortableListItem,\n }}\n >\n <DndContext\n id={dndId}\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n onDragCancel={() => setActiveId(null)}\n >\n <SortableContext items={values} strategy={verticalListSortingStrategy}>\n <ListRoot ref={ref} density={density} {...props}>\n {children}\n </ListRoot>\n </SortableContext>\n <DragOverlay>\n {activeItem ? (\n <ListItemBody\n value={activeItem.props.value}\n status={activeItem.props.status}\n index={activeIndex}\n className={styles.dragOverlayItem}\n // Reasserted only for an EXPLICIT density: DragOverlay is an ordinary DOM sibling\n // of the `<ol>`, not a portal (dnd-kit's `PositionedOverlay` renders in place —\n // confirmed from the installed source), so an omitted/ambient density already\n // reaches it correctly through the real DOM tree with no stamp at all.\n {...(domDensity !== undefined\n ? { \"data-density\": domDensity }\n : {})}\n >\n {activeItem.props.children}\n </ListItemBody>\n ) : null}\n </DragOverlay>\n </DndContext>\n </listContext.Provider>\n )\n})\n"],"names":["SortableListItem","React","props","ref","fallbackId","attributes","listeners","setNodeRef","setActivatorNodeRef","isDragging","isOver","activeIndex","overIndex","useSortable","dropEdge","jsx","ListItemBody","SortableList","striped","showIndex","onReorder","density","children","styles","useListStyles","domDensity","canonicalDomDensity","dndId","listItems","child","ListItem","values","v","activeId","setActiveId","activeItem","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","handleDragStart","event","handleDragEnd","active","over","oldIndex","newIndex","arrayMove","listContext","jsxs","DndContext","closestCenter","SortableContext","verticalListSortingStrategy","ListRoot","DragOverlay"],"mappings":";;;;;AAkCA,MAAMA,IAAmBC,EAAM;AAAA,EAC7B,SAA0BC,GAAOC,GAAK;AACpC,UAAMC,IAAaH,EAAM,MAAA;AAEzB,IAAI,QAAQ,IAAI,aAAa,gBAAgBC,EAAM,UAAU,UAC3D,QAAQ;AAAA,MACN;AAAA,IAAA;AAMJ,UAAM;AAAA,MACJ,YAAAG;AAAA,MACA,WAAAC;AAAA,MACA,YAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,QAAAC;AAAA,MACA,aAAAC;AAAA,MACA,WAAAC;AAAA,IAAA,IACEC,EAAY;AAAA,MACd,IAAIX,EAAM,SAASE;AAAA,MACnB,sBAAsB,MAAM;AAAA,IAAA,CAC7B,GAEKU,IACJJ,KAAU,CAACD,KAAcE,MAAgB,KACrCA,IAAcC,IACZ,WACA,QACF;AAEN,WACE,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAb;AAAA,QACC,GAAGD;AAAA,QACJ,YAAAK;AAAA,QACA,qBAAAC;AAAA,QACA,YAAAC;AAAA,QACA,UAAAK;AAAA,QACA,WAAAR;AAAA,QACA,YAAAD;AAAA,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pC5B,KAAA,QAAAA,EAAY6B,EAAUlB,GAAQgB,GAAUC,CAAQ;AAAA,EAClD;AAEA,SACE,gBAAAjC;AAAA,IAACmC,EAAY;AAAA,IAAZ;AAAA,MACC,OAAO;AAAA,QACL,SAAAhC;AAAA,QACA,WAAAC;AAAA,QACA,UAAU;AAAA,QACV,cAAcnB;AAAA,MAAA;AAAA,MAGhB,UAAA,gBAAAmD;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,IAAIzB;AAAA,UACJ,SAAAS;AAAA,UACA,oBAAoBiB;AAAA,UACpB,aAAaX;AAAA,UACb,WAAWE;AAAA,UACX,cAAc,MAAMV,EAAY,IAAI;AAAA,UAEpC,UAAA;AAAA,YAAA,gBAAAnB,EAACuC,GAAA,EAAgB,OAAOvB,GAAQ,UAAUwB,GACxC,UAAA,gBAAAxC,EAACyC,GAAA,EAAS,KAAArD,GAAU,SAAAkB,GAAmB,GAAGnB,GACvC,UAAAoB,EAAA,CACH,GACF;AAAA,YACA,gBAAAP,EAAC0C,KACE,UAAAtB,IACC,gBAAApB;AAAA,cAACC;AAAA,cAAA;AAAA,gBACC,OAAOmB,EAAW,MAAM;AAAA,gBACxB,QAAQA,EAAW,MAAM;AAAA,gBACzB,OAAOxB;AAAA,gBACP,WAAWY,EAAO;AAAA,gBAKjB,GAAIE,MAAe,SAChB,EAAE,gBAAgBA,EAAA,IAClB,CAAA;AAAA,gBAEH,YAAW,MAAM;AAAA,cAAA;AAAA,YAAA,IAElB,KAAA,CACN;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACF;AAAA,EAAA;AAGN,CAAC;"}
1
+ {"version":3,"file":"list-sortable.js","sources":["../../../src/components/list/list-sortable.tsx"],"sourcesContent":["import * as React from \"react\"\nimport {\n DndContext,\n DragOverlay,\n closestCenter,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors,\n type DragEndEvent,\n type DragStartEvent,\n type Modifier,\n} from \"@dnd-kit/core\"\nimport {\n SortableContext,\n verticalListSortingStrategy,\n arrayMove,\n sortableKeyboardCoordinates,\n useSortable,\n} from \"@dnd-kit/sortable\"\n\nimport {\n listContext,\n ListItem,\n ListItemBody,\n ListRoot,\n canonicalDomDensity,\n useListStyles,\n type ListItemDragListeners,\n type ListItemProps,\n type ListProps,\n} from \"./list\"\n\n// ── SortableListItem ───────────────────────────────────────────────────────\n\nconst SortableListItem = React.forwardRef<HTMLLIElement, ListItemProps>(\n function SortableListItem(props, ref) {\n const fallbackId = React.useId()\n\n if (process.env.NODE_ENV !== \"production\" && props.value === undefined) {\n console.warn(\n \"SortableList: a `ListItem` is missing a `value`. \" +\n \"Give each item a unique `value` so it can be reordered — \" +\n \"items without one are excluded from `onReorder`.\"\n )\n }\n\n const {\n attributes,\n listeners,\n setNodeRef,\n setActivatorNodeRef,\n isDragging,\n isOver,\n activeIndex,\n overIndex,\n } = useSortable({\n id: props.value ?? fallbackId,\n animateLayoutChanges: () => false,\n })\n\n const dropEdge: \"top\" | \"bottom\" | null =\n isOver && !isDragging && activeIndex !== -1\n ? activeIndex < overIndex\n ? \"bottom\"\n : \"top\"\n : null\n\n return (\n <ListItemBody\n ref={ref}\n {...props}\n setNodeRef={setNodeRef}\n setActivatorNodeRef={setActivatorNodeRef}\n isDragging={isDragging}\n dropEdge={dropEdge}\n listeners={listeners as ListItemDragListeners | undefined}\n attributes={attributes}\n />\n )\n }\n)\n\n// ── SortableList ───────────────────────────────────────────────────────────\n\ntype Offset = { x: number; y: number }\n\nconst NO_OFFSET: Offset = { x: 0, y: 0 }\n\n/**\n * Where a fixed-position box placed beside `node` lands, which a transformed ancestor such as a Popover moves off the viewport's origin.\n */\nconst getFixedPositionOrigin = (node: Element): Offset => {\n const probe = node.ownerDocument.createElement(\"div\")\n probe.style.cssText =\n \"position:fixed;top:0;left:0;width:0;height:0;visibility:hidden\"\n node.after(probe)\n const { left, top } = probe.getBoundingClientRect()\n probe.remove()\n return { x: left, y: top }\n}\n\n/**\n * Moves the drag overlay back by `offset`.\n */\nconst shiftBy =\n (offset: Offset): Modifier =>\n ({ transform }) => ({\n ...transform,\n x: transform.x - offset.x,\n y: transform.y - offset.y,\n })\n\nexport type SortableListProps = ListProps & {\n /** Called with the new order of `ListItem` values after a drag. */\n onReorder?: (values: string[]) => void\n}\n\nexport const SortableList = React.forwardRef<\n HTMLOListElement,\n SortableListProps\n>(function SortableList(\n {\n striped = false,\n showIndex = false,\n onReorder,\n density,\n children,\n ...props\n },\n ref\n) {\n const styles = useListStyles()\n const domDensity = canonicalDomDensity(density)\n // dnd-kit otherwise numbers its describedby/live-region ids from a module counter, which the\n // server and the client advance separately, so the handles' aria-describedby failed hydration.\n const dndId = React.useId()\n const listRef = React.useRef<HTMLOListElement>(null)\n React.useImperativeHandle(ref, () => listRef.current as HTMLOListElement, [])\n\n const listItems = (\n React.Children.toArray(children).filter(\n React.isValidElement\n ) as React.ReactElement<ListItemProps>[]\n ).filter((child) => child.type === ListItem)\n const values = listItems\n .map((child) => child.props.value)\n .filter((v): v is string => typeof v === \"string\")\n\n const [activeId, setActiveId] = React.useState<string | null>(null)\n const [overlayOrigin, setOverlayOrigin] = React.useState(NO_OFFSET)\n const activeIndex = activeId ? values.indexOf(activeId) : -1\n const activeItem =\n activeId != null\n ? listItems.find((child) => child.props.value === activeId)\n : undefined\n\n const sensors = useSensors(\n useSensor(PointerSensor, { activationConstraint: { distance: 3 } }),\n // Without the sortable coordinate getter each arrow press moves a fixed 25px, not one row.\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates,\n })\n )\n\n const handleDragStart = (event: DragStartEvent) => {\n setActiveId(event.active.id as string)\n setOverlayOrigin(\n listRef.current ? getFixedPositionOrigin(listRef.current) : NO_OFFSET\n )\n }\n\n const handleDragEnd = (event: DragEndEvent) => {\n setActiveId(null)\n const { active, over } = event\n if (!over || active.id === over.id) return\n\n const oldIndex = values.indexOf(active.id as string)\n const newIndex = values.indexOf(over.id as string)\n if (oldIndex === -1 || newIndex === -1) return\n\n onReorder?.(arrayMove(values, oldIndex, newIndex))\n }\n\n return (\n <listContext.Provider\n value={{\n striped,\n showIndex,\n sortable: true,\n SortableItem: SortableListItem,\n }}\n >\n <DndContext\n id={dndId}\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragStart={handleDragStart}\n onDragEnd={handleDragEnd}\n onDragCancel={() => setActiveId(null)}\n >\n <SortableContext items={values} strategy={verticalListSortingStrategy}>\n <ListRoot ref={listRef} density={density} {...props}>\n {children}\n </ListRoot>\n </SortableContext>\n {/* The overlay stays beside the list so density and appearance reach it through the DOM;\n under a transformed ancestor its fixed position starts from that ancestor, not the\n viewport, so it is shifted back to stay under the pointer. */}\n <DragOverlay modifiers={[shiftBy(overlayOrigin)]}>\n {activeItem ? (\n <ListItemBody\n value={activeItem.props.value}\n textValue={activeItem.props.textValue}\n status={activeItem.props.status}\n index={activeIndex}\n className={styles.dragOverlayItem}\n // Reasserted only for an EXPLICIT density: DragOverlay is an ordinary DOM sibling\n // of the `<ol>`, not a portal (dnd-kit's `PositionedOverlay` renders in place —\n // confirmed from the installed source), so an omitted/ambient density already\n // reaches it correctly through the real DOM tree with no stamp at all.\n {...(domDensity !== undefined\n ? { \"data-density\": domDensity }\n : {})}\n >\n {activeItem.props.children}\n </ListItemBody>\n ) : null}\n </DragOverlay>\n </DndContext>\n </listContext.Provider>\n )\n})\n"],"names":["SortableListItem","React","props","ref","fallbackId","attributes","listeners","setNodeRef","setActivatorNodeRef","isDragging","isOver","activeIndex","overIndex","useSortable","dropEdge","jsx","ListItemBody","NO_OFFSET","getFixedPositionOrigin","node","probe","left","top","shiftBy","offset","transform","SortableList","striped","showIndex","onReorder","density","children","styles","useListStyles","domDensity","canonicalDomDensity","dndId","listRef","listItems","child","ListItem","values","v","activeId","setActiveId","overlayOrigin","setOverlayOrigin","activeItem","sensors","useSensors","useSensor","PointerSensor","KeyboardSensor","sortableKeyboardCoordinates","handleDragStart","event","handleDragEnd","active","over","oldIndex","newIndex","arrayMove","listContext","jsxs","DndContext","closestCenter","SortableContext","verticalListSortingStrategy","ListRoot","DragOverlay"],"mappings":";;;;;AAmCA,MAAMA,IAAmBC,EAAM;AAAA,EAC7B,SAA0BC,GAAOC,GAAK;AACpC,UAAMC,IAAaH,EAAM,MAAA;AAEzB,IAAI,QAAQ,IAAI,aAAa,gBAAgBC,EAAM,UAAU,UAC3D,QAAQ;AAAA,MACN;AAAA,IAAA;AAMJ,UAAM;AAAA,MACJ,YAAAG;AAAA,MACA,WAAAC;AAAA,MACA,YAAAC;AAAA,MACA,qBAAAC;AAAA,MACA,YAAAC;AAAA,MACA,QAAAC;AAAA,MACA,aAAAC;AAAA,MACA,WAAAC;AAAA,IAAA,IACEC,EAAY;AAAA,MACd,IAAIX,EAAM,SAASE;AAAA,MACnB,sBAAsB,MAAM;AAAA,IAAA,CAC7B,GAEKU,IACJJ,KAAU,CAACD,KAAcE,MAAgB,KACrCA,IAAcC,IACZ,WACA,QACF;AAEN,WACE,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAAb;AAAA,QACC,GAAGD;AAAA,QACJ,YAAAK;AAAA,QACA,qBAAAC;AAAA,QACA,YAAAC;AAAA,QACA,UAAAK;AAAA,QACA,WAAAR;AAAA,QACA,YAAAD;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF,GAMMY,IAAoB,EAAE,GAAG,GAAG,GAAG,EAAA,GAK/BC,IAAyB,CAACC,MAA0B;AACxD,QAAMC,IAAQD,EAAK,cAAc,cAAc,KAAK;AACpD,EAAAC,EAAM,MAAM,UACV,kEACFD,EAAK,MAAMC,CAAK;AAChB,QAAM,EAAE,MAAAC,GAAM,KAAAC,MAAQF,EAAM,sBAAA;AAC5B,SAAAA,EAAM,OAAA,GACC,EAAE,GAAGC,GAAM,GAAGC,EAAA;AACvB,GAKMC,IACJ,CAACC,MACD,CAAC,EAAE,WAAAC,SAAiB;AAAA,EAClB,GAAGA;AAAA,EACH,GAAGA,EAAU,IAAID,EAAO;AAAA,E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