@threadlabs/looma 0.9.2 → 0.10.1

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 (49) hide show
  1. package/components/shared/form-reset.js +21 -0
  2. package/components/ui-checkbox/ui-checkbox.html +17 -4
  3. package/components/ui-checkbox/ui-checkbox.js +9 -0
  4. package/components/ui-combobox/ui-combobox.html +23 -11
  5. package/components/ui-combobox/ui-combobox.js +31 -12
  6. package/components/ui-editable/ui-editable.html +3 -1
  7. package/components/ui-editable/ui-editable.js +7 -6
  8. package/components/ui-editor-toolbar/ui-editor-toolbar.html +70 -20
  9. package/components/ui-editor-toolbar/ui-editor-toolbar.js +24 -0
  10. package/components/ui-input/ui-input.html +2 -2
  11. package/components/ui-input/ui-input.js +5 -2
  12. package/components/ui-radio/ui-radio.html +3 -1
  13. package/components/ui-radio/ui-radio.js +11 -0
  14. package/components/ui-radio-group/ui-radio-group.html +7 -5
  15. package/components/ui-radio-group/ui-radio-group.js +16 -3
  16. package/components/ui-search-result-row/ui-search-result-row.html +3 -3
  17. package/components/ui-select/ui-select.html +3 -1
  18. package/components/ui-select/ui-select.js +5 -2
  19. package/components/ui-switch/ui-switch.html +7 -4
  20. package/components/ui-switch/ui-switch.js +9 -0
  21. package/components/ui-textarea/ui-textarea.html +2 -2
  22. package/components/ui-textarea/ui-textarea.js +5 -2
  23. package/components/ui-tree-item/ui-tree-item.html +2 -2
  24. package/dist/index.js +20 -19
  25. package/package.json +1 -1
  26. package/styles/ui-editor-toolbar.css +72 -18
  27. package/vanilla/UiCheckbox.d.ts +1 -0
  28. package/vanilla/UiCheckbox.js +7 -4
  29. package/vanilla/UiCombobox.js +113 -99
  30. package/vanilla/UiEditorToolbar.js +11 -6
  31. package/vanilla/UiRadioGroup.js +7 -1
  32. package/vanilla/UiSearchResultRow.js +4 -1
  33. package/vanilla/UiSwitch.d.ts +1 -0
  34. package/vanilla/UiSwitch.js +7 -4
  35. package/vue/UiCheckbox.d.ts +2 -0
  36. package/vue/UiCheckbox.vue +3 -0
  37. package/vue/UiCombobox.vue +27 -4
  38. package/vue/UiEditorToolbar.vue +90 -20
  39. package/vue/UiRadioGroup.vue +2 -0
  40. package/vue/UiSearchResultRow.vue +1 -0
  41. package/vue/UiSwitch.d.ts +2 -0
  42. package/vue/UiSwitch.vue +3 -0
  43. package/vue/chunks/UiCheckbox.js +4 -1
  44. package/vue/chunks/UiCombobox.js +67 -39
  45. package/vue/chunks/UiEditorToolbar.js +33 -4
  46. package/vue/chunks/UiRadioGroup.js +8 -2
  47. package/vue/chunks/UiSearchResultRow.js +7 -2
  48. package/vue/chunks/UiSwitch.js +4 -1
  49. package/vue/components.css +159 -115
@@ -25,50 +25,54 @@ var _hoisted_6 = [
25
25
  "aria-busy",
26
26
  ".value",
27
27
  "placeholder",
28
- "name",
29
28
  "disabled",
30
29
  "readonly",
31
30
  "required"
32
31
  ];
