@salt-ds/lab 1.0.0-alpha.5 → 1.0.0-alpha.6

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 (148) hide show
  1. package/dist-cjs/packages/lab/src/banner/Banner.css.js +1 -1
  2. package/dist-cjs/packages/lab/src/calendar/internal/CalendarNavigation.js +1 -0
  3. package/dist-cjs/packages/lab/src/calendar/internal/CalendarNavigation.js.map +1 -1
  4. package/dist-cjs/packages/lab/src/cascading-menu/CascadingMenuList.js +2 -2
  5. package/dist-cjs/packages/lab/src/cascading-menu/CascadingMenuList.js.map +1 -1
  6. package/dist-cjs/packages/lab/src/combo-box/ComboBox.js +1 -0
  7. package/dist-cjs/packages/lab/src/combo-box/ComboBox.js.map +1 -1
  8. package/dist-cjs/packages/lab/src/combo-box-deprecated/ComboBoxDeprecated.js +1 -0
  9. package/dist-cjs/packages/lab/src/combo-box-deprecated/ComboBoxDeprecated.js.map +1 -1
  10. package/dist-cjs/packages/lab/src/combo-box-deprecated/internal/DefaultComboBox.js +2 -2
  11. package/dist-cjs/packages/lab/src/combo-box-deprecated/internal/DefaultComboBox.js.map +1 -1
  12. package/dist-cjs/packages/lab/src/combo-box-deprecated/internal/MultiSelectComboBox.js +3 -2
  13. package/dist-cjs/packages/lab/src/combo-box-deprecated/internal/MultiSelectComboBox.js.map +1 -1
  14. package/dist-cjs/packages/lab/src/common-hooks/useCollectionItems.js +2 -2
  15. package/dist-cjs/packages/lab/src/common-hooks/useCollectionItems.js.map +1 -1
  16. package/dist-cjs/packages/lab/src/dropdown/DropdownBase.js +2 -2
  17. package/dist-cjs/packages/lab/src/dropdown/DropdownBase.js.map +1 -1
  18. package/dist-cjs/packages/lab/src/dropdown/DropdownButton.js +2 -1
  19. package/dist-cjs/packages/lab/src/dropdown/DropdownButton.js.map +1 -1
  20. package/dist-cjs/packages/lab/src/dropdown/useDropdownBase.js +1 -0
  21. package/dist-cjs/packages/lab/src/dropdown/useDropdownBase.js.map +1 -1
  22. package/dist-cjs/packages/lab/src/file-drop-zone/FileDropZone.css.js +1 -1
  23. package/dist-cjs/packages/lab/src/form-field/FormField.css.js +1 -1
  24. package/dist-cjs/packages/lab/src/form-field/FormField.js +1 -0
  25. package/dist-cjs/packages/lab/src/form-field/FormField.js.map +1 -1
  26. package/dist-cjs/packages/lab/src/form-field/FormHelperText.css.js +1 -1
  27. package/dist-cjs/packages/lab/src/form-field/FormHelperText.js +1 -1
  28. package/dist-cjs/packages/lab/src/form-field/FormHelperText.js.map +1 -1
  29. package/dist-cjs/packages/lab/src/form-field-context/FormFieldContextNext.js +13 -0
  30. package/dist-cjs/packages/lab/src/form-field-context/FormFieldContextNext.js.map +1 -0
  31. package/dist-cjs/packages/lab/src/form-field-context/useFormFieldPropsNext.js +13 -0
  32. package/dist-cjs/packages/lab/src/form-field-context/useFormFieldPropsNext.js.map +1 -0
  33. package/dist-cjs/packages/lab/src/form-field-next/FormFieldHelperText.css.js +9 -0
  34. package/dist-cjs/packages/lab/src/form-field-next/FormFieldHelperText.css.js.map +1 -0
  35. package/dist-cjs/packages/lab/src/form-field-next/FormFieldHelperText.js +32 -0
  36. package/dist-cjs/packages/lab/src/form-field-next/FormFieldHelperText.js.map +1 -0
  37. package/dist-cjs/packages/lab/src/form-field-next/FormFieldLabel.css.js +9 -0
  38. package/dist-cjs/packages/lab/src/form-field-next/FormFieldLabel.css.js.map +1 -0
  39. package/dist-cjs/packages/lab/src/form-field-next/FormFieldLabel.js +26 -0
  40. package/dist-cjs/packages/lab/src/form-field-next/FormFieldLabel.js.map +1 -0
  41. package/dist-cjs/packages/lab/src/form-field-next/FormFieldNext.css.js +9 -0
  42. package/dist-cjs/packages/lab/src/form-field-next/FormFieldNext.css.js.map +1 -0
  43. package/dist-cjs/packages/lab/src/form-field-next/FormFieldNext.js +90 -0
  44. package/dist-cjs/packages/lab/src/form-field-next/FormFieldNext.js.map +1 -0
  45. package/dist-cjs/packages/lab/src/index.js +10 -0
  46. package/dist-cjs/packages/lab/src/index.js.map +1 -1
  47. package/dist-cjs/packages/lab/src/input/Input.js +1 -0
  48. package/dist-cjs/packages/lab/src/input/Input.js.map +1 -1
  49. package/dist-cjs/packages/lab/src/input-next/InputNext.css.js +9 -0
  50. package/dist-cjs/packages/lab/src/input-next/InputNext.css.js.map +1 -0
  51. package/dist-cjs/packages/lab/src/input-next/InputNext.js +126 -0
  52. package/dist-cjs/packages/lab/src/input-next/InputNext.js.map +1 -0
  53. package/dist-cjs/packages/lab/src/overlay/useOverlay.js +5 -4
  54. package/dist-cjs/packages/lab/src/overlay/useOverlay.js.map +1 -1
  55. package/dist-cjs/packages/lab/src/query-input/internal/QueryInputBody.js +1 -0
  56. package/dist-cjs/packages/lab/src/query-input/internal/QueryInputBody.js.map +1 -1
  57. package/dist-cjs/packages/lab/src/query-input/internal/ValueSelector.js +2 -2
  58. package/dist-cjs/packages/lab/src/query-input/internal/ValueSelector.js.map +1 -1
  59. package/dist-cjs/packages/lab/src/stepper-input/internal/useActivationIndicatorPosition.js +2 -0
  60. package/dist-cjs/packages/lab/src/stepper-input/internal/useActivationIndicatorPosition.js.map +1 -1
  61. package/dist-cjs/packages/lab/src/switch/Switch.js +1 -0
  62. package/dist-cjs/packages/lab/src/switch/Switch.js.map +1 -1
  63. package/dist-cjs/packages/lab/src/tabs/Tabstrip.js +1 -0
  64. package/dist-cjs/packages/lab/src/tabs/Tabstrip.js.map +1 -1
  65. package/dist-cjs/packages/lab/src/tokenized-input/useTokenizedInput.js +1 -0
  66. package/dist-cjs/packages/lab/src/tokenized-input/useTokenizedInput.js.map +1 -1
  67. package/dist-cjs/packages/lab/src/toolbar/overflow-panel/OverflowPanel.js +1 -0
  68. package/dist-cjs/packages/lab/src/toolbar/overflow-panel/OverflowPanel.js.map +1 -1
  69. package/dist-es/packages/lab/src/banner/Banner.css.js +1 -1
  70. package/dist-es/packages/lab/src/calendar/internal/CalendarNavigation.js +1 -0
  71. package/dist-es/packages/lab/src/calendar/internal/CalendarNavigation.js.map +1 -1
  72. package/dist-es/packages/lab/src/cascading-menu/CascadingMenuList.js +2 -2
  73. package/dist-es/packages/lab/src/cascading-menu/CascadingMenuList.js.map +1 -1
  74. package/dist-es/packages/lab/src/combo-box/ComboBox.js +1 -0
  75. package/dist-es/packages/lab/src/combo-box/ComboBox.js.map +1 -1
  76. package/dist-es/packages/lab/src/combo-box-deprecated/ComboBoxDeprecated.js +1 -0
  77. package/dist-es/packages/lab/src/combo-box-deprecated/ComboBoxDeprecated.js.map +1 -1
  78. package/dist-es/packages/lab/src/combo-box-deprecated/internal/DefaultComboBox.js +2 -2
  79. package/dist-es/packages/lab/src/combo-box-deprecated/internal/DefaultComboBox.js.map +1 -1
  80. package/dist-es/packages/lab/src/combo-box-deprecated/internal/MultiSelectComboBox.js +3 -2
  81. package/dist-es/packages/lab/src/combo-box-deprecated/internal/MultiSelectComboBox.js.map +1 -1
  82. package/dist-es/packages/lab/src/common-hooks/useCollectionItems.js +2 -2
  83. package/dist-es/packages/lab/src/common-hooks/useCollectionItems.js.map +1 -1
  84. package/dist-es/packages/lab/src/dropdown/DropdownBase.js +2 -2
  85. package/dist-es/packages/lab/src/dropdown/DropdownBase.js.map +1 -1
  86. package/dist-es/packages/lab/src/dropdown/DropdownButton.js +2 -1
  87. package/dist-es/packages/lab/src/dropdown/DropdownButton.js.map +1 -1
  88. package/dist-es/packages/lab/src/dropdown/useDropdownBase.js +1 -0
  89. package/dist-es/packages/lab/src/dropdown/useDropdownBase.js.map +1 -1
  90. package/dist-es/packages/lab/src/file-drop-zone/FileDropZone.css.js +1 -1
  91. package/dist-es/packages/lab/src/form-field/FormField.css.js +1 -1
  92. package/dist-es/packages/lab/src/form-field/FormField.js +1 -0
  93. package/dist-es/packages/lab/src/form-field/FormField.js.map +1 -1
  94. package/dist-es/packages/lab/src/form-field/FormHelperText.css.js +1 -1
  95. package/dist-es/packages/lab/src/form-field/FormHelperText.js +1 -1
  96. package/dist-es/packages/lab/src/form-field/FormHelperText.js.map +1 -1
  97. package/dist-es/packages/lab/src/form-field-context/FormFieldContextNext.js +9 -0
  98. package/dist-es/packages/lab/src/form-field-context/FormFieldContextNext.js.map +1 -0
  99. package/dist-es/packages/lab/src/form-field-context/useFormFieldPropsNext.js +9 -0
  100. package/dist-es/packages/lab/src/form-field-context/useFormFieldPropsNext.js.map +1 -0
  101. package/dist-es/packages/lab/src/form-field-next/FormFieldHelperText.css.js +7 -0
  102. package/dist-es/packages/lab/src/form-field-next/FormFieldHelperText.css.js.map +1 -0
  103. package/dist-es/packages/lab/src/form-field-next/FormFieldHelperText.js +24 -0
  104. package/dist-es/packages/lab/src/form-field-next/FormFieldHelperText.js.map +1 -0
  105. package/dist-es/packages/lab/src/form-field-next/FormFieldLabel.css.js +7 -0
  106. package/dist-es/packages/lab/src/form-field-next/FormFieldLabel.css.js.map +1 -0
  107. package/dist-es/packages/lab/src/form-field-next/FormFieldLabel.js +22 -0
  108. package/dist-es/packages/lab/src/form-field-next/FormFieldLabel.js.map +1 -0
  109. package/dist-es/packages/lab/src/form-field-next/FormFieldNext.css.js +7 -0
  110. package/dist-es/packages/lab/src/form-field-next/FormFieldNext.css.js.map +1 -0
  111. package/dist-es/packages/lab/src/form-field-next/FormFieldNext.js +86 -0
  112. package/dist-es/packages/lab/src/form-field-next/FormFieldNext.js.map +1 -0
  113. package/dist-es/packages/lab/src/index.js +6 -0
  114. package/dist-es/packages/lab/src/index.js.map +1 -1
  115. package/dist-es/packages/lab/src/input/Input.js +1 -0
  116. package/dist-es/packages/lab/src/input/Input.js.map +1 -1
  117. package/dist-es/packages/lab/src/input-next/InputNext.css.js +7 -0
  118. package/dist-es/packages/lab/src/input-next/InputNext.css.js.map +1 -0
  119. package/dist-es/packages/lab/src/input-next/InputNext.js +122 -0
  120. package/dist-es/packages/lab/src/input-next/InputNext.js.map +1 -0
  121. package/dist-es/packages/lab/src/overlay/useOverlay.js +5 -4
  122. package/dist-es/packages/lab/src/overlay/useOverlay.js.map +1 -1
  123. package/dist-es/packages/lab/src/query-input/internal/QueryInputBody.js +1 -0
  124. package/dist-es/packages/lab/src/query-input/internal/QueryInputBody.js.map +1 -1
  125. package/dist-es/packages/lab/src/query-input/internal/ValueSelector.js +2 -2
  126. package/dist-es/packages/lab/src/query-input/internal/ValueSelector.js.map +1 -1
  127. package/dist-es/packages/lab/src/stepper-input/internal/useActivationIndicatorPosition.js +2 -0
  128. package/dist-es/packages/lab/src/stepper-input/internal/useActivationIndicatorPosition.js.map +1 -1
  129. package/dist-es/packages/lab/src/switch/Switch.js +1 -0
  130. package/dist-es/packages/lab/src/switch/Switch.js.map +1 -1
  131. package/dist-es/packages/lab/src/tabs/Tabstrip.js +1 -0
  132. package/dist-es/packages/lab/src/tabs/Tabstrip.js.map +1 -1
  133. package/dist-es/packages/lab/src/tokenized-input/useTokenizedInput.js +1 -0
  134. package/dist-es/packages/lab/src/tokenized-input/useTokenizedInput.js.map +1 -1
  135. package/dist-es/packages/lab/src/toolbar/overflow-panel/OverflowPanel.js +1 -0
  136. package/dist-es/packages/lab/src/toolbar/overflow-panel/OverflowPanel.js.map +1 -1
  137. package/dist-types/form-field/FormField.d.ts +2 -0
  138. package/dist-types/form-field-context/FormFieldContextNext.d.ts +6 -0
  139. package/dist-types/form-field-context/index.d.ts +2 -0
  140. package/dist-types/form-field-context/useFormFieldPropsNext.d.ts +2 -0
  141. package/dist-types/form-field-next/FormFieldHelperText.d.ts +9 -0
  142. package/dist-types/form-field-next/FormFieldLabel.d.ts +14 -0
  143. package/dist-types/form-field-next/FormFieldNext.d.ts +50 -0
  144. package/dist-types/form-field-next/index.d.ts +3 -0
  145. package/dist-types/index.d.ts +2 -0
  146. package/dist-types/input-next/InputNext.d.ts +34 -0
  147. package/dist-types/input-next/index.d.ts +1 -0
  148. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"FormField.js","sources":["../src/form-field/FormField.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n Dispatch,\n ElementType,\n FocusEventHandler,\n ForwardedRef,\n forwardRef,\n HTMLAttributes,\n SetStateAction,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { makePrefixer, Tooltip, useForkRef, useId } from \"@salt-ds/core\";\nimport { FormFieldContext } from \"../form-field-context\";\nimport { classBase } from \"./constant\";\nimport {\n FormActivationIndicator,\n FormActivationIndicatorProps,\n} from \"./FormActivationIndicator\";\nimport { FormHelperText, FormHelperTextProps } from \"./FormHelperText\";\nimport { FormLabel, FormLabelProps } from \"./FormLabel\";\nimport { NecessityIndicatorOptions } from \"./NecessityIndicator\";\nimport { StatusIndicatorProps } from \"./StatusIndicator\";\n\nimport \"./FormField.css\";\n\nexport type FormFieldLabelPlacement = \"top\" | \"left\";\nexport type FormFieldHelperTextPlacement = \"bottom\" | \"tooltip\";\nexport type FormFieldValidationStatus = \"error\" | \"warning\";\n\nexport interface A11yValueProps\n extends Pick<NecessityIndicatorOptions, \"required\"> {\n /**\n * If `true`, the FormField will be disabled.\n */\n disabled?: boolean;\n /** id of the helper text node */\n helperTextId?: string;\n /** id of the label node */\n labelId?: string;\n /**\n * The FormField value is Readonly\n */\n readOnly?: boolean;\n\n /**\n * Whether the form field needs to render helper text\n */\n renderHelperText?: boolean;\n}\n\nexport interface FormFieldProps\n extends HTMLAttributes<HTMLDivElement>,\n A11yValueProps {\n /**\n * The component used for activation indicator. Default to `FormActivationIndicator`.\n */\n ActivationIndicatorComponent?: ElementType<FormActivationIndicatorProps>;\n /**\n * Outer focus ring focus will not be applied. Defaults to false.\n */\n disableFocusRing?: boolean;\n // I hate this fullWidth business. We should support a width prop. The default should be 100% (standard block behaviour)\n // we should also support 'auto' or explicit numeric values\n /**\n * Whether the form field is occupying full width.\n */\n fullWidth?: boolean;\n /**\n * Whether to show the StatusIndicator component for validation states.\n */\n hasStatusIndicator?: boolean;\n /**\n * The helper text content\n */\n helperText?: string;\n /**\n * The component used for the helper text. Default to `FormHelperText`.\n */\n HelperTextComponent?: ElementType<FormHelperTextProps>;\n /**\n * Location the helperText, values: 'bottom' (default) or 'tooltip'.\n */\n helperTextPlacement?: FormFieldHelperTextPlacement;\n /**\n * Props to be applied to the `HelperTextComponent`.\n *\n * Generic on `FormHelperTextProps` is omitted.\n */\n HelperTextProps?: Partial<FormHelperTextProps>;\n /**\n * The label value for the FormField\n */\n label?: string;\n /**\n * The component used for the label. Default to `FormLabel`.\n */\n LabelComponent?: ElementType;\n /**\n * Location the label, values: 'top' (default) or 'left'\n */\n labelPlacement?: FormFieldLabelPlacement;\n /**\n * Props to be applied to the `LabelComponent`\n */\n LabelProps?: Partial<FormLabelProps>;\n /**\n * Override props to be used with the StatusIndicator component\n */\n StatusIndicatorProps?: Partial<StatusIndicatorProps>;\n /**\n * The state for the FormField: Must be one of: 'error'|'warning'|undefined\n */\n validationStatus?: FormFieldValidationStatus;\n /**\n * FormField variants; defaults to primary.\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\";\n}\n\nexport interface useA11yValueValue {\n \"aria-labelledby\": A11yValueProps[\"labelId\"];\n \"aria-required\": A11yValueProps[\"required\"];\n \"aria-describedby\": A11yValueProps[\"helperTextId\"] | undefined;\n disabled: A11yValueProps[\"disabled\"];\n readOnly: A11yValueProps[\"readOnly\"];\n}\n\nconst useA11yValue = ({\n required,\n disabled,\n readOnly,\n labelId,\n helperTextId,\n renderHelperText,\n}: A11yValueProps) => {\n return useMemo(\n () => ({\n \"aria-labelledby\": labelId,\n \"aria-required\": required,\n \"aria-describedby\": renderHelperText ? helperTextId : undefined,\n disabled,\n readOnly,\n }),\n [labelId, disabled, readOnly, required, renderHelperText, helperTextId]\n );\n};\n\n// TODO: Add TS props for this\nexport const useFormField = ({\n onBlur,\n onFocus,\n}: {\n onBlur?: FocusEventHandler<HTMLDivElement>;\n onFocus?: FocusEventHandler<HTMLDivElement>;\n}): [\n { focused: boolean },\n { setFocused: Dispatch<SetStateAction<boolean>> },\n {\n onBlur: FocusEventHandler<HTMLDivElement>;\n onFocus: FocusEventHandler<HTMLDivElement>;\n }\n] => {\n const [focused, setFocused] = useState(false);\n const handleBlur: FocusEventHandler<HTMLDivElement> = (event) => {\n setFocused(false);\n onBlur?.(event);\n };\n const handleFocus: FocusEventHandler<HTMLDivElement> = (event) => {\n setFocused(true);\n onFocus?.(event);\n };\n return [\n {\n focused,\n },\n {\n setFocused,\n },\n {\n onBlur: handleBlur,\n onFocus: handleFocus,\n },\n ];\n};\n\nconst withBaseName = makePrefixer(classBase);\n\nexport const FormField = forwardRef(\n (\n {\n ActivationIndicatorComponent = FormActivationIndicator,\n children,\n className,\n disabled,\n disableFocusRing = false,\n fullWidth = true,\n hasStatusIndicator,\n HelperTextComponent = FormHelperText,\n HelperTextProps,\n helperText,\n helperTextPlacement = \"bottom\",\n label,\n LabelComponent = FormLabel,\n labelPlacement = \"top\",\n LabelProps = { displayedNecessity: \"required\" },\n onBlur,\n onFocus,\n readOnly,\n required,\n StatusIndicatorProps,\n validationStatus,\n variant = \"primary\",\n ...restProps\n }: FormFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n ) => {\n const labelId = useId(LabelProps?.id);\n const helperTextId = useId(HelperTextProps?.id);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const renderHelperText = !!helperText;\n\n const a11yValue = useA11yValue({\n required,\n disabled,\n readOnly,\n labelId,\n helperTextId,\n renderHelperText,\n });\n\n const [states, dispatchers, eventHandlers] = useFormField({\n onBlur,\n onFocus,\n });\n\n const hasLabel = label !== undefined;\n const labelTop = hasLabel && labelPlacement === \"top\";\n const labelLeft = hasLabel && labelPlacement === \"left\";\n const isWarning = validationStatus === \"warning\";\n const isError = validationStatus === \"error\";\n const focusClass = disableFocusRing\n ? \"lowFocused\"\n : \"focused\"; /* NOTE: need to look at */\n const inlineHelperText =\n renderHelperText && helperTextPlacement === \"bottom\";\n const tooltipHelperText =\n renderHelperText &&\n helperTextPlacement === \"tooltip\" &&\n !hasStatusIndicator;\n\n const handleTriggerRef = useForkRef(rootRef, ref);\n\n return (\n <Tooltip disabled={!tooltipHelperText} content={helperText}>\n <div\n ref={handleTriggerRef}\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"readOnly\")]: readOnly,\n [withBaseName(\"warning\")]: isWarning,\n [withBaseName(\"error\")]: isError,\n [withBaseName(\"fullWidth\")]: fullWidth,\n [withBaseName(focusClass)]: states.focused,\n [withBaseName(\"labelTop\")]: labelTop,\n [withBaseName(\"labelLeft\")]: labelLeft,\n [withBaseName(`withHelperText`)]: inlineHelperText,\n [withBaseName(variant)]: variant,\n },\n className\n )}\n {...eventHandlers}\n {...restProps}\n >\n <FormFieldContext.Provider\n value={{\n ...states,\n ...dispatchers,\n ...eventHandlers,\n a11yProps: a11yValue,\n inFormField: true,\n ref: rootRef,\n }}\n >\n {hasLabel && (\n <LabelComponent\n {...LabelProps}\n validationStatus={validationStatus}\n hasStatusIndicator={hasStatusIndicator}\n StatusIndicatorProps={StatusIndicatorProps}\n className={LabelProps.className}\n label={label}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n tooltipText={helperText}\n id={labelId}\n />\n )}\n {children}\n <ActivationIndicatorComponent\n hasIcon={!hasStatusIndicator}\n validationStatus={validationStatus}\n />\n {renderHelperText && (\n <HelperTextComponent\n helperText={helperText}\n helperTextPlacement={helperTextPlacement}\n {...HelperTextProps}\n id={helperTextId}\n />\n )}\n </FormFieldContext.Provider>\n </div>\n </Tooltip>\n );\n }\n);\n"],"names":["StatusIndicatorProps"],"mappings":";;;;;;;;;;;AAiIA,MAAM,eAAe,CAAC;AAAA,EACpB,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,gBAAA;AACF,CAAsB,KAAA;AACpB,EAAO,OAAA,OAAA;AAAA,IACL,OAAO;AAAA,MACL,iBAAmB,EAAA,OAAA;AAAA,MACnB,eAAiB,EAAA,QAAA;AAAA,MACjB,kBAAA,EAAoB,mBAAmB,YAAe,GAAA,KAA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,GAAG,aAAA;AAAA,QACH,GAAG,SAAA;AAAA,QAEJ,QAAA,kBAAA,IAAA,CAAC,iBAAiB,QAAjB,EAAA;AAAA,UACC,KAAO,EAAA;AAAA,YACL,GAAG,MAAA;AAAA,YACH,GAAG,WAAA;AAAA,YACH,GAAG,aAAA;AAAA,YACH,SAAW,EAAA,SAAA;AAAA,YACX,WAAa,EAAA,IAAA;AAAA,YACb,GAAK,EAAA,OAAA;AAAA,WACP;AAAA,UAEC,QAAA,EAAA;AAAA,YAAA,QAAA,oBACE,GAAA,CAAA,cAAA,EAAA;AAAA,cACE,GAAG,UAAA;AAAA,cACJ,gBAAA;AAAA,cACA,kBAAA;AAAA,cACA,oBAAsBA,EAAAA,qBAAAA;AAAA,cACtB,WAAW,UAAW,CAAA,SAAA;AAAA,cACtB,KAAA;AAAA,cACA,QAAA;AAAA,cACA,QAAA;AAAA,cACA,QAAA;AAAA,cACA,WAAa,EAAA,UAAA;AAAA,cACb,EAAI,EAAA,OAAA;AAAA,aACN,CAAA;AAAA,YAED,QAAA;AAAA,4BACA,GAAA,CAAA,4BAAA,EAAA;AAAA,cACC,SAAS,CAAC,kBAAA;AAAA,cACV,gBAAA;AAAA,aACF,CAAA;AAAA,YACC,oCACE,GAAA,CAAA,mBAAA,EAAA;AAAA,cACC,UAAA;AAAA,cACA,mBAAA;AAAA,cACC,GAAG,eAAA;AAAA,cACJ,EAAI,EAAA,YAAA;AAAA,aACN,CAAA;AAAA,WAAA;AAAA,SAEJ,CAAA;AAAA,OACF,CAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
