@threadlabs/looma 0.17.3 → 0.18.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.
Files changed (71) hide show
  1. package/components/ui-avatar/ui-avatar.html +8 -4
  2. package/components/ui-badge/ui-badge.html +28 -34
  3. package/components/ui-button/ui-button.html +5 -0
  4. package/components/ui-checkbox/ui-checkbox.html +5 -5
  5. package/components/ui-combobox/ui-combobox.html +4 -48
  6. package/components/ui-icon-button/ui-icon-button.html +7 -7
  7. package/components/ui-input/ui-input.html +1 -1
  8. package/components/ui-input-group/ui-input-group.html +2 -2
  9. package/components/ui-listbox/ui-listbox.html +88 -12
  10. package/components/ui-listbox/ui-listbox.js +162 -18
  11. package/components/ui-search-result-row/ui-search-result-row.html +2 -6
  12. package/components/ui-search-shell/ui-search-shell.html +2 -11
  13. package/components/ui-select/ui-select.html +1 -1
  14. package/components/ui-spinner/ui-spinner.html +45 -18
  15. package/components/ui-textarea/ui-textarea.html +1 -1
  16. package/components/ui-tooltip/ui-tooltip.html +2 -2
  17. package/dist/index.js +1 -1
  18. package/editor/chunks/extensions.js +5 -0
  19. package/package.json +1 -1
  20. package/styles/ui-avatar.css +6 -2
  21. package/styles/ui-badge.css +30 -40
  22. package/styles/ui-button.css +7 -0
  23. package/styles/ui-checkbox.css +6 -6
  24. package/styles/ui-combobox.css +0 -52
  25. package/styles/ui-icon-button.css +7 -7
  26. package/styles/ui-input-group.css +2 -2
  27. package/styles/ui-input.css +1 -1
  28. package/styles/ui-listbox.css +33 -8
  29. package/styles/ui-search-result-row.css +2 -6
  30. package/styles/ui-search-shell.css +2 -13
  31. package/styles/ui-select.css +1 -1
  32. package/styles/ui-spinner.css +38 -19
  33. package/styles/ui-textarea.css +1 -1
  34. package/styles/ui-tooltip.css +2 -2
  35. package/tokens.css +67 -2
  36. package/vanilla/UiCombobox.js +9 -1
  37. package/vanilla/UiListbox.d.ts +3 -1
  38. package/vanilla/UiListbox.js +65 -18
  39. package/vanilla/UiSpinner.js +19 -1
  40. package/vue/UiAvatar.vue +11 -2
  41. package/vue/UiBadge.vue +30 -36
  42. package/vue/UiButton.vue +5 -0
  43. package/vue/UiCheckbox.vue +5 -5
  44. package/vue/UiCombobox.vue +4 -49
  45. package/vue/UiIconButton.vue +10 -7
  46. package/vue/UiInput.vue +1 -1
  47. package/vue/UiInputGroup.vue +2 -2
  48. package/vue/UiListbox.d.ts +18 -5
  49. package/vue/UiListbox.vue +142 -25
  50. package/vue/UiSearchResultRow.vue +2 -6
  51. package/vue/UiSearchShell.vue +2 -13
  52. package/vue/UiSelect.vue +1 -1
  53. package/vue/UiSpinner.vue +45 -18
  54. package/vue/UiTextarea.vue +1 -1
  55. package/vue/UiTooltip.vue +2 -2
  56. package/vue/chunks/UiAvatar.js +2 -1
  57. package/vue/chunks/UiBadge.js +1 -1
  58. package/vue/chunks/UiButton.js +1 -1
  59. package/vue/chunks/UiCheckbox.js +1 -1
  60. package/vue/chunks/UiCombobox.js +11 -2
  61. package/vue/chunks/UiIconButton.js +1 -1
  62. package/vue/chunks/UiInput.js +1 -1
  63. package/vue/chunks/UiInputGroup.js +1 -1
  64. package/vue/chunks/UiListbox.js +134 -20
  65. package/vue/chunks/UiSearchResultRow.js +1 -1
  66. package/vue/chunks/UiSearchShell.js +1 -1
  67. package/vue/chunks/UiSelect.js +1 -1
  68. package/vue/chunks/UiSpinner.js +29 -3
  69. package/vue/chunks/UiTextarea.js +1 -1
  70. package/vue/chunks/UiTooltip.js +1 -1
  71. package/vue/components.css +426 -440
