@linyao.tw/ui 1.0.0 → 1.2.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 (178) hide show
  1. package/README.md +9 -1
  2. package/dist/components/date-time/calendar.js +8 -6
  3. package/dist/components/date-time/calendar.js.map +1 -1
  4. package/dist/components/date-time/date-field.js +10 -8
  5. package/dist/components/date-time/date-field.js.map +1 -1
  6. package/dist/components/date-time/date-picker.js +8 -6
  7. package/dist/components/date-time/date-picker.js.map +1 -1
  8. package/dist/components/date-time/date-range-picker.js +8 -6
  9. package/dist/components/date-time/date-range-picker.js.map +1 -1
  10. package/dist/components/date-time/index.js +1 -1
  11. package/dist/components/date-time/shared.d.ts +0 -1
  12. package/dist/components/date-time/shared.js +7 -9
  13. package/dist/components/date-time/shared.js.map +1 -1
  14. package/dist/components/date-time/time-field.js +8 -6
  15. package/dist/components/date-time/time-field.js.map +1 -1
  16. package/dist/components/feedback/alert.js +35 -34
  17. package/dist/components/feedback/alert.js.map +1 -1
  18. package/dist/components/feedback/banner.js +15 -14
  19. package/dist/components/feedback/banner.js.map +1 -1
  20. package/dist/components/feedback/empty-state.d.ts +2 -1
  21. package/dist/components/feedback/empty-state.js +31 -31
  22. package/dist/components/feedback/empty-state.js.map +1 -1
  23. package/dist/components/feedback/feedback.types.d.ts +0 -1
  24. package/dist/components/feedback/feedback.types.js +3 -5
  25. package/dist/components/feedback/feedback.types.js.map +1 -1
  26. package/dist/components/feedback/index.d.ts +8 -8
  27. package/dist/components/feedback/meter.js +21 -21
  28. package/dist/components/feedback/meter.js.map +1 -1
  29. package/dist/components/feedback/progress.js +21 -21
  30. package/dist/components/feedback/progress.js.map +1 -1
  31. package/dist/components/feedback/skeleton.js +11 -11
  32. package/dist/components/feedback/skeleton.js.map +1 -1
  33. package/dist/components/feedback/spinner.js +25 -25
  34. package/dist/components/feedback/spinner.js.map +1 -1
  35. package/dist/components/feedback/toast.js +23 -21
  36. package/dist/components/feedback/toast.js.map +1 -1
  37. package/dist/components/forms/{CodeField.d.ts → code-field.d.ts} +1 -1
  38. package/dist/components/forms/code-field.js +66 -0
  39. package/dist/components/forms/code-field.js.map +1 -0
  40. package/dist/components/forms/{FileUpload.d.ts → file-upload.d.ts} +1 -1
  41. package/dist/components/forms/{FileUpload.js → file-upload.js} +128 -111
  42. package/dist/components/forms/file-upload.js.map +1 -0
  43. package/dist/components/forms/index.d.ts +6 -6
  44. package/dist/components/forms/{Input.js → input.js} +4 -3
  45. package/dist/components/forms/input.js.map +1 -0
  46. package/dist/components/forms/internal.d.ts +0 -2
  47. package/dist/components/forms/internal.js +22 -25
  48. package/dist/components/forms/internal.js.map +1 -1
  49. package/dist/components/forms/number-field.js +74 -0
  50. package/dist/components/forms/number-field.js.map +1 -0
  51. package/dist/components/forms/otp-field.js +58 -0
  52. package/dist/components/forms/otp-field.js.map +1 -0
  53. package/dist/components/forms/{TextField.d.ts → text-field.d.ts} +5 -0
  54. package/dist/components/forms/text-field.js +201 -0
  55. package/dist/components/forms/text-field.js.map +1 -0
  56. package/dist/components/foundations/{Avatar.js → avatar.js} +13 -10
  57. package/dist/components/foundations/avatar.js.map +1 -0
  58. package/dist/components/foundations/{Badge.d.ts → badge.d.ts} +1 -1
  59. package/dist/components/foundations/{Badge.js → badge.js} +4 -3
  60. package/dist/components/foundations/badge.js.map +1 -0
  61. package/dist/components/foundations/{Button.js → button.js} +4 -3
  62. package/dist/components/foundations/button.js.map +1 -0
  63. package/dist/components/foundations/{Card.d.ts → card.d.ts} +9 -2
  64. package/dist/components/foundations/{Card.js → card.js} +6 -5
  65. package/dist/components/foundations/card.js.map +1 -0
  66. package/dist/components/foundations/{IconButton.d.ts → icon-button.d.ts} +2 -8
  67. package/dist/components/foundations/{IconButton.js → icon-button.js} +5 -4
  68. package/dist/components/foundations/icon-button.js.map +1 -0
  69. package/dist/components/foundations/index.d.ts +9 -9
  70. package/dist/components/foundations/{Link.d.ts → link.d.ts} +1 -1
  71. package/dist/components/foundations/link.js +47 -0
  72. package/dist/components/foundations/link.js.map +1 -0
  73. package/dist/components/foundations/{ListCell.d.ts → list-cell.d.ts} +1 -8
  74. package/dist/components/foundations/{ListCell.js → list-cell.js} +4 -3
  75. package/dist/components/foundations/list-cell.js.map +1 -0
  76. package/dist/components/foundations/{SectionHeading.d.ts → section-heading.d.ts} +5 -2
  77. package/dist/components/foundations/{SectionHeading.js → section-heading.js} +4 -3
  78. package/dist/components/foundations/section-heading.js.map +1 -0
  79. package/dist/components/foundations/{Separator.js → separator.js} +4 -3
  80. package/dist/components/foundations/separator.js.map +1 -0
  81. package/dist/components/navigation-data/breadcrumb-pagination.js +89 -81
  82. package/dist/components/navigation-data/breadcrumb-pagination.js.map +1 -1
  83. package/dist/components/navigation-data/command-palette.d.ts +26 -0
  84. package/dist/components/navigation-data/command-palette.js +101 -72
  85. package/dist/components/navigation-data/command-palette.js.map +1 -1
  86. package/dist/components/navigation-data/header-tab-bar.js +50 -46
  87. package/dist/components/navigation-data/header-tab-bar.js.map +1 -1
  88. package/dist/components/navigation-data/index.d.ts +7 -7
  89. package/dist/components/navigation-data/menubar-toolbar.js +2 -1
  90. package/dist/components/navigation-data/menubar-toolbar.js.map +1 -1
  91. package/dist/components/navigation-data/navigation-menu.js +2 -1
  92. package/dist/components/navigation-data/navigation-menu.js.map +1 -1
  93. package/dist/components/navigation-data/scroll-area.js +2 -1
  94. package/dist/components/navigation-data/scroll-area.js.map +1 -1
  95. package/dist/components/navigation-data/table-collection.d.ts +12 -3
  96. package/dist/components/navigation-data/table-collection.js +12 -9
  97. package/dist/components/navigation-data/table-collection.js.map +1 -1
  98. package/dist/components/overlays/dialog.d.ts +23 -3
  99. package/dist/components/overlays/dialog.js +138 -130
  100. package/dist/components/overlays/dialog.js.map +1 -1
  101. package/dist/components/overlays/disclosure.js +2 -1
  102. package/dist/components/overlays/disclosure.js.map +1 -1
  103. package/dist/components/overlays/drawer.d.ts +9 -2
  104. package/dist/components/overlays/drawer.js +158 -151
  105. package/dist/components/overlays/drawer.js.map +1 -1
  106. package/dist/components/overlays/floating.js +116 -113
  107. package/dist/components/overlays/floating.js.map +1 -1
  108. package/dist/components/overlays/index.d.ts +4 -4
  109. package/dist/components/selection/combobox.js +94 -93
  110. package/dist/components/selection/combobox.js.map +1 -1
  111. package/dist/components/selection/controls.d.ts +4 -1
  112. package/dist/components/selection/controls.js +141 -118
  113. package/dist/components/selection/controls.js.map +1 -1
  114. package/dist/components/selection/menu.js +121 -121
  115. package/dist/components/selection/menu.js.map +1 -1
  116. package/dist/components/selection/select.js +108 -107
  117. package/dist/components/selection/select.js.map +1 -1
  118. package/dist/fonts.css +13 -0
  119. package/dist/index.d.ts +1 -0
  120. package/dist/index.js +39 -33
  121. package/dist/internal/accessible-name.d.ts +12 -0
  122. package/dist/internal/class-names.d.ts +12 -0
  123. package/dist/{components/selection/classnames.js → internal/class-names.js} +4 -3
  124. package/dist/internal/class-names.js.map +1 -0
  125. package/dist/internal/index.d.ts +3 -0
  126. package/dist/{components/foundations/shared.d.ts → internal/render.d.ts} +2 -1
  127. package/dist/intl/index.d.ts +3 -0
  128. package/dist/intl/linyao-provider.d.ts +38 -0
  129. package/dist/intl/linyao-provider.js +27 -0
  130. package/dist/intl/linyao-provider.js.map +1 -0
  131. package/dist/intl/messages.d.ts +48 -0
  132. package/dist/intl/messages.js +81 -0
  133. package/dist/intl/messages.js.map +1 -0
  134. package/dist/intl/provider.d.ts +18 -0
  135. package/dist/intl/provider.js +31 -0
  136. package/dist/intl/provider.js.map +1 -0
  137. package/dist/styles.css +1 -1
  138. package/package.json +6 -4
  139. package/dist/components/feedback/feedback.module.js +0 -42
  140. package/dist/components/feedback/feedback.module.js.map +0 -1
  141. package/dist/components/forms/CodeField.js +0 -63
  142. package/dist/components/forms/CodeField.js.map +0 -1
  143. package/dist/components/forms/FileUpload.js.map +0 -1
  144. package/dist/components/forms/Input.js.map +0 -1
  145. package/dist/components/forms/NumberField.js +0 -71
  146. package/dist/components/forms/NumberField.js.map +0 -1
  147. package/dist/components/forms/OTPField.js +0 -54
  148. package/dist/components/forms/OTPField.js.map +0 -1
  149. package/dist/components/forms/TextField.js +0 -199
  150. package/dist/components/forms/TextField.js.map +0 -1
  151. package/dist/components/foundations/Avatar.js.map +0 -1
  152. package/dist/components/foundations/Badge.js.map +0 -1
  153. package/dist/components/foundations/Button.js.map +0 -1
  154. package/dist/components/foundations/Card.js.map +0 -1
  155. package/dist/components/foundations/IconButton.js.map +0 -1
  156. package/dist/components/foundations/Link.js +0 -40
  157. package/dist/components/foundations/Link.js.map +0 -1
  158. package/dist/components/foundations/ListCell.js.map +0 -1
  159. package/dist/components/foundations/SectionHeading.js.map +0 -1
  160. package/dist/components/foundations/Separator.js.map +0 -1
  161. package/dist/components/foundations/shared.js +0 -8
  162. package/dist/components/foundations/shared.js.map +0 -1
  163. package/dist/components/navigation-data/utils.d.ts +0 -2
  164. package/dist/components/navigation-data/utils.js +0 -11
  165. package/dist/components/navigation-data/utils.js.map +0 -1
  166. package/dist/components/overlays/class-names.d.ts +0 -6
  167. package/dist/components/overlays/class-names.js +0 -11
  168. package/dist/components/overlays/class-names.js.map +0 -1
  169. package/dist/components/selection/classnames.d.ts +0 -4
  170. package/dist/components/selection/classnames.js.map +0 -1
  171. package/dist/components/selection/selection.module.js +0 -51
  172. package/dist/components/selection/selection.module.js.map +0 -1
  173. /package/dist/components/forms/{Input.d.ts → input.d.ts} +0 -0
  174. /package/dist/components/forms/{NumberField.d.ts → number-field.d.ts} +0 -0
  175. /package/dist/components/forms/{OTPField.d.ts → otp-field.d.ts} +0 -0
  176. /package/dist/components/foundations/{Avatar.d.ts → avatar.d.ts} +0 -0
  177. /package/dist/components/foundations/{Button.d.ts → button.d.ts} +0 -0
  178. /package/dist/components/foundations/{Separator.d.ts → separator.d.ts} +0 -0