33
- var _hoisted_7 = {
34
- key: 1,
35
- type: "button",
36
- "data-combobox-action": "clear",
37
- "aria-label": "Clear"
38
- };
39
- var _hoisted_8 = ["aria-controls"];
40
- var _hoisted_9 = ["id", "disabled"];
41
- var _hoisted_10 = ["hidden"];
42
- var _hoisted_11 = [
32
+ var _hoisted_7 = [
33
+ "name",
34
+ "value",
35
+ "disabled"
36
+ ];
37
+ var _hoisted_8 = [
38
+ "name",
39
+ "value",
40
+ "disabled"
41
+ ];
42
+ var _hoisted_9 = ["disabled"];
43
+ var _hoisted_10 = ["aria-controls", "disabled"];
44
+ var _hoisted_11 = ["id", "disabled"];
45
+ var _hoisted_12 = ["hidden"];
46
+ var _hoisted_13 = [
43
47
  "id",
44
48
  "aria-label",
45
49
  "aria-busy"
46
50
  ];
47
- var _hoisted_12 = ["role", "aria-label"];
48
- var _hoisted_13 = {
51
+ var _hoisted_14 = ["role", "aria-label"];
52
+ var _hoisted_15 = {
49
53
  key: 0,
50
54
  class: "group"
51
55
  };
52
- var _hoisted_14 = [
56
+ var _hoisted_16 = [
53
57
  "id",
54
58
  "aria-selected",
55
59
  "aria-disabled",
56
60
  "data-index"
57
61
  ];
58
- var _hoisted_15 = { class: "primary" };
59
- var _hoisted_16 = ["id", "data-index"];
60
- var _hoisted_17 = {
62
+ var _hoisted_17 = { class: "primary" };
63
+ var _hoisted_18 = ["id", "data-index"];
64
+ var _hoisted_19 = {
61
65
  key: 1,
62
66
  class: "message"
63
67
  };
64
- var _hoisted_18 = ["id", "hidden"];
65
- var _hoisted_19 = {
68
+ var _hoisted_20 = ["id", "hidden"];
69
+ var _hoisted_21 = {
66
70
  class: "sr-only",
67
71
  role: "status",
68
72
  "aria-live": "polite",
69
73
  "aria-atomic": "true"
70
74
  };
71
- var _hoisted_20 = {
75
+ var _hoisted_22 = {
72
76
  class: "authored-options",
73
77
  hidden: "",
74
78
  "aria-hidden": "true",
@@ -162,6 +166,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
162
166
  issues: []
163
167
  });
164
168
  const uid = ref("");
169
+ const submitted = ref("");
165
170
  const groups = ref([]);
166
171
  const creatable = ref(false);
167
172
  const createIndex = ref(0);
@@ -280,6 +285,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
280
285
  lookupError,
281
286
  validation,
282
287
  uid,
288
+ submitted,
283
289
  groups,
284
290
  creatable,
285
291
  createIndex,
@@ -335,13 +341,34 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
335
341
  "aria-busy": validationStatus.value === "pending",
336
342
  ".value": display.value,
337
343
  placeholder: __props.placeholder,
338
- name: __props.name,
339
344
  disabled: __props.disabled,
340
345
  readonly: __props.readonly,
341
- required: __props.required,
346
+ required: __props.required && !(__props.multiple && internalItems.value[0]),
342
347
  ref: "input"
343
348
  }, null, 40, _hoisted_6),
344
- __props.clearable ? (openBlock(), createElementBlock("button", _hoisted_7, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
349
+ __props.name && !__props.multiple ? (openBlock(), createElementBlock("input", {
350
+ key: 1,
351
+ type: "hidden",
352
+ name: __props.name,
353
+ value: submitted.value,
354
+ disabled: __props.disabled
355
+ }, null, 8, _hoisted_7)) : createCommentVNode("v-if", true),
356
+ __props.name && __props.multiple ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(internalItems.value, (item) => {
357
+ return openBlock(), createElementBlock("input", {
358
+ key: item.id,
359
+ type: "hidden",
360
+ name: __props.name,
361
+ value: item.value,
362
+ disabled: __props.disabled
363
+ }, null, 8, _hoisted_8);
364
+ }), 128)) : createCommentVNode("v-if", true),
365
+ __props.clearable ? (openBlock(), createElementBlock("button", {
366
+ key: 3,
367
+ type: "button",
368
+ "data-combobox-action": "clear",
369
+ "aria-label": "Clear",
370
+ disabled: __props.disabled || __props.readonly
371
+ }, [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
345
372
  class: "affordance-icon",
346
373
  "aria-hidden": "true",
347
374
  viewBox: "0 0 24 24",
@@ -349,14 +376,15 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
349
376
  stroke: "currentColor",
350
377
  "stroke-width": "2",
351
378
  "stroke-linecap": "round"
352
- }, [createElementVNode("path", { d: "M7 7l10 10M17 7 7 17" })], -1)])])) : createCommentVNode("v-if", true),
379
+ }, [createElementVNode("path", { d: "M7 7l10 10M17 7 7 17" })], -1)])], 8, _hoisted_9)) : createCommentVNode("v-if", true),
353
380
  __props.disclosure ? (openBlock(), createElementBlock("button", {
354
- key: 2,
381
+ key: 4,
355
382
  type: "button",
356
383
  "data-combobox-action": "disclosure",
357
384
  tabindex: "-1",
358
385
  "aria-label": "Show suggestions",
359
- "aria-controls": `${uid.value}-listbox`
386
+ "aria-controls": `${uid.value}-listbox`,
387
+ disabled: __props.disabled || __props.readonly
360
388
  }, [..._cache[1] || (_cache[1] = [createElementVNode("svg", {
361
389
  class: "affordance-icon",
362
390
  "aria-hidden": "true",
@@ -366,7 +394,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
366
394
  "stroke-width": "2.25",
367
395
  "stroke-linecap": "round",
368
396
  "stroke-linejoin": "round"
369
- }, [createElementVNode("path", { d: "m6 9 6 6 6-6" })], -1)])], 8, _hoisted_8)) : createCommentVNode("v-if", true)
397
+ }, [createElementVNode("path", { d: "m6 9 6 6 6-6" })], -1)])], 8, _hoisted_10)) : createCommentVNode("v-if", true)
370
398
  ], 512), __props.help ? (openBlock(), createElementBlock("button", {
371
399
  key: 0,
372
400
  class: "help",
@@ -391,7 +419,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
391
419
  }),
392
420
  createElementVNode("path", { d: "M9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3" }),
393
421
  createElementVNode("path", { d: "M12 17h.01" })
394
- ], -1)])], 8, _hoisted_9)) : createCommentVNode("v-if", true)]),
422
+ ], -1)])], 8, _hoisted_11)) : createCommentVNode("v-if", true)]),
395
423
  __props.help ? (openBlock(), createBlock(UiTooltip_default, {
396
424
  key: 0,
397
425
  trigger: "click",
@@ -417,7 +445,7 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
417
445
  key: group.name,
418
446
  role: group.role,
419
447
  "aria-label": group.label ?? void 0
420
- }, [group.name ? (openBlock(), createElementBlock("div", _hoisted_13, toDisplayString(group.name), 1)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(group.rows, (row) => {
448
+ }, [group.name ? (openBlock(), createElementBlock("div", _hoisted_15, toDisplayString(group.name), 1)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(group.rows, (row) => {
421
449
  return openBlock(), createElementBlock("div", {
422
450
  key: row.id,
423
451
  class: normalizeClass(["option", { active: row.index === active.value }]),
@@ -426,8 +454,8 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
426
454
  "aria-selected": row.selected,
427
455
  "aria-disabled": row.disabled,
428
456
  "data-index": row.index
429
- }, [renderSlot(_ctx.$slots, `option-${row.id}`, {}, () => [createElementVNode("span", _hoisted_15, toDisplayString(row.label), 1)], true)], 10, _hoisted_14);
430
- }), 128))], 8, _hoisted_12);
457
+ }, [renderSlot(_ctx.$slots, `option-${row.id}`, {}, () => [createElementVNode("span", _hoisted_17, toDisplayString(row.label), 1)], true)], 10, _hoisted_16);
458
+ }), 128))], 8, _hoisted_14);
431
459
  }), 128)),
