@semplice-studio/pa-design-system 0.1.1 → 0.3.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 (119) hide show
  1. package/README.md +85 -128
  2. package/dist/components/PaAccordion/PaAccordion.vue.d.ts +0 -1
  3. package/dist/components/PaAccordion/PaAccordion.vue.js +3 -5
  4. package/dist/components/PaAccordion/PaAccordion.vue.js.map +1 -1
  5. package/dist/components/PaAccordion/PaAccordion.vue2.js +24 -30
  6. package/dist/components/PaAccordion/PaAccordion.vue2.js.map +1 -1
  7. package/dist/components/PaBanner/PaBanner.vue.js +6 -6
  8. package/dist/components/PaBanner/PaBanner.vue2.js +26 -28
  9. package/dist/components/PaBanner/PaBanner.vue2.js.map +1 -1
  10. package/dist/components/PaCard/PaCard.vue.d.ts +17 -14
  11. package/dist/components/PaCard/PaCard.vue.js +2 -2
  12. package/dist/components/PaCard/PaCard.vue2.js +37 -42
  13. package/dist/components/PaCard/PaCard.vue2.js.map +1 -1
  14. package/dist/components/PaCheckbox/PaCheckbox.vue.d.ts +5 -6
  15. package/dist/components/PaCheckbox/PaCheckbox.vue.js +2 -4
  16. package/dist/components/PaCheckbox/PaCheckbox.vue.js.map +1 -1
  17. package/dist/components/PaCheckbox/PaCheckbox.vue2.js +20 -26
  18. package/dist/components/PaCheckbox/PaCheckbox.vue2.js.map +1 -1
  19. package/dist/components/PaCheckboxGroup/PaCheckboxGroup.vue.d.ts +5 -6
  20. package/dist/components/PaCheckboxGroup/PaCheckboxGroup.vue.js +2 -4
  21. package/dist/components/PaCheckboxGroup/PaCheckboxGroup.vue.js.map +1 -1
  22. package/dist/components/PaCheckboxGroup/PaCheckboxGroup.vue2.js +25 -31
  23. package/dist/components/PaCheckboxGroup/PaCheckboxGroup.vue2.js.map +1 -1
  24. package/dist/components/PaDatePicker/PaDatePicker.vue.d.ts +13 -26
  25. package/dist/components/PaDatePicker/PaDatePicker.vue.js +4 -6
  26. package/dist/components/PaDatePicker/PaDatePicker.vue.js.map +1 -1
  27. package/dist/components/PaDatePicker/PaDatePicker.vue2.js +53 -59
  28. package/dist/components/PaDatePicker/PaDatePicker.vue2.js.map +1 -1
  29. package/dist/components/PaDrawer/PaDrawer.vue.js +2 -2
  30. package/dist/components/PaDrawer/PaDrawer.vue2.js +37 -41
  31. package/dist/components/PaDrawer/PaDrawer.vue2.js.map +1 -1
  32. package/dist/components/PaFileUpload/PaFileUpload.vue.d.ts +0 -1
  33. package/dist/components/PaFileUpload/PaFileUpload.vue.js +3 -5
  34. package/dist/components/PaFileUpload/PaFileUpload.vue.js.map +1 -1
  35. package/dist/components/PaFileUpload/PaFileUpload.vue2.js +22 -28
  36. package/dist/components/PaFileUpload/PaFileUpload.vue2.js.map +1 -1
  37. package/dist/components/PaFooter/PaFooter.vue.js +1 -1
  38. package/dist/components/PaFooter/PaFooter.vue2.js +43 -48
  39. package/dist/components/PaFooter/PaFooter.vue2.js.map +1 -1
  40. package/dist/components/PaHeaderDesktop/PaHeaderDesktop.vue.js +1 -1
  41. package/dist/components/PaHeaderDesktop/PaHeaderDesktop.vue2.js +61 -66
  42. package/dist/components/PaHeaderDesktop/PaHeaderDesktop.vue2.js.map +1 -1
  43. package/dist/components/PaHeaderMobile/PaHeaderMobile.vue.js +2 -2
  44. package/dist/components/PaHeaderMobile/PaHeaderMobile.vue2.js +69 -74
  45. package/dist/components/PaHeaderMobile/PaHeaderMobile.vue2.js.map +1 -1
  46. package/dist/components/PaHero/PaHero.vue.d.ts +15 -12
  47. package/dist/components/PaHero/PaHero.vue.js +2 -2
  48. package/dist/components/PaHero/PaHero.vue2.js +36 -41
  49. package/dist/components/PaHero/PaHero.vue2.js.map +1 -1
  50. package/dist/components/PaInput/PaInput.vue.d.ts +15 -13
  51. package/dist/components/PaInput/PaInput.vue.js +4 -6
  52. package/dist/components/PaInput/PaInput.vue.js.map +1 -1
  53. package/dist/components/PaInput/PaInput.vue2.js +27 -33
  54. package/dist/components/PaInput/PaInput.vue2.js.map +1 -1
  55. package/dist/components/PaModal/PaModal.vue.d.ts +14 -11
  56. package/dist/components/PaModal/PaModal.vue.js +3 -3
  57. package/dist/components/PaModal/PaModal.vue2.js +41 -46
  58. package/dist/components/PaModal/PaModal.vue2.js.map +1 -1
  59. package/dist/components/PaMonthPicker/PaMonthPicker.vue.d.ts +13 -26
  60. package/dist/components/PaMonthPicker/PaMonthPicker.vue.js +2 -4
  61. package/dist/components/PaMonthPicker/PaMonthPicker.vue.js.map +1 -1
  62. package/dist/components/PaMonthPicker/PaMonthPicker.vue2.js +64 -70
  63. package/dist/components/PaMonthPicker/PaMonthPicker.vue2.js.map +1 -1
  64. package/dist/components/PaPagination/PaPagination.vue.js +2 -2
  65. package/dist/components/PaPagination/PaPagination.vue2.js +41 -46
  66. package/dist/components/PaPagination/PaPagination.vue2.js.map +1 -1
  67. package/dist/components/PaRadioGroup/PaRadioGroup.vue.d.ts +5 -6
  68. package/dist/components/PaRadioGroup/PaRadioGroup.vue.js +2 -4
  69. package/dist/components/PaRadioGroup/PaRadioGroup.vue.js.map +1 -1
  70. package/dist/components/PaRadioGroup/PaRadioGroup.vue2.js +22 -28
  71. package/dist/components/PaRadioGroup/PaRadioGroup.vue2.js.map +1 -1
  72. package/dist/components/PaRangePicker/PaRangePicker.vue.d.ts +0 -1
  73. package/dist/components/PaRangePicker/PaRangePicker.vue.js +4 -6
  74. package/dist/components/PaRangePicker/PaRangePicker.vue.js.map +1 -1
  75. package/dist/components/PaRangePicker/PaRangePicker.vue2.js +76 -82
  76. package/dist/components/PaRangePicker/PaRangePicker.vue2.js.map +1 -1
  77. package/dist/components/PaSearchBar/PaSearchBar.vue.d.ts +0 -1
  78. package/dist/components/PaSearchBar/PaSearchBar.vue.js +3 -5
  79. package/dist/components/PaSearchBar/PaSearchBar.vue.js.map +1 -1
  80. package/dist/components/PaSearchBar/PaSearchBar.vue2.js +55 -61
  81. package/dist/components/PaSearchBar/PaSearchBar.vue2.js.map +1 -1
  82. package/dist/components/PaSelect/PaSelect.vue.d.ts +5 -6
  83. package/dist/components/PaSelect/PaSelect.vue.js +4 -6
  84. package/dist/components/PaSelect/PaSelect.vue.js.map +1 -1
  85. package/dist/components/PaSelect/PaSelect.vue2.js +25 -31
  86. package/dist/components/PaSelect/PaSelect.vue2.js.map +1 -1
  87. package/dist/components/PaTabs/PaTabs.vue.js +1 -1
  88. package/dist/components/PaTabs/PaTabs.vue2.js +17 -19
  89. package/dist/components/PaTabs/PaTabs.vue2.js.map +1 -1
  90. package/dist/components/PaTextarea/PaTextarea.vue.d.ts +5 -6
  91. package/dist/components/PaTextarea/PaTextarea.vue.js +4 -6
  92. package/dist/components/PaTextarea/PaTextarea.vue.js.map +1 -1
  93. package/dist/components/PaTextarea/PaTextarea.vue2.js +16 -22
  94. package/dist/components/PaTextarea/PaTextarea.vue2.js.map +1 -1
  95. package/dist/components/PaTimePicker/PaTimePicker.vue.d.ts +0 -1
  96. package/dist/components/PaTimePicker/PaTimePicker.vue.js +2 -4
  97. package/dist/components/PaTimePicker/PaTimePicker.vue.js.map +1 -1
  98. package/dist/components/PaTimePicker/PaTimePicker.vue2.js +44 -50
  99. package/dist/components/PaTimePicker/PaTimePicker.vue2.js.map +1 -1
  100. package/dist/components/PaTitleBar/PaTitleBar.vue.d.ts +12 -9
  101. package/dist/components/PaTitleBar/PaTitleBar.vue.js +2 -2
  102. package/dist/components/PaTitleBar/PaTitleBar.vue2.js +34 -39
  103. package/dist/components/PaTitleBar/PaTitleBar.vue2.js.map +1 -1
  104. package/dist/components/PaToggle/PaToggle.vue.d.ts +0 -1
  105. package/dist/components/PaToggle/PaToggle.vue.js +2 -4
  106. package/dist/components/PaToggle/PaToggle.vue.js.map +1 -1
  107. package/dist/components/PaToggle/PaToggle.vue2.js +20 -26
  108. package/dist/components/PaToggle/PaToggle.vue2.js.map +1 -1
  109. package/dist/components/PaYearPicker/PaYearPicker.vue.d.ts +13 -26
  110. package/dist/components/PaYearPicker/PaYearPicker.vue.js +4 -6
  111. package/dist/components/PaYearPicker/PaYearPicker.vue.js.map +1 -1
  112. package/dist/components/PaYearPicker/PaYearPicker.vue2.js +70 -76
  113. package/dist/components/PaYearPicker/PaYearPicker.vue2.js.map +1 -1
  114. package/dist/style.css +1 -1
  115. package/docs/design-system.md +590 -0
  116. package/docs/layouts.md +297 -0
  117. package/docs/page-composition-examples.md +286 -0
  118. package/docs/public-surface.md +68 -0
  119. package/package.json +8 -4
@@ -1,16 +1,11 @@
1
- import { defineComponent as Z, useModel as ee, computed as h, ref as x, watch as w, nextTick as E, onBeforeUnmount as ae, openBlock as c, createElementBlock as d, normalizeClass as F, toDisplayString as g, createCommentVNode as m, createElementVNode as f, withDirectives as le, vModelText as te, createVNode as P, Fragment as ne, renderList as oe, createBlock as se, mergeModels as H } from "vue";
1
+ import { defineComponent as Z, useModel as ee, useId as ae, computed as h, ref as w, watch as x, nextTick as E, onBeforeUnmount as le, openBlock as c, createElementBlock as d, normalizeClass as U, toDisplayString as g, createCommentVNode as m, createElementVNode as f, withDirectives as te, vModelText as ne, createVNode as H, Fragment as oe, renderList as se, createBlock as ie, mergeModels as K } from "vue";
2
2
  import I from "../PaIcon/PaIcon.vue.js";
