@linyao.tw/ui 0.0.0-snapshot.07df57 → 0.0.0-snapshot.77a04d

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 (188) hide show
  1. package/README.md +100 -4
  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 +28 -3
  47. package/dist/components/forms/internal.js +68 -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.d.ts +25 -0
  87. package/dist/components/navigation-data/header-tab-bar.js +50 -46
  88. package/dist/components/navigation-data/header-tab-bar.js.map +1 -1
  89. package/dist/components/navigation-data/index.d.ts +7 -7
  90. package/dist/components/navigation-data/menubar-toolbar.d.ts +1 -1
  91. package/dist/components/navigation-data/menubar-toolbar.js +2 -1
  92. package/dist/components/navigation-data/menubar-toolbar.js.map +1 -1
  93. package/dist/components/navigation-data/navigation-menu.js +2 -1
  94. package/dist/components/navigation-data/navigation-menu.js.map +1 -1
  95. package/dist/components/navigation-data/scroll-area.js +2 -1
  96. package/dist/components/navigation-data/scroll-area.js.map +1 -1
  97. package/dist/components/navigation-data/table-collection.d.ts +60 -3
  98. package/dist/components/navigation-data/table-collection.js +12 -9
  99. package/dist/components/navigation-data/table-collection.js.map +1 -1
  100. package/dist/components/overlays/dialog.d.ts +60 -3
  101. package/dist/components/overlays/dialog.js +143 -133
  102. package/dist/components/overlays/dialog.js.map +1 -1
  103. package/dist/components/overlays/disclosure.js +2 -1
  104. package/dist/components/overlays/disclosure.js.map +1 -1
  105. package/dist/components/overlays/drawer.d.ts +36 -2
  106. package/dist/components/overlays/drawer.js +169 -149
  107. package/dist/components/overlays/drawer.js.map +1 -1
  108. package/dist/components/overlays/floating.js +116 -113
  109. package/dist/components/overlays/floating.js.map +1 -1
  110. package/dist/components/overlays/index.d.ts +4 -4
  111. package/dist/components/selection/combobox.d.ts +19 -2
  112. package/dist/components/selection/combobox.js +236 -210
  113. package/dist/components/selection/combobox.js.map +1 -1
  114. package/dist/components/selection/controls.d.ts +4 -1
  115. package/dist/components/selection/controls.js +141 -118
  116. package/dist/components/selection/controls.js.map +1 -1
  117. package/dist/components/selection/menu.d.ts +22 -2
  118. package/dist/components/selection/menu.js +121 -121
  119. package/dist/components/selection/menu.js.map +1 -1
  120. package/dist/components/selection/select.d.ts +32 -1
  121. package/dist/components/selection/select.js +122 -107
  122. package/dist/components/selection/select.js.map +1 -1
  123. package/dist/fonts.css +13 -0
  124. package/dist/index.d.ts +1 -0
  125. package/dist/index.js +39 -33
  126. package/dist/internal/accessible-name.d.ts +12 -0
  127. package/dist/internal/class-names.d.ts +12 -0
  128. package/dist/{components/selection/classnames.js → internal/class-names.js} +4 -3
  129. package/dist/internal/class-names.js.map +1 -0
  130. package/dist/internal/index.d.ts +3 -0
  131. package/dist/{components/foundations/shared.d.ts → internal/render.d.ts} +2 -1
  132. package/dist/intl/index.d.ts +3 -0
  133. package/dist/intl/linyao-provider.d.ts +38 -0
  134. package/dist/intl/linyao-provider.js +27 -0
  135. package/dist/intl/linyao-provider.js.map +1 -0
  136. package/dist/intl/messages.d.ts +48 -0
  137. package/dist/intl/messages.js +81 -0
  138. package/dist/intl/messages.js.map +1 -0
  139. package/dist/intl/provider.d.ts +18 -0
  140. package/dist/intl/provider.js +31 -0
  141. package/dist/intl/provider.js.map +1 -0
  142. package/dist/styles.css +1 -1
  143. package/docs/architecture.md +184 -0
  144. package/docs/components.md +322 -0
  145. package/docs/design-principles.md +95 -0
  146. package/docs/theming.md +202 -0
  147. package/docs/tokens.md +228 -0
  148. package/package.json +16 -13
  149. package/dist/components/feedback/feedback.module.js +0 -42
  150. package/dist/components/feedback/feedback.module.js.map +0 -1
  151. package/dist/components/forms/CodeField.js +0 -63
  152. package/dist/components/forms/CodeField.js.map +0 -1
  153. package/dist/components/forms/FileUpload.js.map +0 -1
  154. package/dist/components/forms/Input.js.map +0 -1
  155. package/dist/components/forms/NumberField.js +0 -71
  156. package/dist/components/forms/NumberField.js.map +0 -1
  157. package/dist/components/forms/OTPField.js +0 -54
  158. package/dist/components/forms/OTPField.js.map +0 -1
  159. package/dist/components/forms/TextField.js +0 -199
  160. package/dist/components/forms/TextField.js.map +0 -1
  161. package/dist/components/foundations/Avatar.js.map +0 -1
  162. package/dist/components/foundations/Badge.js.map +0 -1
  163. package/dist/components/foundations/Button.js.map +0 -1
  164. package/dist/components/foundations/Card.js.map +0 -1
  165. package/dist/components/foundations/IconButton.js.map +0 -1
  166. package/dist/components/foundations/Link.js +0 -40
  167. package/dist/components/foundations/Link.js.map +0 -1
  168. package/dist/components/foundations/ListCell.js.map +0 -1
  169. package/dist/components/foundations/SectionHeading.js.map +0 -1
  170. package/dist/components/foundations/Separator.js.map +0 -1
  171. package/dist/components/foundations/shared.js +0 -8
  172. package/dist/components/foundations/shared.js.map +0 -1
  173. package/dist/components/navigation-data/utils.d.ts +0 -2
  174. package/dist/components/navigation-data/utils.js +0 -11
  175. package/dist/components/navigation-data/utils.js.map +0 -1
  176. package/dist/components/overlays/class-names.d.ts +0 -6
  177. package/dist/components/overlays/class-names.js +0 -11
  178. package/dist/components/overlays/class-names.js.map +0 -1
  179. package/dist/components/selection/classnames.d.ts +0 -4
  180. package/dist/components/selection/classnames.js.map +0 -1
  181. package/dist/components/selection/selection.module.js +0 -51
  182. package/dist/components/selection/selection.module.js.map +0 -1
  183. /package/dist/components/forms/{Input.d.ts → input.d.ts} +0 -0
  184. /package/dist/components/forms/{NumberField.d.ts → number-field.d.ts} +0 -0
  185. /package/dist/components/forms/{OTPField.d.ts → otp-field.d.ts} +0 -0
  186. /package/dist/components/foundations/{Avatar.d.ts → avatar.d.ts} +0 -0
  187. /package/dist/components/foundations/{Button.d.ts → button.d.ts} +0 -0
  188. /package/dist/components/foundations/{Separator.d.ts → separator.d.ts} +0 -0
package/README.md CHANGED
@@ -18,6 +18,16 @@ pnpm add @linyao.tw/ui @phosphor-icons/react
18
18
  import "@linyao.tw/ui/styles.css";
19
19
  ```
20
20
 
21
+ > 安裝後,完整文件就在 `node_modules/@linyao.tw/ui/docs/`——元件範例、設計變數、主題與組合規則都在裡面。詳見下方[文件](#文件)。
22
+
23
+ `styles.css` 不含任何遠端請求。需要品牌字型時另外匯入可選入口,或自行代管字型並覆寫 `--font-family-*`:
24
+
25
+ ```tsx
26
+ import "@linyao.tw/ui/fonts.css";
27
+ ```
28
+
29
+ `styles.css` 除了設計變數與元件樣式,也包含一層文件基準樣式:`box-sizing`、`margin`/`padding` 歸零、`body` 的背景與文字色、表單控制項的 `font: inherit` 與 `::selection`。這層放在 `@layer lyds.base`,未分層的應用程式樣式一律勝過它,因此覆寫不需要提高選擇器權重。
30
+
21
31
  ## 使用
22
32
 
23
33
  ```tsx
@@ -36,6 +46,61 @@ export function ProfileForm() {
36
46
  }
37
47
  ```
38
48
 
49
+ ## React Server Components
50
+
51
+ 套件內每個模組都帶有 `"use client"`,因此可以直接從 Server Component 匯入,元件會在用戶端邊界渲染,不需要額外包一層:
52
+
53
+ ```tsx
54
+ // app/page.tsx — Server Component,不需要 "use client"
55
+ import { Button, Card, CardBody } from "@linyao.tw/ui";
56
+
57
+ export default function Page() {
58
+ return (
59
+ <Card>
60
+ <CardBody>
61
+ <Button>儲存</Button>
62
+ </CardBody>
63
+ </Card>
64
+ );
65
+ }
66
+ ```
67
+
68
+ **圖示是唯一的例外,而且會讓建置失敗。** `@phosphor-icons/react` 沒有自己的用戶端邊界,`/dist/csr/*` 會在模組頂層呼叫 `createContext`,在 Server Component 中匯入會得到:
69
+
70
+ ```text
71
+ TypeError: (0 , f.createContext) is not a function
72
+ ```
73
+
74
+ Server Component 請改用同一套圖示的 `/dist/ssr/*` 進入點;`/dist/csr/*` 留給已標記 `"use client"` 的檔案:
75
+
76
+ ```tsx
77
+ // Server Component
78
+ import { FloppyDiskIcon } from "@phosphor-icons/react/dist/ssr/FloppyDisk";
79
+
80
+ // "use client" 的檔案
81
+ import { FloppyDiskIcon } from "@phosphor-icons/react/dist/csr/FloppyDisk";
82
+ ```
83
+
84
+ 兩者的 props 相同,只有 `ssr` 版本不讀取 `IconContext`。
85
+
86
+ ## 在地化
87
+
88
+ 元件的預設字串(關閉、上一頁、清除選取…)與日期時間元件的地區設定由同一個 provider 決定。沒有 provider 時使用繁體中文,日期沿用瀏覽器地區:
89
+
90
+ ```tsx
91
+ import { LinyaoProvider } from "@linyao.tw/ui";
92
+
93
+ <LinyaoProvider locale="en-US">
94
+ <App />
95
+ </LinyaoProvider>;
96
+ ```
97
+
98
+ `locale` 以 `zh` 開頭時選用繁體中文套件,其餘選用英文;`messages` 可合併覆寫個別字串。`ComponentMessages` 含有函式成員,因此 provider 要放在標記 `"use client"` 的元件內。書寫方向不由 provider 控制,`dir` 請和 `data-lyds-theme` 一起設在 `<html>`。
99
+
100
+ ## 與 Tailwind 一起使用
101
+
102
+ `styles.css` 只有基準重置放在 `@layer lyds.base`,元件樣式刻意維持未分層,讓使用端不必靠權重就能覆寫基準層。代價是未分層樣式一律勝過分層樣式:Tailwind v4 的 utilities 位於 `@layer utilities`,因此 `class="p-2"` 不會蓋過 `.lyds-button` 的 padding。請改用元件屬性、覆寫語意變數,或把應用程式樣式也維持未分層。
103
+
39
104
  ## 主題
40
105
 
41
106
  以 `data-lyds-theme` 切換亮色或深色主題:
@@ -44,17 +109,32 @@ export function ProfileForm() {
44
109
  <html data-lyds-theme="dark"></html>
45
110
  ```
46
111
 
47
- 自訂主題時應覆寫語意角色,不要直接修改元件顏色:
112
+ 自訂主題時應覆寫語意角色,不要直接修改元件顏色。換品牌色時,這一組是完整的清單——只改 `--control-primary` 會漏掉 Slider 與選取狀態,因為它們讀的是另一個角色:
48
113
 
49
114
  ```css
50
115
  .product-theme {
51
- --control-primary: var(--palette-signal-600);
52
- --control-primary-hover: var(--palette-signal-700);
116
+ /* 主要操作:Button、送出、主要 CTA */
117
+ --control-primary: oklch(48% 0.17 32);
118
+ --control-primary-hover: oklch(42% 0.17 32);
119
+ --control-primary-pressed: oklch(36% 0.17 32);
53
120
  --control-on-primary: var(--palette-warm-25);
121
+
122
+ /* 選取與填充:Slider 軌道、Switch 開啟、選取中的項目。
123
+ 與 --control-primary 視覺相近但語意獨立,漏掉這兩個是換色時最常見的遺漏。 */
124
+ --control-selected: oklch(48% 0.17 32);
125
+ --control-selected-muted: oklch(92% 0.04 32);
126
+
127
+ /* 強調表面與其上的文字 */
128
+ --background-accent: oklch(48% 0.17 32);
129
+ --text-on-accent: var(--palette-warm-25);
130
+
131
+ /* 焦點環:需與相鄰表面達到 3:1 */
54
132
  --focus-ring: oklch(48% 0.17 32);
55
133
  }
