@vritti/quantum-ui 0.5.8 → 0.5.9

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 (208) hide show
  1. package/dist/ActiveShapeUtils.js +1 -1
  2. package/dist/AreaChart.js +1 -1
  3. package/dist/Avatar.js +5 -5
  4. package/dist/BarChart.js +1 -1
  5. package/dist/Breadcrumb.js +3 -1
  6. package/dist/Breadcrumb.js.map +1 -1
  7. package/dist/Button.js +1 -1
  8. package/dist/CartesianChart.js +40 -2
  9. package/dist/CartesianChart.js.map +1 -1
  10. package/dist/Chart.js +7 -3
  11. package/dist/Chart.js.map +1 -1
  12. package/dist/Checkbox.js +30 -6
  13. package/dist/Checkbox.js.map +1 -1
  14. package/dist/Checkbox2.js +2 -2
  15. package/dist/CheckboxGroup.js +20 -3
  16. package/dist/CheckboxGroup.js.map +1 -1
  17. package/dist/CurrencyField.js +17 -5
  18. package/dist/CurrencyField.js.map +1 -1
  19. package/dist/DangerZoneSkeleton.js +1 -1
  20. package/dist/DatePicker.js +144 -126
  21. package/dist/DatePicker.js.map +1 -1
  22. package/dist/DateRangePicker.js +138 -122
  23. package/dist/DateRangePicker.js.map +1 -1
  24. package/dist/DateTimePicker.js +181 -163
  25. package/dist/DateTimePicker.js.map +1 -1
  26. package/dist/DateTimeRangePicker.js +189 -173
  27. package/dist/DateTimeRangePicker.js.map +1 -1
  28. package/dist/Dialog.js +1 -1
  29. package/dist/DropdownMenu.js +1 -1
  30. package/dist/Form.js +2 -0
  31. package/dist/Form.js.map +1 -1
  32. package/dist/FormSection.js +22 -0
  33. package/dist/FormSection.js.map +1 -1
  34. package/dist/IconSelect.js +4 -2
  35. package/dist/IconSelect.js.map +1 -1
  36. package/dist/Label.js +1 -1
  37. package/dist/LineChart.js +390 -9
  38. package/dist/LineChart.js.map +1 -1
  39. package/dist/OTPField.js +39 -24
  40. package/dist/OTPField.js.map +1 -1
  41. package/dist/PermissionGate.js +25 -3
  42. package/dist/PermissionGate.js.map +1 -1
  43. package/dist/PhoneField.js +47 -30
  44. package/dist/PhoneField.js.map +1 -1
  45. package/dist/PieChart.js +1 -1
  46. package/dist/Progress.js +2 -2
  47. package/dist/RadarChart.js +1 -1
  48. package/dist/RadialChart.js +1 -1
  49. package/dist/RadioGroup.js +35 -18
  50. package/dist/RadioGroup.js.map +1 -1
  51. package/dist/Select.js +53 -33
  52. package/dist/Select.js.map +1 -1
  53. package/dist/SelectFilter.js +13 -6
  54. package/dist/SelectFilter.js.map +1 -1
  55. package/dist/Sidebar.js +1 -1
  56. package/dist/SingleSelect.js +50 -24
  57. package/dist/SingleSelect.js.map +1 -1
  58. package/dist/Switch.js +3 -3
  59. package/dist/TabsSkeleton.js +2 -2
  60. package/dist/TextArea.js +28 -12
  61. package/dist/TextArea.js.map +1 -1
  62. package/dist/TextField.js +70 -53
  63. package/dist/TextField.js.map +1 -1
  64. package/dist/Toggle.js +1 -1
  65. package/dist/UploadFile.js +22 -4
  66. package/dist/UploadFile.js.map +1 -1
  67. package/dist/assets/quantum-ui.css +76 -1
  68. package/dist/calendar2.js +1 -1
  69. package/dist/calendar2.js.map +1 -1
  70. package/dist/components/DateFilter.js +158 -0
  71. package/dist/components/DateFilter.js.map +1 -0
  72. package/dist/components/PermissionGate.js +1 -1
  73. package/dist/components/RichTextEditor.js +1 -1
  74. package/dist/components/TokenInput.js +96 -66
  75. package/dist/components/TokenInput.js.map +1 -1
  76. package/dist/contextAnchor.js +11 -0
  77. package/dist/contextAnchor.js.map +1 -0
  78. package/dist/disabledTip.js +3 -2
  79. package/dist/disabledTip.js.map +1 -1
  80. package/dist/dropdown-menu.js +5 -5
  81. package/dist/getZIndexFromUnknown.js +1 -1
  82. package/dist/image-component.js +1 -1
  83. package/dist/index.js +2 -2
  84. package/dist/index13.js +34 -5
  85. package/dist/index13.js.map +1 -1
  86. package/dist/index14.js +22 -281
  87. package/dist/index14.js.map +1 -1
  88. package/dist/index15.js +212 -1072
  89. package/dist/index15.js.map +1 -1
  90. package/dist/index16.js +1139 -14
  91. package/dist/index16.js.map +1 -1
  92. package/dist/index17.js +14 -20
  93. package/dist/index17.js.map +1 -1
  94. package/dist/index20.js +2 -2
  95. package/dist/index21.js +1 -1
  96. package/dist/index22.js +1 -1
  97. package/dist/index23.js +1 -1
  98. package/dist/index25.js +4 -232
  99. package/dist/index25.js.map +1 -1
  100. package/dist/index26.js +35 -2534
  101. package/dist/index26.js.map +1 -1
  102. package/dist/index27.js +223 -23
  103. package/dist/index27.js.map +1 -1
  104. package/dist/index28.js +1124 -3
  105. package/dist/index28.js.map +1 -1
  106. package/dist/index29.js +2481 -1035
  107. package/dist/index29.js.map +1 -1
  108. package/dist/index30.js +308 -36
  109. package/dist/index30.js.map +1 -1
  110. package/dist/index31.js +7 -307
  111. package/dist/index31.js.map +1 -1
  112. package/dist/index32.js +30 -8
  113. package/dist/index32.js.map +1 -1
  114. package/dist/index33.js +59 -29
  115. package/dist/index33.js.map +1 -1
  116. package/dist/index34.js +10 -59
  117. package/dist/index34.js.map +1 -1
  118. package/dist/index35.js +35347 -9
  119. package/dist/index35.js.map +1 -1
  120. package/dist/index36.js +79 -36
  121. package/dist/index36.js.map +1 -1
  122. package/dist/index37.js +184 -35340
  123. package/dist/index37.js.map +1 -1
  124. package/dist/index5.js +1 -1
  125. package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -1
  126. package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  127. package/dist/lib/components/Checkbox/Checkbox.d.ts +1 -0
  128. package/dist/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
  129. package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts +1 -0
  130. package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
  131. package/dist/lib/components/CurrencyField/CurrencyField.d.ts +1 -0
  132. package/dist/lib/components/CurrencyField/CurrencyField.d.ts.map +1 -1
  133. package/dist/lib/components/DataTable/DataTable.d.ts +1 -1
  134. package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
  135. package/dist/lib/components/DataTable/components/RowActions.d.ts +1 -0
  136. package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
  137. package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
  138. package/dist/lib/components/DataTable/types.d.ts +1 -0
  139. package/dist/lib/components/DataTable/types.d.ts.map +1 -1
  140. package/dist/lib/components/DateFilter/DateFilter.d.ts +17 -0
  141. package/dist/lib/components/DateFilter/DateFilter.d.ts.map +1 -0
  142. package/dist/lib/components/DateFilter/index.d.ts +3 -0
  143. package/dist/lib/components/DateFilter/index.d.ts.map +1 -0
  144. package/dist/lib/components/DatePicker/DatePicker.d.ts +1 -0
  145. package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
  146. package/dist/lib/components/DateRangePicker/DateRangePicker.d.ts +1 -0
  147. package/dist/lib/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
  148. package/dist/lib/components/DateTimePicker/DateTimePicker.d.ts +1 -0
  149. package/dist/lib/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
  150. package/dist/lib/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -0
  151. package/dist/lib/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
  152. package/dist/lib/components/Form/Form.d.ts.map +1 -1
  153. package/dist/lib/components/Form/FormSection.d.ts +1 -1
  154. package/dist/lib/components/Form/FormSection.d.ts.map +1 -1
  155. package/dist/lib/components/Form/fieldPermissions.d.ts +6 -0
  156. package/dist/lib/components/Form/fieldPermissions.d.ts.map +1 -0
  157. package/dist/lib/components/LineChart/LineChart.d.ts +18 -4
  158. package/dist/lib/components/LineChart/LineChart.d.ts.map +1 -1
  159. package/dist/lib/components/LineChart/index.d.ts +1 -1
  160. package/dist/lib/components/LineChart/index.d.ts.map +1 -1
  161. package/dist/lib/components/OTPField/OTPField.d.ts +1 -0
  162. package/dist/lib/components/OTPField/OTPField.d.ts.map +1 -1
  163. package/dist/lib/components/PermissionGate/PermissionGate.d.ts +1 -0
  164. package/dist/lib/components/PermissionGate/PermissionGate.d.ts.map +1 -1
  165. package/dist/lib/components/PermissionGate/index.d.ts +1 -1
  166. package/dist/lib/components/PermissionGate/index.d.ts.map +1 -1
  167. package/dist/lib/components/PhoneField/PhoneField.d.ts +1 -0
  168. package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
  169. package/dist/lib/components/RadioGroup/RadioGroup.d.ts +1 -0
  170. package/dist/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  171. package/dist/lib/components/Select/Select.d.ts.map +1 -1
  172. package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
  173. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts +1 -0
  174. package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
  175. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +1 -0
  176. package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
  177. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts +3 -0
  178. package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
  179. package/dist/lib/components/Select/contextAnchor.d.ts +11 -0
  180. package/dist/lib/components/Select/contextAnchor.d.ts.map +1 -0
  181. package/dist/lib/components/TextArea/TextArea.d.ts +1 -0
  182. package/dist/lib/components/TextArea/TextArea.d.ts.map +1 -1
  183. package/dist/lib/components/TextField/TextField.d.ts +1 -0
  184. package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
  185. package/dist/lib/components/TokenInput/TokenInput.d.ts +1 -0
  186. package/dist/lib/components/TokenInput/TokenInput.d.ts.map +1 -1
  187. package/dist/lib/components/UploadFile/UploadFile.d.ts +1 -0
  188. package/dist/lib/components/UploadFile/UploadFile.d.ts.map +1 -1
  189. package/dist/lib/selects/icon/IconSelect.d.ts +1 -0
  190. package/dist/lib/selects/icon/IconSelect.d.ts.map +1 -1
  191. package/dist/lib/utils/disabledTip.d.ts +1 -1
  192. package/dist/lib/utils/disabledTip.d.ts.map +1 -1
  193. package/dist/popover.js +1 -1
  194. package/dist/select2.js +1 -1
  195. package/dist/separator2.js +1 -1
  196. package/dist/shadcn/shadcnChart/Chart.d.ts +2 -1
  197. package/dist/shadcn/shadcnChart/Chart.d.ts.map +1 -1
  198. package/dist/useDataTable.js +25 -9
  199. package/dist/useDataTable.js.map +1 -1
  200. package/dist/utils/motion.js +2 -2
  201. package/dist/value.js +1 -1
  202. package/package.json +5 -1
  203. package/dist/index38.js +0 -84
  204. package/dist/index38.js.map +0 -1
  205. package/dist/index39.js +0 -199
  206. package/dist/index39.js.map +0 -1
  207. package/dist/lock-keyhole.js +0 -19
  208. package/dist/lock-keyhole.js.map +0 -1
