@threadlabs/looma 0.53.16 → 0.53.18

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/docs/catalog.json CHANGED
@@ -780,7 +780,7 @@
780
780
  ],
781
781
  "schemaVersion": 1,
782
782
  "package": "@threadlabs/looma",
783
- "version": "0.53.16",
783
+ "version": "0.53.18",
784
784
  "groups": [
785
785
  {
786
786
  "id": "layout",
@@ -19023,7 +19023,7 @@
19023
19023
  {
19024
19024
  "name": "invalid",
19025
19025
  "property": "invalid",
19026
- "description": "Marks the field's control invalid by setting aria-invalid on it. Only while invalid, the error slot appears and becomes part of the control's description.",
19026
+ "description": "Marks the field's control invalid by setting aria-invalid on it. Only while invalid, the error slot appears and becomes part of the control's description. Clearing the field error restores the control's own validation state.",
19027
19027
  "type": "boolean",
19028
19028
  "valueType": {
19029
19029
  "kind": "terminal",
@@ -19052,7 +19052,7 @@
19052
19052
  },
19053
19053
  {
19054
19054
  "name": "invalid",
19055
- "description": "Marks the field's control invalid by setting aria-invalid on it. Only while invalid, the error slot appears and becomes part of the control's description.",
19055
+ "description": "Marks the field's control invalid by setting aria-invalid on it. Only while invalid, the error slot appears and becomes part of the control's description. Clearing the field error restores the control's own validation state.",
19056
19056
  "type": "boolean",
19057
19057
  "default": false
19058
19058
  },
@@ -21160,9 +21160,39 @@
21160
21160
  }
21161
21161
  ],
21162
21162
  "shared": [
21163
+ {
21164
+ "name": "--ui-accent"
21165
+ },
21166
+ {
21167
+ "name": "--ui-accent-outline-border",
21168
+ "fallbacks": [
21169
+ "var(--ui-accent-subtle-text)"
21170
+ ]
21171
+ },
21163
21172
  {
21164
21173
  "name": "--ui-accent-solid"
21165
21174
  },
21175
+ {
21176
+ "name": "--ui-accent-subtle-text"
21177
+ },
21178
+ {
21179
+ "name": "--ui-accent-wash"
21180
+ },
21181
+ {
21182
+ "name": "--ui-accent-wash-hover"
21183
+ },
21184
+ {
21185
+ "name": "--ui-action-inset-sm",
21186
+ "fallbacks": [
21187
+ "var(--ui-space-2)"
21188
+ ]
21189
+ },
21190
+ {
21191
+ "name": "--ui-action-radius",
21192
+ "fallbacks": [
21193
+ "var(--ui-radius-md)"
21194
+ ]
21195
+ },
21166
21196
  {
21167
21197
  "name": "--ui-border-strong"
21168
21198
  },
@@ -21259,6 +21289,9 @@
21259
21289
  {
21260
21290
  "name": "--ui-focus-width"
21261
21291
  },
21292
+ {
21293
+ "name": "--ui-font-medium"
21294
+ },
21262
21295
  {
21263
21296
  "name": "--ui-font-size-md"
21264
21297
  },
@@ -21274,6 +21307,12 @@
21274
21307
  {
21275
21308
  "name": "--ui-motion-fast"
21276
21309
  },
21310
+ {
21311
+ "name": "--ui-neutral-shadow"
21312
+ },
21313
+ {
21314
+ "name": "--ui-pressed"
21315
+ },
21277
21316
  {
21278
21317
  "name": "--ui-radius-md"
21279
21318
  },
@@ -21306,6 +21345,12 @@
21306
21345
  },
21307
21346
  {
21308
21347
  "name": "--ui-text-secondary"
21348
+ },
21349
+ {
21350
+ "name": "--ui-tonal-opacity",
21351
+ "fallbacks": [
21352
+ "1"
21353
+ ]
21309
21354
  }
21310
21355
  ]
21311
21356
  },
@@ -3466,6 +3466,41 @@
3466
3466
  }
3467
3467
  }
3468
3468
 
