@threadlabs/looma 0.11.6 → 0.12.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/vue/UiRadio.vue CHANGED
@@ -36,6 +36,7 @@ const emit = defineEmits<{
36
36
 
37
37
  const root = ref<HTMLElement | null>(null)
38
38
  const inputElement = useTemplateRef<HTMLElement>('input')
39
+ const descriptionElement = useTemplateRef<HTMLElement>('description')
39
40
  const internalChecked = ref(false)
40
41
 
41
42
  /** The values the styles' :host-state() rules test. */
@@ -64,7 +65,7 @@ useComponentHost(controllerModule.default, {
64
65
  root,
65
66
  dispatch,
66
67
  props,
67
- refs: { input: inputElement },
68
+ refs: { input: inputElement, description: descriptionElement },
68
69
  state: { internalChecked },
69
70
  })
70
71
  </script>
@@ -84,7 +85,10 @@ useComponentHost(controllerModule.default, {
84
85
  :name="name"
85
86
  ref="input"
86
87
  >
87
- <span class="label"><slot /></span></label>
88
+ <span class="text"><span class="label"><slot /></span>
89
+ <span class="description" aria-hidden="true" ref="description"><slot
90
+ name="description"
91
+ /></span></span></label>
88
92
  </template>
89
93
 
90
94
  <style scoped>
@@ -97,11 +101,29 @@ useComponentHost(controllerModule.default, {
97
101
  cursor: pointer;
98
102
  }
99
103
 
104
+ /* The label, and under it an optional line saying what the choice means. */
105
+ .text {
106
+ display: flex;
107
+ flex-direction: column;
108
+ gap: var(--ui-space-1);
109
+ min-inline-size: 0;
110
+ }
111
+
100
112
  .label {
101
113
  min-inline-size: 0;
102
114
  line-height: var(--ui-line-height-md);
103
115
  }
104
116
 
117
+ .description {
118
+ color: var(--ui-text-secondary);
119
+ font-size: var(--ui-font-size-sm);
120
+ line-height: var(--ui-line-height);
121
+ }
122
+
123
+ .description:empty {
124
+ display: none;
125
+ }
126
+
105
127
  input {
106
128
  flex: 0 0 auto;
107
129
  inline-size: var(--ui-radio-size, 1.125rem);
package/vue/UiSwitch.d.ts CHANGED
@@ -5,9 +5,11 @@ type __VLS_Props = {
5
5
  required?: boolean;
6
6
  value?: string;
7
7
  };
8
- declare var __VLS_1: {};
8
+ declare var __VLS_1: {}, __VLS_3: {};
9
9
  type __VLS_Slots = {} & {
10
10
  default?: (props: typeof __VLS_1) => any;
11
+ } & {
12
+ description?: (props: typeof __VLS_3) => any;
11
13
  };
12
14
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
13
15
  change: (detail: {
package/vue/UiSwitch.vue CHANGED
@@ -36,6 +36,7 @@ const emit = defineEmits<{
36
36
 
37
37
  const root = ref<HTMLElement | null>(null)
38
38
  const inputElement = useTemplateRef<HTMLElement>('input')
39
+ const descriptionElement = useTemplateRef<HTMLElement>('description')
39
40
  const internalChecked = ref(false)
40
41
 
41
42
  /** The values the styles' :host-state() rules test. */
@@ -64,7 +65,7 @@ useComponentHost(controllerModule.default, {
64
65
  root,
65
66
  dispatch,
66
67
  props,
67
- refs: { input: inputElement },
68
+ refs: { input: inputElement, description: descriptionElement },
68
69
  state: { internalChecked },
69
70
  })
70
71
  </script>
@@ -85,7 +86,10 @@ useComponentHost(controllerModule.default, {
85
86
  :value="value"
86
87
  ref="input"
87
88
  >
88
- <span class="label"><slot /></span></label>
89
+ <span class="text"><span class="label"><slot /></span>
90
+ <span class="description" aria-hidden="true" ref="description"><slot
91
+ name="description"
92
+ /></span></span></label>
89
93
  </template>
90
94
 
91
95
  <style scoped>
@@ -98,11 +102,29 @@ useComponentHost(controllerModule.default, {
98
102
  cursor: pointer;
99
103
  }
100
104
 
105
+ /* The label, and under it an optional line saying what the choice means. */
106
+ .text {
107
+ display: flex;
108
+ flex-direction: column;
109
+ gap: var(--ui-space-1);
110
+ min-inline-size: 0;
111
+ }
112
+
101
113
  .label {
102
114
  min-inline-size: 0;
103
115
  line-height: var(--ui-line-height-md);
104
116
  }
105
117
 
118
+ .description {
119
+ color: var(--ui-text-secondary);
120
+ font-size: var(--ui-font-size-sm);
121
+ line-height: var(--ui-line-height);
122
+ }
123
+
124
+ .description:empty {
125
+ display: none;
126
+ }
127
+
106
128
  input {
107
129
  appearance: none;
108
130
  -webkit-appearance: none;
@@ -83,6 +83,6 @@ var UiButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
83
83
  ]);
84
84
  };
85
85
  }
86
- }), [["__scopeId", "data-v-97872575"]]);
86
+ }), [["__scopeId", "data-v-75541d8a"]]);
87
87
  //#endregion
88
88
  export { UiButton_default as t };
@@ -12,7 +12,13 @@ var _hoisted_2 = [
12
12
  "name",
13
13
  "value"
14
14
  ];
15
- var _hoisted_3 = { class: "label" };
15
+ var _hoisted_3 = { class: "text" };
16
+ var _hoisted_4 = { class: "label" };
17
+ var _hoisted_5 = {
18
+ class: "description",
19
+ "aria-hidden": "true",
20
+ ref: "description"
21
+ };
16
22
  //#endregion
17
23
  //#region .build/vue/UiCheckbox.vue
18
24
  var UiCheckbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -48,6 +54,7 @@ var UiCheckbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
48
54
  const emit = __emit;
49
55
  const root = ref(null);
50
56
  const inputElement = useTemplateRef("input");
57
+ const descriptionElement = useTemplateRef("description");
51
58
  const internalChecked = ref(false);
52
59
  /** The values the styles' :host-state() rules test. */
53
60
  const hostState = computed(() => [props.disabled && "disabled"].filter(Boolean).join(" "));
@@ -64,7 +71,10 @@ var UiCheckbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
64
71
  root,
65
72
  dispatch,
66
73
  props,
67
- refs: { input: inputElement },
74
+ refs: {
75
+ input: inputElement,
76
+ description: descriptionElement
77
+ },
68
78
  state: { internalChecked }
69
79
  });
