@iyulab/components 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +118 -0
- package/README.md +5 -0
- package/dist/components/UElement.d.ts +11 -0
- package/dist/components/UElement.js +14 -0
- package/dist/components/UElement.styles.js +9 -0
- package/dist/components/UFloatingElement.d.ts +4 -0
- package/dist/components/UFloatingElement.js +7 -0
- package/dist/components/UFormControlElement.d.ts +20 -3
- package/dist/components/UFormControlElement.js +46 -4
- package/dist/components/UOverlayElement.d.ts +4 -0
- package/dist/components/UOverlayElement.js +7 -0
- package/dist/components/alert/UAlert.d.ts +4 -0
- package/dist/components/alert/UAlert.js +7 -0
- package/dist/components/auto-scroll/UAutoScroll.d.ts +6 -2
- package/dist/components/auto-scroll/UAutoScroll.js +7 -0
- package/dist/components/avatar/UAvatar.d.ts +4 -0
- package/dist/components/avatar/UAvatar.js +11 -0
- package/dist/components/badge/UBadge.d.ts +6 -0
- package/dist/components/badge/UBadge.js +36 -1
- package/dist/components/badge/UBadge.styles.js +8 -0
- package/dist/components/breadcrumb-item/UBreadcrumbItem.js +2 -2
- package/dist/components/button/UButton.d.ts +7 -0
- package/dist/components/button/UButton.js +41 -1
- package/dist/components/button/UButton.styles.js +8 -0
- package/dist/components/button-group/UButtonGroup.d.ts +4 -0
- package/dist/components/button-group/UButtonGroup.js +13 -0
- package/dist/components/calendar/UCalendar.d.ts +8 -0
- package/dist/components/calendar/UCalendar.js +30 -14
- package/dist/components/calendar/UCalendar.styles.js +3 -0
- package/dist/components/calendar/dates.d.ts +12 -0
- package/dist/components/calendar/dates.js +25 -1
- package/dist/components/card/UCard.d.ts +6 -0
- package/dist/components/card/UCard.js +15 -0
- package/dist/components/carousel/UCarousel.d.ts +4 -0
- package/dist/components/carousel/UCarousel.js +7 -0
- package/dist/components/checkbox/UCheckbox.d.ts +6 -0
- package/dist/components/checkbox/UCheckbox.js +25 -1
- package/dist/components/chip/UChip.d.ts +5 -0
- package/dist/components/chip/UChip.js +30 -0
- package/dist/components/command-palette/UCommandPalette.js +3 -0
- package/dist/components/copy-button/UCopyButton.d.ts +4 -0
- package/dist/components/copy-button/UCopyButton.js +13 -0
- package/dist/components/date-picker/UDatePicker.d.ts +11 -5
- package/dist/components/date-picker/UDatePicker.js +13 -0
- package/dist/components/date-range-picker/UDateRangePicker.d.ts +9 -2
- package/dist/components/date-range-picker/UDateRangePicker.js +13 -0
- package/dist/components/date-range-picker/presets.d.ts +2 -1
- package/dist/components/date-range-picker/presets.js +5 -5
- package/dist/components/dialog/UDialog.d.ts +5 -0
- package/dist/components/dialog/UDialog.js +17 -0
- package/dist/components/divider/UDivider.d.ts +5 -0
- package/dist/components/divider/UDivider.js +17 -1
- package/dist/components/divider/UDivider.styles.js +5 -0
- package/dist/components/drawer/UDrawer.d.ts +5 -0
- package/dist/components/drawer/UDrawer.js +12 -0
- package/dist/components/field/UField.d.ts +4 -0
- package/dist/components/field/UField.js +7 -0
- package/dist/components/icon-button/UIconButton.d.ts +4 -0
- package/dist/components/icon-button/UIconButton.js +13 -0
- package/dist/components/input/UInput.d.ts +7 -0
- package/dist/components/input/UInput.js +31 -0
- package/dist/components/input/UInput.styles.js +9 -0
- package/dist/components/menu/UMenu.d.ts +7 -0
- package/dist/components/menu/UMenu.js +18 -0
- package/dist/components/menu-item/UMenuItem.d.ts +5 -0
- package/dist/components/menu-item/UMenuItem.js +13 -1
- package/dist/components/option/UOption.d.ts +4 -0
- package/dist/components/option/UOption.js +8 -1
- package/dist/components/pagination/UPagination.d.ts +4 -0
- package/dist/components/pagination/UPagination.js +11 -0
- package/dist/components/popover/UPopover.d.ts +5 -0
- package/dist/components/popover/UPopover.js +13 -0
- package/dist/components/progress-bar/UProgressBar.d.ts +4 -0
- package/dist/components/progress-bar/UProgressBar.js +14 -1
- package/dist/components/progress-bar/UProgressBar.styles.js +5 -0
- package/dist/components/progress-ring/UProgressRing.d.ts +4 -0
- package/dist/components/progress-ring/UProgressRing.js +13 -0
- package/dist/components/radio/URadio.d.ts +7 -0
- package/dist/components/radio/URadio.js +14 -1
- package/dist/components/rating/URating.d.ts +5 -1
- package/dist/components/rating/URating.js +6 -2
- package/dist/components/select/USelect.d.ts +7 -0
- package/dist/components/select/USelect.js +19 -1
- package/dist/components/skeleton/USkeleton.d.ts +5 -0
- package/dist/components/skeleton/USkeleton.js +16 -0
- package/dist/components/spinner/USpinner.d.ts +4 -0
- package/dist/components/spinner/USpinner.js +24 -0
- package/dist/components/split-panel/USplitPanel.d.ts +4 -0
- package/dist/components/split-panel/USplitPanel.js +7 -0
- package/dist/components/steps/USteps.d.ts +4 -0
- package/dist/components/steps/USteps.js +12 -1
- package/dist/components/switch/USwitch.js +1 -1
- package/dist/components/tab/UTab.d.ts +4 -0
- package/dist/components/tab/UTab.js +12 -1
- package/dist/components/tab/UTab.styles.js +7 -0
- package/dist/components/tab-nav/UTabNav.d.ts +6 -2
- package/dist/components/tab-nav/UTabNav.js +7 -0
- package/dist/components/tab-panel/UTabPanel.d.ts +5 -0
- package/dist/components/tab-panel/UTabPanel.js +18 -0
- package/dist/components/tag/UTag.d.ts +6 -0
- package/dist/components/tag/UTag.js +32 -1
- package/dist/components/text/UText.d.ts +5 -0
- package/dist/components/text/UText.js +21 -0
- package/dist/components/textarea/UTextarea.d.ts +7 -0
- package/dist/components/textarea/UTextarea.js +24 -0
- package/dist/components/tree/UTree.d.ts +4 -0
- package/dist/components/tree/UTree.js +7 -0
- package/dist/components/tree-item/UTreeItem.d.ts +4 -0
- package/dist/components/tree-item/UTreeItem.js +8 -1
- package/dist/custom-elements.json +46557 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -1
- package/dist/plugins/cem-check.d.ts +29 -0
- package/dist/plugins/cem-check.js +90 -0
- package/dist/plugins/cem-config.d.ts +17 -0
- package/dist/plugins/cem-config.js +22 -0
- package/dist/plugins/cem-enumerated-plugin.d.ts +20 -0
- package/dist/plugins/cem-enumerated-plugin.js +105 -0
- package/dist/plugins/cem-events-plugin.d.ts +18 -0
- package/dist/plugins/cem-events-plugin.js +96 -0
- package/dist/utilities/enumerated.d.ts +20 -0
- package/dist/utilities/enumerated.js +24 -0
- package/dist/utilities/format.js +49 -15
- package/package.json +18 -15
- package/skills/iyulab-components/SKILL.md +5 -1
- package/skills/iyulab-components/references/components/checkbox.md +1 -1
- package/skills/iyulab-components/references/components/date-picker.md +2 -2
- package/skills/iyulab-components/references/components/date-range-picker.md +4 -4
- package/skills/iyulab-components/references/components/field.md +5 -0
- package/skills/iyulab-components/references/components/file-input.md +1 -1
- package/skills/iyulab-components/references/components/input.md +1 -1
- package/skills/iyulab-components/references/components/select.md +1 -1
- package/skills/iyulab-components/references/components/textarea.md +1 -1
|
@@ -69,6 +69,13 @@ export declare class UButton extends UElement {
|
|
|
69
69
|
* 네이티브 버튼을 대체하는 요소가 잃으면 안 되는 계약이다.
|
|
70
70
|
*/
|
|
71
71
|
static shadowRootOptions: ShadowRootInit;
|
|
72
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
73
|
+
static enumerated: {
|
|
74
|
+
appearance: readonly ButtonAppearance[];
|
|
75
|
+
color: readonly ButtonColor[];
|
|
76
|
+
size: readonly ButtonSize[];
|
|
77
|
+
type: readonly ButtonType[];
|
|
78
|
+
};
|
|
72
79
|
/** 외형 정도 — `solid`(기본) · `soft` · `outlined` · `plain` · `link` */
|
|
73
80
|
appearance: ButtonAppearance;
|
|
74
81
|
/**
|
|
@@ -2,6 +2,7 @@ import "../spinner/USpinner.js";
|
|
|
2
2
|
import { UElement } from "../UElement.js";
|
|
3
3
|
import { styles } from "./UButton.styles.js";
|
|
4
4
|
import { FORWARDED_ARIA, readForwardedAria } from "./forwarded-aria.js";
|
|
5
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
5
6
|
import { SlotPresence } from "../../utilities/slotPresence.js";
|
|
6
7
|
import { HostAria } from "../../utilities/hostAria.js";
|
|
7
8
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
@@ -47,6 +48,45 @@ var UButton = class UButton extends UElement {
|
|
|
47
48
|
delegatesFocus: true
|
|
48
49
|
};
|
|
49
50
|
}
|
|
51
|
+
static {
|
|
52
|
+
this.enumerated = {
|
|
53
|
+
...UElement.enumerated,
|
|
54
|
+
appearance: enumeratedValues()([
|
|
55
|
+
"solid",
|
|
56
|
+
"soft",
|
|
57
|
+
"outlined",
|
|
58
|
+
"plain",
|
|
59
|
+
"link"
|
|
60
|
+
]),
|
|
61
|
+
color: enumeratedValues()([
|
|
62
|
+
"neutral",
|
|
63
|
+
"primary",
|
|
64
|
+
"secondary",
|
|
65
|
+
"info",
|
|
66
|
+
"success",
|
|
67
|
+
"warning",
|
|
68
|
+
"danger",
|
|
69
|
+
"blue",
|
|
70
|
+
"green",
|
|
71
|
+
"red",
|
|
72
|
+
"orange",
|
|
73
|
+
"teal",
|
|
74
|
+
"cyan",
|
|
75
|
+
"purple",
|
|
76
|
+
"pink"
|
|
77
|
+
]),
|
|
78
|
+
size: enumeratedValues()([
|
|
79
|
+
"sm",
|
|
80
|
+
"md",
|
|
81
|
+
"lg"
|
|
82
|
+
]),
|
|
83
|
+
type: enumeratedValues()([
|
|
84
|
+
"button",
|
|
85
|
+
"submit",
|
|
86
|
+
"reset"
|
|
87
|
+
])
|
|
88
|
+
};
|
|
89
|
+
}
|
|
50
90
|
/** 자기 `disabled` 또는 조상 fieldset. */
|
|
51
91
|
get effectivelyDisabled() {
|
|
52
92
|
return this.disabled || this.formDisabled;
|
|
@@ -165,7 +205,7 @@ var UButton = class UButton extends UElement {
|
|
|
165
205
|
return html`
|
|
166
206
|
<span class="affix affix-prefix" ?hidden=${!this.affixes.has("prefix")}><slot name="prefix"></slot></span>
|
|
167
207
|
<div class="content" part="content">
|
|
168
|
-
<slot></slot>
|
|
208
|
+
<bdi><slot></slot></bdi>
|
|
169
209
|
</div>
|
|
170
210
|
<span class="affix affix-suffix" ?hidden=${!this.affixes.has("suffix")}><slot name="suffix"></slot></span>
|
|
171
211
|
`;
|
|
@@ -8,6 +8,10 @@ import { ButtonAppearance } from '../button/UButton.js';
|
|
|
8
8
|
* @slot - u-button 또는 u-icon-button 요소들
|
|
9
9
|
*/
|
|
10
10
|
export declare class UButtonGroup extends UElement {
|
|
11
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
12
|
+
static enumerated: {
|
|
13
|
+
appearance: readonly ButtonAppearance[];
|
|
14
|
+
};
|
|
11
15
|
static styles: import('lit').CSSResultGroup[];
|
|
12
16
|
/** 하위 버튼에 자동 적용할 외형 */
|
|
13
17
|
appearance: ButtonAppearance;
|
|
@@ -2,6 +2,7 @@ import { UElement } from "../UElement.js";
|
|
|
2
2
|
import { UButton } from "../button/UButton.js";
|
|
3
3
|
import { UIconButton } from "../icon-button/UIconButton.js";
|
|
4
4
|
import { styles } from "./UButtonGroup.styles.js";
|
|
5
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
5
6
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
6
7
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
7
8
|
import { html } from "lit";
|
|
@@ -17,6 +18,18 @@ var UButtonGroup = class UButtonGroup extends UElement {
|
|
|
17
18
|
this.propagate();
|
|
18
19
|
};
|
|
19
20
|
}
|
|
21
|
+
static {
|
|
22
|
+
this.enumerated = {
|
|
23
|
+
...super.enumerated,
|
|
24
|
+
appearance: enumeratedValues()([
|
|
25
|
+
"solid",
|
|
26
|
+
"soft",
|
|
27
|
+
"outlined",
|
|
28
|
+
"plain",
|
|
29
|
+
"link"
|
|
30
|
+
])
|
|
31
|
+
};
|
|
32
|
+
}
|
|
20
33
|
static {
|
|
21
34
|
this.styles = [super.styles, styles];
|
|
22
35
|
}
|
|
@@ -45,6 +45,10 @@ export type CalendarSelection = 'single' | 'range';
|
|
|
45
45
|
* @internal
|
|
46
46
|
*/
|
|
47
47
|
export declare class UCalendar extends UElement {
|
|
48
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
49
|
+
static enumerated: {
|
|
50
|
+
selection: readonly CalendarSelection[];
|
|
51
|
+
};
|
|
48
52
|
static styles: import('lit').CSSResultGroup[];
|
|
49
53
|
/** `single` picks one day (`value`); `range` picks two (`start`/`end`). */
|
|
50
54
|
selection: CalendarSelection;
|
|
@@ -72,6 +76,10 @@ export declare class UCalendar extends UElement {
|
|
|
72
76
|
/** The day the pointer rests on — previews the range while an anchor is set. */
|
|
73
77
|
private hoverDate?;
|
|
74
78
|
private grabFocusOnUpdate;
|
|
79
|
+
/** Writes a day-of-month in the active locale's digits — rebuilt every render, so a locale change is picked up. */
|
|
80
|
+
private dayNumber;
|
|
81
|
+
/** 이 렌더에서 쓰는 주의 첫 요일(0 = 일 … 6 = 토) — 머리글 · 격자 앞 빈 칸 · Home/End 가 한 값을 읽는다. */
|
|
82
|
+
private weekStart;
|
|
75
83
|
/**
|
|
76
84
|
* Shows the month containing `date` (ISO or `Date`) as the first visible month and makes
|
|
77
85
|
* that day the roving-tabindex target. Does not move DOM focus — call `focusDay()` for that.
|
|
@@ -2,20 +2,21 @@ import "../icon-button/UIconButton.js";
|
|
|
2
2
|
import { UElement } from "../UElement.js";
|
|
3
3
|
import { Locale } from "../../utilities/Locale.js";
|
|
4
4
|
import { formatDate } from "../../utilities/format.js";
|
|
5
|
-
import { addDays, addMonths, daysInMonth, isDayUnavailable, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate } from "./dates.js";
|
|
5
|
+
import { addDays, addMonths, dayOfWeekIndex, daysInMonth, isDayUnavailable, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate, weekStartDay } from "./dates.js";
|
|
6
6
|
import { styles } from "./UCalendar.styles.js";
|
|
7
7
|
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html } from "lit";
|
|
11
12
|
import { customElement, property, state } from "lit/decorators.js";
|
|
12
13
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
13
14
|
// src/components/calendar/UCalendar.ts
|
|
14
|
-
/** Cells to render for one month — leading `null`s pad the previous month's
|
|
15
|
-
function buildMonthGrid(month) {
|
|
15
|
+
/** Cells to render for one month — leading `null`s pad the previous month's offset from the locale's first day of the week. */
|
|
16
|
+
function buildMonthGrid(month, weekStart) {
|
|
16
17
|
const first = startOfMonth(month);
|
|
17
18
|
const cells = [];
|
|
18
|
-
for (let i = 0; i < first
|
|
19
|
+
for (let i = 0; i < dayOfWeekIndex(first, weekStart); i++) cells.push(null);
|
|
19
20
|
for (let d = 1; d <= daysInMonth(month); d++) cells.push(new Date(month.getFullYear(), month.getMonth(), d));
|
|
20
21
|
return cells;
|
|
21
22
|
}
|
|
@@ -29,11 +30,11 @@ function chunkWeeks(cells) {
|
|
|
29
30
|
function ordered(a, b) {
|
|
30
31
|
return a.getTime() <= b.getTime() ? [a, b] : [b, a];
|
|
31
32
|
}
|
|
32
|
-
/** 2023-01-01 was a Sunday — a fixed reference date
|
|
33
|
-
function getWeekdayLabels(locale) {
|
|
33
|
+
/** 2023-01-01 was a Sunday — a fixed reference date, so the labels never depend on today; the row starts at the locale's first day. */
|
|
34
|
+
function getWeekdayLabels(weekStart, locale) {
|
|
34
35
|
const formatter = new Intl.DateTimeFormat(locale ?? Locale.get(), { weekday: "narrow" });
|
|
35
36
|
const sunday = new Date(2023, 0, 1);
|
|
36
|
-
return Array.from({ length: 7 }, (_, i) => formatter.format(addDays(sunday, i)));
|
|
37
|
+
return Array.from({ length: 7 }, (_, i) => formatter.format(addDays(sunday, weekStart + i)));
|
|
37
38
|
}
|
|
38
39
|
var UCalendar = class UCalendar extends UElement {
|
|
39
40
|
constructor(..._args) {
|
|
@@ -43,6 +44,8 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
43
44
|
this.viewDate = startOfMonth(/* @__PURE__ */ new Date());
|
|
44
45
|
this.focusedDate = /* @__PURE__ */ new Date();
|
|
45
46
|
this.grabFocusOnUpdate = false;
|
|
47
|
+
this.dayNumber = new Intl.NumberFormat(Locale.get(), { useGrouping: false });
|
|
48
|
+
this.weekStart = 0;
|
|
46
49
|
this.handlePointerLeave = () => {
|
|
47
50
|
this.hoverDate = void 0;
|
|
48
51
|
};
|
|
@@ -50,13 +53,14 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
50
53
|
this.handleNextMonth = () => this.navigateMonth(1);
|
|
51
54
|
this.handleDayKeydown = (e, date) => {
|
|
52
55
|
const forward = this.isRtl ? -1 : 1;
|
|
56
|
+
const column = dayOfWeekIndex(date, this.weekStart);
|
|
53
57
|
const deltas = {
|
|
54
58
|
ArrowRight: forward,
|
|
55
59
|
ArrowLeft: -forward,
|
|
56
60
|
ArrowDown: 7,
|
|
57
61
|
ArrowUp: -7,
|
|
58
|
-
Home: -
|
|
59
|
-
End: 6 -
|
|
62
|
+
Home: -column,
|
|
63
|
+
End: 6 - column
|
|
60
64
|
};
|
|
61
65
|
if (e.key in deltas) {
|
|
62
66
|
e.preventDefault();
|
|
@@ -73,6 +77,12 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
73
77
|
}
|
|
74
78
|
};
|
|
75
79
|
}
|
|
80
|
+
static {
|
|
81
|
+
this.enumerated = {
|
|
82
|
+
...super.enumerated,
|
|
83
|
+
selection: enumeratedValues()(["single", "range"])
|
|
84
|
+
};
|
|
85
|
+
}
|
|
76
86
|
static {
|
|
77
87
|
this.styles = [super.styles, styles];
|
|
78
88
|
}
|
|
@@ -99,19 +109,25 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
99
109
|
}
|
|
100
110
|
render() {
|
|
101
111
|
const months = Array.from({ length: Math.max(1, this.visibleMonths) }, (_, i) => addMonths(this.viewDate, i));
|
|
102
|
-
|
|
112
|
+
this.weekStart = weekStartDay(Locale.get());
|
|
113
|
+
const weekdayLabels = getWeekdayLabels(this.weekStart);
|
|
103
114
|
const range = this.shownRange();
|
|
115
|
+
this.dayNumber = new Intl.NumberFormat(Locale.get(), { useGrouping: false });
|
|
104
116
|
return html`
|
|
105
117
|
<div class="months" @pointerleave=${this.handlePointerLeave}>
|
|
106
118
|
${months.map((month, i) => this.renderMonth(month, weekdayLabels, i === 0, i === months.length - 1, range))}
|
|
107
119
|
</div>
|
|
108
|
-
<span class="status" role="status">${this.anchor ? Locale.getValue("rangeStartChosen", { date: formatDate(this.anchor, {
|
|
120
|
+
<span class="status" role="status">${this.anchor ? Locale.getValue("rangeStartChosen", { date: formatDate(this.anchor, {
|
|
121
|
+
dateStyle: "long",
|
|
122
|
+
calendar: "gregory"
|
|
123
|
+
}) }) : ""}</span>
|
|
109
124
|
`;
|
|
110
125
|
}
|
|
111
126
|
renderMonth(month, weekdayLabels, first, last, range) {
|
|
112
127
|
const monthLabel = formatDate(month, {
|
|
113
128
|
year: "numeric",
|
|
114
|
-
month: "long"
|
|
129
|
+
month: "long",
|
|
130
|
+
calendar: "gregory"
|
|
115
131
|
});
|
|
116
132
|
return html`
|
|
117
133
|
<div class="month" part="calendar-month">
|
|
@@ -125,7 +141,7 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
125
141
|
</div>
|
|
126
142
|
<div class="calendar-grid" part="calendar-grid" role="grid" aria-label=${monthLabel}
|
|
127
143
|
aria-multiselectable=${ifDefined(this.selection === "range" ? "true" : void 0)}>
|
|
128
|
-
${chunkWeeks(buildMonthGrid(month)).map((week) => html`
|
|
144
|
+
${chunkWeeks(buildMonthGrid(month, this.weekStart)).map((week) => html`
|
|
129
145
|
<div class="calendar-week" part="calendar-week" role="row">
|
|
130
146
|
${week.map((date) => date ? this.renderDay(date, range) : html`<span class="day-empty" role="gridcell" aria-hidden="true"></span>`)}
|
|
131
147
|
</div>
|
|
@@ -165,7 +181,7 @@ var UCalendar = class UCalendar extends UElement {
|
|
|
165
181
|
@pointerenter=${() => {
|
|
166
182
|
if (this.anchor) this.hoverDate = date;
|
|
167
183
|
}}
|
|
168
|
-
>${date.getDate()}</button>
|
|
184
|
+
>${this.dayNumber.format(date.getDate())}</button>
|
|
169
185
|
`;
|
|
170
186
|
}
|
|
171
187
|
dayButton(date) {
|
|
@@ -7,6 +7,18 @@ export declare function startOfMonth(date: Date): Date;
|
|
|
7
7
|
export declare function addMonths(date: Date, delta: number): Date;
|
|
8
8
|
export declare function addDays(date: Date, delta: number): Date;
|
|
9
9
|
export declare function daysInMonth(date: Date): number;
|
|
10
|
+
/**
|
|
11
|
+
* 로케일이 한 주를 여는 요일 — `Date#getDay()` 와 같은 수(0 = 일 … 6 = 토).
|
|
12
|
+
*
|
|
13
|
+
* CLDR 의 지역 자료를 `Intl.Locale` 로 읽는다(`fa` `ar-EG` 는 토요일, `de` `fr` `ru` 는 월요일, `en` `ko` `ja` 는 일요일).
|
|
14
|
+
* 지역이 없는 태그(`en` · `ar`)는 엔진이 «가장 그럴듯한 지역»으로 채워 답한다. 엔진이 주 정보를 내지 않거나 태그를 읽지
|
|
15
|
+
* 못하면 일요일 — 이 달력이 로케일을 따르기 전까지 늘 그랬던 값이다.
|
|
16
|
+
*/
|
|
17
|
+
export declare function weekStartDay(locale: string): number;
|
|
18
|
+
/** `date` 가 그 주의 몇 번째 칸인가(0 = 첫 칸) — `weekStart` 는 {@link weekStartDay} 의 값. */
|
|
19
|
+
export declare function dayOfWeekIndex(date: Date, weekStart: number): number;
|
|
20
|
+
/** `date` 가 속한 주의 첫날. */
|
|
21
|
+
export declare function startOfWeek(date: Date, weekStart: number): Date;
|
|
10
22
|
/** 두 날의 달 차이(`b` 가 `a` 보다 몇 달 뒤인가). 일자는 무시한다. */
|
|
11
23
|
export declare function monthDiff(a: Date, b: Date): number;
|
|
12
24
|
/** 앱이 정하는 날짜별 비활성 규칙 — ISO `YYYY-MM-DD` 를 받아 고를 수 없으면 `true`. */
|
|
@@ -23,6 +23,30 @@ function addDays(date, delta) {
|
|
|
23
23
|
function daysInMonth(date) {
|
|
24
24
|
return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* 로케일이 한 주를 여는 요일 — `Date#getDay()` 와 같은 수(0 = 일 … 6 = 토).
|
|
28
|
+
*
|
|
29
|
+
* CLDR 의 지역 자료를 `Intl.Locale` 로 읽는다(`fa` `ar-EG` 는 토요일, `de` `fr` `ru` 는 월요일, `en` `ko` `ja` 는 일요일).
|
|
30
|
+
* 지역이 없는 태그(`en` · `ar`)는 엔진이 «가장 그럴듯한 지역»으로 채워 답한다. 엔진이 주 정보를 내지 않거나 태그를 읽지
|
|
31
|
+
* 못하면 일요일 — 이 달력이 로케일을 따르기 전까지 늘 그랬던 값이다.
|
|
32
|
+
*/
|
|
33
|
+
function weekStartDay(locale) {
|
|
34
|
+
try {
|
|
35
|
+
const loc = new Intl.Locale(locale);
|
|
36
|
+
const first = (typeof loc.getWeekInfo === "function" ? loc.getWeekInfo() : loc.weekInfo)?.firstDay;
|
|
37
|
+
return typeof first === "number" && first >= 1 && first <= 7 ? first % 7 : 0;
|
|
38
|
+
} catch {
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** `date` 가 그 주의 몇 번째 칸인가(0 = 첫 칸) — `weekStart` 는 {@link weekStartDay} 의 값. */
|
|
43
|
+
function dayOfWeekIndex(date, weekStart) {
|
|
44
|
+
return (date.getDay() - weekStart + 7) % 7;
|
|
45
|
+
}
|
|
46
|
+
/** `date` 가 속한 주의 첫날. */
|
|
47
|
+
function startOfWeek(date, weekStart) {
|
|
48
|
+
return addDays(date, -dayOfWeekIndex(date, weekStart));
|
|
49
|
+
}
|
|
26
50
|
/** 두 날의 달 차이(`b` 가 `a` 보다 몇 달 뒤인가). 일자는 무시한다. */
|
|
27
51
|
function monthDiff(a, b) {
|
|
28
52
|
return (b.getFullYear() - a.getFullYear()) * 12 + (b.getMonth() - a.getMonth());
|
|
@@ -37,4 +61,4 @@ function isOutOfRange(date, min, max) {
|
|
|
37
61
|
if (max && date.getTime() > parseISODate(max).getTime()) return true;
|
|
38
62
|
return false;
|
|
39
63
|
}
|
|
40
|
-
export { addDays, addMonths, daysInMonth, isDayUnavailable, isOutOfRange, isSameDay, monthDiff, parseISODate, startOfMonth, toISODate };
|
|
64
|
+
export { addDays, addMonths, dayOfWeekIndex, daysInMonth, isDayUnavailable, isOutOfRange, isSameDay, monthDiff, parseISODate, startOfMonth, startOfWeek, toISODate, weekStartDay };
|
|
@@ -27,6 +27,12 @@ export type CardTone = 'primary' | 'info' | 'success' | 'warning' | 'danger';
|
|
|
27
27
|
* @cssprop --card-border-color - 테두리 색
|
|
28
28
|
*/
|
|
29
29
|
export declare class UCard extends UElement {
|
|
30
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
31
|
+
static enumerated: {
|
|
32
|
+
orientation: readonly CardOrientation[];
|
|
33
|
+
appearance: readonly CardAppearance[];
|
|
34
|
+
tone: readonly CardTone[];
|
|
35
|
+
};
|
|
30
36
|
static styles: import('lit').CSSResultGroup[];
|
|
31
37
|
/** 카드 레이아웃 방향 */
|
|
32
38
|
orientation: CardOrientation;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
2
|
import { styles } from "./UCard.styles.js";
|
|
3
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
3
4
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
4
5
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
5
6
|
import { html } from "lit";
|
|
@@ -14,6 +15,20 @@ var UCard = class UCard extends UElement {
|
|
|
14
15
|
this.appearance = "outlined";
|
|
15
16
|
this.hoverable = false;
|
|
16
17
|
}
|
|
18
|
+
static {
|
|
19
|
+
this.enumerated = {
|
|
20
|
+
...super.enumerated,
|
|
21
|
+
orientation: enumeratedValues()(["vertical", "horizontal"]),
|
|
22
|
+
appearance: enumeratedValues()(["outlined", "plain"]),
|
|
23
|
+
tone: enumeratedValues()([
|
|
24
|
+
"primary",
|
|
25
|
+
"info",
|
|
26
|
+
"success",
|
|
27
|
+
"warning",
|
|
28
|
+
"danger"
|
|
29
|
+
])
|
|
30
|
+
};
|
|
31
|
+
}
|
|
17
32
|
static {
|
|
18
33
|
this.styles = [super.styles, styles];
|
|
19
34
|
}
|
|
@@ -32,6 +32,10 @@ import { UElement } from '../UElement.js';
|
|
|
32
32
|
* @csspart rotation-button - 자동 넘김 정지/시작 버튼 (`autoplay` 일 때만, 인디케이터 안)
|
|
33
33
|
*/
|
|
34
34
|
export declare class UCarousel extends UElement {
|
|
35
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
36
|
+
static enumerated: {
|
|
37
|
+
paginationStyle: readonly ("dots" | "labels")[];
|
|
38
|
+
};
|
|
35
39
|
static styles: import('lit').CSSResultGroup[];
|
|
36
40
|
/** 자동 재생 활성화 */
|
|
37
41
|
autoplay: boolean;
|
|
@@ -6,6 +6,7 @@ import { HostAria } from "../../utilities/hostAria.js";
|
|
|
6
6
|
import { UNATTENDED_IDLE_MS } from "../../utilities/unattended.js";
|
|
7
7
|
import { styles } from "./UCarousel.styles.js";
|
|
8
8
|
import { delegate } from "../../utilities/listenInShadow.js";
|
|
9
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
9
10
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
10
11
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
11
12
|
import { html, nothing } from "lit";
|
|
@@ -139,6 +140,12 @@ var UCarousel = class UCarousel extends UElement {
|
|
|
139
140
|
e.stopPropagation();
|
|
140
141
|
};
|
|
141
142
|
}
|
|
143
|
+
static {
|
|
144
|
+
this.enumerated = {
|
|
145
|
+
...super.enumerated,
|
|
146
|
+
paginationStyle: enumeratedValues()(["dots", "labels"])
|
|
147
|
+
};
|
|
148
|
+
}
|
|
142
149
|
static {
|
|
143
150
|
this.styles = [super.styles, styles];
|
|
144
151
|
}
|
|
@@ -23,6 +23,12 @@ export type CheckboxColor = "primary" | "secondary" | "info" | "success" | "warn
|
|
|
23
23
|
* @event change - 체크 상태 변경 시 발생
|
|
24
24
|
* */
|
|
25
25
|
export declare class UCheckbox extends UFormControlElement<string> {
|
|
26
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
27
|
+
static enumerated: {
|
|
28
|
+
appearance: readonly CheckboxAppearance[];
|
|
29
|
+
color: readonly CheckboxColor[];
|
|
30
|
+
descriptionDisplay: readonly import('../field/UField.js').FieldDescriptionDisplay[];
|
|
31
|
+
};
|
|
26
32
|
static styles: import('lit').CSSResultGroup[];
|
|
27
33
|
/** 외형 정도 — `solid`(기본) · `outlined` */
|
|
28
34
|
appearance: CheckboxAppearance;
|
|
@@ -2,6 +2,7 @@ import "../icon/UIcon.js";
|
|
|
2
2
|
import { UFormControlElement } from "../UFormControlElement.js";
|
|
3
3
|
import { Locale } from "../../utilities/Locale.js";
|
|
4
4
|
import { styles } from "./UCheckbox.styles.js";
|
|
5
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
5
6
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
6
7
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
7
8
|
import { html } from "lit";
|
|
@@ -26,6 +27,29 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
|
|
|
26
27
|
this.relay(e);
|
|
27
28
|
};
|
|
28
29
|
}
|
|
30
|
+
static {
|
|
31
|
+
this.enumerated = {
|
|
32
|
+
...super.enumerated,
|
|
33
|
+
appearance: enumeratedValues()(["solid", "outlined"]),
|
|
34
|
+
color: enumeratedValues()([
|
|
35
|
+
"primary",
|
|
36
|
+
"secondary",
|
|
37
|
+
"info",
|
|
38
|
+
"success",
|
|
39
|
+
"warning",
|
|
40
|
+
"danger",
|
|
41
|
+
"blue",
|
|
42
|
+
"green",
|
|
43
|
+
"red",
|
|
44
|
+
"orange",
|
|
45
|
+
"teal",
|
|
46
|
+
"cyan",
|
|
47
|
+
"purple",
|
|
48
|
+
"pink",
|
|
49
|
+
"neutral"
|
|
50
|
+
])
|
|
51
|
+
};
|
|
52
|
+
}
|
|
29
53
|
static {
|
|
30
54
|
this.styles = [super.styles, styles];
|
|
31
55
|
}
|
|
@@ -72,7 +96,7 @@ var UCheckbox = class UCheckbox extends UFormControlElement {
|
|
|
72
96
|
></u-icon>
|
|
73
97
|
</span>
|
|
74
98
|
<span class="label" part="label">
|
|
75
|
-
<slot @slotchange=${this.handleLabelSlotChange}>${this.label}</slot>
|
|
99
|
+
<bdi><slot @slotchange=${this.handleLabelSlotChange}>${this.label}</slot></bdi>
|
|
76
100
|
<span class="required" ?hidden=${!this.required}>*</span>
|
|
77
101
|
</span>
|
|
78
102
|
</label>
|
|
@@ -18,6 +18,11 @@ import { TagAppearance, TagColor } from '../tag/UTag.js';
|
|
|
18
18
|
* @event remove - 삭제 버튼 클릭 시 발생
|
|
19
19
|
*/
|
|
20
20
|
export declare class UChip extends UElement {
|
|
21
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
22
|
+
static enumerated: {
|
|
23
|
+
appearance: readonly TagAppearance[];
|
|
24
|
+
color: readonly TagColor[];
|
|
25
|
+
};
|
|
21
26
|
static styles: import('lit').CSSResultGroup[];
|
|
22
27
|
/** 칩의 스타일 변형 */
|
|
23
28
|
appearance: TagAppearance;
|
|
@@ -6,6 +6,7 @@ import { UElement } from "../UElement.js";
|
|
|
6
6
|
import { styles } from "./UChip.styles.js";
|
|
7
7
|
import { Locale } from "../../utilities/Locale.js";
|
|
8
8
|
import { delegate } from "../../utilities/listenInShadow.js";
|
|
9
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
9
10
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
10
11
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
11
12
|
import { html } from "lit";
|
|
@@ -39,6 +40,35 @@ var UChip = class UChip extends UElement {
|
|
|
39
40
|
})) this.remove();
|
|
40
41
|
};
|
|
41
42
|
}
|
|
43
|
+
static {
|
|
44
|
+
this.enumerated = {
|
|
45
|
+
...super.enumerated,
|
|
46
|
+
appearance: enumeratedValues()([
|
|
47
|
+
"solid",
|
|
48
|
+
"soft",
|
|
49
|
+
"outlined",
|
|
50
|
+
"plain"
|
|
51
|
+
]),
|
|
52
|
+
color: enumeratedValues()([
|
|
53
|
+
"neutral",
|
|
54
|
+
"primary",
|
|
55
|
+
"secondary",
|
|
56
|
+
"info",
|
|
57
|
+
"success",
|
|
58
|
+
"warning",
|
|
59
|
+
"danger",
|
|
60
|
+
"blue",
|
|
61
|
+
"green",
|
|
62
|
+
"yellow",
|
|
63
|
+
"red",
|
|
64
|
+
"orange",
|
|
65
|
+
"teal",
|
|
66
|
+
"cyan",
|
|
67
|
+
"purple",
|
|
68
|
+
"pink"
|
|
69
|
+
])
|
|
70
|
+
};
|
|
71
|
+
}
|
|
42
72
|
static {
|
|
43
73
|
this.styles = [super.styles, styles];
|
|
44
74
|
}
|
|
@@ -19,6 +19,10 @@ import { ButtonAppearance } from '../button/UButton.js';
|
|
|
19
19
|
* @csspart tooltip - 툴팁 요소 (아이콘 전용 형태)
|
|
20
20
|
*/
|
|
21
21
|
export declare class UCopyButton extends UElement {
|
|
22
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
23
|
+
static enumerated: {
|
|
24
|
+
appearance: readonly ButtonAppearance[];
|
|
25
|
+
};
|
|
22
26
|
static styles: import('lit').CSSResultGroup[];
|
|
23
27
|
/** 호스트의 `.focus()` 를 안쪽 컨트롤로 위임한다 — `UButton` 과 같은 계약(호스트는 포커스 가능하지 않다). */
|
|
24
28
|
static shadowRootOptions: ShadowRootInit;
|
|
@@ -5,6 +5,7 @@ import { UElement } from "../UElement.js";
|
|
|
5
5
|
import { styles } from "./UCopyButton.styles.js";
|
|
6
6
|
import { Locale } from "../../utilities/Locale.js";
|
|
7
7
|
import { delegate } from "../../utilities/listenInShadow.js";
|
|
8
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
8
9
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
9
10
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
10
11
|
import { html } from "lit";
|
|
@@ -46,6 +47,18 @@ var UCopyButton = class UCopyButton extends UElement {
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
}
|
|
50
|
+
static {
|
|
51
|
+
this.enumerated = {
|
|
52
|
+
...super.enumerated,
|
|
53
|
+
appearance: enumeratedValues()([
|
|
54
|
+
"solid",
|
|
55
|
+
"soft",
|
|
56
|
+
"outlined",
|
|
57
|
+
"plain",
|
|
58
|
+
"link"
|
|
59
|
+
])
|
|
60
|
+
};
|
|
61
|
+
}
|
|
49
62
|
static {
|
|
50
63
|
this.styles = [super.styles, styles];
|
|
51
64
|
}
|
|
@@ -21,11 +21,10 @@ export type { DateDisabledFn } from '../calendar/dates.js';
|
|
|
21
21
|
* local UTC offset, so the value is unconditionally valid regardless of how coarse the time
|
|
22
22
|
* input was.
|
|
23
23
|
*
|
|
24
|
-
* The calendar week
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* where unsupported.
|
|
24
|
+
* The calendar week starts on the active locale's first day of the week — Monday for `de` `fr` `ru`,
|
|
25
|
+
* Saturday for `fa` `ar-EG`, Sunday for `en` `ko` `ja` — read from `Intl.Locale`. The weekday row, the
|
|
26
|
+
* empty cells before the 1st and the Home/End keys all follow it. A browser that does not report week
|
|
27
|
+
* information gets Sunday.
|
|
29
28
|
*
|
|
30
29
|
* Exposes a `:state(open)` custom state (via `ElementInternals.states`) while the calendar
|
|
31
30
|
* popover is showing — style with `u-date-picker:state(open)::part(container)`. Unlike
|
|
@@ -61,6 +60,13 @@ export type { DateDisabledFn } from '../calendar/dates.js';
|
|
|
61
60
|
* value assignment does not fire it (same contract as native form controls).
|
|
62
61
|
*/
|
|
63
62
|
export declare class UDatePicker extends UFormControlElement<string> {
|
|
63
|
+
/** 목록 밖의 값은 어떤 규칙에도 안 걸려 조용히 기본 모양이 된다 — 개발 모드에서 한 번 알린다(`UElement.enumerated`). */
|
|
64
|
+
static enumerated: {
|
|
65
|
+
size: readonly FieldSize[];
|
|
66
|
+
mode: readonly DatePickerMode[];
|
|
67
|
+
format: readonly DateTextFormat[];
|
|
68
|
+
descriptionDisplay: readonly import('../field/UField.js').FieldDescriptionDisplay[];
|
|
69
|
+
};
|
|
64
70
|
static styles: import('lit').CSSResultGroup[];
|
|
65
71
|
protected static fieldBox: boolean;
|
|
66
72
|
/** 크기 — 다른 필드·버튼과 같은 세 단(`md` = `--u-density`(14px) · `sm` = 그 6/7(12px) · `lg` = 8/7(16px) — 밀도 단을 바꾸면 셋이 함께 움직인다). */
|
|
@@ -13,6 +13,7 @@ import { normalizeTime, sameDateTime, splitDateTime, toDateTimeOffset } from "..
|
|
|
13
13
|
import { styles } from "../calendar/picker.styles.js";
|
|
14
14
|
import { styles as styles$1 } from "./UDatePicker.styles.js";
|
|
15
15
|
import { delegate } from "../../utilities/listenInShadow.js";
|
|
16
|
+
import { enumeratedValues } from "../../utilities/enumerated.js";
|
|
16
17
|
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorateMetadata.js";
|
|
17
18
|
import __decorate from "../../_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/decorate.js";
|
|
18
19
|
import { html } from "lit";
|
|
@@ -142,6 +143,18 @@ var UDatePicker = class UDatePicker extends UFormControlElement {
|
|
|
142
143
|
this.handleClearClick(e);
|
|
143
144
|
};
|
|
144
145
|
}
|
|
146
|
+
static {
|
|
147
|
+
this.enumerated = {
|
|
148
|
+
...super.enumerated,
|
|
149
|
+
size: enumeratedValues()([
|
|
150
|
+
"sm",
|
|
151
|
+
"md",
|
|
152
|
+
"lg"
|
|
153
|
+
]),
|
|
154
|
+
mode: enumeratedValues()(["date", "datetime"]),
|
|
155
|
+
format: enumeratedValues()(["iso", "locale"])
|
|
156
|
+
};
|
|
157
|
+
}
|
|
145
158
|
static {
|
|
146
159
|
this.styles = [
|
|
147
160
|
super.styles,
|