@septkit/ui 0.0.89 → 0.0.90

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.
@@ -38,14 +38,15 @@ var F = {
38
38
  limit: {},
39
39
  actionLabel: {},
40
40
  ariaLabel: {},
41
- ariaDescribedby: {}
41
+ ariaDescribedby: {},
42
+ inputId: {}
42
43
  }, {
43
44
  modelValue: { default: null },
44
45
  modelModifiers: {}
45
46
  }),
46
47
  emits: /*@__PURE__*/ w(["action"], ["update:modelValue"]),
47
48
  setup(C, { emit: w }) {
48
- let R = C, z = w, B = N(C, "modelValue"), V = { action: !0 }, H = O(""), U = O(), W = g(() => ({
49
+ let R = C, z = w, B = N(C, "modelValue"), V = { action: !0 }, H = O(""), U = O(), W = O("body"), G = g(() => ({
49
50
  "input-neutral": R.color === "neutral",
50
51
  "input-primary": R.color === "primary",
51
52
  "input-secondary": R.color === "secondary",
@@ -63,7 +64,7 @@ var F = {
63
64
  "input-md": R.size === "md",
64
65
  "input-lg": R.size === "lg",
65
66
  "input-xl": R.size === "xl"
66
- })), G = g(() => !!R.searchText), K = g(() => G.value ? m({
67
+ })), K = g(() => !!R.searchText), q = g(() => K.value ? m({
67
68
  options: R.options,
68
69
  search: H.value,
69
70
  searchText: R.searchText,
@@ -75,58 +76,63 @@ var F = {
75
76
  items: R.options
76
77
  }],
77
78
  more: 0
78
- }), q = g(() => G.value && K.value.groups.length === 0), J = g(() => K.value.groups.reduce((e, t) => e + t.items.length, 0) + K.value.more);
79
- function Y(e) {
79
+ }), J = g(() => K.value && q.value.groups.length === 0), Y = g(() => q.value.groups.reduce((e, t) => e + t.items.length, 0) + q.value.more);
80
+ function X(e) {
80
81
  return R.getKey ? R.getKey(e) : R.displayValue(e);
81
82
  }
82
- function X(e) {
83
+ function Z(e) {
83
84
  return e == null || e === V ? "" : R.displayValue(e);
84
85
  }
85
- function Z(e) {
86
+ function Q(e) {
86
87
  if (e === V) {
87
- z("action", H.value.trim(), J.value);
88
+ z("action", H.value.trim(), Y.value);
88
89
  return;
89
90
  }
90
91
  B.value = e;
91
92
  }
92
- function Q(e, t) {
93
- return e === V || t === V ? e === t : e != null && t != null && Y(e) === Y(t);
93
+ function $(e, t) {
94
+ return e === V || t === V ? e === t : e != null && t != null && X(e) === X(t);
94
95
  }
95
- async function $(e) {
96
- e && (H.value = "", await T(), await T(), (U.value?.$el)?.select());
96
+ async function ee(e) {
97
+ if (!e) return;
98
+ H.value = "";
99
+ let t = U.value?.$el;
100
+ W.value = t?.closest("dialog[open]") ?? "body", await T(), await T(), t?.select();
97
101
  }
98
- function ee(e) {
102
+ function te(e) {
99
103
  H.value = e.target.value;
100
104
  }
101
105
  return (m, g) => (D(), _(M(e), {
102
106
  "model-value": B.value,
103
107
  class: "dropdown w-full",
104
108
  disabled: C.disabled,
105
- "ignore-filter": G.value,
106
- by: C.getKey ? Q : void 0,
107
- "onUpdate:modelValue": Z,
108
- "onUpdate:open": $
109
+ "ignore-filter": K.value,
110
+ by: C.getKey ? $ : void 0,
111
+ "onUpdate:modelValue": Q,
112
+ "onUpdate:open": ee
109
113
  }, {
110
- default: P(() => [S(M(t), { class: E(["input w-full flex items-center gap-2", W.value]) }, {
114
+ default: P(() => [S(M(t), { class: E(["input w-full flex items-center gap-2", G.value]) }, {
111
115
  default: P(() => [S(M(a), {
112
116
  ref_key: "input",
113
117
  ref: U,
114
118
  class: "input-ghost outline-none w-full",
115
119
  placeholder: C.placeholder ?? "Search...",
116
- "display-value": X,
120
+ "display-value": Z,
117
121
  "aria-label": C.ariaLabel,
118
122
  "aria-describedby": C.ariaDescribedby,
119
- onInput: ee
123
+ id: C.inputId,
124
+ onInput: te
120
125
  }, null, 8, [
121
126
  "placeholder",
122
127
  "aria-label",
123
- "aria-describedby"
128
+ "aria-describedby",
129
+ "id"
124
130
  ]), S(M(u), { "aria-label": C.ariaLabel ? `Show the choices for: ${C.ariaLabel}` : "Show the choices" }, {
125
131
  default: P(() => [S(M(p), { class: "h-4 w-4 text-base-content/60 cursor-pointer" })]),
126
132
  _: 1
127
133
  }, 8, ["aria-label"])]),
128
134
  _: 1
129
- }, 8, ["class"]), S(M(l), null, {
135
+ }, 8, ["class"]), S(M(l), { to: W.value }, {
130
136
  default: P(() => [S(M(n), {
131
137
  position: "popper",
132
138
  "side-offset": 4,
@@ -138,15 +144,15 @@ var F = {
138
144
  }, {
139
145
  default: P(() => [S(M(d), { class: "max-h-64 overflow-y-auto p-1" }, {
140
146
  default: P(() => [
141
- G.value ? v("", !0) : (D(), _(M(r), {
147
+ K.value ? v("", !0) : (D(), _(M(r), {
142
148
  key: 0,
143
149
  class: "text-base-content/80 text-xs text-center py-2"
144
150
  }, {
145
151
  default: P(() => [x(j(C.emptyText ?? "No results found"), 1)]),
146
152
  _: 1
147
153
  })),
148
- q.value ? (D(), y("p", F, j(C.emptyText ?? `Nothing matches “${H.value}”`), 1)) : v("", !0),
149
- (D(!0), y(h, null, k(K.value.groups, (e) => (D(), _(M(i), { key: e.label }, {
154
+ J.value ? (D(), y("p", F, j(C.emptyText ?? `Nothing matches “${H.value}”`), 1)) : v("", !0),
155
+ (D(!0), y(h, null, k(q.value.groups, (e) => (D(), _(M(i), { key: e.label }, {
150
156
  default: P(() => [e.label ? (D(), _(M(c), {
151
157
  key: 0,
152
158
  "data-testid": "combobox-group-label",
@@ -155,7 +161,7 @@ var F = {
155
161
  default: P(() => [x(j(e.label), 1)]),
156
162
  _: 2
157
163
  }, 1024)) : v("", !0), (D(!0), y(h, null, k(e.items, (e) => (D(), _(M(o), {
158
- key: Y(e),
164
+ key: X(e),
159
165
  value: e,
160
166
  class: "cursor-pointer text-xs leading-none w-full flex items-center gap-2 rounded px-2 min-h-7 py-1 pl-7 relative select-none data-disabled:opacity-40 data-disabled:pointer-events-none data-highlighted:outline-none data-highlighted:bg-primary data-highlighted:text-primary-content"
161
167
  }, {
@@ -167,14 +173,14 @@ var F = {
167
173
  }, 1032, ["value"]))), 128))]),
168
174
  _: 2
169
175
  }, 1024))), 128)),
170
- K.value.more > 0 ? (D(), y("p", L, j(K.value.more) + " more: type to narrow ", 1)) : v("", !0),
176
+ q.value.more > 0 ? (D(), y("p", L, j(q.value.more) + " more: type to narrow ", 1)) : v("", !0),
171
177
  C.actionLabel ? (D(), _(M(o), {
172
178
  key: 3,
173
179
  "data-testid": "combobox-action",
174
180
  value: V,
175
181
  class: "cursor-pointer text-xs leading-none w-full flex items-center gap-2 rounded px-2 min-h-7 py-1 pl-7 relative select-none border-t border-base-300 font-medium data-highlighted:outline-none data-highlighted:bg-primary data-highlighted:text-primary-content"
176
182
  }, {
177
- default: P(() => [x(j(C.actionLabel(H.value.trim(), J.value)), 1)]),
183
+ default: P(() => [x(j(C.actionLabel(H.value.trim(), Y.value)), 1)]),
178
184
  _: 1
179
185
  })) : v("", !0)
180
186
  ]),
@@ -183,7 +189,7 @@ var F = {
183
189
  _: 3
184
190
  })]),
185
191
  _: 3
186
- })]),
192
+ }, 8, ["to"])]),
187
193
  _: 3
188
194
  }, 8, [
189
195
  "model-value",
package/dist/index.d.ts CHANGED
@@ -573,6 +573,8 @@ declare type __VLS_Props_3 = {
573
573
  /** The input's accessible name, and what describes it. */
574
574
  ariaLabel?: string;
575
575
  ariaDescribedby?: string;
576
+ /** The id of the input, for a `<label for>` to point at. */
577
+ inputId?: string;
576
578
  };
577
579
 
578
580
  declare type __VLS_Props_4 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@septkit/ui",
3
- "version": "0.0.89",
3
+ "version": "0.0.90",
4
4
  "type": "module",
5
5
  "source": "lib/index.ts",
6
6
  "files": [