3469
+ /* The native file action uses the outline button palette. The input still owns pointer and keyboard activation. */
3470
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]::file-selector-button {
3471
+ appearance: none;
3472
+ min-block-size: var(--ui-control-size-sm);
3473
+ margin-inline-end: var(--ui-space-2) !important;
3474
+ padding: var(--ui-control-inset-block-sm, var(--ui-space-1)) var(--ui-action-inset-sm, var(--ui-space-2)) !important;
3475
+ border: var(--ui-border-width) solid var(--ui-accent-outline-border, var(--ui-accent-subtle-text));
3476
+ border-radius: var(--ui-action-radius, var(--ui-radius-md));
3477
+ background-color: transparent;
3478
+ background-image: linear-gradient(var(--ui-accent-wash), var(--ui-accent-wash));
3479
+ color: var(--ui-accent-subtle-text);
3480
+ box-shadow: var(--ui-neutral-shadow);
3481
+ font: inherit;
3482
+ font-weight: var(--ui-font-medium);
3483
+ cursor: pointer;
3484
+ }
3485
+
3486
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]:enabled:hover::file-selector-button {
3487
+ background-image: linear-gradient(var(--ui-accent-wash-hover), var(--ui-accent-wash-hover));
3488
+ }
3489
+
3490
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]:enabled:active::file-selector-button {
3491
+ background-image: none;
3492
+ background-color: oklch(from var(--ui-accent) l c h / calc(18% * var(--ui-tonal-opacity, 1)));
3493
+ box-shadow: var(--ui-pressed);
3494
+ }
3495
+
3496
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]:disabled::file-selector-button {
3497
+ border-color: var(--ui-control-border);
3498
+ background: transparent;
3499
+ color: var(--ui-disabled-text);
3500
+ box-shadow: none;
3501
+ cursor: not-allowed;
3502
+ }
3503
+
3469
3504
  /* Tabbing into a field selects its text; tint that selection softly instead of the page highlight. */