@@ -1,119 +1,119 @@
1
- import e from "./selection.module.js";
2
- import { mergeStateClassName as t } from "./classnames.js";
3
- import { forwardRef as n } from "react";
4
- import { jsx as r } from "react/jsx-runtime";
5
- import { Separator as i } from "@base-ui/react/separator";
6
- import { CheckIcon as a } from "@phosphor-icons/react/dist/csr/Check";
7
- import { Menu as o } from "@base-ui/react/menu";
8
- import { ContextMenu as s } from "@base-ui/react/context-menu";
1
+ "use client";
2
+ import { withStateClassName as e } from "../../internal/class-names.js";
3
+ import { forwardRef as t } from "react";
4
+ import { jsx as n } from "react/jsx-runtime";
5
+ import { Separator as r } from "@base-ui/react/separator";
6
+ import { CheckIcon as i } from "@phosphor-icons/react/dist/csr/Check";
7
+ import { Menu as a } from "@base-ui/react/menu";
8
+ import { ContextMenu as o } from "@base-ui/react/context-menu";
9
9
  //#region src/components/selection/menu.tsx
10
- var c = n(function({ className: n, ...i }, a) {
11
- return /* @__PURE__ */ r(o.Trigger, {
12
- ...i,
13
- className: t(e.menuTrigger, n),
14
- ref: a
10
+ var s = t(function({ className: t, ...r }, i) {
11
+ return /* @__PURE__ */ n(a.Trigger, {
12
+ ...r,
13
+ className: e("lyds-menu__trigger", t),
14
+ ref: i
15
15
  });
16
- }), l = n(function({ className: n, ...i }, a) {
17
- return /* @__PURE__ */ r(o.Positioner, {
18
- ...i,
19
- className: t(e.positioner, n),
20
- ref: a
16
+ }), c = t(function({ className: t, ...r }, i) {
17
+ return /* @__PURE__ */ n(a.Positioner, {
18
+ ...r,
19
+ className: e("lyds-listbox__positioner", t),
20
+ ref: i
21
21
  });
22
- }), u = n(function({ className: n, ...i }, a) {
23
- return /* @__PURE__ */ r(o.Popup, {
24
- ...i,
25
- className: t(e.menuPopup, n),
26
- ref: a
22
+ }), l = t(function({ className: t, ...r }, i) {
23
+ return /* @__PURE__ */ n(a.Popup, {
24
+ ...r,
25
+ className: e("lyds-menu__popup", t),
26
+ ref: i
27
27
  });
28
- }), d = n(function({ className: n, ...i }, a) {
29
- return /* @__PURE__ */ r(o.Item, {
30
- ...i,
31
- className: t(e.menuItem, n),
32
- ref: a
28
+ }), u = t(function({ className: t, ...r }, i) {
29
+ return /* @__PURE__ */ n(a.Item, {
30
+ ...r,
31
+ className: e("lyds-menu__item", t),
32
+ ref: i
33
33
  });
34
- }), f = n(function({ className: n, ...i }, a) {
35
- return /* @__PURE__ */ r(o.LinkItem, {
36
- ...i,
37
- className: t(e.menuItem, n),
38
- ref: a
34
+ }), d = t(function({ className: t, ...r }, i) {
35
+ return /* @__PURE__ */ n(a.LinkItem, {
36
+ ...r,
37
+ className: e("lyds-menu__item", t),
38
+ ref: i
39
39
  });
40
- }), p = n(function({ className: n, ...i }, a) {
41
- return /* @__PURE__ */ r(o.CheckboxItem, {
42
- ...i,
43
- className: t(e.menuItem, n),
44
- ref: a
40
+ }), f = t(function({ className: t, ...r }, i) {
41
+ return /* @__PURE__ */ n(a.CheckboxItem, {
42
+ ...r,
43
+ className: e("lyds-menu__item", t),
44
+ ref: i
45
45
  });
46
- }), m = n(function({ children: n, className: i, ...s }, c) {
47
- return /* @__PURE__ */ r(o.CheckboxItemIndicator, {
48
- ...s,
49
- className: t(e.menuItemIndicator, i),
50
- ref: c,
51
- children: n ?? /* @__PURE__ */ r(a, {
46
+ }), p = t(function({ children: t, className: r, ...o }, s) {
47
+ return /* @__PURE__ */ n(a.CheckboxItemIndicator, {
48
+ ...o,
49
+ className: e("lyds-menu__item-indicator", r),
50
+ ref: s,
51
+ children: t ?? /* @__PURE__ */ n(i, {
52
52
  "aria-hidden": "true",
53
53
  weight: "bold"
54
54
  })
55
55
  });
56
- }), h = n(function({ className: n, ...i }, a) {
57
- return /* @__PURE__ */ r(o.RadioItem, {
58
- ...i,
59
- className: t(e.menuItem, n),
60
- ref: a
56
+ }), m = t(function({ className: t, ...r }, i) {
57
+ return /* @__PURE__ */ n(a.RadioItem, {
58
+ ...r,
59
+ className: e("lyds-menu__item", t),
60
+ ref: i
61
61
  });
62
- }), g = n(function({ children: n, className: i, ...s }, c) {
63
- return /* @__PURE__ */ r(o.RadioItemIndicator, {
64
- ...s,
65
- className: t(e.menuItemIndicator, i),
66
- ref: c,
67
- children: n ?? /* @__PURE__ */ r(a, {
62
+ }), h = t(function({ children: t, className: r, ...o }, s) {
63
+ return /* @__PURE__ */ n(a.RadioItemIndicator, {
64
+ ...o,
65
+ className: e("lyds-menu__item-indicator", r),
66
+ ref: s,
67
+ children: t ?? /* @__PURE__ */ n(i, {
68
68
  "aria-hidden": "true",
69
69
  "data-lyds-glyph": "check",
70
70
  weight: "bold"
71
71
  })
72
72
  });
73
- }), _ = n(function({ className: n, ...i }, a) {
74
- return /* @__PURE__ */ r(o.GroupLabel, {
75
- ...i,
76
- className: t(e.groupLabel, n),
77
- ref: a
78
- });
79
- }), v = n(function({ className: n, ...a }, o) {
80
- return /* @__PURE__ */ r(i, {
81
- ...a,
82
- className: t(e.separator, n),
83
- ref: o
73
+ }), g = t(function({ className: t, ...r }, i) {
74
+ return /* @__PURE__ */ n(a.GroupLabel, {
75
+ ...r,
76
+ className: e("lyds-listbox__group-label", t),
77
+ ref: i
84
78
  });
85
- }), y = n(function({ className: n, ...i }, a) {
86
- return /* @__PURE__ */ r(o.SubmenuTrigger, {
79
+ }), _ = t(function({ className: t, ...i }, a) {
80
+ return /* @__PURE__ */ n(r, {
87
81
  ...i,
88
- className: t(e.menuItem, n),
82
+ className: e("lyds-listbox__separator", t),
89
83
  ref: a
90
84
  });
91
- }), b = {
92
- Arrow: o.Arrow,
93
- Backdrop: o.Backdrop,
94
- CheckboxItem: p,
95
- CheckboxItemIndicator: m,
96
- Group: o.Group,
97
- GroupLabel: _,
98
- Handle: o.Handle,
99
- Item: d,
100
- LinkItem: f,
101
- Popup: u,
102
- Portal: o.Portal,
103
- Positioner: l,
104
- RadioGroup: o.RadioGroup,
105
- RadioItem: h,
106
- RadioItemIndicator: g,
107
- Root: o.Root,
108
- Separator: v,
109
- SubmenuRoot: o.SubmenuRoot,
110
- SubmenuTrigger: y,
111
- Trigger: c,
112
- Viewport: o.Viewport,
113
- createHandle: o.createHandle
114
- }, x = b, S = b, C = n(function({ className: n, onKeyDown: i, ...a }, o) {
115
- let c = (e) => {
116
- if (i?.(e), e.defaultPrevented || e.key !== "F10" || !e.shiftKey) return;
85
+ }), v = t(function({ className: t, ...r }, i) {
86
+ return /* @__PURE__ */ n(a.SubmenuTrigger, {
87
+ ...r,
88
+ className: e("lyds-menu__item", t),
89
+ ref: i
90
+ });
91
+ }), y = {
92
+ Arrow: a.Arrow,
93
+ Backdrop: a.Backdrop,
94
+ CheckboxItem: f,
95
+ CheckboxItemIndicator: p,
96
+ Group: a.Group,
97
+ GroupLabel: g,
98
+ Handle: a.Handle,
99
+ Item: u,
100
+ LinkItem: d,
101
+ Popup: l,
102
+ Portal: a.Portal,
103
+ Positioner: c,
104
+ RadioGroup: a.RadioGroup,
105
+ RadioItem: m,
106
+ RadioItemIndicator: h,
107
+ Root: a.Root,
108
+ Separator: _,
109
+ SubmenuRoot: a.SubmenuRoot,
110
+ SubmenuTrigger: v,
111
+ Trigger: s,
112
+ Viewport: a.Viewport,
113
+ createHandle: a.createHandle
114
+ }, b = y, x = y, S = t(function({ className: t, onKeyDown: r, ...i }, a) {
115
+ let s = (e) => {
116
+ if (r?.(e), e.defaultPrevented || e.key !== "F10" || !e.shiftKey) return;
117
117
  e.preventDefault();
118
118
  let t = e.currentTarget, n = t.getBoundingClientRect();
119
119
  t.dispatchEvent(new globalThis.MouseEvent("contextmenu", {
@@ -124,34 +124,34 @@ var c = n(function({ className: n, ...i }, a) {
124
124
  clientY: n.top + n.height / 2
125
125
  }));
126
126
  };
127
- return /* @__PURE__ */ r(s.Trigger, {
128
- ...a,
129
- className: t(e.contextTrigger, n),
130
- ref: o,
131
- onKeyDown: c
127
+ return /* @__PURE__ */ n(o.Trigger, {
128
+ ...i,
129
+ className: e("lyds-context-menu__trigger", t),
130
+ ref: a,
131
+ onKeyDown: s
132
132
  });
133
- }), w = {
134
- Arrow: s.Arrow,
135
- Backdrop: s.Backdrop,
136
- CheckboxItem: p,
137
- CheckboxItemIndicator: m,
138
- Group: s.Group,
139
- GroupLabel: _,
140
- Item: d,
141
- LinkItem: f,
142
- Popup: u,
143
- Portal: s.Portal,
144
- Positioner: l,
145
- RadioGroup: s.RadioGroup,
146
- RadioItem: h,
147
- RadioItemIndicator: g,
148
- Root: s.Root,
149
- Separator: v,
150
- SubmenuRoot: s.SubmenuRoot,
151
- SubmenuTrigger: y,
152
- Trigger: C
133
+ }), C = {
134
+ Arrow: o.Arrow,
135
+ Backdrop: o.Backdrop,
136
+ CheckboxItem: f,
137
+ CheckboxItemIndicator: p,
138
+ Group: o.Group,
139
+ GroupLabel: g,
140
+ Item: u,
141
+ LinkItem: d,
142
+ Popup: l,
143
+ Portal: o.Portal,
144
+ Positioner: c,
145
+ RadioGroup: o.RadioGroup,
146
+ RadioItem: m,
147
+ RadioItemIndicator: h,
148
+ Root: o.Root,
149
+ Separator: _,
150
+ SubmenuRoot: o.SubmenuRoot,
151
+ SubmenuTrigger: v,
152
+ Trigger: S
153
153
  };
154
154
  //#endregion
155
- export { w as ContextMenu, C as ContextMenuTrigger, x as DropdownMenu, S as Menu, p as MenuCheckboxItem, m as MenuCheckboxItemIndicator, _ as MenuGroupLabel, d as MenuItem, f as MenuLinkItem, u as MenuPopup, l as MenuPositioner, h as MenuRadioItem, g as MenuRadioItemIndicator, v as MenuSeparator, y as MenuSubmenuTrigger, c as MenuTrigger };
155
+ export { C as ContextMenu, S as ContextMenuTrigger, b as DropdownMenu, x as Menu, f as MenuCheckboxItem, p as MenuCheckboxItemIndicator, g as MenuGroupLabel, u as MenuItem, d as MenuLinkItem, l as MenuPopup, c as MenuPositioner, m as MenuRadioItem, h as MenuRadioItemIndicator, _ as MenuSeparator, v as MenuSubmenuTrigger, s as MenuTrigger };
156
156
 
157
157
  //# sourceMappingURL=menu.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"menu.js","names":[],"sources":["../../../src/components/selection/menu.tsx"],"sourcesContent":["import { ContextMenu as BaseContextMenu, type ContextMenuTriggerProps } from \"@base-ui/react/context-menu\";\nimport {\n\tMenu as BaseMenu,\n\ttype MenuCheckboxItemIndicatorProps,\n\ttype MenuCheckboxItemProps,\n\ttype MenuGroupLabelProps,\n\ttype MenuItemProps,\n\ttype MenuLinkItemProps,\n\ttype MenuPopupProps,\n\ttype MenuPositionerProps,\n\ttype MenuRadioItemIndicatorProps,\n\ttype MenuRadioItemProps,\n\ttype MenuSubmenuTriggerProps,\n\ttype MenuTriggerProps\n} from \"@base-ui/react/menu\";\nimport { Separator as BaseSeparator, type SeparatorProps } from \"@base-ui/react/separator\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef } from \"react\";\n\nimport { mergeStateClassName } from \"./classnames\";\nimport styles from \"./selection.module.css\";\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger({ className, ...props }, ref) {\n\treturn <BaseMenu.Trigger {...props} className={mergeStateClassName(styles.menuTrigger, className)} ref={ref} />;\n});\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(function MenuPositioner({ className, ...props }, ref) {\n\treturn <BaseMenu.Positioner {...props} className={mergeStateClassName(styles.positioner, className)} ref={ref} />;\n});\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup({ className, ...props }, ref) {\n\treturn <BaseMenu.Popup {...props} className={mergeStateClassName(styles.menuPopup, className)} ref={ref} />;\n});\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem({ className, ...props }, ref) {\n\treturn <BaseMenu.Item {...props} className={mergeStateClassName(styles.menuItem, className)} ref={ref} />;\n});\n\nexport const MenuLinkItem = forwardRef<HTMLAnchorElement, MenuLinkItemProps>(function MenuLinkItem({ className, ...props }, ref) {\n\treturn <BaseMenu.LinkItem {...props} className={mergeStateClassName(styles.menuItem, className)} ref={ref} />;\n});\n\nexport const MenuCheckboxItem = forwardRef<HTMLElement, MenuCheckboxItemProps>(function MenuCheckboxItem({ className, ...props }, ref) {\n\treturn <BaseMenu.CheckboxItem {...props} className={mergeStateClassName(styles.menuItem, className)} ref={ref} />;\n});\n\nexport const MenuCheckboxItemIndicator = forwardRef<HTMLSpanElement, MenuCheckboxItemIndicatorProps>(function MenuCheckboxItemIndicator({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseMenu.CheckboxItemIndicator {...props} className={mergeStateClassName(styles.menuItemIndicator, className)} ref={ref}>\n\t\t\t{children ?? <CheckIcon aria-hidden=\"true\" weight=\"bold\" />}\n\t\t</BaseMenu.CheckboxItemIndicator>\n\t);\n});\n\nexport const MenuRadioItem = forwardRef<HTMLElement, MenuRadioItemProps>(function MenuRadioItem({ className, ...props }, ref) {\n\treturn <BaseMenu.RadioItem {...props} className={mergeStateClassName(styles.menuItem, className)} ref={ref} />;\n});\n\nexport const MenuRadioItemIndicator = forwardRef<HTMLSpanElement, MenuRadioItemIndicatorProps>(function MenuRadioItemIndicator({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseMenu.RadioItemIndicator {...props} className={mergeStateClassName(styles.menuItemIndicator, className)} ref={ref}>\n\t\t\t{children ?? <CheckIcon aria-hidden=\"true\" data-lyds-glyph=\"check\" weight=\"bold\" />}\n\t\t</BaseMenu.RadioItemIndicator>\n\t);\n});\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(function MenuGroupLabel({ className, ...props }, ref) {\n\treturn <BaseMenu.GroupLabel {...props} className={mergeStateClassName(styles.groupLabel, className)} ref={ref} />;\n});\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, SeparatorProps>(function MenuSeparator({ className, ...props }, ref) {\n\treturn <BaseSeparator {...props} className={mergeStateClassName(styles.separator, className)} ref={ref} />;\n});\n\nexport const MenuSubmenuTrigger = forwardRef<HTMLElement, MenuSubmenuTriggerProps>(function MenuSubmenuTrigger({ className, ...props }, ref) {\n\treturn <BaseMenu.SubmenuTrigger {...props} className={mergeStateClassName(styles.menuItem, className)} ref={ref} />;\n});\n\nconst menuParts = {\n\tArrow: BaseMenu.Arrow,\n\tBackdrop: BaseMenu.Backdrop,\n\tCheckboxItem: MenuCheckboxItem,\n\tCheckboxItemIndicator: MenuCheckboxItemIndicator,\n\tGroup: BaseMenu.Group,\n\tGroupLabel: MenuGroupLabel,\n\tHandle: BaseMenu.Handle,\n\tItem: MenuItem,\n\tLinkItem: MenuLinkItem,\n\tPopup: MenuPopup,\n\tPortal: BaseMenu.Portal,\n\tPositioner: MenuPositioner,\n\tRadioGroup: BaseMenu.RadioGroup,\n\tRadioItem: MenuRadioItem,\n\tRadioItemIndicator: MenuRadioItemIndicator,\n\tRoot: BaseMenu.Root,\n\tSeparator: MenuSeparator,\n\tSubmenuRoot: BaseMenu.SubmenuRoot,\n\tSubmenuTrigger: MenuSubmenuTrigger,\n\tTrigger: MenuTrigger,\n\tViewport: BaseMenu.Viewport,\n\tcreateHandle: BaseMenu.createHandle\n} as const;\n\n/** 由按鈕觸發的應用程式選單。 */\nexport const DropdownMenu = menuParts;\n\n/** DropdownMenu 的別名,名稱與 Base UI 詞彙一致。 */\nexport const Menu = menuParts;\n\nexport const ContextMenuTrigger = forwardRef<HTMLDivElement, ContextMenuTriggerProps>(function ContextMenuTrigger({ className, onKeyDown, ...props }, ref) {\n\tconst handleKeyDown: NonNullable<ContextMenuTriggerProps[\"onKeyDown\"]> = event => {\n\t\tonKeyDown?.(event);\n\t\tif (event.defaultPrevented || event.key !== \"F10\" || !event.shiftKey) return;\n\n\t\tevent.preventDefault();\n\t\tconst target = event.currentTarget;\n\t\tconst bounds = target.getBoundingClientRect();\n\t\ttarget.dispatchEvent(\n\t\t\tnew globalThis.MouseEvent(\"contextmenu\", {\n\t\t\t\tbubbles: true,\n\t\t\t\tbutton: 2,\n\t\t\t\tcancelable: true,\n\t\t\t\tclientX: bounds.left + bounds.width / 2,\n\t\t\t\tclientY: bounds.top + bounds.height / 2\n\t\t\t})\n\t\t);\n\t};\n\n\treturn <BaseContextMenu.Trigger {...props} className={mergeStateClassName(styles.contextTrigger, className)} ref={ref} onKeyDown={handleKeyDown} />;\n});\n\nexport const ContextMenu = {\n\tArrow: BaseContextMenu.Arrow,\n\tBackdrop: BaseContextMenu.Backdrop,\n\tCheckboxItem: MenuCheckboxItem,\n\tCheckboxItemIndicator: MenuCheckboxItemIndicator,\n\tGroup: BaseContextMenu.Group,\n\tGroupLabel: MenuGroupLabel,\n\tItem: MenuItem,\n\tLinkItem: MenuLinkItem,\n\tPopup: MenuPopup,\n\tPortal: BaseContextMenu.Portal,\n\tPositioner: MenuPositioner,\n\tRadioGroup: BaseContextMenu.RadioGroup,\n\tRadioItem: MenuRadioItem,\n\tRadioItemIndicator: MenuRadioItemIndicator,\n\tRoot: BaseContextMenu.Root,\n\tSeparator: MenuSeparator,\n\tSubmenuRoot: BaseContextMenu.SubmenuRoot,\n\tSubmenuTrigger: MenuSubmenuTrigger,\n\tTrigger: ContextMenuTrigger\n} as const;\n"],"mappings":";;;;;;;;;AAsBA,IAAa,IAAc,EAAgD,SAAqB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC7H,OAAO,kBAAC,EAAS,SAAV;EAAkB,GAAI;EAAO,WAAW,EAAoB,EAAO,aAAa,CAAS;EAAQ;CAAM,CAAA;AAC/G,CAAC,GAEY,IAAiB,EAAgD,SAAwB,EAAE,cAAW,GAAG,KAAS,GAAK;CACnI,OAAO,kBAAC,EAAS,YAAV;EAAqB,GAAI;EAAO,WAAW,EAAoB,EAAO,YAAY,CAAS;EAAQ;CAAM,CAAA;AACjH,CAAC,GAEY,IAAY,EAA2C,SAAmB,EAAE,cAAW,GAAG,KAAS,GAAK;CACpH,OAAO,kBAAC,EAAS,OAAV;EAAgB,GAAI;EAAO,WAAW,EAAoB,EAAO,WAAW,CAAS;EAAQ;CAAM,CAAA;AAC3G,CAAC,GAEY,IAAW,EAAuC,SAAkB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC9G,OAAO,kBAAC,EAAS,MAAV;EAAe,GAAI;EAAO,WAAW,EAAoB,EAAO,UAAU,CAAS;EAAQ;CAA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,CAAC,GAEY,IAAc;CAC1B,OAAO,EAAgB;CACvB,UAAU,EAAgB;CAC1B,cAAc;CACd,uBAAuB;CACvB,OAAO,EAAgB;CACvB,YAAY;CACZ,MAAM;CACN,UAAU;CACV,OAAO;CACP,QAAQ,EAAgB;CACxB,YAAY;CACZ,YAAY,EAAgB;CAC5B,WAAW;CACX,oBAAoB;CACpB,MAAM,EAAgB;CACtB,WAAW;CACX,aAAa,EAAgB;CAC7B,gBAAgB;CAChB,SAAS;AACV"}
1
+ {"version":3,"file":"menu.js","names":[],"sources":["../../../src/components/selection/menu.tsx"],"sourcesContent":["import { ContextMenu as BaseContextMenu, type ContextMenuTriggerProps } from \"@base-ui/react/context-menu\";\nimport {\n\tMenu as BaseMenu,\n\ttype MenuCheckboxItemIndicatorProps,\n\ttype MenuCheckboxItemProps,\n\ttype MenuGroupLabelProps,\n\ttype MenuItemProps,\n\ttype MenuLinkItemProps,\n\ttype MenuPopupProps,\n\ttype MenuPositionerProps,\n\ttype MenuRadioItemIndicatorProps,\n\ttype MenuRadioItemProps,\n\ttype MenuSubmenuTriggerProps,\n\ttype MenuTriggerProps\n} from \"@base-ui/react/menu\";\nimport { Separator as BaseSeparator, type SeparatorProps } from \"@base-ui/react/separator\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef } from \"react\";\n\nimport { withStateClassName } from \"@/internal\";\n\nexport const MenuTrigger = forwardRef<HTMLButtonElement, MenuTriggerProps>(function MenuTrigger({ className, ...props }, ref) {\n\treturn <BaseMenu.Trigger {...props} className={withStateClassName(\"lyds-menu__trigger\", className)} ref={ref} />;\n});\n\nexport const MenuPositioner = forwardRef<HTMLDivElement, MenuPositionerProps>(function MenuPositioner({ className, ...props }, ref) {\n\treturn <BaseMenu.Positioner {...props} className={withStateClassName(\"lyds-listbox__positioner\", className)} ref={ref} />;\n});\n\nexport const MenuPopup = forwardRef<HTMLDivElement, MenuPopupProps>(function MenuPopup({ className, ...props }, ref) {\n\treturn <BaseMenu.Popup {...props} className={withStateClassName(\"lyds-menu__popup\", className)} ref={ref} />;\n});\n\nexport const MenuItem = forwardRef<HTMLElement, MenuItemProps>(function MenuItem({ className, ...props }, ref) {\n\treturn <BaseMenu.Item {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuLinkItem = forwardRef<HTMLAnchorElement, MenuLinkItemProps>(function MenuLinkItem({ className, ...props }, ref) {\n\treturn <BaseMenu.LinkItem {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuCheckboxItem = forwardRef<HTMLElement, MenuCheckboxItemProps>(function MenuCheckboxItem({ className, ...props }, ref) {\n\treturn <BaseMenu.CheckboxItem {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuCheckboxItemIndicator = forwardRef<HTMLSpanElement, MenuCheckboxItemIndicatorProps>(function MenuCheckboxItemIndicator({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseMenu.CheckboxItemIndicator {...props} className={withStateClassName(\"lyds-menu__item-indicator\", className)} ref={ref}>\n\t\t\t{children ?? <CheckIcon aria-hidden=\"true\" weight=\"bold\" />}\n\t\t</BaseMenu.CheckboxItemIndicator>\n\t);\n});\n\nexport const MenuRadioItem = forwardRef<HTMLElement, MenuRadioItemProps>(function MenuRadioItem({ className, ...props }, ref) {\n\treturn <BaseMenu.RadioItem {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nexport const MenuRadioItemIndicator = forwardRef<HTMLSpanElement, MenuRadioItemIndicatorProps>(function MenuRadioItemIndicator({ children, className, ...props }, ref) {\n\treturn (\n\t\t<BaseMenu.RadioItemIndicator {...props} className={withStateClassName(\"lyds-menu__item-indicator\", className)} ref={ref}>\n\t\t\t{children ?? <CheckIcon aria-hidden=\"true\" data-lyds-glyph=\"check\" weight=\"bold\" />}\n\t\t</BaseMenu.RadioItemIndicator>\n\t);\n});\n\nexport const MenuGroupLabel = forwardRef<HTMLDivElement, MenuGroupLabelProps>(function MenuGroupLabel({ className, ...props }, ref) {\n\treturn <BaseMenu.GroupLabel {...props} className={withStateClassName(\"lyds-listbox__group-label\", className)} ref={ref} />;\n});\n\nexport const MenuSeparator = forwardRef<HTMLDivElement, SeparatorProps>(function MenuSeparator({ className, ...props }, ref) {\n\treturn <BaseSeparator {...props} className={withStateClassName(\"lyds-listbox__separator\", className)} ref={ref} />;\n});\n\nexport const MenuSubmenuTrigger = forwardRef<HTMLElement, MenuSubmenuTriggerProps>(function MenuSubmenuTrigger({ className, ...props }, ref) {\n\treturn <BaseMenu.SubmenuTrigger {...props} className={withStateClassName(\"lyds-menu__item\", className)} ref={ref} />;\n});\n\nconst menuParts = {\n\tArrow: BaseMenu.Arrow,\n\tBackdrop: BaseMenu.Backdrop,\n\tCheckboxItem: MenuCheckboxItem,\n\tCheckboxItemIndicator: MenuCheckboxItemIndicator,\n\tGroup: BaseMenu.Group,\n\tGroupLabel: MenuGroupLabel,\n\tHandle: BaseMenu.Handle,\n\tItem: MenuItem,\n\tLinkItem: MenuLinkItem,\n\tPopup: MenuPopup,\n\tPortal: BaseMenu.Portal,\n\tPositioner: MenuPositioner,\n\tRadioGroup: BaseMenu.RadioGroup,\n\tRadioItem: MenuRadioItem,\n\tRadioItemIndicator: MenuRadioItemIndicator,\n\tRoot: BaseMenu.Root,\n\tSeparator: MenuSeparator,\n\tSubmenuRoot: BaseMenu.SubmenuRoot,\n\tSubmenuTrigger: MenuSubmenuTrigger,\n\tTrigger: MenuTrigger,\n\tViewport: BaseMenu.Viewport,\n\tcreateHandle: BaseMenu.createHandle\n} as const;\n\n/** 由按鈕觸發的應用程式選單。 */\nexport const DropdownMenu = menuParts;\n\n/** DropdownMenu 的別名,名稱與 Base UI 詞彙一致。 */\nexport const Menu = menuParts;\n\nexport const ContextMenuTrigger = forwardRef<HTMLDivElement, ContextMenuTriggerProps>(function ContextMenuTrigger({ className, onKeyDown, ...props }, ref) {\n\tconst handleKeyDown: NonNullable<ContextMenuTriggerProps[\"onKeyDown\"]> = event => {\n\t\tonKeyDown?.(event);\n\t\tif (event.defaultPrevented || event.key !== \"F10\" || !event.shiftKey) return;\n\n\t\tevent.preventDefault();\n\t\tconst target = event.currentTarget;\n\t\tconst bounds = target.getBoundingClientRect();\n\t\ttarget.dispatchEvent(\n\t\t\tnew globalThis.MouseEvent(\"contextmenu\", {\n\t\t\t\tbubbles: true,\n\t\t\t\tbutton: 2,\n\t\t\t\tcancelable: true,\n\t\t\t\tclientX: bounds.left + bounds.width / 2,\n\t\t\t\tclientY: bounds.top + bounds.height / 2\n\t\t\t})\n\t\t);\n\t};\n\n\treturn <BaseContextMenu.Trigger {...props} className={withStateClassName(\"lyds-context-menu__trigger\", className)} ref={ref} onKeyDown={handleKeyDown} />;\n});\n\nexport const ContextMenu = {\n\tArrow: BaseContextMenu.Arrow,\n\tBackdrop: BaseContextMenu.Backdrop,\n\tCheckboxItem: MenuCheckboxItem,\n\tCheckboxItemIndicator: MenuCheckboxItemIndicator,\n\tGroup: BaseContextMenu.Group,\n\tGroupLabel: MenuGroupLabel,\n\tItem: MenuItem,\n\tLinkItem: MenuLinkItem,\n\tPopup: MenuPopup,\n\tPortal: BaseContextMenu.Portal,\n\tPositioner: MenuPositioner,\n\tRadioGroup: BaseContextMenu.RadioGroup,\n\tRadioItem: MenuRadioItem,\n\tRadioItemIndicator: MenuRadioItemIndicator,\n\tRoot: BaseContextMenu.Root,\n\tSeparator: MenuSeparator,\n\tSubmenuRoot: BaseContextMenu.SubmenuRoot,\n\tSubmenuTrigger: MenuSubmenuTrigger,\n\tTrigger: ContextMenuTrigger\n} as const;\n"],"mappings":";;;;;;;;;AAqBA,IAAa,IAAc,EAAgD,SAAqB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC7H,OAAO,kBAAC,EAAS,SAAV;EAAkB,GAAI;EAAO,WAAW,EAAmB,sBAAsB,CAAS;EAAQ;CAAM,CAAA;AAChH,CAAC,GAEY,IA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IADA,IAAY,CAAK,GACb,EAAM,oBAAoB,EAAM,QAAQ,SAAS,CAAC,EAAM,UAAU;EAEtE,EAAM,eAAe;EACrB,IAAM,IAAS,EAAM,eACf,IAAS,EAAO,sBAAsB;EAC5C,EAAO,cACN,IAAI,WAAW,WAAW,eAAe;GACxC,SAAS;GACT,QAAQ;GACR,YAAY;GACZ,SAAS,EAAO,OAAO,EAAO,QAAQ;GACtC,SAAS,EAAO,MAAM,EAAO,SAAS;EACvC,CAAC,CACF;CACD;CAEA,OAAO,kBAAC,EAAgB,SAAjB;EAAyB,GAAI;EAAO,WAAW,EAAmB,8BAA8B,CAAS;EAAQ;EAAK,WAAW;CAAgB,CAAA;AACzJ,CAAC,GAEY,IAAc;CAC1B,OAAO,EAAgB;CACvB,UAAU,EAAgB;CAC1B,cAAc;CACd,uBAAuB;CACvB,OAAO,EAAgB;CACvB,YAAY;CACZ,MAAM;CACN,UAAU;CACV,OAAO;CACP,QAAQ,EAAgB;CACxB,YAAY;CACZ,YAAY,EAAgB;CAC5B,WAAW;CACX,oBAAoB;CACpB,MAAM,EAAgB;CACtB,WAAW;CACX,aAAa,EAAgB;CAC7B,gBAAgB;CAChB,SAAS;AACV"}
@@ -1,138 +1,139 @@
1
- import e from "./selection.module.js";
2
- import { combineStateClassNames as t, mergeStateClassName as n } from "./classnames.js";
3
- import { forwardRef as r } from "react";
4
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
- import { CheckIcon as o } from "@phosphor-icons/react/dist/csr/Check";
6
- import { CaretDownIcon as s } from "@phosphor-icons/react/dist/csr/CaretDown";
7
- import { Select as c } from "@base-ui/react/select";
1
+ "use client";
2
+ import { combineStateClassNames as e, withStateClassName as t } from "../../internal/class-names.js";
3
+ import { useMessages as n } from "../../intl/provider.js";
4
+ import { forwardRef as r, useMemo as i } from "react";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
+ import { CheckIcon as s } from "@phosphor-icons/react/dist/csr/Check";
7
+ import { CaretDownIcon as c } from "@phosphor-icons/react/dist/csr/CaretDown";
8
+ import { Select as l } from "@base-ui/react/select";
8
9
  //#region src/components/selection/select.tsx
9
- var l = r(function({ className: t, ...r }, a) {
10
- return /* @__PURE__ */ i(c.Trigger, {
11
- ...r,
12
- className: n(e.selectTrigger, t),
13
- ref: a
10
+ var u = r(function({ className: e, ...n }, r) {
11
+ return /* @__PURE__ */ a(l.Trigger, {
12
+ ...n,
13
+ className: t("lyds-select__trigger", e),
14
+ ref: r
14
15
  });
15
- }), u = r(function({ className: t, ...r }, a) {
16
- return /* @__PURE__ */ i(c.Value, {
17
- ...r,
18
- className: n(e.selectValue, t),
19
- ref: a
16
+ }), d = r(function({ className: e, ...n }, r) {
17
+ return /* @__PURE__ */ a(l.Value, {
18
+ ...n,
19
+ className: t("lyds-select__value", e),
20
+ ref: r
20
21
  });
21
- }), d = r(function({ className: t, ...r }, a) {
22
- return /* @__PURE__ */ i(c.Positioner, {
23
- ...r,
24
- className: n(e.positioner, t),
25
- ref: a
22
+ }), f = r(function({ className: e, ...n }, r) {
23
+ return /* @__PURE__ */ a(l.Positioner, {
24
+ ...n,
25
+ className: t("lyds-listbox__positioner", e),
26
+ ref: r
26
27
  });
27
- }), f = r(function({ className: t, ...r }, a) {
28
- return /* @__PURE__ */ i(c.Popup, {
29
- ...r,
30
- className: n(e.popup, t),
31
- ref: a
28
+ }), p = r(function({ className: e, ...n }, r) {
29
+ return /* @__PURE__ */ a(l.Popup, {
30
+ ...n,
31
+ className: t("lyds-listbox__popup", e),
32
+ ref: r
32
33
  });
33
- }), p = r(function({ className: t, ...r }, a) {
34
- return /* @__PURE__ */ i(c.List, {
35
- ...r,
36
- className: n(e.optionList, t),
37
- ref: a
34
+ }), m = r(function({ className: e, ...n }, r) {
35
+ return /* @__PURE__ */ a(l.List, {
36
+ ...n,
37
+ className: t("lyds-listbox__list", e),
38
+ ref: r
38
39
  });
39
- }), m = r(function({ className: t, ...r }, a) {
40
- return /* @__PURE__ */ i(c.Item, {
41
- ...r,
42
- className: n(e.option, t),
43
- ref: a
40
+ }), h = r(function({ className: e, ...n }, r) {
41
+ return /* @__PURE__ */ a(l.Item, {
42
+ ...n,
43
+ className: t("lyds-listbox__option", e),
44
+ ref: r
44
45
  });
45
- }), h = r(function({ className: t, ...r }, a) {
46
- return /* @__PURE__ */ i(c.ItemIndicator, {
47
- ...r,
48
- className: n(e.optionIndicator, t),
49
- ref: a
46
+ }), g = r(function({ className: e, ...n }, r) {
47
+ return /* @__PURE__ */ a(l.ItemIndicator, {
48
+ ...n,
49
+ className: t("lyds-listbox__option-indicator", e),
50
+ ref: r
50
51
  });
51
- }), g = r(function({ className: t, ...r }, a) {
52
- return /* @__PURE__ */ i(c.ItemText, {
53
- ...r,
54
- className: n(e.optionText, t),
55
- ref: a
52
+ }), _ = r(function({ className: e, ...n }, r) {
53
+ return /* @__PURE__ */ a(l.ItemText, {
54
+ ...n,
55
+ className: t("lyds-listbox__option-text", e),
56
+ ref: r
56
57
  });
57
- }), _ = r(function({ className: t, ...r }, a) {
58
- return /* @__PURE__ */ i(c.GroupLabel, {
59
- ...r,
60
- className: n(e.groupLabel, t),
61
- ref: a
58
+ }), v = r(function({ className: e, ...n }, r) {
59
+ return /* @__PURE__ */ a(l.GroupLabel, {
60
+ ...n,
61
+ className: t("lyds-listbox__group-label", e),
62
+ ref: r
62
63
  });
63
- }), v = r(function({ className: t, ...r }, a) {
64
- return /* @__PURE__ */ i(c.Separator, {
65
- ...r,
66
- className: n(e.separator, t),
67
- ref: a
64
+ }), y = r(function({ className: e, ...n }, r) {
65
+ return /* @__PURE__ */ a(l.Separator, {
66
+ ...n,
67
+ className: t("lyds-listbox__separator", e),
68
+ ref: r
68
69
  });
69
70
  });
70
- function y({ "aria-describedby": n, "aria-label": r, "aria-labelledby": _, className: v, invalid: y = !1, options: b, placeholder: x = "請選擇", popupProps: S, positionerProps: C, triggerProps: w, ...T }) {
71
- let E = b.map((e) => ({
71
+ function b({ "aria-describedby": t, "aria-label": r, "aria-labelledby": v, className: y, invalid: b = !1, options: x, placeholder: S, popupProps: C, positionerProps: w, triggerProps: T, ...E }) {
72
+ let D = n(), O = i(() => x.map((e) => ({
72
73
  label: e.label,
73
74
  value: e.value
74
- }));
75
- return /* @__PURE__ */ a(c.Root, {
76
- ...T,
77
- items: E,
78
- children: [/* @__PURE__ */ a(l, {
79
- ...w,
80
- "aria-describedby": n ?? w?.["aria-describedby"],
81
- "aria-invalid": y || w?.["aria-invalid"] || void 0,
82
- "aria-label": r ?? w?.["aria-label"],
83
- "aria-labelledby": _ ?? w?.["aria-labelledby"],
84
- className: t(v, w?.className),
85
- children: [/* @__PURE__ */ i(u, { placeholder: x }), /* @__PURE__ */ i(c.Icon, {
75
+ })), [x]);
76
+ return /* @__PURE__ */ o(l.Root, {
77
+ ...E,
78
+ items: O,
79
+ children: [/* @__PURE__ */ o(u, {
80
+ ...T,
81
+ "aria-describedby": t ?? T?.["aria-describedby"],
82
+ "aria-invalid": b || T?.["aria-invalid"] || void 0,
83
+ "aria-label": r ?? T?.["aria-label"],
84
+ "aria-labelledby": v ?? T?.["aria-labelledby"],
85
+ className: e(y, T?.className),
86
+ children: [/* @__PURE__ */ a(d, { placeholder: S ?? D.selectPlaceholder }), /* @__PURE__ */ a(l.Icon, {
86
87
  "aria-hidden": "true",
87
- className: e.selectIcon,
88
- children: /* @__PURE__ */ i(s, {
88
+ className: "lyds-select__icon",
89
+ children: /* @__PURE__ */ a(c, {
89
90
  "aria-hidden": "true",
90
91
  weight: "bold"
91
92
  })
92
93
  })]
93
- }), /* @__PURE__ */ i(c.Portal, { children: /* @__PURE__ */ i(d, {
94
+ }), /* @__PURE__ */ a(l.Portal, { children: /* @__PURE__ */ a(f, {
94
95
  alignItemWithTrigger: !1,
95
- ...C,
96
- children: /* @__PURE__ */ i(f, {
97
- ...S,
98
- children: /* @__PURE__ */ i(p, { children: b.map((t, n) => /* @__PURE__ */ a(m, {
99
- disabled: t.disabled,
100
- label: t.textValue,
101
- value: t.value,
102
- children: [/* @__PURE__ */ i(h, { children: /* @__PURE__ */ i(o, {
96
+ ...w,
97
+ children: /* @__PURE__ */ a(p, {
98
+ ...C,
99
+ children: /* @__PURE__ */ a(m, { children: x.map((e, t) => /* @__PURE__ */ o(h, {
100
+ disabled: e.disabled,
101
+ label: e.textValue,
102
+ value: e.value,
103
+ children: [/* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(s, {
103
104
  "aria-hidden": "true",
104
105
  weight: "bold"
105
- }) }), /* @__PURE__ */ a(g, { children: [/* @__PURE__ */ i("span", { children: t.label }), t.description ? /* @__PURE__ */ i("span", {
106
- className: e.optionDescription,
107
- children: t.description
106
+ }) }), /* @__PURE__ */ o(_, { children: [/* @__PURE__ */ a("span", { children: e.label }), e.description ? /* @__PURE__ */ a("span", {
107
+ className: "lyds-listbox__option-description",
108
+ children: e.description
108
109
  }) : null] })]
109
- }, t.key ?? t.textValue ?? n)) })
110
+ }, e.key ?? e.textValue ?? t)) })
110
111
  })
111
112
  }) })]
112
113
  });
113
114
  }
114
- var b = Object.assign(y, {
115
- Arrow: c.Arrow,
116
- Backdrop: c.Backdrop,
117
- Group: c.Group,
118
- GroupLabel: _,
119
- Icon: c.Icon,
120
- Item: m,
121
- ItemIndicator: h,
122
- ItemText: g,
123
- Label: c.Label,
124
- List: p,
125
- Popup: f,
126
- Portal: c.Portal,
127
- Positioner: d,
128
- Root: c.Root,
129
- ScrollDownArrow: c.ScrollDownArrow,
130
- ScrollUpArrow: c.ScrollUpArrow,
131
- Separator: v,
132
- Trigger: l,
133
- Value: u
115
+ var x = Object.assign(b, {
116
+ Arrow: l.Arrow,
117
+ Backdrop: l.Backdrop,
118
+ Group: l.Group,
119
+ GroupLabel: v,
120
+ Icon: l.Icon,
121
+ Item: h,
122
+ ItemIndicator: g,
123
+ ItemText: _,
124
+ Label: l.Label,
125
+ List: m,
126
+ Popup: p,
127
+ Portal: l.Portal,
128
+ Positioner: f,
129
+ Root: l.Root,
130
+ ScrollDownArrow: l.ScrollDownArrow,
131
+ ScrollUpArrow: l.ScrollUpArrow,
132
+ Separator: y,
133
+ Trigger: u,
134
+ Value: d
134
135
  });
135
136
  //#endregion
136
- export { b as Select, _ as SelectGroupLabel, m as SelectItem, h as SelectItemIndicator, g as SelectItemText, p as SelectList, f as SelectPopup, d as SelectPositioner, v as SelectSeparator, l as SelectTrigger, u as SelectValue };
137
+ export { x as Select, v as SelectGroupLabel, h as SelectItem, g as SelectItemIndicator, _ as SelectItemText, m as SelectList, p as SelectPopup, f as SelectPositioner, y as SelectSeparator, u as SelectTrigger, d as SelectValue };
137
138
 
138
139
  //# sourceMappingURL=select.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"select.js","names":[],"sources":["../../../src/components/selection/select.tsx"],"sourcesContent":["import {\n\tSelect as BaseSelect,\n\ttype SelectGroupLabelProps,\n\ttype SelectItemIndicatorProps,\n\ttype SelectItemProps,\n\ttype SelectItemTextProps,\n\ttype SelectListProps,\n\ttype SelectPopupProps,\n\ttype SelectPositionerProps,\n\ttype SelectRootProps,\n\ttype SelectSeparatorProps,\n\ttype SelectTriggerProps,\n\ttype SelectValueProps\n} from \"@base-ui/react/select\";\nimport { CaretDownIcon } from \"@phosphor-icons/react/dist/csr/CaretDown\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef, type Key, type ReactNode } from \"react\";\n\nimport { combineStateClassNames, mergeStateClassName } from \"./classnames\";\nimport styles from \"./selection.module.css\";\n\nexport const SelectTrigger = forwardRef<HTMLButtonElement, SelectTriggerProps>(function SelectTrigger({ className, ...props }, ref) {\n\treturn <BaseSelect.Trigger {...props} className={mergeStateClassName(styles.selectTrigger, className)} ref={ref} />;\n});\n\nexport const SelectValue = forwardRef<HTMLSpanElement, SelectValueProps>(function SelectValue({ className, ...props }, ref) {\n\treturn <BaseSelect.Value {...props} className={mergeStateClassName(styles.selectValue, className)} ref={ref} />;\n});\n\nexport const SelectPositioner = forwardRef<HTMLDivElement, SelectPositionerProps>(function SelectPositioner({ className, ...props }, ref) {\n\treturn <BaseSelect.Positioner {...props} className={mergeStateClassName(styles.positioner, className)} ref={ref} />;\n});\n\nexport const SelectPopup = forwardRef<HTMLDivElement, SelectPopupProps>(function SelectPopup({ className, ...props }, ref) {\n\treturn <BaseSelect.Popup {...props} className={mergeStateClassName(styles.popup, className)} ref={ref} />;\n});\n\nexport const SelectList = forwardRef<HTMLDivElement, SelectListProps>(function SelectList({ className, ...props }, ref) {\n\treturn <BaseSelect.List {...props} className={mergeStateClassName(styles.optionList, className)} ref={ref} />;\n});\n\nexport const SelectItem = forwardRef<HTMLElement, SelectItemProps>(function SelectItem({ className, ...props }, ref) {\n\treturn <BaseSelect.Item {...props} className={mergeStateClassName(styles.option, className)} ref={ref} />;\n});\n\nexport const SelectItemIndicator = forwardRef<HTMLSpanElement, SelectItemIndicatorProps>(function SelectItemIndicator({ className, ...props }, ref) {\n\treturn <BaseSelect.ItemIndicator {...props} className={mergeStateClassName(styles.optionIndicator, className)} ref={ref} />;\n});\n\nexport const SelectItemText = forwardRef<HTMLDivElement, SelectItemTextProps>(function SelectItemText({ className, ...props }, ref) {\n\treturn <BaseSelect.ItemText {...props} className={mergeStateClassName(styles.optionText, className)} ref={ref} />;\n});\n\nexport const SelectGroupLabel = forwardRef<HTMLDivElement, SelectGroupLabelProps>(function SelectGroupLabel({ className, ...props }, ref) {\n\treturn <BaseSelect.GroupLabel {...props} className={mergeStateClassName(styles.groupLabel, className)} ref={ref} />;\n});\n\nexport const SelectSeparator = forwardRef<HTMLDivElement, SelectSeparatorProps>(function SelectSeparator({ className, ...props }, ref) {\n\treturn <BaseSelect.Separator {...props} className={mergeStateClassName(styles.separator, className)} ref={ref} />;\n});\n\nexport interface SelectOption<Value> {\n\tdescription?: ReactNode;\n\tdisabled?: boolean;\n\tkey?: Key;\n\tlabel: ReactNode;\n\ttextValue?: string;\n\tvalue: Value;\n}\n\nexport interface SelectProps<Value> extends Omit<SelectRootProps<Value, false>, \"children\" | \"items\" | \"multiple\"> {\n\t\"aria-describedby\"?: string;\n\t\"aria-label\"?: string;\n\t\"aria-labelledby\"?: string;\n\tclassName?: string;\n\tinvalid?: boolean;\n\toptions: readonly SelectOption<Value>[];\n\tplaceholder?: ReactNode;\n\tpopupProps?: SelectPopupProps;\n\tpositionerProps?: SelectPositionerProps;\n\ttriggerProps?: Omit<SelectTriggerProps, \"children\">;\n}\n\nfunction SelectComponent<Value>({\n\t\"aria-describedby\": ariaDescribedby,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledby,\n\tclassName,\n\tinvalid = false,\n\toptions,\n\tplaceholder = \"請選擇\",\n\tpopupProps,\n\tpositionerProps,\n\ttriggerProps,\n\t...rootProps\n}: SelectProps<Value>) {\n\tconst items = options.map(option => ({ label: option.label, value: option.value }));\n\n\treturn (\n\t\t<BaseSelect.Root {...rootProps} items={items}>\n\t\t\t<SelectTrigger\n\t\t\t\t{...triggerProps}\n\t\t\t\taria-describedby={ariaDescribedby ?? triggerProps?.[\"aria-describedby\"]}\n\t\t\t\taria-invalid={invalid || triggerProps?.[\"aria-invalid\"] || undefined}\n\t\t\t\taria-label={ariaLabel ?? triggerProps?.[\"aria-label\"]}\n\t\t\t\taria-labelledby={ariaLabelledby ?? triggerProps?.[\"aria-labelledby\"]}\n\t\t\t\tclassName={combineStateClassNames(className, triggerProps?.className)}\n\t\t\t>\n\t\t\t\t<SelectValue placeholder={placeholder} />\n\t\t\t\t<BaseSelect.Icon aria-hidden=\"true\" className={styles.selectIcon}>\n\t\t\t\t\t<CaretDownIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t\t</BaseSelect.Icon>\n\t\t\t</SelectTrigger>\n\t\t\t<BaseSelect.Portal>\n\t\t\t\t<SelectPositioner alignItemWithTrigger={false} {...positionerProps}>\n\t\t\t\t\t<SelectPopup {...popupProps}>\n\t\t\t\t\t\t<SelectList>\n\t\t\t\t\t\t\t{options.map((option, index) => (\n\t\t\t\t\t\t\t\t<SelectItem disabled={option.disabled} key={option.key ?? option.textValue ?? index} label={option.textValue} value={option.value}>\n\t\t\t\t\t\t\t\t\t<SelectItemIndicator>\n\t\t\t\t\t\t\t\t\t\t<CheckIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t\t\t\t\t\t\t</SelectItemIndicator>\n\t\t\t\t\t\t\t\t\t<SelectItemText>\n\t\t\t\t\t\t\t\t\t\t<span>{option.label}</span>\n\t\t\t\t\t\t\t\t\t\t{option.description ? <span className={styles.optionDescription}>{option.description}</span> : null}\n\t\t\t\t\t\t\t\t\t</SelectItemText>\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SelectList>\n\t\t\t\t\t</SelectPopup>\n\t\t\t\t</SelectPositioner>\n\t\t\t</BaseSelect.Portal>\n\t\t</BaseSelect.Root>\n\t);\n}\n\nexport const Select = Object.assign(SelectComponent, {\n\tArrow: BaseSelect.Arrow,\n\tBackdrop: BaseSelect.Backdrop,\n\tGroup: BaseSelect.Group,\n\tGroupLabel: SelectGroupLabel,\n\tIcon: BaseSelect.Icon,\n\tItem: SelectItem,\n\tItemIndicator: SelectItemIndicator,\n\tItemText: SelectItemText,\n\tLabel: BaseSelect.Label,\n\tList: SelectList,\n\tPopup: SelectPopup,\n\tPortal: BaseSelect.Portal,\n\tPositioner: SelectPositioner,\n\tRoot: BaseSelect.Root,\n\tScrollDownArrow: BaseSelect.ScrollDownArrow,\n\tScrollUpArrow: BaseSelect.ScrollUpArrow,\n\tSeparator: SelectSeparator,\n\tTrigger: SelectTrigger,\n\tValue: SelectValue\n});\n"],"mappings":";;;;;;;;AAqBA,IAAa,IAAgB,EAAkD,SAAuB,EAAE,cAAW,GAAG,KAAS,GAAK;CACnI,OAAO,kBAAC,EAAW,SAAZ;EAAoB,GAAI;EAAO,WAAW,EAAoB,EAAO,eAAe,CAAS;EAAQ;CAAM,CAAA;AACnH,CAAC,GAEY,IAAc,EAA8C,SAAqB,EAAE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D,EAAA,UACC,kBAAC,GAAD;MAAW,eAAY;MAAO,QAAO;KAAQ,CAAA,EACzB,CAAA,GACrB,kBAAC,GAAD,EAAA,UAAA,CACC,kBAAC,QAAD,EAAA,UAAO,EAAO,MAAY,CAAA,GACzB,EAAO,cAAc,kBAAC,QAAD;MAAM,WAAW,EAAO;MAAoB,UAAA,EAAO;KAAkB,CAAA,IAAI,IAChF,EAAA,CAAA,CACL;IARgC,GAAA,EAAO,OAAO,EAAO,aAAa,CAQlE,CACZ,EACU,CAAA;GACA,CAAA;EACI,CAAA,EACA,CAAA,CACH;;AAEnB;AAEA,IAAa,IAAS,OAAO,OAAO,GAAiB;CACpD,OAAO,EAAW;CAClB,UAAU,EAAW;CACrB,OAAO,EAAW;CAClB,YAAY;CACZ,MAAM,EAAW;CACjB,MAAM;CACN,eAAe;CACf,UAAU;CACV,OAAO,EAAW;CAClB,MAAM;CACN,OAAO;CACP,QAAQ,EAAW;CACnB,YAAY;CACZ,MAAM,EAAW;CACjB,iBAAiB,EAAW;CAC5B,eAAe,EAAW;CAC1B,WAAW;CACX,SAAS;CACT,OAAO;AACR,CAAC"}
1
+ {"version":3,"file":"select.js","names":[],"sources":["../../../src/components/selection/select.tsx"],"sourcesContent":["import {\n\tSelect as BaseSelect,\n\ttype SelectGroupLabelProps,\n\ttype SelectItemIndicatorProps,\n\ttype SelectItemProps,\n\ttype SelectItemTextProps,\n\ttype SelectListProps,\n\ttype SelectPopupProps,\n\ttype SelectPositionerProps,\n\ttype SelectRootProps,\n\ttype SelectSeparatorProps,\n\ttype SelectTriggerProps,\n\ttype SelectValueProps\n} from \"@base-ui/react/select\";\nimport { CaretDownIcon } from \"@phosphor-icons/react/dist/csr/CaretDown\";\nimport { CheckIcon } from \"@phosphor-icons/react/dist/csr/Check\";\nimport { forwardRef, useMemo, type Key, type ReactNode } from \"react\";\n\nimport { combineStateClassNames, withStateClassName } from \"@/internal\";\nimport { useMessages } from \"@/intl\";\n\nexport const SelectTrigger = forwardRef<HTMLButtonElement, SelectTriggerProps>(function SelectTrigger({ className, ...props }, ref) {\n\treturn <BaseSelect.Trigger {...props} className={withStateClassName(\"lyds-select__trigger\", className)} ref={ref} />;\n});\n\nexport const SelectValue = forwardRef<HTMLSpanElement, SelectValueProps>(function SelectValue({ className, ...props }, ref) {\n\treturn <BaseSelect.Value {...props} className={withStateClassName(\"lyds-select__value\", className)} ref={ref} />;\n});\n\nexport const SelectPositioner = forwardRef<HTMLDivElement, SelectPositionerProps>(function SelectPositioner({ className, ...props }, ref) {\n\treturn <BaseSelect.Positioner {...props} className={withStateClassName(\"lyds-listbox__positioner\", className)} ref={ref} />;\n});\n\nexport const SelectPopup = forwardRef<HTMLDivElement, SelectPopupProps>(function SelectPopup({ className, ...props }, ref) {\n\treturn <BaseSelect.Popup {...props} className={withStateClassName(\"lyds-listbox__popup\", className)} ref={ref} />;\n});\n\nexport const SelectList = forwardRef<HTMLDivElement, SelectListProps>(function SelectList({ className, ...props }, ref) {\n\treturn <BaseSelect.List {...props} className={withStateClassName(\"lyds-listbox__list\", className)} ref={ref} />;\n});\n\nexport const SelectItem = forwardRef<HTMLElement, SelectItemProps>(function SelectItem({ className, ...props }, ref) {\n\treturn <BaseSelect.Item {...props} className={withStateClassName(\"lyds-listbox__option\", className)} ref={ref} />;\n});\n\nexport const SelectItemIndicator = forwardRef<HTMLSpanElement, SelectItemIndicatorProps>(function SelectItemIndicator({ className, ...props }, ref) {\n\treturn <BaseSelect.ItemIndicator {...props} className={withStateClassName(\"lyds-listbox__option-indicator\", className)} ref={ref} />;\n});\n\nexport const SelectItemText = forwardRef<HTMLDivElement, SelectItemTextProps>(function SelectItemText({ className, ...props }, ref) {\n\treturn <BaseSelect.ItemText {...props} className={withStateClassName(\"lyds-listbox__option-text\", className)} ref={ref} />;\n});\n\nexport const SelectGroupLabel = forwardRef<HTMLDivElement, SelectGroupLabelProps>(function SelectGroupLabel({ className, ...props }, ref) {\n\treturn <BaseSelect.GroupLabel {...props} className={withStateClassName(\"lyds-listbox__group-label\", className)} ref={ref} />;\n});\n\nexport const SelectSeparator = forwardRef<HTMLDivElement, SelectSeparatorProps>(function SelectSeparator({ className, ...props }, ref) {\n\treturn <BaseSelect.Separator {...props} className={withStateClassName(\"lyds-listbox__separator\", className)} ref={ref} />;\n});\n\nexport interface SelectOption<Value> {\n\tdescription?: ReactNode;\n\tdisabled?: boolean;\n\tkey?: Key;\n\tlabel: ReactNode;\n\ttextValue?: string;\n\tvalue: Value;\n}\n\nexport interface SelectProps<Value> extends Omit<SelectRootProps<Value, false>, \"children\" | \"items\" | \"multiple\"> {\n\t\"aria-describedby\"?: string;\n\t\"aria-label\"?: string;\n\t\"aria-labelledby\"?: string;\n\tclassName?: string;\n\tinvalid?: boolean;\n\toptions: readonly SelectOption<Value>[];\n\tplaceholder?: ReactNode;\n\tpopupProps?: SelectPopupProps;\n\tpositionerProps?: SelectPositionerProps;\n\ttriggerProps?: Omit<SelectTriggerProps, \"children\">;\n}\n\nfunction SelectComponent<Value>({\n\t\"aria-describedby\": ariaDescribedby,\n\t\"aria-label\": ariaLabel,\n\t\"aria-labelledby\": ariaLabelledby,\n\tclassName,\n\tinvalid = false,\n\toptions,\n\tplaceholder,\n\tpopupProps,\n\tpositionerProps,\n\ttriggerProps,\n\t...rootProps\n}: SelectProps<Value>) {\n\tconst messages = useMessages();\n\t// A fresh array on every render resets Base UI's item collection, so keep the identity stable.\n\tconst items = useMemo(() => options.map(option => ({ label: option.label, value: option.value })), [options]);\n\n\treturn (\n\t\t<BaseSelect.Root {...rootProps} items={items}>\n\t\t\t<SelectTrigger\n\t\t\t\t{...triggerProps}\n\t\t\t\taria-describedby={ariaDescribedby ?? triggerProps?.[\"aria-describedby\"]}\n\t\t\t\taria-invalid={invalid || triggerProps?.[\"aria-invalid\"] || undefined}\n\t\t\t\taria-label={ariaLabel ?? triggerProps?.[\"aria-label\"]}\n\t\t\t\taria-labelledby={ariaLabelledby ?? triggerProps?.[\"aria-labelledby\"]}\n\t\t\t\tclassName={combineStateClassNames(className, triggerProps?.className)}\n\t\t\t>\n\t\t\t\t<SelectValue placeholder={placeholder ?? messages.selectPlaceholder} />\n\t\t\t\t<BaseSelect.Icon aria-hidden=\"true\" className={\"lyds-select__icon\"}>\n\t\t\t\t\t<CaretDownIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t\t</BaseSelect.Icon>\n\t\t\t</SelectTrigger>\n\t\t\t<BaseSelect.Portal>\n\t\t\t\t<SelectPositioner alignItemWithTrigger={false} {...positionerProps}>\n\t\t\t\t\t<SelectPopup {...popupProps}>\n\t\t\t\t\t\t<SelectList>\n\t\t\t\t\t\t\t{options.map((option, index) => (\n\t\t\t\t\t\t\t\t<SelectItem disabled={option.disabled} key={option.key ?? option.textValue ?? index} label={option.textValue} value={option.value}>\n\t\t\t\t\t\t\t\t\t<SelectItemIndicator>\n\t\t\t\t\t\t\t\t\t\t<CheckIcon aria-hidden=\"true\" weight=\"bold\" />\n\t\t\t\t\t\t\t\t\t</SelectItemIndicator>\n\t\t\t\t\t\t\t\t\t<SelectItemText>\n\t\t\t\t\t\t\t\t\t\t<span>{option.label}</span>\n\t\t\t\t\t\t\t\t\t\t{option.description ? <span className={\"lyds-listbox__option-description\"}>{option.description}</span> : null}\n\t\t\t\t\t\t\t\t\t</SelectItemText>\n\t\t\t\t\t\t\t\t</SelectItem>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</SelectList>\n\t\t\t\t\t</SelectPopup>\n\t\t\t\t</SelectPositioner>\n\t\t\t</BaseSelect.Portal>\n\t\t</BaseSelect.Root>\n\t);\n}\n\nexport const Select = Object.assign(SelectComponent, {\n\tArrow: BaseSelect.Arrow,\n\tBackdrop: BaseSelect.Backdrop,\n\tGroup: BaseSelect.Group,\n\tGroupLabel: SelectGroupLabel,\n\tIcon: BaseSelect.Icon,\n\tItem: SelectItem,\n\tItemIndicator: SelectItemIndicator,\n\tItemText: SelectItemText,\n\tLabel: BaseSelect.Label,\n\tList: SelectList,\n\tPopup: SelectPopup,\n\tPortal: BaseSelect.Portal,\n\tPositioner: SelectPositioner,\n\tRoot: BaseSelect.Root,\n\tScrollDownArrow: BaseSelect.ScrollDownArrow,\n\tScrollUpArrow: BaseSelect.ScrollUpArrow,\n\tSeparator: SelectSeparator,\n\tTrigger: SelectTrigger,\n\tValue: SelectValue\n});\n"],"mappings":";;;;;;;;;AAqBA,IAAa,IAAgB,EAAkD,SAAuB,EAAE,cAAW,GAAG,KAAS,GAAK;CACnI,OAAO,kBAAC,EAAW,SAAZ;EAAoB,GAAI;EAAO,WAAW,EAAmB,wBAAwB,CAAS;EAAQ;CAAM,CAAA;AACpH,CAAC,GAEY,IAAc,EAA8C,SAAqB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC3H,OAAO,kBAAC,EAAW,OAAZ;EAAkB,GAAI;EAAO,WAAW,EAAmB,sBAAsB,CAAS;EAAQ;CAAM,CAAA;AAChH,CAAC,GAEY,IAAmB,EAAkD,SAA0B,EAAE,cAAW,GAAG,KAAS,GAAK;CACzI,OAAO,kBAAC,EAAW,YAAZ;EAAuB,GAAI;EAAO,WAAW,EAAmB,4BAA4B,CAAS;EAAQ;CAAM,CAAA;AAC3H,CAAC,GAEY,IAAc,EAA6C,SAAqB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC1H,OAAO,kBAAC,EAAW,OAAZ;EAAkB,GAAI;EAAO,WAAW,EAAmB,uBAAuB,CAAS;EAAQ;CAAM,CAAA;AACjH,CAAC,GAEY,IAAa,EAA4C,SAAoB,EAAE,cAAW,GAAG,KAAS,GAAK;CACvH,OAAO,kBAAC,EAAW,MAAZ;EAAiB,GAAI;EAAO,WAAW,EAAmB,sBAAsB,CAAS;EAAQ;CAAM,CAAA;AAC/G,CAAC,GAEY,IAAa,EAAyC,SAAoB,EAAE,cAAW,GAAG,KAAS,GAAK;CACpH,OAAO,kBAAC,EAAW,MAAZ;EAAiB,GAAI;EAAO,WAAW,EAAmB,wBAAwB,CAAS;EAAQ;CAAM,C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