432
460
  creatable.value ? (openBlock(), createElementBlock("div", {
433
461
  key: 0,
@@ -436,21 +464,21 @@ var UiCombobox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
436
464
  "aria-selected": "false",
437
465
  id: `${uid.value}-option-${createIndex.value}`,
438
466
  "data-index": createIndex.value
439
- }, toDisplayString(`Create “${raw.value}”`), 11, _hoisted_16)) : createCommentVNode("v-if", true),
440
- message.value ? (openBlock(), createElementBlock("div", _hoisted_17, toDisplayString(message.value), 1)) : createCommentVNode("v-if", true)
441
- ], 8, _hoisted_11), renderSlot(_ctx.$slots, "footer", {}, void 0, true)], 8, _hoisted_10),
467
+ }, toDisplayString(`Create “${raw.value}”`), 11, _hoisted_18)) : createCommentVNode("v-if", true),
468
+ message.value ? (openBlock(), createElementBlock("div", _hoisted_19, toDisplayString(message.value), 1)) : createCommentVNode("v-if", true)
469
+ ], 8, _hoisted_13), renderSlot(_ctx.$slots, "footer", {}, void 0, true)], 8, _hoisted_12),
442
470
  createElementVNode("div", {
443
471
  class: "message",
444
472
  id: `${uid.value}-validation`,
445
- hidden: !validation.value.issues.length
473
+ hidden: !validation.value.issues[0]
446
474
  }, [(openBlock(true), createElementBlock(Fragment, null, renderList(validation.value.issues, (issue, index) => {
447
475
  return openBlock(), createElementBlock("div", { key: index }, toDisplayString(issue.message), 1);
448
- }), 128))], 8, _hoisted_18),
449
- createElementVNode("div", _hoisted_19, toDisplayString(statusText.value), 1),
450
- createElementVNode("div", _hoisted_20, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 512)
476
+ }), 128))], 8, _hoisted_20),
477
+ createElementVNode("div", _hoisted_21, toDisplayString(statusText.value), 1),
478
+ createElementVNode("div", _hoisted_22, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 512)
451
479
  ], 16, _hoisted_1);
