@dloizides/ui-forms 1.26.0 → 1.27.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/index.mjs CHANGED
@@ -2110,6 +2110,86 @@ function DateRangeControl({
2110
2110
  )
2111
2111
  ] });
2112
2112
  }
2113
+ var NATIVE_INPUT_BOX = {
2114
+ borderStyle: "solid",
2115
+ boxSizing: "border-box",
2116
+ fontFamily: "inherit",
2117
+ width: "100%"
2118
+ };
2119
+ function buildNativeInputStyle(themed) {
2120
+ const { paddingHorizontal, paddingVertical, ...box } = StyleSheet.flatten(controlStyles.input);
2121
+ return {
2122
+ ...box,
2123
+ ...themed,
2124
+ ...NATIVE_INPUT_BOX,
2125
+ paddingBlock: paddingVertical,
2126
+ paddingInline: paddingHorizontal
2127
+ };
2128
+ }
2129
+ function WebDateInput({ fieldProps, context, webInputType }) {
2130
+ const { label, value, onChange, onSubmit, accessibilityHint, testID, required, disabled = false, min, max } = fieldProps;
2131
+ const { style, focusBind, hoverBind } = useThemedInput({ hasError: context.hasError, editable: !disabled });
2132
+ const webA11y = webFieldA11y({
2133
+ describedById: context.describedById,
2134
+ hasError: context.hasError,
2135
+ required
2136
+ });
2137
+ const handleChange = (event) => onChange(event.target.value);
2138
+ const handleKeyDown = (event) => {
2139
+ if (event.key !== "Enter" || onSubmit === void 0) return;
2140
+ event.preventDefault();
2141
+ onSubmit();
2142
+ };
2143
+ return /* @__PURE__ */ jsx(
2144
+ "input",
2145
+ {
2146
+ ...webA11y,
2147
+ ...hoverBind,
2148
+ ...focusBind,
2149
+ "aria-label": label,
2150
+ "data-testid": testID,
2151
+ disabled,
2152
+ id: context.controlId,
2153
+ max,
2154
+ min,
2155
+ style: buildNativeInputStyle(style),
2156
+ title: accessibilityHint,
2157
+ type: webInputType,
2158
+ value,
2159
+ onChange: handleChange,
2160
+ onKeyDown: handleKeyDown
2161
+ }
2162
+ );
2163
+ }
2164
+ var IS_WEB7 = Platform.OS === "web";
2165
+ function renderNativeInput(fieldProps, context) {
2166
+ return /* @__PURE__ */ jsx(
2167
+ ThemedTextInput,
2168
+ {
2169
+ accessibilityHint: fieldProps.accessibilityHint,
2170
+ accessibilityLabel: fieldProps.label,
2171
+ describedById: context.describedById,
2172
+ editable: fieldProps.disabled !== true,
2173
+ hasError: context.hasError,
2174
+ id: context.controlId,
2175
+ requiredField: fieldProps.required,
2176
+ testID: fieldProps.testID,
2177
+ value: fieldProps.value,
2178
+ onChangeText: fieldProps.onChange,
2179
+ onSubmitEditing: fieldProps.onSubmit
2180
+ }
2181
+ );
2182
+ }
2183
+ function TemporalField({ fieldProps, webInputType }) {
2184
+ const { label, required, hint, error } = fieldProps;
2185
+ return /* @__PURE__ */ jsx(Field, { error, hint, label, required, children: (context) => IS_WEB7 ? /* @__PURE__ */ jsx(WebDateInput, { context, fieldProps, webInputType }) : renderNativeInput(fieldProps, context) });
2186
+ }
2187
+ function DateField(props) {
2188
+ return /* @__PURE__ */ jsx(TemporalField, { fieldProps: props, webInputType: "date" });
2189
+ }
2190
+ function DateTimeField(props) {
2191
+ return /* @__PURE__ */ jsx(TemporalField, { fieldProps: props, webInputType: "datetime-local" });
2192
+ }
2113
2193
 
2114
2194
  // src/groupSelection/groupSelection.ts
2115
2195
  var NONE = 0;
@@ -2350,6 +2430,6 @@ var UploadWithLinkField = ({
2350
2430
  ] });
2351
2431
  };
2352
2432
 
2353
- export { AlignToControl, AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateRangeControl, Field, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStatusLine, FormSwitch, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, SelectControl, SelectField, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
2433
+ export { AlignToControl, AnchoredMenu, ChipSelector, DEFAULT_MAX_RECENTS, DEFAULT_OPTIONAL_LABEL, DEFAULT_TYPEAHEAD_MAX_SUGGESTIONS, DEFAULT_TYPEAHEAD_MIN_CHARS, DateField, DateRangeControl, DateTimeField, Field, FormActions, FormCell, FormCheckbox, FormField, FormGrid, FormSection, FormStatusLine, FormSwitch, INLINE_FIELD_ROW_MIN_WIDTH, InlineFieldRow, SelectControl, SelectField, StepperNav, StepperTabs, ThemedTextInput, TypeaheadControl, UploadWithLinkField, controlStyles, groupAriaChecked, inlineFieldRowLayout, isUnmatched, resolveGroupSelection, resolveStepNeighbours, suggestOptions, toggleGroupSelection, useFocusFirstInvalid, useKeepInView, useRecentValues, useThemedInput };
2354
2434
  //# sourceMappingURL=index.mjs.map
2355
2435
  //# sourceMappingURL=index.mjs.map