@@ -1,14 +1,35 @@
1
1
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
2
  import { n as useComponentHost, t as createDispatch } from "./host.js";
3
- import { computed, createElementBlock, defineComponent, mergeProps, openBlock, ref, renderSlot, vModelSelect, withDirectives } from "vue";
3
+ import { t as UiScrollArea_default } from "./UiScrollArea.js";
4
+ import { Fragment, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderList, renderSlot, toDisplayString, useTemplateRef, withCtx } from "vue";
4
5
  import * as controllerModule from "@threadlabs/looma/components/ui-listbox/ui-listbox.js";
5
6
  //#region .build/vue/UiListbox.vue?vue&type=script&setup=true&lang.ts
6
7
  var _hoisted_1 = [
8
+ "tabindex",
9
+ "aria-multiselectable",
10
+ "aria-disabled",
11
+ "aria-required",
12
+ "aria-invalid"
13
+ ];
14
+ var _hoisted_2 = [
15
+ "data-multiple",
16
+ "id",
17
+ "data-index",
18
+ "aria-selected",
19
+ "aria-disabled"
20
+ ];
21
+ var _hoisted_3 = [
7
22
  "size",
8
23
  "multiple",
9
24
  "disabled",
10
25
  "required",
11
- "aria-invalid"
26
+ "name"
27
+ ];
28
+ var _hoisted_4 = ["name", "value"];
29
+ var _hoisted_5 = [
30
+ "required",
31
+ "checked",
32
+ "disabled"
12
33
  ];
13
34
  //#endregion
14
35
  //#region .build/vue/UiListbox.vue
@@ -28,43 +49,136 @@ var UiListbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
28
49
  type: Boolean,
29
50
  default: false
30
51
  },
52
+ name: { default: "" },
31
53
  required: {
32
54
  type: Boolean,
33
55
  default: false
34
56
  },
35
57
  rows: { default: 5 },
36
58
  value: {},
37
- values: {},
38
- modelValue: {}
59
+ values: {}
39
60
  },