70
80
  return (_ctx, _cache) => {
@@ -81,9 +91,9 @@ var UiCheckbox_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__P
81
91
  name: __props.name,
82
92
  value: __props.value,
83
93
  ref: "input"
84
- }, null, 40, _hoisted_2), createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])], 16, _hoisted_1);
94
+ }, null, 40, _hoisted_2), createElementVNode("span", _hoisted_3, [createElementVNode("span", _hoisted_4, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]), createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "description", {}, void 0, true)], 512)])], 16, _hoisted_1);
85
95
  };
86
96
  }
87
- }), [["__scopeId", "data-v-9c9d1eaa"]]);
97
+ }), [["__scopeId", "data-v-4d65c3b0"]]);
88
98
  //#endregion
89
99
  export { UiCheckbox_default as t };
@@ -59,6 +59,6 @@ var UiIconButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
59
59
  }), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1);
60
60
  };
61
61
  }
62
- }), [["__scopeId", "data-v-bcedd63e"]]);
62
+ }), [["__scopeId", "data-v-c322b7ed"]]);
63
63
  //#endregion
64
64
  export { UiIconButton_default as t };
@@ -11,7 +11,13 @@ var _hoisted_2 = [
11
11
  "value",
12
12
  "name"
13
13
  ];
14
- var _hoisted_3 = { class: "label" };
14
+ var _hoisted_3 = { class: "text" };
15
+ var _hoisted_4 = { class: "label" };
16
+ var _hoisted_5 = {
17
+ class: "description",
18
+ "aria-hidden": "true",
19
+ ref: "description"
20
+ };
15
21
  //#endregion