452
480
  };
453
481
  }
454
- }), [["__scopeId", "data-v-3b8b0ecf"]]);
482
+ }), [["__scopeId", "data-v-cd33b9b7"]]);
455
483
  //#endregion
456
484
  export { UiCombobox_default as t };
@@ -1,7 +1,13 @@
1
+ import { n as useComponentHost, t as createDispatch } from "./host.js";
1
2
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
- import { computed, createElementBlock, defineComponent, mergeProps, openBlock, renderSlot } from "vue";
3
+ import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, useTemplateRef } from "vue";
4
+ import * as controllerModule from "@threadlabs/looma/components/ui-editor-toolbar/ui-editor-toolbar.js";
3
5
  //#region .build/vue/UiEditorToolbar.vue?vue&type=script&setup=true&lang.ts
4
6
  var _hoisted_1 = ["data-ui-editor-toolbar-state"];
7
+ var _hoisted_2 = {
8
+ class: "strip",
9
+ ref: "strip"
10
+ };
5
11
  //#endregion
6
12
  //#region .build/vue/UiEditorToolbar.vue
7
13
  var UiEditorToolbar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -13,16 +19,39 @@ var UiEditorToolbar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/*
13
19
  } },
14
20
  setup(__props) {
15
21
  const props = __props;
22
+ const root = ref(null);
23
+ const stripElement = useTemplateRef("strip");
24
+ const overflowStart = ref(false);
25
+ const overflowEnd = ref(false);
16
26
  /** The values the styles' :host-state() rules test. */
17
- const hostState = computed(() => [props.floating && "floating"].filter(Boolean).join(" "));
27
+ const hostState = computed(() => [
28
+ overflowStart.value && "overflowStart",
29
+ overflowEnd.value && "overflowEnd",
30
+ props.floating && "floating"
31
+ ].filter(Boolean).join(" "));
32
+ const dispatch = createDispatch(root);
33
+ useComponentHost(controllerModule.default, {
34
+ root,
35
+ dispatch,
36
+ props,
37
+ refs: { strip: stripElement },
38
+ state: {
39
+ overflowStart,
40
+ overflowEnd
41
+ }
42
+ });
18
43
  return (_ctx, _cache) => {
19
44
  return openBlock(), createElementBlock("div", mergeProps({
20
45
  "data-component": "ui-editor-toolbar",
21
46
  role: "toolbar",
22
47
  "aria-label": "Editor toolbar"
23
- }, _ctx.$attrs, { "data-ui-editor-toolbar-state": hostState.value || void 0 }), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1);
48
+ }, _ctx.$attrs, {
49
+ "data-ui-editor-toolbar-state": hostState.value || void 0,
50
+ ref_key: "root",
51
+ ref: root
52
+ }), [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "default")], 512)], 16, _hoisted_1);
24
53
  };
25
54
  }