40
- emits: ["update:modelValue"],
61
+ emits: [
62
+ "update:value",
63
+ "update:values",
64
+ "change"
65
+ ],
41
66
  setup(__props, { emit: __emit }) {
42
67
  const props = __props;
43
68
  const emit = __emit;
44
- const model = computed({
45
- get: () => props.modelValue ?? props.value ?? void 0,
46
- set: (value) => emit("update:modelValue", value)
47
- });
48
69
  const root = ref(null);
49
- const dispatch = createDispatch(root);
70
+ const choicesElement = useTemplateRef("choices");
71
+ const optionsElement = useTemplateRef("options");
72
+ const validityElement = useTemplateRef("validity");
73
+ const choices = ref([]);
74
+ const selection = ref([]);
75
+ const hasSelection = ref(false);
76
+ const active = ref(-1);
77
+ const uid = ref("");
78
+ const validationError = ref(false);
79
+ const isChangeDetail = (detail) => detail !== null && typeof detail === "object" && !Array.isArray(detail) && (typeof detail["value"] === "string" || detail["value"] === null) && Array.isArray(detail["values"]) && detail["values"].every((item) => typeof item === "string") && (detail["trigger"] === "keyboard" || detail["trigger"] === "pointer") && Object.keys(detail).every((key) => [
80
+ "value",
81
+ "values",
82
+ "trigger"
83
+ ].includes(key));
84
+ const dispatch = createDispatch(root, emit, {
85
+ checks: { change: isChangeDetail },
86
+ modeled: ["value", "values"]
87
+ });
50
88
  useComponentHost(controllerModule.default, {
51
89
  root,
52
90
  dispatch,
53
- props
91
+ props,
92
+ refs: {
93
+ choices: choicesElement,
94
+ options: optionsElement,
95
+ validity: validityElement
96
+ },
97
+ state: {
98
+ choices,
99
+ selection,
100
+ hasSelection,
101
+ active,
102
+ uid,
103
+ validationError
104
+ }
54
105
  });
106
+ function text(value) {
107
+ if (Array.isArray(value)) return value.map(text).join(" ");
108
+ return value === null || value === void 0 || typeof value === "object" ? "" : String(value);
109
+ }
110
+ function attribute(value) {
111
+ if (value === null || value === void 0 || value === false || typeof value === "object" && !Array.isArray(value)) return void 0;
112
+ return value === true ? "" : text(value);
113
+ }
55
114
  return (_ctx, _cache) => {
56
- return withDirectives((openBlock(), createElementBlock("select", mergeProps({ "data-component": "ui-listbox" }, _ctx.$attrs, {
57
- size: __props.rows,
58
- multiple: __props.multiple,
59
- disabled: __props.disabled,
60
- required: __props.required,
61
- "aria-invalid": __props.invalid,
62
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
115
+ return openBlock(), createElementBlock("div", mergeProps({
116
+ "data-component": "ui-listbox",
117
+ role: "listbox"
118
+ }, _ctx.$attrs, {
119
+ tabindex: attribute({
120
+ true: "-1",
121
+ false: "0"
122
+ }[`${__props.disabled}`]),
123
+ "aria-multiselectable": __props.multiple,
124
+ "aria-disabled": __props.disabled,
125
+ "aria-required": __props.required,
126
+ "aria-invalid": __props.invalid || validationError.value,
127
+ style: { "--_rows": __props.rows },
63
128
  ref_key: "root",
64
129
  ref: root
65
- }), [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1)), [[vModelSelect, model.value]]);
130
+ }), [
131
+ createVNode(UiScrollArea_default, {
132
+ class: "choices",
133
+ ref_key: "choices",
134
+ ref: choices
135
+ }, {
136
+ default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(choices.value, (choice) => {
137
+ return openBlock(), createElementBlock("div", {
138
+ key: choice.index,
139
+ class: normalizeClass(["option", { active: choice.index === active.value }]),
140
+ role: "option",
141
+ "data-ui-choice-option": "",
142
+ "data-multiple": __props.multiple ? "" : void 0,
143
+ id: `${uid.value}-option-${choice.index}`,
144
+ "data-index": choice.index,
145
+ "aria-selected": choice.selected,
146
+ "aria-disabled": choice.disabled
147
+ }, [createElementVNode("span", null, toDisplayString(choice.label), 1)], 10, _hoisted_2);
148
+ }), 128))]),
149
+ _: 1
150
+ }, 512),
151
+ createElementVNode("select", {
152
+ class: "fallback",
153
+ "aria-label": "Choices",
154
+ size: __props.rows,
155
+ multiple: __props.multiple,
156
+ disabled: __props.disabled,
157
+ required: __props.required,
158
+ name: __props.name,
159
+ ref: "options"
160
+ }, [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 8, _hoisted_3),
161
+ __props.name && !__props.disabled ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(selection.value, (selected, index) => {
162
+ return openBlock(), createElementBlock("input", {
163
+ key: index,
164
+ type: "hidden",
165
+ name: __props.name,
166
+ value: selected
167
+ }, null, 8, _hoisted_4);
168
+ }), 128)) : createCommentVNode("v-if", true),
169
+ createElementVNode("input", {
170
+ class: "validity",
171
+ type: "checkbox",
172
+ "aria-hidden": "true",
173
+ tabindex: "-1",
174
+ required: __props.required && !hasSelection.value && !__props.disabled,
175
+ checked: hasSelection.value,
176
+ disabled: __props.disabled,
177
+ ref: "validity"
178
+ }, null, 8, _hoisted_5)
179
+ ], 16, _hoisted_1);
66
180
  };
67
181
  }
68
- }), [["__scopeId", "data-v-44b33b05"]]);
182
+ }), [["__scopeId", "data-v-db56e4d0"]]);
69
183
  //#endregion
70
184
  export { UiListbox_default as t };
@@ -50,6 +50,6 @@ var UiSearchResultRow_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
50
50
  ], 16, _hoisted_1);
51
51
  };
52
52
  }