56
134
  ```
57
135
 
136
+ 改色後請自行驗證對比。本套件對自己的預設值有自動檢查,但無法檢查你覆寫後的值。
137
+
58
138
  ## 設計邊界
59
139
 
60
140
  - 元件不包含 API 呼叫、路由、分析、儲存或業務驗證。
@@ -80,6 +160,22 @@ Linyao Design System 以 WCAG 2.2 AA 為目標,提供鍵盤操作、焦點樣
80
160
 
81
161
  ## 文件
82
162
 
83
- 完整的安裝、Storybook、開發、元件、設計變數、主題與發佈規範請參閱 [專案 README](https://github.com/linyao-tw/ui#readme) 與 [文件目錄](https://github.com/linyao-tw/ui/tree/main/docs)。
163
+ **完整文件隨套件一起安裝**,不需要連網或回到 GitHub。安裝後可直接讀取:
164
+
165
+ ```text
166
+ node_modules/@linyao.tw/ui/docs/
167
+ ```
168
+
169
+ | 想知道什麼 | 讀這個檔案 |
170
+ | ------------------------------------------------------- | --------------------------- |
171
+ | 每個元件的用途、props、組合方式與可執行範例 | `docs/components.md` |
172
+ | 主題切換、SSR、自訂品牌色、覆寫語意角色 | `docs/theming.md` |
173
+ | 設計變數完整清單:色彩、字體、間距、尺寸、動態效果 | `docs/tokens.md` |
174
+ | 組合模型、浮層堆疊、用戶端邊界、CSS 分層、公開 API 邊界 | `docs/architecture.md` |
175
+ | 元件結構、色彩與互動的設計依據 | `docs/design-principles.md` |
176
+
177
+ 公開匯出項目與型別的權威來源是 `dist/index.d.ts`;上述文件說明的是「為什麼這樣設計」與「怎麼組合」。
178
+
179
+ 變更記錄見 [CHANGELOG.md](https://github.com/linyao-tw/ui/blob/main/CHANGELOG.md)。線上版本另見 [專案 README](https://github.com/linyao-tw/ui#readme) 與 [文件目錄](https://github.com/linyao-tw/ui/tree/main/docs)。
84
180
 
85
181
  授權:Apache-2.0。套件與專案包含相同的完整授權檔。
@@ -1,4 +1,6 @@
1
- import { LocaleBoundary as e, cx as t } from "./shared.js";
1
+ "use client";
2
+ import { cx as e } from "../../internal/class-names.js";
3
+ import { LocaleBoundary as t } from "./shared.js";
2
4
  import { CaretLeftIcon as n } from "@phosphor-icons/react/dist/csr/CaretLeft";
3
5
  import { CaretRightIcon as r } from "@phosphor-icons/react/dist/csr/CaretRight";
4
6
  import { forwardRef as i } from "react";
@@ -68,22 +70,22 @@ function y({ weekdayStyle: e = "short" }) {
68
70
  }) })]
69
71
  });
70
72
  }
71
- function b({ weekdayStyle: e, showMonthYearPickers: n, disabled: r, className: i }) {
73
+ function b({ weekdayStyle: t, showMonthYearPickers: n, disabled: r, className: i }) {
72
74
  return /* @__PURE__ */ _("div", {
73
- className: t("lyds-calendar-panel", i),
75
+ className: e("lyds-calendar-panel", i),
74
76
  children: [/* @__PURE__ */ g(v, {
75
77
  showMonthYearPickers: n,
76
78
  disabled: r
77
- }), /* @__PURE__ */ g(y, { weekdayStyle: e })]
79
+ }), /* @__PURE__ */ g(y, { weekdayStyle: t })]
78
80
  });
79
81
  }
80
82
  function x({ locale: n, className: r, disabled: i, readOnly: a, invalid: s, onValueChange: c, weekdayStyle: l, ...u }, d) {
81
- return /* @__PURE__ */ g(e, {
83
+ return /* @__PURE__ */ g(t, {
82
84
  locale: n,
83
85
  children: /* @__PURE__ */ g(o, {
84
86
  ...u,
85
87
  ref: d,
86
- className: t("lyds-calendar", r),
88
+ className: e("lyds-calendar", r),
87
89
  ...i === void 0 ? {} : { isDisabled: i },
88
90
  ...a === void 0 ? {} : { isReadOnly: a },
89
91
  ...s === void 0 ? {} : { isInvalid: s },
@@ -1 +1 @@
1
- {"version":3,"file":"calendar.js","names":[],"sources":["../../../src/components/date-time/calendar.tsx"],"sourcesContent":["import type { CalendarDate } from \"@internationalized/date\";\nimport { CaretLeftIcon } from \"@phosphor-icons/react/dist/csr/CaretLeft\";\nimport { CaretRightIcon } from \"@phosphor-icons/react/dist/csr/CaretRight\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { Button } from \"react-aria-components/Button\";\nimport {\n\tCalendar as AriaCalendar,\n\tCalendarCell,\n\tCalendarGrid,\n\tCalendarGridBody,\n\tCalendarGridHeader,\n\tCalendarHeaderCell,\n\tCalendarHeading,\n\tCalendarMonthPicker,\n\tCalendarYearPicker,\n\ttype CalendarProps as AriaCalendarProps\n} from \"react-aria-components/Calendar\";\nimport type { CalendarBehaviorProps, DateValue as LydsDateValue } from \"./date-types\";\nimport { LocaleBoundary, cx } from \"./shared\";\n\nexport type { FirstDayOfWeek } from \"./date-types\";\nexport type WeekdayStyle = \"narrow\" | \"short\" | \"long\";\n\nexport interface CalendarProps<T extends LydsDateValue = CalendarDate> extends CalendarBehaviorProps<T> {\n\tlocale?: string | undefined;\n\tclassName?: string;\n\tweekdayStyle?: WeekdayStyle | undefined;\n}\n\ntype CalendarForwardedKeys = Exclude<keyof CalendarBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"readOnly\">;\ntype CalendarUnexpectedForwardedKeys = Exclude<CalendarForwardedKeys, keyof AriaCalendarProps<LydsDateValue>>;\ntype CalendarPropContract = CalendarUnexpectedForwardedKeys extends never ? true : never;\nconst calendarPropContract: CalendarPropContract = true;\nvoid calendarPropContract;\n\nexport interface CalendarPanelProps {\n\tweekdayStyle?: WeekdayStyle | undefined;\n\tshowMonthYearPickers?: boolean | undefined;\n\tdisabled?: boolean | undefined;\n\tclassName?: string | undefined;\n}\n\nexport function CalendarNavigation({ showMonthYearPickers = true, disabled }: Pick<CalendarPanelProps, \"showMonthYearPickers\" | \"disabled\">) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"lyds-calendar-navigation\">\n\t\t\t\t<Button slot=\"previous\" className=\"lyds-calendar-navigation-button\">\n\t\t\t\t\t<CaretLeftIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"bold\" />\n\t\t\t\t</Button>\n\t\t\t\t<CalendarHeading className=\"lyds-calendar-heading\" />\n\t\t\t\t<Button slot=\"next\" className=\"lyds-calendar-navigation-button\">\n\t\t\t\t\t<CaretRightIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"bold\" />\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{showMonthYearPickers ? (\n\t\t\t\t<div className=\"lyds-calendar-period-pickers\">\n\t\t\t\t\t<CalendarMonthPicker>\n\t\t\t\t\t\t{({ items, value, onChange, ...ariaProps }) => (\n\t\t\t\t\t\t\t<select {...ariaProps} className=\"lyds-calendar-period-select\" value={String(value)} disabled={disabled} onChange={event => onChange(Number(event.currentTarget.value))}>\n\t\t\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t\t\t<option key={item.id} value={item.id}>\n\t\t\t\t\t\t\t\t\t\t{item.formatted}\n\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</CalendarMonthPicker>\n\t\t\t\t\t<CalendarYearPicker>\n\t\t\t\t\t\t{({ items, value, onChange, ...ariaProps }) => (\n\t\t\t\t\t\t\t<select {...ariaProps} className=\"lyds-calendar-period-select\" value={String(value)} disabled={disabled} onChange={event => onChange(Number(event.currentTarget.value))}>\n\t\t\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t\t\t<option key={item.id} value={item.id}>\n\t\t\t\t\t\t\t\t\t\t{item.formatted}\n\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</CalendarYearPicker>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</>\n\t);\n}\n\nexport function CalendarGridView({ weekdayStyle = \"short\" }: Pick<CalendarPanelProps, \"weekdayStyle\">) {\n\treturn (\n\t\t<CalendarGrid weekdayStyle={weekdayStyle} className=\"lyds-calendar-grid\">\n\t\t\t<CalendarGridHeader>{day => <CalendarHeaderCell className=\"lyds-calendar-weekday\">{day}</CalendarHeaderCell>}</CalendarGridHeader>\n\t\t\t<CalendarGridBody>{date => <CalendarCell date={date} className=\"lyds-calendar-cell\" />}</CalendarGridBody>\n\t\t</CalendarGrid>\n\t);\n}\n\nexport function CalendarPanel({ weekdayStyle, showMonthYearPickers, disabled, className }: CalendarPanelProps) {\n\treturn (\n\t\t<div className={cx(\"lyds-calendar-panel\", className)}>\n\t\t\t<CalendarNavigation showMonthYearPickers={showMonthYearPickers} disabled={disabled} />\n\t\t\t<CalendarGridView weekdayStyle={weekdayStyle} />\n\t\t</div>\n\t);\n}\n\nfunction CalendarImpl<T extends LydsDateValue>(\n\t{ locale, className, disabled, readOnly, invalid, onValueChange, weekdayStyle, ...calendarProps }: CalendarProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>\n) {\n\tconst ariaCalendarProps = calendarProps as unknown as Omit<AriaCalendarProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isReadOnly\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaCalendar\n\t\t\t\t{...ariaCalendarProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-calendar\", className)}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaCalendarProps<T>[\"onChange\"]> })}\n\t\t\t>\n\t\t\t\t<CalendarPanel weekdayStyle={weekdayStyle} disabled={disabled} />\n\t\t\t</AriaCalendar>\n\t\t</LocaleBoundary>\n\t);\n}\n\nexport const Calendar = forwardRef(CalendarImpl) as <T extends LydsDateValue = CalendarDate>(props: CalendarProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;;AA0CA,SAAgB,EAAmB,EAAE,0BAAuB,IAAM,eAA2E;CAC5I,OACC,kBAAA,GAAA,EAAA,UAAA,CACC,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACC,kBAAC,GAAD;IAAQ,MAAK;IAAW,WAAU;IACjC,UAAA,kBAAC,GAAD;KAAe,eAAY;KAAO,WAAU;KAAkB,QAAO;IAAQ,CAAA;GACtE,CAAA;GACR,kBAAC,GAAD,EAAiB,WAAU,wBAAyB,CAAA;GACpD,kBAAC,GAAD;IAAQ,MAAK;IAAO,WAAU;IAC7B,UAAA,kBAAC,GAAD;KAAgB,eAAY;KAAO,WAAU;KAAkB,QAAO;IAAQ,CAAA;GACvE,CAAA;EACJ;CACJ,CAAA,GAAA,IACA,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACC,kBAAC,GAAD,EAAA,WACG,EAAE,UAAO,UAAO,aAAU,GAAG,QAC9B,kBAAC,UAAD;GAAQ,GAAI;GAAW,WAAU;GAA8B,OAAO,OAAO,CAAK;GAAa;GAAU,WAAU,MAAS,EAAS,OAAO,EAAM,cAAc,KAAK,CAAC;GACpK,UAAA,EAAM,KAAI,MACV,kBAAC,UAAD;IAAsB,OAAO,EAAK;IAChC,UAAA,EAAK;GACC,GAFK,EAAK,EAEV,CACR;EACM,CAAA,EAEW,CAAA,GACrB,kBAAC,GAAD,EAAA,WACG,EAAE,UAAO,UAAO,aAAU,GAAG,QAC9B,kBAAC,UAAD;GAAQ,GAAI;GAAW,WAAU;GAA8B,OAAO,OAAO,CAAK;GAAa;GAAU,WAAU,MAAS,EAAS,OAAO,EAAM,cAAc,KAAK,CAAC;GACpK,UAAA,EAAM,KAAI,MACV,kBAAC,UAAD;IAAsB,OAAO,EAAK;IAChC,UAAA,EAAK;GACC,GAFK,EAAK,EAEV,CACR;EACM,CAAA,EAEU,CAAA,CAChB;CACF,CAAA,IAAA,IACH,EAAA,CAAA;AAEJ;AAEA,SAAgB,EAAiB,EAAE,kBAAe,WAAqD;CACtG,OACC,kBAAC,GAAD;EAA4B;EAAc,WAAU;EAApD,UAAA,CACC,kBAAC,GAAD,EAAA,WAAqB,MAAO,kBAAC,GAAD;GAAoB,WAAU;GAAyB,UAAA;EAAwB,CAAA,EAAsB,CAAA,GACjI,kBAAC,GAAD,EAAA,WAAmB,MAAQ,kBAAC,GAAD;GAAoB;GAAM,WAAU;EAAsB,CAAA,EAAoB,CAAA,CAC5F;;AAEhB;AAEA,SAAgB,EAAc,EAAE,iBAAc,yBAAsB,aAAU,gBAAiC;CAC9G,OACC,kBAAC,OAAD;EAAK,WAAW,EAAG,uBAAuB,CAAS;EAAnD,UAAA,CACC,kBAAC,GAAD;GAA0C;GAAgC;EAAW,CAAA,GACrF,kBAAC,GAAD,EAAgC,gBAAe,CAAA,CAC3C;;AAEP;AAEA,SAAS,EACR,EAAE,WAAQ,cAAW,aAAU,aAAU,YAAS,kBAAe,iBAAc,GAAG,KAClF,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,iBAAiB,CAAS;GACxC,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA0E;GAE9H,UAAA,kBAAC,GAAD;IAA6B;IAAwB;GAAW,CAAA;EACnD,CAAA;CACC,CAAA;AAElB;AAEA,IAAa,IAAW,EAAW,CAAY"}
1
+ {"version":3,"file":"calendar.js","names":[],"sources":["../../../src/components/date-time/calendar.tsx"],"sourcesContent":["import { cx } from \"@/internal\";\nimport type { CalendarDate } from \"@internationalized/date\";\nimport { CaretLeftIcon } from \"@phosphor-icons/react/dist/csr/CaretLeft\";\nimport { CaretRightIcon } from \"@phosphor-icons/react/dist/csr/CaretRight\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { Button } from \"react-aria-components/Button\";\nimport {\n\tCalendar as AriaCalendar,\n\tCalendarCell,\n\tCalendarGrid,\n\tCalendarGridBody,\n\tCalendarGridHeader,\n\tCalendarHeaderCell,\n\tCalendarHeading,\n\tCalendarMonthPicker,\n\tCalendarYearPicker,\n\ttype CalendarProps as AriaCalendarProps\n} from \"react-aria-components/Calendar\";\nimport type { CalendarBehaviorProps, DateValue as LydsDateValue } from \"./date-types\";\nimport { LocaleBoundary } from \"./shared\";\nexport type { FirstDayOfWeek } from \"./date-types\";\nexport type WeekdayStyle = \"narrow\" | \"short\" | \"long\";\n\nexport interface CalendarProps<T extends LydsDateValue = CalendarDate> extends CalendarBehaviorProps<T> {\n\tlocale?: string | undefined;\n\tclassName?: string;\n\tweekdayStyle?: WeekdayStyle | undefined;\n}\n\ntype CalendarForwardedKeys = Exclude<keyof CalendarBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"readOnly\">;\ntype CalendarUnexpectedForwardedKeys = Exclude<CalendarForwardedKeys, keyof AriaCalendarProps<LydsDateValue>>;\ntype CalendarPropContract = CalendarUnexpectedForwardedKeys extends never ? true : never;\nconst calendarPropContract: CalendarPropContract = true;\nvoid calendarPropContract;\n\nexport interface CalendarPanelProps {\n\tweekdayStyle?: WeekdayStyle | undefined;\n\tshowMonthYearPickers?: boolean | undefined;\n\tdisabled?: boolean | undefined;\n\tclassName?: string | undefined;\n}\n\nexport function CalendarNavigation({ showMonthYearPickers = true, disabled }: Pick<CalendarPanelProps, \"showMonthYearPickers\" | \"disabled\">) {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"lyds-calendar-navigation\">\n\t\t\t\t<Button slot=\"previous\" className=\"lyds-calendar-navigation-button\">\n\t\t\t\t\t<CaretLeftIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"bold\" />\n\t\t\t\t</Button>\n\t\t\t\t<CalendarHeading className=\"lyds-calendar-heading\" />\n\t\t\t\t<Button slot=\"next\" className=\"lyds-calendar-navigation-button\">\n\t\t\t\t\t<CaretRightIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"bold\" />\n\t\t\t\t</Button>\n\t\t\t</div>\n\t\t\t{showMonthYearPickers ? (\n\t\t\t\t<div className=\"lyds-calendar-period-pickers\">\n\t\t\t\t\t<CalendarMonthPicker>\n\t\t\t\t\t\t{({ items, value, onChange, ...ariaProps }) => (\n\t\t\t\t\t\t\t<select {...ariaProps} className=\"lyds-calendar-period-select\" value={String(value)} disabled={disabled} onChange={event => onChange(Number(event.currentTarget.value))}>\n\t\t\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t\t\t<option key={item.id} value={item.id}>\n\t\t\t\t\t\t\t\t\t\t{item.formatted}\n\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</CalendarMonthPicker>\n\t\t\t\t\t<CalendarYearPicker>\n\t\t\t\t\t\t{({ items, value, onChange, ...ariaProps }) => (\n\t\t\t\t\t\t\t<select {...ariaProps} className=\"lyds-calendar-period-select\" value={String(value)} disabled={disabled} onChange={event => onChange(Number(event.currentTarget.value))}>\n\t\t\t\t\t\t\t\t{items.map(item => (\n\t\t\t\t\t\t\t\t\t<option key={item.id} value={item.id}>\n\t\t\t\t\t\t\t\t\t\t{item.formatted}\n\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</CalendarYearPicker>\n\t\t\t\t</div>\n\t\t\t) : null}\n\t\t</>\n\t);\n}\n\nexport function CalendarGridView({ weekdayStyle = \"short\" }: Pick<CalendarPanelProps, \"weekdayStyle\">) {\n\treturn (\n\t\t<CalendarGrid weekdayStyle={weekdayStyle} className=\"lyds-calendar-grid\">\n\t\t\t<CalendarGridHeader>{day => <CalendarHeaderCell className=\"lyds-calendar-weekday\">{day}</CalendarHeaderCell>}</CalendarGridHeader>\n\t\t\t<CalendarGridBody>{date => <CalendarCell date={date} className=\"lyds-calendar-cell\" />}</CalendarGridBody>\n\t\t</CalendarGrid>\n\t);\n}\n\nexport function CalendarPanel({ weekdayStyle, showMonthYearPickers, disabled, className }: CalendarPanelProps) {\n\treturn (\n\t\t<div className={cx(\"lyds-calendar-panel\", className)}>\n\t\t\t<CalendarNavigation showMonthYearPickers={showMonthYearPickers} disabled={disabled} />\n\t\t\t<CalendarGridView weekdayStyle={weekdayStyle} />\n\t\t</div>\n\t);\n}\n\nfunction CalendarImpl<T extends LydsDateValue>(\n\t{ locale, className, disabled, readOnly, invalid, onValueChange, weekdayStyle, ...calendarProps }: CalendarProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>\n) {\n\tconst ariaCalendarProps = calendarProps as unknown as Omit<AriaCalendarProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isReadOnly\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaCalendar\n\t\t\t\t{...ariaCalendarProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-calendar\", className)}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaCalendarProps<T>[\"onChange\"]> })}\n\t\t\t>\n\t\t\t\t<CalendarPanel weekdayStyle={weekdayStyle} disabled={disabled} />\n\t\t\t</AriaCalendar>\n\t\t</LocaleBoundary>\n\t);\n}\n\nexport const Calendar = forwardRef(CalendarImpl) as <T extends LydsDateValue = CalendarDate>(props: CalendarProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;;;;AA0CA,SAAgB,EAAmB,EAAE,0BAAuB,IAAM,eAA2E;CAC5I,OACC,kBAAA,GAAA,EAAA,UAAA,CACC,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACC,kBAAC,GAAD;IAAQ,MAAK;IAAW,WAAU;IACjC,UAAA,kBAAC,GAAD;KAAe,eAAY;KAAO,WAAU;KAAkB,QAAO;IAAQ,CAAA;GACtE,CAAA;GACR,kBAAC,GAAD,EAAiB,WAAU,wBAAyB,CAAA;GACpD,kBAAC,GAAD;IAAQ,MAAK;IAAO,WAAU;IAC7B,UAAA,kBAAC,GAAD;KAAgB,eAAY;KAAO,WAAU;KAAkB,QAAO;IAAQ,CAAA;GACvE,CAAA;EACJ;CACJ,CAAA,GAAA,IACA,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACC,kBAAC,GAAD,EAAA,WACG,EAAE,UAAO,UAAO,aAAU,GAAG,QAC9B,kBAAC,UAAD;GAAQ,GAAI;GAAW,WAAU;GAA8B,OAAO,OAAO,CAAK;GAAa;GAAU,WAAU,MAAS,EAAS,OAAO,EAAM,cAAc,KAAK,CAAC;GACpK,UAAA,EAAM,KAAI,MACV,kBAAC,UAAD;IAAsB,OAAO,EAAK;IAChC,UAAA,EAAK;GACC,GAFK,EAAK,EAEV,CACR;EACM,CAAA,EAEW,CAAA,GACrB,kBAAC,GAAD,EAAA,WACG,EAAE,UAAO,UAAO,aAAU,GAAG,QAC9B,kBAAC,UAAD;GAAQ,GAAI;GAAW,WAAU;GAA8B,OAAO,OAAO,CAAK;GAAa;GAAU,WAAU,MAAS,EAAS,OAAO,EAAM,cAAc,KAAK,CAAC;GACpK,UAAA,EAAM,KAAI,MACV,kBAAC,UAAD;IAAsB,OAAO,EAAK;IAChC,UAAA,EAAK;GACC,GAFK,EAAK,EAEV,CACR;EACM,CAAA,EAEU,CAAA,CAChB;CACF,CAAA,IAAA,IACH,EAAA,CAAA;AAEJ;AAEA,SAAgB,EAAiB,EAAE,kBAAe,WAAqD;CACtG,OACC,kBAAC,GAAD;EAA4B;EAAc,WAAU;EAApD,UAAA,CACC,kBAAC,GAAD,EAAA,WAAqB,MAAO,kBAAC,GAAD;GAAoB,WAAU;GAAyB,UAAA;EAAwB,CAAA,EAAsB,CAAA,GACjI,kBAAC,GAAD,EAAA,WAAmB,MAAQ,kBAAC,GAAD;GAAoB;GAAM,WAAU;EAAsB,CAAA,EAAoB,CAAA,CAC5F;;AAEhB;AAEA,SAAgB,EAAc,EAAE,iBAAc,yBAAsB,aAAU,gBAAiC;CAC9G,OACC,kBAAC,OAAD;EAAK,WAAW,EAAG,uBAAuB,CAAS;EAAnD,UAAA,CACC,kBAAC,GAAD;GAA0C;GAAgC;EAAW,CAAA,GACrF,kBAAC,GAAD,EAAgC,gBAAe,CAAA,CAC3C;;AAEP;AAEA,SAAS,EACR,EAAE,WAAQ,cAAW,aAAU,aAAU,YAAS,kBAAe,iBAAc,GAAG,KAClF,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,iBAAiB,CAAS;GACxC,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA0E;GAE9H,UAAA,kBAAC,GAAD;IAA6B;IAAwB;GAAW,CAAA;EACnD,CAAA;CACC,CAAA;AAElB;AAEA,IAAa,IAAW,EAAW,CAAY"}
@@ -1,12 +1,14 @@
1
- import { FieldLabel as e, FieldMessages as t, LocaleBoundary as n, cx as r } from "./shared.js";
1
+ "use client";
2
+ import { cx as e } from "../../internal/class-names.js";
3
+ import { FieldLabel as t, FieldMessages as n, LocaleBoundary as r } from "./shared.js";
2
4
  import { forwardRef as i } from "react";
3
5
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
4
6
  import { DateField as s, DateInput as c, DateSegment as l } from "react-aria-components/DateField";
5
7
  //#region src/components/date-time/date-field.tsx
6
- function u({ className: e, slot: t }) {
8
+ function u({ className: t, slot: n }) {
7
9
  return /* @__PURE__ */ a(c, {
8
- className: r("lyds-date-input", e),
9
- ...t ? { slot: t } : {},
10
+ className: e("lyds-date-input", t),
11
+ ...n ? { slot: n } : {},
10
12
  children: (e) => /* @__PURE__ */ a(l, {
11
13
  segment: e,
12
14
  className: "lyds-date-segment"
@@ -14,12 +16,12 @@ function u({ className: e, slot: t }) {
14
16
  });
15
17
  }
16
18
  function d({ label: i, description: c, error: l, locale: d, size: f = "md", className: p, disabled: m, readOnly: h, required: g, invalid: _, onValueChange: v, ...y }, b) {
17
- return /* @__PURE__ */ a(n, {
19
+ return /* @__PURE__ */ a(r, {
18
20
  locale: d,
19
21
  children: /* @__PURE__ */ o(s, {
20
22
  ...y,
21
23
  ref: b,
22
- className: r("lyds-date-field", p),
24
+ className: e("lyds-date-field", p),
23
25
  "data-size": f,
24
26
  ...m === void 0 ? {} : { isDisabled: m },
25
27
  ...h === void 0 ? {} : { isReadOnly: h },
@@ -27,9 +29,9 @@ function d({ label: i, description: c, error: l, locale: d, size: f = "md", clas
27
29
  ..._ === void 0 ? {} : { isInvalid: _ },
28
30
  ...v === void 0 ? {} : { onChange: v },
29
31
  children: [
30
- /* @__PURE__ */ a(e, { children: i }),
32
+ /* @__PURE__ */ a(t, { children: i }),
31
33
  /* @__PURE__ */ a(u, {}),
32
- /* @__PURE__ */ a(t, {
34
+ /* @__PURE__ */ a(n, {
33
35
  description: c,
34
36
  error: l
35
37
  })
@@ -1 +1 @@
1
- {"version":3,"file":"date-field.js","names":[],"sources":["../../../src/components/date-time/date-field.tsx"],"sourcesContent":["import type { CalendarDate } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { DateField as AriaDateField, DateInput, DateSegment, type DateFieldProps as AriaDateFieldProps } from \"react-aria-components/DateField\";\nimport type { DateFieldBehaviorProps, DateValue as LydsDateValue } from \"./date-types\";\nimport { FieldLabel, FieldMessages, LocaleBoundary, cx, type DateTimeFieldChromeProps } from \"./shared\";\n\nexport interface DateFieldProps<T extends LydsDateValue = CalendarDate> extends DateFieldBehaviorProps<T>, DateTimeFieldChromeProps {}\n\ntype DateFieldForwardedKeys = Exclude<keyof DateFieldBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"readOnly\" | \"required\">;\ntype DateFieldUnexpectedForwardedKeys = Exclude<DateFieldForwardedKeys, keyof AriaDateFieldProps<LydsDateValue>>;\ntype DateFieldPropContract = DateFieldUnexpectedForwardedKeys extends never ? true : never;\nconst dateFieldPropContract: DateFieldPropContract = true;\nvoid dateFieldPropContract;\n\nexport function DateInputSegments({ className, slot }: { className?: string; slot?: string }) {\n\treturn (\n\t\t<DateInput className={cx(\"lyds-date-input\", className)} {...(slot ? { slot } : {})}>\n\t\t\t{segment => <DateSegment segment={segment} className=\"lyds-date-segment\" />}\n\t\t</DateInput>\n\t);\n}\n\nfunction DateFieldImpl<T extends LydsDateValue>(\n\t{ label, description, error, locale, size = \"md\", className, disabled, readOnly, required, invalid, onValueChange, ...fieldProps }: DateFieldProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>\n) {\n\tconst ariaFieldProps = fieldProps as unknown as Omit<AriaDateFieldProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaDateField\n\t\t\t\t{...ariaFieldProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaDateFieldProps<T>[\"onChange\"]> })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<DateInputSegments />\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t</AriaDateField>\n\t\t</LocaleBoundary>\n\t);\n}\n\nexport const DateField = forwardRef(DateFieldImpl) as <T extends LydsDateValue = CalendarDate>(props: DateFieldProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;AAcA,SAAgB,EAAkB,EAAE,cAAW,WAA+C;CAC7F,OACC,kBAAC,GAAD;EAAW,WAAW,EAAG,mBAAmB,CAAS;EAAG,GAAK,IAAO,EAAE,QAAK,IAAI,CAAC;EAC9E,WAAA,MAAW,kBAAC,GAAD;GAAsB;GAAS,WAAU;EAAqB,CAAA;CAChE,CAAA;AAEb;AAEA,SAAS,EACR,EAAE,UAAO,gBAAa,UAAO,WAAQ,UAAO,MAAM,cAAW,aAAU,aAAU,aAAU,YAAS,kBAAe,GAAG,KACtH,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,CAAS;GAC1C,aAAW;GACX,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA2E;GAThI,UAAA;IAWC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,GAAD,CAAoB,CAAA;IACpB,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;GAC1C;;CACA,CAAA;AAElB;AAEA,IAAa,IAAY,EAAW,CAAa"}
1
+ {"version":3,"file":"date-field.js","names":[],"sources":["../../../src/components/date-time/date-field.tsx"],"sourcesContent":["import { cx } from \"@/internal\";\nimport type { CalendarDate } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { DateField as AriaDateField, DateInput, DateSegment, type DateFieldProps as AriaDateFieldProps } from \"react-aria-components/DateField\";\nimport type { DateFieldBehaviorProps, DateValue as LydsDateValue } from \"./date-types\";\nimport { FieldLabel, FieldMessages, LocaleBoundary, type DateTimeFieldChromeProps } from \"./shared\";\nexport interface DateFieldProps<T extends LydsDateValue = CalendarDate> extends DateFieldBehaviorProps<T>, DateTimeFieldChromeProps {}\n\ntype DateFieldForwardedKeys = Exclude<keyof DateFieldBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"readOnly\" | \"required\">;\ntype DateFieldUnexpectedForwardedKeys = Exclude<DateFieldForwardedKeys, keyof AriaDateFieldProps<LydsDateValue>>;\ntype DateFieldPropContract = DateFieldUnexpectedForwardedKeys extends never ? true : never;\nconst dateFieldPropContract: DateFieldPropContract = true;\nvoid dateFieldPropContract;\n\nexport function DateInputSegments({ className, slot }: { className?: string; slot?: string }) {\n\treturn (\n\t\t<DateInput className={cx(\"lyds-date-input\", className)} {...(slot ? { slot } : {})}>\n\t\t\t{segment => <DateSegment segment={segment} className=\"lyds-date-segment\" />}\n\t\t</DateInput>\n\t);\n}\n\nfunction DateFieldImpl<T extends LydsDateValue>(\n\t{ label, description, error, locale, size = \"md\", className, disabled, readOnly, required, invalid, onValueChange, ...fieldProps }: DateFieldProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>\n) {\n\tconst ariaFieldProps = fieldProps as unknown as Omit<AriaDateFieldProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaDateField\n\t\t\t\t{...ariaFieldProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaDateFieldProps<T>[\"onChange\"]> })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<DateInputSegments />\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t</AriaDateField>\n\t\t</LocaleBoundary>\n\t);\n}\n\nexport const DateField = forwardRef(DateFieldImpl) as <T extends LydsDateValue = CalendarDate>(props: DateFieldProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;AAcA,SAAgB,EAAkB,EAAE,cAAW,WAA+C;CAC7F,OACC,kBAAC,GAAD;EAAW,WAAW,EAAG,mBAAmB,CAAS;EAAG,GAAK,IAAO,EAAE,QAAK,IAAI,CAAC;EAC9E,WAAA,MAAW,kBAAC,GAAD;GAAsB;GAAS,WAAU;EAAqB,CAAA;CAChE,CAAA;AAEb;AAEA,SAAS,EACR,EAAE,UAAO,gBAAa,UAAO,WAAQ,UAAO,MAAM,cAAW,aAAU,aAAU,aAAU,YAAS,kBAAe,GAAG,KACtH,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,CAAS;GAC1C,aAAW;GACX,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA2E;GAThI,UAAA;IAWC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,GAAD,CAAoB,CAAA;IACpB,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;GAC1C;;CACA,CAAA;AAElB;AAEA,IAAa,IAAY,EAAW,CAAa"}
@@ -1,4 +1,6 @@
1
- import { CalendarGlyph as e, FieldLabel as t, FieldMessages as n, LocaleBoundary as r, cx as i } from "./shared.js";
1
+ "use client";
2
+ import { cx as e } from "../../internal/class-names.js";
3
+ import { CalendarGlyph as t, FieldLabel as n, FieldMessages as r, LocaleBoundary as i } from "./shared.js";
2
4
  import { CalendarPanel as a } from "./calendar.js";
3
5
  import { DateInputSegments as o } from "./date-field.js";
4
6
  import { forwardRef as s } from "react";
@@ -11,12 +13,12 @@ import { Group as m } from "react-aria-components/Group";
11
13
  import { Popover as h } from "react-aria-components/Popover";
12
14
  //#region src/components/date-time/date-picker.tsx
13
15
  function g({ label: s, description: g, error: _, locale: v, size: y = "md", className: b, open: x, disabled: S, readOnly: C, required: w, invalid: T, onValueChange: E, firstDayOfWeek: D, weekdayStyle: O, showMonthYearPickers: k, popoverPlacement: A = "bottom start", ...j }, M, N) {
14
- return /* @__PURE__ */ u(r, {
16
+ return /* @__PURE__ */ u(i, {
15
17
  locale: v,
16
18
  children: /* @__PURE__ */ d(f, {
17
19
  ...j,
18
20
  ref: M,
19
- className: i("lyds-date-field", "lyds-date-picker", N && "lyds-date-time-picker", b),
21
+ className: e("lyds-date-field", "lyds-date-picker", N && "lyds-date-time-picker", b),
20
22
  "data-size": y,
21
23
  ...x === void 0 ? {} : { isOpen: x },
22
24
  ...S === void 0 ? {} : { isDisabled: S },
@@ -26,15 +28,15 @@ function g({ label: s, description: g, error: _, locale: v, size: y = "md", clas
26
28
  ...E === void 0 ? {} : { onChange: E },
27
29
  ...D === void 0 ? {} : { firstDayOfWeek: D },
28
30
  children: [
29
- /* @__PURE__ */ u(t, { children: s }),
31
+ /* @__PURE__ */ u(n, { children: s }),
30
32
  /* @__PURE__ */ d(m, {
31
33
  className: "lyds-date-picker-group",
32
34
  children: [/* @__PURE__ */ u(o, { className: "lyds-date-picker-input" }), /* @__PURE__ */ u(c, {
33
35
  className: "lyds-date-picker-button",
34
- children: /* @__PURE__ */ u(e, {})
36
+ children: /* @__PURE__ */ u(t, {})
35
37
  })]
36
38
  }),
37
- /* @__PURE__ */ u(n, {
39
+ /* @__PURE__ */ u(r, {
38
40
  description: g,
39
41
  error: _
40
42
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.js","names":[],"sources":["../../../src/components/date-time/date-picker.tsx"],"sourcesContent":["import type { CalendarDate, CalendarDateTime, ZonedDateTime } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { Button } from \"react-aria-components/Button\";\nimport { Calendar as AriaCalendar } from \"react-aria-components/Calendar\";\nimport { DatePicker as AriaDatePicker, type DatePickerProps as AriaDatePickerProps } from \"react-aria-components/DatePicker\";\nimport { Dialog } from \"react-aria-components/Dialog\";\nimport { Group } from \"react-aria-components/Group\";\nimport { Popover } from \"react-aria-components/Popover\";\nimport { CalendarPanel, type WeekdayStyle } from \"./calendar\";\nimport { DateInputSegments } from \"./date-field\";\nimport type { DatePickerBehaviorProps, DatePopoverPlacement, DateValue as LydsDateValue } from \"./date-types\";\nimport { CalendarGlyph, FieldLabel, FieldMessages, LocaleBoundary, cx, type DateTimeFieldChromeProps } from \"./shared\";\n\ninterface DatePickerChromeProps extends DateTimeFieldChromeProps {\n\topen?: boolean;\n\tdisabled?: boolean;\n\treadOnly?: boolean;\n\trequired?: boolean;\n\tinvalid?: boolean;\n\tweekdayStyle?: WeekdayStyle | undefined;\n\tshowMonthYearPickers?: boolean | undefined;\n\tpopoverPlacement?: DatePopoverPlacement | undefined;\n}\n\nexport interface DatePickerProps<T extends LydsDateValue = CalendarDate> extends DatePickerBehaviorProps<T>, DatePickerChromeProps {}\n\ntype DatePickerForwardedKeys = Exclude<keyof DatePickerBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"open\" | \"readOnly\" | \"required\">;\ntype DatePickerUnexpectedForwardedKeys = Exclude<DatePickerForwardedKeys, keyof AriaDatePickerProps<LydsDateValue>>;\ntype DatePickerPropContract = DatePickerUnexpectedForwardedKeys extends never ? true : never;\nconst datePickerPropContract: DatePickerPropContract = true;\nvoid datePickerPropContract;\n\n/**\n * 日期時間值保留自身語意。不含時區的日期時間請使用 `CalendarDateTime`;\n * 具明確時區的時間點請使用 `ZonedDateTime`。Linyao Design System 不會在兩者之間自動轉換。\n */\nexport type DateTimeValue = CalendarDateTime | ZonedDateTime;\n\nexport interface DateTimePickerProps<T extends DateTimeValue = CalendarDateTime> extends Omit<DatePickerProps<T>, \"granularity\"> {\n\tgranularity?: \"hour\" | \"minute\" | \"second\";\n}\n\nfunction SingleDatePicker<T extends LydsDateValue>(\n\t{\n\t\tlabel,\n\t\tdescription,\n\t\terror,\n\t\tlocale,\n\t\tsize = \"md\",\n\t\tclassName,\n\t\topen,\n\t\tdisabled,\n\t\treadOnly,\n\t\trequired,\n\t\tinvalid,\n\t\tonValueChange,\n\t\tfirstDayOfWeek,\n\t\tweekdayStyle,\n\t\tshowMonthYearPickers,\n\t\tpopoverPlacement = \"bottom start\",\n\t\t...pickerProps\n\t}: DatePickerProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>,\n\tdateTime: boolean\n) {\n\tconst ariaPickerProps = pickerProps as unknown as Omit<AriaDatePickerProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isOpen\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaDatePicker\n\t\t\t\t{...ariaPickerProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", \"lyds-date-picker\", dateTime && \"lyds-date-time-picker\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(open === undefined ? {} : { isOpen: open })}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaDatePickerProps<T>[\"onChange\"]> })}\n\t\t\t\t{...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<Group className=\"lyds-date-picker-group\">\n\t\t\t\t\t<DateInputSegments className=\"lyds-date-picker-input\" />\n\t\t\t\t\t<Button className=\"lyds-date-picker-button\">\n\t\t\t\t\t\t<CalendarGlyph />\n\t\t\t\t\t</Button>\n\t\t\t\t</Group>\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t\t<Popover className=\"lyds-date-popover\" placement={popoverPlacement}>\n\t\t\t\t\t<Dialog className=\"lyds-date-popover-dialog\">\n\t\t\t\t\t\t<AriaCalendar className=\"lyds-calendar\" {...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}>\n\t\t\t\t\t\t\t<CalendarPanel weekdayStyle={weekdayStyle} showMonthYearPickers={showMonthYearPickers} disabled={disabled} />\n\t\t\t\t\t\t</AriaCalendar>\n\t\t\t\t\t</Dialog>\n\t\t\t\t</Popover>\n\t\t\t</AriaDatePicker>\n\t\t</LocaleBoundary>\n\t);\n}\n\nfunction DatePickerImpl<T extends LydsDateValue>(props: DatePickerProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn SingleDatePicker(props, ref, false);\n}\n\nfunction DateTimePickerImpl<T extends DateTimeValue>(props: DateTimePickerProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn SingleDatePicker({ ...props, granularity: props.granularity ?? \"minute\" }, ref, true);\n}\n\nexport const DatePicker = forwardRef(DatePickerImpl) as <T extends LydsDateValue = CalendarDate>(props: DatePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n\nexport const DateTimePicker = forwardRef(DateTimePickerImpl) as <T extends DateTimeValue = CalendarDateTime>(props: DateTimePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;;;;;;AA0CA,SAAS,EACR,EACC,UACA,gBACA,UACA,WACA,UAAO,MACP,cACA,SACA,aACA,aACA,aACA,YACA,kBACA,mBACA,iBACA,yBACA,sBAAmB,gBACnB,GAAG,KAEJ,GACA,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,oBAAoB,KAAY,yBAAyB,CAAS;GACnG,aAAW;GACX,GAAK,MAAS,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,EAAK;GAC9C,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA4E;GAChI,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;GAX3D,UAAA;IAaC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,GAAD;KAAO,WAAU;KAAjB,UAAA,CACC,kBAAC,GAAD,EAAmB,WAAU,yBAA0B,CAAA,GACvD,kBAAC,GAAD;MAAQ,WAAU;MACjB,UAAA,kBAAC,GAAD,CAAgB,CAAA;KACT,CAAA,CACF;;IACP,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;IACxD,kBAAC,GAAD;KAAS,WAAU;KAAoB,WAAW;KACjD,UAAA,kBAAC,GAAD;MAAQ,WAAU;MACjB,UAAA,kBAAC,GAAD;OAAc,WAAU;OAAgB,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;OACjG,UAAA,kBAAC,GAAD;QAA6B;QAAoC;QAAgC;OAAW,CAAA;MAC/F,CAAA;KACP,CAAA;IACA,CAAA;GACM;;CACD,CAAA;AAElB;AAEA,SAAS,EAAwC,GAA2B,GAAyC;CACpH,OAAO,EAAiB,GAAO,GAAK,EAAK;AAC1C;AAEA,SAAS,EAA4C,GAA+B,GAAyC;CAC5H,OAAO,EAAiB;EAAE,GAAG;EAAO,aAAa,EAAM,eAAe;CAAS,GAAG,GAAK,EAAI;AAC5F;AAEA,IAAa,IAAa,EAAW,CAAc,GAEtC,IAAiB,EAAW,CAAkB"}
1
+ {"version":3,"file":"date-picker.js","names":[],"sources":["../../../src/components/date-time/date-picker.tsx"],"sourcesContent":["import { cx } from \"@/internal\";\nimport type { CalendarDate, CalendarDateTime, ZonedDateTime } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { Button } from \"react-aria-components/Button\";\nimport { Calendar as AriaCalendar } from \"react-aria-components/Calendar\";\nimport { DatePicker as AriaDatePicker, type DatePickerProps as AriaDatePickerProps } from \"react-aria-components/DatePicker\";\nimport { Dialog } from \"react-aria-components/Dialog\";\nimport { Group } from \"react-aria-components/Group\";\nimport { Popover } from \"react-aria-components/Popover\";\nimport { CalendarPanel, type WeekdayStyle } from \"./calendar\";\nimport { DateInputSegments } from \"./date-field\";\nimport type { DatePickerBehaviorProps, DatePopoverPlacement, DateValue as LydsDateValue } from \"./date-types\";\nimport { CalendarGlyph, FieldLabel, FieldMessages, LocaleBoundary, type DateTimeFieldChromeProps } from \"./shared\";\ninterface DatePickerChromeProps extends DateTimeFieldChromeProps {\n\topen?: boolean;\n\tdisabled?: boolean;\n\treadOnly?: boolean;\n\trequired?: boolean;\n\tinvalid?: boolean;\n\tweekdayStyle?: WeekdayStyle | undefined;\n\tshowMonthYearPickers?: boolean | undefined;\n\tpopoverPlacement?: DatePopoverPlacement | undefined;\n}\n\nexport interface DatePickerProps<T extends LydsDateValue = CalendarDate> extends DatePickerBehaviorProps<T>, DatePickerChromeProps {}\n\ntype DatePickerForwardedKeys = Exclude<keyof DatePickerBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"open\" | \"readOnly\" | \"required\">;\ntype DatePickerUnexpectedForwardedKeys = Exclude<DatePickerForwardedKeys, keyof AriaDatePickerProps<LydsDateValue>>;\ntype DatePickerPropContract = DatePickerUnexpectedForwardedKeys extends never ? true : never;\nconst datePickerPropContract: DatePickerPropContract = true;\nvoid datePickerPropContract;\n\n/**\n * 日期時間值保留自身語意。不含時區的日期時間請使用 `CalendarDateTime`;\n * 具明確時區的時間點請使用 `ZonedDateTime`。Linyao Design System 不會在兩者之間自動轉換。\n */\nexport type DateTimeValue = CalendarDateTime | ZonedDateTime;\n\nexport interface DateTimePickerProps<T extends DateTimeValue = CalendarDateTime> extends Omit<DatePickerProps<T>, \"granularity\"> {\n\tgranularity?: \"hour\" | \"minute\" | \"second\";\n}\n\nfunction SingleDatePicker<T extends LydsDateValue>(\n\t{\n\t\tlabel,\n\t\tdescription,\n\t\terror,\n\t\tlocale,\n\t\tsize = \"md\",\n\t\tclassName,\n\t\topen,\n\t\tdisabled,\n\t\treadOnly,\n\t\trequired,\n\t\tinvalid,\n\t\tonValueChange,\n\t\tfirstDayOfWeek,\n\t\tweekdayStyle,\n\t\tshowMonthYearPickers,\n\t\tpopoverPlacement = \"bottom start\",\n\t\t...pickerProps\n\t}: DatePickerProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>,\n\tdateTime: boolean\n) {\n\tconst ariaPickerProps = pickerProps as unknown as Omit<AriaDatePickerProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isOpen\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaDatePicker\n\t\t\t\t{...ariaPickerProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", \"lyds-date-picker\", dateTime && \"lyds-date-time-picker\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(open === undefined ? {} : { isOpen: open })}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaDatePickerProps<T>[\"onChange\"]> })}\n\t\t\t\t{...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<Group className=\"lyds-date-picker-group\">\n\t\t\t\t\t<DateInputSegments className=\"lyds-date-picker-input\" />\n\t\t\t\t\t<Button className=\"lyds-date-picker-button\">\n\t\t\t\t\t\t<CalendarGlyph />\n\t\t\t\t\t</Button>\n\t\t\t\t</Group>\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t\t<Popover className=\"lyds-date-popover\" placement={popoverPlacement}>\n\t\t\t\t\t<Dialog className=\"lyds-date-popover-dialog\">\n\t\t\t\t\t\t<AriaCalendar className=\"lyds-calendar\" {...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}>\n\t\t\t\t\t\t\t<CalendarPanel weekdayStyle={weekdayStyle} showMonthYearPickers={showMonthYearPickers} disabled={disabled} />\n\t\t\t\t\t\t</AriaCalendar>\n\t\t\t\t\t</Dialog>\n\t\t\t\t</Popover>\n\t\t\t</AriaDatePicker>\n\t\t</LocaleBoundary>\n\t);\n}\n\nfunction DatePickerImpl<T extends LydsDateValue>(props: DatePickerProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn SingleDatePicker(props, ref, false);\n}\n\nfunction DateTimePickerImpl<T extends DateTimeValue>(props: DateTimePickerProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn SingleDatePicker({ ...props, granularity: props.granularity ?? \"minute\" }, ref, true);\n}\n\nexport const DatePicker = forwardRef(DatePickerImpl) as <T extends LydsDateValue = CalendarDate>(props: DatePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n\nexport const DateTimePicker = forwardRef(DateTimePickerImpl) as <T extends DateTimeValue = CalendarDateTime>(props: DateTimePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;;;;;;;;AA0CA,SAAS,EACR,EACC,UACA,gBACA,UACA,WACA,UAAO,MACP,cACA,SACA,aACA,aACA,aACA,YACA,kBACA,mBACA,iBACA,yBACA,sBAAmB,gBACnB,GAAG,KAEJ,GACA,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,oBAAoB,KAAY,yBAAyB,CAAS;GACnG,aAAW;GACX,GAAK,MAAS,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,EAAK;GAC9C,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA4E;GAChI,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;GAX3D,UAAA;IAaC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,GAAD;KAAO,WAAU;KAAjB,UAAA,CACC,kBAAC,GAAD,EAAmB,WAAU,yBAA0B,CAAA,GACvD,kBAAC,GAAD;MAAQ,WAAU;MACjB,UAAA,kBAAC,GAAD,CAAgB,CAAA;KACT,CAAA,CACF;;IACP,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;IACxD,kBAAC,GAAD;KAAS,WAAU;KAAoB,WAAW;KACjD,UAAA,kBAAC,GAAD;MAAQ,WAAU;MACjB,UAAA,kBAAC,GAAD;OAAc,WAAU;OAAgB,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;OACjG,UAAA,kBAAC,GAAD;QAA6B;QAAoC;QAAgC;OAAW,CAAA;MAC/F,CAAA;KACP,CAAA;IACA,CAAA;GACM;;CACD,CAAA;AAElB;AAEA,SAAS,EAAwC,GAA2B,GAAyC;CACpH,OAAO,EAAiB,GAAO,GAAK,EAAK;AAC1C;AAEA,SAAS,EAA4C,GAA+B,GAAyC;CAC5H,OAAO,EAAiB;EAAE,GAAG;EAAO,aAAa,EAAM,eAAe;CAAS,GAAG,GAAK,EAAI;AAC5F;AAEA,IAAa,IAAa,EAAW,CAAc,GAEtC,IAAiB,EAAW,CAAkB"}
@@ -1,4 +1,6 @@
1
- import { CalendarGlyph as e, FieldLabel as t, FieldMessages as n, LocaleBoundary as r, cx as i } from "./shared.js";
1
+ "use client";
2
+ import { cx as e } from "../../internal/class-names.js";
3
+ import { CalendarGlyph as t, FieldLabel as n, FieldMessages as r, LocaleBoundary as i } from "./shared.js";
2
4
  import { CalendarPanel as a } from "./calendar.js";
3
5
  import { DateInputSegments as o } from "./date-field.js";
4
6
  import { forwardRef as s } from "react";
@@ -10,12 +12,12 @@ import { Popover as p } from "react-aria-components/Popover";
10
12
  import { DateRangePicker as m, RangeCalendar as h } from "react-aria-components/DateRangePicker";
11
13
  //#region src/components/date-time/date-range-picker.tsx
12
14
  function g({ label: s, description: g, error: _, locale: v, size: y = "md", className: b, open: x, disabled: S, readOnly: C, required: w, invalid: T, onValueChange: E, firstDayOfWeek: D, weekdayStyle: O, showMonthYearPickers: k, popoverPlacement: A = "bottom start", ...j }, M) {
13
- return /* @__PURE__ */ l(r, {
15
+ return /* @__PURE__ */ l(i, {
14
16
  locale: v,
15
17
  children: /* @__PURE__ */ u(m, {
16
18
  ...j,
17
19
  ref: M,
18
- className: i("lyds-date-field", "lyds-date-picker", "lyds-date-range-picker", b),
20
+ className: e("lyds-date-field", "lyds-date-picker", "lyds-date-range-picker", b),
19
21
  "data-size": y,
20
22
  ...x === void 0 ? {} : { isOpen: x },
21
23
  ...S === void 0 ? {} : { isDisabled: S },
@@ -25,7 +27,7 @@ function g({ label: s, description: g, error: _, locale: v, size: y = "md", clas
25
27
  ...E === void 0 ? {} : { onChange: E },
26
28
  ...D === void 0 ? {} : { firstDayOfWeek: D },
27
29
  children: [
28
- /* @__PURE__ */ l(t, { children: s }),
30
+ /* @__PURE__ */ l(n, { children: s }),
29
31
  /* @__PURE__ */ u(f, {
30
32
  className: "lyds-date-picker-group",
31
33
  children: [
@@ -44,11 +46,11 @@ function g({ label: s, description: g, error: _, locale: v, size: y = "md", clas
44
46
  }),
45
47
  /* @__PURE__ */ l(c, {
46
48
  className: "lyds-date-picker-button",
47
- children: /* @__PURE__ */ l(e, {})
49
+ children: /* @__PURE__ */ l(t, {})
48
50
  })
49
51
  ]
50
52
  }),
51
- /* @__PURE__ */ l(n, {
53
+ /* @__PURE__ */ l(r, {
52
54
  description: g,
53
55
  error: _
54
56
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"date-range-picker.js","names":[],"sources":["../../../src/components/date-time/date-range-picker.tsx"],"sourcesContent":["import type { CalendarDate } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { Button } from \"react-aria-components/Button\";\nimport { DateRangePicker as AriaDateRangePicker, RangeCalendar, type DateRangePickerProps as AriaDateRangePickerProps } from \"react-aria-components/DateRangePicker\";\nimport { Dialog } from \"react-aria-components/Dialog\";\nimport { Group } from \"react-aria-components/Group\";\nimport { Popover } from \"react-aria-components/Popover\";\nimport { CalendarPanel, type WeekdayStyle } from \"./calendar\";\nimport { DateInputSegments } from \"./date-field\";\nimport type { DatePopoverPlacement, DateRangePickerBehaviorProps, DateValue as LydsDateValue } from \"./date-types\";\nimport { CalendarGlyph, FieldLabel, FieldMessages, LocaleBoundary, cx, type DateTimeFieldChromeProps } from \"./shared\";\n\nexport interface DateRangePickerProps<T extends LydsDateValue = CalendarDate> extends DateRangePickerBehaviorProps<T>, DateTimeFieldChromeProps {\n\tweekdayStyle?: WeekdayStyle | undefined;\n\tshowMonthYearPickers?: boolean | undefined;\n\tpopoverPlacement?: DatePopoverPlacement | undefined;\n}\n\ntype DateRangePickerForwardedKeys = Exclude<keyof DateRangePickerBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"open\" | \"readOnly\" | \"required\">;\ntype DateRangePickerUnexpectedForwardedKeys = Exclude<DateRangePickerForwardedKeys, keyof AriaDateRangePickerProps<LydsDateValue>>;\ntype DateRangePickerPropContract = DateRangePickerUnexpectedForwardedKeys extends never ? true : never;\nconst dateRangePickerPropContract: DateRangePickerPropContract = true;\nvoid dateRangePickerPropContract;\n\nfunction DateRangePickerImpl<T extends LydsDateValue>(\n\t{\n\t\tlabel,\n\t\tdescription,\n\t\terror,\n\t\tlocale,\n\t\tsize = \"md\",\n\t\tclassName,\n\t\topen,\n\t\tdisabled,\n\t\treadOnly,\n\t\trequired,\n\t\tinvalid,\n\t\tonValueChange,\n\t\tfirstDayOfWeek,\n\t\tweekdayStyle,\n\t\tshowMonthYearPickers,\n\t\tpopoverPlacement = \"bottom start\",\n\t\t...pickerProps\n\t}: DateRangePickerProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>\n) {\n\tconst ariaPickerProps = pickerProps as unknown as Omit<AriaDateRangePickerProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isOpen\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaDateRangePicker\n\t\t\t\t{...ariaPickerProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", \"lyds-date-picker\", \"lyds-date-range-picker\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(open === undefined ? {} : { isOpen: open })}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaDateRangePickerProps<T>[\"onChange\"]> })}\n\t\t\t\t{...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<Group className=\"lyds-date-picker-group\">\n\t\t\t\t\t<DateInputSegments className=\"lyds-date-picker-input\" slot=\"start\" />\n\t\t\t\t\t<span className=\"lyds-date-range-separator\" aria-hidden=\"true\">\n\t\t\t\t\t\t–\n\t\t\t\t\t</span>\n\t\t\t\t\t<DateInputSegments className=\"lyds-date-picker-input\" slot=\"end\" />\n\t\t\t\t\t<Button className=\"lyds-date-picker-button\">\n\t\t\t\t\t\t<CalendarGlyph />\n\t\t\t\t\t</Button>\n\t\t\t\t</Group>\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t\t<Popover className=\"lyds-date-popover\" placement={popoverPlacement}>\n\t\t\t\t\t<Dialog className=\"lyds-date-popover-dialog\">\n\t\t\t\t\t\t<RangeCalendar className=\"lyds-calendar lyds-range-calendar\" {...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}>\n\t\t\t\t\t\t\t<CalendarPanel weekdayStyle={weekdayStyle} showMonthYearPickers={showMonthYearPickers} disabled={disabled} />\n\t\t\t\t\t\t</RangeCalendar>\n\t\t\t\t\t</Dialog>\n\t\t\t\t</Popover>\n\t\t\t</AriaDateRangePicker>\n\t\t</LocaleBoundary>\n\t);\n}\n\nexport const DateRangePicker = forwardRef(DateRangePickerImpl) as <T extends LydsDateValue = CalendarDate>(props: DateRangePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;;;;;AAwBA,SAAS,EACR,EACC,UACA,gBACA,UACA,WACA,UAAO,MACP,cACA,SACA,aACA,aACA,aACA,YACA,kBACA,mBACA,iBACA,yBACA,sBAAmB,gBACnB,GAAG,KAEJ,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,oBAAoB,0BAA0B,CAAS;GACxF,aAAW;GACX,GAAK,MAAS,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,EAAK;GAC9C,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAAiF;GACrI,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;GAX3D,UAAA;IAaC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,GAAD;KAAO,WAAU;KAAjB,UAAA;MACC,kBAAC,GAAD;OAAmB,WAAU;OAAyB,MAAK;MAAS,CAAA;MACpE,kBAAC,QAAD;OAAM,WAAU;OAA4B,eAAY;OAAO,UAAA;MAEzD,CAAA;MACN,kBAAC,GAAD;OAAmB,WAAU;OAAyB,MAAK;MAAO,CAAA;MAClE,kBAAC,GAAD;OAAQ,WAAU;OACjB,UAAA,kBAAC,GAAD,CAAgB,CAAA;MACT,CAAA;KACF;;IACP,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;IACxD,kBAAC,GAAD;KAAS,WAAU;KAAoB,WAAW;KACjD,UAAA,kBAAC,GAAD;MAAQ,WAAU;MACjB,UAAA,kBAAC,GAAD;OAAe,WAAU;OAAoC,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;OACtH,UAAA,kBAAC,GAAD;QAA6B;QAAoC;QAAgC;OAAW,CAAA;MAC9F,CAAA;KACR,CAAA;IACA,CAAA;GACW;;CACN,CAAA;AAElB;AAEA,IAAa,IAAkB,EAAW,CAAmB"}
1
+ {"version":3,"file":"date-range-picker.js","names":[],"sources":["../../../src/components/date-time/date-range-picker.tsx"],"sourcesContent":["import { cx } from \"@/internal\";\nimport type { CalendarDate } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { Button } from \"react-aria-components/Button\";\nimport { DateRangePicker as AriaDateRangePicker, RangeCalendar, type DateRangePickerProps as AriaDateRangePickerProps } from \"react-aria-components/DateRangePicker\";\nimport { Dialog } from \"react-aria-components/Dialog\";\nimport { Group } from \"react-aria-components/Group\";\nimport { Popover } from \"react-aria-components/Popover\";\nimport { CalendarPanel, type WeekdayStyle } from \"./calendar\";\nimport { DateInputSegments } from \"./date-field\";\nimport type { DatePopoverPlacement, DateRangePickerBehaviorProps, DateValue as LydsDateValue } from \"./date-types\";\nimport { CalendarGlyph, FieldLabel, FieldMessages, LocaleBoundary, type DateTimeFieldChromeProps } from \"./shared\";\nexport interface DateRangePickerProps<T extends LydsDateValue = CalendarDate> extends DateRangePickerBehaviorProps<T>, DateTimeFieldChromeProps {\n\tweekdayStyle?: WeekdayStyle | undefined;\n\tshowMonthYearPickers?: boolean | undefined;\n\tpopoverPlacement?: DatePopoverPlacement | undefined;\n}\n\ntype DateRangePickerForwardedKeys = Exclude<keyof DateRangePickerBehaviorProps<LydsDateValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"open\" | \"readOnly\" | \"required\">;\ntype DateRangePickerUnexpectedForwardedKeys = Exclude<DateRangePickerForwardedKeys, keyof AriaDateRangePickerProps<LydsDateValue>>;\ntype DateRangePickerPropContract = DateRangePickerUnexpectedForwardedKeys extends never ? true : never;\nconst dateRangePickerPropContract: DateRangePickerPropContract = true;\nvoid dateRangePickerPropContract;\n\nfunction DateRangePickerImpl<T extends LydsDateValue>(\n\t{\n\t\tlabel,\n\t\tdescription,\n\t\terror,\n\t\tlocale,\n\t\tsize = \"md\",\n\t\tclassName,\n\t\topen,\n\t\tdisabled,\n\t\treadOnly,\n\t\trequired,\n\t\tinvalid,\n\t\tonValueChange,\n\t\tfirstDayOfWeek,\n\t\tweekdayStyle,\n\t\tshowMonthYearPickers,\n\t\tpopoverPlacement = \"bottom start\",\n\t\t...pickerProps\n\t}: DateRangePickerProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>\n) {\n\tconst ariaPickerProps = pickerProps as unknown as Omit<AriaDateRangePickerProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isOpen\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaDateRangePicker\n\t\t\t\t{...ariaPickerProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", \"lyds-date-picker\", \"lyds-date-range-picker\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(open === undefined ? {} : { isOpen: open })}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaDateRangePickerProps<T>[\"onChange\"]> })}\n\t\t\t\t{...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<Group className=\"lyds-date-picker-group\">\n\t\t\t\t\t<DateInputSegments className=\"lyds-date-picker-input\" slot=\"start\" />\n\t\t\t\t\t<span className=\"lyds-date-range-separator\" aria-hidden=\"true\">\n\t\t\t\t\t\t–\n\t\t\t\t\t</span>\n\t\t\t\t\t<DateInputSegments className=\"lyds-date-picker-input\" slot=\"end\" />\n\t\t\t\t\t<Button className=\"lyds-date-picker-button\">\n\t\t\t\t\t\t<CalendarGlyph />\n\t\t\t\t\t</Button>\n\t\t\t\t</Group>\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t\t<Popover className=\"lyds-date-popover\" placement={popoverPlacement}>\n\t\t\t\t\t<Dialog className=\"lyds-date-popover-dialog\">\n\t\t\t\t\t\t<RangeCalendar className=\"lyds-calendar lyds-range-calendar\" {...(firstDayOfWeek === undefined ? {} : { firstDayOfWeek })}>\n\t\t\t\t\t\t\t<CalendarPanel weekdayStyle={weekdayStyle} showMonthYearPickers={showMonthYearPickers} disabled={disabled} />\n\t\t\t\t\t\t</RangeCalendar>\n\t\t\t\t\t</Dialog>\n\t\t\t\t</Popover>\n\t\t\t</AriaDateRangePicker>\n\t\t</LocaleBoundary>\n\t);\n}\n\nexport const DateRangePicker = forwardRef(DateRangePickerImpl) as <T extends LydsDateValue = CalendarDate>(props: DateRangePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;;;;;;;AAwBA,SAAS,EACR,EACC,UACA,gBACA,UACA,WACA,UAAO,MACP,cACA,SACA,aACA,aACA,aACA,YACA,kBACA,mBACA,iBACA,yBACA,sBAAmB,gBACnB,GAAG,KAEJ,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,oBAAoB,0BAA0B,CAAS;GACxF,aAAW;GACX,GAAK,MAAS,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,EAAK;GAC9C,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAAiF;GACrI,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;GAX3D,UAAA;IAaC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,GAAD;KAAO,WAAU;KAAjB,UAAA;MACC,kBAAC,GAAD;OAAmB,WAAU;OAAyB,MAAK;MAAS,CAAA;MACpE,kBAAC,QAAD;OAAM,WAAU;OAA4B,eAAY;OAAO,UAAA;MAEzD,CAAA;MACN,kBAAC,GAAD;OAAmB,WAAU;OAAyB,MAAK;MAAO,CAAA;MAClE,kBAAC,GAAD;OAAQ,WAAU;OACjB,UAAA,kBAAC,GAAD,CAAgB,CAAA;MACT,CAAA;KACF;;IACP,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;IACxD,kBAAC,GAAD;KAAS,WAAU;KAAoB,WAAW;KACjD,UAAA,kBAAC,GAAD;MAAQ,WAAU;MACjB,UAAA,kBAAC,GAAD;OAAe,WAAU;OAAoC,GAAK,MAAmB,KAAA,IAAY,CAAC,IAAI,EAAE,kBAAe;OACtH,UAAA,kBAAC,GAAD;QAA6B;QAAoC;QAAgC;OAAW,CAAA;MAC9F,CAAA;KACR,CAAA;IACA,CAAA;GACW;;CACN,CAAA;AAElB;AAEA,IAAa,IAAkB,EAAW,CAAmB"}
@@ -1,4 +1,4 @@
1
- /* empty css */
1
+ "use client";
2
2
  import { Calendar as e } from "./calendar.js";
3
3
  import { DateField as t } from "./date-field.js";
4
4
  import { DatePicker as n, DateTimePicker as r } from "./date-picker.js";
@@ -12,7 +12,6 @@ export interface DateTimeFieldChromeProps {
12
12
  size?: DateTimeSize;
13
13
  className?: string;
14
14
  }
15
- export declare function cx(...values: Array<string | false | null | undefined>): string;
16
15
  export declare function LocaleBoundary({ locale, children }: {
17
16
  locale?: string | undefined;
18
17
  children: ReactNode;
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import { CalendarDotsIcon as e } from "@phosphor-icons/react/dist/csr/CalendarDots";
2
3
  import { ClockIcon as t } from "@phosphor-icons/react/dist/csr/Clock";
3
4
  import { FieldError as n } from "react-aria-components/FieldError";
@@ -6,22 +7,19 @@ import { Label as i } from "react-aria-components/Label";
6
7
  import { Text as a } from "react-aria-components/Text";
7
8
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
8
9
  //#region src/components/date-time/shared.tsx
9
- function l(...e) {
10
- return e.filter(Boolean).join(" ");
11
- }
12
- function u({ locale: e, children: t }) {
10
+ function l({ locale: e, children: t }) {
13
11
  return e ? /* @__PURE__ */ s(r, {
14
12
  locale: e,
15
13
  children: t
16
14
  }) : /* @__PURE__ */ s(o, { children: t });
17
15
  }
18
- function d({ children: e }) {
16
+ function u({ children: e }) {
19
17
  return e == null ? null : /* @__PURE__ */ s(i, {
20
18
  className: "lyds-date-label",
21
19
  children: e
22
20
  });
23
21
  }
24
- function f({ description: e, error: t }) {
22
+ function d({ description: e, error: t }) {
25
23
  return /* @__PURE__ */ c(o, { children: [e == null ? null : /* @__PURE__ */ s(a, {
26
24
  slot: "description",
27
25
  className: "lyds-date-description",
@@ -33,14 +31,14 @@ function f({ description: e, error: t }) {
33
31
  children: t
34
32
  })] });
35
33
  }
36
- function p() {
34
+ function f() {
37
35
  return /* @__PURE__ */ s(e, {
38
36
  "aria-hidden": "true",
39
37
  className: "lyds-date-glyph",
40
38
  weight: "regular"
41
39
  });
42
40
  }
43
- function m() {
41
+ function p() {
44
42
  return /* @__PURE__ */ s(t, {
45
43
  "aria-hidden": "true",
46
44
  className: "lyds-date-glyph",
@@ -48,6 +46,6 @@ function m() {
48
46
  });
49
47
  }
50
48
  //#endregion
51
- export { p as CalendarGlyph, m as ClockGlyph, d as FieldLabel, f as FieldMessages, u as LocaleBoundary, l as cx };
49
+ export { f as CalendarGlyph, p as ClockGlyph, u as FieldLabel, d as FieldMessages, l as LocaleBoundary };
52
50
 
53
51
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","names":[],"sources":["../../../src/components/date-time/shared.tsx"],"sourcesContent":["import { CalendarDotsIcon } from \"@phosphor-icons/react/dist/csr/CalendarDots\";\nimport { ClockIcon } from \"@phosphor-icons/react/dist/csr/Clock\";\nimport type { ReactNode } from \"react\";\nimport { FieldError } from \"react-aria-components/FieldError\";\nimport { I18nProvider } from \"react-aria-components/I18nProvider\";\nimport { Label } from \"react-aria-components/Label\";\nimport { Text } from \"react-aria-components/Text\";\n\nexport type DateTimeSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface DateTimeFieldChromeProps {\n\t/** 欄位的可見標籤。不適合顯示可見標籤時,請改用 `aria-label`。 */\n\tlabel?: ReactNode;\n\t/** 透過 React Aria 與控制項關聯的補充說明。 */\n\tdescription?: ReactNode;\n\t/** 與控制項關聯的驗證訊息。 */\n\terror?: ReactNode;\n\t/** 用於區段順序、標籤與數字格式的 BCP 47 地區設定。省略時沿用最近的 `I18nProvider`。 */\n\tlocale?: string | undefined;\n\tsize?: DateTimeSize;\n\tclassName?: string;\n}\n\nexport function cx(...values: Array<string | false | null | undefined>): string {\n\treturn values.filter(Boolean).join(\" \");\n}\n\nexport function LocaleBoundary({ locale, children }: { locale?: string | undefined; children: ReactNode }) {\n\tif (!locale) {\n\t\treturn <>{children}</>;\n\t}\n\n\treturn <I18nProvider locale={locale}>{children}</I18nProvider>;\n}\n\nexport function FieldLabel({ children }: { children?: ReactNode }) {\n\treturn children == null ? null : <Label className=\"lyds-date-label\">{children}</Label>;\n}\n\nexport function FieldMessages({ description, error }: Pick<DateTimeFieldChromeProps, \"description\" | \"error\">) {\n\treturn (\n\t\t<>\n\t\t\t{description == null ? null : (\n\t\t\t\t<Text slot=\"description\" className=\"lyds-date-description\">\n\t\t\t\t\t{description}\n\t\t\t\t</Text>\n\t\t\t)}\n\t\t\t{error == null ? null : (\n\t\t\t\t<FieldError aria-atomic=\"true\" aria-live=\"polite\" className=\"lyds-date-error\">\n\t\t\t\t\t{error}\n\t\t\t\t</FieldError>\n\t\t\t)}\n\t\t</>\n\t);\n}\n\nexport function CalendarGlyph() {\n\treturn <CalendarDotsIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"regular\" />;\n}\n\nexport function ClockGlyph() {\n\treturn <ClockIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"regular\" />;\n}\n"],"mappings":";;;;;;;;AAuBA,SAAgB,EAAG,GAAG,GAA0D;CAC/E,OAAO,EAAO,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AAEA,SAAgB,EAAe,EAAE,WAAQ,eAAkE;CAK1G,OAJK,IAIE,kBAAC,GAAD;EAAsB;EAAS;CAAuB,CAAA,IAHrD,kBAAA,GAAA,EAAG,YAAW,CAAA;AAIvB;AAEA,SAAgB,EAAW,EAAE,eAAsC;CAClE,OAAO,KAAY,OAAO,OAAO,kBAAC,GAAD;EAAO,WAAU;EAAmB;CAAgB,CAAA;AACtF;AAEA,SAAgB,EAAc,EAAE,gBAAa,YAAkE;CAC9G,OACC,kBAAA,GAAA,EAAA,UAAA,CACE,KAAe,OAAO,OACtB,kBAAC,GAAD;EAAM,MAAK;EAAc,WAAU;EACjC,UAAA;CACI,CAAA,GAEN,KAAS,OAAO,OAChB,kBAAC,GAAD;EAAY,eAAY;EAAO,aAAU;EAAS,WAAU;EAC1D,UAAA;CACU,CAAA,CAEZ,EAAA,CAAA;AAEJ;AAEA,SAAgB,IAAgB;CAC/B,OAAO,kBAAC,GAAD;EAAkB,eAAY;EAAO,WAAU;EAAkB,QAAO;CAAW,CAAA;AAC3F;AAEA,SAAgB,IAAa;CAC5B,OAAO,kBAAC,GAAD;EAAW,eAAY;EAAO,WAAU;EAAkB,QAAO;CAAW,CAAA;AACpF"}
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../../src/components/date-time/shared.tsx"],"sourcesContent":["import { CalendarDotsIcon } from \"@phosphor-icons/react/dist/csr/CalendarDots\";\nimport { ClockIcon } from \"@phosphor-icons/react/dist/csr/Clock\";\nimport type { ReactNode } from \"react\";\nimport { FieldError } from \"react-aria-components/FieldError\";\nimport { I18nProvider } from \"react-aria-components/I18nProvider\";\nimport { Label } from \"react-aria-components/Label\";\nimport { Text } from \"react-aria-components/Text\";\n\nexport type DateTimeSize = \"sm\" | \"md\" | \"lg\";\n\nexport interface DateTimeFieldChromeProps {\n\t/** 欄位的可見標籤。不適合顯示可見標籤時,請改用 `aria-label`。 */\n\tlabel?: ReactNode;\n\t/** 透過 React Aria 與控制項關聯的補充說明。 */\n\tdescription?: ReactNode;\n\t/** 與控制項關聯的驗證訊息。 */\n\terror?: ReactNode;\n\t/** 用於區段順序、標籤與數字格式的 BCP 47 地區設定。省略時沿用最近的 `I18nProvider`。 */\n\tlocale?: string | undefined;\n\tsize?: DateTimeSize;\n\tclassName?: string;\n}\n\nexport function LocaleBoundary({ locale, children }: { locale?: string | undefined; children: ReactNode }) {\n\tif (!locale) {\n\t\treturn <>{children}</>;\n\t}\n\n\treturn <I18nProvider locale={locale}>{children}</I18nProvider>;\n}\n\nexport function FieldLabel({ children }: { children?: ReactNode }) {\n\treturn children == null ? null : <Label className=\"lyds-date-label\">{children}</Label>;\n}\n\nexport function FieldMessages({ description, error }: Pick<DateTimeFieldChromeProps, \"description\" | \"error\">) {\n\treturn (\n\t\t<>\n\t\t\t{description == null ? null : (\n\t\t\t\t<Text slot=\"description\" className=\"lyds-date-description\">\n\t\t\t\t\t{description}\n\t\t\t\t</Text>\n\t\t\t)}\n\t\t\t{error == null ? null : (\n\t\t\t\t<FieldError aria-atomic=\"true\" aria-live=\"polite\" className=\"lyds-date-error\">\n\t\t\t\t\t{error}\n\t\t\t\t</FieldError>\n\t\t\t)}\n\t\t</>\n\t);\n}\n\nexport function CalendarGlyph() {\n\treturn <CalendarDotsIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"regular\" />;\n}\n\nexport function ClockGlyph() {\n\treturn <ClockIcon aria-hidden=\"true\" className=\"lyds-date-glyph\" weight=\"regular\" />;\n}\n"],"mappings":";;;;;;;;;AAuBA,SAAgB,EAAe,EAAE,WAAQ,eAAkE;CAK1G,OAJK,IAIE,kBAAC,GAAD;EAAsB;EAAS;CAAuB,CAAA,IAHrD,kBAAA,GAAA,EAAG,YAAW,CAAA;AAIvB;AAEA,SAAgB,EAAW,EAAE,eAAsC;CAClE,OAAO,KAAY,OAAO,OAAO,kBAAC,GAAD;EAAO,WAAU;EAAmB;CAAgB,CAAA;AACtF;AAEA,SAAgB,EAAc,EAAE,gBAAa,YAAkE;CAC9G,OACC,kBAAA,GAAA,EAAA,UAAA,CACE,KAAe,OAAO,OACtB,kBAAC,GAAD;EAAM,MAAK;EAAc,WAAU;EACjC,UAAA;CACI,CAAA,GAEN,KAAS,OAAO,OAChB,kBAAC,GAAD;EAAY,eAAY;EAAO,aAAU;EAAS,WAAU;EAC1D,UAAA;CACU,CAAA,CAEZ,EAAA,CAAA;AAEJ;AAEA,SAAgB,IAAgB;CAC/B,OAAO,kBAAC,GAAD;EAAkB,eAAY;EAAO,WAAU;EAAkB,QAAO;CAAW,CAAA;AAC3F;AAEA,SAAgB,IAAa;CAC5B,OAAO,kBAAC,GAAD;EAAW,eAAY;EAAO,WAAU;EAAkB,QAAO;CAAW,CAAA;AACpF"}
@@ -1,15 +1,17 @@
1
- import { ClockGlyph as e, FieldLabel as t, FieldMessages as n, LocaleBoundary as r, cx as i } from "./shared.js";
1
+ "use client";
2
+ import { cx as e } from "../../internal/class-names.js";
3
+ import { ClockGlyph as t, FieldLabel as n, FieldMessages as r, LocaleBoundary as i } from "./shared.js";
2
4
  import { forwardRef as a } from "react";
3
5
  import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
6
  import { DateInput as c, DateSegment as l, TimeField as u } from "react-aria-components/TimeField";
5
7
  //#region src/components/date-time/time-field.tsx
6
8
  function d({ label: a, description: d, error: f, locale: p, size: m = "md", className: h, disabled: g, readOnly: _, required: v, invalid: y, onValueChange: b, ...x }, S, C) {
7
- return /* @__PURE__ */ o(r, {
9
+ return /* @__PURE__ */ o(i, {
8
10
  locale: p,
9
11
  children: /* @__PURE__ */ s(u, {
10
12
  ...x,
11
13
  ref: S,
12
- className: i("lyds-date-field", "lyds-time-field", C && "lyds-time-picker", h),
14
+ className: e("lyds-date-field", "lyds-time-field", C && "lyds-time-picker", h),
13
15
  "data-size": m,
14
16
  ...g === void 0 ? {} : { isDisabled: g },
15
17
  ..._ === void 0 ? {} : { isReadOnly: _ },
@@ -17,7 +19,7 @@ function d({ label: a, description: d, error: f, locale: p, size: m = "md", clas
17
19
  ...y === void 0 ? {} : { isInvalid: y },
18
20
  ...b === void 0 ? {} : { onChange: b },
19
21
  children: [
20
- /* @__PURE__ */ o(t, { children: a }),
22
+ /* @__PURE__ */ o(n, { children: a }),
21
23
  /* @__PURE__ */ s("div", {
22
24
  className: "lyds-date-input-shell",
23
25
  children: [/* @__PURE__ */ o(c, {
@@ -28,10 +30,10 @@ function d({ label: a, description: d, error: f, locale: p, size: m = "md", clas
28
30
  })
29
31
  }), C ? /* @__PURE__ */ o("span", {
30
32
  className: "lyds-date-input-affordance",
31
- children: /* @__PURE__ */ o(e, {})
33
+ children: /* @__PURE__ */ o(t, {})
32
34
  }) : null]
33
35
  }),
34
- /* @__PURE__ */ o(n, {
36
+ /* @__PURE__ */ o(r, {
35
37
  description: d,
36
38
  error: f
37
39
  })
@@ -1 +1 @@
1
- {"version":3,"file":"time-field.js","names":[],"sources":["../../../src/components/date-time/time-field.tsx"],"sourcesContent":["import type { Time } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { TimeField as AriaTimeField, DateInput, DateSegment, type TimeFieldProps as AriaTimeFieldProps } from \"react-aria-components/TimeField\";\nimport type { TimeValue as LydsTimeValue, TimeFieldBehaviorProps } from \"./date-types\";\nimport { ClockGlyph, FieldLabel, FieldMessages, LocaleBoundary, cx, type DateTimeFieldChromeProps } from \"./shared\";\n\nexport interface TimeFieldProps<T extends LydsTimeValue = Time> extends TimeFieldBehaviorProps<T>, DateTimeFieldChromeProps {}\n\nexport type TimePickerProps<T extends LydsTimeValue = Time> = TimeFieldProps<T>;\n\ntype TimeFieldForwardedKeys = Exclude<keyof TimeFieldBehaviorProps<LydsTimeValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"readOnly\" | \"required\">;\ntype TimeFieldUnexpectedForwardedKeys = Exclude<TimeFieldForwardedKeys, keyof AriaTimeFieldProps<LydsTimeValue>>;\ntype TimeFieldPropContract = TimeFieldUnexpectedForwardedKeys extends never ? true : never;\nconst timeFieldPropContract: TimeFieldPropContract = true;\nvoid timeFieldPropContract;\n\nfunction TimeControl<T extends LydsTimeValue>(\n\t{ label, description, error, locale, size = \"md\", className, disabled, readOnly, required, invalid, onValueChange, ...fieldProps }: TimeFieldProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>,\n\tshowPickerGlyph: boolean\n) {\n\tconst ariaFieldProps = fieldProps as unknown as Omit<AriaTimeFieldProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaTimeField\n\t\t\t\t{...ariaFieldProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", \"lyds-time-field\", showPickerGlyph && \"lyds-time-picker\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaTimeFieldProps<T>[\"onChange\"]> })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<div className=\"lyds-date-input-shell\">\n\t\t\t\t\t<DateInput className=\"lyds-date-input\">{segment => <DateSegment segment={segment} className=\"lyds-date-segment\" />}</DateInput>\n\t\t\t\t\t{showPickerGlyph ? (\n\t\t\t\t\t\t<span className=\"lyds-date-input-affordance\">\n\t\t\t\t\t\t\t<ClockGlyph />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t</AriaTimeField>\n\t\t</LocaleBoundary>\n\t);\n}\n\nfunction TimeFieldImpl<T extends LydsTimeValue>(props: TimeFieldProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn TimeControl(props, ref, false);\n}\n\nfunction TimePickerImpl<T extends LydsTimeValue>(props: TimePickerProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn TimeControl(props, ref, true);\n}\n\nexport const TimeField = forwardRef(TimeFieldImpl) as <T extends LydsTimeValue = Time>(props: TimeFieldProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n\n/**\n * 支援地區格式的區段式時間選擇器。此元件不預設有限的時間選項;\n * `minValue`、`maxValue`、`granularity` 與 `hourCycle` 仍由使用端依 React Aria 語意控制。\n */\nexport const TimePicker = forwardRef(TimePickerImpl) as <T extends LydsTimeValue = Time>(props: TimePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;AAgBA,SAAS,EACR,EAAE,UAAO,gBAAa,UAAO,WAAQ,UAAO,MAAM,cAAW,aAAU,aAAU,aAAU,YAAS,kBAAe,GAAG,KACtH,GACA,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,mBAAmB,KAAmB,oBAAoB,CAAS;GACpG,aAAW;GACX,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA2E;GAThI,UAAA;IAWC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACC,kBAAC,GAAD;MAAW,WAAU;MAAmB,WAAA,MAAW,kBAAC,GAAD;OAAsB;OAAS,WAAU;MAAqB,CAAA;KAAa,CAAA,GAC7H,IACA,kBAAC,QAAD;MAAM,WAAU;MACf,UAAA,kBAAC,GAAD,CAAa,CAAA;KACR,CAAA,IACH,IACA;;IACL,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;GAC1C;;CACA,CAAA;AAElB;AAEA,SAAS,EAAuC,GAA0B,GAAyC;CAClH,OAAO,EAAY,GAAO,GAAK,EAAK;AACrC;AAEA,SAAS,EAAwC,GAA2B,GAAyC;CACpH,OAAO,EAAY,GAAO,GAAK,EAAI;AACpC;AAEA,IAAa,IAAY,EAAW,CAAa,GAMpC,IAAa,EAAW,CAAc"}
1
+ {"version":3,"file":"time-field.js","names":[],"sources":["../../../src/components/date-time/time-field.tsx"],"sourcesContent":["import { cx } from \"@/internal\";\nimport type { Time } from \"@internationalized/date\";\nimport { forwardRef, type ReactElement, type RefAttributes } from \"react\";\nimport { TimeField as AriaTimeField, DateInput, DateSegment, type TimeFieldProps as AriaTimeFieldProps } from \"react-aria-components/TimeField\";\nimport type { TimeValue as LydsTimeValue, TimeFieldBehaviorProps } from \"./date-types\";\nimport { ClockGlyph, FieldLabel, FieldMessages, LocaleBoundary, type DateTimeFieldChromeProps } from \"./shared\";\nexport interface TimeFieldProps<T extends LydsTimeValue = Time> extends TimeFieldBehaviorProps<T>, DateTimeFieldChromeProps {}\n\nexport type TimePickerProps<T extends LydsTimeValue = Time> = TimeFieldProps<T>;\n\ntype TimeFieldForwardedKeys = Exclude<keyof TimeFieldBehaviorProps<LydsTimeValue>, \"disabled\" | \"invalid\" | \"onValueChange\" | \"readOnly\" | \"required\">;\ntype TimeFieldUnexpectedForwardedKeys = Exclude<TimeFieldForwardedKeys, keyof AriaTimeFieldProps<LydsTimeValue>>;\ntype TimeFieldPropContract = TimeFieldUnexpectedForwardedKeys extends never ? true : never;\nconst timeFieldPropContract: TimeFieldPropContract = true;\nvoid timeFieldPropContract;\n\nfunction TimeControl<T extends LydsTimeValue>(\n\t{ label, description, error, locale, size = \"md\", className, disabled, readOnly, required, invalid, onValueChange, ...fieldProps }: TimeFieldProps<T>,\n\tref: React.ForwardedRef<HTMLDivElement>,\n\tshowPickerGlyph: boolean\n) {\n\tconst ariaFieldProps = fieldProps as unknown as Omit<AriaTimeFieldProps<T>, \"children\" | \"className\" | \"isDisabled\" | \"isInvalid\" | \"isReadOnly\" | \"isRequired\" | \"onChange\">;\n\n\treturn (\n\t\t<LocaleBoundary locale={locale}>\n\t\t\t<AriaTimeField\n\t\t\t\t{...ariaFieldProps}\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"lyds-date-field\", \"lyds-time-field\", showPickerGlyph && \"lyds-time-picker\", className)}\n\t\t\t\tdata-size={size}\n\t\t\t\t{...(disabled === undefined ? {} : { isDisabled: disabled })}\n\t\t\t\t{...(readOnly === undefined ? {} : { isReadOnly: readOnly })}\n\t\t\t\t{...(required === undefined ? {} : { isRequired: required })}\n\t\t\t\t{...(invalid === undefined ? {} : { isInvalid: invalid })}\n\t\t\t\t{...(onValueChange === undefined ? {} : { onChange: onValueChange as unknown as NonNullable<AriaTimeFieldProps<T>[\"onChange\"]> })}\n\t\t\t>\n\t\t\t\t<FieldLabel>{label}</FieldLabel>\n\t\t\t\t<div className=\"lyds-date-input-shell\">\n\t\t\t\t\t<DateInput className=\"lyds-date-input\">{segment => <DateSegment segment={segment} className=\"lyds-date-segment\" />}</DateInput>\n\t\t\t\t\t{showPickerGlyph ? (\n\t\t\t\t\t\t<span className=\"lyds-date-input-affordance\">\n\t\t\t\t\t\t\t<ClockGlyph />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : null}\n\t\t\t\t</div>\n\t\t\t\t<FieldMessages description={description} error={error} />\n\t\t\t</AriaTimeField>\n\t\t</LocaleBoundary>\n\t);\n}\n\nfunction TimeFieldImpl<T extends LydsTimeValue>(props: TimeFieldProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn TimeControl(props, ref, false);\n}\n\nfunction TimePickerImpl<T extends LydsTimeValue>(props: TimePickerProps<T>, ref: React.ForwardedRef<HTMLDivElement>) {\n\treturn TimeControl(props, ref, true);\n}\n\nexport const TimeField = forwardRef(TimeFieldImpl) as <T extends LydsTimeValue = Time>(props: TimeFieldProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n\n/**\n * 支援地區格式的區段式時間選擇器。此元件不預設有限的時間選項;\n * `minValue`、`maxValue`、`granularity` 與 `hourCycle` 仍由使用端依 React Aria 語意控制。\n */\nexport const TimePicker = forwardRef(TimePickerImpl) as <T extends LydsTimeValue = Time>(props: TimePickerProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;\n"],"mappings":";;;;;;;AAgBA,SAAS,EACR,EAAE,UAAO,gBAAa,UAAO,WAAQ,UAAO,MAAM,cAAW,aAAU,aAAU,aAAU,YAAS,kBAAe,GAAG,KACtH,GACA,GACC;CAGD,OACC,kBAAC,GAAD;EAAwB;EACvB,UAAA,kBAAC,GAAD;GACC,GAAI;GACC;GACL,WAAW,EAAG,mBAAmB,mBAAmB,KAAmB,oBAAoB,CAAS;GACpG,aAAW;GACX,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAa,KAAA,IAAY,CAAC,IAAI,EAAE,YAAY,EAAS;GAC1D,GAAK,MAAY,KAAA,IAAY,CAAC,IAAI,EAAE,WAAW,EAAQ;GACvD,GAAK,MAAkB,KAAA,IAAY,CAAC,IAAI,EAAE,UAAU,EAA2E;GAThI,UAAA;IAWC,kBAAC,GAAD,EAAA,UAAa,EAAkB,CAAA;IAC/B,kBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACC,kBAAC,GAAD;MAAW,WAAU;MAAmB,WAAA,MAAW,kBAAC,GAAD;OAAsB;OAAS,WAAU;MAAqB,CAAA;KAAa,CAAA,GAC7H,IACA,kBAAC,QAAD;MAAM,WAAU;MACf,UAAA,kBAAC,GAAD,CAAa,CAAA;KACR,CAAA,IACH,IACA;;IACL,kBAAC,GAAD;KAA4B;KAAoB;IAAQ,CAAA;GAC1C;;CACA,CAAA;AAElB;AAEA,SAAS,EAAuC,GAA0B,GAAyC;CAClH,OAAO,EAAY,GAAO,GAAK,EAAK;AACrC;AAEA,SAAS,EAAwC,GAA2B,GAAyC;CACpH,OAAO,EAAY,GAAO,GAAK,EAAI;AACpC;AAEA,IAAa,IAAY,EAAW,CAAa,GAMpC,IAAa,EAAW,CAAc"}