@linyao.tw/ui 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/components/date-time/calendar.js +7 -6
- package/dist/components/date-time/calendar.js.map +1 -1
- package/dist/components/date-time/date-field.js +9 -8
- package/dist/components/date-time/date-field.js.map +1 -1
- package/dist/components/date-time/date-picker.js +7 -6
- package/dist/components/date-time/date-picker.js.map +1 -1
- package/dist/components/date-time/date-range-picker.js +7 -6
- package/dist/components/date-time/date-range-picker.js.map +1 -1
- package/dist/components/date-time/index.js +0 -1
- package/dist/components/date-time/shared.d.ts +0 -1
- package/dist/components/date-time/shared.js +6 -9
- package/dist/components/date-time/shared.js.map +1 -1
- package/dist/components/date-time/time-field.js +7 -6
- package/dist/components/date-time/time-field.js.map +1 -1
- package/dist/components/feedback/alert.js +34 -34
- package/dist/components/feedback/alert.js.map +1 -1
- package/dist/components/feedback/banner.js +14 -14
- package/dist/components/feedback/banner.js.map +1 -1
- package/dist/components/feedback/empty-state.d.ts +2 -1
- package/dist/components/feedback/empty-state.js +30 -31
- package/dist/components/feedback/empty-state.js.map +1 -1
- package/dist/components/feedback/feedback.types.d.ts +0 -1
- package/dist/components/feedback/feedback.types.js +2 -5
- package/dist/components/feedback/feedback.types.js.map +1 -1
- package/dist/components/feedback/index.d.ts +8 -8
- package/dist/components/feedback/meter.js +20 -21
- package/dist/components/feedback/meter.js.map +1 -1
- package/dist/components/feedback/progress.js +20 -21
- package/dist/components/feedback/progress.js.map +1 -1
- package/dist/components/feedback/skeleton.js +10 -11
- package/dist/components/feedback/skeleton.js.map +1 -1
- package/dist/components/feedback/spinner.js +24 -25
- package/dist/components/feedback/spinner.js.map +1 -1
- package/dist/components/feedback/toast.js +22 -21
- package/dist/components/feedback/toast.js.map +1 -1
- package/dist/components/forms/{CodeField.d.ts → code-field.d.ts} +1 -1
- package/dist/components/forms/code-field.js +65 -0
- package/dist/components/forms/code-field.js.map +1 -0
- package/dist/components/forms/{FileUpload.d.ts → file-upload.d.ts} +1 -1
- package/dist/components/forms/{FileUpload.js → file-upload.js} +127 -111
- package/dist/components/forms/file-upload.js.map +1 -0
- package/dist/components/forms/index.d.ts +6 -6
- package/dist/components/forms/{Input.js → input.js} +3 -3
- package/dist/components/forms/input.js.map +1 -0
- package/dist/components/forms/internal.d.ts +0 -2
- package/dist/components/forms/internal.js +12 -17
- package/dist/components/forms/internal.js.map +1 -1
- package/dist/components/forms/number-field.js +73 -0
- package/dist/components/forms/number-field.js.map +1 -0
- package/dist/components/forms/otp-field.js +57 -0
- package/dist/components/forms/otp-field.js.map +1 -0
- package/dist/components/forms/{TextField.d.ts → text-field.d.ts} +5 -0
- package/dist/components/forms/text-field.js +200 -0
- package/dist/components/forms/text-field.js.map +1 -0
- package/dist/components/foundations/{Avatar.js → avatar.js} +3 -3
- package/dist/components/foundations/avatar.js.map +1 -0
- package/dist/components/foundations/{Badge.d.ts → badge.d.ts} +1 -1
- package/dist/components/foundations/{Badge.js → badge.js} +3 -3
- package/dist/components/foundations/badge.js.map +1 -0
- package/dist/components/foundations/{Button.js → button.js} +3 -3
- package/dist/components/foundations/button.js.map +1 -0
- package/dist/components/foundations/{Card.d.ts → card.d.ts} +9 -2
- package/dist/components/foundations/{Card.js → card.js} +5 -5
- package/dist/components/foundations/card.js.map +1 -0
- package/dist/components/foundations/{IconButton.d.ts → icon-button.d.ts} +2 -8
- package/dist/components/foundations/{IconButton.js → icon-button.js} +4 -4
- package/dist/components/foundations/icon-button.js.map +1 -0
- package/dist/components/foundations/index.d.ts +9 -9
- package/dist/components/foundations/{Link.d.ts → link.d.ts} +1 -1
- package/dist/components/foundations/link.js +46 -0
- package/dist/components/foundations/link.js.map +1 -0
- package/dist/components/foundations/{ListCell.d.ts → list-cell.d.ts} +1 -8
- package/dist/components/foundations/{ListCell.js → list-cell.js} +3 -3
- package/dist/components/foundations/list-cell.js.map +1 -0
- package/dist/components/foundations/{SectionHeading.d.ts → section-heading.d.ts} +5 -2
- package/dist/components/foundations/{SectionHeading.js → section-heading.js} +3 -3
- package/dist/components/foundations/section-heading.js.map +1 -0
- package/dist/components/foundations/{Separator.js → separator.js} +3 -3
- package/dist/components/foundations/separator.js.map +1 -0
- package/dist/components/navigation-data/breadcrumb-pagination.js +88 -81
- package/dist/components/navigation-data/breadcrumb-pagination.js.map +1 -1
- package/dist/components/navigation-data/command-palette.d.ts +26 -0
- package/dist/components/navigation-data/command-palette.js +100 -72
- package/dist/components/navigation-data/command-palette.js.map +1 -1
- package/dist/components/navigation-data/header-tab-bar.js +49 -46
- package/dist/components/navigation-data/header-tab-bar.js.map +1 -1
- package/dist/components/navigation-data/index.d.ts +7 -7
- package/dist/components/navigation-data/menubar-toolbar.js +1 -1
- package/dist/components/navigation-data/menubar-toolbar.js.map +1 -1
- package/dist/components/navigation-data/navigation-menu.js +1 -1
- package/dist/components/navigation-data/navigation-menu.js.map +1 -1
- package/dist/components/navigation-data/scroll-area.js +1 -1
- package/dist/components/navigation-data/scroll-area.js.map +1 -1
- package/dist/components/navigation-data/table-collection.d.ts +12 -3
- package/dist/components/navigation-data/table-collection.js +11 -9
- package/dist/components/navigation-data/table-collection.js.map +1 -1
- package/dist/components/overlays/dialog.d.ts +13 -2
- package/dist/components/overlays/dialog.js +136 -131
- package/dist/components/overlays/dialog.js.map +1 -1
- package/dist/components/overlays/disclosure.js +1 -1
- package/dist/components/overlays/disclosure.js.map +1 -1
- package/dist/components/overlays/drawer.d.ts +5 -1
- package/dist/components/overlays/drawer.js +156 -152
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/floating.js +115 -113
- package/dist/components/overlays/floating.js.map +1 -1
- package/dist/components/overlays/index.d.ts +4 -4
- package/dist/components/selection/combobox.js +93 -93
- package/dist/components/selection/combobox.js.map +1 -1
- package/dist/components/selection/controls.d.ts +4 -1
- package/dist/components/selection/controls.js +140 -118
- package/dist/components/selection/controls.js.map +1 -1
- package/dist/components/selection/menu.js +120 -121
- package/dist/components/selection/menu.js.map +1 -1
- package/dist/components/selection/select.js +107 -107
- package/dist/components/selection/select.js.map +1 -1
- package/dist/fonts.css +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +37 -33
- package/dist/internal/accessible-name.d.ts +12 -0
- package/dist/internal/class-names.d.ts +12 -0
- package/dist/{components/selection/classnames.js → internal/class-names.js} +3 -3
- package/dist/internal/class-names.js.map +1 -0
- package/dist/internal/index.d.ts +3 -0
- package/dist/{components/foundations/shared.d.ts → internal/render.d.ts} +2 -1
- package/dist/intl/index.d.ts +2 -0
- package/dist/intl/messages.d.ts +48 -0
- package/dist/intl/messages.js +80 -0
- package/dist/intl/messages.js.map +1 -0
- package/dist/intl/provider.d.ts +18 -0
- package/dist/intl/provider.js +22 -0
- package/dist/intl/provider.js.map +1 -0
- package/dist/styles.css +1 -1
- package/package.json +6 -4
- package/dist/components/feedback/feedback.module.js +0 -42
- package/dist/components/feedback/feedback.module.js.map +0 -1
- package/dist/components/forms/CodeField.js +0 -63
- package/dist/components/forms/CodeField.js.map +0 -1
- package/dist/components/forms/FileUpload.js.map +0 -1
- package/dist/components/forms/Input.js.map +0 -1
- package/dist/components/forms/NumberField.js +0 -71
- package/dist/components/forms/NumberField.js.map +0 -1
- package/dist/components/forms/OTPField.js +0 -54
- package/dist/components/forms/OTPField.js.map +0 -1
- package/dist/components/forms/TextField.js +0 -199
- package/dist/components/forms/TextField.js.map +0 -1
- package/dist/components/foundations/Avatar.js.map +0 -1
- package/dist/components/foundations/Badge.js.map +0 -1
- package/dist/components/foundations/Button.js.map +0 -1
- package/dist/components/foundations/Card.js.map +0 -1
- package/dist/components/foundations/IconButton.js.map +0 -1
- package/dist/components/foundations/Link.js +0 -40
- package/dist/components/foundations/Link.js.map +0 -1
- package/dist/components/foundations/ListCell.js.map +0 -1
- package/dist/components/foundations/SectionHeading.js.map +0 -1
- package/dist/components/foundations/Separator.js.map +0 -1
- package/dist/components/foundations/shared.js +0 -8
- package/dist/components/foundations/shared.js.map +0 -1
- package/dist/components/navigation-data/utils.d.ts +0 -2
- package/dist/components/navigation-data/utils.js +0 -11
- package/dist/components/navigation-data/utils.js.map +0 -1
- package/dist/components/overlays/class-names.d.ts +0 -6
- package/dist/components/overlays/class-names.js +0 -11
- package/dist/components/overlays/class-names.js.map +0 -1
- package/dist/components/selection/classnames.d.ts +0 -4
- package/dist/components/selection/classnames.js.map +0 -1
- package/dist/components/selection/selection.module.js +0 -51
- package/dist/components/selection/selection.module.js.map +0 -1
- /package/dist/components/forms/{Input.d.ts → input.d.ts} +0 -0
- /package/dist/components/forms/{NumberField.d.ts → number-field.d.ts} +0 -0
- /package/dist/components/forms/{OTPField.d.ts → otp-field.d.ts} +0 -0
- /package/dist/components/foundations/{Avatar.d.ts → avatar.d.ts} +0 -0
- /package/dist/components/foundations/{Button.d.ts → button.d.ts} +0 -0
- /package/dist/components/foundations/{Separator.d.ts → separator.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -18,6 +18,14 @@ pnpm add @linyao.tw/ui @phosphor-icons/react
|
|
|
18
18
|
import "@linyao.tw/ui/styles.css";
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
`styles.css` 不含任何遠端請求。需要品牌字型時另外匯入可選入口,或自行代管字型並覆寫 `--font-family-*`:
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
import "@linyao.tw/ui/fonts.css";
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`styles.css` 除了設計變數與元件樣式,也包含一層文件基準樣式:`box-sizing`、`margin`/`padding` 歸零、`body` 的背景與文字色、表單控制項的 `font: inherit` 與 `::selection`。這層放在 `@layer lyds.base`,未分層的應用程式樣式一律勝過它,因此覆寫不需要提高選擇器權重。
|
|
28
|
+
|
|
21
29
|
## 使用
|
|
22
30
|
|
|
23
31
|
```tsx
|
|
@@ -80,6 +88,6 @@ Linyao Design System 以 WCAG 2.2 AA 為目標,提供鍵盤操作、焦點樣
|
|
|
80
88
|
|
|
81
89
|
## 文件
|
|
82
90
|
|
|
83
|
-
|
|
91
|
+
變更記錄見 [CHANGELOG.md](https://github.com/linyao-tw/ui/blob/main/CHANGELOG.md)。完整的安裝、Storybook、開發、元件、設計變數、主題與發佈規範請參閱 [專案 README](https://github.com/linyao-tw/ui#readme) 與 [文件目錄](https://github.com/linyao-tw/ui/tree/main/docs)。
|
|
84
92
|
|
|
85
93
|
授權:Apache-2.0。套件與專案包含相同的完整授權檔。
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
2
|
+
import { LocaleBoundary as t } from "./shared.js";
|
|
2
3
|
import { CaretLeftIcon as n } from "@phosphor-icons/react/dist/csr/CaretLeft";
|
|
3
4
|
import { CaretRightIcon as r } from "@phosphor-icons/react/dist/csr/CaretRight";
|
|
4
5
|
import { forwardRef as i } from "react";
|
|
@@ -68,22 +69,22 @@ function y({ weekdayStyle: e = "short" }) {
|
|
|
68
69
|
}) })]
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
function b({ weekdayStyle:
|
|
72
|
+
function b({ weekdayStyle: t, showMonthYearPickers: n, disabled: r, className: i }) {
|
|
72
73
|
return /* @__PURE__ */ _("div", {
|
|
73
|
-
className:
|
|
74
|
+
className: e("lyds-calendar-panel", i),
|
|
74
75
|
children: [/* @__PURE__ */ g(v, {
|
|
75
76
|
showMonthYearPickers: n,
|
|
76
77
|
disabled: r
|
|
77
|
-
}), /* @__PURE__ */ g(y, { weekdayStyle:
|
|
78
|
+
}), /* @__PURE__ */ g(y, { weekdayStyle: t })]
|
|
78
79
|
});
|
|
79
80
|
}
|
|
80
81
|
function x({ locale: n, className: r, disabled: i, readOnly: a, invalid: s, onValueChange: c, weekdayStyle: l, ...u }, d) {
|
|
81
|
-
return /* @__PURE__ */ g(
|
|
82
|
+
return /* @__PURE__ */ g(t, {
|
|
82
83
|
locale: n,
|
|
83
84
|
children: /* @__PURE__ */ g(o, {
|
|
84
85
|
...u,
|
|
85
86
|
ref: d,
|
|
86
|
-
className:
|
|
87
|
+
className: e("lyds-calendar", r),
|
|
87
88
|
...i === void 0 ? {} : { isDisabled: i },
|
|
88
89
|
...a === void 0 ? {} : { isReadOnly: a },
|
|
89
90
|
...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
|
|
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,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
2
|
+
import { FieldLabel as t, FieldMessages as n, LocaleBoundary as r } from "./shared.js";
|
|
2
3
|
import { forwardRef as i } from "react";
|
|
3
4
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
5
|
import { DateField as s, DateInput as c, DateSegment as l } from "react-aria-components/DateField";
|
|
5
6
|
//#region src/components/date-time/date-field.tsx
|
|
6
|
-
function u({ className:
|
|
7
|
+
function u({ className: t, slot: n }) {
|
|
7
8
|
return /* @__PURE__ */ a(c, {
|
|
8
|
-
className:
|
|
9
|
-
...
|
|
9
|
+
className: e("lyds-date-input", t),
|
|
10
|
+
...n ? { slot: n } : {},
|
|
10
11
|
children: (e) => /* @__PURE__ */ a(l, {
|
|
11
12
|
segment: e,
|
|
12
13
|
className: "lyds-date-segment"
|
|
@@ -14,12 +15,12 @@ function u({ className: e, slot: t }) {
|
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
17
|
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(
|
|
18
|
+
return /* @__PURE__ */ a(r, {
|
|
18
19
|
locale: d,
|
|
19
20
|
children: /* @__PURE__ */ o(s, {
|
|
20
21
|
...y,
|
|
21
22
|
ref: b,
|
|
22
|
-
className:
|
|
23
|
+
className: e("lyds-date-field", p),
|
|
23
24
|
"data-size": f,
|
|
24
25
|
...m === void 0 ? {} : { isDisabled: m },
|
|
25
26
|
...h === void 0 ? {} : { isReadOnly: h },
|
|
@@ -27,9 +28,9 @@ function d({ label: i, description: c, error: l, locale: d, size: f = "md", clas
|
|
|
27
28
|
..._ === void 0 ? {} : { isInvalid: _ },
|
|
28
29
|
...v === void 0 ? {} : { onChange: v },
|
|
29
30
|
children: [
|
|
30
|
-
/* @__PURE__ */ a(
|
|
31
|
+
/* @__PURE__ */ a(t, { children: i }),
|
|
31
32
|
/* @__PURE__ */ a(u, {}),
|
|
32
|
-
/* @__PURE__ */ a(
|
|
33
|
+
/* @__PURE__ */ a(n, {
|
|
33
34
|
description: c,
|
|
34
35
|
error: l
|
|
35
36
|
})
|
|
@@ -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,
|
|
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,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
2
|
+
import { CalendarGlyph as t, FieldLabel as n, FieldMessages as r, LocaleBoundary as i } from "./shared.js";
|
|
2
3
|
import { CalendarPanel as a } from "./calendar.js";
|
|
3
4
|
import { DateInputSegments as o } from "./date-field.js";
|
|
4
5
|
import { forwardRef as s } from "react";
|
|
@@ -11,12 +12,12 @@ import { Group as m } from "react-aria-components/Group";
|
|
|
11
12
|
import { Popover as h } from "react-aria-components/Popover";
|
|
12
13
|
//#region src/components/date-time/date-picker.tsx
|
|
13
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, N) {
|
|
14
|
-
return /* @__PURE__ */ u(
|
|
15
|
+
return /* @__PURE__ */ u(i, {
|
|
15
16
|
locale: v,
|
|
16
17
|
children: /* @__PURE__ */ d(f, {
|
|
17
18
|
...j,
|
|
18
19
|
ref: M,
|
|
19
|
-
className:
|
|
20
|
+
className: e("lyds-date-field", "lyds-date-picker", N && "lyds-date-time-picker", b),
|
|
20
21
|
"data-size": y,
|
|
21
22
|
...x === void 0 ? {} : { isOpen: x },
|
|
22
23
|
...S === void 0 ? {} : { isDisabled: S },
|
|
@@ -26,15 +27,15 @@ function g({ label: s, description: g, error: _, locale: v, size: y = "md", clas
|
|
|
26
27
|
...E === void 0 ? {} : { onChange: E },
|
|
27
28
|
...D === void 0 ? {} : { firstDayOfWeek: D },
|
|
28
29
|
children: [
|
|
29
|
-
/* @__PURE__ */ u(
|
|
30
|
+
/* @__PURE__ */ u(n, { children: s }),
|
|
30
31
|
/* @__PURE__ */ d(m, {
|
|
31
32
|
className: "lyds-date-picker-group",
|
|
32
33
|
children: [/* @__PURE__ */ u(o, { className: "lyds-date-picker-input" }), /* @__PURE__ */ u(c, {
|
|
33
34
|
className: "lyds-date-picker-button",
|
|
34
|
-
children: /* @__PURE__ */ u(
|
|
35
|
+
children: /* @__PURE__ */ u(t, {})
|
|
35
36
|
})]
|
|
36
37
|
}),
|
|
37
|
-
/* @__PURE__ */ u(
|
|
38
|
+
/* @__PURE__ */ u(r, {
|
|
38
39
|
description: g,
|
|
39
40
|
error: _
|
|
40
41
|
}),
|
|
@@ -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,
|
|
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,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
2
|
+
import { CalendarGlyph as t, FieldLabel as n, FieldMessages as r, LocaleBoundary as i } from "./shared.js";
|
|
2
3
|
import { CalendarPanel as a } from "./calendar.js";
|
|
3
4
|
import { DateInputSegments as o } from "./date-field.js";
|
|
4
5
|
import { forwardRef as s } from "react";
|
|
@@ -10,12 +11,12 @@ import { Popover as p } from "react-aria-components/Popover";
|
|
|
10
11
|
import { DateRangePicker as m, RangeCalendar as h } from "react-aria-components/DateRangePicker";
|
|
11
12
|
//#region src/components/date-time/date-range-picker.tsx
|
|
12
13
|
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(
|
|
14
|
+
return /* @__PURE__ */ l(i, {
|
|
14
15
|
locale: v,
|
|
15
16
|
children: /* @__PURE__ */ u(m, {
|
|
16
17
|
...j,
|
|
17
18
|
ref: M,
|
|
18
|
-
className:
|
|
19
|
+
className: e("lyds-date-field", "lyds-date-picker", "lyds-date-range-picker", b),
|
|
19
20
|
"data-size": y,
|
|
20
21
|
...x === void 0 ? {} : { isOpen: x },
|
|
21
22
|
...S === void 0 ? {} : { isDisabled: S },
|
|
@@ -25,7 +26,7 @@ function g({ label: s, description: g, error: _, locale: v, size: y = "md", clas
|
|
|
25
26
|
...E === void 0 ? {} : { onChange: E },
|
|
26
27
|
...D === void 0 ? {} : { firstDayOfWeek: D },
|
|
27
28
|
children: [
|
|
28
|
-
/* @__PURE__ */ l(
|
|
29
|
+
/* @__PURE__ */ l(n, { children: s }),
|
|
29
30
|
/* @__PURE__ */ u(f, {
|
|
30
31
|
className: "lyds-date-picker-group",
|
|
31
32
|
children: [
|
|
@@ -44,11 +45,11 @@ function g({ label: s, description: g, error: _, locale: v, size: y = "md", clas
|
|
|
44
45
|
}),
|
|
45
46
|
/* @__PURE__ */ l(c, {
|
|
46
47
|
className: "lyds-date-picker-button",
|
|
47
|
-
children: /* @__PURE__ */ l(
|
|
48
|
+
children: /* @__PURE__ */ l(t, {})
|
|
48
49
|
})
|
|
49
50
|
]
|
|
50
51
|
}),
|
|
51
|
-
/* @__PURE__ */ l(
|
|
52
|
+
/* @__PURE__ */ l(r, {
|
|
52
53
|
description: g,
|
|
53
54
|
error: _
|
|
54
55
|
}),
|
|
@@ -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,
|
|
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"}
|
|
@@ -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;
|
|
@@ -6,22 +6,19 @@ import { Label as i } from "react-aria-components/Label";
|
|
|
6
6
|
import { Text as a } from "react-aria-components/Text";
|
|
7
7
|
import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
8
8
|
//#region src/components/date-time/shared.tsx
|
|
9
|
-
function l(
|
|
10
|
-
return e.filter(Boolean).join(" ");
|
|
11
|
-
}
|
|
12
|
-
function u({ locale: e, children: t }) {
|
|
9
|
+
function l({ locale: e, children: t }) {
|
|
13
10
|
return e ? /* @__PURE__ */ s(r, {
|
|
14
11
|
locale: e,
|
|
15
12
|
children: t
|
|
16
13
|
}) : /* @__PURE__ */ s(o, { children: t });
|
|
17
14
|
}
|
|
18
|
-
function
|
|
15
|
+
function u({ children: e }) {
|
|
19
16
|
return e == null ? null : /* @__PURE__ */ s(i, {
|
|
20
17
|
className: "lyds-date-label",
|
|
21
18
|
children: e
|
|
22
19
|
});
|
|
23
20
|
}
|
|
24
|
-
function
|
|
21
|
+
function d({ description: e, error: t }) {
|
|
25
22
|
return /* @__PURE__ */ c(o, { children: [e == null ? null : /* @__PURE__ */ s(a, {
|
|
26
23
|
slot: "description",
|
|
27
24
|
className: "lyds-date-description",
|
|
@@ -33,14 +30,14 @@ function f({ description: e, error: t }) {
|
|
|
33
30
|
children: t
|
|
34
31
|
})] });
|
|
35
32
|
}
|
|
36
|
-
function
|
|
33
|
+
function f() {
|
|
37
34
|
return /* @__PURE__ */ s(e, {
|
|
38
35
|
"aria-hidden": "true",
|
|
39
36
|
className: "lyds-date-glyph",
|
|
40
37
|
weight: "regular"
|
|
41
38
|
});
|
|
42
39
|
}
|
|
43
|
-
function
|
|
40
|
+
function p() {
|
|
44
41
|
return /* @__PURE__ */ s(t, {
|
|
45
42
|
"aria-hidden": "true",
|
|
46
43
|
className: "lyds-date-glyph",
|
|
@@ -48,6 +45,6 @@ function m() {
|
|
|
48
45
|
});
|
|
49
46
|
}
|
|
50
47
|
//#endregion
|
|
51
|
-
export {
|
|
48
|
+
export { f as CalendarGlyph, p as ClockGlyph, u as FieldLabel, d as FieldMessages, l as LocaleBoundary };
|
|
52
49
|
|
|
53
50
|
//# 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
|
|
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,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
2
|
+
import { ClockGlyph as t, FieldLabel as n, FieldMessages as r, LocaleBoundary as i } from "./shared.js";
|
|
2
3
|
import { forwardRef as a } from "react";
|
|
3
4
|
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
4
5
|
import { DateInput as c, DateSegment as l, TimeField as u } from "react-aria-components/TimeField";
|
|
5
6
|
//#region src/components/date-time/time-field.tsx
|
|
6
7
|
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(
|
|
8
|
+
return /* @__PURE__ */ o(i, {
|
|
8
9
|
locale: p,
|
|
9
10
|
children: /* @__PURE__ */ s(u, {
|
|
10
11
|
...x,
|
|
11
12
|
ref: S,
|
|
12
|
-
className:
|
|
13
|
+
className: e("lyds-date-field", "lyds-time-field", C && "lyds-time-picker", h),
|
|
13
14
|
"data-size": m,
|
|
14
15
|
...g === void 0 ? {} : { isDisabled: g },
|
|
15
16
|
..._ === void 0 ? {} : { isReadOnly: _ },
|
|
@@ -17,7 +18,7 @@ function d({ label: a, description: d, error: f, locale: p, size: m = "md", clas
|
|
|
17
18
|
...y === void 0 ? {} : { isInvalid: y },
|
|
18
19
|
...b === void 0 ? {} : { onChange: b },
|
|
19
20
|
children: [
|
|
20
|
-
/* @__PURE__ */ o(
|
|
21
|
+
/* @__PURE__ */ o(n, { children: a }),
|
|
21
22
|
/* @__PURE__ */ s("div", {
|
|
22
23
|
className: "lyds-date-input-shell",
|
|
23
24
|
children: [/* @__PURE__ */ o(c, {
|
|
@@ -28,10 +29,10 @@ function d({ label: a, description: d, error: f, locale: p, size: m = "md", clas
|
|
|
28
29
|
})
|
|
29
30
|
}), C ? /* @__PURE__ */ o("span", {
|
|
30
31
|
className: "lyds-date-input-affordance",
|
|
31
|
-
children: /* @__PURE__ */ o(
|
|
32
|
+
children: /* @__PURE__ */ o(t, {})
|
|
32
33
|
}) : null]
|
|
33
34
|
}),
|
|
34
|
-
/* @__PURE__ */ o(
|
|
35
|
+
/* @__PURE__ */ o(r, {
|
|
35
36
|
description: d,
|
|
36
37
|
error: f
|
|
37
38
|
})
|
|
@@ -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,
|
|
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"}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import e from "
|
|
2
|
-
import { getLiveRegionProps as t
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { jsx as
|
|
1
|
+
import { cx as e } from "../../internal/class-names.js";
|
|
2
|
+
import { getLiveRegionProps as t } from "./feedback.types.js";
|
|
3
|
+
import { forwardRef as n } from "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
5
|
//#region src/components/feedback/alert.tsx
|
|
6
|
-
var
|
|
7
|
-
let
|
|
8
|
-
return /* @__PURE__ */
|
|
9
|
-
ref:
|
|
10
|
-
className:
|
|
11
|
-
"data-status":
|
|
12
|
-
role:
|
|
13
|
-
"aria-live":
|
|
14
|
-
...
|
|
6
|
+
var i = n(function({ "aria-live": n, className: i, live: a = "off", role: o, status: s = "neutral", ...c }, l) {
|
|
7
|
+
let u = t(a);
|
|
8
|
+
return /* @__PURE__ */ r("div", {
|
|
9
|
+
ref: l,
|
|
10
|
+
className: e("lyds-feedback-panel", "lyds-alert", i),
|
|
11
|
+
"data-status": s,
|
|
12
|
+
role: o ?? u.role,
|
|
13
|
+
"aria-live": n ?? u["aria-live"],
|
|
14
|
+
...c
|
|
15
15
|
});
|
|
16
|
-
}),
|
|
17
|
-
return /* @__PURE__ */
|
|
18
|
-
ref:
|
|
19
|
-
className:
|
|
20
|
-
...
|
|
16
|
+
}), a = i, o = n(function({ className: t, ...n }, i) {
|
|
17
|
+
return /* @__PURE__ */ r("div", {
|
|
18
|
+
ref: i,
|
|
19
|
+
className: e("lyds-feedback__content", t),
|
|
20
|
+
...n
|
|
21
21
|
});
|
|
22
|
-
}),
|
|
23
|
-
return /* @__PURE__ */
|
|
24
|
-
ref:
|
|
25
|
-
className:
|
|
26
|
-
...
|
|
22
|
+
}), s = n(function({ className: t, ...n }, i) {
|
|
23
|
+
return /* @__PURE__ */ r("div", {
|
|
24
|
+
ref: i,
|
|
25
|
+
className: e("lyds-feedback__title", t),
|
|
26
|
+
...n
|
|
27
27
|
});
|
|
28
|
-
}),
|
|
29
|
-
return /* @__PURE__ */
|
|
30
|
-
ref:
|
|
31
|
-
className:
|
|
32
|
-
...
|
|
28
|
+
}), c = n(function({ className: t, ...n }, i) {
|
|
29
|
+
return /* @__PURE__ */ r("p", {
|
|
30
|
+
ref: i,
|
|
31
|
+
className: e("lyds-feedback__description", t),
|
|
32
|
+
...n
|
|
33
33
|
});
|
|
34
|
-
}),
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
ref:
|
|
37
|
-
className:
|
|
38
|
-
...
|
|
34
|
+
}), l = n(function({ className: t, ...n }, i) {
|
|
35
|
+
return /* @__PURE__ */ r("div", {
|
|
36
|
+
ref: i,
|
|
37
|
+
className: e("lyds-feedback__actions", t),
|
|
38
|
+
...n
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
41
|
//#endregion
|
|
42
|
-
export {
|
|
42
|
+
export { i as Alert, l as AlertActions, o as AlertContent, c as AlertDescription, s as AlertTitle, a as AlertView };
|
|
43
43
|
|
|
44
44
|
//# sourceMappingURL=alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/feedback/alert.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\n\nimport
|
|
1
|
+
{"version":3,"file":"alert.js","names":[],"sources":["../../../src/components/feedback/alert.tsx"],"sourcesContent":["import { forwardRef, type HTMLAttributes } from \"react\";\n\nimport { cx } from \"@/internal\";\nimport { getLiveRegionProps, type FeedbackLiveMode, type FeedbackStatus } from \"./feedback.types\";\nexport interface AlertProps extends HTMLAttributes<HTMLDivElement> {\n\t/**\n\t * 控制語意狀態色盤。此屬性不會讓 Alert 成為即時區域;\n\t * 僅在內容動態加入或更新時設定 `live`。\n\t */\n\tstatus?: FeedbackStatus;\n\t/**\n\t * 動態回饋的播報方式。靜態 Alert 預設為 `off`,\n\t * 避免頁面載入時不必要的播報。\n\t */\n\tlive?: FeedbackLiveMode;\n}\n\nexport const Alert = forwardRef<HTMLDivElement, AlertProps>(function Alert({ \"aria-live\": ariaLive, className, live = \"off\", role, status = \"neutral\", ...props }, ref) {\n\tconst liveRegionProps = getLiveRegionProps(live);\n\n\treturn (\n\t\t<div\n\t\t\tref={ref}\n\t\t\tclassName={cx(\"lyds-feedback-panel\", \"lyds-alert\", className)}\n\t\t\tdata-status={status}\n\t\t\trole={role ?? liveRegionProps.role}\n\t\t\taria-live={ariaLive ?? liveRegionProps[\"aria-live\"]}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\n\n/** Alert 元件的別名。 */\nexport const AlertView = Alert;\n\nexport const AlertContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AlertContent({ className, ...props }, ref) {\n\treturn <div ref={ref} className={cx(\"lyds-feedback__content\", className)} {...props} />;\n});\n\nexport const AlertTitle = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AlertTitle({ className, ...props }, ref) {\n\treturn <div ref={ref} className={cx(\"lyds-feedback__title\", className)} {...props} />;\n});\n\nexport const AlertDescription = forwardRef<HTMLParagraphElement, HTMLAttributes<HTMLParagraphElement>>(function AlertDescription({ className, ...props }, ref) {\n\treturn <p ref={ref} className={cx(\"lyds-feedback__description\", className)} {...props} />;\n});\n\nexport const AlertActions = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function AlertActions({ className, ...props }, ref) {\n\treturn <div ref={ref} className={cx(\"lyds-feedback__actions\", className)} {...props} />;\n});\n"],"mappings":";;;;;AAiBA,IAAa,IAAQ,EAAuC,SAAe,EAAE,aAAa,GAAU,cAAW,UAAO,OAAO,SAAM,YAAS,WAAW,GAAG,KAAS,GAAK;CACvK,IAAM,IAAkB,EAAmB,CAAI;CAE/C,OACC,kBAAC,OAAD;EACM;EACL,WAAW,EAAG,uBAAuB,cAAc,CAAS;EAC5D,eAAa;EACb,MAAM,KAAQ,EAAgB;EAC9B,aAAW,KAAY,EAAgB;EACvC,GAAI;CACJ,CAAA;AAEH,CAAC,GAGY,IAAY,GAEZ,IAAe,EAA2D,SAAsB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC1I,OAAO,kBAAC,OAAD;EAAU;EAAK,WAAW,EAAG,0BAA0B,CAAS;EAAG,GAAI;CAAQ,CAAA;AACvF,CAAC,GAEY,IAAa,EAA2D,SAAoB,EAAE,cAAW,GAAG,KAAS,GAAK;CACtI,OAAO,kBAAC,OAAD;EAAU;EAAK,WAAW,EAAG,wBAAwB,CAAS;EAAG,GAAI;CAAQ,CAAA;AACrF,CAAC,GAEY,IAAmB,EAAuE,SAA0B,EAAE,cAAW,GAAG,KAAS,GAAK;CAC9J,OAAO,kBAAC,KAAD;EAAQ;EAAK,WAAW,EAAG,8BAA8B,CAAS;EAAG,GAAI;CAAQ,CAAA;AACzF,CAAC,GAEY,IAAe,EAA2D,SAAsB,EAAE,cAAW,GAAG,KAAS,GAAK;CAC1I,OAAO,kBAAC,OAAD;EAAU;EAAK,WAAW,EAAG,0BAA0B,CAAS;EAAG,GAAI;CAAQ,CAAA;AACvF,CAAC"}
|