3470
3505
  :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))::selection {
3471
3506
  background: color-mix(in srgb, var(--ui-accent-solid) 20%, transparent);
@@ -3543,6 +3578,8 @@
3543
3578
  @media (pointer: coarse) {
3544
3579
  }
3545
3580
 
3581
+ /* The native file action uses the outline button palette. The input still owns pointer and keyboard activation. */
3582
+
3546
3583
  /* Tabbing into a field selects its text; tint that selection softly instead of the page highlight. */
3547
3584
 
3548
3585
  /* The app's invalid flag, or the browser's own verdict once the user has left an invalid field. */
package/editor/index.js CHANGED
@@ -5258,8 +5258,41 @@ function connect$9(host) {
5258
5258
  const element = host.element;
5259
5259
  let activeInput = null;
5260
5260
  let owned = /* @__PURE__ */ new Set();
5261
+ let controlInvalid;
5261
5262
  let queued = false;
5262
5263
  const warned = /* @__PURE__ */ new Set();
5264
+ const readControlInvalid = (records) => {
5265
+ if (records.some((record) => record.attributeName === "aria-invalid")) controlInvalid = activeInput.getAttribute("aria-invalid") ?? "false";
5266
+ else if (records.some(({ attributeName }) => /^data-ui-[a-z-]+-prop-invalid$/.test(attributeName) && activeInput.getAttribute(attributeName) === "true")) controlInvalid = "true";
5267
+ };
5268
+ const setNativeInvalid = (value) => {
5269
+ if (activeInput.getAttribute("aria-invalid") === value) return;
5270
+ activeInput.setAttribute("aria-invalid", value);
5271
+ invalidObserver.takeRecords();
5272
+ };
5273
+ const invalidObserver = new MutationObserver((records) => {
5274
+ readControlInvalid(records);
5275
+ if (host.props.invalid.value) setNativeInvalid("true");
5276
+ });
5277
+ const releaseInvalid = () => {
5278
+ if (controlInvalid === void 0) return;
5279
+ readControlInvalid(invalidObserver.takeRecords());
5280
+ invalidObserver.disconnect();
5281
+ setNativeInvalid(controlInvalid);
5282
+ controlInvalid = void 0;
5283
+ };
5284
+ const updateInvalid = () => {
5285
+ if (!host.props.invalid.value) {
5286
+ releaseInvalid();
5287
+ return;
5288
+ }
5289
+ if (controlInvalid === void 0) {
5290
+ controlInvalid = activeInput.getAttribute("aria-invalid") ?? "false";
5291
+ invalidObserver.observe(activeInput, { attributes: true });
5292
+ }
5293
+ readControlInvalid(invalidObserver.takeRecords());
5294
+ setNativeInvalid("true");
5295
+ };
5263
5296
  const removeOwned = (input) => {
5264
5297
  if (!input || owned.size === 0) return;
5265
5298
  const remaining = descriptionIds(input).filter((value) => !owned.has(value));
@@ -5276,6 +5309,7 @@ function connect$9(host) {
5276
5309
  const errorRegion = element.querySelector(":scope > .error");
5277
5310
  const error = element.querySelector(":scope > .error > *, [slot=\"error\"], [role=\"alert\"]") ?? (errorRegion?.textContent.trim() ? errorRegion : null);
5278
5311
  if (input !== activeInput) {
5312
+ releaseInvalid();
5279
5313
  removeOwned(activeInput);
5280
5314
  activeInput = input;
5281
5315
  owned = /* @__PURE__ */ new Set();
@@ -5301,7 +5335,7 @@ function connect$9(host) {
5301
5335
  input.disabled = Boolean(host.props.disabled.value);
5302
5336
  if (input.matches("[data-ui-field-control]")) for (const value of element.querySelectorAll("[data-ui-field-value]")) value.disabled = input.disabled;
5303
5337
  input.required = Boolean(host.props.required.value);
5304
- input.setAttribute("aria-invalid", String(Boolean(host.props.invalid.value)));
5338
+ updateInvalid();
5305
5339
  };
5306
5340
  const schedule = () => {
5307
5341
  if (queued) return;
@@ -5334,6 +5368,7 @@ function connect$9(host) {
5334
5368
  return () => {
5335
5369
  stop();
5336
5370
  observer.disconnect();
5371
+ releaseInvalid();
5337
5372
  removeOwned(activeInput);
5338
5373
  };
5339
5374
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.53.16",
3
+ "version": "0.53.18",
4
4
  "type": "module",
5
5
  "description": "HTML Next UI components, native DOM support and design tokens.",
6
6
  "license": "MIT",
@@ -78,6 +78,41 @@
78
78
  }
79
79
  }
80
80
 
81
+ /* The native file action uses the outline button palette. The input still owns pointer and keyboard activation. */
82
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]::file-selector-button {
83
+ appearance: none;
84
+ min-block-size: var(--ui-control-size-sm);
85
+ margin-inline-end: var(--ui-space-2) !important;
86
+ padding: var(--ui-control-inset-block-sm, var(--ui-space-1)) var(--ui-action-inset-sm, var(--ui-space-2)) !important;
87
+ border: var(--ui-border-width) solid var(--ui-accent-outline-border, var(--ui-accent-subtle-text));
88
+ border-radius: var(--ui-action-radius, var(--ui-radius-md));
89
+ background-color: transparent;
90
+ background-image: linear-gradient(var(--ui-accent-wash), var(--ui-accent-wash));
91
+ color: var(--ui-accent-subtle-text);
92
+ box-shadow: var(--ui-neutral-shadow);
93
+ font: inherit;
94
+ font-weight: var(--ui-font-medium);
95
+ cursor: pointer;
96
+ }
97
+
98
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]:enabled:hover::file-selector-button {
99
+ background-image: linear-gradient(var(--ui-accent-wash-hover), var(--ui-accent-wash-hover));
100
+ }
101
+
102
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]:enabled:active::file-selector-button {
103
+ background-image: none;
104
+ background-color: oklch(from var(--ui-accent) l c h / calc(18% * var(--ui-tonal-opacity, 1)));
105
+ box-shadow: var(--ui-pressed);
106
+ }
107
+
108
+ :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))[type="file"]:disabled::file-selector-button {
109
+ border-color: var(--ui-control-border);
110
+ background: transparent;
111
+ color: var(--ui-disabled-text);
112
+ box-shadow: none;
113
+ cursor: not-allowed;
114
+ }
115
+
81
116
  /* Tabbing into a field selects its text; tint that selection softly instead of the page highlight. */
82
117
  :scope:where(:is([component~="ui-input"]:not(template), [data-component~="ui-input"]:not([component])))::selection {
83
118
  background: color-mix(in srgb, var(--ui-accent-solid) 20%, transparent);
@@ -155,6 +190,8 @@
155
190
  @media (pointer: coarse) {
156
191
  }
157
192
 
193
+ /* The native file action uses the outline button palette. The input still owns pointer and keyboard activation. */
194
+
158
195
  /* Tabbing into a field selects its text; tint that selection softly instead of the page highlight. */
159
196
 
160
197
  /* The app's invalid flag, or the browser's own verdict once the user has left an invalid field. */