package/dist/Checkbox.js CHANGED
@@ -1,18 +1,31 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
2
  import React__default from 'react';
3
3
  import { F as Field, a as FieldContent, e as FieldLabel, b as FieldDescription, c as FieldError } from './field.js';
4
+ import { c as cn } from './utils.js';
4
5
  import { w as withDisabledTip } from './disabledTip.js';
6
+ import { c as usePermission, l as lockedTip, b as PermissionLockIcon } from './PermissionGate.js';
5
7
  import { C as Checkbox$1 } from './Checkbox2.js';
6
8
 
7
9
  const Checkbox = React__default.forwardRef(
8
- ({ label, description, error, disabledTip, id, ...props }, ref) => {
10
+ ({ label, description, error, disabledTip, permission, id, ...props }, ref) => {
9
11
  const generatedId = React__default.useId();
10
12
  const fieldId = id || generatedId;
11
13
  const hasError = !!error;
14
+ const gate = usePermission(permission);
15
+ const { granted, locked, reason } = gate;
16
+ if (!granted) {
17
+ return null;
18
+ }
19
+ const isDisabled = props.disabled || locked;
20
+ const tip = locked ? lockedTip(gate) : disabledTip;
12
21
  if (!label && !description && !error) {
13
- return withDisabledTip(/* @__PURE__ */ jsx(Checkbox$1, { ...props, ref, id: fieldId }), disabledTip, props.disabled);
22
+ return withDisabledTip(
23
+ /* @__PURE__ */ jsx(Checkbox$1, { ...props, ref, id: fieldId, disabled: isDisabled }),
24
+ tip,
25
+ isDisabled
26
+ );
14
27
  }
15
- return /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", "data-disabled": props.disabled, "data-invalid": hasError, children: [
28
+ return /* @__PURE__ */ jsxs(Field, { orientation: "horizontal", "data-disabled": isDisabled, "data-invalid": hasError, children: [
16
29
  withDisabledTip(
17
30
  /* @__PURE__ */ jsx(
18
31
  Checkbox$1,
@@ -20,15 +33,26 @@ const Checkbox = React__default.forwardRef(
20
33
  ...props,
21
34
  ref,
22
35
  id: fieldId,
36
+ disabled: isDisabled,
23
37
  "aria-describedby": description || error ? `${fieldId}-description ${fieldId}-error` : void 0,
24
38
  "aria-invalid": hasError
25
39
  }
26
40
  ),
27
- disabledTip,
28
- props.disabled
41
+ tip,
42
+ isDisabled
29
43
  ),
30
44
  /* @__PURE__ */ jsxs(FieldContent, { children: [
31
- label && /* @__PURE__ */ jsx(FieldLabel, { htmlFor: fieldId, className: "font-normal cursor-pointer", children: label }),
45
+ label && /* @__PURE__ */ jsxs(
46
+ FieldLabel,
47
+ {
48
+ htmlFor: fieldId,
49
+ className: cn("font-normal cursor-pointer", locked && "items-center gap-1.5"),
50
+ children: [
51
+ locked && /* @__PURE__ */ jsx(PermissionLockIcon, { reason, className: "size-3.5" }),
52
+ label
53
+ ]
54
+ }
55
+ ),
32
56
  description && /* @__PURE__ */ jsx(FieldDescription, { id: `${fieldId}-description`, children: description }),
33
57
  error && /* @__PURE__ */ jsx(FieldError, { id: `${fieldId}-error`, children: error })
34
58
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":["../lib/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Checkbox as ShadcnCheckbox } from '../../../shadcn/shadcnCheckbox';\nimport { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../../../shadcn/shadcnField';\nimport { withDisabledTip } from '../../utils/disabledTip';\n\nexport interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof ShadcnCheckbox> {\n label?: React.ReactNode;\n\n description?: React.ReactNode;\n\n error?: string;\n\n disabledTip?: string;\n}\n\n// Checkbox component with Field system integration\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof ShadcnCheckbox>, CheckboxProps>(\n ({ label, description, error, disabledTip, id, ...props }, ref) => {\n const generatedId = React.useId();\n const fieldId = id || generatedId;\n const hasError = !!error;\n\n // If no label or description, just return the base checkbox\n if (!label && !description && !error) {\n return withDisabledTip(<ShadcnCheckbox {...props} ref={ref} id={fieldId} />, disabledTip, props.disabled);\n }\n\n return (\n <Field orientation=\"horizontal\" data-disabled={props.disabled} data-invalid={hasError}>\n {withDisabledTip(\n <ShadcnCheckbox\n {...props}\n ref={ref}\n id={fieldId}\n aria-describedby={description || error ? `${fieldId}-description ${fieldId}-error` : undefined}\n aria-invalid={hasError}\n />,\n disabledTip,\n props.disabled,\n )}\n <FieldContent>\n {label && (\n <FieldLabel htmlFor={fieldId} className=\"font-normal cursor-pointer\">\n {label}\n </FieldLabel>\n )}\n\n {description && <FieldDescription id={`${fieldId}-description`}>{description}</FieldDescription>}\n\n {error && <FieldError id={`${fieldId}-error`}>{error}</FieldError>}\n </FieldContent>\n </Field>\n );\n },\n);\n\nCheckbox.displayName = 'Checkbox';\n"],"names":["React","ShadcnCheckbox"],"mappings":";;;;;;AAgBO,MAAM,WAAWA,cAAA,CAAM,UAAA;AAAA,EAC5B,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,KAAA,EAAO,aAAa,EAAA,EAAI,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AACjE,IAAA,MAAM,WAAA,GAAcA,eAAM,KAAA,EAAM;AAChC,IAAA,MAAM,UAAU,EAAA,IAAM,WAAA;AACtB,IAAA,MAAM,QAAA,GAAW,CAAC,CAAC,KAAA;AAGnB,IAAA,IAAI,CAAC,KAAA,IAAS,CAAC,WAAA,IAAe,CAAC,KAAA,EAAO;AACpC,MAAA,OAAO,eAAA,iBAAgB,GAAA,CAACC,UAAA,EAAA,EAAgB,GAAG,KAAA,EAAO,GAAA,EAAU,EAAA,EAAI,OAAA,EAAS,CAAA,EAAI,WAAA,EAAa,KAAA,CAAM,QAAQ,CAAA;AAAA,IAC1G;AAEA,IAAA,uBACE,IAAA,CAAC,SAAM,WAAA,EAAY,YAAA,EAAa,iBAAe,KAAA,CAAM,QAAA,EAAU,gBAAc,QAAA,EAC1E,QAAA,EAAA;AAAA,MAAA,eAAA;AAAA,wBACC,GAAA;AAAA,UAACA,UAAA;AAAA,UAAA;AAAA,YACE,GAAG,KAAA;AAAA,YACJ,GAAA;AAAA,YACA,EAAA,EAAI,OAAA;AAAA,YACJ,oBAAkB,WAAA,IAAe,KAAA,GAAQ,GAAG,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,MAAA,CAAA,GAAW,MAAA;AAAA,YACrF,cAAA,EAAc;AAAA;AAAA,SAChB;AAAA,QACA,WAAA;AAAA,QACA,KAAA,CAAM;AAAA,OACR;AAAA,2BACC,YAAA,EAAA,EACE,QAAA,EAAA;AAAA,QAAA,KAAA,wBACE,UAAA,EAAA,EAAW,OAAA,EAAS,OAAA,EAAS,SAAA,EAAU,8BACrC,QAAA,EAAA,KAAA,EACH,CAAA;AAAA,QAGD,+BAAe,GAAA,CAAC,gBAAA,EAAA,EAAiB,IAAI,CAAA,EAAG,OAAO,gBAAiB,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,QAE5E,yBAAS,GAAA,CAAC,UAAA,EAAA,EAAW,IAAI,CAAA,EAAG,OAAO,UAAW,QAAA,EAAA,KAAA,EAAM;AAAA,OAAA,EACvD;AAAA,KAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":["../lib/components/Checkbox/Checkbox.tsx"],"sourcesContent":["import React from 'react';\nimport { Checkbox as ShadcnCheckbox } from '../../../shadcn/shadcnCheckbox';\nimport { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../../../shadcn/shadcnField';\nimport { cn } from '../../../shadcn/utils';\nimport { withDisabledTip } from '../../utils/disabledTip';\nimport { lockedTip, PermissionLockIcon, usePermission } from '../PermissionGate';\n\nexport interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof ShadcnCheckbox> {\n label?: React.ReactNode;\n\n description?: React.ReactNode;\n\n error?: string;\n\n disabledTip?: string;\n\n /** Permission code gating this field: hidden when not granted, disabled with a lock + upsell tip when locked */\n permission?: string;\n}\n\n// Checkbox component with Field system integration\nexport const Checkbox = React.forwardRef<React.ElementRef<typeof ShadcnCheckbox>, CheckboxProps>(\n ({ label, description, error, disabledTip, permission, id, ...props }, ref) => {\n const generatedId = React.useId();\n const fieldId = id || generatedId;\n const hasError = !!error;\n const gate = usePermission(permission);\n const { granted, locked, reason } = gate;\n\n // render = role: the role doesn't grant this field, so it doesn't exist for this user\n if (!granted) {\n return null;\n }\n\n // enable = role ∧ plan ∧ BU: granted but locked renders disabled with the upsell as its tooltip\n const isDisabled = props.disabled || locked;\n const tip = locked ? lockedTip(gate) : disabledTip;\n\n // If no label or description, just return the base checkbox\n if (!label && !description && !error) {\n return withDisabledTip(\n <ShadcnCheckbox {...props} ref={ref} id={fieldId} disabled={isDisabled} />,\n tip,\n isDisabled,\n );\n }\n\n return (\n <Field orientation=\"horizontal\" data-disabled={isDisabled} data-invalid={hasError}>\n {withDisabledTip(\n <ShadcnCheckbox\n {...props}\n ref={ref}\n id={fieldId}\n disabled={isDisabled}\n aria-describedby={description || error ? `${fieldId}-description ${fieldId}-error` : undefined}\n aria-invalid={hasError}\n />,\n tip,\n isDisabled,\n )}\n <FieldContent>\n {label && (\n <FieldLabel\n htmlFor={fieldId}\n className={cn('font-normal cursor-pointer', locked && 'items-center gap-1.5')}\n >\n {locked && <PermissionLockIcon reason={reason} className=\"size-3.5\" />}\n {label}\n </FieldLabel>\n )}\n\n {description && <FieldDescription id={`${fieldId}-description`}>{description}</FieldDescription>}\n\n {error && <FieldError id={`${fieldId}-error`}>{error}</FieldError>}\n </FieldContent>\n </Field>\n );\n },\n);\n\nCheckbox.displayName = 'Checkbox';\n"],"names":["React","ShadcnCheckbox"],"mappings":";;;;;;;;AAqBO,MAAM,WAAWA,cAAA,CAAM,UAAA;AAAA,EAC5B,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,KAAA,EAAO,WAAA,EAAa,UAAA,EAAY,EAAA,EAAI,GAAG,KAAA,EAAM,EAAG,GAAA,KAAQ;AAC7E,IAAA,MAAM,WAAA,GAAcA,eAAM,KAAA,EAAM;AAChC,IAAA,MAAM,UAAU,EAAA,IAAM,WAAA;AACtB,IAAA,MAAM,QAAA,GAAW,CAAC,CAAC,KAAA;AACnB,IAAA,MAAM,IAAA,GAAO,cAAc,UAAU,CAAA;AACrC,IAAA,MAAM,EAAE,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAO,GAAI,IAAA;AAGpC,IAAA,IAAI,CAAC,OAAA,EAAS;AACZ,MAAA,OAAO,IAAA;AAAA,IACT;AAGA,IAAA,MAAM,UAAA,GAAa,MAAM,QAAA,IAAY,MAAA;AACrC,IAAA,MAAM,GAAA,GAAM,MAAA,GAAS,SAAA,CAAU,IAAI,CAAA,GAAI,WAAA;AAGvC,IAAA,IAAI,CAAC,KAAA,IAAS,CAAC,WAAA,IAAe,CAAC,KAAA,EAAO;AACpC,MAAA,OAAO,eAAA;AAAA,wBACL,GAAA,CAACC,cAAgB,GAAG,KAAA,EAAO,KAAU,EAAA,EAAI,OAAA,EAAS,UAAU,UAAA,EAAY,CAAA;AAAA,QACxE,GAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAEA,IAAA,4BACG,KAAA,EAAA,EAAM,WAAA,EAAY,cAAa,eAAA,EAAe,UAAA,EAAY,gBAAc,QAAA,EACtE,QAAA,EAAA;AAAA,MAAA,eAAA;AAAA,wBACC,GAAA;AAAA,UAACA,UAAA;AAAA,UAAA;AAAA,YACE,GAAG,KAAA;AAAA,YACJ,GAAA;AAAA,YACA,EAAA,EAAI,OAAA;AAAA,YACJ,QAAA,EAAU,UAAA;AAAA,YACV,oBAAkB,WAAA,IAAe,KAAA,GAAQ,GAAG,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,MAAA,CAAA,GAAW,MAAA;AAAA,YACrF,cAAA,EAAc;AAAA;AAAA,SAChB;AAAA,QACA,GAAA;AAAA,QACA;AAAA,OACF;AAAA,2BACC,YAAA,EAAA,EACE,QAAA,EAAA;AAAA,QAAA,KAAA,oBACC,IAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,OAAA,EAAS,OAAA;AAAA,YACT,SAAA,EAAW,EAAA,CAAG,4BAAA,EAA8B,MAAA,IAAU,sBAAsB,CAAA;AAAA,YAE3E,QAAA,EAAA;AAAA,cAAA,MAAA,oBAAU,GAAA,CAAC,kBAAA,EAAA,EAAmB,MAAA,EAAgB,SAAA,EAAU,UAAA,EAAW,CAAA;AAAA,cACnE;AAAA;AAAA;AAAA,SACH;AAAA,QAGD,+BAAe,GAAA,CAAC,gBAAA,EAAA,EAAiB,IAAI,CAAA,EAAG,OAAO,gBAAiB,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,QAE5E,yBAAS,GAAA,CAAC,UAAA,EAAA,EAAW,IAAI,CAAA,EAAG,OAAO,UAAW,QAAA,EAAA,KAAA,EAAM;AAAA,OAAA,EACvD;AAAA,KAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEA,QAAA,CAAS,WAAA,GAAc,UAAA;;;;"}
package/dist/Checkbox2.js CHANGED
@@ -3,8 +3,8 @@ import * as React from 'react';
3
3
  import { u as useComposedRefs } from './index12.js';
4
4
  import { P as Presence, c as createContextScope } from './index21.js';
5
5
  import { P as Primitive, u as useControllableState, c as composeEventHandlers } from './index20.js';
6
- import { u as usePrevious } from './index35.js';
7
- import { u as useSize } from './index36.js';
6
+ import { u as usePrevious } from './index34.js';
7
+ import { u as useSize } from './index29.js';
8
8
  import { c as cn } from './utils.js';
9
9
  import { C as Check } from './check.js';
10
10
 
@@ -2,7 +2,9 @@ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import React__default, { useCallback, useMemo } from 'react';
3
3
  import { h as FieldSet, f as FieldLegend, b as FieldDescription, c as FieldError, F as Field, a as FieldContent, e as FieldLabel } from './field.js';
4
4
  import { c as cn } from './utils.js';
5
+ import { w as withDisabledTip } from './disabledTip.js';
5
6
  import { B as Button } from './Button.js';
7
+ import { c as usePermission, b as PermissionLockIcon, l as lockedTip } from './PermissionGate.js';
6
8
  import { C as CheckCheck } from './check-check.js';
7
9
  import { X } from './x.js';
8
10
  import { C as Checkbox } from './Checkbox2.js';
@@ -18,7 +20,8 @@ const CheckboxGroup = React__default.forwardRef(
18
20
  error,
19
21
  orientation = "vertical",
20
22
  columns,
21
- disabled,
23
+ disabled: disabledProp,
24
+ permission,
22
25
  clearable = false,
23
26
  className,
24
27
  name: _name,
@@ -27,6 +30,9 @@ const CheckboxGroup = React__default.forwardRef(
27
30
  }, ref) => {
28
31
  const groupId = React__default.useId();
29
32
  const hasError = !!error;
33
+ const gate = usePermission(permission);
34
+ const { granted, locked, reason } = gate;
35
+ const disabled = disabledProp || locked;
30
36
  const [internalValue, setInternalValue] = React__default.useState(defaultValue ?? []);
31
37
  const isControlled = controlledValue !== void 0;
32
38
  const currentValue = isControlled ? controlledValue : internalValue;
@@ -115,13 +121,24 @@ const CheckboxGroup = React__default.forwardRef(
115
121
  columns ? `grid gap-3` : orientation === "horizontal" ? "flex flex-row flex-wrap gap-4" : "flex flex-col gap-3"
116
122
  );
117
123
  const groupStyle = columns ? { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` } : void 0;
124
+ if (!granted) {
125
+ return null;
126
+ }
118
127
  return /* @__PURE__ */ jsxs(FieldSet, { ref, "data-invalid": hasError || void 0, className, ...props, children: [
119
128
  label ? /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-4", children: [
120
- /* @__PURE__ */ jsx(FieldLegend, { variant: "label", children: label }),
129
+ /* @__PURE__ */ jsxs(FieldLegend, { variant: "label", className: cn(locked && "flex items-center gap-1.5"), children: [
130
+ locked && /* @__PURE__ */ jsx(PermissionLockIcon, { reason, className: "size-3.5" }),
131
+ label
132
+ ] }),
121
133
  headerActions
122
134
  ] }) : headerActions && /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: headerActions }),
123
135
  description && !error && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
124
- /* @__PURE__ */ jsx("div", { className: groupClassName, style: groupStyle, children: options.map(renderItem) }),
136
+ withDisabledTip(
137
+ /* @__PURE__ */ jsx("div", { className: groupClassName, style: groupStyle, children: options.map(renderItem) }),
138
+ locked ? lockedTip(gate) : void 0,
139
+ disabled,
140
+ "block w-full"
141
+ ),
125
142
  error && /* @__PURE__ */ jsx(FieldError, { children: error })
126
143
  ] });
127
144
  }
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.js","sources":["../lib/components/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import { CheckCheck, X } from 'lucide-react';\nimport React, { useCallback, useMemo } from 'react';\nimport { Checkbox as ShadcnCheckbox } from '../../../shadcn/shadcnCheckbox';\nimport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldLabel,\n FieldLegend,\n FieldSet,\n} from '../../../shadcn/shadcnField';\nimport { cn } from '../../../shadcn/utils';\nimport { Button } from '../Button';\n\nexport interface CheckboxOption {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface CheckboxGroupProps {\n options: CheckboxOption[];\n value?: string[];\n onValueChange?: (value: string[]) => void;\n defaultValue?: string[];\n label?: React.ReactNode;\n description?: React.ReactNode;\n error?: string;\n orientation?: 'vertical' | 'horizontal';\n columns?: number;\n disabled?: boolean;\n clearable?: boolean;\n className?: string;\n name?: string;\n onBlur?: () => void;\n}\n\n// CheckboxGroup component for multi-select with Field system integration\nexport const CheckboxGroup = React.forwardRef<HTMLFieldSetElement, CheckboxGroupProps>(\n (\n {\n options,\n value: controlledValue,\n onValueChange,\n defaultValue,\n label,\n description,\n error,\n orientation = 'vertical',\n columns,\n disabled,\n clearable = false,\n className,\n name: _name,\n onBlur,\n ...props\n },\n ref,\n ) => {\n const groupId = React.useId();\n const hasError = !!error;\n\n // Internal state for uncontrolled mode\n const [internalValue, setInternalValue] = React.useState<string[]>(defaultValue ?? []);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n\n // Commit a new selection array through the shared controlled/uncontrolled path\n const commitValue = useCallback(\n (next: string[]) => {\n if (!isControlled) {\n setInternalValue(next);\n }\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n // Toggle a value in/out of the selection array\n const handleToggle = useCallback(\n (optionValue: string, checked: boolean) => {\n const next = checked ? [...currentValue, optionValue] : currentValue.filter((v) => v !== optionValue);\n commitValue(next);\n },\n [currentValue, commitValue],\n );\n\n // Values of every option that can be selected (excludes individually disabled options)\n const selectableValues = useMemo(\n () => options.filter((option) => !option.disabled).map((option) => option.value),\n [options],\n );\n\n // Header action state: all selectable already chosen / nothing chosen\n const allSelected = selectableValues.length > 0 && selectableValues.every((v) => currentValue.includes(v));\n const noneSelected = currentValue.length === 0;\n\n // Select every non-disabled option's value\n const handleSelectAll = useCallback(() => {\n commitValue(selectableValues);\n }, [commitValue, selectableValues]);\n\n // Empty the selection\n const handleClear = useCallback(() => {\n commitValue([]);\n }, [commitValue]);\n\n // Inline \"Select all\" / \"Clear\" actions shown when clearable and the group is not disabled\n const showActions = clearable && !disabled;\n const headerActions = showActions ? (\n <div className=\"-mr-1 flex items-center gap-0.5\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleSelectAll}\n disabled={allSelected}\n className=\"h-7 gap-1.5 px-2 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n <CheckCheck className=\"size-3.5\" />\n Select all\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleClear}\n disabled={noneSelected}\n className=\"h-7 gap-1.5 px-2 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n <X className=\"size-3.5\" />\n Clear\n </Button>\n </div>\n ) : null;\n\n // Render a single checkbox option with label and optional description\n const renderItem = (option: CheckboxOption) => {\n const itemId = `${groupId}-${option.value}`;\n const isItemDisabled = disabled || option.disabled;\n\n return (\n <Field key={option.value} orientation=\"horizontal\" data-disabled={isItemDisabled || undefined}>\n <ShadcnCheckbox\n checked={currentValue.includes(option.value)}\n onCheckedChange={(checked) => handleToggle(option.value, checked === true)}\n disabled={isItemDisabled}\n id={itemId}\n onBlur={onBlur}\n />\n <FieldContent>\n <FieldLabel htmlFor={itemId} className=\"font-normal cursor-pointer\">\n {option.label}\n </FieldLabel>\n {option.description && <FieldDescription>{option.description}</FieldDescription>}\n </FieldContent>\n </Field>\n );\n };\n\n // Compute layout classes based on columns or orientation\n const groupClassName = cn(\n columns ? `grid gap-3` : orientation === 'horizontal' ? 'flex flex-row flex-wrap gap-4' : 'flex flex-col gap-3',\n );\n\n // Dynamic grid-cols style when columns prop is provided\n const groupStyle = columns ? { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` } : undefined;\n\n return (\n <FieldSet ref={ref} data-invalid={hasError || undefined} className={className} {...props}>\n {label ? (\n <div className=\"flex items-center justify-between gap-4\">\n <FieldLegend variant=\"label\">{label}</FieldLegend>\n {headerActions}\n </div>\n ) : (\n headerActions && <div className=\"flex justify-end\">{headerActions}</div>\n )}\n {description && !error && <FieldDescription>{description}</FieldDescription>}\n <div className={groupClassName} style={groupStyle}>\n {options.map(renderItem)}\n </div>\n {error && <FieldError>{error}</FieldError>}\n </FieldSet>\n );\n },\n);\n\nCheckboxGroup.displayName = 'CheckboxGroup';\n"],"names":["React","ShadcnCheckbox"],"mappings":";;;;;;;;;AAwCO,MAAM,gBAAgBA,cA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AO,KAcnB,CAAA;AAAA,IAEJ,CAAA;AAGA,IAAA,MAAM,cAAA,GAAiB,EAAA;AAAA,MACrB,OAAA,GAAU,CAAA,UAAA,CAAA,GAAe,WAAA,KAAgB,YAAA,GAAe,+BAAA,GAAkC;AAAA,KAC5F;AAGA,IAAA,MAAM,aAAa,OAAA,GAAU,EAAE,qBAAqB,CAAA,OAAA,EAAU,OAAO,qBAAoB,GAAI,MAAA;AAE7F,IAAA,uBACE,IAAA,CAAC,YAAS,GAAA,EAAU,cAAA,EAAc,YAAY,MAAA,EAAW,SAAA,EAAuB,GAAG,KAAA,EAChF,QAAA,EAAA;AAAA,MAAA,KAAA,mBACC,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,yCAAA,EACb,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,WAAA,EAAA,EAAY,OAAA,EAAQ,OAAA,EAAS,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,QACnC;AAAA,OAAA,EACH,IAEA,aAAA,oBAAiB,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,oBAAoB,QAAA,EAAA,aAAA,EAAc,CAAA;AAAA,MAEnE,WAAA,IAAe,CAAC,KAAA,oBAAS,GAAA,CAAC,oBAAkB,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,sBACzD,GAAA,CAAC,SAAI,SAAA,EAAW,cAAA,EAAgB,OAAO,UAAA,EACpC,QAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,UAAU,CAAA,EACzB,CAAA;AAAA,MACC,KAAA,oBAAS,GAAA,CAAC,UAAA,EAAA,EAAY,QAAA,EAAA,KAAA,EAAM;AAAA,KAAA,EAC/B,CAAA;AAAA,EAEJ;AACF;AAEA,aAAA,CAAc,WAAA,GAAc,eAAA;;;;"}
1
+ {"version":3,"file":"CheckboxGroup.js","sources":["../lib/components/CheckboxGroup/CheckboxGroup.tsx"],"sourcesContent":["import { CheckCheck, X } from 'lucide-react';\nimport React, { useCallback, useMemo } from 'react';\nimport { Checkbox as ShadcnCheckbox } from '../../../shadcn/shadcnCheckbox';\nimport {\n Field,\n FieldContent,\n FieldDescription,\n FieldError,\n FieldLabel,\n FieldLegend,\n FieldSet,\n} from '../../../shadcn/shadcnField';\nimport { cn } from '../../../shadcn/utils';\nimport { withDisabledTip } from '../../utils/disabledTip';\nimport { Button } from '../Button';\nimport { lockedTip, PermissionLockIcon, usePermission } from '../PermissionGate';\n\nexport interface CheckboxOption {\n value: string;\n label: React.ReactNode;\n description?: React.ReactNode;\n disabled?: boolean;\n}\n\nexport interface CheckboxGroupProps {\n options: CheckboxOption[];\n value?: string[];\n onValueChange?: (value: string[]) => void;\n defaultValue?: string[];\n label?: React.ReactNode;\n description?: React.ReactNode;\n error?: string;\n orientation?: 'vertical' | 'horizontal';\n columns?: number;\n disabled?: boolean;\n clearable?: boolean;\n className?: string;\n name?: string;\n onBlur?: () => void;\n /** Permission code gating this field: hidden when not granted, disabled with a lock + upsell tip when locked */\n permission?: string;\n}\n\n// CheckboxGroup component for multi-select with Field system integration\nexport const CheckboxGroup = React.forwardRef<HTMLFieldSetElement, CheckboxGroupProps>(\n (\n {\n options,\n value: controlledValue,\n onValueChange,\n defaultValue,\n label,\n description,\n error,\n orientation = 'vertical',\n columns,\n disabled: disabledProp,\n permission,\n clearable = false,\n className,\n name: _name,\n onBlur,\n ...props\n },\n ref,\n ) => {\n const groupId = React.useId();\n const hasError = !!error;\n const gate = usePermission(permission);\n const { granted, locked, reason } = gate;\n // enable = role ∧ plan ∧ BU: granted but locked renders disabled with the upsell as its tooltip\n const disabled = disabledProp || locked;\n\n // Internal state for uncontrolled mode\n const [internalValue, setInternalValue] = React.useState<string[]>(defaultValue ?? []);\n const isControlled = controlledValue !== undefined;\n const currentValue = isControlled ? controlledValue : internalValue;\n\n // Commit a new selection array through the shared controlled/uncontrolled path\n const commitValue = useCallback(\n (next: string[]) => {\n if (!isControlled) {\n setInternalValue(next);\n }\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n // Toggle a value in/out of the selection array\n const handleToggle = useCallback(\n (optionValue: string, checked: boolean) => {\n const next = checked ? [...currentValue, optionValue] : currentValue.filter((v) => v !== optionValue);\n commitValue(next);\n },\n [currentValue, commitValue],\n );\n\n // Values of every option that can be selected (excludes individually disabled options)\n const selectableValues = useMemo(\n () => options.filter((option) => !option.disabled).map((option) => option.value),\n [options],\n );\n\n // Header action state: all selectable already chosen / nothing chosen\n const allSelected = selectableValues.length > 0 && selectableValues.every((v) => currentValue.includes(v));\n const noneSelected = currentValue.length === 0;\n\n // Select every non-disabled option's value\n const handleSelectAll = useCallback(() => {\n commitValue(selectableValues);\n }, [commitValue, selectableValues]);\n\n // Empty the selection\n const handleClear = useCallback(() => {\n commitValue([]);\n }, [commitValue]);\n\n // Inline \"Select all\" / \"Clear\" actions shown when clearable and the group is not disabled\n const showActions = clearable && !disabled;\n const headerActions = showActions ? (\n <div className=\"-mr-1 flex items-center gap-0.5\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleSelectAll}\n disabled={allSelected}\n className=\"h-7 gap-1.5 px-2 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n <CheckCheck className=\"size-3.5\" />\n Select all\n </Button>\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n onClick={handleClear}\n disabled={noneSelected}\n className=\"h-7 gap-1.5 px-2 text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n <X className=\"size-3.5\" />\n Clear\n </Button>\n </div>\n ) : null;\n\n // Render a single checkbox option with label and optional description\n const renderItem = (option: CheckboxOption) => {\n const itemId = `${groupId}-${option.value}`;\n const isItemDisabled = disabled || option.disabled;\n\n return (\n <Field key={option.value} orientation=\"horizontal\" data-disabled={isItemDisabled || undefined}>\n <ShadcnCheckbox\n checked={currentValue.includes(option.value)}\n onCheckedChange={(checked) => handleToggle(option.value, checked === true)}\n disabled={isItemDisabled}\n id={itemId}\n onBlur={onBlur}\n />\n <FieldContent>\n <FieldLabel htmlFor={itemId} className=\"font-normal cursor-pointer\">\n {option.label}\n </FieldLabel>\n {option.description && <FieldDescription>{option.description}</FieldDescription>}\n </FieldContent>\n </Field>\n );\n };\n\n // Compute layout classes based on columns or orientation\n const groupClassName = cn(\n columns ? `grid gap-3` : orientation === 'horizontal' ? 'flex flex-row flex-wrap gap-4' : 'flex flex-col gap-3',\n );\n\n // Dynamic grid-cols style when columns prop is provided\n const groupStyle = columns ? { gridTemplateColumns: `repeat(${columns}, minmax(0, 1fr))` } : undefined;\n\n // render = role: the role doesn't grant this field, so it doesn't exist for this user\n if (!granted) {\n return null;\n }\n\n return (\n <FieldSet ref={ref} data-invalid={hasError || undefined} className={className} {...props}>\n {label ? (\n <div className=\"flex items-center justify-between gap-4\">\n <FieldLegend variant=\"label\" className={cn(locked && 'flex items-center gap-1.5')}>\n {locked && <PermissionLockIcon reason={reason} className=\"size-3.5\" />}\n {label}\n </FieldLegend>\n {headerActions}\n </div>\n ) : (\n headerActions && <div className=\"flex justify-end\">{headerActions}</div>\n )}\n {description && !error && <FieldDescription>{description}</FieldDescription>}\n {withDisabledTip(\n <div className={groupClassName} style={groupStyle}>\n {options.map(renderItem)}\n </div>,\n locked ? lockedTip(gate) : undefined,\n disabled,\n 'block w-full',\n )}\n {error && <FieldError>{error}</FieldError>}\n </FieldSet>\n );\n },\n);\n\nCheckboxGroup.displayName = 'CheckboxGroup';\n"],"names":["React","ShadcnCheckbox"],"mappings":";;;;;;;;;;;AA4CO,MAAM,gBAAgBA,cAAA,CAAM,UAAA;AAAA,EACjC,CACE;AAAA,IACE,OAAA;AAAA,IACA,KAAA,EAAO,eAAA;AAAA,IACP,aAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,WAAA,GAAc,UAAA;AAAA,IACd,OAAA;AAAA,IACA,QAAA,EAAU,YAAA;AAAA,IACV,UAAA;AAAA,IACA,SAAA,GAAY,KAAA;AA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,UAAA,EAAA,EAAY,QAAA,EAAA,KAAA,EAAM;AAAA,KAAA,EAC/B,CAAA;AAAA,EAEJ;AACF;AAEA,aAAA,CAAc,WAAA,GAAc,eAAA;;;;"}
@@ -4,6 +4,7 @@ import { F as Field, e as FieldLabel, a as FieldContent, b as FieldDescription,
4
4
  import { c as cn } from './utils.js';
5
5
  import { C as CURRENCIES } from './currencies.js';
6
6
  import { getCurrencyExponent } from './utils/currency.js';
7
+ import { c as usePermission, l as lockedTip, b as PermissionLockIcon } from './PermissionGate.js';
7
8
  import { S as Select } from './Select.js';
8
9
  import { C as ChevronDown } from './chevron-down.js';
9
10
  import { T as TooltipProvider, a as Tooltip, b as TooltipTrigger, c as TooltipContent } from './tooltip2.js';
@@ -36,14 +37,19 @@ const CurrencyField = React__default.forwardRef(
36
37
  label,
37
38
  description,
38
39
  error,
39
- disabled,
40
+ disabled: disabledProp,
40
41
  disabledTip,
41
42
  placeholder,
42
43
  className,
43
- required
44
+ required,
45
+ permission
44
46
  }, ref) => {
45
47
  const fieldId = React__default.useId();
46
48
  const hasError = !!error;
49
+ const gate = usePermission(permission);
50
+ const { granted, locked, reason } = gate;
51
+ const disabled = disabledProp || locked;
52
+ const tip = locked ? lockedTip(gate) : disabledTip;
47
53
  const isLocked = !!currencyCode || currencies?.length === 1;
48
54
  const options = React__default.useMemo(() => currencyOptions(currencies), [currencies]);
49
55
  const fallbackCurrency = currencies && currencies.length > 0 && !currencies.includes(defaultCurrencyCode) ? currencies[0] : defaultCurrencyCode;
@@ -113,8 +119,14 @@ const CurrencyField = React__default.forwardRef(
113
119
  emit(currency, snapped);
114
120
  }
115
121
  }, [amount, currency, decimals, emit]);
122
+ if (!granted) {
123
+ return null;
124
+ }
116
125
  const field = /* @__PURE__ */ jsxs(Field, { "data-disabled": disabled, children: [
117
- label && /* @__PURE__ */ jsx(FieldLabel, { htmlFor: fieldId, children: label }),
126
+ label && /* @__PURE__ */ jsxs(FieldLabel, { htmlFor: fieldId, className: cn(locked && "items-center gap-1.5"), children: [
127
+ locked && /* @__PURE__ */ jsx(PermissionLockIcon, { reason, className: "size-3.5" }),
128
+ label
129
+ ] }),
118
130
  /* @__PURE__ */ jsxs(FieldContent, { children: [
119
131
  /* @__PURE__ */ jsxs(
120
132
  "div",
@@ -203,12 +215,12 @@ const CurrencyField = React__default.forwardRef(
203
215
  error && /* @__PURE__ */ jsx(FieldError, { id: `${fieldId}-error`, children: error })
204
216
  ] })
205
217
  ] });
206
- if (!disabledTip || !disabled) {
218
+ if (!tip || !disabled) {
207
219
  return field;
208
220
  }
209
221
  return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsxs(Tooltip, { children: [
210
222
  /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx("span", { className: "inline-flex w-full cursor-not-allowed", children: field }) }),
211
- /* @__PURE__ */ jsx(TooltipContent, { children: disabledTip })
223
+ /* @__PURE__ */ jsx(TooltipContent, { children: tip })
212
224
  ] }) });
213
225
  }
214
226
  );
@@ -1 +1 @@
1
- {"version":3,"file":"CurrencyField.js","sources":["../lib/components/CurrencyField/CurrencyField.tsx"],"sourcesContent":["import { ChevronDown } from 'lucide-react';\nimport React from 'react';\nimport { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../../../shadcn/shadcnField';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../../shadcn/shadcnTooltip';\nimport { cn } from '../../../shadcn/utils';\nimport { CURRENCIES } from '../../selects/currency/currencies';\nimport { type CurrencyValue, getCurrencyExponent } from '../../utils/currency';\nimport { Select, type SelectOption, type SelectValue } from '../Select';\n\nexport interface CurrencyFieldProps {\n name?: string;\n\n value?: CurrencyValue;\n\n onChange?: (value: CurrencyValue) => void;\n\n currencyCode?: string;\n\n currencies?: string[];\n\n defaultCurrencyCode?: string;\n\n label?: React.ReactNode;\n\n description?: React.ReactNode;\n\n error?: React.ReactNode;\n\n disabled?: boolean;\n\n disabledTip?: string;\n\n placeholder?: string;\n\n className?: string;\n\n required?: boolean;\n}\n\n// Truncates an amount string to at most `decimals` fractional digits\nfunction truncateDecimals(amount: string, decimals: number): string {\n if (amount === '') return amount;\n if (!Number.isFinite(Number(amount))) return amount;\n const [whole, fraction] = amount.split('.');\n if (decimals === 0) return whole ?? '';\n if (fraction === undefined) return amount;\n if (fraction.length <= decimals) return amount;\n return `${whole}.${fraction.slice(0, decimals)}`;\n}\n\n// Returns the `step` attribute for an input given a currency exponent\nfunction stepForDecimals(decimals: number): string {\n if (decimals <= 0) return '1';\n return `0.${'0'.repeat(decimals - 1)}1`;\n}\n\n// The selectable currencies, in the caller's order; a code missing from the ISO list still appears as itself\nfunction currencyOptions(currencies?: string[]): SelectOption[] {\n if (!currencies) return CURRENCIES;\n return currencies.map((code) => CURRENCIES.find((option) => option.value === code) ?? { value: code, label: code });\n}\n\n// Currency-aware money input combining a currency selector with an exponent-aware amount input\nexport const CurrencyField = React.forwardRef<HTMLInputElement, CurrencyFieldProps>(\n (\n {\n name: _name,\n value,\n onChange,\n currencyCode,\n currencies,\n defaultCurrencyCode = 'USD',\n label,\n description,\n error,\n disabled,\n disabledTip,\n placeholder,\n className,\n required,\n },\n ref,\n ) => {\n const fieldId = React.useId();\n const hasError = !!error;\n const isLocked = !!currencyCode || currencies?.length === 1;\n const options = React.useMemo(() => currencyOptions(currencies), [currencies]);\n const fallbackCurrency =\n currencies && currencies.length > 0 && !currencies.includes(defaultCurrencyCode)\n ? currencies[0]\n : defaultCurrencyCode;\n\n const initialCurrency = value?.currency ?? currencyCode ?? fallbackCurrency ?? 'USD';\n const [currency, setCurrency] = React.useState<string>(initialCurrency);\n const [amount, setAmount] = React.useState<string>(value?.value ?? '');\n\n // Sync with external controlled value changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitting internal state to avoid feedback loops\n React.useEffect(() => {\n if (value?.currency !== undefined && value.currency !== currency) {\n setCurrency(value.currency);\n }\n if (value?.value !== undefined && value.value !== amount) {\n setAmount(value.value);\n }\n }, [value?.currency, value?.value]);\n\n // If currencyCode prop changes while locked, reflect it\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitting internal state to avoid feedback loops\n React.useEffect(() => {\n if (currencyCode && currencyCode !== currency) {\n setCurrency(currencyCode);\n }\n }, [currencyCode]);\n\n // A narrowed list that no longer holds the current currency moves it to the first one allowed\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitting internal state to avoid feedback loops\n React.useEffect(() => {\n if (!currencyCode && currencies && currencies.length > 0 && !currencies.includes(currency)) {\n setCurrency(currencies[0]);\n }\n }, [currencyCode, currencies?.join(',')]);\n\n const decimals = getCurrencyExponent(currency);\n const step = stepForDecimals(decimals);\n\n const emit = React.useCallback(\n (nextCurrency: string, nextAmount: string) => {\n onChange?.({ currency: nextCurrency, value: nextAmount });\n },\n [onChange],\n );\n\n const handleCurrencyChange = React.useCallback(\n (nextValue: SelectValue) => {\n if (nextValue == null) return;\n const nextCurrency = String(nextValue);\n const nextDecimals = getCurrencyExponent(nextCurrency);\n const truncated = truncateDecimals(amount, nextDecimals);\n setCurrency(nextCurrency);\n if (truncated !== amount) setAmount(truncated);\n emit(nextCurrency, truncated);\n },\n [amount, emit],\n );\n\n const handleAmountChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const raw = event.target.value;\n // Allow empty, digits, and a single decimal separator; cap fractional digits\n if (raw === '') {\n setAmount('');\n emit(currency, '');\n return;\n }\n // Strict numeric pattern -- reject anything else silently\n if (!/^\\d*\\.?\\d*$/.test(raw)) return;\n const truncated = truncateDecimals(raw, decimals);\n setAmount(truncated);\n emit(currency, truncated);\n },\n [currency, decimals, emit],\n );\n\n const handleAmountBlur = React.useCallback(() => {\n if (amount === '' || amount === '.') return;\n const parsed = Number(amount);\n if (!Number.isFinite(parsed)) return;\n const snapped = parsed.toFixed(decimals);\n if (snapped !== amount) {\n setAmount(snapped);\n emit(currency, snapped);\n }\n }, [amount, currency, decimals, emit]);\n\n const field = (\n <Field data-disabled={disabled}>\n {label && <FieldLabel htmlFor={fieldId}>{label}</FieldLabel>}\n\n <FieldContent>\n <div\n className={cn(\n 'flex h-9 w-full items-stretch rounded-md border border-input bg-transparent dark:bg-input/30 shadow-xs transition-[color,box-shadow]',\n 'focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[1px]',\n disabled && 'opacity-50 cursor-not-allowed pointer-events-none',\n hasError && 'border-destructive focus-within:ring-destructive/20 dark:focus-within:ring-destructive/40',\n className,\n )}\n >\n {isLocked ? (\n <span\n role=\"img\"\n aria-label={`Currency ${currency}`}\n className=\"flex items-center justify-center border-r border-input px-3 text-sm font-medium text-muted-foreground select-none\"\n >\n {currency}\n </span>\n ) : (\n <div className=\"flex items-center border-r border-input\">\n <Select\n options={options}\n searchable\n placeholder=\"Select currency\"\n value={currency}\n onChange={handleCurrencyChange}\n disabled={disabled}\n clearable={false}\n label=\"\"\n contentClassName=\"min-w-[280px] w-auto\"\n anchor={({ selectedOption, open, disabled: anchorDisabled }) => (\n <button\n type=\"button\"\n disabled={anchorDisabled}\n aria-label=\"Select currency\"\n aria-expanded={open}\n className={cn(\n 'flex h-full items-center gap-1 px-3 text-sm font-medium text-foreground outline-none',\n 'hover:bg-accent/50 focus-visible:bg-accent/50',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n )}\n >\n <span>{selectedOption ? String(selectedOption.value) : currency}</span>\n <ChevronDown\n className={cn('size-3.5 text-muted-foreground transition-transform', open && 'rotate-180')}\n />\n </button>\n )}\n />\n </div>\n )}\n\n <input\n ref={ref}\n id={fieldId}\n type=\"text\"\n inputMode=\"decimal\"\n pattern=\"^[0-9]*\\.?[0-9]*$\"\n step={step}\n value={amount}\n onChange={handleAmountChange}\n onBlur={handleAmountBlur}\n disabled={disabled}\n required={required}\n placeholder={placeholder}\n aria-invalid={hasError}\n aria-describedby={description || error ? `${fieldId}-description ${fieldId}-error` : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent px-3 py-1 text-sm outline-none',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n )}\n />\n </div>\n\n {description && !error && <FieldDescription id={`${fieldId}-description`}>{description}</FieldDescription>}\n {error && <FieldError id={`${fieldId}-error`}>{error}</FieldError>}\n </FieldContent>\n </Field>\n );\n\n if (!disabledTip || !disabled) {\n return field;\n }\n\n return (\n <TooltipProvider>\n <Tooltip>\n {/* Disabled inputs don't emit hover/focus events, so the trigger lives on a wrapper. */}\n <TooltipTrigger asChild>\n <span className=\"inline-flex w-full cursor-not-allowed\">{field}</span>\n </TooltipTrigger>\n <TooltipContent>{disabledTip}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n },\n);\n\nCurrencyField.displayName = 'CurrencyField';\n"],"names":["React"],"mappings":";;;;;;;;;;AAwCA,SAAS,gBAAA,CAAiB,QAAgB,QAAA,EAA0B;AAClE,EAAA,IAAI,MAAA,KAAW,IAAI,OAAO,MAAA;AAC1B,EAAA,IAAI,CAAC,MAAA,CAAO,QAAA,CAAS,OAAO,MAAM,CAAC,GAAG,OAAO,MAAA;AAC7C,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,MAAA,CAAO,MAAM,GAAG,CAAA;AAC1C,EAAA,IAAI,QAAA,KAAa,CAAA,EAAG,OAAO,KAAA,IAAS,EAAA;AACpC,EAAA,IAAI,QAAA,KAAa,QAAW,OAAO,MAAA;AACnC,EAAA,IAAI,QAAA,CAAS,MAAA,IAAU,QAAA,EAAU,OAAO,MAAA;AACxC,EAAA,OAAO,GAAG,KAAK,CAAA,CAAA,EAAI,SAAS,KAAA,CAAM,CAAA,EAAG,QAAQ,CAAC,CAAA,CAAA;AAChD;AAGA,SAAS,gBAAgB,QAAA,EAA0B;AACjD,EAAA,IAAI,QAAA,IAAY,GAAG,OAAO,GAAA;AAC1B,EAAA,OAAO,CAAA,EAAA,EAAK,GAAA,CAAI,MAAA,CAAO,QAAA,GAAW,CAAC,CAAC,CAAA,CAAA,CAAA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;AAAA,kBACA,QAAA;AAAA,kBACA,WAAA;AAAA,kBACA,cAAA,EAAc,QAAA;AAAA,kBACd,oBAAkB,WAAA,IAAe,KAAA,GAAQ,GAAG,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,MAAA,CAAA,GAAW,MAAA;AAAA,kBACrF,SAAA,EAAW,EAAA;AAAA,oBACT,8DAAA;AAAA,oBACA,mCAAA;AAAA,oBACA;AAAA;AACF;AAAA;AACF;AAAA;AAAA,SACF;AAAA,QAEC,WAAA,IAAe,CAAC,KAAA,oBAAS,GAAA,CAAC,oBAAiB,EAAA,EAAI,CAAA,EAAG,OAAO,CAAA,YAAA,CAAA,EAAiB,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,QACtF,yBAAS,GAAA,CAAC,UAAA,EAAA,EAAW,IAAI,CAAA,EAAG,OAAO,UAAW,QAAA,EAAA,KAAA,EAAM;AAAA,OAAA,EACvD;AAAA,KAAA,EACF,CAAA;AAGF,IAAA,IAAI,CAAC,WAAA,IAAe,CAAC,QAAA,EAAU;AAC7B,MAAA,OAAO,KAAA;AAAA,IACT;AAEA,IAAA,uBACE,GAAA,CAAC,eAAA,EAAA,EACC,QAAA,kBAAA,IAAA,CAAC,OAAA,EAAA,EAEC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,cAAA,EAAA,EAAe,SAAO,IAAA,EACrB,QAAA,kBAAA,GAAA,CAAC,UAAK,SAAA,EAAU,uCAAA,EAAyC,iBAAM,CAAA,EACjE,CAAA;AAAA,sBACA,GAAA,CAAC,kBAAgB,QAAA,EAAA,WAAA,EAAY;AAAA,KAAA,EAC/B,CAAA,EACF,CAAA;AAAA,EAEJ;AACF;AAEA,aAAA,CAAc,WAAA,GAAc,eAAA;;;;"}
1
+ {"version":3,"file":"CurrencyField.js","sources":["../lib/components/CurrencyField/CurrencyField.tsx"],"sourcesContent":["import { ChevronDown } from 'lucide-react';\nimport React from 'react';\nimport { Field, FieldContent, FieldDescription, FieldError, FieldLabel } from '../../../shadcn/shadcnField';\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '../../../shadcn/shadcnTooltip';\nimport { cn } from '../../../shadcn/utils';\nimport { CURRENCIES } from '../../selects/currency/currencies';\nimport { type CurrencyValue, getCurrencyExponent } from '../../utils/currency';\nimport { lockedTip, PermissionLockIcon, usePermission } from '../PermissionGate';\nimport { Select, type SelectOption, type SelectValue } from '../Select';\n\nexport interface CurrencyFieldProps {\n name?: string;\n\n value?: CurrencyValue;\n\n onChange?: (value: CurrencyValue) => void;\n\n currencyCode?: string;\n\n currencies?: string[];\n\n defaultCurrencyCode?: string;\n\n label?: React.ReactNode;\n\n description?: React.ReactNode;\n\n error?: React.ReactNode;\n\n disabled?: boolean;\n\n disabledTip?: string;\n\n placeholder?: string;\n\n className?: string;\n\n required?: boolean;\n\n /** Permission code gating this field: hidden when not granted, disabled with a lock + upsell tip when locked */\n permission?: string;\n}\n\n// Truncates an amount string to at most `decimals` fractional digits\nfunction truncateDecimals(amount: string, decimals: number): string {\n if (amount === '') return amount;\n if (!Number.isFinite(Number(amount))) return amount;\n const [whole, fraction] = amount.split('.');\n if (decimals === 0) return whole ?? '';\n if (fraction === undefined) return amount;\n if (fraction.length <= decimals) return amount;\n return `${whole}.${fraction.slice(0, decimals)}`;\n}\n\n// Returns the `step` attribute for an input given a currency exponent\nfunction stepForDecimals(decimals: number): string {\n if (decimals <= 0) return '1';\n return `0.${'0'.repeat(decimals - 1)}1`;\n}\n\n// The selectable currencies, in the caller's order; a code missing from the ISO list still appears as itself\nfunction currencyOptions(currencies?: string[]): SelectOption[] {\n if (!currencies) return CURRENCIES;\n return currencies.map((code) => CURRENCIES.find((option) => option.value === code) ?? { value: code, label: code });\n}\n\n// Currency-aware money input combining a currency selector with an exponent-aware amount input\nexport const CurrencyField = React.forwardRef<HTMLInputElement, CurrencyFieldProps>(\n (\n {\n name: _name,\n value,\n onChange,\n currencyCode,\n currencies,\n defaultCurrencyCode = 'USD',\n label,\n description,\n error,\n disabled: disabledProp,\n disabledTip,\n placeholder,\n className,\n required,\n permission,\n },\n ref,\n ) => {\n const fieldId = React.useId();\n const hasError = !!error;\n const gate = usePermission(permission);\n const { granted, locked, reason } = gate;\n // enable = role ∧ plan ∧ BU: granted but locked renders disabled with the upsell as its tooltip\n const disabled = disabledProp || locked;\n const tip = locked ? lockedTip(gate) : disabledTip;\n const isLocked = !!currencyCode || currencies?.length === 1;\n const options = React.useMemo(() => currencyOptions(currencies), [currencies]);\n const fallbackCurrency =\n currencies && currencies.length > 0 && !currencies.includes(defaultCurrencyCode)\n ? currencies[0]\n : defaultCurrencyCode;\n\n const initialCurrency = value?.currency ?? currencyCode ?? fallbackCurrency ?? 'USD';\n const [currency, setCurrency] = React.useState<string>(initialCurrency);\n const [amount, setAmount] = React.useState<string>(value?.value ?? '');\n\n // Sync with external controlled value changes\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitting internal state to avoid feedback loops\n React.useEffect(() => {\n if (value?.currency !== undefined && value.currency !== currency) {\n setCurrency(value.currency);\n }\n if (value?.value !== undefined && value.value !== amount) {\n setAmount(value.value);\n }\n }, [value?.currency, value?.value]);\n\n // If currencyCode prop changes while locked, reflect it\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitting internal state to avoid feedback loops\n React.useEffect(() => {\n if (currencyCode && currencyCode !== currency) {\n setCurrency(currencyCode);\n }\n }, [currencyCode]);\n\n // A narrowed list that no longer holds the current currency moves it to the first one allowed\n // biome-ignore lint/correctness/useExhaustiveDependencies: intentionally omitting internal state to avoid feedback loops\n React.useEffect(() => {\n if (!currencyCode && currencies && currencies.length > 0 && !currencies.includes(currency)) {\n setCurrency(currencies[0]);\n }\n }, [currencyCode, currencies?.join(',')]);\n\n const decimals = getCurrencyExponent(currency);\n const step = stepForDecimals(decimals);\n\n const emit = React.useCallback(\n (nextCurrency: string, nextAmount: string) => {\n onChange?.({ currency: nextCurrency, value: nextAmount });\n },\n [onChange],\n );\n\n const handleCurrencyChange = React.useCallback(\n (nextValue: SelectValue) => {\n if (nextValue == null) return;\n const nextCurrency = String(nextValue);\n const nextDecimals = getCurrencyExponent(nextCurrency);\n const truncated = truncateDecimals(amount, nextDecimals);\n setCurrency(nextCurrency);\n if (truncated !== amount) setAmount(truncated);\n emit(nextCurrency, truncated);\n },\n [amount, emit],\n );\n\n const handleAmountChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const raw = event.target.value;\n // Allow empty, digits, and a single decimal separator; cap fractional digits\n if (raw === '') {\n setAmount('');\n emit(currency, '');\n return;\n }\n // Strict numeric pattern -- reject anything else silently\n if (!/^\\d*\\.?\\d*$/.test(raw)) return;\n const truncated = truncateDecimals(raw, decimals);\n setAmount(truncated);\n emit(currency, truncated);\n },\n [currency, decimals, emit],\n );\n\n const handleAmountBlur = React.useCallback(() => {\n if (amount === '' || amount === '.') return;\n const parsed = Number(amount);\n if (!Number.isFinite(parsed)) return;\n const snapped = parsed.toFixed(decimals);\n if (snapped !== amount) {\n setAmount(snapped);\n emit(currency, snapped);\n }\n }, [amount, currency, decimals, emit]);\n\n // render = role: the role doesn't grant this field, so it doesn't exist for this user\n if (!granted) {\n return null;\n }\n\n const field = (\n <Field data-disabled={disabled}>\n {label && (\n <FieldLabel htmlFor={fieldId} className={cn(locked && 'items-center gap-1.5')}>\n {locked && <PermissionLockIcon reason={reason} className=\"size-3.5\" />}\n {label}\n </FieldLabel>\n )}\n\n <FieldContent>\n <div\n className={cn(\n 'flex h-9 w-full items-stretch rounded-md border border-input bg-transparent dark:bg-input/30 shadow-xs transition-[color,box-shadow]',\n 'focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[1px]',\n disabled && 'opacity-50 cursor-not-allowed pointer-events-none',\n hasError && 'border-destructive focus-within:ring-destructive/20 dark:focus-within:ring-destructive/40',\n className,\n )}\n >\n {isLocked ? (\n <span\n role=\"img\"\n aria-label={`Currency ${currency}`}\n className=\"flex items-center justify-center border-r border-input px-3 text-sm font-medium text-muted-foreground select-none\"\n >\n {currency}\n </span>\n ) : (\n <div className=\"flex items-center border-r border-input\">\n <Select\n options={options}\n searchable\n placeholder=\"Select currency\"\n value={currency}\n onChange={handleCurrencyChange}\n disabled={disabled}\n clearable={false}\n label=\"\"\n contentClassName=\"min-w-[280px] w-auto\"\n anchor={({ selectedOption, open, disabled: anchorDisabled }) => (\n <button\n type=\"button\"\n disabled={anchorDisabled}\n aria-label=\"Select currency\"\n aria-expanded={open}\n className={cn(\n 'flex h-full items-center gap-1 px-3 text-sm font-medium text-foreground outline-none',\n 'hover:bg-accent/50 focus-visible:bg-accent/50',\n 'disabled:cursor-not-allowed disabled:opacity-50',\n )}\n >\n <span>{selectedOption ? String(selectedOption.value) : currency}</span>\n <ChevronDown\n className={cn('size-3.5 text-muted-foreground transition-transform', open && 'rotate-180')}\n />\n </button>\n )}\n />\n </div>\n )}\n\n <input\n ref={ref}\n id={fieldId}\n type=\"text\"\n inputMode=\"decimal\"\n pattern=\"^[0-9]*\\.?[0-9]*$\"\n step={step}\n value={amount}\n onChange={handleAmountChange}\n onBlur={handleAmountBlur}\n disabled={disabled}\n required={required}\n placeholder={placeholder}\n aria-invalid={hasError}\n aria-describedby={description || error ? `${fieldId}-description ${fieldId}-error` : undefined}\n className={cn(\n 'flex-1 min-w-0 bg-transparent px-3 py-1 text-sm outline-none',\n 'placeholder:text-muted-foreground',\n 'disabled:cursor-not-allowed',\n )}\n />\n </div>\n\n {description && !error && <FieldDescription id={`${fieldId}-description`}>{description}</FieldDescription>}\n {error && <FieldError id={`${fieldId}-error`}>{error}</FieldError>}\n </FieldContent>\n </Field>\n );\n\n if (!tip || !disabled) {\n return field;\n }\n\n return (\n <TooltipProvider>\n <Tooltip>\n {/* Disabled inputs don't emit hover/focus events, so the trigger lives on a wrapper. */}\n <TooltipTrigger asChild>\n <span className=\"inline-flex w-full cursor-not-allowed\">{field}</span>\n </TooltipTrigger>\n <TooltipContent>{tip}</TooltipContent>\n </Tooltip>\n </TooltipProvider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as Alert } from './Alert.js';
3
3
  import { B as Button } from './Button.js';
4
- import { u as usePermission } from './PermissionGate.js';
4
+ import { c as usePermission } from './PermissionGate.js';
5
5
  import { C as Card, d as CardHeader, e as CardTitle, a as CardContent } from './Card.js';
6
6
  import { T as TriangleAlert } from './triangle-alert.js';
7
7
  import { c as cn } from './utils.js';