1
+ {"version":3,"file":"FormField.js","sources":["../src/form-field/FormField.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n Dispatch,\n ElementType,\n FocusEventHandler,\n ForwardedRef,\n forwardRef,\n HTMLAttributes,\n SetStateAction,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { makePrefixer, Tooltip, useForkRef, useId } from \"@salt-ds/core\";\nimport { FormFieldContext } from \"../form-field-context\";\nimport { classBase } from \"./constant\";\nimport {\n FormActivationIndicator,\n FormActivationIndicatorProps,\n} from \"./FormActivationIndicator\";\nimport { FormHelperText, FormHelperTextProps } from \"./FormHelperText\";\nimport { FormLabel, FormLabelProps } from \"./FormLabel\";\nimport { NecessityIndicatorOptions } from \"./NecessityIndicator\";\nimport { StatusIndicatorProps } from \"./StatusIndicator\";\n\nimport \"./FormField.css\";\n\nexport type FormFieldLabelPlacement = \"top\" | \"left\";\nexport type FormFieldHelperTextPlacement = \"bottom\" | \"tooltip\";\nexport type FormFieldValidationStatus = \"error\" | \"warning\";\n\nexport interface A11yValueProps\n extends Pick<NecessityIndicatorOptions, \"required\"> {\n /**\n * If `true`, the FormField will be disabled.\n */\n disabled?: boolean;\n /** id of the helper text node */\n helperTextId?: string;\n /** id of the label node */\n labelId?: string;\n /**\n * The FormField value is Readonly\n */\n readOnly?: boolean;\n\n /**\n * Whether the form field needs to render helper text\n */\n renderHelperText?: boolean;\n}\n\nexport interface FormFieldProps\n extends HTMLAttributes<HTMLDivElement>,\n A11yValueProps {\n /**\n * The component used for activation indicator. Default to `FormActivationIndicator`.\n */\n ActivationIndicatorComponent?: ElementType<FormActivationIndicatorProps>;\n /**\n * Outer focus ring focus will not be applied. Defaults to false.\n */\n disableFocusRing?: boolean;\n // I hate this fullWidth business. We should support a width prop. The default should be 100% (standard block behaviour)\n // we should also support 'auto' or explicit numeric values\n /**\n * Whether the form field is occupying full width.\n */\n fullWidth?: boolean;\n /**\n * Whether to show the StatusIndicator component for validation states.\n */\n hasStatusIndicator?: boolean;\n /**\n * The helper text content\n */\n helperText?: string;\n /**\n * The component used for the helper text. Default to `FormHelperText`.\n */\n HelperTextComponent?: ElementType<FormHelperTextProps>;\n /**\n * Location the helperText, values: 'bottom' (default) or 'tooltip'.\n */\n helperTextPlacement?: FormFieldHelperTextPlacement;\n /**\n * Props to be applied to the `HelperTextComponent`.\n *\n * Generic on `FormHelperTextProps` is omitted.\n */\n HelperTextProps?: Partial<FormHelperTextProps>;\n /**\n * The label value for the FormField\n */\n label?: string;\n /**\n * The component used for the label. Default to `FormLabel`.\n */\n LabelComponent?: ElementType;\n /**\n * Location the label, values: 'top' (default) or 'left'\n */\n labelPlacement?: FormFieldLabelPlacement;\n /**\n * Props to be applied to the `LabelComponent`\n */\n LabelProps?: Partial<FormLabelProps>;\n /**\n * Override props to be used with the StatusIndicator component\n */\n StatusIndicatorProps?: Partial<StatusIndicatorProps>;\n /**\n * The state for the FormField: Must be one of: 'error'|'warning'|undefined\n */\n validationStatus?: FormFieldValidationStatus;\n /**\n * FormField variants; defaults to primary.\n *\n * **Deprecated:** The 'tertiary' variant has been deprecated\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\";\n}\n\nexport interface useA11yValueValue {\n \"aria-labelledby\": A11yValueProps[\"labelId\"];\n \"aria-required\": A11yValueProps[\"required\"];\n \"aria-describedby\": A11yValueProps[\"helperTextId\"] | undefined;\n disabled: A11yValueProps[\"disabled\"];\n readOnly: A11yValueProps[\"readOnly\"];\n}\n\nconst useA11yValue = ({\n required,\n disabled,\n readOnly,\n labelId,\n helperTextId,\n renderHelperText,\n}: A11yValueProps) => {\n return useMemo(\n () => ({\n \"aria-labelledby\": labelId,\n \"aria-required\": required,\n \"aria-describedby\": renderHelperText ? helperTextId : undefined,\n disabled,\n readOnly,\n }),\n [labelId, disabled, readOnly, required, renderHelperText, helperTextId]\n );\n};\n\n// TODO: Add TS props for this\nexport const useFormField = ({\n onBlur,\n onFocus,\n}: {\n onBlur?: FocusEventHandler<HTMLDivElement>;\n onFocus?: FocusEventHandler<HTMLDivElement>;\n}): [\n { focused: boolean },\n { setFocused: Dispatch<SetStateAction<boolean>> },\n {\n onBlur: FocusEventHandler<HTMLDivElement>;\n onFocus: FocusEventHandler<HTMLDivElement>;\n }\n] => {\n const [focused, setFocused] = useState(false);\n const handleBlur: FocusEventHandler<HTMLDivElement> = (event) => {\n setFocused(false);\n onBlur?.(event);\n };\n const handleFocus: FocusEventHandler<HTMLDivElement> = (event) => {\n setFocused(true);\n onFocus?.(event);\n };\n return [\n {\n focused,\n },\n {\n setFocused,\n },\n {\n onBlur: handleBlur,\n onFocus: handleFocus,\n },\n ];\n};\n\nconst withBaseName = makePrefixer(classBase);\n\nexport const FormField = forwardRef(\n (\n {\n ActivationIndicatorComponent = FormActivationIndicator,\n children,\n className,\n disabled,\n disableFocusRing = false,\n fullWidth = true,\n hasStatusIndicator,\n HelperTextComponent = FormHelperText,\n HelperTextProps,\n helperText,\n helperTextPlacement = \"bottom\",\n label,\n LabelComponent = FormLabel,\n labelPlacement = \"top\",\n LabelProps = { displayedNecessity: \"required\" },\n onBlur,\n onFocus,\n readOnly,\n required,\n StatusIndicatorProps,\n validationStatus,\n variant = \"primary\",\n ...restProps\n }: FormFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n ) => {\n const labelId = useId(LabelProps?.id);\n const helperTextId = useId(HelperTextProps?.id);\n const rootRef = useRef<HTMLDivElement>(null);\n\n const renderHelperText = !!helperText;\n\n const a11yValue = useA11yValue({\n required,\n disabled,\n readOnly,\n labelId,\n helperTextId,\n renderHelperText,\n });\n\n const [states, dispatchers, eventHandlers] = useFormField({\n onBlur,\n onFocus,\n });\n\n const hasLabel = label !== undefined;\n const labelTop = hasLabel && labelPlacement === \"top\";\n const labelLeft = hasLabel && labelPlacement === \"left\";\n const isWarning = validationStatus === \"warning\";\n const isError = validationStatus === \"error\";\n const focusClass = disableFocusRing\n ? \"lowFocused\"\n : \"focused\"; /* NOTE: need to look at */\n const inlineHelperText =\n renderHelperText && helperTextPlacement === \"bottom\";\n const tooltipHelperText =\n renderHelperText &&\n helperTextPlacement === \"tooltip\" &&\n !hasStatusIndicator;\n\n const handleTriggerRef = useForkRef(rootRef, ref);\n\n return (\n <Tooltip disabled={!tooltipHelperText} content={helperText}>\n <div\n ref={handleTriggerRef}\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"readOnly\")]: readOnly,\n [withBaseName(\"warning\")]: isWarning,\n [withBaseName(\"error\")]: isError,\n [withBaseName(\"fullWidth\")]: fullWidth,\n [withBaseName(focusClass)]: states.focused,\n [withBaseName(\"labelTop\")]: labelTop,\n [withBaseName(\"labelLeft\")]: labelLeft,\n [withBaseName(`withHelperText`)]: inlineHelperText,\n [withBaseName(variant)]: variant,\n },\n className\n )}\n {...eventHandlers}\n {...restProps}\n >\n <FormFieldContext.Provider\n value={{\n ...states,\n ...dispatchers,\n ...eventHandlers,\n a11yProps: a11yValue,\n inFormField: true,\n ref: rootRef,\n }}\n >\n {hasLabel && (\n <LabelComponent\n {...LabelProps}\n validationStatus={validationStatus}\n hasStatusIndicator={hasStatusIndicator}\n StatusIndicatorProps={StatusIndicatorProps}\n className={LabelProps.className}\n label={label}\n disabled={disabled}\n readOnly={readOnly}\n required={required}\n tooltipText={helperText}\n id={labelId}\n />\n )}\n {children}\n <ActivationIndicatorComponent\n hasIcon={!hasStatusIndicator}\n validationStatus={validationStatus}\n />\n {renderHelperText && (\n <HelperTextComponent\n helperText={helperText}\n helperTextPlacement={helperTextPlacement}\n {...HelperTextProps}\n id={helperTextId}\n />\n )}\n </FormFieldContext.Provider>\n </div>\n </Tooltip>\n );\n }\n);\n"],"names":["StatusIndicatorProps"],"mappings":";;;;;;;;;;;;AAmIA,MAAM,eAAe,CAAC;AAAA,EACpB,QAAA;AAAA,EACA,QAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,gBAAA;AACF,CAAsB,KAAA;AACpB,EAAO,OAAA,OAAA;AAAA,IACL,OAAO;AAAA,MACL,iBAAmB,EAAA,OAAA;AAAA,MACnB,eAAiB,EAAA,QAAA;AAAA,MACjB,kBAAA,EAAoB,mBAAmB,YAAe,GAAA,KAAA,CAAA;AAAA,MACtD,QAAA;AAAA,MACA,QAAA;AAAA,KACF,CAAA;AAAA,IACA,CAAC,OAAS,EAAA,QAA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AA;AAAA,UACC,KAAO,EAAA;AAAA,YACL,GAAG,MAAA;AAAA,YACH,GAAG,WAAA;AAAA,YACH,GAAG,aAAA;AAAA,YACH,SAAW,EAAA,SAAA;AAAA,YACX,WAAa,EAAA,IAAA;AAAA,YACb,GAAK,EAAA,OAAA;AAAA,WACP;AAAA,UAEC,QAAA,EAAA;AAAA,YAAA,QAAA,oBACE,GAAA,CAAA,cAAA,EAAA;AAAA,cACE,GAAG,UAAA;AAAA,cACJ,gBAAA;AAAA,cACA,kBAAA;AAAA,cACA,oBAAsBA,EAAAA,qBAAAA;AAAA,cACtB,WAAW,UAAW,CAAA,SAAA;AAAA,cACtB,KAAA;AAAA,cACA,QAAA;AAAA,cACA,QAAA;AAAA,cACA,QAAA;AAAA,cACA,WAAa,EAAA,UAAA;AAAA,cACb,EAAI,EAAA,OAAA;AAAA,aACN,CAAA;AAAA,YAED,QAAA;AAAA,4BACA,GAAA,CAAA,4BAAA,EAAA;AAAA,cACC,SAAS,CAAC,kBAAA;AAAA,cACV,gBAAA;AAAA,aACF,CAAA;AAAA,YACC,oCACE,GAAA,CAAA,mBAAA,EAAA;AAAA,cACC,UAAA;AAAA,cACA,mBAAA;AAAA,cACC,GAAG,eAAA;AAAA,cACJ,EAAI,EAAA,YAAA;AAAA,aACN,CAAA;AAAA,WAAA;AAAA,SAEJ,CAAA;AAAA,OACF,CAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = "/* Styles applied to the root element dependent on density */\n.salt-density-high {\n --formField-helperText-marginTop-default: 2px;\n --formField-helperText-marginTop-fullWidth: 3px;\n\n --formField-helperText-background-offset-height: 17px;\n}\n.salt-density-medium {\n --formField-helperText-marginTop-default: 2px;\n --formField-helperText-marginTop-fullWidth: 3px;\n --formField-helperText-transform: translate(0, 2px);\n\n --formField-helperText-background-offset-height: 19px;\n}\n.salt-density-touch {\n --formField-helperText-marginTop-default: 8px;\n --formField-helperText-marginTop-fullWidth: 5px;\n --formField-helperText-transform: translate(0, -3px);\n\n --formField-helperText-background-offset-height: 21px;\n}\n.salt-density-low {\n --formField-helperText-marginTop-default: 4px;\n --formField-helperText-marginTop-fullWidth: 5px;\n --formField-helperText-transform: translate(0, 1px);\n\n --formField-helperText-background-offset-height: 21px;\n}\n\n/* Class applied if `fullWidth={true}` */\n.saltFormField-fullWidth {\n --formField-helperText-transform: none;\n}\n\n/* Class applied to the helper text container */\n.saltFormFieldHelperText {\n --formField-helperText-opacity: 1;\n\n color: var(--saltFormField-helperText-color, var(--salt-text-secondary-foreground));\n font-size: var(--formField-helperText-fontSize);\n font-style: var(--saltFormField-helperText-fontStyle, var(--salt-editable-help-fontStyle));\n letter-spacing: var(--saltFormField-helperText-letterSpacing, 0);\n line-height: var(--saltFormField-helperText-lineHeight, var(--salt-text-lineHeight));\n min-height: var(--saltFormField-helperText-minHeight, var(--salt-text-label-minHeight));\n margin-bottom: var(--saltFormField-helperText-marginBottom, 0);\n margin-top: var(--saltFormField-helperText-marginTop, var(--formField-helperText-marginTop));\n opacity: var(--saltFormField-helperText-opacity, var(--formField-helperText-opacity));\n padding-left: var(--saltFormField-helperText-paddingLeft, var(--salt-size-unit));\n padding-right: var(--saltFormField-helperText-paddingRight, var(--salt-size-unit));\n transform: var(--saltFormField-helperText-transform, var(--formField-helperText-transform, none));\n}\n";
3
+ var css_248z = "/* Styles applied to the root element dependent on density */\n.salt-density-high {\n --formField-helperText-marginTop-default: 2px;\n --formField-helperText-marginTop-fullWidth: 3px;\n\n --formField-helperText-background-offset-height: 17px;\n}\n.salt-density-medium {\n --formField-helperText-marginTop-default: 2px;\n --formField-helperText-marginTop-fullWidth: 3px;\n --formField-helperText-transform: translate(0, 2px);\n\n --formField-helperText-background-offset-height: 19px;\n}\n.salt-density-touch {\n --formField-helperText-marginTop-default: 8px;\n --formField-helperText-marginTop-fullWidth: 5px;\n --formField-helperText-transform: translate(0, -3px);\n\n --formField-helperText-background-offset-height: 21px;\n}\n.salt-density-low {\n --formField-helperText-marginTop-default: 4px;\n --formField-helperText-marginTop-fullWidth: 5px;\n --formField-helperText-transform: translate(0, 1px);\n\n --formField-helperText-background-offset-height: 21px;\n}\n\n/* Class applied if `fullWidth={true}` */\n.saltFormField-fullWidth {\n --formField-helperText-transform: none;\n}\n\n/* Class applied to the helper text container */\n.saltFormHelperText {\n --formField-helperText-opacity: 1;\n\n color: var(--saltFormField-helperText-color, var(--salt-text-secondary-foreground));\n font-size: var(--formField-helperText-fontSize);\n font-style: var(--saltFormField-helperText-fontStyle, var(--salt-editable-help-fontStyle));\n letter-spacing: var(--saltFormField-helperText-letterSpacing, 0);\n line-height: var(--saltFormField-helperText-lineHeight, var(--salt-text-lineHeight));\n min-height: var(--saltFormField-helperText-minHeight, var(--salt-text-label-minHeight));\n margin-bottom: var(--saltFormField-helperText-marginBottom, 0);\n margin-top: var(--saltFormField-helperText-marginTop, var(--formField-helperText-marginTop));\n opacity: var(--saltFormField-helperText-opacity, var(--formField-helperText-opacity));\n padding-left: var(--saltFormField-helperText-paddingLeft, var(--salt-size-unit));\n padding-right: var(--saltFormField-helperText-paddingRight, var(--salt-size-unit));\n transform: var(--saltFormField-helperText-transform, var(--formField-helperText-transform, none));\n}\n";
4
4
  styleInject(css_248z);
5
5
 
6
6
  export { css_248z as default };
@@ -9,7 +9,7 @@ const FormHelperText = ({
9
9
  if (helperText) {
10
10
  if (helperTextPlacement === "bottom") {
11
11
  return /* @__PURE__ */ jsx("p", {
12
- className: `saltFormFieldHelperText`,
12
+ className: "saltFormHelperText",
13
13
  ...restProps,
14
14
  children: helperText
15
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"FormHelperText.js","sources":["../src/form-field/FormHelperText.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef } from \"react\";\nimport { FormFieldProps } from \"./FormField\";\n\nimport \"./FormHelperText.css\";\n\nexport type FormHelperTextProps<E extends React.ElementType = \"p\"> =\n ComponentPropsWithoutRef<E> & {\n helperText: FormFieldProps[\"helperText\"];\n helperTextPlacement: FormFieldProps[\"helperTextPlacement\"];\n };\n\nexport const FormHelperText = <E extends React.ElementType = \"p\">({\n helperText,\n helperTextPlacement,\n ...restProps\n}: FormHelperTextProps<E>) => {\n if (helperText) {\n if (helperTextPlacement === \"bottom\") {\n return (\n <p className={`saltFormFieldHelperText`} {...restProps}>\n {helperText}\n </p>\n );\n } else if (helperTextPlacement === \"tooltip\") {\n console.warn(\"helperTextPlacement tooltip has not yet implemented\");\n return null;\n } else {\n return null;\n }\n } else {\n return null;\n }\n};\n"],"names":[],"mappings":";;;AAWO,MAAM,iBAAiB,CAAoC;AAAA,EAChE,UAAA;AAAA,EACA,mBAAA;AAAA,EACG,GAAA,SAAA;AACL,CAA8B,KAAA;AAC5B,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,IAAI,wBAAwB,QAAU,EAAA;AACpC,MAAA,uBACG,GAAA,CAAA,GAAA,EAAA;AAAA,QAAE,SAAW,EAAA,CAAA,uBAAA,CAAA;AAAA,QAA4B,GAAG,SAAA;AAAA,QAC1C,QAAA,EAAA,UAAA;AAAA,OACH,CAAA,CAAA;AAAA,KAEJ,MAAA,IAAW,wBAAwB,SAAW,EAAA;AAC5C,MAAA,OAAA,CAAQ,KAAK,qDAAqD,CAAA,CAAA;AAClE,MAAO,OAAA,IAAA,CAAA;AAAA,KACF,MAAA;AACL,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACK,MAAA;AACL,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACF;;;;"}
1
+ {"version":3,"file":"FormHelperText.js","sources":["../src/form-field/FormHelperText.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef } from \"react\";\nimport { FormFieldProps } from \"./FormField\";\n\nimport \"./FormHelperText.css\";\n\nexport type FormHelperTextProps<E extends React.ElementType = \"p\"> =\n ComponentPropsWithoutRef<E> & {\n helperText: FormFieldProps[\"helperText\"];\n helperTextPlacement: FormFieldProps[\"helperTextPlacement\"];\n };\n\nexport const FormHelperText = <E extends React.ElementType = \"p\">({\n helperText,\n helperTextPlacement,\n ...restProps\n}: FormHelperTextProps<E>) => {\n if (helperText) {\n if (helperTextPlacement === \"bottom\") {\n return (\n <p className=\"saltFormHelperText\" {...restProps}>\n {helperText}\n </p>\n );\n } else if (helperTextPlacement === \"tooltip\") {\n console.warn(\"helperTextPlacement tooltip has not yet implemented\");\n return null;\n } else {\n return null;\n }\n } else {\n return null;\n }\n};\n"],"names":[],"mappings":";;;AAWO,MAAM,iBAAiB,CAAoC;AAAA,EAChE,UAAA;AAAA,EACA,mBAAA;AAAA,EACG,GAAA,SAAA;AACL,CAA8B,KAAA;AAC5B,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,IAAI,wBAAwB,QAAU,EAAA;AACpC,MAAA,uBACG,GAAA,CAAA,GAAA,EAAA;AAAA,QAAE,SAAU,EAAA,oBAAA;AAAA,QAAsB,GAAG,SAAA;AAAA,QACnC,QAAA,EAAA,UAAA;AAAA,OACH,CAAA,CAAA;AAAA,KAEJ,MAAA,IAAW,wBAAwB,SAAW,EAAA;AAC5C,MAAA,OAAA,CAAQ,KAAK,qDAAqD,CAAA,CAAA;AAClE,MAAO,OAAA,IAAA,CAAA;AAAA,KACF,MAAA;AACL,MAAO,OAAA,IAAA,CAAA;AAAA,KACT;AAAA,GACK,MAAA;AACL,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AACF;;;;"}
@@ -0,0 +1,9 @@
1
+ import { createContext } from '@salt-ds/core';
2
+
3
+ const FormFieldContextNext = createContext(
4
+ "FormFieldContext",
5
+ {}
6
+ );
7
+
8
+ export { FormFieldContextNext };
9
+ //# sourceMappingURL=FormFieldContextNext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldContextNext.js","sources":["../src/form-field-context/FormFieldContextNext.ts"],"sourcesContent":["import { createContext } from \"@salt-ds/core\";\nimport { useA11yValueValue } from \"../form-field-next\";\n\nexport interface FormFieldContextNextValue {\n a11yProps: useA11yValueValue;\n}\n\nexport const FormFieldContextNext = createContext(\n \"FormFieldContext\",\n {} as FormFieldContextNextValue\n);\n"],"names":[],"mappings":";;AAOO,MAAM,oBAAuB,GAAA,aAAA;AAAA,EAClC,kBAAA;AAAA,EACA,EAAC;AACH;;;;"}
@@ -0,0 +1,9 @@
1
+ import { useContext } from 'react';
2
+ import { FormFieldContextNext } from './FormFieldContextNext.js';
3
+
4
+ function useFormFieldPropsNext() {
5
+ return useContext(FormFieldContextNext) || {};
6
+ }
7
+
8
+ export { useFormFieldPropsNext };
9
+ //# sourceMappingURL=useFormFieldPropsNext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useFormFieldPropsNext.js","sources":["../src/form-field-context/useFormFieldPropsNext.ts"],"sourcesContent":["import { useContext } from \"react\";\nimport {\n FormFieldContextNext,\n FormFieldContextNextValue,\n} from \"./FormFieldContextNext\";\n\nexport function useFormFieldPropsNext(): Partial<FormFieldContextNextValue> {\n return useContext(FormFieldContextNext) || {};\n}\n"],"names":[],"mappings":";;;AAMO,SAAS,qBAA4D,GAAA;AAC1E,EAAO,OAAA,UAAA,CAAW,oBAAoB,CAAA,IAAK,EAAC,CAAA;AAC9C;;;;"}
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".saltFormFieldHelperText.saltText {\n font-style: var(--saltFormField-helperText-fontStyle, var(--salt-editable-help-fontStyle));\n width: 100%;\n}\n";
4
+ styleInject(css_248z);
5
+
6
+ export { css_248z as default };
7
+ //# sourceMappingURL=FormFieldHelperText.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldHelperText.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,24 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import clsx from 'clsx';
3
+ import { makePrefixer, Text } from '@salt-ds/core';
4
+ import './FormFieldHelperText.css.js';
5
+
6
+ const withBaseName = makePrefixer("saltFormFieldHelperText");
7
+ const FormFieldHelperText = ({
8
+ className,
9
+ disabled,
10
+ helperText,
11
+ ...restProps
12
+ }) => {
13
+ return /* @__PURE__ */ jsx(Text, {
14
+ className: clsx(withBaseName(), className),
15
+ disabled,
16
+ variant: "secondary",
17
+ styleAs: "label",
18
+ ...restProps,
19
+ children: helperText
20
+ });
21
+ };
22
+
23
+ export { FormFieldHelperText };
24
+ //# sourceMappingURL=FormFieldHelperText.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldHelperText.js","sources":["../src/form-field-next/FormFieldHelperText.tsx"],"sourcesContent":["import clsx from \"clsx\";\nimport { makePrefixer, Text, TextProps } from \"@salt-ds/core\";\nimport { FormFieldProps } from \"./FormFieldNext\";\n\nimport \"./FormFieldHelperText.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldHelperText\");\n\nexport interface FormFieldHelperTextProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {\n helperText: FormFieldProps[\"helperText\"];\n disabled?: boolean;\n}\n\nexport const FormFieldHelperText = ({\n className,\n disabled,\n helperText,\n ...restProps\n}: FormFieldHelperTextProps) => {\n return (\n <Text\n className={clsx(withBaseName(), className)}\n disabled={disabled}\n variant=\"secondary\"\n styleAs=\"label\"\n {...restProps}\n >\n {helperText}\n </Text>\n );\n};\n"],"names":[],"mappings":";;;;;AAMA,MAAM,YAAA,GAAe,aAAa,yBAAyB,CAAA,CAAA;AAQpD,MAAM,sBAAsB,CAAC;AAAA,EAClC,SAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACG,GAAA,SAAA;AACL,CAAgC,KAAA;AAC9B,EAAA,uBACG,GAAA,CAAA,IAAA,EAAA;AAAA,IACC,SAAW,EAAA,IAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,IACzC,QAAA;AAAA,IACA,OAAQ,EAAA,WAAA;AAAA,IACR,OAAQ,EAAA,OAAA;AAAA,IACP,GAAG,SAAA;AAAA,IAEH,QAAA,EAAA,UAAA;AAAA,GACH,CAAA,CAAA;AAEJ;;;;"}
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".saltFormFieldLabel.saltText {\n align-self: center;\n font-weight: var(--saltFormField-label-fontWeight, var(--salt-text-fontWeight-strong));\n width: 100%;\n}\n\n.saltFormFieldLabel:hover + .saltFormFieldNext-controls * {\n --inputNext-borderColor: var(--salt-editable-borderColor-hover);\n}\n";
4
+ styleInject(css_248z);
5
+
6
+ export { css_248z as default };
7
+ //# sourceMappingURL=FormFieldLabel.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldLabel.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,22 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { clsx } from 'clsx';
3
+ import { makePrefixer, Label } from '@salt-ds/core';
4
+ import './FormFieldLabel.css.js';
5
+
6
+ const withBaseName = makePrefixer("saltFormFieldLabel");
7
+ const FormFieldLabel = ({
8
+ className,
9
+ disabled,
10
+ label,
11
+ ...restProps
12
+ }) => /* @__PURE__ */ jsx(Label, {
13
+ as: "label",
14
+ className: clsx(withBaseName(), className),
15
+ disabled,
16
+ variant: "secondary",
17
+ ...restProps,
18
+ children: label
19
+ });
20
+
21
+ export { FormFieldLabel };
22
+ //# sourceMappingURL=FormFieldLabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldLabel.js","sources":["../src/form-field-next/FormFieldLabel.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { Label, makePrefixer, TextProps } from \"@salt-ds/core\";\n\nimport \"./FormFieldLabel.css\";\n\nconst withBaseName = makePrefixer(\"saltFormFieldLabel\");\nexport interface FormFieldLabelProps\n extends Omit<TextProps<\"label\">, \"variant\" | \"styleAs\"> {\n /**\n * Whether the Form Field is disabled.\n */\n disabled?: boolean;\n /**\n * The label value for the FormFieldLabel\n */\n label?: string;\n}\n\nexport const FormFieldLabel = ({\n className,\n disabled,\n label,\n ...restProps\n}: FormFieldLabelProps) => (\n <Label\n as=\"label\"\n className={clsx(withBaseName(), className)}\n disabled={disabled}\n variant=\"secondary\"\n {...restProps}\n >\n {label}\n </Label>\n);\n"],"names":[],"mappings":";;;;;AAKA,MAAM,YAAA,GAAe,aAAa,oBAAoB,CAAA,CAAA;AAa/C,MAAM,iBAAiB,CAAC;AAAA,EAC7B,SAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACG,GAAA,SAAA;AACL,CAAA,qBACG,GAAA,CAAA,KAAA,EAAA;AAAA,EACC,EAAG,EAAA,OAAA;AAAA,EACH,SAAW,EAAA,IAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,EACzC,QAAA;AAAA,EACA,OAAQ,EAAA,WAAA;AAAA,EACP,GAAG,SAAA;AAAA,EAEH,QAAA,EAAA,KAAA;AAAA,CACH;;;;"}
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = ".saltFormFieldNext {\n display: inline-grid;\n position: relative;\n column-gap: var(--salt-size-adornmentGap);\n row-gap: var(--salt-size-adornmentGap);\n vertical-align: top;\n width: var(--saltFormFieldNext-width, 100%);\n}\n\n.saltFormFieldNext-labelLeft {\n align-self: center;\n grid-template-columns: auto 1fr;\n}\n\n.saltFormFieldNext-labelTop {\n}\n\n.saltFormFieldNext-controls {\n align-items: center;\n display: grid;\n grid-auto-columns: minmax(0, 1fr);\n grid-auto-flow: column;\n grid-column-gap: var(--salt-size-adornmentGap);\n}\n\n.saltFormFieldNext > * {\n grid-row-start: 2;\n grid-row-end: 3;\n}\n\n.saltFormFieldNext > .saltFormFieldLabel {\n grid-row-start: 1;\n grid-row-end: 2;\n}\n\n.saltFormFieldNext-labelLeft > * {\n grid-row-start: 1;\n grid-row-end: 2;\n}\n\n.saltFormFieldNext > .saltFormFieldHelperText {\n grid-row-start: 3;\n grid-row-end: 4;\n}\n\n.saltFormFieldNext.saltFormFieldNext-labelLeft > .saltFormFieldHelperText {\n grid-row-start: 2;\n grid-row-end: 3;\n}\n\n.saltFormFieldNext-labelLeft > .saltFormFieldLabel ~ * {\n grid-column-start: 2;\n grid-column-end: 2;\n}\n\n.saltFormFieldNext-disabled .saltInputNext-focused {\n outline: none;\n}\n";
4
+ styleInject(css_248z);
5
+
6
+ export { css_248z as default };
7
+ //# sourceMappingURL=FormFieldNext.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldNext.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,86 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { clsx } from 'clsx';
3
+ import { forwardRef, useMemo } from 'react';
4
+ import { makePrefixer, useId, capitalize } from '@salt-ds/core';
5
+ import '../form-field-context/FormFieldContext.js';
6
+ import { FormFieldContextNext } from '../form-field-context/FormFieldContextNext.js';
7
+ import { FormFieldLabel } from './FormFieldLabel.js';
8
+ import { FormFieldHelperText } from './FormFieldHelperText.js';
9
+ import './FormFieldNext.css.js';
10
+
11
+ const useA11yValue = ({
12
+ disabled,
13
+ labelId,
14
+ helperTextId,
15
+ readOnly
16
+ }) => {
17
+ return useMemo(
18
+ () => ({
19
+ "aria-labelledby": labelId,
20
+ "aria-describedby": helperTextId,
21
+ disabled,
22
+ readOnly
23
+ }),
24
+ [labelId, disabled, helperTextId, readOnly]
25
+ );
26
+ };
27
+ const withBaseName = makePrefixer("saltFormFieldNext");
28
+ const FormField = forwardRef(
29
+ ({
30
+ children,
31
+ className,
32
+ disabled = false,
33
+ helperText,
34
+ label,
35
+ labelPlacement = "top",
36
+ onBlur,
37
+ onFocus,
38
+ readOnly = false,
39
+ id: idProp,
40
+ ...restProps
41
+ }, ref) => {
42
+ const labelId = useId();
43
+ const helperTextId = useId();
44
+ const a11yValue = useA11yValue({
45
+ labelId,
46
+ helperTextId,
47
+ disabled,
48
+ readOnly
49
+ });
50
+ return /* @__PURE__ */ jsx("div", {
51
+ ref,
52
+ className: clsx(
53
+ withBaseName(),
54
+ {
55
+ [withBaseName("disabled")]: disabled,
56
+ [withBaseName("readOnly")]: readOnly,
57
+ [withBaseName(`label${capitalize(labelPlacement)}`)]: labelPlacement
58
+ },
59
+ className
60
+ ),
61
+ ...restProps,
62
+ children: /* @__PURE__ */ jsxs(FormFieldContextNext.Provider, {
63
+ value: { a11yProps: a11yValue },
64
+ children: [
65
+ label && /* @__PURE__ */ jsx(FormFieldLabel, {
66
+ id: labelId,
67
+ disabled,
68
+ label
69
+ }),
70
+ /* @__PURE__ */ jsx("div", {
71
+ className: withBaseName("controls"),
72
+ children
73
+ }),
74
+ helperText && /* @__PURE__ */ jsx(FormFieldHelperText, {
75
+ id: helperTextId,
76
+ disabled,
77
+ helperText
78
+ })
79
+ ]
80
+ })
81
+ });
82
+ }
83
+ );
84
+
85
+ export { FormField };
86
+ //# sourceMappingURL=FormFieldNext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FormFieldNext.js","sources":["../src/form-field-next/FormFieldNext.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { ForwardedRef, forwardRef, HTMLAttributes, useMemo } from \"react\";\nimport { makePrefixer, useId, capitalize } from \"@salt-ds/core\";\nimport { FormFieldContextNext } from \"../form-field-context\";\nimport { FormFieldLabel } from \"./FormFieldLabel\";\nimport { FormFieldHelperText } from \"./FormFieldHelperText\";\n\nimport \"./FormFieldNext.css\";\n\nexport type FormFieldLabelPlacement = \"top\" | \"left\";\n\nexport interface FormFieldProps\n extends HTMLAttributes<HTMLDivElement>,\n A11yValueProps {\n /**\n * Disabled prop\n */\n disabled?: boolean;\n /**\n * The helper text content\n */\n helperText?: string;\n /**\n * The label value for the FormField\n */\n label?: string;\n /**\n * Location the label, values: 'top' (default) or 'left'\n */\n labelPlacement?: FormFieldLabelPlacement;\n /**\n * Readonly prop\n */\n readOnly?: boolean;\n /**\n * Optional id prop\n */\n id?: string;\n}\n\nexport interface A11yValueProps {\n /**\n * If `true`, the FormField will be disabled.\n */\n disabled?: boolean;\n /** Helper Text */\n helperTextId?: string;\n /** id of the label node */\n labelId?: string;\n /**\n * If `true`, the FormField will be readonly.\n */\n readOnly?: boolean;\n}\nexport interface useA11yValueValue {\n \"aria-labelledby\": A11yValueProps[\"labelId\"];\n \"aria-describedby\": A11yValueProps[\"helperTextId\"] | undefined;\n disabled: A11yValueProps[\"disabled\"];\n readOnly: A11yValueProps[\"readOnly\"];\n}\n\nconst useA11yValue = ({\n disabled,\n labelId,\n helperTextId,\n readOnly,\n}: A11yValueProps) => {\n return useMemo(\n () => ({\n \"aria-labelledby\": labelId,\n \"aria-describedby\": helperTextId,\n disabled,\n readOnly,\n }),\n [labelId, disabled, helperTextId, readOnly]\n );\n};\n\nconst withBaseName = makePrefixer(\"saltFormFieldNext\");\n\nexport const FormField = forwardRef(\n (\n {\n children,\n className,\n disabled = false,\n helperText,\n label,\n labelPlacement = \"top\",\n onBlur,\n onFocus,\n readOnly = false,\n id: idProp,\n ...restProps\n }: FormFieldProps,\n ref: ForwardedRef<HTMLDivElement>\n ) => {\n const labelId = useId();\n const helperTextId = useId();\n\n const a11yValue = useA11yValue({\n labelId,\n helperTextId,\n disabled,\n readOnly,\n });\n\n return (\n <div\n ref={ref}\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"readOnly\")]: readOnly,\n [withBaseName(`label${capitalize(labelPlacement)}`)]:\n labelPlacement,\n },\n className\n )}\n {...restProps}\n >\n <FormFieldContextNext.Provider value={{ a11yProps: a11yValue }}>\n {label && (\n <FormFieldLabel id={labelId} disabled={disabled} label={label} />\n )}\n <div className={withBaseName(\"controls\")}>{children}</div>\n {helperText && (\n <FormFieldHelperText\n id={helperTextId}\n disabled={disabled}\n helperText={helperText}\n />\n )}\n </FormFieldContextNext.Provider>\n </div>\n );\n }\n);\n"],"names":[],"mappings":";;;;;;;;;;AA6DA,MAAM,eAAe,CAAC;AAAA,EACpB,QAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AACF,CAAsB,KAAA;AACpB,EAAO,OAAA,OAAA;AAAA,IACL,OAAO;AAAA,MACL,iBAAmB,EAAA,OAAA;AAAA,MACnB,kBAAoB,EAAA,YAAA;AAAA,MACpB,QAAA;AAAA,MACA,QAAA;AAAA,KACF,CAAA;AAAA,IACA,CAAC,OAAA,EAAS,QAAU,EAAA,YAAA,EAAc,QAAQ,CAAA;AAAA,GAC5C,CAAA;AACF,CAAA,CAAA;AAEA,MAAM,YAAA,GAAe,aAAa,mBAAmB,CAAA,CAAA;AAE9C,MAAM,SAAY,GAAA,UAAA;AAAA,EACvB,CACE;AAAA,IACE,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,UAAA;AAAA,IACA,KAAA;AAAA,IACA,cAAiB,GAAA,KAAA;AAAA,IACjB,MAAA;AAAA,IACA,OAAA;AAAA,IACA,QAAW,GAAA,KAAA;AAAA,IACX,EAAI,EAAA,MAAA;AAAA,IACD,GAAA,SAAA;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,UAAU,KAAM,EAAA,CAAA;AACtB,IAAA,MAAM,eAAe,KAAM,EAAA,CAAA;AAE3B,IAAA,MAAM,YAAY,YAAa,CAAA;AAAA,MAC7B,OAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,uBACG,GAAA,CAAA,KAAA,EAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAW,EAAA,IAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb;AAAA,UACE,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,UAC5B,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,UAC5B,CAAC,YAAa,CAAA,CAAA,KAAA,EAAQ,UAAW,CAAA,cAAc,GAAG,CAChD,GAAA,cAAA;AAAA,SACJ;AAAA,QACA,SAAA;AAAA,OACF;AAAA,MACC,GAAG,SAAA;AAAA,MAEJ,QAAA,kBAAA,IAAA,CAAC,qBAAqB,QAArB,EAAA;AAAA,QAA8B,KAAA,EAAO,EAAE,SAAA,EAAW,SAAU,EAAA;AAAA,QAC1D,QAAA,EAAA;AAAA,UAAA,KAAA,oBACE,GAAA,CAAA,cAAA,EAAA;AAAA,YAAe,EAAI,EAAA,OAAA;AAAA,YAAS,QAAA;AAAA,YAAoB,KAAA;AAAA,WAAc,CAAA;AAAA,0BAEhE,GAAA,CAAA,KAAA,EAAA;AAAA,YAAI,SAAA,EAAW,aAAa,UAAU,CAAA;AAAA,YAAI,QAAA;AAAA,WAAS,CAAA;AAAA,UACnD,8BACE,GAAA,CAAA,mBAAA,EAAA;AAAA,YACC,EAAI,EAAA,YAAA;AAAA,YACJ,QAAA;AAAA,YACA,UAAA;AAAA,WACF,CAAA;AAAA,SAAA;AAAA,OAEJ,CAAA;AAAA,KACF,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
@@ -78,12 +78,18 @@ export { FileDropZone } from './file-drop-zone/FileDropZone.js';
78
78
  export { createFileTypeValidator, createTotalSizeValidator } from './file-drop-zone/validators.js';
79
79
  export { FormField, useFormField } from './form-field/FormField.js';
80
80
  export { FormLabel } from './form-field/FormLabel.js';
81
+ export { FormField as FormFieldNext } from './form-field-next/FormFieldNext.js';
82
+ import './form-field-next/FormFieldHelperText.js';
83
+ import './form-field-next/FormFieldLabel.js';
81
84
  export { FormFieldContext } from './form-field-context/FormFieldContext.js';
85
+ export { FormFieldContextNext } from './form-field-context/FormFieldContextNext.js';
82
86
  export { useFormFieldProps } from './form-field-context/useFormFieldProps.js';
87
+ export { useFormFieldPropsNext } from './form-field-context/useFormFieldPropsNext.js';
83
88
  export { FormGroup } from './form-group/FormGroup.js';
84
89
  export { FormattedInput } from './formatted-input/FormattedInput.js';
85
90
  export { Input } from './input/Input.js';
86
91
  export { StaticInputAdornment } from './input/StaticInputAdornment.js';
92
+ export { Input as InputNext } from './input-next/InputNext.js';
87
93
  export { LAYER_POSITIONS, LayerLayout } from './layer-layout/LayerLayout.js';
88
94
  export { Highlighter } from './list/Highlighter.js';
89
95
  export { ListItem, ListItemProxy } from './list/ListItem.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,6 +3,7 @@ import { clsx } from 'clsx';
3
3
  import { forwardRef, useState, useRef } from 'react';
4
4
  import { makePrefixer, useForkRef, useControlled } from '@salt-ds/core';
5
5
  import '../form-field-context/FormFieldContext.js';
6
+ import '../form-field-context/FormFieldContextNext.js';
6
7
  import { useFormFieldProps } from '../form-field-context/useFormFieldProps.js';
7
8
  import { useCursorOnFocus } from './useCursorOnFocus.js';
8
9
  import './Input.css.js';
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../src/input/Input.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n AriaAttributes,\n ChangeEvent,\n ElementType,\n FocusEvent,\n FocusEventHandler,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n KeyboardEventHandler,\n MouseEvent,\n MouseEventHandler,\n ReactNode,\n useRef,\n useState,\n} from \"react\";\nimport { makePrefixer, useControlled, useForkRef } from \"@salt-ds/core\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { useCursorOnFocus } from \"./useCursorOnFocus\";\n\nimport \"./Input.css\";\n\nconst withBaseName = makePrefixer(\"saltInput\");\n\n// TODO: Double confirm whether this should be extending DivElement given root is `<div>`.\n// And forwarded ref is not assigned to the root like other components.\nexport interface InputProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n /**\n * Determines the position of the text cursor on focus of the input.\n *\n * start = place cursor at the beginning<br>\n * end = place cursor at the end<br>\n * \\# = index to place the cursor<br>\n */\n cursorPositionOnFocus?: \"start\" | \"end\" | number;\n /**\n * The value of the `input` element, required for an uncontrolled component.\n */\n defaultValue?: HTMLInputElement[\"defaultValue\"];\n /**\n * If `true`, the component is disabled.\n */\n disabled?: HTMLInputElement[\"disabled\"];\n /**\n * The marker to use in an empty read only Input.\n * Use `''` to disable this feature. Defaults to '—'.\n */\n emptyReadOnlyMarker?: string;\n /**\n * Determines what gets highlighted on focus of the input.\n *\n * If `true` all text will be highlighted.\n * If an array text between those indices will be highlighted\n * e.g. [0,1] will highlight the first character.\n */\n highlightOnFocus?: boolean | number[];\n /**\n * The HTML element to render the Input, e.g. 'input', a custom React component.\n */\n inputComponent?: ElementType;\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n onBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Callback for change event.\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>, value: string) => void;\n onFocus?: FocusEventHandler<HTMLInputElement>;\n onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n onKeyUp?: KeyboardEventHandler<HTMLInputElement>;\n onMouseUp?: MouseEventHandler<HTMLInputElement>;\n onMouseMove?: MouseEventHandler<HTMLInputElement>;\n onMouseDown?: MouseEventHandler<HTMLInputElement>;\n /**\n * If `true`, the component is read only.\n */\n readOnly?: boolean;\n /**\n *\n * Determines the alignment of the input text.\n */\n textAlign?: \"left\" | \"right\" | \"center\";\n type?: HTMLInputElement[\"type\"];\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: HTMLInputElement[\"value\"];\n renderSuffix?: (state: {\n disabled?: boolean;\n error?: boolean;\n focused?: boolean;\n margin?: \"dense\" | \"none\" | \"normal\";\n required?: boolean;\n startAdornment?: ReactNode;\n }) => ReactNode;\n endAdornment?: ReactNode;\n startAdornment?: ReactNode;\n}\n\nfunction mergeA11yProps(\n a11yProps: Partial<ReturnType<typeof useFormFieldProps>[\"a11yProps\"]> = {},\n inputProps: InputProps[\"inputProps\"] = {},\n misplacedAriaProps: AriaAttributes\n) {\n const ariaLabelledBy = clsx(\n a11yProps[\"aria-labelledby\"],\n inputProps[\"aria-labelledby\"]\n );\n\n return {\n ...misplacedAriaProps,\n ...a11yProps,\n ...inputProps,\n // The weird filtering is due to TokenizedInputBase\n \"aria-labelledby\": ariaLabelledBy\n ? Array.from(new Set(ariaLabelledBy.split(\" \"))).join(\" \")\n : null,\n };\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n className: classNameProp,\n cursorPositionOnFocus,\n disabled,\n emptyReadOnlyMarker = \"—\",\n endAdornment,\n highlightOnFocus,\n id,\n inputComponent: InputComponent = \"input\",\n inputProps: inputPropsProp,\n role,\n style,\n value: valueProp,\n // If we leave both value and defaultValue undefined, we will get a React warning on first edit\n // (uncontrolled to controlled warning) from the React input\n defaultValue: defaultValueProp = valueProp === undefined ? \"\" : undefined,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n onMouseUp,\n onMouseMove,\n onMouseDown,\n readOnly: readOnlyProp,\n renderSuffix,\n startAdornment,\n textAlign = \"left\",\n type = \"text\",\n ...other\n },\n ref\n) {\n const {\n a11yProps: {\n readOnly: a11yReadOnly,\n disabled: a11yDisabled,\n ...restA11y\n } = {},\n setFocused: setFormFieldFocused,\n inFormField,\n } = useFormFieldProps();\n\n const [focused, setFocused] = useState(false);\n const inputRef = useRef(null);\n const handleRef = useForkRef(inputRef, ref);\n const cursorOnFocusHelpers = useCursorOnFocus(inputRef, {\n cursorPositionOnFocus,\n highlightOnFocus,\n });\n\n const isDisabled = disabled || a11yDisabled;\n const isReadOnly = readOnlyProp || a11yReadOnly;\n const misplacedAriaProps = {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n role,\n };\n const inputProps = mergeA11yProps(\n restA11y,\n inputPropsProp,\n misplacedAriaProps\n );\n const isEmptyReadOnly = isReadOnly && !defaultValueProp && !valueProp;\n const defaultValue = isEmptyReadOnly ? emptyReadOnlyMarker : defaultValueProp;\n\n const [value, setValue] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: \"Input\",\n state: \"value\",\n });\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const value = event.target.value;\n setValue(value);\n onChange?.(event, value);\n };\n\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n onFocus?.(event);\n setFormFieldFocused?.(true);\n setFocused(true);\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n onBlur?.(event);\n setFormFieldFocused?.(false);\n setFocused(false);\n };\n\n const handleMouseMove = (event: MouseEvent<HTMLInputElement>) => {\n cursorOnFocusHelpers.handleMouseMove(event);\n\n onMouseMove?.(event);\n };\n\n const handleMouseUp = (event: MouseEvent<HTMLInputElement>) => {\n cursorOnFocusHelpers.handleMouseUp();\n\n onMouseUp?.(event);\n };\n\n const handleMouseDown = (event: MouseEvent<HTMLInputElement>) => {\n cursorOnFocusHelpers.handleMouseDown();\n\n onMouseDown?.(event);\n };\n\n return (\n <div\n className={clsx(\n withBaseName(),\n {\n [withBaseName(`${textAlign}TextAlign`)]: textAlign,\n [withBaseName(\"formField\")]: inFormField,\n [withBaseName(\"focused\")]: focused && !inFormField,\n [withBaseName(\"disabled\")]: isDisabled,\n [withBaseName(\"inputAdornedStart\")]: startAdornment,\n [withBaseName(\"inputAdornedEnd\")]: endAdornment,\n },\n classNameProp\n )}\n style={style}\n {...other}\n >\n {startAdornment && (\n <div className={withBaseName(\"prefixContainer\")}>{startAdornment}</div>\n )}\n <InputComponent\n type={type}\n id={id}\n {...inputProps}\n className={clsx(withBaseName(\"input\"), inputProps?.className)}\n disabled={isDisabled}\n ref={handleRef}\n value={value}\n onBlur={handleBlur}\n onChange={handleChange}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onFocus={handleFocus}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseMove={handleMouseMove}\n readOnly={isReadOnly}\n />\n {endAdornment && (\n <div className={withBaseName(\"suffixContainer\")}>{endAdornment}</div>\n )}\n {/* TODO: Confirm implementation of suffix */}\n {renderSuffix?.({ disabled, focused })}\n </div>\n );\n});\n"],"names":["Input","value"],"mappings":";;;;;;;;;AAuBA,MAAM,YAAA,GAAe,aAAa,WAAW,CAAA,CAAA;AAgF7C,SAAS,eACP,SAAwE,GAAA,IACxE,UAAuC,GAAA,IACvC,kBACA,EAAA;AACA,EAAA,MAAM,cAAiB,GAAA,IAAA;AAAA,IACrB,SAAU,CAAA,iBAAA,CAAA;AAAA,IACV,UAAW,CAAA,iBAAA,CAAA;AAAA,GACb,CAAA;AAEA,EAAO,OAAA;AAAA,IACL,GAAG,kBAAA;AAAA,IACH,GAAG,SAAA;AAAA,IACH,GAAG,UAAA;AAAA,IAEH,iBAAmB,EAAA,cAAA,GACf,KAAM,CAAA,IAAA,CAAK,IAAI,GAAI,CAAA,cAAA,CAAe,KAAM,CAAA,GAAG,CAAC,CA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AA;AAAA,QAAI,QAAA,EAAA,YAAA;AAAA,OAAa,CAAA;AAAA,MAGhE,YAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,YAAA,CAAe,EAAE,QAAA,EAAU,OAAQ,EAAA,CAAA;AAAA,KAAA;AAAA,GACtC,CAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"Input.js","sources":["../src/input/Input.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n AriaAttributes,\n ChangeEvent,\n ElementType,\n FocusEvent,\n FocusEventHandler,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n KeyboardEventHandler,\n MouseEvent,\n MouseEventHandler,\n ReactNode,\n useRef,\n useState,\n} from \"react\";\nimport { makePrefixer, useControlled, useForkRef } from \"@salt-ds/core\";\nimport { useFormFieldProps } from \"../form-field-context\";\nimport { useCursorOnFocus } from \"./useCursorOnFocus\";\n\nimport \"./Input.css\";\n\nconst withBaseName = makePrefixer(\"saltInput\");\n\n// TODO: Double confirm whether this should be extending DivElement given root is `<div>`.\n// And forwarded ref is not assigned to the root like other components.\nexport interface InputProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n /**\n * Determines the position of the text cursor on focus of the input.\n *\n * start = place cursor at the beginning<br>\n * end = place cursor at the end<br>\n * \\# = index to place the cursor<br>\n */\n cursorPositionOnFocus?: \"start\" | \"end\" | number;\n /**\n * The value of the `input` element, required for an uncontrolled component.\n */\n defaultValue?: HTMLInputElement[\"defaultValue\"];\n /**\n * If `true`, the component is disabled.\n */\n disabled?: HTMLInputElement[\"disabled\"];\n /**\n * The marker to use in an empty read only Input.\n * Use `''` to disable this feature. Defaults to '—'.\n */\n emptyReadOnlyMarker?: string;\n /**\n * Determines what gets highlighted on focus of the input.\n *\n * If `true` all text will be highlighted.\n * If an array text between those indices will be highlighted\n * e.g. [0,1] will highlight the first character.\n */\n highlightOnFocus?: boolean | number[];\n /**\n * The HTML element to render the Input, e.g. 'input', a custom React component.\n */\n inputComponent?: ElementType;\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n onBlur?: FocusEventHandler<HTMLInputElement>;\n /**\n * Callback for change event.\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>, value: string) => void;\n onFocus?: FocusEventHandler<HTMLInputElement>;\n onKeyDown?: KeyboardEventHandler<HTMLInputElement>;\n onKeyUp?: KeyboardEventHandler<HTMLInputElement>;\n onMouseUp?: MouseEventHandler<HTMLInputElement>;\n onMouseMove?: MouseEventHandler<HTMLInputElement>;\n onMouseDown?: MouseEventHandler<HTMLInputElement>;\n /**\n * If `true`, the component is read only.\n */\n readOnly?: boolean;\n /**\n *\n * Determines the alignment of the input text.\n */\n textAlign?: \"left\" | \"right\" | \"center\";\n type?: HTMLInputElement[\"type\"];\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: HTMLInputElement[\"value\"];\n renderSuffix?: (state: {\n disabled?: boolean;\n error?: boolean;\n focused?: boolean;\n margin?: \"dense\" | \"none\" | \"normal\";\n required?: boolean;\n startAdornment?: ReactNode;\n }) => ReactNode;\n endAdornment?: ReactNode;\n startAdornment?: ReactNode;\n}\n\nfunction mergeA11yProps(\n a11yProps: Partial<ReturnType<typeof useFormFieldProps>[\"a11yProps\"]> = {},\n inputProps: InputProps[\"inputProps\"] = {},\n misplacedAriaProps: AriaAttributes\n) {\n const ariaLabelledBy = clsx(\n a11yProps[\"aria-labelledby\"],\n inputProps[\"aria-labelledby\"]\n );\n\n return {\n ...misplacedAriaProps,\n ...a11yProps,\n ...inputProps,\n // The weird filtering is due to TokenizedInputBase\n \"aria-labelledby\": ariaLabelledBy\n ? Array.from(new Set(ariaLabelledBy.split(\" \"))).join(\" \")\n : null,\n };\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n className: classNameProp,\n cursorPositionOnFocus,\n disabled,\n emptyReadOnlyMarker = \"—\",\n endAdornment,\n highlightOnFocus,\n id,\n inputComponent: InputComponent = \"input\",\n inputProps: inputPropsProp,\n role,\n style,\n value: valueProp,\n // If we leave both value and defaultValue undefined, we will get a React warning on first edit\n // (uncontrolled to controlled warning) from the React input\n defaultValue: defaultValueProp = valueProp === undefined ? \"\" : undefined,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n onMouseUp,\n onMouseMove,\n onMouseDown,\n readOnly: readOnlyProp,\n renderSuffix,\n startAdornment,\n textAlign = \"left\",\n type = \"text\",\n ...other\n },\n ref\n) {\n const {\n a11yProps: {\n readOnly: a11yReadOnly,\n disabled: a11yDisabled,\n ...restA11y\n } = {},\n setFocused: setFormFieldFocused,\n inFormField,\n } = useFormFieldProps();\n\n const [focused, setFocused] = useState(false);\n const inputRef = useRef(null);\n const handleRef = useForkRef(inputRef, ref);\n const cursorOnFocusHelpers = useCursorOnFocus(inputRef, {\n cursorPositionOnFocus,\n highlightOnFocus,\n });\n\n const isDisabled = disabled || a11yDisabled;\n const isReadOnly = readOnlyProp || a11yReadOnly;\n const misplacedAriaProps = {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n role,\n };\n const inputProps = mergeA11yProps(\n restA11y,\n inputPropsProp,\n misplacedAriaProps\n );\n const isEmptyReadOnly = isReadOnly && !defaultValueProp && !valueProp;\n const defaultValue = isEmptyReadOnly ? emptyReadOnlyMarker : defaultValueProp;\n\n const [value, setValue] = useControlled({\n controlled: valueProp,\n default: defaultValue,\n name: \"Input\",\n state: \"value\",\n });\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const value = event.target.value;\n setValue(value);\n onChange?.(event, value);\n };\n\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n onFocus?.(event);\n setFormFieldFocused?.(true);\n setFocused(true);\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n onBlur?.(event);\n setFormFieldFocused?.(false);\n setFocused(false);\n };\n\n const handleMouseMove = (event: MouseEvent<HTMLInputElement>) => {\n cursorOnFocusHelpers.handleMouseMove(event);\n\n onMouseMove?.(event);\n };\n\n const handleMouseUp = (event: MouseEvent<HTMLInputElement>) => {\n cursorOnFocusHelpers.handleMouseUp();\n\n onMouseUp?.(event);\n };\n\n const handleMouseDown = (event: MouseEvent<HTMLInputElement>) => {\n cursorOnFocusHelpers.handleMouseDown();\n\n onMouseDown?.(event);\n };\n\n return (\n <div\n className={clsx(\n withBaseName(),\n {\n [withBaseName(`${textAlign}TextAlign`)]: textAlign,\n [withBaseName(\"formField\")]: inFormField,\n [withBaseName(\"focused\")]: focused && !inFormField,\n [withBaseName(\"disabled\")]: isDisabled,\n [withBaseName(\"inputAdornedStart\")]: startAdornment,\n [withBaseName(\"inputAdornedEnd\")]: endAdornment,\n },\n classNameProp\n )}\n style={style}\n {...other}\n >\n {startAdornment && (\n <div className={withBaseName(\"prefixContainer\")}>{startAdornment}</div>\n )}\n <InputComponent\n type={type}\n id={id}\n {...inputProps}\n className={clsx(withBaseName(\"input\"), inputProps?.className)}\n disabled={isDisabled}\n ref={handleRef}\n value={value}\n onBlur={handleBlur}\n onChange={handleChange}\n onKeyDown={onKeyDown}\n onKeyUp={onKeyUp}\n onFocus={handleFocus}\n onMouseDown={handleMouseDown}\n onMouseUp={handleMouseUp}\n onMouseMove={handleMouseMove}\n readOnly={isReadOnly}\n />\n {endAdornment && (\n <div className={withBaseName(\"suffixContainer\")}>{endAdornment}</div>\n )}\n {/* TODO: Confirm implementation of suffix */}\n {renderSuffix?.({ disabled, focused })}\n </div>\n );\n});\n"],"names":["Input","value"],"mappings":";;;;;;;;;;AAuBA,MAAM,YAAA,GAAe,aAAa,WAAW,CAAA,CAAA;AAgF7C,SAAS,eACP,SAAwE,GAAA,IACxE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AAA,SAAA;AAAA,QACL,KAAA;AAAA,QACA,MAAQ,EAAA,UAAA;AAAA,QACR,QAAU,EAAA,YAAA;AAAA,QACV,SAAA;AAAA,QACA,OAAA;AAAA,QACA,OAAS,EAAA,WAAA;AAAA,QACT,WAAa,EAAA,eAAA;AAAA,QACb,SAAW,EAAA,aAAA;AAAA,QACX,WAAa,EAAA,eAAA;AAAA,QACb,QAAU,EAAA,UAAA;AAAA,OACZ,CAAA;AAAA,MACC,gCACE,GAAA,CAAA,KAAA,EAAA;AAAA,QAAI,SAAA,EAAW,aAAa,iBAAiB,CAAA;AAAA,QAAI,QAAA,EAAA,YAAA;AAAA,OAAa,CAAA;AAAA,MAGhE,YAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,YAAA,CAAe,EAAE,QAAA,EAAU,OAAQ,EAAA,CAAA;AAAA,KAAA;AAAA,GACtC,CAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -0,0 +1,7 @@
1
+ import styleInject from '../../../../node_modules/style-inject/dist/style-inject.es.js';
2
+
3
+ var css_248z = "/* Style applied to the root element */\n.saltInputNext {\n --inputNext-borderColor: var(--salt-editable-borderColor);\n --inputNext-borderStyle: var(--salt-editable-borderStyle);\n\n align-items: center;\n background: var(--saltInputNext-background, var(--inputNext-background));\n border-color: var(--saltInputNext-borderColor, var(--inputNext-borderColor));\n border-width: var(--saltInputNext-borderWidth, 0 0 var(--salt-size-border) 0);\n border-style: var(--saltInputNext-borderStyle, var(--inputNext-borderStyle));\n border-radius: var(--saltInputNext-borderRadius, 0);\n color: var(--saltInputNext-color, var(--salt-text-primary-foreground));\n display: inline-flex;\n font-family: var(--saltInputNext-fontFamily, var(--salt-text-fontFamily));\n font-size: var(--saltInputNext-fontSize, var(--salt-text-fontSize));\n height: var(--saltInputNext-height, var(--salt-size-base));\n line-height: var(--salt-text-lineHeight);\n min-height: var(--saltInputNext-minHeight, var(--salt-size-base));\n min-width: var(--saltInputNext-minWidth, 8em);\n padding: var(--saltInputNext-padding, 0 var(--salt-size-unit));\n position: var(--saltInputNext-position, relative);\n width: 100%;\n}\n\n.saltInputNext:hover {\n --inputNext-background: var(--inputNext-background-hover);\n --inputNext-borderColor: var(--salt-editable-borderColor-hover);\n --inputNext-borderStyle: var(--salt-editable-borderStyle-hover);\n}\n\n.saltInputNext:active {\n --inputNext-background: var(--inputNext-background-active);\n --inputNext-borderColor: var(--salt-editable-borderColor-active);\n --inputNext-borderStyle: var(--salt-editable-borderStyle-active);\n}\n\n/* Class applied if `variant=\"primary\"` */\n.saltInputNext-primary {\n --inputNext-background: var(--salt-editable-primary-background);\n --inputNext-background-active: var(--salt-editable-primary-background-active);\n --inputNext-background-hover: var(--salt-editable-primary-background-hover);\n --inputNext-background-disabled: var(--salt-editable-primary-background-disabled);\n --inputNext-background-readonly: var(--salt-editable-primary-background-readonly);\n}\n\n/* Class applied if `variant=\"secondary\"` */\n.saltInputNext-secondary {\n --inputNext-background: var(--salt-editable-secondary-background);\n --inputNext-background-active: var(--salt-editable-secondary-background-active);\n --inputNext-background-hover: var(--salt-editable-secondary-background-active);\n --inputNext-background-disabled: var(--salt-editable-secondary-background-disabled);\n --inputNext-background-readonly: var(--salt-editable-secondary-background-readonly);\n}\n\n/* Style applied to inner input component */\n.saltInputNext-input {\n background: none;\n border: none;\n box-sizing: content-box;\n color: inherit;\n cursor: var(--saltInputNext-cursor, default);\n display: block;\n flex: 1;\n font: inherit;\n height: 100%;\n letter-spacing: var(--saltInputNext-letterSpacing, 0);\n margin: 0;\n min-width: 0;\n overflow: hidden;\n padding: 0;\n text-align: var(--saltInputNext-textAlign, left);\n width: 100%;\n}\n\n/* Style applied if `readOnly={true}` */\n.saltInputNext.saltInputNext-readOnly {\n --inputNext-background: var(--inputNext-background-readonly);\n --inputNext-background-hover: var(--inputNext-background-readonly);\n --inputNext-borderColor: var(--salt-editable-borderColor-readonly);\n --inputNext-borderStyle: var(--salt-editable-borderStyle-readonly);\n}\n\n/* Reset in the next class */\n.saltInputNext-input:focus {\n outline: none;\n}\n\n/* Styling when focused */\n.saltInputNext-focused {\n outline-style: var(--saltInputNext-focused-outlineStyle, var(--salt-focused-outlineStyle));\n outline-width: var(--saltInputNext-focused-outlineWidth, var(--salt-focused-outlineWidth));\n outline-color: var(--saltInputNext-focused-outlineColor, var(--salt-focused-outlineColor));\n outline-offset: var(--saltInputNext-focused-outlineOffset, var(--salt-focused-outlineOffset));\n}\n\n/* Styling when focused if `disabled={true}` or `readOnly={true}` */\n.saltInputNext-focused.saltInputNext-readOnly,\n.saltInputNext-disabled .saltInputNext-focused {\n outline: none;\n}\n\n/* Style applied to selected input */\n.saltInputNext-input::selection {\n background: var(--saltInputNext-highlight-color, var(--salt-text-background-selected));\n}\n\n/* Style applied to selected input if `disabled={true}` */\n.saltInputNext-disabled .saltInputNext-input::selection {\n background: none;\n}\n\n/* Style applied to input if `disabled={true}` */\n.saltInputNext-disabled .saltInputNext-input,\n.saltInputNext.saltInputNext-disabled,\n.saltInputNext.saltInputNext-disabled:hover,\n.saltInputNext.saltInputNext-disabled:active {\n --inputNext-background: var(--inputNext-background-disabled);\n --inputNext-borderColor: var(--salt-editable-borderColor-disabled);\n --inputNext-borderStyle: var(--salt-editable-borderStyle-disabled);\n\n cursor: var(--salt-editable-cursor-disabled);\n color: var(--saltInputNext-text-color-disabled, var(--salt-text-primary-foreground-disabled));\n}\n";
4
+ styleInject(css_248z);
5
+
6
+ export { css_248z as default };
7
+ //# sourceMappingURL=InputNext.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputNext.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,122 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { clsx } from 'clsx';
3
+ import { forwardRef, useState } from 'react';
4
+ import { makePrefixer, useControlled } from '@salt-ds/core';
5
+ import '../form-field-context/FormFieldContext.js';
6
+ import '../form-field-context/FormFieldContextNext.js';
7
+ import { useFormFieldPropsNext } from '../form-field-context/useFormFieldPropsNext.js';
8
+ import './InputNext.css.js';
9
+
10
+ const withBaseName = makePrefixer("saltInputNext");
11
+ function mergeA11yProps(a11yProps = {}, inputProps = {}, misplacedAriaProps) {
12
+ const ariaLabelledBy = clsx(
13
+ a11yProps["aria-labelledby"],
14
+ inputProps["aria-labelledby"]
15
+ );
16
+ return {
17
+ ...misplacedAriaProps,
18
+ ...a11yProps,
19
+ ...inputProps,
20
+ "aria-label": ariaLabelledBy ? Array.from(new Set(ariaLabelledBy.split(" "))).join(" ") : void 0
21
+ };
22
+ }
23
+ const Input = forwardRef(function Input2({
24
+ "aria-activedescendant": ariaActiveDescendant,
25
+ "aria-expanded": ariaExpanded,
26
+ "aria-owns": ariaOwns,
27
+ className: classNameProp,
28
+ disabled,
29
+ id,
30
+ inputProps: inputPropsProp,
31
+ onChange,
32
+ readOnly: readOnlyProp,
33
+ role,
34
+ style,
35
+ type = "text",
36
+ value: valueProp,
37
+ defaultValue: defaultValueProp = valueProp === void 0 ? "" : void 0,
38
+ variant = "primary",
39
+ ...other
40
+ }, ref) {
41
+ const {
42
+ a11yProps: {
43
+ disabled: a11yDisabled,
44
+ readOnly: a11yReadOnly,
45
+ ...restA11y
46
+ } = {}
47
+ } = useFormFieldPropsNext();
48
+ const isDisabled = disabled || a11yDisabled;
49
+ const isReadOnly = readOnlyProp || a11yReadOnly;
50
+ const [focused, setFocused] = useState(false);
51
+ const misplacedAriaProps = {
52
+ "aria-activedescendant": ariaActiveDescendant,
53
+ "aria-expanded": ariaExpanded,
54
+ "aria-owns": ariaOwns,
55
+ role
56
+ };
57
+ const inputProps = mergeA11yProps(
58
+ restA11y,
59
+ inputPropsProp,
60
+ misplacedAriaProps
61
+ );
62
+ const {
63
+ onBlur,
64
+ onFocus,
65
+ onKeyDown,
66
+ onKeyUp,
67
+ onMouseUp,
68
+ onMouseMove,
69
+ onMouseDown,
70
+ ...restInputProps
71
+ } = inputProps;
72
+ const [value, setValue] = useControlled({
73
+ controlled: valueProp,
74
+ default: defaultValueProp,
75
+ name: "Input",
76
+ state: "value"
77
+ });
78
+ const handleChange = (event) => {
79
+ const value2 = event.target.value;
80
+ setValue(value2);
81
+ onChange == null ? void 0 : onChange(event, value2);
82
+ };
83
+ const handleBlur = (event) => {
84
+ onBlur == null ? void 0 : onBlur(event);
85
+ setFocused(false);
86
+ };
87
+ const handleFocus = (event) => {
88
+ onFocus == null ? void 0 : onFocus(event);
89
+ setFocused(true);
90
+ };
91
+ return /* @__PURE__ */ jsx("div", {
92
+ className: clsx(
93
+ withBaseName(),
94
+ {
95
+ [withBaseName("focused")]: !isDisabled && focused,
96
+ [withBaseName("disabled")]: isDisabled,
97
+ [withBaseName("readOnly")]: isReadOnly,
98
+ [withBaseName(variant)]: variant
99
+ },
100
+ classNameProp
101
+ ),
102
+ style,
103
+ ...other,
104
+ children: /* @__PURE__ */ jsx("input", {
105
+ type,
106
+ id,
107
+ className: clsx(withBaseName("input"), inputProps == null ? void 0 : inputProps.className),
108
+ disabled: isDisabled,
109
+ readOnly: isReadOnly,
110
+ ref,
111
+ value,
112
+ tabIndex: isReadOnly || isDisabled ? -1 : 0,
113
+ onBlur: handleBlur,
114
+ onChange: handleChange,
115
+ onFocus: !isDisabled ? handleFocus : void 0,
116
+ ...restInputProps
117
+ })
118
+ });
119
+ });
120
+
121
+ export { Input };
122
+ //# sourceMappingURL=InputNext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputNext.js","sources":["../src/input-next/InputNext.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport {\n AriaAttributes,\n ChangeEvent,\n ElementType,\n FocusEvent,\n forwardRef,\n HTMLAttributes,\n InputHTMLAttributes,\n useState,\n} from \"react\";\nimport { makePrefixer, useControlled } from \"@salt-ds/core\";\nimport { useFormFieldPropsNext } from \"../form-field-context\";\n\nimport \"./InputNext.css\";\n\nconst withBaseName = makePrefixer(\"saltInputNext\");\n\n// TODO: Double confirm whether this should be extending DivElement given root is `<div>`.\n// And forwarded ref is not assigned to the root like other components.\nexport interface InputProps\n extends Omit<HTMLAttributes<HTMLDivElement>, \"onChange\" | \"defaultValue\"> {\n /**\n * The value of the `input` element, required for an uncontrolled component.\n */\n defaultValue?: HTMLInputElement[\"defaultValue\"];\n /**\n * If `true`, the component is disabled.\n */\n disabled?: HTMLInputElement[\"disabled\"];\n /**\n * [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#Attributes) applied to the `input` element.\n */\n inputProps?: InputHTMLAttributes<HTMLInputElement>;\n /**\n * Callback for change event.\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>, value: string) => void;\n /**\n * If `true`, the component is read only.\n */\n readOnly?: boolean;\n type?: HTMLInputElement[\"type\"];\n /**\n * The value of the `input` element, required for a controlled component.\n */\n value?: HTMLInputElement[\"value\"];\n /**\n * Styling variant. Defaults to \"primary\".\n */\n variant?: \"primary\" | \"secondary\";\n}\n\nfunction mergeA11yProps(\n a11yProps: Partial<\n ReturnType<typeof useFormFieldPropsNext>[\"a11yProps\"]\n > = {},\n inputProps: InputProps[\"inputProps\"] = {},\n misplacedAriaProps: AriaAttributes\n) {\n const ariaLabelledBy = clsx(\n a11yProps[\"aria-labelledby\"],\n inputProps[\"aria-labelledby\"]\n );\n\n return {\n ...misplacedAriaProps,\n ...a11yProps,\n ...inputProps,\n // TODO: look at this - The weird filtering is due to TokenizedInputBase\n \"aria-label\": ariaLabelledBy\n ? Array.from(new Set(ariaLabelledBy.split(\" \"))).join(\" \")\n : undefined,\n };\n}\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n className: classNameProp,\n disabled,\n id,\n inputProps: inputPropsProp,\n onChange,\n readOnly: readOnlyProp,\n role,\n style,\n type = \"text\",\n value: valueProp,\n // If we leave both value and defaultValue undefined, we will get a React warning on first edit\n // (uncontrolled to controlled warning) from the React input\n defaultValue: defaultValueProp = valueProp === undefined ? \"\" : undefined,\n variant = \"primary\",\n ...other\n },\n ref\n) {\n const {\n a11yProps: {\n disabled: a11yDisabled,\n readOnly: a11yReadOnly,\n ...restA11y\n } = {},\n } = useFormFieldPropsNext();\n\n const isDisabled = disabled || a11yDisabled;\n const isReadOnly = readOnlyProp || a11yReadOnly;\n\n const [focused, setFocused] = useState(false);\n\n const misplacedAriaProps = {\n \"aria-activedescendant\": ariaActiveDescendant,\n \"aria-expanded\": ariaExpanded,\n \"aria-owns\": ariaOwns,\n role,\n };\n const inputProps = mergeA11yProps(\n restA11y,\n inputPropsProp,\n misplacedAriaProps\n );\n\n const {\n onBlur,\n onFocus,\n onKeyDown,\n onKeyUp,\n onMouseUp,\n onMouseMove,\n onMouseDown,\n ...restInputProps\n } = inputProps;\n\n const [value, setValue] = useControlled({\n controlled: valueProp,\n default: defaultValueProp,\n name: \"Input\",\n state: \"value\",\n });\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const value = event.target.value;\n setValue(value);\n onChange?.(event, value);\n };\n\n const handleBlur = (event: FocusEvent<HTMLInputElement>) => {\n onBlur?.(event);\n setFocused(false);\n };\n\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n onFocus?.(event);\n setFocused(true);\n };\n\n return (\n <div\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"focused\")]: !isDisabled && focused,\n [withBaseName(\"disabled\")]: isDisabled,\n [withBaseName(\"readOnly\")]: isReadOnly,\n [withBaseName(variant)]: variant,\n },\n classNameProp\n )}\n style={style}\n {...other}\n >\n <input\n type={type}\n id={id}\n className={clsx(withBaseName(\"input\"), inputProps?.className)}\n disabled={isDisabled}\n readOnly={isReadOnly}\n ref={ref}\n value={value}\n tabIndex={isReadOnly || isDisabled ? -1 : 0}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={!isDisabled ? handleFocus : undefined}\n {...restInputProps}\n />\n </div>\n );\n});\n"],"names":["Input","value"],"mappings":";;;;;;;;;AAgBA,MAAM,YAA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