53
- }), [["__scopeId", "data-v-5a2d6e2a"]]);
53
+ }), [["__scopeId", "data-v-5fd17258"]]);
54
54
  //#endregion
55
55
  export { UiSearchResultRow_default as t };
@@ -67,6 +67,6 @@ var UiSearchShell_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @
67
67
  ])], 8, _hoisted_1)], 16);
68
68
  };
69
69
  }
70
- }), [["__scopeId", "data-v-089e37ee"]]);
70
+ }), [["__scopeId", "data-v-b1cde00b"]]);
71
71
  //#endregion
72
72
  export { UiSearchShell_default as t };
@@ -60,6 +60,6 @@ var UiSelect_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
60
60
  }), [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1)), [[vModelSelect, model.value]]);
61
61
  };
62
62
  }
63
- }), [["__scopeId", "data-v-3f68a24f"]]);
63
+ }), [["__scopeId", "data-v-699dcb22"]]);
64
64
  //#endregion
65
65
  export { UiSelect_default as t };
@@ -1,9 +1,10 @@
1
1
  import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper.js";
2
- import { computed, createElementBlock, defineComponent, mergeProps, openBlock } from "vue";
2
+ import { computed, createElementBlock, createElementVNode, defineComponent, mergeProps, openBlock } from "vue";
3
3
  //#region .build/vue/UiSpinner.vue?vue&type=script&setup=true&lang.ts
4
4
  var _hoisted_1 = [
5
5
  "role",
6
6
  "aria-label",
7
+ "aria-live",
7
8
  "aria-hidden",
8
9
  "data-ui-spinner-state"
9
10
  ];
@@ -47,6 +48,16 @@ var UiSpinner_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
47
48
  true: __props.label,
48
49
  false: null
49
50
  }[`${__props.label !== ""}`]),
51
+ "aria-live": typeof {
52
+ true: "polite",
53
+ false: null
54
+ }[`${__props.label !== ""}`] === "boolean" ? String({
55
+ true: "polite",
56
+ false: null
57
+ }[`${__props.label !== ""}`]) : attribute({
58
+ true: "polite",
59
+ false: null
60
+ }[`${__props.label !== ""}`]),
50
61
  "aria-hidden": typeof {
51
62
  true: null,
52
63
  false: "true"
@@ -58,9 +69,24 @@ var UiSpinner_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
58
69
  false: "true"
59
70
  }[`${__props.label !== ""}`]),
60
71
  "data-ui-spinner-state": hostState.value || void 0
61
- }), null, 16, _hoisted_1);
72
+ }), [..._cache[0] || (_cache[0] = [createElementVNode("svg", {
73
+ viewBox: "0 0 50 50",
74
+ fill: "none",
75
+ "aria-hidden": "true",
76
+ focusable: "false"
77
+ }, [createElementVNode("circle", {
78
+ class: "track",
79
+ cx: "25",
80
+ cy: "25",
81
+ r: "20"
82
+ }), createElementVNode("circle", {
83
+ class: "arc",
84
+ cx: "25",
85
+ cy: "25",
86
+ r: "20"
87
+ })], -1)])], 16, _hoisted_1);
62
88
  };
63
89
  }
64
- }), [["__scopeId", "data-v-1c74343f"]]);
90
+ }), [["__scopeId", "data-v-7dbd4f40"]]);
65
91
  //#endregion
66
92
  export { UiSpinner_default as t };
@@ -74,6 +74,6 @@ var UiTextarea_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
74
74
  }), null, 16, _hoisted_1)), [[vModelText, model.value]]);
75
75
  };
76
76
  }
77
- }), [["__scopeId", "data-v-f371e58f"]]);
77
+ }), [["__scopeId", "data-v-a2e0e09f"]]);
78
78
  //#endregion
79
79
  export { UiTextarea_default as t };
@@ -68,6 +68,6 @@ var UiTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
68
68
  }), [createElementVNode("div", _hoisted_2, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])], 16, _hoisted_1);
69
69
  };
70
70
  }
71
- }), [["__scopeId", "data-v-8f81f4b2"]]);
71
+ }), [["__scopeId", "data-v-0e272bf3"]]);
72
72
  //#endregion
73
73
  export { UiTooltip_default as t };