16
22
  //#region .build/vue/UiRadio.vue
17
23
  var UiRadio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -43,6 +49,7 @@ var UiRadio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
43
49
  const emit = __emit;
44
50
  const root = ref(null);
45
51
  const inputElement = useTemplateRef("input");
52
+ const descriptionElement = useTemplateRef("description");
46
53
  const internalChecked = ref(false);
47
54
  /** The values the styles' :host-state() rules test. */
48
55
  const hostState = computed(() => [props.disabled && "disabled"].filter(Boolean).join(" "));
@@ -59,7 +66,10 @@ var UiRadio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
59
66
  root,
60
67
  dispatch,
61
68
  props,
62
- refs: { input: inputElement },
69
+ refs: {
70
+ input: inputElement,
71
+ description: descriptionElement
72
+ },
63
73
  state: { internalChecked }
64
74
  });
65
75
  return (_ctx, _cache) => {
@@ -75,9 +85,9 @@ var UiRadio_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE
75
85
  value: __props.value,
76
86
  name: __props.name,
77
87
  ref: "input"
78
- }, null, 40, _hoisted_2), createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])], 16, _hoisted_1);
88
+ }, null, 40, _hoisted_2), createElementVNode("span", _hoisted_3, [createElementVNode("span", _hoisted_4, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]), createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "description", {}, void 0, true)], 512)])], 16, _hoisted_1);
79
89
  };
80
90
  }
81
- }), [["__scopeId", "data-v-e31949a7"]]);
91
+ }), [["__scopeId", "data-v-f9c61d50"]]);
82
92
  //#endregion
83
93
  export { UiRadio_default as t };
@@ -11,7 +11,13 @@ var _hoisted_2 = [
11
11
  "name",
12
12
  "value"
13
13
  ];
14
- var _hoisted_3 = { class: "label" };
14
+ var _hoisted_3 = { class: "text" };
15
+ var _hoisted_4 = { class: "label" };
16
+ var _hoisted_5 = {
17
+ class: "description",
18
+ "aria-hidden": "true",
19
+ ref: "description"
20
+ };
15
21
  //#endregion
16
22
  //#region .build/vue/UiSwitch.vue
17
23
  var UiSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
@@ -43,6 +49,7 @@ var UiSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
43
49
  const emit = __emit;
44
50
  const root = ref(null);
45
51
  const inputElement = useTemplateRef("input");
52
+ const descriptionElement = useTemplateRef("description");
46
53
  const internalChecked = ref(false);
47
54
  /** The values the styles' :host-state() rules test. */
48
55
  const hostState = computed(() => [props.disabled && "disabled"].filter(Boolean).join(" "));
@@ -59,7 +66,10 @@ var UiSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
59
66
  root,
60
67
  dispatch,
61
68
  props,
62
- refs: { input: inputElement },
69
+ refs: {
70
+ input: inputElement,
71
+ description: descriptionElement
72
+ },
63
73
  state: { internalChecked }
64
74
  });
65
75
  return (_ctx, _cache) => {
@@ -76,9 +86,9 @@ var UiSwitch_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PUR
76
86
  name: __props.name,
77
87
  value: __props.value,
78
88
  ref: "input"
79
- }, null, 40, _hoisted_2), createElementVNode("span", _hoisted_3, [renderSlot(_ctx.$slots, "default", {}, void 0, true)])], 16, _hoisted_1);
89
+ }, null, 40, _hoisted_2), createElementVNode("span", _hoisted_3, [createElementVNode("span", _hoisted_4, [renderSlot(_ctx.$slots, "default", {}, void 0, true)]), createElementVNode("span", _hoisted_5, [renderSlot(_ctx.$slots, "description", {}, void 0, true)], 512)])], 16, _hoisted_1);
80
90
  };
81
91
  }
82
- }), [["__scopeId", "data-v-26ab3add"]]);
92
+ }), [["__scopeId", "data-v-85cb3260"]]);
83
93
  //#endregion
84
94
  export { UiSwitch_default as t };