3
- const re = ["for"], ie = { class: "pa-search-bar__wrapper" }, ce = { class: "pa-search-bar__input-cell" }, ue = ["id", "aria-expanded", "aria-activedescendant", "placeholder", "disabled"], de = ["aria-label"], fe = ["disabled"], be = { class: "pa-search-bar__button-label" }, pe = ["id", "aria-selected", "aria-disabled", "onClick"], ve = { class: "pa-search-bar__option-label" }, he = {
3
+ const re = ["for"], ce = { class: "pa-search-bar__wrapper" }, ue = { class: "pa-search-bar__input-cell" }, de = ["id", "aria-expanded", "aria-activedescendant", "placeholder", "disabled"], fe = ["aria-label"], be = ["disabled"], pe = { class: "pa-search-bar__button-label" }, ve = ["id", "aria-selected", "aria-disabled", "onClick"], he = { class: "pa-search-bar__option-label" }, me = {
4
4
  key: 2,
5
5
  class: "pa-search-bar__helper"
6
- };
7
- let me = 0;
8
- function _e() {
9
- return `pa-search-bar-${++me}`;
10
- }
11
- const xe = /* @__PURE__ */ Z({
6
+ }, ye = /* @__PURE__ */ Z({
12
7
  __name: "PaSearchBar",
13
- props: /* @__PURE__ */ H({
8
+ props: /* @__PURE__ */ K({
14
9
  label: {},
15
10
  placeholder: {},
16
11
  helperText: {},
@@ -24,34 +19,34 @@ const xe = /* @__PURE__ */ Z({
24
19
  value: { default: "" },
25
20
  valueModifiers: {}
26
21
  }),
27
- emits: /* @__PURE__ */ H(["search", "clear", "select"], ["update:value"]),
28
- setup(o, { emit: K }) {
29
- const t = o, _ = K, i = ee(o, "value"), D = _e(), $ = h(() => t.id ?? `${D}__input`), L = `${D}__listbox`, V = h(
22
+ emits: /* @__PURE__ */ K(["search", "clear", "select"], ["update:value"]),
23
+ setup(o, { emit: P }) {
24
+ const t = o, _ = P, r = ee(o, "value"), D = `pa-search-bar-${ae()}`, $ = h(() => t.id ?? `${D}__input`), L = `${D}__listbox`, V = h(
30
25
  () => (t.options ?? []).map((e, a) => `${D}__option-${a}`)
31
- ), k = x(null), T = x([]), s = x(!1), n = x(-1), B = h(
26
+ ), k = w(null), T = w([]), s = w(!1), n = w(-1), C = h(
32
27
  () => Array.isArray(t.options) && t.options.length > 0
33
- ), j = h(() => i.value.length > 0 && !t.disabled), q = h(
28
+ ), j = h(() => r.value.length > 0 && !t.disabled), q = h(
34
29
  () => s.value && n.value >= 0 ? V.value[n.value] : void 0
35
30
  );
36
31
  let b = null, p = null;
37
- function C() {
32
+ function M() {
38
33
  b && (clearTimeout(b), b = null);
39
34
  }
40
35
  function y() {
41
36
  p && (clearTimeout(p), p = null);
42
37
  }
43
- function M() {
44
- t.disabled || !B.value || (s.value = !0);
38
+ function B() {
39
+ t.disabled || !C.value || (s.value = !0);
45
40
  }
46
41
  function v() {
47
42
  s.value = !1, n.value = -1;
48
43
  }
49
44
  function O() {
50
45
  var e;
51
- t.disabled || (C(), _("search", i.value), (e = k.value) == null || e.blur());
46
+ t.disabled || (M(), _("search", r.value), (e = k.value) == null || e.blur());
52
47
  }
53
48
  function G() {
54
- y(), M();
49
+ y(), B();
55
50
  }
56
51
  function J() {
57
52
  y(), p = setTimeout(() => {
@@ -59,7 +54,7 @@ const xe = /* @__PURE__ */ Z({
59
54
  }, 150);
60
55
  }
61
56
  function Q() {
62
- t.disabled || (i.value = "", _("clear"), E(() => {
57
+ t.disabled || (r.value = "", _("clear"), E(() => {
63
58
  var e;
64
59
  return (e = k.value) == null ? void 0 : e.focus();
65
60
  }));
@@ -68,19 +63,19 @@ const xe = /* @__PURE__ */ Z({
68
63
  e.preventDefault(), y();
69
64
  }
70
65
  function R(e) {
71
- t.disabled || e.disabled || (i.value = e.value, _("select", e), v(), E(() => {
66
+ t.disabled || e.disabled || (r.value = e.value, _("select", e), v(), E(() => {
72
67
  var a;
73
68
  return (a = k.value) == null ? void 0 : a.focus();
74
69
  }));
75
70
  }
76
71
  function z(e, a) {
77
- const l = t.options ?? [], r = l.length;
78
- if (r === 0) return -1;
72
+ const l = t.options ?? [], i = l.length;
73
+ if (i === 0) return -1;
79
74
  let u = e;
80
- for (let S = 0; S < r; S++) {
81
- u = (u + a + r) % r;
82
- const U = l[u];
83
- if (U && !U.disabled) return u;
75
+ for (let F = 0; F < i; F++) {
76
+ u = (u + a + i) % i;
77
+ const S = l[u];
78
+ if (S && !S.disabled) return u;
84
79
  }
85
80
  return -1;
86
81
  }
@@ -104,12 +99,12 @@ const xe = /* @__PURE__ */ Z({
104
99
  if (!t.disabled)
105
100
  switch (e.key) {
106
101
  case "ArrowDown": {
107
- e.preventDefault(), s.value ? n.value = z(n.value, 1) : B.value && (M(), n.value = A());
102
+ e.preventDefault(), s.value ? n.value = z(n.value, 1) : C.value && (B(), n.value = A());
108
103
  break;
109
104
  }
110
105
  case "ArrowUp": {
111
106
  if (e.preventDefault(), !s.value)
112
- B.value && (M(), n.value = N());
107
+ C.value && (B(), n.value = N());
113
108
  else {
114
109
  const a = n.value < 0 ? 0 : n.value;
115
110
  n.value = z(a, -1);
@@ -143,12 +138,12 @@ const xe = /* @__PURE__ */ Z({
143
138
  function Y(e, a) {
144
139
  e && (T.value[a] = e);
145
140
  }
146
- return w(n, async (e) => {
141
+ return x(n, async (e) => {
147
142
  if (e < 0) return;
148
143
  await E();
149
144
  const a = T.value[e];
150
145
  a && typeof a.scrollIntoView == "function" && a.scrollIntoView({ block: "nearest" });
151
- }), w(
146
+ }), x(
152
147
  () => {
153
148
  var e;
154
149
  return ((e = t.options) == null ? void 0 : e.length) ?? 0;
@@ -156,19 +151,19 @@ const xe = /* @__PURE__ */ Z({
156
151
  (e) => {
157
152
  T.value.length = e, e === 0 ? v() : n.value >= e && (n.value = -1);
158
153
  }
159
- ), w(
154
+ ), x(
160
155
  () => t.disabled,
161
156
  (e) => {
162
157
  e && v();
163
158
  }
164
- ), w(i, () => {
165
- t.disabled || (C(), t.debounceMs > 0 && (b = setTimeout(() => {
166
- _("search", i.value), b = null;
159
+ ), x(r, () => {
160
+ t.disabled || (M(), t.debounceMs > 0 && (b = setTimeout(() => {
161
+ _("search", r.value), b = null;
167
162
  }, t.debounceMs)));
168
- }), ae(() => {
169
- C(), y();
163
+ }), le(() => {
164
+ M(), y();
170
165
  }), (e, a) => (c(), d("div", {
171
- class: F([
166
+ class: U([
172
167
  "pa-search-bar",
173
168
  {
174
169
  "pa-search-bar--disabled": o.disabled,
@@ -181,13 +176,13 @@ const xe = /* @__PURE__ */ Z({
181
176
  for: $.value,
182
177
  class: "pa-search-bar__label"
183
178
  }, g(o.label), 9, re)) : m("", !0),
184
- f("div", ie, [
185
- f("div", ce, [
186
- le(f("input", {
179
+ f("div", ce, [
180
+ f("div", ue, [
181
+ te(f("input", {
187
182
  id: $.value,
188
183
  ref_key: "inputRef",
189
184
  ref: k,
190
- "onUpdate:modelValue": a[0] || (a[0] = (l) => i.value = l),
185
+ "onUpdate:modelValue": a[0] || (a[0] = (l) => r.value = l),
191
186
  type: "search",
192
187
  autocomplete: "off",
193
188
  class: "pa-search-bar__input",
@@ -201,8 +196,8 @@ const xe = /* @__PURE__ */ Z({
201
196
  onKeydown: X,
202
197
  onFocus: G,
203
198
  onBlur: J
204
- }, null, 40, ue), [
205
- [te, i.value]
199
+ }, null, 40, de), [
200
+ [ne, r.value]
206
201
  ]),
207
202
  j.value ? (c(), d("button", {
208
203
  key: 0,
@@ -211,11 +206,11 @@ const xe = /* @__PURE__ */ Z({
211
206
  "aria-label": o.clearLabel,
212
207
  onClick: Q
213
208
  }, [
214
- P(I, {
209
+ H(I, {
215
210
  name: "x",
216
211
  size: "sm"
217
212
  })
218
- ], 8, de)) : m("", !0)
213
+ ], 8, fe)) : m("", !0)
219
214
  ]),
220
215
  f("button", {
221
216
  type: "button",
@@ -223,12 +218,12 @@ const xe = /* @__PURE__ */ Z({
223
218
  disabled: o.disabled,
224
219
  onClick: O
225
220
  }, [
226
- f("span", be, g(o.searchLabel), 1),
227
- P(I, {
221
+ f("span", pe, g(o.searchLabel), 1),
222
+ H(I, {
228
223
  name: "magnifying-glass",
229
224
  size: "sm"
230
225
  })
231
- ], 8, fe)
226
+ ], 8, be)
232
227
  ]),
233
228
  s.value ? (c(), d("ul", {
234
229
  key: 1,
@@ -236,36 +231,35 @@ const xe = /* @__PURE__ */ Z({
236
231
  role: "listbox",
237
232
  class: "pa-search-bar__listbox"
238
233
  }, [
239
- (c(!0), d(ne, null, oe(o.options, (l, r) => (c(), d("li", {
240
- key: `option-${r}`,
234
+ (c(!0), d(oe, null, se(o.options, (l, i) => (c(), d("li", {
235
+ key: `option-${i}`,
241
236
  ref_for: !0,
242
- ref: (u) => Y(u, r),
243
- id: V.value[r],
237
+ ref: (u) => Y(u, i),
238
+ id: V.value[i],
244
239
  role: "option",
245
- "aria-selected": r === n.value ? "true" : "false",
240
+ "aria-selected": i === n.value ? "true" : "false",
246
241
  "aria-disabled": l.disabled ? "true" : void 0,
247
- class: F([
242
+ class: U([
248
243
  "pa-search-bar__option",
249
244
  { "pa-search-bar__option--disabled": l.disabled }
250
245
  ]),
251
246
  onMousedown: W,
252
247
  onClick: (u) => R(l)
253
248
  }, [
254
- f("span", ve, g(l.value), 1),
255
- r === n.value && !l.disabled ? (c(), se(I, {
249
+ f("span", he, g(l.value), 1),
250
+ i === n.value && !l.disabled ? (c(), ie(I, {
256
251
  key: 0,
257
252
  name: "check",
258
253
  size: "sm",
259
254
  class: "pa-search-bar__option-check"
260
255
  })) : m("", !0)
261
- ], 42, pe))), 128))
256
+ ], 42, ve))), 128))
262
257
  ])) : m("", !0),
263
- o.helperText ? (c(), d("p", he, g(o.helperText), 1)) : m("", !0)
258
+ o.helperText ? (c(), d("p", me, g(o.helperText), 1)) : m("", !0)
264
259
  ], 2));
265
260
  }
266
261
  });
267
262
  export {
268
- xe as default,
269
- _e as nextPaSearchBarId
263
+ ye as default
270
264
  };
271
265
  //# sourceMappingURL=PaSearchBar.vue2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaSearchBar.vue2.js","sources":["../../../src/components/PaSearchBar/PaSearchBar.vue"],"sourcesContent":["<script lang=\"ts\">\nlet searchBarUid = 0\nexport function nextPaSearchBarId() {\n return `pa-search-bar-${++searchBarUid}`\n}\n\nexport interface PaSearchBarOption {\n value: string\n disabled?: boolean\n}\n\nexport interface PaSearchBarProps {\n label?: string\n placeholder?: string\n helperText?: string\n disabled?: boolean\n id?: string\n searchLabel?: string\n clearLabel?: string\n debounceMs?: number\n options?: PaSearchBarOption[]\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue'\nimport PaIcon from '../PaIcon/PaIcon.vue'\n\nconst props = withDefaults(defineProps<PaSearchBarProps>(), {\n disabled: false,\n searchLabel: 'Ricerca',\n clearLabel: 'Cancella ricerca',\n debounceMs: 0,\n})\n\nconst emit = defineEmits<{\n search: [value: string]\n clear: []\n select: [option: PaSearchBarOption]\n}>()\n\nconst model = defineModel<string>('value', { default: '' })\n\nconst baseId = nextPaSearchBarId()\nconst inputId = computed(() => props.id ?? `${baseId}__input`)\nconst listboxId = `${baseId}__listbox`\nconst optionIds = computed(() =>\n (props.options ?? []).map((_, i) => `${baseId}__option-${i}`),\n)\n\nconst inputRef = ref<HTMLInputElement | null>(null)\nconst optionRefs = ref<HTMLLIElement[]>([])\nconst dropdownOpen = ref(false)\nconst activeIndex = ref(-1)\n\nconst hasOptions = computed(\n () => Array.isArray(props.options) && props.options.length > 0,\n)\n\nconst showClear = computed(() => model.value.length > 0 && !props.disabled)\n\nconst activeDescendant = computed(() =>\n dropdownOpen.value && activeIndex.value >= 0\n ? optionIds.value[activeIndex.value]\n : undefined,\n)\n\nlet debounceTimer: ReturnType<typeof setTimeout> | null = null\nlet blurTimer: ReturnType<typeof setTimeout> | null = null\n\nfunction clearDebounce() {\n if (debounceTimer) {\n clearTimeout(debounceTimer)\n debounceTimer = null\n }\n}\n\nfunction clearBlurTimer() {\n if (blurTimer) {\n clearTimeout(blurTimer)\n blurTimer = null\n }\n}\n\nfunction openDropdown() {\n if (props.disabled || !hasOptions.value) return\n dropdownOpen.value = true\n}\n\nfunction closeDropdown() {\n dropdownOpen.value = false\n activeIndex.value = -1\n}\n\nfunction triggerSearch() {\n if (props.disabled) return\n clearDebounce()\n emit('search', model.value)\n inputRef.value?.blur()\n}\n\nfunction onFocus() {\n clearBlurTimer()\n openDropdown()\n}\n\nfunction onBlur() {\n clearBlurTimer()\n blurTimer = setTimeout(() => {\n closeDropdown()\n blurTimer = null\n }, 150)\n}\n\nfunction onClear() {\n if (props.disabled) return\n model.value = ''\n emit('clear')\n nextTick(() => inputRef.value?.focus())\n}\n\nfunction onOptionMousedown(event: MouseEvent) {\n event.preventDefault()\n clearBlurTimer()\n}\n\nfunction selectOption(option: PaSearchBarOption) {\n if (props.disabled || option.disabled) return\n model.value = option.value\n emit('select', option)\n closeDropdown()\n nextTick(() => inputRef.value?.focus())\n}\n\nfunction findNextEnabled(from: number, dir: 1 | -1): number {\n const opts = props.options ?? []\n const n = opts.length\n if (n === 0) return -1\n let i = from\n for (let step = 0; step < n; step++) {\n i = (i + dir + n) % n\n const opt = opts[i]\n if (opt && !opt.disabled) return i\n }\n return -1\n}\n\nfunction findFirstEnabled(): number {\n const opts = props.options ?? []\n for (let i = 0; i < opts.length; i++) {\n const opt = opts[i]\n if (opt && !opt.disabled) return i\n }\n return -1\n}\n\nfunction findLastEnabled(): number {\n const opts = props.options ?? []\n for (let i = opts.length - 1; i >= 0; i--) {\n const opt = opts[i]\n if (opt && !opt.disabled) return i\n }\n return -1\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (props.disabled) return\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault()\n if (!dropdownOpen.value) {\n if (hasOptions.value) {\n openDropdown()\n activeIndex.value = findFirstEnabled()\n }\n } else {\n activeIndex.value = findNextEnabled(activeIndex.value, 1)\n }\n break\n }\n case 'ArrowUp': {\n event.preventDefault()\n if (!dropdownOpen.value) {\n if (hasOptions.value) {\n openDropdown()\n activeIndex.value = findLastEnabled()\n }\n } else {\n const from = activeIndex.value < 0 ? 0 : activeIndex.value\n activeIndex.value = findNextEnabled(from, -1)\n }\n break\n }\n case 'Home': {\n if (dropdownOpen.value) {\n event.preventDefault()\n activeIndex.value = findFirstEnabled()\n }\n break\n }\n case 'End': {\n if (dropdownOpen.value) {\n event.preventDefault()\n activeIndex.value = findLastEnabled()\n }\n break\n }\n case 'Enter': {\n event.preventDefault()\n const opts = props.options ?? []\n const opt = activeIndex.value >= 0 ? opts[activeIndex.value] : undefined\n if (dropdownOpen.value && opt && !opt.disabled) {\n selectOption(opt)\n return\n }\n triggerSearch()\n break\n }\n case 'Escape': {\n if (dropdownOpen.value) {\n event.preventDefault()\n closeDropdown()\n }\n break\n }\n }\n}\n\nfunction setOptionRef(el: Element | null, i: number) {\n if (el) optionRefs.value[i] = el as HTMLLIElement\n}\n\nwatch(activeIndex, async (i) => {\n if (i < 0) return\n await nextTick()\n const el = optionRefs.value[i]\n if (el && typeof el.scrollIntoView === 'function') {\n el.scrollIntoView({ block: 'nearest' })\n }\n})\n\nwatch(\n () => props.options?.length ?? 0,\n (n) => {\n optionRefs.value.length = n\n if (n === 0) closeDropdown()\n else if (activeIndex.value >= n) activeIndex.value = -1\n },\n)\n\nwatch(\n () => props.disabled,\n (d) => {\n if (d) closeDropdown()\n },\n)\n\nwatch(model, () => {\n if (props.disabled) return\n clearDebounce()\n if (props.debounceMs > 0) {\n debounceTimer = setTimeout(() => {\n emit('search', model.value)\n debounceTimer = null\n }, props.debounceMs)\n }\n})\n\nonBeforeUnmount(() => {\n clearDebounce()\n clearBlurTimer()\n})\n</script>\n\n<template>\n <div\n :class=\"[\n 'pa-search-bar',\n {\n 'pa-search-bar--disabled': disabled,\n 'pa-search-bar--open': dropdownOpen,\n },\n ]\"\n >\n <label v-if=\"label\" :for=\"inputId\" class=\"pa-search-bar__label\">\n {{ label }}\n </label>\n <div class=\"pa-search-bar__wrapper\">\n <div class=\"pa-search-bar__input-cell\">\n <input\n :id=\"inputId\"\n ref=\"inputRef\"\n v-model=\"model\"\n type=\"search\"\n autocomplete=\"off\"\n class=\"pa-search-bar__input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-expanded=\"dropdownOpen\"\n :aria-activedescendant=\"activeDescendant\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n class=\"pa-search-bar__clear\"\n :aria-label=\"clearLabel\"\n @click=\"onClear\"\n >\n <PaIcon name=\"x\" size=\"sm\" />\n </button>\n </div>\n <button\n type=\"button\"\n class=\"pa-search-bar__button\"\n :disabled=\"disabled\"\n @click=\"triggerSearch\"\n >\n <span class=\"pa-search-bar__button-label\">{{ searchLabel }}</span>\n <PaIcon name=\"magnifying-glass\" size=\"sm\" />\n </button>\n </div>\n <ul\n v-if=\"dropdownOpen\"\n :id=\"listboxId\"\n role=\"listbox\"\n class=\"pa-search-bar__listbox\"\n >\n <li\n v-for=\"(opt, i) in options\"\n :key=\"`option-${i}`\"\n :ref=\"(el) => setOptionRef(el as Element | null, i)\"\n :id=\"optionIds[i]\"\n role=\"option\"\n :aria-selected=\"i === activeIndex ? 'true' : 'false'\"\n :aria-disabled=\"opt.disabled ? 'true' : undefined\"\n :class=\"[\n 'pa-search-bar__option',\n { 'pa-search-bar__option--disabled': opt.disabled },\n ]\"\n @mousedown=\"onOptionMousedown\"\n @click=\"selectOption(opt)\"\n >\n <span class=\"pa-search-bar__option-label\">{{ opt.value }}</span>\n <PaIcon\n v-if=\"i === activeIndex && !opt.disabled\"\n name=\"check\"\n size=\"sm\"\n class=\"pa-search-bar__option-check\"\n />\n </li>\n </ul>\n <p v-if=\"helperText\" class=\"pa-search-bar__helper\">{{ helperText }}</p>\n </div>\n</template>\n\n<style scoped>\n.pa-search-bar {\n display: flex;\n flex-direction: column;\n font-family: var(--pa-font-family-base);\n container-type: inline-size;\n}\n\n.pa-search-bar__label {\n font-size: var(--pa-font-label-sm-size);\n line-height: var(--pa-font-label-sm-line-height);\n font-weight: var(--pa-font-label-sm-weight);\n color: var(--pa-color-text-secondary-gray);\n padding-bottom: var(--pa-space-xs);\n}\n\n.pa-search-bar__wrapper {\n display: flex;\n align-items: stretch;\n box-sizing: border-box;\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n border-radius: 9px;\n overflow: hidden;\n transition: border-color 120ms ease, box-shadow 120ms ease,\n border-radius 120ms ease;\n}\n\n.pa-search-bar__wrapper:hover {\n border-color: var(--pa-color-neutral-gray);\n}\n\n.pa-search-bar__wrapper:focus-within {\n border-color: var(--pa-color-primary);\n box-shadow: 0 0 0 2px var(--pa-color-primary-focus-border);\n}\n\n.pa-search-bar--open .pa-search-bar__wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.pa-search-bar__input-cell {\n flex: 1 1 auto;\n min-width: 0;\n display: flex;\n align-items: center;\n gap: var(--pa-space-xs);\n padding-right: var(--pa-space-sm);\n}\n\n.pa-search-bar__input {\n flex: 1 1 auto;\n min-width: 0;\n margin: 0;\n padding: 12px var(--pa-space-sm);\n background: transparent;\n border: none;\n outline: none;\n color: var(--pa-color-text-secondary-gray);\n font-family: inherit;\n font-size: var(--pa-font-body-size);\n line-height: var(--pa-font-body-line-height);\n font-weight: var(--pa-font-body-weight);\n}\n\n.pa-search-bar__input::placeholder {\n color: var(--pa-color-text-disabled-gray);\n}\n\n.pa-search-bar__input::-webkit-search-decoration,\n.pa-search-bar__input::-webkit-search-cancel-button,\n.pa-search-bar__input::-webkit-search-results-button,\n.pa-search-bar__input::-webkit-search-results-decoration {\n appearance: none;\n -webkit-appearance: none;\n}\n\n.pa-search-bar__clear {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 24px;\n height: 24px;\n margin: 0;\n padding: 0;\n background: transparent;\n border: none;\n border-radius: var(--pa-radius-smooth);\n color: var(--pa-color-text-secondary-gray);\n cursor: pointer;\n}\n\n.pa-search-bar__clear:hover {\n color: var(--pa-color-neutral-charcoal);\n}\n\n.pa-search-bar__clear:focus-visible {\n outline: 2px solid var(--pa-color-primary-focus-border);\n outline-offset: 1px;\n}\n\n.pa-search-bar__button {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--pa-space-xs);\n margin: 0;\n padding: 12px var(--pa-space-2xl);\n background: var(--pa-color-primary);\n border: none;\n border-radius: 0;\n color: var(--pa-color-text-white);\n font-family: inherit;\n font-size: var(--pa-font-label-sm-size);\n line-height: var(--pa-font-label-sm-line-height);\n font-weight: var(--pa-font-label-sm-weight);\n cursor: pointer;\n transition: background-color 120ms ease;\n}\n\n.pa-search-bar__button:hover {\n background: var(--pa-color-primary-hover);\n}\n\n.pa-search-bar__button:active {\n background: var(--pa-color-primary-pressed);\n}\n\n.pa-search-bar__button:focus-visible {\n outline: 2px solid var(--pa-color-text-white);\n outline-offset: -4px;\n}\n\n.pa-search-bar__listbox {\n list-style: none;\n margin: 0;\n padding: 0;\n background: var(--pa-color-bg-white);\n max-height: 320px;\n overflow-y: auto;\n}\n\n.pa-search-bar__option {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--pa-space-xs);\n padding: var(--pa-space-sm);\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n margin-bottom: -1px;\n color: var(--pa-color-text-secondary-gray);\n font-size: var(--pa-font-body-size);\n line-height: var(--pa-font-body-line-height);\n font-weight: var(--pa-font-body-weight);\n cursor: pointer;\n user-select: none;\n transition: background-color 80ms ease, color 80ms ease,\n border-color 80ms ease;\n}\n\n.pa-search-bar__option:last-child {\n margin-bottom: 0;\n border-bottom-left-radius: var(--pa-radius-smooth);\n border-bottom-right-radius: var(--pa-radius-smooth);\n}\n\n.pa-search-bar__option:hover {\n background: var(--pa-color-primary-hover);\n color: var(--pa-color-text-white);\n}\n\n.pa-search-bar__option:active {\n background: var(--pa-color-primary-pressed);\n color: var(--pa-color-text-white);\n}\n\n.pa-search-bar__option:focus-visible {\n outline: none;\n border-color: var(--pa-color-primary);\n}\n\n.pa-search-bar__option[aria-selected='true'] {\n background: var(--pa-color-primary);\n color: var(--pa-color-text-white);\n}\n\n.pa-search-bar__option--disabled,\n.pa-search-bar__option--disabled:hover,\n.pa-search-bar__option--disabled:active {\n background: var(--pa-color-bg-disabled-gray);\n color: var(--pa-color-text-disabled-gray);\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.pa-search-bar__option-check {\n flex: 0 0 auto;\n}\n\n.pa-search-bar__helper {\n margin: 0;\n padding-top: var(--pa-space-xs);\n font-size: var(--pa-font-label-helper-size);\n line-height: var(--pa-font-label-helper-line-height);\n font-weight: var(--pa-font-label-helper-weight);\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-search-bar--disabled .pa-search-bar__wrapper,\n.pa-search-bar--disabled .pa-search-bar__wrapper:hover {\n background: var(--pa-color-bg-secondary-light-40);\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n\n.pa-search-bar--disabled .pa-search-bar__input {\n color: var(--pa-color-text-disabled-gray);\n cursor: not-allowed;\n}\n\n.pa-search-bar--disabled .pa-search-bar__button {\n background: var(--pa-color-bg-secondary-light-40);\n color: var(--pa-color-text-disabled-gray);\n cursor: not-allowed;\n}\n\n.pa-search-bar--disabled .pa-search-bar__button:hover {\n background: var(--pa-color-bg-secondary-light-40);\n}\n\n@container (max-width: 600px) {\n .pa-search-bar__wrapper {\n flex-direction: column;\n gap: var(--pa-space-xs);\n background: transparent;\n border: none;\n border-radius: 0;\n overflow: visible;\n }\n\n .pa-search-bar__wrapper:hover,\n .pa-search-bar__wrapper:focus-within {\n border-color: transparent;\n box-shadow: none;\n }\n\n .pa-search-bar--open .pa-search-bar__wrapper {\n border-radius: 0;\n }\n\n .pa-search-bar__input-cell {\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n border-radius: var(--pa-radius-smooth);\n transition: border-color 120ms ease, box-shadow 120ms ease;\n }\n\n .pa-search-bar__input-cell:focus-within {\n border-color: var(--pa-color-primary);\n box-shadow: 0 0 0 2px var(--pa-color-primary-focus-border);\n }\n\n .pa-search-bar--open .pa-search-bar__input-cell {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .pa-search-bar__button {\n width: 100%;\n height: 52px;\n border-radius: var(--pa-radius-smooth);\n }\n\n .pa-search-bar--disabled .pa-search-bar__input-cell {\n background: var(--pa-color-bg-secondary-light-40);\n }\n}\n</style>\n"],"names":["searchBarUid","nextPaSearchBarId","props","__props","emit","__emit","model","_useModel","baseId","inputId","computed","listboxId","optionIds","_","i","inputRef","ref","optionRefs","dropdownOpen","activeIndex","hasOptions","showClear","activeDescendant","debounceTimer","blurTimer","clearDebounce","clearBlurTimer","openDropdown","closeDropdown","triggerSearch","_a","onFocus","onBlur","onClear","nextTick","onOptionMousedown","event","selectOption","option","findNextEnabled","from","dir","opts","n","step","opt","findFirstEnabled","findLastEnabled","onKeydown","setOptionRef","el","watch","d","onBeforeUnmount","_createElementBlock","_normalizeClass","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","$event","_createVNode","PaIcon","_hoisted_7","_toDisplayString","_openBlock","_Fragment","_renderList","_hoisted_9","_createBlock","_hoisted_10"],"mappings":";;;;;;AACA,IAAIA,KAAe;AACZ,SAASC,KAAoB;AAClC,SAAO,iBAAiB,EAAED,EAAY;AACxC;;;;;;;;;;;;;;;;;;;AAwBA,UAAME,IAAQC,GAORC,IAAOC,GAMPC,IAAQC,GAAmBJ,GAAC,OAAwB,GAEpDK,IAASP,GAAA,GACTQ,IAAUC,EAAS,MAAMR,EAAM,MAAM,GAAGM,CAAM,SAAS,GACvDG,IAAY,GAAGH,CAAM,aACrBI,IAAYF;AAAA,MAAS,OACxBR,EAAM,WAAW,CAAA,GAAI,IAAI,CAACW,GAAGC,MAAM,GAAGN,CAAM,YAAYM,CAAC,EAAE;AAAA,IAAA,GAGxDC,IAAWC,EAA6B,IAAI,GAC5CC,IAAaD,EAAqB,EAAE,GACpCE,IAAeF,EAAI,EAAK,GACxBG,IAAcH,EAAI,EAAE,GAEpBI,IAAaV;AAAA,MACjB,MAAM,MAAM,QAAQR,EAAM,OAAO,KAAKA,EAAM,QAAQ,SAAS;AAAA,IAAA,GAGzDmB,IAAYX,EAAS,MAAMJ,EAAM,MAAM,SAAS,KAAK,CAACJ,EAAM,QAAQ,GAEpEoB,IAAmBZ;AAAA,MAAS,MAChCQ,EAAa,SAASC,EAAY,SAAS,IACvCP,EAAU,MAAMO,EAAY,KAAK,IACjC;AAAA,IAAA;AAGN,QAAII,IAAsD,MACtDC,IAAkD;AAEtD,aAASC,IAAgB;AACvB,MAAIF,MACF,aAAaA,CAAa,GAC1BA,IAAgB;AAAA,IAEpB;AAEA,aAASG,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QS,UAAA;AAAA,UAPP,MAAK;AAAA,UACL,OAAM;AAAA,UACL,UAAUtD,EAAA;AAAA,UACV,SAAO0B;AAAA,QAAA;UAER4B,EAAkE,QAAlEM,IAAkEC,EAArB7D,EAAA,WAAW,GAAA,CAAA;AAAA,UACxD0D,EAA4CC,GAAA;AAAA,YAApC,MAAK;AAAA,YAAmB,MAAK;AAAA,UAAA;;;MAIjC5C,EAAA,cADRoC,EA6BK,MAAA;AAAA;QA3BF,IAAI3C;AAAA,QACL,MAAK;AAAA,QACL,OAAM;AAAA,MAAA;SAENsD,EAAA,EAAA,GAAAX,EAsBKY,IAAA,MAAAC,GArBgBhE,EAAA,SAAO,CAAlB0C,GAAK/B,YADfwC,EAsBK,MAAA;AAAA,UApBF,eAAexC,CAAC;AAAA;UAChB,MAAMoC,MAAOD,EAAaC,GAAsBpC,CAAC;AAAA,UACjD,IAAIF,EAAA,MAAUE,CAAC;AAAA,UAChB,MAAK;AAAA,UACJ,iBAAeA,MAAMK,EAAA,QAAW,SAAA;AAAA,UAChC,iBAAe0B,EAAI,oBAAoB;AAAA,UACvC,OAAKU,EAAA;AAAA;YAAsF,EAAA,mCAAAV,EAAI,SAAA;AAAA,UAAQ;UAIvG,aAAWV;AAAA,UACX,SAAK,CAAAyB,MAAEvB,EAAaQ,CAAG;AAAA,QAAA;UAExBY,EAAgE,QAAhEW,IAAgEJ,EAAnBnB,EAAI,KAAK,GAAA,CAAA;AAAA,UAE9C/B,MAAMK,EAAA,SAAW,CAAK0B,EAAI,iBADlCwB,GAKEP,GAAA;AAAA;YAHA,MAAK;AAAA,YACL,MAAK;AAAA,YACL,OAAM;AAAA,UAAA;;;MAIH3D,EAAA,mBAATmD,EAAuE,KAAvEgB,IAAuEN,EAAjB7D,EAAA,UAAU,GAAA,CAAA;;;;"}
1
+ {"version":3,"file":"PaSearchBar.vue2.js","sources":["../../../src/components/PaSearchBar/PaSearchBar.vue"],"sourcesContent":["<script lang=\"ts\">\n\nexport interface PaSearchBarOption {\n value: string\n disabled?: boolean\n}\n\nexport interface PaSearchBarProps {\n label?: string\n placeholder?: string\n helperText?: string\n disabled?: boolean\n id?: string\n searchLabel?: string\n clearLabel?: string\n debounceMs?: number\n options?: PaSearchBarOption[]\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, nextTick, onBeforeUnmount, ref, useId, watch } from 'vue'\nimport PaIcon from '../PaIcon/PaIcon.vue'\n\nconst props = withDefaults(defineProps<PaSearchBarProps>(), {\n disabled: false,\n searchLabel: 'Ricerca',\n clearLabel: 'Cancella ricerca',\n debounceMs: 0,\n})\n\nconst emit = defineEmits<{\n search: [value: string]\n clear: []\n select: [option: PaSearchBarOption]\n}>()\n\nconst model = defineModel<string>('value', { default: '' })\n\nconst baseId = `pa-search-bar-${useId()}`\nconst inputId = computed(() => props.id ?? `${baseId}__input`)\nconst listboxId = `${baseId}__listbox`\nconst optionIds = computed(() =>\n (props.options ?? []).map((_, i) => `${baseId}__option-${i}`),\n)\n\nconst inputRef = ref<HTMLInputElement | null>(null)\nconst optionRefs = ref<HTMLLIElement[]>([])\nconst dropdownOpen = ref(false)\nconst activeIndex = ref(-1)\n\nconst hasOptions = computed(\n () => Array.isArray(props.options) && props.options.length > 0,\n)\n\nconst showClear = computed(() => model.value.length > 0 && !props.disabled)\n\nconst activeDescendant = computed(() =>\n dropdownOpen.value && activeIndex.value >= 0\n ? optionIds.value[activeIndex.value]\n : undefined,\n)\n\nlet debounceTimer: ReturnType<typeof setTimeout> | null = null\nlet blurTimer: ReturnType<typeof setTimeout> | null = null\n\nfunction clearDebounce() {\n if (debounceTimer) {\n clearTimeout(debounceTimer)\n debounceTimer = null\n }\n}\n\nfunction clearBlurTimer() {\n if (blurTimer) {\n clearTimeout(blurTimer)\n blurTimer = null\n }\n}\n\nfunction openDropdown() {\n if (props.disabled || !hasOptions.value) return\n dropdownOpen.value = true\n}\n\nfunction closeDropdown() {\n dropdownOpen.value = false\n activeIndex.value = -1\n}\n\nfunction triggerSearch() {\n if (props.disabled) return\n clearDebounce()\n emit('search', model.value)\n inputRef.value?.blur()\n}\n\nfunction onFocus() {\n clearBlurTimer()\n openDropdown()\n}\n\nfunction onBlur() {\n clearBlurTimer()\n blurTimer = setTimeout(() => {\n closeDropdown()\n blurTimer = null\n }, 150)\n}\n\nfunction onClear() {\n if (props.disabled) return\n model.value = ''\n emit('clear')\n nextTick(() => inputRef.value?.focus())\n}\n\nfunction onOptionMousedown(event: MouseEvent) {\n event.preventDefault()\n clearBlurTimer()\n}\n\nfunction selectOption(option: PaSearchBarOption) {\n if (props.disabled || option.disabled) return\n model.value = option.value\n emit('select', option)\n closeDropdown()\n nextTick(() => inputRef.value?.focus())\n}\n\nfunction findNextEnabled(from: number, dir: 1 | -1): number {\n const opts = props.options ?? []\n const n = opts.length\n if (n === 0) return -1\n let i = from\n for (let step = 0; step < n; step++) {\n i = (i + dir + n) % n\n const opt = opts[i]\n if (opt && !opt.disabled) return i\n }\n return -1\n}\n\nfunction findFirstEnabled(): number {\n const opts = props.options ?? []\n for (let i = 0; i < opts.length; i++) {\n const opt = opts[i]\n if (opt && !opt.disabled) return i\n }\n return -1\n}\n\nfunction findLastEnabled(): number {\n const opts = props.options ?? []\n for (let i = opts.length - 1; i >= 0; i--) {\n const opt = opts[i]\n if (opt && !opt.disabled) return i\n }\n return -1\n}\n\nfunction onKeydown(event: KeyboardEvent) {\n if (props.disabled) return\n switch (event.key) {\n case 'ArrowDown': {\n event.preventDefault()\n if (!dropdownOpen.value) {\n if (hasOptions.value) {\n openDropdown()\n activeIndex.value = findFirstEnabled()\n }\n } else {\n activeIndex.value = findNextEnabled(activeIndex.value, 1)\n }\n break\n }\n case 'ArrowUp': {\n event.preventDefault()\n if (!dropdownOpen.value) {\n if (hasOptions.value) {\n openDropdown()\n activeIndex.value = findLastEnabled()\n }\n } else {\n const from = activeIndex.value < 0 ? 0 : activeIndex.value\n activeIndex.value = findNextEnabled(from, -1)\n }\n break\n }\n case 'Home': {\n if (dropdownOpen.value) {\n event.preventDefault()\n activeIndex.value = findFirstEnabled()\n }\n break\n }\n case 'End': {\n if (dropdownOpen.value) {\n event.preventDefault()\n activeIndex.value = findLastEnabled()\n }\n break\n }\n case 'Enter': {\n event.preventDefault()\n const opts = props.options ?? []\n const opt = activeIndex.value >= 0 ? opts[activeIndex.value] : undefined\n if (dropdownOpen.value && opt && !opt.disabled) {\n selectOption(opt)\n return\n }\n triggerSearch()\n break\n }\n case 'Escape': {\n if (dropdownOpen.value) {\n event.preventDefault()\n closeDropdown()\n }\n break\n }\n }\n}\n\nfunction setOptionRef(el: Element | null, i: number) {\n if (el) optionRefs.value[i] = el as HTMLLIElement\n}\n\nwatch(activeIndex, async (i) => {\n if (i < 0) return\n await nextTick()\n const el = optionRefs.value[i]\n if (el && typeof el.scrollIntoView === 'function') {\n el.scrollIntoView({ block: 'nearest' })\n }\n})\n\nwatch(\n () => props.options?.length ?? 0,\n (n) => {\n optionRefs.value.length = n\n if (n === 0) closeDropdown()\n else if (activeIndex.value >= n) activeIndex.value = -1\n },\n)\n\nwatch(\n () => props.disabled,\n (d) => {\n if (d) closeDropdown()\n },\n)\n\nwatch(model, () => {\n if (props.disabled) return\n clearDebounce()\n if (props.debounceMs > 0) {\n debounceTimer = setTimeout(() => {\n emit('search', model.value)\n debounceTimer = null\n }, props.debounceMs)\n }\n})\n\nonBeforeUnmount(() => {\n clearDebounce()\n clearBlurTimer()\n})\n</script>\n\n<template>\n <div\n :class=\"[\n 'pa-search-bar',\n {\n 'pa-search-bar--disabled': disabled,\n 'pa-search-bar--open': dropdownOpen,\n },\n ]\"\n >\n <label v-if=\"label\" :for=\"inputId\" class=\"pa-search-bar__label\">\n {{ label }}\n </label>\n <div class=\"pa-search-bar__wrapper\">\n <div class=\"pa-search-bar__input-cell\">\n <input\n :id=\"inputId\"\n ref=\"inputRef\"\n v-model=\"model\"\n type=\"search\"\n autocomplete=\"off\"\n class=\"pa-search-bar__input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-expanded=\"dropdownOpen\"\n :aria-activedescendant=\"activeDescendant\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n @keydown=\"onKeydown\"\n @focus=\"onFocus\"\n @blur=\"onBlur\"\n />\n <button\n v-if=\"showClear\"\n type=\"button\"\n class=\"pa-search-bar__clear\"\n :aria-label=\"clearLabel\"\n @click=\"onClear\"\n >\n <PaIcon name=\"x\" size=\"sm\" />\n </button>\n </div>\n <button\n type=\"button\"\n class=\"pa-search-bar__button\"\n :disabled=\"disabled\"\n @click=\"triggerSearch\"\n >\n <span class=\"pa-search-bar__button-label\">{{ searchLabel }}</span>\n <PaIcon name=\"magnifying-glass\" size=\"sm\" />\n </button>\n </div>\n <ul\n v-if=\"dropdownOpen\"\n :id=\"listboxId\"\n role=\"listbox\"\n class=\"pa-search-bar__listbox\"\n >\n <li\n v-for=\"(opt, i) in options\"\n :key=\"`option-${i}`\"\n :ref=\"(el) => setOptionRef(el as Element | null, i)\"\n :id=\"optionIds[i]\"\n role=\"option\"\n :aria-selected=\"i === activeIndex ? 'true' : 'false'\"\n :aria-disabled=\"opt.disabled ? 'true' : undefined\"\n :class=\"[\n 'pa-search-bar__option',\n { 'pa-search-bar__option--disabled': opt.disabled },\n ]\"\n @mousedown=\"onOptionMousedown\"\n @click=\"selectOption(opt)\"\n >\n <span class=\"pa-search-bar__option-label\">{{ opt.value }}</span>\n <PaIcon\n v-if=\"i === activeIndex && !opt.disabled\"\n name=\"check\"\n size=\"sm\"\n class=\"pa-search-bar__option-check\"\n />\n </li>\n </ul>\n <p v-if=\"helperText\" class=\"pa-search-bar__helper\">{{ helperText }}</p>\n </div>\n</template>\n\n<style scoped>\n.pa-search-bar {\n display: flex;\n flex-direction: column;\n font-family: var(--pa-font-family-base);\n container-type: inline-size;\n}\n\n.pa-search-bar__label {\n font-size: var(--pa-font-label-sm-size);\n line-height: var(--pa-font-label-sm-line-height);\n font-weight: var(--pa-font-label-sm-weight);\n color: var(--pa-color-text-secondary-gray);\n padding-bottom: var(--pa-space-xs);\n}\n\n.pa-search-bar__wrapper {\n display: flex;\n align-items: stretch;\n box-sizing: border-box;\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n border-radius: 9px;\n overflow: hidden;\n transition: border-color 120ms ease, box-shadow 120ms ease,\n border-radius 120ms ease;\n}\n\n.pa-search-bar__wrapper:hover {\n border-color: var(--pa-color-neutral-gray);\n}\n\n.pa-search-bar__wrapper:focus-within {\n border-color: var(--pa-color-primary);\n box-shadow: 0 0 0 2px var(--pa-color-primary-focus-border);\n}\n\n.pa-search-bar--open .pa-search-bar__wrapper {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n}\n\n.pa-search-bar__input-cell {\n flex: 1 1 auto;\n min-width: 0;\n display: flex;\n align-items: center;\n gap: var(--pa-space-xs);\n padding-right: var(--pa-space-sm);\n}\n\n.pa-search-bar__input {\n flex: 1 1 auto;\n min-width: 0;\n margin: 0;\n padding: 12px var(--pa-space-sm);\n background: transparent;\n border: none;\n outline: none;\n color: var(--pa-color-text-secondary-gray);\n font-family: inherit;\n font-size: var(--pa-font-body-size);\n line-height: var(--pa-font-body-line-height);\n font-weight: var(--pa-font-body-weight);\n}\n\n.pa-search-bar__input::placeholder {\n color: var(--pa-color-text-disabled-gray);\n}\n\n.pa-search-bar__input::-webkit-search-decoration,\n.pa-search-bar__input::-webkit-search-cancel-button,\n.pa-search-bar__input::-webkit-search-results-button,\n.pa-search-bar__input::-webkit-search-results-decoration {\n appearance: none;\n -webkit-appearance: none;\n}\n\n.pa-search-bar__clear {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 24px;\n height: 24px;\n margin: 0;\n padding: 0;\n background: transparent;\n border: none;\n border-radius: var(--pa-radius-smooth);\n color: var(--pa-color-text-secondary-gray);\n cursor: pointer;\n}\n\n.pa-search-bar__clear:hover {\n color: var(--pa-color-neutral-charcoal);\n}\n\n.pa-search-bar__clear:focus-visible {\n outline: 2px solid var(--pa-color-primary-focus-border);\n outline-offset: 1px;\n}\n\n.pa-search-bar__button {\n flex: 0 0 auto;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--pa-space-xs);\n margin: 0;\n padding: 12px var(--pa-space-2xl);\n background: var(--pa-color-primary);\n border: none;\n border-radius: 0;\n color: var(--pa-color-text-white);\n font-family: inherit;\n font-size: var(--pa-font-label-sm-size);\n line-height: var(--pa-font-label-sm-line-height);\n font-weight: var(--pa-font-label-sm-weight);\n cursor: pointer;\n transition: background-color 120ms ease;\n}\n\n.pa-search-bar__button:hover {\n background: var(--pa-color-primary-hover);\n}\n\n.pa-search-bar__button:active {\n background: var(--pa-color-primary-pressed);\n}\n\n.pa-search-bar__button:focus-visible {\n outline: 2px solid var(--pa-color-text-white);\n outline-offset: -4px;\n}\n\n.pa-search-bar__listbox {\n list-style: none;\n margin: 0;\n padding: 0;\n background: var(--pa-color-bg-white);\n max-height: 320px;\n overflow-y: auto;\n}\n\n.pa-search-bar__option {\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--pa-space-xs);\n padding: var(--pa-space-sm);\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n margin-bottom: -1px;\n color: var(--pa-color-text-secondary-gray);\n font-size: var(--pa-font-body-size);\n line-height: var(--pa-font-body-line-height);\n font-weight: var(--pa-font-body-weight);\n cursor: pointer;\n user-select: none;\n transition: background-color 80ms ease, color 80ms ease,\n border-color 80ms ease;\n}\n\n.pa-search-bar__option:last-child {\n margin-bottom: 0;\n border-bottom-left-radius: var(--pa-radius-smooth);\n border-bottom-right-radius: var(--pa-radius-smooth);\n}\n\n.pa-search-bar__option:hover {\n background: var(--pa-color-primary-hover);\n color: var(--pa-color-text-white);\n}\n\n.pa-search-bar__option:active {\n background: var(--pa-color-primary-pressed);\n color: var(--pa-color-text-white);\n}\n\n.pa-search-bar__option:focus-visible {\n outline: none;\n border-color: var(--pa-color-primary);\n}\n\n.pa-search-bar__option[aria-selected='true'] {\n background: var(--pa-color-primary);\n color: var(--pa-color-text-white);\n}\n\n.pa-search-bar__option--disabled,\n.pa-search-bar__option--disabled:hover,\n.pa-search-bar__option--disabled:active {\n background: var(--pa-color-bg-disabled-gray);\n color: var(--pa-color-text-disabled-gray);\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.pa-search-bar__option-check {\n flex: 0 0 auto;\n}\n\n.pa-search-bar__helper {\n margin: 0;\n padding-top: var(--pa-space-xs);\n font-size: var(--pa-font-label-helper-size);\n line-height: var(--pa-font-label-helper-line-height);\n font-weight: var(--pa-font-label-helper-weight);\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-search-bar--disabled .pa-search-bar__wrapper,\n.pa-search-bar--disabled .pa-search-bar__wrapper:hover {\n background: var(--pa-color-bg-secondary-light-40);\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n\n.pa-search-bar--disabled .pa-search-bar__input {\n color: var(--pa-color-text-disabled-gray);\n cursor: not-allowed;\n}\n\n.pa-search-bar--disabled .pa-search-bar__button {\n background: var(--pa-color-bg-secondary-light-40);\n color: var(--pa-color-text-disabled-gray);\n cursor: not-allowed;\n}\n\n.pa-search-bar--disabled .pa-search-bar__button:hover {\n background: var(--pa-color-bg-secondary-light-40);\n}\n\n@container (max-width: 600px) {\n .pa-search-bar__wrapper {\n flex-direction: column;\n gap: var(--pa-space-xs);\n background: transparent;\n border: none;\n border-radius: 0;\n overflow: visible;\n }\n\n .pa-search-bar__wrapper:hover,\n .pa-search-bar__wrapper:focus-within {\n border-color: transparent;\n box-shadow: none;\n }\n\n .pa-search-bar--open .pa-search-bar__wrapper {\n border-radius: 0;\n }\n\n .pa-search-bar__input-cell {\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n border-radius: var(--pa-radius-smooth);\n transition: border-color 120ms ease, box-shadow 120ms ease;\n }\n\n .pa-search-bar__input-cell:focus-within {\n border-color: var(--pa-color-primary);\n box-shadow: 0 0 0 2px var(--pa-color-primary-focus-border);\n }\n\n .pa-search-bar--open .pa-search-bar__input-cell {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n }\n\n .pa-search-bar__button {\n width: 100%;\n height: 52px;\n border-radius: var(--pa-radius-smooth);\n }\n\n .pa-search-bar--disabled .pa-search-bar__input-cell {\n background: var(--pa-color-bg-secondary-light-40);\n }\n}\n</style>\n"],"names":["props","__props","emit","__emit","model","_useModel","baseId","useId","inputId","computed","listboxId","optionIds","_","i","inputRef","ref","optionRefs","dropdownOpen","activeIndex","hasOptions","showClear","activeDescendant","debounceTimer","blurTimer","clearDebounce","clearBlurTimer","openDropdown","closeDropdown","triggerSearch","_a","onFocus","onBlur","onClear","nextTick","onOptionMousedown","event","selectOption","option","findNextEnabled","from","dir","opts","n","step","opt","findFirstEnabled","findLastEnabled","onKeydown","setOptionRef","el","watch","d","onBeforeUnmount","_createElementBlock","_normalizeClass","_hoisted_1","_createElementVNode","_hoisted_2","_hoisted_3","$event","_createVNode","PaIcon","_hoisted_7","_toDisplayString","_openBlock","_Fragment","_renderList","_hoisted_9","_createBlock","_hoisted_10"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwBA,UAAMA,IAAQC,GAORC,IAAOC,GAMPC,IAAQC,GAAmBJ,GAAC,OAAwB,GAEpDK,IAAS,iBAAiBC,GAAA,CAAO,IACjCC,IAAUC,EAAS,MAAMT,EAAM,MAAM,GAAGM,CAAM,SAAS,GACvDI,IAAY,GAAGJ,CAAM,aACrBK,IAAYF;AAAA,MAAS,OACxBT,EAAM,WAAW,CAAA,GAAI,IAAI,CAACY,GAAGC,MAAM,GAAGP,CAAM,YAAYO,CAAC,EAAE;AAAA,IAAA,GAGxDC,IAAWC,EAA6B,IAAI,GAC5CC,IAAaD,EAAqB,EAAE,GACpCE,IAAeF,EAAI,EAAK,GACxBG,IAAcH,EAAI,EAAE,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BY,EAAgE,QAAhEW,IAAgEJ,EAAnBnB,EAAI,KAAK,GAAA,CAAA;AAAA,UAE9C,MAAM1B,EAAA,SAAW,CAAK0B,EAAI,iBADlCwB,GAKEP,GAAA;AAAA;YAHA,MAAK;AAAA,YACL,MAAK;AAAA,YACL,OAAM;AAAA,UAAA;;;MAIH5D,EAAA,mBAAToD,EAAuE,KAAvEgB,IAAuEN,EAAjB9D,EAAA,UAAU,GAAA,CAAA;;;;"}
@@ -19,14 +19,13 @@ export interface PaSelectProps {
19
19
  readonly?: boolean;
20
20
  placeholder?: string;
21
21
  }
22
- export declare function nextPaSelectId(): string;
23
- declare const _default: import("vue").DefineComponent<PaSelectProps & {
22
+ type __VLS_Props = PaSelectProps;
23
+ type __VLS_PublicProps = __VLS_Props & {
24
24
  modelValue?: string;
25
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
25
+ };
26
+ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
26
27
  "update:modelValue": (value: string) => any;
27
- }, string, import("vue").PublicProps, Readonly<PaSelectProps & {
28
- modelValue?: string;
29
- }> & Readonly<{
28
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
30
29
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
31
30
  }>, {
32
31
  error: string | boolean;
@@ -1,10 +1,8 @@
1
- import t from "./PaSelect.vue2.js";
2
- import { nextPaSelectId as c } from "./PaSelect.vue2.js";
1
+ import o from "./PaSelect.vue2.js";
3
2
  /* empty css */
4
- import e from "../../_virtual/_plugin-vue_export-helper.js";
5
- const f = /* @__PURE__ */ e(t, [["__scopeId", "data-v-4228fedd"]]);
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-091fc6ee"]]);
6
5
  export {
7
- f as default,
8
- c as nextPaSelectId
6
+ c as default
9
7
  };
10
8
  //# sourceMappingURL=PaSelect.vue.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaSelect.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"PaSelect.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,22 +1,17 @@
1
- import { defineComponent as B, useModel as V, computed as a, openBlock as t, createElementBlock as d, normalizeClass as h, createTextVNode as k, toDisplayString as s, createCommentVNode as i, createElementVNode as b, withDirectives as x, Fragment as M, renderList as S, vModelSelect as w, createVNode as z, mergeModels as I } from "vue";
2
- import N from "../PaIcon/PaIcon.vue.js";
3
- const T = ["for"], $ = {
1
+ import { defineComponent as B, useModel as V, useId as k, computed as a, openBlock as t, createElementBlock as d, normalizeClass as h, createTextVNode as x, toDisplayString as r, createCommentVNode as i, createElementVNode as b, withDirectives as M, Fragment as S, renderList as w, vModelSelect as z, createVNode as I, mergeModels as N } from "vue";
2
+ import T from "../PaIcon/PaIcon.vue.js";
3
+ const $ = ["for"], C = {
4
4
  key: 0,
5
5
  class: "pa-select__required",
6
6
  "aria-hidden": "true"
7
- }, C = { class: "pa-select__field" }, A = ["id", "disabled", "required", "name", "autocomplete", "aria-required", "aria-invalid", "aria-describedby"], D = {
7
+ }, A = { class: "pa-select__field" }, D = ["id", "disabled", "required", "name", "autocomplete", "aria-required", "aria-invalid", "aria-describedby"], E = {
8
8
  key: 0,
9
9
  value: "",
10
10
  disabled: "",
11
11
  hidden: ""
12
- }, E = ["value", "disabled"], P = ["id"];
13
- let F = 0;
14
- function L() {
15
- return `pa-select-${++F}`;
16
- }
17
- const H = /* @__PURE__ */ B({
12
+ }, F = ["value", "disabled"], L = ["id"], G = /* @__PURE__ */ B({
18
13
  __name: "PaSelect",
19
- props: /* @__PURE__ */ I({
14
+ props: /* @__PURE__ */ N({
20
15
  options: {},
21
16
  size: { default: "sm" },
22
17
  label: {},
@@ -36,21 +31,21 @@ const H = /* @__PURE__ */ B({
36
31
  }),
37
32
  emits: ["update:modelValue"],
38
33
  setup(e) {
39
- const l = e, n = V(e, "modelValue"), p = L(), c = a(() => l.id ?? p), v = a(() => `${c.value}-msg`), r = a(() => !!l.error), m = a(() => l.valid && !r.value), y = a(
34
+ const l = e, n = V(e, "modelValue"), p = `pa-select-${k()}`, c = a(() => l.id ?? p), v = a(() => `${c.value}-msg`), s = a(() => !!l.error), m = a(() => l.valid && !s.value), y = a(
40
35
  () => typeof l.error == "string" && l.error.length > 0 ? l.error : null
41
36
  ), g = a(
42
- () => !r.value && !m.value && l.helperText ? l.helperText : null
37
+ () => !s.value && !m.value && l.helperText ? l.helperText : null
43
38
  ), u = a(() => y.value ?? g.value), q = a(
44
39
  () => l.placeholder !== void 0 && n.value === ""
45
40
  );
46
- return (U, f) => (t(), d("div", {
41
+ return (P, f) => (t(), d("div", {
47
42
  class: h([
48
43
  "pa-select",
49
44
  `pa-select--${e.size}`,
50
45
  {
51
46
  "pa-select--disabled": e.disabled && !e.readonly,
52
47
  "pa-select--readonly": e.readonly,
53
- "pa-select--error": r.value,
48
+ "pa-select--error": s.value,
54
49
  "pa-select--valid": m.value,
55
50
  "pa-select--placeholder-shown": q.value
56
51
  }
@@ -61,11 +56,11 @@ const H = /* @__PURE__ */ B({
61
56
  for: c.value,
62
57
  class: "pa-select__label"
63
58
  }, [
64
- k(s(e.label), 1),
65
- e.required ? (t(), d("span", $, "*")) : i("", !0)
66
- ], 8, T)) : i("", !0),
67
- b("div", C, [
68
- x(b("select", {
59
+ x(r(e.label), 1),
60
+ e.required ? (t(), d("span", C, "*")) : i("", !0)
61
+ ], 8, $)) : i("", !0),
62
+ b("div", A, [
63
+ M(b("select", {
69
64
  id: c.value,
70
65
  "onUpdate:modelValue": f[0] || (f[0] = (o) => n.value = o),
71
66
  disabled: e.disabled || e.readonly,
@@ -73,20 +68,20 @@ const H = /* @__PURE__ */ B({
73
68
  name: e.name,
74
69
  autocomplete: e.autocomplete,
75
70
  "aria-required": e.required || void 0,
76
- "aria-invalid": r.value || void 0,
71
+ "aria-invalid": s.value || void 0,
77
72
  "aria-describedby": u.value ? v.value : void 0,
78
73
  class: "pa-select__control"
79
74
  }, [
80
- e.placeholder ? (t(), d("option", D, s(e.placeholder), 1)) : i("", !0),
81
- (t(!0), d(M, null, S(e.options, (o) => (t(), d("option", {
75
+ e.placeholder ? (t(), d("option", E, r(e.placeholder), 1)) : i("", !0),
76
+ (t(!0), d(S, null, w(e.options, (o) => (t(), d("option", {
82
77
  key: o.value,
83
78
  value: o.value,
84
79
  disabled: o.disabled
85
- }, s(o.label), 9, E))), 128))
86
- ], 8, A), [
87
- [w, n.value]
80
+ }, r(o.label), 9, F))), 128))
81
+ ], 8, D), [
82
+ [z, n.value]
88
83
  ]),
89
- z(N, {
84
+ I(T, {
90
85
  name: "caret-up-down",
91
86
  size: "md",
92
87
  class: "pa-select__chevron"
@@ -95,13 +90,12 @@ const H = /* @__PURE__ */ B({
95
90
  u.value ? (t(), d("div", {
96
91
  key: 1,
97
92
  id: v.value,
98
- class: h(["pa-select__message", { "pa-select__message--error": r.value }])
99
- }, s(u.value), 11, P)) : i("", !0)
93
+ class: h(["pa-select__message", { "pa-select__message--error": s.value }])
94
+ }, r(u.value), 11, L)) : i("", !0)
100
95
  ], 2));
101
96
  }
102
97
  });
103
98
  export {
104
- H as default,
105
- L as nextPaSelectId
99
+ G as default
106
100
  };
107
101
  //# sourceMappingURL=PaSelect.vue2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PaSelect.vue2.js","sources":["../../../src/components/PaSelect/PaSelect.vue"],"sourcesContent":["<script lang=\"ts\">\nlet uid = 0\nexport function nextPaSelectId() {\n return `pa-select-${++uid}`\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport PaIcon from '../PaIcon/PaIcon.vue'\n\nexport type PaSelectSize = 'sm' | 'lg'\n\nexport interface PaSelectOption {\n value: string\n label: string\n disabled?: boolean\n}\n\nexport interface PaSelectProps {\n options: PaSelectOption[]\n size?: PaSelectSize\n label?: string\n disabled?: boolean\n id?: string\n helperText?: string\n error?: string | boolean\n valid?: boolean\n name?: string\n autocomplete?: string\n required?: boolean\n readonly?: boolean\n placeholder?: string\n}\n\nconst props = withDefaults(defineProps<PaSelectProps>(), {\n size: 'sm',\n disabled: false,\n error: false,\n valid: false,\n required: false,\n readonly: false,\n})\n\nconst model = defineModel<string>({ default: '' })\n\nconst generatedId = nextPaSelectId()\nconst inputId = computed(() => props.id ?? generatedId)\nconst messageId = computed(() => `${inputId.value}-msg`)\n\nconst errorActive = computed(() => Boolean(props.error))\nconst validActive = computed(() => props.valid && !errorActive.value)\n\nconst errorMessage = computed(() =>\n typeof props.error === 'string' && props.error.length > 0 ? props.error : null,\n)\nconst helperMessage = computed(() =>\n !errorActive.value && !validActive.value && props.helperText ? props.helperText : null,\n)\nconst message = computed(() => errorMessage.value ?? helperMessage.value)\n\nconst placeholderShown = computed(\n () => props.placeholder !== undefined && model.value === '',\n)\n</script>\n\n<template>\n <div\n :class=\"[\n 'pa-select',\n `pa-select--${size}`,\n {\n 'pa-select--disabled': disabled && !readonly,\n 'pa-select--readonly': readonly,\n 'pa-select--error': errorActive,\n 'pa-select--valid': validActive,\n 'pa-select--placeholder-shown': placeholderShown,\n },\n ]\"\n >\n <label v-if=\"label\" :for=\"inputId\" class=\"pa-select__label\">\n {{ label }}<span v-if=\"required\" class=\"pa-select__required\" aria-hidden=\"true\">*</span>\n </label>\n <div class=\"pa-select__field\">\n <select\n :id=\"inputId\"\n v-model=\"model\"\n :disabled=\"disabled || readonly\"\n :required=\"required\"\n :name=\"name\"\n :autocomplete=\"autocomplete\"\n :aria-required=\"required || undefined\"\n :aria-invalid=\"errorActive || undefined\"\n :aria-describedby=\"message ? messageId : undefined\"\n class=\"pa-select__control\"\n >\n <option v-if=\"placeholder\" value=\"\" disabled hidden>{{ placeholder }}</option>\n <option\n v-for=\"opt in options\"\n :key=\"opt.value\"\n :value=\"opt.value\"\n :disabled=\"opt.disabled\"\n >\n {{ opt.label }}\n </option>\n </select>\n <PaIcon name=\"caret-up-down\" size=\"md\" class=\"pa-select__chevron\" />\n </div>\n <div\n v-if=\"message\"\n :id=\"messageId\"\n :class=\"['pa-select__message', { 'pa-select__message--error': errorActive }]\"\n >\n {{ message }}\n </div>\n </div>\n</template>\n\n<style scoped>\n.pa-select {\n display: flex;\n flex-direction: column;\n gap: var(--pa-space-2xs);\n font-family: var(--pa-font-family-base);\n}\n\n.pa-select__label {\n font-size: var(--pa-font-label-sm-size);\n line-height: var(--pa-font-label-sm-line-height);\n font-weight: var(--pa-font-label-sm-weight);\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-select__field {\n display: flex;\n align-items: center;\n gap: var(--pa-space-xs);\n box-sizing: border-box;\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n border-radius: var(--pa-radius-smooth);\n transition: border-color 120ms ease, background-color 120ms ease;\n}\n\n.pa-select__field:hover {\n border-color: var(--pa-color-neutral-gray);\n}\n\n.pa-select__field:focus-within {\n outline: 3px solid var(--pa-color-primary-focus-border);\n outline-offset: 0;\n border-color: var(--pa-color-primary);\n}\n\n.pa-select__control {\n flex: 1 1 auto;\n min-width: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n background: transparent;\n border: none;\n outline: none;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n color: var(--pa-color-text-black);\n font-family: inherit;\n font-size: var(--pa-font-body-size);\n line-height: var(--pa-font-body-line-height);\n font-weight: var(--pa-font-body-weight);\n cursor: pointer;\n}\n\n.pa-select__chevron {\n flex: 0 0 auto;\n pointer-events: none;\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-select--sm .pa-select__field {\n height: 44px;\n padding: 0 var(--pa-space-sm);\n}\n\n.pa-select--lg .pa-select__field {\n height: 60px;\n padding: 0 var(--pa-space-sm);\n}\n\n.pa-select--lg .pa-select__label {\n font-size: var(--pa-font-label-md-size);\n line-height: var(--pa-font-label-md-line-height);\n font-weight: var(--pa-font-label-md-weight);\n}\n\n.pa-select--placeholder-shown .pa-select__control {\n color: var(--pa-color-text-disabled-gray);\n}\n\n.pa-select--disabled .pa-select__field {\n background: var(--pa-color-bg-disabled-gray);\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n\n.pa-select--disabled .pa-select__field:hover {\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n\n.pa-select--disabled .pa-select__label,\n.pa-select--disabled .pa-select__control,\n.pa-select--disabled .pa-select__chevron {\n color: var(--pa-color-text-disabled-gray);\n}\n\n.pa-select--disabled .pa-select__control {\n cursor: not-allowed;\n}\n\n.pa-select--error .pa-select__field {\n border-color: var(--pa-color-error);\n border-width: var(--pa-border-sm);\n}\n.pa-select--error .pa-select__field:hover {\n border-color: var(--pa-color-error);\n}\n\n.pa-select--valid .pa-select__field {\n border-color: var(--pa-color-success);\n border-width: var(--pa-border-sm);\n}\n.pa-select--valid .pa-select__field:hover {\n border-color: var(--pa-color-success);\n}\n\n.pa-select__message {\n font-size: var(--pa-font-label-helper-size);\n line-height: var(--pa-font-label-helper-line-height);\n font-weight: var(--pa-font-label-helper-weight);\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-select__message--error {\n color: var(--pa-color-error);\n}\n\n.pa-select__required {\n margin-left: var(--pa-space-3xs);\n color: var(--pa-color-error);\n}\n\n.pa-select--readonly .pa-select__field {\n background: var(--pa-color-bg-primary-light-40);\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n.pa-select--readonly .pa-select__field:hover {\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n.pa-select--readonly .pa-select__control {\n cursor: not-allowed;\n}\n</style>\n"],"names":["uid","nextPaSelectId","props","__props","model","_useModel","generatedId","inputId","computed","messageId","errorActive","validActive","errorMessage","helperMessage","message","placeholderShown","_createElementBlock","_normalizeClass","_hoisted_2","_createElementVNode","_hoisted_3","$event","_hoisted_5","_toDisplayString","_Frag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C,GAwBM;AAAA,UAvBJD,EAqBS,UAAA;AAAA,UApBN,IAAIZ,EAAA;AAAA,wDACIH,EAAK,QAAAiB;AAAA,UACb,UAAUlB,EAAA,YAAYA,EAAA;AAAA,UACtB,UAAUA,EAAA;AAAA,UACV,MAAMA,EAAA;AAAA,UACN,cAAcA,EAAA;AAAA,UACd,iBAAeA,EAAA,YAAY;AAAA,UAC3B,gBAAcO,EAAA,SAAe;AAAA,UAC7B,oBAAkBI,EAAA,QAAUL,EAAA,QAAY;AAAA,UACzC,OAAM;AAAA,QAAA;UAEQN,EAAA,oBAAda,EAA8E,UAA9EM,GAA8EC,EAAvBpB,EAAA,WAAW,GAAA,CAAA;kBAClEa,EAOSQ,GAAA,MAAAC,EANOtB,EAAA,SAAO,CAAduB,YADTV,EAOS,UAAA;AAAA,YALN,KAAKU,EAAI;AAAA,YACT,OAAOA,EAAI;AAAA,YACX,UAAUA,EAAI;AAAA,UAAA,GAEZH,EAAAG,EAAI,KAAK,GAAA,GAAAC,CAAA;;cAjBLvB,EAAA,KAAK;AAAA,QAAA;QAoBhBwB,EAAoEC,GAAA;AAAA,UAA5D,MAAK;AAAA,UAAgB,MAAK;AAAA,UAAK,OAAM;AAAA,QAAA;;MAGvCf,EAAA,cADRE,EAMM,OAAA;AAAA;QAJH,IAAIP,EAAA;AAAA,QACJ,+DAA6DC,EAAA,OAAW,CAAA;AAAA,MAAA,KAEtEI,EAAA,KAAO,GAAA,IAAAgB,CAAA;;;;"}
1
+ {"version":3,"file":"PaSelect.vue2.js","sources":["../../../src/components/PaSelect/PaSelect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, useId } from 'vue'\nimport PaIcon from '../PaIcon/PaIcon.vue'\n\nexport type PaSelectSize = 'sm' | 'lg'\n\nexport interface PaSelectOption {\n value: string\n label: string\n disabled?: boolean\n}\n\nexport interface PaSelectProps {\n options: PaSelectOption[]\n size?: PaSelectSize\n label?: string\n disabled?: boolean\n id?: string\n helperText?: string\n error?: string | boolean\n valid?: boolean\n name?: string\n autocomplete?: string\n required?: boolean\n readonly?: boolean\n placeholder?: string\n}\n\nconst props = withDefaults(defineProps<PaSelectProps>(), {\n size: 'sm',\n disabled: false,\n error: false,\n valid: false,\n required: false,\n readonly: false,\n})\n\nconst model = defineModel<string>({ default: '' })\n\nconst generatedId = `pa-select-${useId()}`\nconst inputId = computed(() => props.id ?? generatedId)\nconst messageId = computed(() => `${inputId.value}-msg`)\n\nconst errorActive = computed(() => Boolean(props.error))\nconst validActive = computed(() => props.valid && !errorActive.value)\n\nconst errorMessage = computed(() =>\n typeof props.error === 'string' && props.error.length > 0 ? props.error : null,\n)\nconst helperMessage = computed(() =>\n !errorActive.value && !validActive.value && props.helperText ? props.helperText : null,\n)\nconst message = computed(() => errorMessage.value ?? helperMessage.value)\n\nconst placeholderShown = computed(\n () => props.placeholder !== undefined && model.value === '',\n)\n</script>\n\n<template>\n <div\n :class=\"[\n 'pa-select',\n `pa-select--${size}`,\n {\n 'pa-select--disabled': disabled && !readonly,\n 'pa-select--readonly': readonly,\n 'pa-select--error': errorActive,\n 'pa-select--valid': validActive,\n 'pa-select--placeholder-shown': placeholderShown,\n },\n ]\"\n >\n <label v-if=\"label\" :for=\"inputId\" class=\"pa-select__label\">\n {{ label }}<span v-if=\"required\" class=\"pa-select__required\" aria-hidden=\"true\">*</span>\n </label>\n <div class=\"pa-select__field\">\n <select\n :id=\"inputId\"\n v-model=\"model\"\n :disabled=\"disabled || readonly\"\n :required=\"required\"\n :name=\"name\"\n :autocomplete=\"autocomplete\"\n :aria-required=\"required || undefined\"\n :aria-invalid=\"errorActive || undefined\"\n :aria-describedby=\"message ? messageId : undefined\"\n class=\"pa-select__control\"\n >\n <option v-if=\"placeholder\" value=\"\" disabled hidden>{{ placeholder }}</option>\n <option\n v-for=\"opt in options\"\n :key=\"opt.value\"\n :value=\"opt.value\"\n :disabled=\"opt.disabled\"\n >\n {{ opt.label }}\n </option>\n </select>\n <PaIcon name=\"caret-up-down\" size=\"md\" class=\"pa-select__chevron\" />\n </div>\n <div\n v-if=\"message\"\n :id=\"messageId\"\n :class=\"['pa-select__message', { 'pa-select__message--error': errorActive }]\"\n >\n {{ message }}\n </div>\n </div>\n</template>\n\n<style scoped>\n.pa-select {\n display: flex;\n flex-direction: column;\n gap: var(--pa-space-2xs);\n font-family: var(--pa-font-family-base);\n}\n\n.pa-select__label {\n font-size: var(--pa-font-label-sm-size);\n line-height: var(--pa-font-label-sm-line-height);\n font-weight: var(--pa-font-label-sm-weight);\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-select__field {\n display: flex;\n align-items: center;\n gap: var(--pa-space-xs);\n box-sizing: border-box;\n background: var(--pa-color-bg-white);\n border: var(--pa-border-xs) solid var(--pa-color-bg-secondary-light-50);\n border-radius: var(--pa-radius-smooth);\n transition: border-color 120ms ease, background-color 120ms ease;\n}\n\n.pa-select__field:hover {\n border-color: var(--pa-color-neutral-gray);\n}\n\n.pa-select__field:focus-within {\n outline: 3px solid var(--pa-color-primary-focus-border);\n outline-offset: 0;\n border-color: var(--pa-color-primary);\n}\n\n.pa-select__control {\n flex: 1 1 auto;\n min-width: 0;\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n background: transparent;\n border: none;\n outline: none;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n color: var(--pa-color-text-black);\n font-family: inherit;\n font-size: var(--pa-font-body-size);\n line-height: var(--pa-font-body-line-height);\n font-weight: var(--pa-font-body-weight);\n cursor: pointer;\n}\n\n.pa-select__chevron {\n flex: 0 0 auto;\n pointer-events: none;\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-select--sm .pa-select__field {\n height: 44px;\n padding: 0 var(--pa-space-sm);\n}\n\n.pa-select--lg .pa-select__field {\n height: 60px;\n padding: 0 var(--pa-space-sm);\n}\n\n.pa-select--lg .pa-select__label {\n font-size: var(--pa-font-label-md-size);\n line-height: var(--pa-font-label-md-line-height);\n font-weight: var(--pa-font-label-md-weight);\n}\n\n.pa-select--placeholder-shown .pa-select__control {\n color: var(--pa-color-text-disabled-gray);\n}\n\n.pa-select--disabled .pa-select__field {\n background: var(--pa-color-bg-disabled-gray);\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n\n.pa-select--disabled .pa-select__field:hover {\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n\n.pa-select--disabled .pa-select__label,\n.pa-select--disabled .pa-select__control,\n.pa-select--disabled .pa-select__chevron {\n color: var(--pa-color-text-disabled-gray);\n}\n\n.pa-select--disabled .pa-select__control {\n cursor: not-allowed;\n}\n\n.pa-select--error .pa-select__field {\n border-color: var(--pa-color-error);\n border-width: var(--pa-border-sm);\n}\n.pa-select--error .pa-select__field:hover {\n border-color: var(--pa-color-error);\n}\n\n.pa-select--valid .pa-select__field {\n border-color: var(--pa-color-success);\n border-width: var(--pa-border-sm);\n}\n.pa-select--valid .pa-select__field:hover {\n border-color: var(--pa-color-success);\n}\n\n.pa-select__message {\n font-size: var(--pa-font-label-helper-size);\n line-height: var(--pa-font-label-helper-line-height);\n font-weight: var(--pa-font-label-helper-weight);\n color: var(--pa-color-text-secondary-gray);\n}\n\n.pa-select__message--error {\n color: var(--pa-color-error);\n}\n\n.pa-select__required {\n margin-left: var(--pa-space-3xs);\n color: var(--pa-color-error);\n}\n\n.pa-select--readonly .pa-select__field {\n background: var(--pa-color-bg-primary-light-40);\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n.pa-select--readonly .pa-select__field:hover {\n border-color: var(--pa-color-bg-secondary-light-50);\n}\n.pa-select--readonly .pa-select__control {\n cursor: not-allowed;\n}\n</style>\n"],"names":["props","__props","model","_useModel","generatedId","useId","inputId","computed","messageId","errorActive","validActive","errorMessage","helperMessage","message","placeholderShown","_createElementBlock","_normalizeClass","_hoisted_2","_createElementVNode","_hoisted_3","$event","_hoisted_5","_toDisplayString","_Fragment","_renderList","opt","_hoisted_6","_createVNode","PaIcon","_hoisted_7"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;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B,UAAUA,EAAA;AAAA,UACV,MAAMA,EAAA;AAAA,UACN,cAAcA,EAAA;AAAA,UACd,iBAAeA,EAAA,YAAY;AAAA,UAC3B,gBAAcQ,EAAA,SAAe;AAAA,UAC7B,oBAAkBI,EAAA,QAAUL,EAAA,QAAY;AAAA,UACzC,OAAM;AAAA,QAAA;UAEQP,EAAA,oBAAdc,EAA8E,UAA9EM,GAA8EC,EAAvBrB,EAAA,WAAW,GAAA,CAAA;kBAClEc,EAOSQ,GAAA,MAAAC,EANOvB,EAAA,SAAO,CAAdwB,YADTV,EAOS,UAAA;AAAA,YALN,KAAKU,EAAI;AAAA,YACT,OAAOA,EAAI;AAAA,YACX,UAAUA,EAAI;AAAA,UAAA,GAEZH,EAAAG,EAAI,KAAK,GAAA,GAAAC,CAAA;;cAjBLxB,EAAA,KAAK;AAAA,QAAA;QAoBhByB,EAAoEC,GAAA;AAAA,UAA5D,MAAK;AAAA,UAAgB,MAAK;AAAA,UAAK,OAAM;AAAA,QAAA;;MAGvCf,EAAA,cADRE,EAMM,OAAA;AAAA;QAJH,IAAIP,EAAA;AAAA,QACJ,+DAA6DC,EAAA,OAAW,CAAA;AAAA,MAAA,KAEtEI,EAAA,KAAO,GAAA,IAAAgB,CAAA;;;;"}
@@ -2,7 +2,7 @@ import o from "./PaTabs.vue2.js";
2
2
  import { PaTabsKey as f } from "./PaTabs.vue2.js";
3
3
  /* empty css */
4
4
  import a from "../../_virtual/_plugin-vue_export-helper.js";
5
- const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-bb2485e5"]]);
5
+ const m = /* @__PURE__ */ a(o, [["__scopeId", "data-v-8560e34a"]]);
6
6
  export {
7
7
  f as PaTabsKey,
8
8
  m as default