jsswift 1.0.47 → 1.0.49

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/jsswift.js CHANGED
@@ -7823,6 +7823,30 @@ const unitCover = (v, name = 'size') => {
7823
7823
  return el;
7824
7824
  };
7825
7825
 
7826
+ // Public field attributes belong to the interactive control, not its wrapper.
7827
+ function uiConfigureFieldControl(field, control, props, native = false) {
7828
+ field.focus = (options) => control.focus(options);
7829
+ const set = (name, value) => {
7830
+ if (value == null || value === false) control.removeAttribute(name);
7831
+ else control.setAttribute(name, String(value));
7832
+ };
7833
+ JSswift.reactive.effect(() => {
7834
+ const label = uiUnwrap(props.ariaLabel) ?? (typeof props.label === "string" ? props.label : null);
7835
+ set("aria-label", label);
7836
+ set("aria-labelledby", uiUnwrap(props.ariaLabelledBy));
7837
+ set("aria-describedby", uiUnwrap(props.ariaDescribedBy));
7838
+ const invalid = props.ariaInvalid == null ? !!uiUnwrap(props.error) : !!uiUnwrap(props.ariaInvalid);
7839
+ control.setAttribute("aria-invalid", String(invalid));
7840
+ const required = !!uiUnwrap(props.required);
7841
+ control.setAttribute("aria-required", String(required));
7842
+ if (native) {
7843
+ control.required = required;
7844
+ for (const name of ["min", "max", "step", "pattern", "minLength", "maxLength"])
7845
+ set(name.toLowerCase(), uiUnwrap(props[name]));
7846
+ }
7847
+ }, "UI.Field:controlAttributes");
7848
+ }
7849
+
7826
7850
  UI.Input = (props = {}) => {
7827
7851
  const slots = props.slots || {};
7828
7852
  const fieldProps = {
@@ -7984,6 +8008,7 @@ const unitCover = (v, name = 'size') => {
7984
8008
 
7985
8009
  // expose reference
7986
8010
  field._input = input;
8011
+ uiConfigureFieldControl(field, input, props, true);
7987
8012
  uiRegisterShortcode(input, props, {
7988
8013
  isEnabled: () => !input.disabled,
7989
8014
  action: () => uiFocusShortcutTarget(input, { selectText: !!props.selectOnShortcode })
@@ -9381,6 +9406,7 @@ const unitCover = (v, name = 'size') => {
9381
9406
  // refresh has-value when value changes
9382
9407
  JSswift.reactive.effect(() => { field._refresh?.(); }, "UI.Select:fieldRefresh");
9383
9408
 
9409
+ uiConfigureFieldControl(field, root, props);
9384
9410
  field._select = root;
9385
9411
  field._dispose = root._dispose;
9386
9412
  JSswift._registerCleanup?.(field, field._dispose);