@vritti/quantum-ui 0.5.8 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ActiveShapeUtils.js +1 -1
- package/dist/AreaChart.js +1 -1
- package/dist/Avatar.js +5 -5
- package/dist/BarChart.js +1 -1
- package/dist/Breadcrumb.js +3 -1
- package/dist/Breadcrumb.js.map +1 -1
- package/dist/Button.js +1 -1
- package/dist/CartesianChart.js +40 -2
- package/dist/CartesianChart.js.map +1 -1
- package/dist/Chart.js +7 -3
- package/dist/Chart.js.map +1 -1
- package/dist/Checkbox.js +30 -6
- package/dist/Checkbox.js.map +1 -1
- package/dist/Checkbox2.js +2 -2
- package/dist/CheckboxGroup.js +20 -3
- package/dist/CheckboxGroup.js.map +1 -1
- package/dist/{CurrencyField.js → CurrencyFieldFilter.js} +167 -11
- package/dist/CurrencyFieldFilter.js.map +1 -0
- package/dist/CurrencySelector.js.map +1 -1
- package/dist/DangerZoneSkeleton.js +1 -1
- package/dist/DatePicker.js +157 -124
- package/dist/DatePicker.js.map +1 -1
- package/dist/DateRangePicker.js +272 -130
- package/dist/DateRangePicker.js.map +1 -1
- package/dist/DateTimePicker.js +183 -165
- package/dist/DateTimePicker.js.map +1 -1
- package/dist/DateTimeRangePicker.js +189 -173
- package/dist/DateTimeRangePicker.js.map +1 -1
- package/dist/DetailSectionSkeleton.js +1 -1
- package/dist/Dialog.js +1 -1
- package/dist/DropdownMenu.js +1 -1
- package/dist/Form.js +2 -0
- package/dist/Form.js.map +1 -1
- package/dist/FormSection.js +22 -0
- package/dist/FormSection.js.map +1 -1
- package/dist/ISOCountrySelect.js.map +1 -1
- package/dist/IconSelect.js +259 -271
- package/dist/IconSelect.js.map +1 -1
- package/dist/Label.js +1 -1
- package/dist/LineChart.js +390 -9
- package/dist/LineChart.js.map +1 -1
- package/dist/LocaleSelector.js.map +1 -1
- package/dist/OTPField.js +39 -24
- package/dist/OTPField.js.map +1 -1
- package/dist/PermissionGate.js +25 -3
- package/dist/PermissionGate.js.map +1 -1
- package/dist/PhoneField.js +47 -30
- package/dist/PhoneField.js.map +1 -1
- package/dist/PieChart.js +14 -10
- package/dist/PieChart.js.map +1 -1
- package/dist/Progress.js +2 -2
- package/dist/RadarChart.js +1 -1
- package/dist/RadialChart.js +1 -1
- package/dist/RadioGroup.js +35 -18
- package/dist/RadioGroup.js.map +1 -1
- package/dist/RelativeDayStrip.js +83 -0
- package/dist/RelativeDayStrip.js.map +1 -0
- package/dist/Select.js +77 -40
- package/dist/Select.js.map +1 -1
- package/dist/SelectFilter.js +37 -15
- package/dist/SelectFilter.js.map +1 -1
- package/dist/Sidebar.js +1 -1
- package/dist/SingleSelect.js +50 -24
- package/dist/SingleSelect.js.map +1 -1
- package/dist/Switch.js +3 -3
- package/dist/TabsSkeleton.js +2 -2
- package/dist/TextArea.js +28 -12
- package/dist/TextArea.js.map +1 -1
- package/dist/TextField.js +70 -53
- package/dist/TextField.js.map +1 -1
- package/dist/TimezoneSelector.js.map +1 -1
- package/dist/Toggle.js +1 -1
- package/dist/UploadFile.js +22 -4
- package/dist/UploadFile.js.map +1 -1
- package/dist/assets/quantum-ui.css +84 -1
- package/dist/banknote.js +19 -0
- package/dist/banknote.js.map +1 -0
- package/dist/calendar2.js +1 -1
- package/dist/calendar2.js.map +1 -1
- package/dist/components/CurrencyField.js +1 -1
- package/dist/components/DateFilter.js +101 -0
- package/dist/components/DateFilter.js.map +1 -0
- package/dist/components/DateRangePicker.js +1 -1
- package/dist/components/FormattedDate.js +3 -3
- package/dist/components/FormattedDate.js.map +1 -1
- package/dist/components/PermissionGate.js +1 -1
- package/dist/components/RichTextEditor.js +1 -1
- package/dist/components/TokenInput.js +96 -66
- package/dist/components/TokenInput.js.map +1 -1
- package/dist/contextAnchor.js +11 -0
- package/dist/contextAnchor.js.map +1 -0
- package/dist/disabledTip.js +3 -2
- package/dist/disabledTip.js.map +1 -1
- package/dist/dropdown-menu.js +5 -5
- package/dist/getZIndexFromUnknown.js +1 -1
- package/dist/hooks/index.js +3 -2
- package/dist/hooks/index.js.map +1 -1
- package/dist/image-component.js +1 -1
- package/dist/index.js +7 -6
- package/dist/index.js.map +1 -1
- package/dist/index13.js +34 -5
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +4 -4
- package/dist/index15.js +20 -1139
- package/dist/index15.js.map +1 -1
- package/dist/index16.js +1139 -14
- package/dist/index16.js.map +1 -1
- package/dist/index17.js +14 -20
- package/dist/index17.js.map +1 -1
- package/dist/index20.js +2 -2
- package/dist/index21.js +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.js +1 -1
- package/dist/index25.js +4 -232
- package/dist/index25.js.map +1 -1
- package/dist/index26.js +202 -2506
- package/dist/index26.js.map +1 -1
- package/dist/index27.js +1120 -27
- package/dist/index27.js.map +1 -1
- package/dist/index28.js +2570 -3
- package/dist/index28.js.map +1 -1
- package/dist/index29.js +35 -1123
- package/dist/index29.js.map +1 -1
- package/dist/index30.js +308 -36
- package/dist/index30.js.map +1 -1
- package/dist/index31.js +7 -307
- package/dist/index31.js.map +1 -1
- package/dist/index32.js +30 -8
- package/dist/index32.js.map +1 -1
- package/dist/index33.js +59 -29
- package/dist/index33.js.map +1 -1
- package/dist/index34.js +10 -59
- package/dist/index34.js.map +1 -1
- package/dist/index35.js +35347 -9
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +79 -36
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +184 -35340
- package/dist/index37.js.map +1 -1
- package/dist/index5.js +1 -1
- package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts +2 -1
- package/dist/lib/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/lib/components/Checkbox/Checkbox.d.ts +1 -0
- package/dist/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts +1 -0
- package/dist/lib/components/CheckboxGroup/CheckboxGroup.d.ts.map +1 -1
- package/dist/lib/components/CurrencyField/CurrencyField.d.ts +1 -0
- package/dist/lib/components/CurrencyField/CurrencyField.d.ts.map +1 -1
- package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts +27 -0
- package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts.map +1 -0
- package/dist/lib/components/CurrencyField/index.d.ts +2 -0
- package/dist/lib/components/CurrencyField/index.d.ts.map +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/components/RowActions.d.ts +1 -0
- package/dist/lib/components/DataTable/components/RowActions.d.ts.map +1 -1
- package/dist/lib/components/DataTable/store/store.d.ts.map +1 -1
- package/dist/lib/components/DataTable/types.d.ts +1 -0
- package/dist/lib/components/DataTable/types.d.ts.map +1 -1
- package/dist/lib/components/DateFilter/DateFilter.d.ts +25 -0
- package/dist/lib/components/DateFilter/DateFilter.d.ts.map +1 -0
- package/dist/lib/components/DateFilter/index.d.ts +3 -0
- package/dist/lib/components/DateFilter/index.d.ts.map +1 -0
- package/dist/lib/components/DatePicker/DatePicker.d.ts +1 -0
- package/dist/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/lib/components/DatePicker/RelativeDayStrip.d.ts +28 -0
- package/dist/lib/components/DatePicker/RelativeDayStrip.d.ts.map +1 -0
- package/dist/lib/components/DateRangePicker/DateRangeFilter.d.ts +28 -0
- package/dist/lib/components/DateRangePicker/DateRangeFilter.d.ts.map +1 -0
- package/dist/lib/components/DateRangePicker/DateRangePicker.d.ts +1 -0
- package/dist/lib/components/DateRangePicker/DateRangePicker.d.ts.map +1 -1
- package/dist/lib/components/DateRangePicker/index.d.ts +2 -0
- package/dist/lib/components/DateRangePicker/index.d.ts.map +1 -1
- package/dist/lib/components/DateTimePicker/DateTimePicker.d.ts +1 -0
- package/dist/lib/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/lib/components/DateTimeRangePicker/DateTimeRangePicker.d.ts +1 -0
- package/dist/lib/components/DateTimeRangePicker/DateTimeRangePicker.d.ts.map +1 -1
- package/dist/lib/components/Form/Form.d.ts.map +1 -1
- package/dist/lib/components/Form/FormSection.d.ts +1 -1
- package/dist/lib/components/Form/FormSection.d.ts.map +1 -1
- package/dist/lib/components/Form/fieldPermissions.d.ts +6 -0
- package/dist/lib/components/Form/fieldPermissions.d.ts.map +1 -0
- package/dist/lib/components/LineChart/LineChart.d.ts +18 -4
- package/dist/lib/components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/lib/components/LineChart/index.d.ts +1 -1
- package/dist/lib/components/LineChart/index.d.ts.map +1 -1
- package/dist/lib/components/OTPField/OTPField.d.ts +1 -0
- package/dist/lib/components/OTPField/OTPField.d.ts.map +1 -1
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts +1 -0
- package/dist/lib/components/PermissionGate/PermissionGate.d.ts.map +1 -1
- package/dist/lib/components/PermissionGate/index.d.ts +1 -1
- package/dist/lib/components/PermissionGate/index.d.ts.map +1 -1
- package/dist/lib/components/PhoneField/PhoneField.d.ts +1 -0
- package/dist/lib/components/PhoneField/PhoneField.d.ts.map +1 -1
- package/dist/lib/components/PieChart/PieChart.d.ts +3 -1
- package/dist/lib/components/PieChart/PieChart.d.ts.map +1 -1
- package/dist/lib/components/RadioGroup/RadioGroup.d.ts +1 -0
- package/dist/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/lib/components/Select/Select.d.ts.map +1 -1
- package/dist/lib/components/Select/SelectFilter.d.ts +17 -4
- package/dist/lib/components/Select/SelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts +3 -0
- package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts +4 -0
- package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +1 -0
- package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts +3 -0
- package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/contextAnchor.d.ts +11 -0
- package/dist/lib/components/Select/contextAnchor.d.ts.map +1 -0
- package/dist/lib/components/Select/hooks/useMultiSelect.d.ts +2 -1
- package/dist/lib/components/Select/hooks/useMultiSelect.d.ts.map +1 -1
- package/dist/lib/components/TextArea/TextArea.d.ts +1 -0
- package/dist/lib/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/lib/components/TextField/TextField.d.ts +1 -0
- package/dist/lib/components/TextField/TextField.d.ts.map +1 -1
- package/dist/lib/components/TokenInput/TokenInput.d.ts +1 -0
- package/dist/lib/components/TokenInput/TokenInput.d.ts.map +1 -1
- package/dist/lib/components/UploadFile/UploadFile.d.ts +1 -0
- package/dist/lib/components/UploadFile/UploadFile.d.ts.map +1 -1
- package/dist/lib/components/index.d.ts +1 -1
- package/dist/lib/components/index.d.ts.map +1 -1
- package/dist/lib/hooks/index.d.ts +4 -3
- package/dist/lib/hooks/index.d.ts.map +1 -1
- package/dist/lib/hooks/useCategoricalColors.d.ts +3 -0
- package/dist/lib/hooks/useCategoricalColors.d.ts.map +1 -0
- package/dist/lib/hooks/useFormatters.d.ts +4 -1
- package/dist/lib/hooks/useFormatters.d.ts.map +1 -1
- package/dist/lib/hooks/useWorkspaceCurrency.d.ts +2 -0
- package/dist/lib/hooks/useWorkspaceCurrency.d.ts.map +1 -0
- package/dist/lib/hooks/useWorkspaceTimeZone.d.ts +2 -0
- package/dist/lib/hooks/useWorkspaceTimeZone.d.ts.map +1 -0
- package/dist/lib/selects/currency/CurrencyFilter.d.ts +3 -5
- package/dist/lib/selects/currency/CurrencyFilter.d.ts.map +1 -1
- package/dist/lib/selects/icon/IconSelect.d.ts +1 -0
- package/dist/lib/selects/icon/IconSelect.d.ts.map +1 -1
- package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts +3 -4
- package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts.map +1 -1
- package/dist/lib/selects/locale/LocaleFilter.d.ts +3 -4
- package/dist/lib/selects/locale/LocaleFilter.d.ts.map +1 -1
- package/dist/lib/selects/timezone/TimezoneFilter.d.ts +3 -4
- package/dist/lib/selects/timezone/TimezoneFilter.d.ts.map +1 -1
- package/dist/lib/types/table-filter.d.ts +8 -2
- package/dist/lib/types/table-filter.d.ts.map +1 -1
- package/dist/lib/types/utility.d.ts +2 -0
- package/dist/lib/types/utility.d.ts.map +1 -0
- package/dist/lib/utils/colors.d.ts +8 -0
- package/dist/lib/utils/colors.d.ts.map +1 -1
- package/dist/lib/utils/currency.d.ts +2 -2
- package/dist/lib/utils/currency.d.ts.map +1 -1
- package/dist/lib/utils/disabledTip.d.ts +1 -1
- package/dist/lib/utils/disabledTip.d.ts.map +1 -1
- package/dist/lib/utils/format.d.ts +2 -2
- package/dist/lib/utils/format.d.ts.map +1 -1
- package/dist/lib/utils/timezone.d.ts +2 -2
- package/dist/lib/utils/timezone.d.ts.map +1 -1
- package/dist/select2.js +1 -1
- package/dist/separator2.js +1 -1
- package/dist/shadcn/shadcnChart/Chart.d.ts +2 -1
- package/dist/shadcn/shadcnChart/Chart.d.ts.map +1 -1
- package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts +2 -2
- package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts.map +1 -1
- package/dist/types/table-filter.js.map +1 -1
- package/dist/types/utility.js +2 -0
- package/dist/types/utility.js.map +1 -0
- package/dist/useCategoricalColors.js +20 -0
- package/dist/useCategoricalColors.js.map +1 -0
- package/dist/useDataTable.js +26 -10
- package/dist/useDataTable.js.map +1 -1
- package/dist/useFormatters.js +13 -13
- package/dist/useFormatters.js.map +1 -1
- package/dist/useWorkspaceTimeZone.js +10 -0
- package/dist/useWorkspaceTimeZone.js.map +1 -0
- package/dist/utils/colors.js +187 -1
- package/dist/utils/colors.js.map +1 -1
- package/dist/utils/currency.js +12 -12
- package/dist/utils/currency.js.map +1 -1
- package/dist/utils/format.js +6 -6
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/motion.js +2 -2
- package/dist/utils/timezone.js +12 -12
- package/dist/utils/timezone.js.map +1 -1
- package/dist/value.js +1 -1
- package/package.json +9 -1
- package/dist/CurrencyField.js.map +0 -1
- package/dist/index38.js +0 -84
- package/dist/index38.js.map +0 -1
- package/dist/index39.js +0 -199
- package/dist/index39.js.map +0 -1
- package/dist/lib/hooks/useBUCurrency.d.ts +0 -2
- package/dist/lib/hooks/useBUCurrency.d.ts.map +0 -1
- package/dist/lib/hooks/useBUTimezone.d.ts +0 -2
- package/dist/lib/hooks/useBUTimezone.d.ts.map +0 -1
- package/dist/lock-keyhole.js +0 -19
- package/dist/lock-keyhole.js.map +0 -1
- package/dist/useBUTimezone.js +0 -10
- package/dist/useBUTimezone.js.map +0 -1
package/dist/TextArea.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.js","sources":["../shadcn/shadcnTextarea/textarea.tsx","../lib/components/TextArea/TextArea.tsx"],"sourcesContent":["import type * as React from 'react';\n\nimport { cn } from '../utils';\n\nfunction Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n 'border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Textarea };\n","import React from 'react';\nimport { Textarea } from '../../../shadcn/shadcnTextarea';\nimport { cn } from '../../../shadcn/utils';\nimport { Field, FieldDescription, FieldError, FieldLabel } from '../Field';\n\nexport interface TextAreaProps extends React.ComponentProps<'textarea'> {\n label?: string;\n description?: React.ReactNode;\n error?: string;\n}\n\n// TextArea molecule - Textarea + Label composition using Field system\nexport const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ label, description, error, className, id, disabled, ...props }, ref) => {\n const generatedId = React.useId();\n const fieldId = id || generatedId;\n\n return (\n <Field data-disabled={disabled}>\n {label && <FieldLabel htmlFor={fieldId}
|
|
1
|
+
{"version":3,"file":"TextArea.js","sources":["../shadcn/shadcnTextarea/textarea.tsx","../lib/components/TextArea/TextArea.tsx"],"sourcesContent":["import type * as React from 'react';\n\nimport { cn } from '../utils';\n\nfunction Textarea({ className, ...props }: React.ComponentProps<'textarea'>) {\n return (\n <textarea\n data-slot=\"textarea\"\n className={cn(\n 'border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport { Textarea };\n","import React from 'react';\nimport { Textarea } from '../../../shadcn/shadcnTextarea';\nimport { cn } from '../../../shadcn/utils';\nimport { withDisabledTip } from '../../utils/disabledTip';\nimport { Field, FieldDescription, FieldError, FieldLabel } from '../Field';\nimport { lockedTip, PermissionLockIcon, usePermission } from '../PermissionGate';\n\nexport interface TextAreaProps extends React.ComponentProps<'textarea'> {\n label?: string;\n description?: React.ReactNode;\n error?: string;\n /** Permission code gating this field: hidden when not granted, disabled with a lock + upsell tip when locked */\n permission?: string;\n}\n\n// TextArea molecule - Textarea + Label composition using Field system\nexport const TextArea = React.forwardRef<HTMLTextAreaElement, TextAreaProps>(\n ({ label, description, error, className, id, disabled: disabledProp, permission, ...props }, ref) => {\n const generatedId = React.useId();\n const fieldId = id || generatedId;\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 disabled = disabledProp || locked;\n\n return (\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 {withDisabledTip(\n <Textarea\n ref={ref}\n id={fieldId}\n disabled={disabled}\n className={cn(className)}\n aria-invalid={!!error}\n {...props}\n />,\n locked ? lockedTip(gate) : undefined,\n disabled,\n 'block w-full',\n )}\n\n {description && !error && <FieldDescription>{description}</FieldDescription>}\n {error && <FieldError>{error}</FieldError>}\n </Field>\n );\n },\n);\n\nTextArea.displayName = 'TextArea';\n"],"names":["React"],"mappings":";;;;;;;AAIA,SAAS,QAAA,CAAS,EAAE,SAAA,EAAW,GAAG,OAAM,EAAqC;AAC3E,EAAA,uBACE,GAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,WAAA,EAAU,UAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACT,qcAAA;AAAA,QACA;AAAA,OACF;AAAA,MACC,GAAG;AAAA;AAAA,GACN;AAEJ;;ACCO,MAAM,WAAWA,cAAA,CAAM,UAAA;AAAA,EAC5B,CAAC,EAAE,KAAA,EAAO,WAAA,EAAa,KAAA,EAAO,SAAA,EAAW,EAAA,EAAI,QAAA,EAAU,YAAA,EAAc,UAAA,EAAY,GAAG,KAAA,IAAS,GAAA,KAAQ;AACnG,IAAA,MAAM,WAAA,GAAcA,eAAM,KAAA,EAAM;AAChC,IAAA,MAAM,UAAU,EAAA,IAAM,WAAA;AACtB,IAAA,MAAM,IAAA,GAA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, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import React__default from 'react';
|
|
3
3
|
import { c as cn } from './utils.js';
|
|
4
|
+
import { w as withDisabledTip } from './disabledTip.js';
|
|
5
|
+
import { c as usePermission, b as PermissionLockIcon, l as lockedTip } from './PermissionGate.js';
|
|
4
6
|
import { F as Field, e as FieldLabel, b as FieldDescription, c as FieldError } from './field.js';
|
|
5
7
|
import { I as Input } from './Input.js';
|
|
6
8
|
import { C as ChevronUp } from './chevron-up.js';
|
|
@@ -13,7 +15,8 @@ const TextField = React__default.forwardRef(
|
|
|
13
15
|
error,
|
|
14
16
|
className,
|
|
15
17
|
id,
|
|
16
|
-
disabled,
|
|
18
|
+
disabled: disabledProp,
|
|
19
|
+
permission,
|
|
17
20
|
startAdornment,
|
|
18
21
|
endAdornment,
|
|
19
22
|
positive,
|
|
@@ -23,6 +26,9 @@ const TextField = React__default.forwardRef(
|
|
|
23
26
|
style,
|
|
24
27
|
...props
|
|
25
28
|
}, ref) => {
|
|
29
|
+
const gate = usePermission(permission);
|
|
30
|
+
const { granted, locked, reason } = gate;
|
|
31
|
+
const disabled = disabledProp || locked;
|
|
26
32
|
const isNumberType = props.type === "number";
|
|
27
33
|
const normalizedType = isNumberType ? "text" : props.type;
|
|
28
34
|
const normalizedInputMode = props.inputMode ?? (isNumberType ? integer ? "numeric" : "decimal" : void 0);
|
|
@@ -148,60 +154,71 @@ const TextField = React__default.forwardRef(
|
|
|
148
154
|
observer.observe(node);
|
|
149
155
|
return () => observer.disconnect();
|
|
150
156
|
}, [hasEndContent]);
|
|
157
|
+
if (!granted) {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
151
160
|
return /* @__PURE__ */ jsxs(Field, { "data-disabled": disabled, children: [
|
|
152
|
-
label && /* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
/* @__PURE__ */ jsx(
|
|
156
|
-
Input,
|
|
157
|
-
{
|
|
158
|
-
"aria-invalid": !!error,
|
|
159
|
-
ref: assignRef,
|
|
160
|
-
disabled,
|
|
161
|
-
className: cn(className, startAdornment && "pl-10"),
|
|
162
|
-
id,
|
|
163
|
-
...props,
|
|
164
|
-
style: { ...style, paddingRight: endPadding },
|
|
165
|
-
value: displayValue,
|
|
166
|
-
min: effectiveMin,
|
|
167
|
-
type: normalizedType,
|
|
168
|
-
inputMode: normalizedInputMode,
|
|
169
|
-
onKeyDown: handleKeyDown,
|
|
170
|
-
onChange: handleChange
|
|
171
|
-
}
|
|
172
|
-
),
|
|
173
|
-
hasEndContent && /* @__PURE__ */ jsxs("div", { ref: endOverlayRef, className: "absolute inset-y-0 right-0 z-10 flex items-center gap-2 pr-2", children: [
|
|
174
|
-
(endAdornment || autoConstraintText) && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: combinedEndAdornment }),
|
|
175
|
-
isNumberType && /* @__PURE__ */ jsxs("div", { className: "flex h-7 w-4 flex-col overflow-hidden rounded-sm border border-border bg-background", children: [
|
|
176
|
-
/* @__PURE__ */ jsx(
|
|
177
|
-
"button",
|
|
178
|
-
{
|
|
179
|
-
type: "button",
|
|
180
|
-
tabIndex: -1,
|
|
181
|
-
className: "flex h-1/2 items-center justify-center border-b border-border text-muted-foreground hover:bg-accent disabled:opacity-50",
|
|
182
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
183
|
-
onClick: () => setInputNumericValue(1),
|
|
184
|
-
disabled,
|
|
185
|
-
"aria-label": "Increase value",
|
|
186
|
-
children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-2.5" })
|
|
187
|
-
}
|
|
188
|
-
),
|
|
189
|
-
/* @__PURE__ */ jsx(
|
|
190
|
-
"button",
|
|
191
|
-
{
|
|
192
|
-
type: "button",
|
|
193
|
-
tabIndex: -1,
|
|
194
|
-
className: "flex h-1/2 items-center justify-center text-muted-foreground hover:bg-accent disabled:opacity-50",
|
|
195
|
-
onMouseDown: (event) => event.preventDefault(),
|
|
196
|
-
onClick: () => setInputNumericValue(-1),
|
|
197
|
-
disabled,
|
|
198
|
-
"aria-label": "Decrease value",
|
|
199
|
-
children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-2.5" })
|
|
200
|
-
}
|
|
201
|
-
)
|
|
202
|
-
] })
|
|
203
|
-
] })
|
|
161
|
+
label && /* @__PURE__ */ jsxs(FieldLabel, { className: cn(locked && "items-center gap-1.5"), children: [
|
|
162
|
+
locked && /* @__PURE__ */ jsx(PermissionLockIcon, { reason, className: "size-3.5" }),
|
|
163
|
+
label
|
|
204
164
|
] }),
|
|
165
|
+
withDisabledTip(
|
|
166
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
167
|
+
startAdornment && /* @__PURE__ */ jsx("div", { className: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none", children: startAdornment }),
|
|
168
|
+
/* @__PURE__ */ jsx(
|
|
169
|
+
Input,
|
|
170
|
+
{
|
|
171
|
+
"aria-invalid": !!error,
|
|
172
|
+
ref: assignRef,
|
|
173
|
+
disabled,
|
|
174
|
+
className: cn(className, startAdornment && "pl-10"),
|
|
175
|
+
id,
|
|
176
|
+
...props,
|
|
177
|
+
style: { ...style, paddingRight: endPadding },
|
|
178
|
+
value: displayValue,
|
|
179
|
+
min: effectiveMin,
|
|
180
|
+
type: normalizedType,
|
|
181
|
+
inputMode: normalizedInputMode,
|
|
182
|
+
onKeyDown: handleKeyDown,
|
|
183
|
+
onChange: handleChange
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
hasEndContent && /* @__PURE__ */ jsxs("div", { ref: endOverlayRef, className: "absolute inset-y-0 right-0 z-10 flex items-center gap-2 pr-2", children: [
|
|
187
|
+
(endAdornment || autoConstraintText) && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: combinedEndAdornment }),
|
|
188
|
+
isNumberType && /* @__PURE__ */ jsxs("div", { className: "flex h-7 w-4 flex-col overflow-hidden rounded-sm border border-border bg-background", children: [
|
|
189
|
+
/* @__PURE__ */ jsx(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
tabIndex: -1,
|
|
194
|
+
className: "flex h-1/2 items-center justify-center border-b border-border text-muted-foreground hover:bg-accent disabled:opacity-50",
|
|
195
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
196
|
+
onClick: () => setInputNumericValue(1),
|
|
197
|
+
disabled,
|
|
198
|
+
"aria-label": "Increase value",
|
|
199
|
+
children: /* @__PURE__ */ jsx(ChevronUp, { className: "size-2.5" })
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
/* @__PURE__ */ jsx(
|
|
203
|
+
"button",
|
|
204
|
+
{
|
|
205
|
+
type: "button",
|
|
206
|
+
tabIndex: -1,
|
|
207
|
+
className: "flex h-1/2 items-center justify-center text-muted-foreground hover:bg-accent disabled:opacity-50",
|
|
208
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
209
|
+
onClick: () => setInputNumericValue(-1),
|
|
210
|
+
disabled,
|
|
211
|
+
"aria-label": "Decrease value",
|
|
212
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "size-2.5" })
|
|
213
|
+
}
|
|
214
|
+
)
|
|
215
|
+
] })
|
|
216
|
+
] })
|
|
217
|
+
] }),
|
|
218
|
+
locked ? lockedTip(gate) : void 0,
|
|
219
|
+
disabled,
|
|
220
|
+
"block w-full"
|
|
221
|
+
),
|
|
205
222
|
description && !error && /* @__PURE__ */ jsx(FieldDescription, { children: description }),
|
|
206
223
|
error && /* @__PURE__ */ jsx(FieldError, { children: error })
|
|
207
224
|
] });
|
package/dist/TextField.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.js","sources":["../lib/components/TextField/TextField.tsx"],"sourcesContent":["import { ChevronDown, ChevronUp } from 'lucide-react';\nimport React from 'react';\nimport { Input } from '../../../shadcn/shadcnInput';\nimport { cn } from '../../../shadcn/utils';\nimport { Field, FieldDescription, FieldError, FieldLabel } from '../Field';\n\nexport interface TextFieldProps extends React.ComponentProps<'input'> {\n label?: string;\n description?: React.ReactNode;\n error?: string;\n startAdornment?: React.ReactNode;\n endAdornment?: React.ReactNode;\n positive?: boolean;\n nonZero?: boolean;\n integer?: boolean;\n}\n\n// TextField molecule - Input + Label composition using Field system\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n label,\n description,\n error,\n className,\n id,\n disabled,\n startAdornment,\n endAdornment,\n positive,\n nonZero,\n integer,\n onChange,\n style,\n ...props\n },\n ref,\n ) => {\n const isNumberType = props.type === 'number';\n const normalizedType = isNumberType ? 'text' : props.type;\n const normalizedInputMode = props.inputMode ?? (isNumberType ? (integer ? 'numeric' : 'decimal') : undefined);\n // Resolve the actual minimum: positive floor takes precedence over `min`; integer+positive means ≥1, decimal keeps min 0 so 0.x stays typeable.\n const positiveFloor = positive ? (integer ? 1 : 0) : undefined;\n const propsMinNum = props.min != null && props.min !== '' ? Number(props.min) : undefined;\n const propsMinValid = propsMinNum !== undefined && Number.isFinite(propsMinNum) ? propsMinNum : undefined;\n const effectiveMin =\n positiveFloor !== undefined && propsMinValid !== undefined\n ? Math.max(positiveFloor, propsMinValid)\n : (propsMinValid ?? positiveFloor);\n const inputRef = React.useRef<HTMLInputElement>(null);\n // Tracks the last raw string typed so intermediate states like \"-\" or \"0.\" survive the RHF round-trip; must be state so updates re-render and don't revert the controlled input.\n const [rawInput, setRawInput] = React.useState<string>('');\n // Trailing overlay is measured at runtime so the input reserves exactly its width as right padding; re-measures via ResizeObserver.\n const endOverlayRef = React.useRef<HTMLDivElement>(null);\n const [endPadding, setEndPadding] = React.useState<number | undefined>(undefined);\n\n const assignRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n const setInputNumericValue = React.useCallback(\n (delta: 1 | -1) => {\n if (!isNumberType || disabled) return;\n const input = inputRef.current;\n if (!input) return;\n\n const parsedStep = Number(props.step);\n const step = Number.isFinite(parsedStep) && parsedStep > 0 ? parsedStep : 1;\n const parsedMax = Number(props.max);\n const max = Number.isFinite(parsedMax) ? parsedMax : undefined;\n const current = Number(input.value);\n const baseValue = Number.isFinite(current) ? current : (effectiveMin ?? 0);\n\n let next = baseValue + delta * step;\n if (effectiveMin !== undefined) next = Math.max(effectiveMin, next);\n if (max !== undefined) next = Math.min(max, next);\n\n const stepString = String(step);\n const decimals = integer || stepString.includes('.') === false ? 0 : (stepString.split('.')[1]?.length ?? 0);\n const nextValue = decimals > 0 ? next.toFixed(decimals) : String(Math.round(next));\n\n const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set;\n valueSetter?.call(input, nextValue);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n },\n [isNumberType, disabled, effectiveMin, integer, props.max, props.step],\n );\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isNumberType) {\n const raw = event.target.value;\n setRawInput(raw);\n const num = raw === '' ? NaN : Number(raw);\n (onChange as unknown as (v: number) => void)?.(num);\n } else {\n onChange?.(event);\n }\n },\n [isNumberType, onChange],\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || !isNumberType || disabled) return;\n if (positive && (event.key === '-' || event.key === 'e')) {\n event.preventDefault();\n return;\n }\n if (integer && (event.key === '.' || event.key === ',' || event.key === 'e')) {\n event.preventDefault();\n return;\n }\n // Block '0' as the first keystroke in integer mode when `positive` (≥1) or `nonZero` is set; decimal mode keeps '0' typeable so the user can start \"0.3\".\n if (\n (positive || nonZero) &&\n integer &&\n event.key === '0' &&\n (event.currentTarget.value === '' || event.currentTarget.value === '0')\n ) {\n event.preventDefault();\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n setInputNumericValue(1);\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n setInputNumericValue(-1);\n }\n },\n [isNumberType, disabled, positive, nonZero, integer, setInputNumericValue, props.onKeyDown],\n );\n\n // For number fields, prefer the raw typed string when it represents the same value as the stored number, preserving intermediate states like \"0.\", \"1.50\", \"-\".\n let displayValue: TextFieldProps['value'] = props.value;\n if (isNumberType && typeof props.value === 'number') {\n if (Number.isNaN(props.value)) {\n displayValue = rawInput;\n } else if (rawInput !== '' && Number(rawInput) === props.value) {\n displayValue = rawInput;\n }\n }\n\n const hasMin = propsMinValid !== undefined;\n const hasMax = props.max != null && props.max !== '';\n const hints: string[] = [];\n const integerLabel = positive ? '+Int' : 'Int';\n const positiveLabel = '+';\n const nonZeroLabel = '≠0';\n if (integer && nonZero) hints.push(`${integerLabel} ${nonZeroLabel}`);\n else if (integer) hints.push(integerLabel);\n else if (positive && nonZero) hints.push(`${positiveLabel} ${nonZeroLabel}`);\n else if (positive) hints.push(positiveLabel);\n else if (nonZero) hints.push(nonZeroLabel);\n if (hasMin && hasMax) hints.push(`Range: ${propsMinValid} - ${props.max}`);\n else if (hasMax) hints.push(`Max: ${props.max}`);\n else if (hasMin) hints.push(`Min: ${propsMinValid}`);\n const autoConstraintText = hints.join(', ');\n const combinedEndAdornment = (\n <>\n {autoConstraintText ? (\n <span className=\"text-xs text-muted-foreground whitespace-nowrap\">{autoConstraintText}</span>\n ) : null}\n {endAdornment}\n </>\n );\n\n const hasEndContent = isNumberType || !!endAdornment || !!autoConstraintText;\n\n React.useLayoutEffect(() => {\n const node = endOverlayRef.current;\n if (!hasEndContent || !node) {\n setEndPadding(undefined);\n return;\n }\n // Reserve the overlay's width plus a small gap so input text never sits under it.\n const measure = () => setEndPadding(node.offsetWidth + 4);\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n return () => observer.disconnect();\n }, [hasEndContent]);\n\n return (\n <Field data-disabled={disabled}>\n {label && <FieldLabel>{label}</FieldLabel>}\n\n <div className=\"relative\">\n {startAdornment && (\n <div className=\"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none\">{startAdornment}</div>\n )}\n <Input\n aria-invalid={!!error}\n ref={assignRef}\n disabled={disabled}\n className={cn(className, startAdornment && 'pl-10')}\n id={id}\n {...props}\n style={{ ...style, paddingRight: endPadding }}\n value={displayValue}\n min={effectiveMin}\n type={normalizedType}\n inputMode={normalizedInputMode}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n />\n {hasEndContent && (\n <div ref={endOverlayRef} className=\"absolute inset-y-0 right-0 z-10 flex items-center gap-2 pr-2\">\n {(endAdornment || autoConstraintText) && (\n <div className=\"flex items-center gap-2\">{combinedEndAdornment}</div>\n )}\n {isNumberType && (\n <div className=\"flex h-7 w-4 flex-col overflow-hidden rounded-sm border border-border bg-background\">\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"flex h-1/2 items-center justify-center border-b border-border text-muted-foreground hover:bg-accent disabled:opacity-50\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => setInputNumericValue(1)}\n disabled={disabled}\n aria-label=\"Increase value\"\n >\n <ChevronUp className=\"size-2.5\" />\n </button>\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"flex h-1/2 items-center justify-center text-muted-foreground hover:bg-accent disabled:opacity-50\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => setInputNumericValue(-1)}\n disabled={disabled}\n aria-label=\"Decrease value\"\n >\n <ChevronDown className=\"size-2.5\" />\n </button>\n </div>\n )}\n </div>\n )}\n </div>\n\n {description && !error && <FieldDescription>{description}</FieldDescription>}\n {error && <FieldError>{error}</FieldError>}\n </Field>\n );\n },\n);\n\nTextField.displayName = 'TextField';\n"],"names":["React"],"mappings":";;;;;;;;AAkBO,MAAM,YAAYA,cAAA,CAAM,UAAA;AAAA,EAC7B,CACE;AAAA,IACE,KAAA;AAAA,IACA,WAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAA;AAAA,IACA,EAAA;AAAA,IACA,QAAA;AAAA,IACA,cAAA;AAAA,IACA,YAAA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W,gBAAA;AAAA,gBAEX,QAAA,kBAAA,GAAA,CAAC,SAAA,EAAA,EAAU,SAAA,EAAU,UAAA,EAAW;AAAA;AAAA,aAClC;AAAA,4BACA,GAAA;AAAA,cAAC,QAAA;AAAA,cAAA;AAAA,gBACC,IAAA,EAAK,QAAA;AAAA,gBACL,QAAA,EAAU,EAAA;AAAA,gBACV,SAAA,EAAU,kGAAA;AAAA,gBACV,WAAA,EAAa,CAAC,KAAA,KAAU,KAAA,CAAM,cAAA,EAAe;AAAA,gBAC7C,OAAA,EAAS,MAAM,oBAAA,CAAqB,EAAE,CAAA;AAAA,gBACtC,QAAA;AAAA,gBACA,YAAA,EAAW,gBAAA;AAAA,gBAEX,QAAA,kBAAA,GAAA,CAAC,WAAA,EAAA,EAAY,SAAA,EAAU,UAAA,EAAW;AAAA;AAAA;AACpC,WAAA,EACF;AAAA,SAAA,EAEJ;AAAA,OAAA,EAEJ,CAAA;AAAA,MAEC,WAAA,IAAe,CAAC,KAAA,oBAAS,GAAA,CAAC,oBAAkB,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,MACxD,KAAA,oBAAS,GAAA,CAAC,UAAA,EAAA,EAAY,QAAA,EAAA,KAAA,EAAM;AAAA,KAAA,EAC/B,CAAA;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"TextField.js","sources":["../lib/components/TextField/TextField.tsx"],"sourcesContent":["import { ChevronDown, ChevronUp } from 'lucide-react';\nimport React from 'react';\nimport { Input } from '../../../shadcn/shadcnInput';\nimport { cn } from '../../../shadcn/utils';\nimport { withDisabledTip } from '../../utils/disabledTip';\nimport { Field, FieldDescription, FieldError, FieldLabel } from '../Field';\nimport { lockedTip, PermissionLockIcon, usePermission } from '../PermissionGate';\n\nexport interface TextFieldProps extends React.ComponentProps<'input'> {\n label?: string;\n description?: React.ReactNode;\n error?: string;\n startAdornment?: React.ReactNode;\n endAdornment?: React.ReactNode;\n positive?: boolean;\n nonZero?: boolean;\n integer?: boolean;\n /** Permission code gating this field: hidden when not granted, disabled with a lock + upsell tip when locked */\n permission?: string;\n}\n\n// TextField molecule - Input + Label composition using Field system\nexport const TextField = React.forwardRef<HTMLInputElement, TextFieldProps>(\n (\n {\n label,\n description,\n error,\n className,\n id,\n disabled: disabledProp,\n permission,\n startAdornment,\n endAdornment,\n positive,\n nonZero,\n integer,\n onChange,\n style,\n ...props\n },\n ref,\n ) => {\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 isNumberType = props.type === 'number';\n const normalizedType = isNumberType ? 'text' : props.type;\n const normalizedInputMode = props.inputMode ?? (isNumberType ? (integer ? 'numeric' : 'decimal') : undefined);\n // Resolve the actual minimum: positive floor takes precedence over `min`; integer+positive means ≥1, decimal keeps min 0 so 0.x stays typeable.\n const positiveFloor = positive ? (integer ? 1 : 0) : undefined;\n const propsMinNum = props.min != null && props.min !== '' ? Number(props.min) : undefined;\n const propsMinValid = propsMinNum !== undefined && Number.isFinite(propsMinNum) ? propsMinNum : undefined;\n const effectiveMin =\n positiveFloor !== undefined && propsMinValid !== undefined\n ? Math.max(positiveFloor, propsMinValid)\n : (propsMinValid ?? positiveFloor);\n const inputRef = React.useRef<HTMLInputElement>(null);\n // Tracks the last raw string typed so intermediate states like \"-\" or \"0.\" survive the RHF round-trip; must be state so updates re-render and don't revert the controlled input.\n const [rawInput, setRawInput] = React.useState<string>('');\n // Trailing overlay is measured at runtime so the input reserves exactly its width as right padding; re-measures via ResizeObserver.\n const endOverlayRef = React.useRef<HTMLDivElement>(null);\n const [endPadding, setEndPadding] = React.useState<number | undefined>(undefined);\n\n const assignRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n inputRef.current = node;\n if (typeof ref === 'function') {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref],\n );\n\n const setInputNumericValue = React.useCallback(\n (delta: 1 | -1) => {\n if (!isNumberType || disabled) return;\n const input = inputRef.current;\n if (!input) return;\n\n const parsedStep = Number(props.step);\n const step = Number.isFinite(parsedStep) && parsedStep > 0 ? parsedStep : 1;\n const parsedMax = Number(props.max);\n const max = Number.isFinite(parsedMax) ? parsedMax : undefined;\n const current = Number(input.value);\n const baseValue = Number.isFinite(current) ? current : (effectiveMin ?? 0);\n\n let next = baseValue + delta * step;\n if (effectiveMin !== undefined) next = Math.max(effectiveMin, next);\n if (max !== undefined) next = Math.min(max, next);\n\n const stepString = String(step);\n const decimals = integer || stepString.includes('.') === false ? 0 : (stepString.split('.')[1]?.length ?? 0);\n const nextValue = decimals > 0 ? next.toFixed(decimals) : String(Math.round(next));\n\n const valueSetter = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value')?.set;\n valueSetter?.call(input, nextValue);\n input.dispatchEvent(new Event('input', { bubbles: true }));\n },\n [isNumberType, disabled, effectiveMin, integer, props.max, props.step],\n );\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n if (isNumberType) {\n const raw = event.target.value;\n setRawInput(raw);\n const num = raw === '' ? NaN : Number(raw);\n (onChange as unknown as (v: number) => void)?.(num);\n } else {\n onChange?.(event);\n }\n },\n [isNumberType, onChange],\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n props.onKeyDown?.(event);\n if (event.defaultPrevented || !isNumberType || disabled) return;\n if (positive && (event.key === '-' || event.key === 'e')) {\n event.preventDefault();\n return;\n }\n if (integer && (event.key === '.' || event.key === ',' || event.key === 'e')) {\n event.preventDefault();\n return;\n }\n // Block '0' as the first keystroke in integer mode when `positive` (≥1) or `nonZero` is set; decimal mode keeps '0' typeable so the user can start \"0.3\".\n if (\n (positive || nonZero) &&\n integer &&\n event.key === '0' &&\n (event.currentTarget.value === '' || event.currentTarget.value === '0')\n ) {\n event.preventDefault();\n return;\n }\n if (event.key === 'ArrowUp') {\n event.preventDefault();\n setInputNumericValue(1);\n } else if (event.key === 'ArrowDown') {\n event.preventDefault();\n setInputNumericValue(-1);\n }\n },\n [isNumberType, disabled, positive, nonZero, integer, setInputNumericValue, props.onKeyDown],\n );\n\n // For number fields, prefer the raw typed string when it represents the same value as the stored number, preserving intermediate states like \"0.\", \"1.50\", \"-\".\n let displayValue: TextFieldProps['value'] = props.value;\n if (isNumberType && typeof props.value === 'number') {\n if (Number.isNaN(props.value)) {\n displayValue = rawInput;\n } else if (rawInput !== '' && Number(rawInput) === props.value) {\n displayValue = rawInput;\n }\n }\n\n const hasMin = propsMinValid !== undefined;\n const hasMax = props.max != null && props.max !== '';\n const hints: string[] = [];\n const integerLabel = positive ? '+Int' : 'Int';\n const positiveLabel = '+';\n const nonZeroLabel = '≠0';\n if (integer && nonZero) hints.push(`${integerLabel} ${nonZeroLabel}`);\n else if (integer) hints.push(integerLabel);\n else if (positive && nonZero) hints.push(`${positiveLabel} ${nonZeroLabel}`);\n else if (positive) hints.push(positiveLabel);\n else if (nonZero) hints.push(nonZeroLabel);\n if (hasMin && hasMax) hints.push(`Range: ${propsMinValid} - ${props.max}`);\n else if (hasMax) hints.push(`Max: ${props.max}`);\n else if (hasMin) hints.push(`Min: ${propsMinValid}`);\n const autoConstraintText = hints.join(', ');\n const combinedEndAdornment = (\n <>\n {autoConstraintText ? (\n <span className=\"text-xs text-muted-foreground whitespace-nowrap\">{autoConstraintText}</span>\n ) : null}\n {endAdornment}\n </>\n );\n\n const hasEndContent = isNumberType || !!endAdornment || !!autoConstraintText;\n\n React.useLayoutEffect(() => {\n const node = endOverlayRef.current;\n if (!hasEndContent || !node) {\n setEndPadding(undefined);\n return;\n }\n // Reserve the overlay's width plus a small gap so input text never sits under it.\n const measure = () => setEndPadding(node.offsetWidth + 4);\n measure();\n if (typeof ResizeObserver === 'undefined') return;\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n return () => observer.disconnect();\n }, [hasEndContent]);\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 <Field data-disabled={disabled}>\n {label && (\n <FieldLabel className={cn(locked && 'items-center gap-1.5')}>\n {locked && <PermissionLockIcon reason={reason} className=\"size-3.5\" />}\n {label}\n </FieldLabel>\n )}\n\n {withDisabledTip(\n <div className=\"relative\">\n {startAdornment && (\n <div className=\"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none\">\n {startAdornment}\n </div>\n )}\n <Input\n aria-invalid={!!error}\n ref={assignRef}\n disabled={disabled}\n className={cn(className, startAdornment && 'pl-10')}\n id={id}\n {...props}\n style={{ ...style, paddingRight: endPadding }}\n value={displayValue}\n min={effectiveMin}\n type={normalizedType}\n inputMode={normalizedInputMode}\n onKeyDown={handleKeyDown}\n onChange={handleChange}\n />\n {hasEndContent && (\n <div ref={endOverlayRef} className=\"absolute inset-y-0 right-0 z-10 flex items-center gap-2 pr-2\">\n {(endAdornment || autoConstraintText) && (\n <div className=\"flex items-center gap-2\">{combinedEndAdornment}</div>\n )}\n {isNumberType && (\n <div className=\"flex h-7 w-4 flex-col overflow-hidden rounded-sm border border-border bg-background\">\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"flex h-1/2 items-center justify-center border-b border-border text-muted-foreground hover:bg-accent disabled:opacity-50\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => setInputNumericValue(1)}\n disabled={disabled}\n aria-label=\"Increase value\"\n >\n <ChevronUp className=\"size-2.5\" />\n </button>\n <button\n type=\"button\"\n tabIndex={-1}\n className=\"flex h-1/2 items-center justify-center text-muted-foreground hover:bg-accent disabled:opacity-50\"\n onMouseDown={(event) => event.preventDefault()}\n onClick={() => setInputNumericValue(-1)}\n disabled={disabled}\n aria-label=\"Decrease value\"\n >\n <ChevronDown className=\"size-2.5\" />\n </button>\n </div>\n )}\n </div>\n )}\n </div>,\n locked ? lockedTip(gate) : undefined,\n disabled,\n 'block w-full',\n )}\n\n {description && !error && <FieldDescription>{description}</FieldDescription>}\n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U,UAAA,EAAW;AAAA;AAAA;AACpC,aAAA,EACF;AAAA,WAAA,EAEJ;AAAA,SAAA,EAEJ,CAAA;AAAA,QACA,MAAA,GAAS,SAAA,CAAU,IAAI,CAAA,GAAI,MAAA;AAAA,QAC3B,QAAA;AAAA,QACA;AAAA,OACF;AAAA,MAEC,WAAA,IAAe,CAAC,KAAA,oBAAS,GAAA,CAAC,oBAAkB,QAAA,EAAA,WAAA,EAAY,CAAA;AAAA,MACxD,KAAA,oBAAS,GAAA,CAAC,UAAA,EAAA,EAAY,QAAA,EAAA,KAAA,EAAM;AAAA,KAAA,EAC/B,CAAA;AAAA,EAEJ;AACF;AAEA,SAAA,CAAU,WAAA,GAAc,WAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimezoneSelector.js","sources":["../lib/selects/timezone/timezones.ts","../lib/selects/timezone/TimezoneFilter.tsx","../lib/selects/timezone/TimezoneSelector.tsx"],"sourcesContent":["import type { SelectOption } from '../../components/Select/types';\n\nfunction getSupportedTimeZones(): string[] {\n const intlWithSupportedValues = Intl as typeof Intl & {\n supportedValuesOf?: (key: 'timeZone') => string[];\n };\n\n if (typeof Intl !== 'undefined' && typeof intlWithSupportedValues.supportedValuesOf === 'function') {\n try {\n const timeZones = intlWithSupportedValues.supportedValuesOf('timeZone');\n if (timeZones.length > 0) {\n return timeZones.includes('UTC') ? timeZones : ['UTC', ...timeZones];\n }\n } catch {\n // no-op; falls back to UTC\n }\n }\n\n return ['UTC'];\n}\n\nexport const TIMEZONES: SelectOption[] = getSupportedTimeZones().map((timeZone) => ({\n value: timeZone,\n label: timeZone,\n}));\n","import { forwardRef } from 'react';\nimport { SelectFilter, type SelectFilterProps } from '../../components/Select/SelectFilter';\nimport { TIMEZONES } from './timezones';\n\nexport type TimezoneFilterProps =
|
|
1
|
+
{"version":3,"file":"TimezoneSelector.js","sources":["../lib/selects/timezone/timezones.ts","../lib/selects/timezone/TimezoneFilter.tsx","../lib/selects/timezone/TimezoneSelector.tsx"],"sourcesContent":["import type { SelectOption } from '../../components/Select/types';\n\nfunction getSupportedTimeZones(): string[] {\n const intlWithSupportedValues = Intl as typeof Intl & {\n supportedValuesOf?: (key: 'timeZone') => string[];\n };\n\n if (typeof Intl !== 'undefined' && typeof intlWithSupportedValues.supportedValuesOf === 'function') {\n try {\n const timeZones = intlWithSupportedValues.supportedValuesOf('timeZone');\n if (timeZones.length > 0) {\n return timeZones.includes('UTC') ? timeZones : ['UTC', ...timeZones];\n }\n } catch {\n // no-op; falls back to UTC\n }\n }\n\n return ['UTC'];\n}\n\nexport const TIMEZONES: SelectOption[] = getSupportedTimeZones().map((timeZone) => ({\n value: timeZone,\n label: timeZone,\n}));\n","import { forwardRef } from 'react';\nimport { SelectFilter, type SelectFilterProps } from '../../components/Select/SelectFilter';\nimport type { DistributiveOmit } from '../../types/utility';\nimport { TIMEZONES } from './timezones';\n\nexport type TimezoneFilterProps = DistributiveOmit<SelectFilterProps, 'options' | 'name'> & { name?: string };\n\n// Pre-configured SelectFilter for timezone filtering with runtime-supported IANA options\nexport const TimezoneFilter = Object.assign(\n forwardRef<HTMLButtonElement, TimezoneFilterProps>((props, ref) => (\n <SelectFilter\n ref={ref}\n name=\"timezone\"\n label=\"Timezone\"\n placeholder=\"Select timezone\"\n options={TIMEZONES}\n {...props}\n />\n )),\n { displayName: 'TimezoneFilter', defaultLabel: 'Timezone', defaultName: 'timezone' },\n);\n","import { forwardRef } from 'react';\nimport { Select, type SelectProps } from '../../components/Select/Select';\nimport { TIMEZONES } from './timezones';\n\nexport type TimezoneSelectorProps = Omit<SelectProps, 'optionsEndpoint'>;\n\n// Pre-configured Select for timezone selection with runtime-supported IANA options\nexport const TimezoneSelector = forwardRef<HTMLButtonElement, TimezoneSelectorProps>((props, ref) => (\n <Select ref={ref} label=\"Timezone\" placeholder=\"Select timezone\" searchable options={TIMEZONES} {...props} />\n));\nTimezoneSelector.displayName = 'TimezoneSelector';\n"],"names":[],"mappings":";;;;;A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G;AACD,gBAAA,CAAiB,WAAA,GAAc,kBAAA;;;;"}
|
package/dist/Toggle.js
CHANGED
package/dist/UploadFile.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useRef, useMemo, useEffect } from 'react';
|
|
3
3
|
import { c as cn } from './utils.js';
|
|
4
|
+
import { w as withDisabledTip } from './disabledTip.js';
|
|
4
5
|
import { B as Button } from './Button.js';
|
|
5
6
|
import { F as FilePreview } from './FilePreview.js';
|
|
7
|
+
import { c as usePermission, b as PermissionLockIcon, l as lockedTip } from './PermissionGate.js';
|
|
6
8
|
import { F as Field, e as FieldLabel, c as FieldError } from './field.js';
|
|
7
9
|
import { U as Upload, I as Image } from './upload.js';
|
|
8
10
|
import { C as Camera, U as User } from './user.js';
|
|
@@ -21,7 +23,7 @@ const UploadFile = ({
|
|
|
21
23
|
multiple = false,
|
|
22
24
|
accept,
|
|
23
25
|
className,
|
|
24
|
-
disabled,
|
|
26
|
+
disabled: disabledProp,
|
|
25
27
|
label,
|
|
26
28
|
error,
|
|
27
29
|
placeholder,
|
|
@@ -29,9 +31,13 @@ const UploadFile = ({
|
|
|
29
31
|
value,
|
|
30
32
|
previewUrl,
|
|
31
33
|
onChange,
|
|
32
|
-
isLoading
|
|
34
|
+
isLoading,
|
|
35
|
+
permission
|
|
33
36
|
}) => {
|
|
34
37
|
const inputRef = useRef(null);
|
|
38
|
+
const gate = usePermission(permission);
|
|
39
|
+
const { granted, locked, reason } = gate;
|
|
40
|
+
const disabled = disabledProp || locked;
|
|
35
41
|
const files = !value ? [] : Array.isArray(value) ? value : [value];
|
|
36
42
|
const hasFiles = files.length > 0;
|
|
37
43
|
const firstFile = files[0];
|
|
@@ -189,12 +195,24 @@ const UploadFile = ({
|
|
|
189
195
|
`${file.name}-${file.size}`
|
|
190
196
|
)) });
|
|
191
197
|
}
|
|
198
|
+
if (!granted) {
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
const anchorElement = renderAnchor();
|
|
192
202
|
return (
|
|
193
203
|
// Field is w-full by default; a tile is a fixed 80px square or circle, so it hugs its content
|
|
194
204
|
// instead of claiming the whole row and pushing sibling content to the far edge
|
|
195
205
|
/* @__PURE__ */ jsxs(Field, { "data-disabled": disabled, className: cn(isTile && "w-fit", className), children: [
|
|
196
|
-
label && /* @__PURE__ */
|
|
197
|
-
|
|
206
|
+
label && /* @__PURE__ */ jsxs(FieldLabel, { className: cn(locked && "items-center gap-1.5"), children: [
|
|
207
|
+
locked && /* @__PURE__ */ jsx(PermissionLockIcon, { reason, className: "size-3.5" }),
|
|
208
|
+
label
|
|
209
|
+
] }),
|
|
210
|
+
anchorElement && withDisabledTip(
|
|
211
|
+
anchorElement,
|
|
212
|
+
locked ? lockedTip(gate) : void 0,
|
|
213
|
+
disabled,
|
|
214
|
+
anchor === "dropzone" ? "block w-full" : void 0
|
|
215
|
+
),
|
|
198
216
|
renderFileList(),
|
|
199
217
|
/* @__PURE__ */ jsx(
|
|
200
218
|
"input",
|
package/dist/UploadFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadFile.js","sources":["../lib/components/UploadFile/UploadFile.tsx"],"sourcesContent":["import { Camera, Image, Upload, User, X } from 'lucide-react';\nimport type React from 'react';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { cn } from '../../../shadcn/utils';\nimport { Button } from '../Button';\nimport { Field, FieldError, FieldLabel } from '../Field';\nimport { FilePreview } from '../FilePreview';\n\ntype AnchorPreset = 'dropzone' | 'button' | 'avatar' | 'logo';\n\ninterface UploadFileBaseProps {\n anchor?: AnchorPreset | React.ReactNode;\n multiple?: boolean;\n accept?: string;\n className?: string;\n disabled?: boolean;\n label?: string;\n error?: string;\n placeholder?: string;\n hint?: string;\n value?: File | File[] | null;\n /** URL of an already-persisted file (e.g. a saved avatar). Shown as the preview until a new file is picked. */\n previewUrl?: string;\n isLoading?: boolean;\n}\n\ninterface UploadFileStandaloneProps extends UploadFileBaseProps {\n name?: never;\n onChange: (files: File | File[] | undefined) => void;\n}\n\ninterface UploadFileFormProps extends UploadFileBaseProps {\n name: string;\n onChange?: (files: File | File[] | undefined) => void;\n}\n\nexport type UploadFileProps = UploadFileStandaloneProps | UploadFileFormProps;\n\n// Creates a revocable object URL for an image File; null for non-images or no file.\n// Built during render, not in an effect, so the preview never flashes a placeholder first.\nfunction useImageObjectUrl(file: File | undefined): string | null {\n const objectUrl = useMemo(() => (file?.type.startsWith('image/') ? URL.createObjectURL(file) : null), [file]);\n\n useEffect(() => {\n if (!objectUrl) return;\n return () => URL.revokeObjectURL(objectUrl);\n }, [objectUrl]);\n\n return objectUrl;\n}\n\n// File upload trigger with optional preset anchors and built-in file preview\nexport const UploadFile: React.FC<UploadFileProps> = ({\n anchor = 'dropzone',\n multiple = false,\n accept,\n className,\n disabled,\n label,\n error,\n placeholder,\n hint,\n value,\n previewUrl,\n onChange,\n isLoading,\n}) => {\n const inputRef = useRef<HTMLInputElement>(null);\n\n // Normalize value to an array for consistent handling\n const files: File[] = !value ? [] : Array.isArray(value) ? value : [value];\n const hasFiles = files.length > 0;\n\n const firstFile: File | undefined = files[0];\n const selectedImageUrl = useImageObjectUrl(firstFile);\n // A picked file always wins; previewUrl only fills in when nothing is selected, so\n // picking a non-image never falls back to the stale remote image\n const imageSrc = hasFiles ? selectedImageUrl : (previewUrl ?? null);\n\n // True when using a preset string anchor (not a custom ReactNode)\n const isPreset = anchor === 'dropzone' || anchor === 'button' || anchor === 'avatar' || anchor === 'logo';\n // Both tile presets share one 80px picker; avatar crops to a circle, logo keeps the whole image in a square\n const isTile = anchor === 'avatar' || anchor === 'logo';\n\n // Opens the native file picker\n function handleClick() {\n if (disabled) return;\n inputRef.current?.click();\n }\n\n // Forwards selected files to consumer and resets input\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n const fileList = event.target.files;\n if (!fileList || fileList.length === 0) return;\n\n if (multiple) {\n // Merge with existing files, avoiding duplicates by name+size\n const incoming = Array.from(fileList);\n const merged = [...files, ...incoming.filter((f) => !files.some((e) => e.name === f.name && e.size === f.size))];\n onChange?.(merged);\n } else {\n onChange?.(fileList[0]);\n }\n\n // Reset so the same file can be re-selected\n event.target.value = '';\n }\n\n // Removes a specific file from the selection\n function handleRemove(file: File) {\n if (multiple) {\n const remaining = files.filter((f) => f !== file);\n onChange?.(remaining.length ? remaining : undefined);\n } else {\n onChange?.(undefined);\n }\n }\n\n // Renders the clickable anchor element based on the anchor prop\n function renderAnchor() {\n // Custom ReactNode — preserve original headless behaviour\n if (!isPreset) {\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={disabled}\n style={{ all: 'unset', display: 'inline-block', cursor: disabled ? 'default' : 'pointer' }}\n >\n {anchor as React.ReactNode}\n </button>\n );\n }\n\n if (anchor === 'dropzone') {\n // In single mode with a file selected, the file row replaces the dropzone\n if (!multiple && hasFiles) return null;\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={disabled}\n className={cn(\n 'flex w-full flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-8 transition-colors',\n error ? 'border-destructive' : 'border-border',\n disabled ? 'cursor-default opacity-50' : 'cursor-pointer hover:bg-muted/50',\n )}\n >\n {imageSrc ? (\n <img src={imageSrc} alt=\"\" className=\"h-16 w-16 rounded object-cover\" />\n ) : (\n <Upload className=\"h-6 w-6 text-muted-foreground\" />\n )}\n <p className=\"text-sm text-muted-foreground\">{placeholder ?? 'Click or drag to upload'}</p>\n {hint && <p className=\"text-xs text-muted-foreground\">{hint}</p>}\n </button>\n );\n }\n\n if (anchor === 'button') {\n // In single mode with a file selected, the file row replaces the button\n if (!multiple && hasFiles) return null;\n\n return (\n <Button type=\"button\" variant=\"outline\" onClick={handleClick} disabled={disabled}>\n <Upload className=\"h-4 w-4\" />\n {placeholder ?? 'Upload file'}\n </Button>\n );\n }\n\n if (isTile) {\n const avatarSize = 80;\n const isLogo = anchor === 'logo';\n const shape = isLogo ? 'rounded-lg' : 'rounded-full';\n const Placeholder = isLogo ? Image : User;\n\n return (\n // Wrapper provides positioning context for the badge outside overflow-hidden\n <div className=\"relative inline-block\" style={{ width: avatarSize, height: avatarSize }}>\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={disabled}\n className={cn(\n 'group relative h-full w-full overflow-hidden bg-muted',\n shape,\n disabled ? 'cursor-default' : 'cursor-pointer',\n // A shown image is content, not an affordance — only dim the empty placeholder\n disabled && !imageSrc && 'opacity-50',\n )}\n >\n {imageSrc ? (\n <>\n <img\n src={imageSrc}\n alt={firstFile?.name ?? ''}\n // A logo must stay whole, so it is contained; an avatar fills its circle\n className={cn('w-full h-full', shape, isLogo ? 'object-contain' : 'object-cover')}\n style={{ width: avatarSize, height: avatarSize }}\n />\n {/* Camera overlay on hover — omitted when read-only, since nothing can be picked */}\n {!disabled && (\n <div\n className={cn(\n 'absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100',\n shape,\n )}\n >\n <Camera className=\"h-5 w-5 text-white\" />\n </div>\n )}\n </>\n ) : (\n <div className=\"flex h-full w-full items-center justify-center\">\n <Placeholder className=\"h-8 w-8 text-muted-foreground\" />\n </div>\n )}\n </button>\n\n {/* Badge sits outside overflow-hidden so it's never clipped */}\n {!imageSrc && (\n <div className=\"pointer-events-none absolute -bottom-0.5 -right-0.5 flex h-6 w-6 items-center justify-center rounded-full bg-primary ring-2 ring-background\">\n <Upload className=\"h-3 w-3 text-primary-foreground\" />\n </div>\n )}\n </div>\n );\n }\n\n return null;\n }\n\n // Renders the file list below the anchor for preset anchors (not the tile presets, which preview inline)\n function renderFileList() {\n if (!isPreset || !hasFiles || isTile) return null;\n\n return (\n <div className=\"flex flex-col gap-2\">\n {files.map((file) => (\n <div\n key={`${file.name}-${file.size}`}\n className={cn(\n 'relative overflow-hidden flex items-center gap-3 rounded-lg border border-dashed p-3',\n isLoading ? 'border-primary/40 animate-pulse' : 'border-border',\n )}\n >\n {isLoading && <div className=\"absolute inset-0 bg-primary/5\" />}\n <div className=\"relative flex items-center gap-3 flex-1 min-w-0\">\n <FilePreview file={file} size={40} />\n <div className=\"flex-1 min-w-0\">\n <span className=\"block truncate text-sm\">{file.name}</span>\n {isLoading && <span className=\"text-xs text-muted-foreground\">Uploading...</span>}\n </div>\n {!isLoading && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 shrink-0\"\n onClick={() => handleRemove(file)}\n disabled={disabled}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n )}\n </div>\n </div>\n ))}\n </div>\n );\n }\n\n return (\n // Field is w-full by default; a tile is a fixed 80px square or circle, so it hugs its content\n // instead of claiming the whole row and pushing sibling content to the far edge\n <Field data-disabled={disabled} className={cn(isTile && 'w-fit', className)}>\n {label && <FieldLabel>{label}</FieldLabel>}\n\n {renderAnchor()}\n {renderFileList()}\n\n <input\n ref={inputRef}\n type=\"file\"\n multiple={multiple}\n accept={accept}\n disabled={disabled}\n onChange={handleChange}\n style={{ display: 'none' }}\n aria-hidden=\"true\"\n tabIndex={-1}\n />\n\n {error && <FieldError>{error}</FieldError>}\n </Field>\n );\n};\n\nUploadFile.displayName = 'UploadFile';\n"],"names":[],"mappings":";;;;;;;;;;AAwCA,SAAS,kBAAkB,IAAA,EAAuC;AAChE,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,MAAO,IAAA,EAAM,KAAK,UAAA,CAAW,QAAQ,CAAA,GAAI,GAAA,CAAI,gBAAgB,IAAI,CAAA,GAAI,IAAA,EAAO,CAAC,IAAI,CAAC,CAAA;AAE5G,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,SAAA,EAAW;AAChB,IAAA,OAAO,MAAM,GAAA,CAAI,eAAA,CAAgB,SAAS,CAAA;AAAA,EAC5C,CAAA,EAAG,CAAC,SAAS,CAAC,CAAA;AAEd,EAAA,OAAO,SAAA;AACT;AAGO,MAAM,aAAwC,CAA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GAAc,YAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"UploadFile.js","sources":["../lib/components/UploadFile/UploadFile.tsx"],"sourcesContent":["import { Camera, Image, Upload, User, X } from 'lucide-react';\nimport type React from 'react';\nimport { useEffect, useMemo, useRef } from 'react';\nimport { cn } from '../../../shadcn/utils';\nimport { withDisabledTip } from '../../utils/disabledTip';\nimport { Button } from '../Button';\nimport { Field, FieldError, FieldLabel } from '../Field';\nimport { FilePreview } from '../FilePreview';\nimport { lockedTip, PermissionLockIcon, usePermission } from '../PermissionGate';\n\ntype AnchorPreset = 'dropzone' | 'button' | 'avatar' | 'logo';\n\ninterface UploadFileBaseProps {\n anchor?: AnchorPreset | React.ReactNode;\n multiple?: boolean;\n accept?: string;\n className?: string;\n disabled?: boolean;\n label?: string;\n error?: string;\n placeholder?: string;\n hint?: string;\n value?: File | File[] | null;\n /** URL of an already-persisted file (e.g. a saved avatar). Shown as the preview until a new file is picked. */\n previewUrl?: string;\n isLoading?: boolean;\n /** Permission code gating this field: hidden when not granted, disabled with a lock + upsell tip when locked */\n permission?: string;\n}\n\ninterface UploadFileStandaloneProps extends UploadFileBaseProps {\n name?: never;\n onChange: (files: File | File[] | undefined) => void;\n}\n\ninterface UploadFileFormProps extends UploadFileBaseProps {\n name: string;\n onChange?: (files: File | File[] | undefined) => void;\n}\n\nexport type UploadFileProps = UploadFileStandaloneProps | UploadFileFormProps;\n\n// Creates a revocable object URL for an image File; null for non-images or no file.\n// Built during render, not in an effect, so the preview never flashes a placeholder first.\nfunction useImageObjectUrl(file: File | undefined): string | null {\n const objectUrl = useMemo(() => (file?.type.startsWith('image/') ? URL.createObjectURL(file) : null), [file]);\n\n useEffect(() => {\n if (!objectUrl) return;\n return () => URL.revokeObjectURL(objectUrl);\n }, [objectUrl]);\n\n return objectUrl;\n}\n\n// File upload trigger with optional preset anchors and built-in file preview\nexport const UploadFile: React.FC<UploadFileProps> = ({\n anchor = 'dropzone',\n multiple = false,\n accept,\n className,\n disabled: disabledProp,\n label,\n error,\n placeholder,\n hint,\n value,\n previewUrl,\n onChange,\n isLoading,\n permission,\n}) => {\n const inputRef = useRef<HTMLInputElement>(null);\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 // Normalize value to an array for consistent handling\n const files: File[] = !value ? [] : Array.isArray(value) ? value : [value];\n const hasFiles = files.length > 0;\n\n const firstFile: File | undefined = files[0];\n const selectedImageUrl = useImageObjectUrl(firstFile);\n // A picked file always wins; previewUrl only fills in when nothing is selected, so\n // picking a non-image never falls back to the stale remote image\n const imageSrc = hasFiles ? selectedImageUrl : (previewUrl ?? null);\n\n // True when using a preset string anchor (not a custom ReactNode)\n const isPreset = anchor === 'dropzone' || anchor === 'button' || anchor === 'avatar' || anchor === 'logo';\n // Both tile presets share one 80px picker; avatar crops to a circle, logo keeps the whole image in a square\n const isTile = anchor === 'avatar' || anchor === 'logo';\n\n // Opens the native file picker\n function handleClick() {\n if (disabled) return;\n inputRef.current?.click();\n }\n\n // Forwards selected files to consumer and resets input\n function handleChange(event: React.ChangeEvent<HTMLInputElement>) {\n const fileList = event.target.files;\n if (!fileList || fileList.length === 0) return;\n\n if (multiple) {\n // Merge with existing files, avoiding duplicates by name+size\n const incoming = Array.from(fileList);\n const merged = [...files, ...incoming.filter((f) => !files.some((e) => e.name === f.name && e.size === f.size))];\n onChange?.(merged);\n } else {\n onChange?.(fileList[0]);\n }\n\n // Reset so the same file can be re-selected\n event.target.value = '';\n }\n\n // Removes a specific file from the selection\n function handleRemove(file: File) {\n if (multiple) {\n const remaining = files.filter((f) => f !== file);\n onChange?.(remaining.length ? remaining : undefined);\n } else {\n onChange?.(undefined);\n }\n }\n\n // Renders the clickable anchor element based on the anchor prop\n function renderAnchor() {\n // Custom ReactNode — preserve original headless behaviour\n if (!isPreset) {\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={disabled}\n style={{ all: 'unset', display: 'inline-block', cursor: disabled ? 'default' : 'pointer' }}\n >\n {anchor as React.ReactNode}\n </button>\n );\n }\n\n if (anchor === 'dropzone') {\n // In single mode with a file selected, the file row replaces the dropzone\n if (!multiple && hasFiles) return null;\n\n return (\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={disabled}\n className={cn(\n 'flex w-full flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed p-8 transition-colors',\n error ? 'border-destructive' : 'border-border',\n disabled ? 'cursor-default opacity-50' : 'cursor-pointer hover:bg-muted/50',\n )}\n >\n {imageSrc ? (\n <img src={imageSrc} alt=\"\" className=\"h-16 w-16 rounded object-cover\" />\n ) : (\n <Upload className=\"h-6 w-6 text-muted-foreground\" />\n )}\n <p className=\"text-sm text-muted-foreground\">{placeholder ?? 'Click or drag to upload'}</p>\n {hint && <p className=\"text-xs text-muted-foreground\">{hint}</p>}\n </button>\n );\n }\n\n if (anchor === 'button') {\n // In single mode with a file selected, the file row replaces the button\n if (!multiple && hasFiles) return null;\n\n return (\n <Button type=\"button\" variant=\"outline\" onClick={handleClick} disabled={disabled}>\n <Upload className=\"h-4 w-4\" />\n {placeholder ?? 'Upload file'}\n </Button>\n );\n }\n\n if (isTile) {\n const avatarSize = 80;\n const isLogo = anchor === 'logo';\n const shape = isLogo ? 'rounded-lg' : 'rounded-full';\n const Placeholder = isLogo ? Image : User;\n\n return (\n // Wrapper provides positioning context for the badge outside overflow-hidden\n <div className=\"relative inline-block\" style={{ width: avatarSize, height: avatarSize }}>\n <button\n type=\"button\"\n onClick={handleClick}\n disabled={disabled}\n className={cn(\n 'group relative h-full w-full overflow-hidden bg-muted',\n shape,\n disabled ? 'cursor-default' : 'cursor-pointer',\n // A shown image is content, not an affordance — only dim the empty placeholder\n disabled && !imageSrc && 'opacity-50',\n )}\n >\n {imageSrc ? (\n <>\n <img\n src={imageSrc}\n alt={firstFile?.name ?? ''}\n // A logo must stay whole, so it is contained; an avatar fills its circle\n className={cn('w-full h-full', shape, isLogo ? 'object-contain' : 'object-cover')}\n style={{ width: avatarSize, height: avatarSize }}\n />\n {/* Camera overlay on hover — omitted when read-only, since nothing can be picked */}\n {!disabled && (\n <div\n className={cn(\n 'absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 transition-opacity group-hover:opacity-100',\n shape,\n )}\n >\n <Camera className=\"h-5 w-5 text-white\" />\n </div>\n )}\n </>\n ) : (\n <div className=\"flex h-full w-full items-center justify-center\">\n <Placeholder className=\"h-8 w-8 text-muted-foreground\" />\n </div>\n )}\n </button>\n\n {/* Badge sits outside overflow-hidden so it's never clipped */}\n {!imageSrc && (\n <div className=\"pointer-events-none absolute -bottom-0.5 -right-0.5 flex h-6 w-6 items-center justify-center rounded-full bg-primary ring-2 ring-background\">\n <Upload className=\"h-3 w-3 text-primary-foreground\" />\n </div>\n )}\n </div>\n );\n }\n\n return null;\n }\n\n // Renders the file list below the anchor for preset anchors (not the tile presets, which preview inline)\n function renderFileList() {\n if (!isPreset || !hasFiles || isTile) return null;\n\n return (\n <div className=\"flex flex-col gap-2\">\n {files.map((file) => (\n <div\n key={`${file.name}-${file.size}`}\n className={cn(\n 'relative overflow-hidden flex items-center gap-3 rounded-lg border border-dashed p-3',\n isLoading ? 'border-primary/40 animate-pulse' : 'border-border',\n )}\n >\n {isLoading && <div className=\"absolute inset-0 bg-primary/5\" />}\n <div className=\"relative flex items-center gap-3 flex-1 min-w-0\">\n <FilePreview file={file} size={40} />\n <div className=\"flex-1 min-w-0\">\n <span className=\"block truncate text-sm\">{file.name}</span>\n {isLoading && <span className=\"text-xs text-muted-foreground\">Uploading...</span>}\n </div>\n {!isLoading && (\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className=\"h-8 w-8 shrink-0\"\n onClick={() => handleRemove(file)}\n disabled={disabled}\n >\n <X className=\"h-4 w-4\" />\n </Button>\n )}\n </div>\n </div>\n ))}\n </div>\n );\n }\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 anchorElement = renderAnchor();\n\n return (\n // Field is w-full by default; a tile is a fixed 80px square or circle, so it hugs its content\n // instead of claiming the whole row and pushing sibling content to the far edge\n <Field data-disabled={disabled} className={cn(isTile && 'w-fit', className)}>\n {label && (\n <FieldLabel className={cn(locked && 'items-center gap-1.5')}>\n {locked && <PermissionLockIcon reason={reason} className=\"size-3.5\" />}\n {label}\n </FieldLabel>\n )}\n\n {anchorElement &&\n withDisabledTip(\n anchorElement,\n locked ? lockedTip(gate) : undefined,\n disabled,\n anchor === 'dropzone' ? 'block w-full' : undefined,\n )}\n {renderFileList()}\n\n <input\n ref={inputRef}\n type=\"file\"\n multiple={multiple}\n accept={accept}\n disabled={disabled}\n onChange={handleChange}\n style={{ display: 'none' }}\n aria-hidden=\"true\"\n tabIndex={-1}\n />\n\n {error && <FieldError>{error}</FieldError>}\n </Field>\n );\n};\n\nUploadFile.displayName = 'UploadFile';\n"],"names":[],"mappings":";;;;;;;;;;;;AA4CA,SAAS,kBAAkB,IAAA,EAAuC;AAChE,EAAA,MAAM,SAAA,GAAY,OAAA,CAAQ,MAAO,IAAA,EAAM,KAAK,UAAA,CAAW,QAAQ,CAAA,GAAI,GAAA,CAAI,gBAAgB,IAAI,CAAA,GAAI,IAAA,EAAO,CAAC,IAAI,CAAC,CAAA;AAE5G,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,SAAA,EAAW;AAChB,IAAA,OAAO,MAAM,GAAA,CAAI,eAAA,CAAgB,SAAS,CAAA;AAAA,EAC5C,CAAA,EAAG,CAAC,SAAS,CAAC,CAAA;AAEd,EAAA,OAAO,SAAA;AACT;AAGO,MAAM,aAAwC,CAAC;AAAA,EACpD,MAAA,GAAS,UAAA;AAAA,EACT,QAAA,GAAW,KAAA;AAAA,EACX,MAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA,EAAU,YAAA;AAAA,EACV,KAAA;AAAA,EACA,KAAA;AAAA,EACA,WAAA;AAAA,EACA,IAA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