26
- }), [["__scopeId", "data-v-b71db5ba"]]);
55
+ }), [["__scopeId", "data-v-e776f060"]]);
27
56
  //#endregion
28
57
  export { UiEditorToolbar_default as t };
@@ -3,7 +3,11 @@ import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-hel
3
3
  import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, ref, renderSlot, toDisplayString } from "vue";
4
4
  import * as controllerModule from "@threadlabs/looma/components/ui-radio-group/ui-radio-group.js";
5
5
  //#region .build/vue/UiRadioGroup.vue?vue&type=script&setup=true&lang.ts
6
- var _hoisted_1 = ["data-ui-radio-group-state"];
6
+ var _hoisted_1 = [
7
+ "aria-required",
8
+ "disabled",
9
+ "data-ui-radio-group-state"
10
+ ];
7
11
  //#endregion
8
12
  //#region .build/vue/UiRadioGroup.vue
9
13
  var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -63,12 +67,14 @@ var UiRadioGroup_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
63
67
  "data-component": "ui-radio-group",
64
68
  role: "radiogroup"
65
69
  }, _ctx.$attrs, {
70
+ "aria-required": __props.required,
71
+ disabled: __props.disabled,
66
72
  "data-ui-radio-group-state": hostState.value || void 0,
67
73
  ref_key: "root",
68
74
  ref: root
69
75
  }), [createElementVNode("legend", null, toDisplayString(__props.label), 1), renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1);
70
76
  };
71
77
  }
72
- }), [["__scopeId", "data-v-cd639df6"]]);
78
+ }), [["__scopeId", "data-v-f54344c6"]]);
73
79
  //#endregion
74
80
  export { UiRadioGroup_default as t };
@@ -1,7 +1,11 @@
1
1
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
2
  import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock, renderSlot } from "vue";
3
3
  //#region .build/vue/UiSearchResultRow.vue?vue&type=script&setup=true&lang.ts
4
- var _hoisted_1 = ["disabled", "data-ui-search-result-row-state"];
4
+ var _hoisted_1 = [
5
+ "disabled",
6
+ "aria-current",
7
+ "data-ui-search-result-row-state"
8
+ ];
5
9
  var _hoisted_2 = { class: "leading" };
6
10
  var _hoisted_3 = { class: "content" };
7
11
  var _hoisted_4 = { class: "title" };
@@ -33,6 +37,7 @@ var UiSearchResultRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
33
37
  type: "button"
34
38
  }, _ctx.$attrs, {
35
39
  disabled: __props.disabled,
40
+ "aria-current": __props.selected,
36
41
  "data-ui-search-result-row-state": hostState.value || void 0
37
42
  }), [
38
43
  createElementVNode("span", _hoisted_2, [renderSlot(_ctx.$slots, "leading")]),
@@ -45,6 +50,6 @@ var UiSearchResultRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
45
50
  ], 16, _hoisted_1);
46
51
  };
47
52
  }
48
- }), [["__scopeId", "data-v-9f29c4b0"]]);
53
+ }), [["__scopeId", "data-v-c2562cce"]]);
49
54
  //#endregion
50
55
  export { UiSearchResultRow_default as t };
@@ -8,6 +8,7 @@ var _hoisted_2 = [
8
8
  ".checked",
9
9
  "disabled",
10
10
  "required",
11
+ "name",
11
12
  "value"
12
13
  ];
13
14
  var _hoisted_3 = { class: "label" };
@@ -25,6 +26,7 @@ var UiSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
25
26
  type: Boolean,
26
27
  default: false
27
28
  },
29
+ name: { default: "" },
28
30
  required: {
29
31
  type: Boolean,
30
32
  default: false
@@ -71,11 +73,12 @@ var UiSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
71
73
  ".checked": internalChecked.value,
72
74
  disabled: __props.disabled,
73
75
  required: __props.required,
76
+ name: __props.name,
74
77
  value: __props.value,
75
78
  ref: "input"
76
79
  }, null, 40, _hoisted_2), createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])], 16, _hoisted_1);
77
80
  };
78
81
  }
79
- }), [["__scopeId", "data-v-529fe437"]]);
82
+ }), [["__scopeId", "data-v-aeb44053"]]);
80
83
  //#endregion
81
84
  export { UiSwitch_default as t };