@iyulab/components 1.52.0 → 1.54.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 +73 -0
- package/README.md +54 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/decorate.js +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.151.0 → _@oxc-project_runtime@0.152.0}/helpers/esm/decorateMetadata.js +1 -1
- package/dist/_virtual/_glob-assets_raw/player-pause-fill.svg.a756c400.js +4 -0
- package/dist/_virtual/_glob-assets_raw/player-play-fill.svg.768b6efc.js +4 -0
- package/dist/assets/locales/ar.json.js +27 -1
- package/dist/assets/locales/de.json.js +27 -1
- package/dist/assets/locales/en.json.js +27 -1
- package/dist/assets/locales/es.json.js +27 -1
- package/dist/assets/locales/fr.json.js +27 -1
- package/dist/assets/locales/id.json.js +27 -1
- package/dist/assets/locales/ja.json.js +27 -1
- package/dist/assets/locales/ko.json.js +27 -1
- package/dist/assets/locales/pt-BR.json.js +27 -1
- package/dist/assets/locales/ru.json.js +27 -1
- package/dist/assets/locales/th.json.js +27 -1
- package/dist/assets/locales/vi.json.js +27 -1
- package/dist/assets/locales/zh-CN.json.js +27 -1
- package/dist/assets/locales/zh-TW.json.js +27 -1
- package/dist/components/UFloatingElement.js +2 -2
- package/dist/components/UFormControlElement.js +2 -2
- package/dist/components/UOverlayElement.js +2 -2
- package/dist/components/alert/UAlert.js +2 -2
- package/dist/components/avatar/UAvatar.js +2 -2
- package/dist/components/badge/UBadge.js +2 -2
- package/dist/components/breadcrumb/UBreadcrumb.js +1 -1
- package/dist/components/breadcrumb-item/UBreadcrumbItem.js +2 -2
- package/dist/components/button/UButton.js +2 -2
- package/dist/components/button-group/UButtonGroup.js +2 -2
- package/dist/components/calendar/UCalendar.d.ts +101 -0
- package/dist/components/calendar/UCalendar.js +223 -0
- package/dist/components/calendar/UCalendar.styles.d.ts +1 -0
- package/dist/components/calendar/UCalendar.styles.js +137 -0
- package/dist/components/calendar/dates.d.ts +13 -0
- package/dist/components/calendar/dates.js +37 -0
- package/dist/components/calendar/picker.styles.d.ts +5 -0
- package/dist/components/calendar/picker.styles.js +78 -0
- package/dist/components/card/UCard.js +2 -2
- package/dist/components/carousel/UCarousel.d.ts +17 -0
- package/dist/components/carousel/UCarousel.js +53 -12
- package/dist/components/carousel/UCarousel.styles.js +20 -0
- package/dist/components/checkbox/UCheckbox.js +2 -2
- package/dist/components/chip/UChip.js +2 -2
- package/dist/components/copy-button/UCopyButton.js +2 -2
- package/dist/components/date-picker/UDatePicker.d.ts +8 -13
- package/dist/components/date-picker/UDatePicker.js +36 -165
- package/dist/components/date-picker/UDatePicker.styles.js +0 -135
- package/dist/components/date-range-picker/UDateRangePicker.d.ts +113 -0
- package/dist/components/date-range-picker/UDateRangePicker.js +276 -0
- package/dist/components/date-range-picker/UDateRangePicker.styles.d.ts +1 -0
- package/dist/components/date-range-picker/UDateRangePicker.styles.js +83 -0
- package/dist/components/date-range-picker/presets.d.ts +32 -0
- package/dist/components/date-range-picker/presets.js +78 -0
- package/dist/components/dialog/UDialog.js +2 -2
- package/dist/components/divider/UDivider.js +2 -2
- package/dist/components/drawer/UDrawer.js +2 -2
- package/dist/components/expander/UExpander.js +2 -2
- package/dist/components/field/UField.js +2 -2
- package/dist/components/file-input/UFileInput.js +2 -2
- package/dist/components/form/UForm.js +2 -2
- package/dist/components/icon/UIcon.js +2 -2
- package/dist/components/icon-button/UIconButton.js +2 -2
- package/dist/components/input/UInput.d.ts +31 -3
- package/dist/components/input/UInput.js +131 -24
- package/dist/components/menu/UMenu.js +2 -2
- package/dist/components/menu-item/UMenuItem.js +2 -2
- package/dist/components/option/UOption.js +2 -2
- package/dist/components/panel/UPanel.js +2 -2
- package/dist/components/popover/UPopover.js +2 -2
- package/dist/components/progress-bar/UProgressBar.js +2 -2
- package/dist/components/progress-ring/UProgressRing.js +2 -2
- package/dist/components/radio/URadio.js +2 -2
- package/dist/components/rating/URating.js +2 -2
- package/dist/components/select/USelect.js +2 -2
- package/dist/components/skeleton/USkeleton.js +2 -2
- package/dist/components/slider/USlider.js +2 -2
- package/dist/components/spinner/USpinner.js +2 -2
- package/dist/components/split-panel/USplitPanel.js +2 -2
- package/dist/components/switch/USwitch.js +2 -2
- package/dist/components/tab/UTab.js +2 -2
- package/dist/components/tab-panel/UTabPanel.js +2 -2
- package/dist/components/tag/UTag.js +2 -2
- package/dist/components/text/UText.js +2 -2
- package/dist/components/textarea/UTextarea.js +2 -2
- package/dist/components/tooltip/UTooltip.js +2 -2
- package/dist/components/tree/UTree.js +2 -2
- package/dist/components/tree-item/UTreeItem.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -2
- package/dist/plugins/vite-plugin-react-wrapper.d.ts +7 -0
- package/dist/plugins/vite-plugin-react-wrapper.js +11 -1
- package/dist/react/UDateRangePicker.d.ts +13 -0
- package/dist/react/UDateRangePicker.js +12 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/utilities/Locale.d.ts +1 -1
- package/dist/utilities/format.d.ts +27 -0
- package/dist/utilities/format.js +71 -1
- package/dist/utilities/icons.js +4 -0
- package/package.json +3 -3
- package/skills/iyulab-components/SKILL.md +1 -0
- package/skills/iyulab-components/references/components/carousel.md +6 -0
- package/skills/iyulab-components/references/components/date-picker.md +2 -0
- package/skills/iyulab-components/references/components/date-range-picker.md +147 -0
- package/skills/iyulab-components/references/components/input.md +14 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import { styles } from "./USpinner.styles.js";
|
|
5
5
|
import { html } from "lit";
|
|
6
6
|
import { customElement, property, state } from "lit/decorators.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import { arrayAttrConverter } from "../../utilities/converters.js";
|
|
5
5
|
import { devWarnOnce } from "../../utilities/devWarning.js";
|
|
6
6
|
import { Locale } from "../../utilities/Locale.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
3
3
|
import { UFormControlElement } from "../UFormControlElement.js";
|
|
4
4
|
import { Locale } from "../../utilities/Locale.js";
|
|
5
5
|
import { styles } from "./USwitch.styles.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import "../button/UButton.js";
|
|
5
5
|
import "../icon/UIcon.js";
|
|
6
6
|
import { Locale } from "../../utilities/Locale.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import { UPanel } from "../panel/UPanel.js";
|
|
5
5
|
import { UTab } from "../tab/UTab.js";
|
|
6
6
|
import { styles } from "./UTabPanel.styles.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import "../icon/UIcon.js";
|
|
5
5
|
import { statusIcon } from "../../utilities/statusIcon.js";
|
|
6
6
|
import { styles } from "./UTag.styles.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import { styles } from "./UText.styles.js";
|
|
5
5
|
import { customElement, property } from "lit/decorators.js";
|
|
6
6
|
import { html, literal } from "lit/static-html.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
3
3
|
import { UFormControlElement } from "../UFormControlElement.js";
|
|
4
4
|
import { Locale } from "../../utilities/Locale.js";
|
|
5
5
|
import "../field/UField.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
1
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
2
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
3
3
|
import { UFloatingElement } from "../UFloatingElement.js";
|
|
4
4
|
import { styles } from "./UTooltip.styles.js";
|
|
5
5
|
import { html } from "lit";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import { UTreeItem } from "../tree-item/UTreeItem.js";
|
|
5
5
|
import { styles } from "./UTree.styles.js";
|
|
6
6
|
import { html } from "lit";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { UElement } from "../UElement.js";
|
|
2
|
-
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.
|
|
3
|
-
import __decorate from "../../_virtual/_@oxc-project_runtime@0.
|
|
2
|
+
import __decorateMetadata from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorateMetadata.js";
|
|
3
|
+
import __decorate from "../../_virtual/_@oxc-project_runtime@0.152.0/helpers/esm/decorate.js";
|
|
4
4
|
import "../spinner/USpinner.js";
|
|
5
5
|
import "../icon/UIcon.js";
|
|
6
6
|
import { styles } from "./UTreeItem.styles.js";
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './components/checkbox/UCheckbox.js';
|
|
|
15
15
|
export * from './components/chip/UChip.js';
|
|
16
16
|
export * from './components/copy-button/UCopyButton.js';
|
|
17
17
|
export * from './components/date-picker/UDatePicker.js';
|
|
18
|
+
export * from './components/date-range-picker/UDateRangePicker.js';
|
|
18
19
|
export * from './components/dialog/UDialog.js';
|
|
19
20
|
export * from './components/divider/UDivider.js';
|
|
20
21
|
export * from './components/drawer/UDrawer.js';
|
package/dist/index.js
CHANGED
|
@@ -26,10 +26,11 @@ import { UCheckbox } from "./components/checkbox/UCheckbox.js";
|
|
|
26
26
|
import { UTag } from "./components/tag/UTag.js";
|
|
27
27
|
import { UChip } from "./components/chip/UChip.js";
|
|
28
28
|
import { UCopyButton } from "./components/copy-button/UCopyButton.js";
|
|
29
|
+
import { formatCurrency, formatDate, formatDateRange, formatNumber, parseNumber } from "./utilities/format.js";
|
|
29
30
|
import { UField } from "./components/field/UField.js";
|
|
30
31
|
import { UPopover } from "./components/popover/UPopover.js";
|
|
31
|
-
import { formatCurrency, formatDate, formatNumber } from "./utilities/format.js";
|
|
32
32
|
import { UDatePicker } from "./components/date-picker/UDatePicker.js";
|
|
33
|
+
import { UDateRangePicker } from "./components/date-range-picker/UDateRangePicker.js";
|
|
33
34
|
import { UDialog } from "./components/dialog/UDialog.js";
|
|
34
35
|
import { UDivider } from "./components/divider/UDivider.js";
|
|
35
36
|
import { UDrawer } from "./components/drawer/UDrawer.js";
|
|
@@ -61,4 +62,4 @@ import { Dialog } from "./utilities/Dialog.js";
|
|
|
61
62
|
import { Theme } from "./utilities/Theme.js";
|
|
62
63
|
import { Toast } from "./utilities/Toast.js";
|
|
63
64
|
import { decodeTsv, encodeTsv } from "./utilities/tsv.js";
|
|
64
|
-
export { ALERT_STATUSES, BrowserStorage, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USwitch, UTab, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, createDevWarner, dateAttrConverter, decodeTsv, devWarnOnce, encodeTsv, formatCurrency, formatDate, formatNumber, getDefaultBaseUrl, getParentElement, isCoarsePointer, isFocusCandidate, isImeComposing, jsonAttrConverter, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter };
|
|
65
|
+
export { ALERT_STATUSES, BrowserStorage, Dialog, IconCache, IconRegistry, Locale, OverlayManager, Theme, Toast, UAlert, UAvatar, UBadge, UBreadcrumb, UBreadcrumbItem, UButton, UButtonGroup, UCard, UCarousel, UCheckbox, UChip, UCopyButton, UDatePicker, UDateRangePicker, UDialog, UDivider, UDrawer, UElement, UExpander, UField, UFileInput, UFloatingElement, UForm, UFormControlElement, UIcon, UIconButton, UInput, UMenu, UMenuItem, UOption, UOverlayElement, UPanel, UPopover, UProgressBar, UProgressRing, URadio, URating, USelect, USkeleton, USlider, USpinner, USplitPanel, USwitch, UTab, UTabPanel, UTag, UText, UTextarea, UTooltip, UTree, UTreeItem, arrayAttrConverter, booleanAttrConverter, createDevWarner, dateAttrConverter, decodeTsv, devWarnOnce, encodeTsv, formatCurrency, formatDate, formatDateRange, formatNumber, getDefaultBaseUrl, getParentElement, isCoarsePointer, isFocusCandidate, isImeComposing, jsonAttrConverter, parseNumber, querySelectorAllWithin, querySelectorDeep, querySelectorWithin, resetDevWarnings, setDefaultBaseUrl, urlAttrConverter };
|
|
@@ -41,6 +41,13 @@ interface PluginOptions {
|
|
|
41
41
|
* Lit Element 컴포넌트를 React 래퍼로 자동 생성하는 Vite 플러그인
|
|
42
42
|
*/
|
|
43
43
|
export default function reactWrapperPlugin(options: PluginOptions): Plugin;
|
|
44
|
+
/**
|
|
45
|
+
* 등록 데코레이터 바로 위 JSDoc 에 `@internal` 이 있는가 — 다른 컴포넌트가 내부에서만 쓰는
|
|
46
|
+
* 요소(예: 날짜 피커들의 달력 격자)는 공개 표면이 아니므로 래퍼도 문서도 만들지 않는다.
|
|
47
|
+
* 표식은 컴포넌트 소스 한 곳에 두고, 표면을 만드는 쪽(이 플러그인 · `scripts/*-doc.mjs`)이
|
|
48
|
+
* 각자 읽는다 — 제외 목록을 설정 파일마다 따로 두면 서로 어긋난다.
|
|
49
|
+
*/
|
|
50
|
+
export declare function isInternalElement(content: string): boolean;
|
|
44
51
|
/**
|
|
45
52
|
* 이벤트가 **정적으로 수집되지 않는 형태**로 발화되는지 검사한다. 반환값이 비어 있지 않으면
|
|
46
53
|
* 빌드를 실패시킨다 — 누락된 이벤트는 React 소비자 쪽에서 에러도 경고도 없이 죽으므로
|
|
@@ -63,11 +63,21 @@ export default function reactWrapperPlugin(options) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
// --- 컴포넌트 파싱 ---
|
|
66
|
+
/**
|
|
67
|
+
* 등록 데코레이터 바로 위 JSDoc 에 `@internal` 이 있는가 — 다른 컴포넌트가 내부에서만 쓰는
|
|
68
|
+
* 요소(예: 날짜 피커들의 달력 격자)는 공개 표면이 아니므로 래퍼도 문서도 만들지 않는다.
|
|
69
|
+
* 표식은 컴포넌트 소스 한 곳에 두고, 표면을 만드는 쪽(이 플러그인 · `scripts/*-doc.mjs`)이
|
|
70
|
+
* 각자 읽는다 — 제외 목록을 설정 파일마다 따로 두면 서로 어긋난다.
|
|
71
|
+
*/
|
|
72
|
+
export function isInternalElement(content) {
|
|
73
|
+
const doc = content.match(/\/\*\*((?:(?!\*\/)[\s\S])*)\*\/\s*@customElement\s*\(/);
|
|
74
|
+
return !!doc && /@internal\b/.test(doc[1]);
|
|
75
|
+
}
|
|
66
76
|
function parseComponent(filePath, violations = []) {
|
|
67
77
|
const content = readFileSync(filePath, 'utf-8');
|
|
68
78
|
// @customElement('tag-name') 데코레이터 확인
|
|
69
79
|
const tagMatch = content.match(/@customElement\s*\(\s*['"]([^'"]+)['"]\s*\)/);
|
|
70
|
-
if (!tagMatch)
|
|
80
|
+
if (!tagMatch || isInternalElement(content))
|
|
71
81
|
return [];
|
|
72
82
|
// export class ClassName 추출
|
|
73
83
|
const classMatch = content.match(/export\s+(?:abstract\s+)?class\s+(\w+)/);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { UDateRangePicker as UDateRangePickerElement } from '@iyulab/components/dist/components/date-range-picker/UDateRangePicker.js';
|
|
3
|
+
|
|
4
|
+
export declare const UDateRangePicker: React.ForwardRefExoticComponent<
|
|
5
|
+
Omit<Partial<UDateRangePickerElement>, keyof React.HTMLAttributes<UDateRangePickerElement>>
|
|
6
|
+
& Omit<React.HTMLAttributes<UDateRangePickerElement>, 'onChange'>
|
|
7
|
+
& React.RefAttributes<UDateRangePickerElement>
|
|
8
|
+
& {
|
|
9
|
+
onChange?: (event: CustomEvent) => void;
|
|
10
|
+
}
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
export type UDateRangePickerProps = React.ComponentProps<typeof UDateRangePicker>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import { UDateRangePicker as UDateRangePickerElement } from '@iyulab/components/dist/components/date-range-picker/UDateRangePicker.js';
|
|
4
|
+
|
|
5
|
+
export const UDateRangePicker = createComponent({
|
|
6
|
+
react: React,
|
|
7
|
+
tagName: 'u-date-range-picker',
|
|
8
|
+
elementClass: UDateRangePickerElement,
|
|
9
|
+
events: {
|
|
10
|
+
onChange: 'change',
|
|
11
|
+
},
|
|
12
|
+
});
|
package/dist/react/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export { UExpander, UExpanderProps } from './UExpander';
|
|
|
31
31
|
export { UDrawer, UDrawerProps } from './UDrawer';
|
|
32
32
|
export { UDivider, UDividerProps } from './UDivider';
|
|
33
33
|
export { UDialog, UDialogProps } from './UDialog';
|
|
34
|
+
export { UDateRangePicker, UDateRangePickerProps } from './UDateRangePicker';
|
|
34
35
|
export { UDatePicker, UDatePickerProps } from './UDatePicker';
|
|
35
36
|
export { UCopyButton, UCopyButtonProps } from './UCopyButton';
|
|
36
37
|
export { UChip, UChipProps } from './UChip';
|
package/dist/react/index.js
CHANGED
|
@@ -31,6 +31,7 @@ export { UExpander } from './UExpander.js';
|
|
|
31
31
|
export { UDrawer } from './UDrawer.js';
|
|
32
32
|
export { UDivider } from './UDivider.js';
|
|
33
33
|
export { UDialog } from './UDialog.js';
|
|
34
|
+
export { UDateRangePicker } from './UDateRangePicker.js';
|
|
34
35
|
export { UDatePicker } from './UDatePicker.js';
|
|
35
36
|
export { UCopyButton } from './UCopyButton.js';
|
|
36
37
|
export { UChip } from './UChip.js';
|
|
@@ -12,7 +12,7 @@ export type SupportedLocale = 'en' | 'ko' | 'ja' | 'zh-CN' | 'zh-TW' | 'es' | 'f
|
|
|
12
12
|
/** 내장 로케일은 자동완성되지만, 임의의 BCP47 태그도 그대로 받는다. */
|
|
13
13
|
export type LocaleTag = SupportedLocale | (string & {});
|
|
14
14
|
/** 라이브러리가 제공하는 chrome 문자열 키. 지금은 검증 메시지뿐이지만 이후 다른 UI 문구도 추가될 수 있다. */
|
|
15
|
-
export type LocaleMessageKey = 'valueMissing' | 'badInput' | 'typeMismatch' | 'patternMismatch' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'tooShort' | 'tooLong' | 'increment' | 'decrement' | 'clear' | 'today' | 'time' | 'showPassword' | 'hidePassword' | 'previousSlide' | 'nextSlide' | 'goToSlide' | 'chooseDate' | 'previousMonth' | 'nextMonth' | 'close' | 'copy' | 'copied' | 'chooseFile' | 'noFileChosen' | 'filesSelected' | 'resizePanels' | 'breadcrumb' | 'search' | 'alertError' | 'alertWarning' | 'alertSuccess' | 'alertInfo' | 'alertNotice' | 'alertMessage' | 'remove' | 'closeTab' | 'confirm' | 'cancel';
|
|
15
|
+
export type LocaleMessageKey = 'valueMissing' | 'badInput' | 'typeMismatch' | 'patternMismatch' | 'rangeUnderflow' | 'rangeOverflow' | 'stepMismatch' | 'tooShort' | 'tooLong' | 'increment' | 'decrement' | 'clear' | 'today' | 'time' | 'showPassword' | 'hidePassword' | 'previousSlide' | 'nextSlide' | 'goToSlide' | 'stopSlideRotation' | 'startSlideRotation' | 'chooseDate' | 'chooseDateRange' | 'yesterday' | 'last7Days' | 'last30Days' | 'thisWeek' | 'lastWeek' | 'thisMonth' | 'lastMonth' | 'thisYear' | 'quickRanges' | 'rangeStartChosen' | 'previousMonth' | 'nextMonth' | 'close' | 'copy' | 'copied' | 'chooseFile' | 'noFileChosen' | 'filesSelected' | 'resizePanels' | 'breadcrumb' | 'search' | 'alertError' | 'alertWarning' | 'alertSuccess' | 'alertInfo' | 'alertNotice' | 'alertMessage' | 'remove' | 'closeTab' | 'confirm' | 'cancel';
|
|
16
16
|
type LocaleTable = Record<LocaleMessageKey, string>;
|
|
17
17
|
/**
|
|
18
18
|
* 한 패키지(또는 앱 영역)의 문자열 묶음.
|
|
@@ -28,3 +28,30 @@ export declare function formatCurrency(value: number, currency: string, options?
|
|
|
28
28
|
* surface at the first render rather than be papered over with a wrong-looking amount.
|
|
29
29
|
*/
|
|
30
30
|
export declare function formatDate(value: Date | string, options?: Intl.DateTimeFormatOptions, locale?: LocaleTag): string;
|
|
31
|
+
/**
|
|
32
|
+
* Formats a date range with the active locale, via `Intl.DateTimeFormat#formatRange` — the
|
|
33
|
+
* locale decides the separator and drops the parts the two ends share (`Mar 6 – Apr 3, 2026`,
|
|
34
|
+
* `2026. 3. 6. ~ 4. 3.`). Accepts Date objects or ISO `YYYY-MM-DD` strings (local time).
|
|
35
|
+
*
|
|
36
|
+
* Like {@link formatDate}, an end that can't be resolved to a real date degrades instead of
|
|
37
|
+
* throwing: both invalid → the two raw values joined with ` – `; one invalid → that raw value
|
|
38
|
+
* stands in for its formatted side.
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatDateRange(start: Date | string, end: Date | string, options?: Intl.DateTimeFormatOptions, locale?: LocaleTag): string;
|
|
41
|
+
/**
|
|
42
|
+
* Reads a number the way a person types it, in any locale — the inverse of {@link formatNumber}.
|
|
43
|
+
* Returns `null` for text that is not a number; never a partial number (`"1,5x"` is `null`, not 1.5).
|
|
44
|
+
*
|
|
45
|
+
* Which separator is the decimal one:
|
|
46
|
+
* - `.` and `,` both present → the **last** one is decimal, the other groups (`1.234,5` and
|
|
47
|
+
* `1,234.5` are both 1234.5).
|
|
48
|
+
* - one separator, repeated → it groups (`1.234.567` → 1234567).
|
|
49
|
+
* - a single `.` → decimal (`0.125` stays 0.125 on a comma-decimal page — people type dots).
|
|
50
|
+
* - a single `,` → decimal, except when the locale writes decimals with `.` and exactly three
|
|
51
|
+
* digits follow (`1,234` on an English page → 1234).
|
|
52
|
+
*
|
|
53
|
+
* Grouping (by either separator, spaces or apostrophes) must come in threes after a first group of
|
|
54
|
+
* one to three digits — `1,23,4` is `null`. A leading `+`, `-` or `−` sets the sign. Exponents are
|
|
55
|
+
* not read. `locale` defaults to the active `Locale`.
|
|
56
|
+
*/
|
|
57
|
+
export declare function parseNumber(text: string, locale?: LocaleTag): number | null;
|
package/dist/utilities/format.js
CHANGED
|
@@ -62,5 +62,75 @@ function formatDate(value, options, locale) {
|
|
|
62
62
|
if (Number.isNaN(date.getTime())) return String(value);
|
|
63
63
|
return new Intl.DateTimeFormat(locale ?? Locale.get(), options).format(date);
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Formats a date range with the active locale, via `Intl.DateTimeFormat#formatRange` — the
|
|
67
|
+
* locale decides the separator and drops the parts the two ends share (`Mar 6 – Apr 3, 2026`,
|
|
68
|
+
* `2026. 3. 6. ~ 4. 3.`). Accepts Date objects or ISO `YYYY-MM-DD` strings (local time).
|
|
69
|
+
*
|
|
70
|
+
* Like {@link formatDate}, an end that can't be resolved to a real date degrades instead of
|
|
71
|
+
* throwing: both invalid → the two raw values joined with ` – `; one invalid → that raw value
|
|
72
|
+
* stands in for its formatted side.
|
|
73
|
+
*/
|
|
74
|
+
function formatDateRange(start, end, options, locale) {
|
|
75
|
+
const a = resolve(start);
|
|
76
|
+
const b = resolve(end);
|
|
77
|
+
const okA = !Number.isNaN(a.getTime());
|
|
78
|
+
const okB = !Number.isNaN(b.getTime());
|
|
79
|
+
const formatter = new Intl.DateTimeFormat(locale ?? Locale.get(), options);
|
|
80
|
+
if (okA && okB) return a.getTime() <= b.getTime() ? formatter.formatRange(a, b) : formatter.formatRange(b, a);
|
|
81
|
+
return `${okA ? formatter.format(a) : String(start)} – ${okB ? formatter.format(b) : String(end)}`;
|
|
82
|
+
}
|
|
83
|
+
/** The decimal separator `Intl.NumberFormat` writes for `locale` (`.` or `,` in practice). */
|
|
84
|
+
function decimalSeparatorOf(locale) {
|
|
85
|
+
return new Intl.NumberFormat(locale).formatToParts(1.1).find((p) => p.type === "decimal")?.value ?? ".";
|
|
86
|
+
}
|
|
87
|
+
/** Space-like characters and apostrophes that locales use to group digits (fr/ru NBSP, de-CH ’). */
|
|
88
|
+
var GROUP_MARKS = /[\s\u00A0\u202F\u2009'\u2019]/;
|
|
89
|
+
/**
|
|
90
|
+
* Reads a number the way a person types it, in any locale — the inverse of {@link formatNumber}.
|
|
91
|
+
* Returns `null` for text that is not a number; never a partial number (`"1,5x"` is `null`, not 1.5).
|
|
92
|
+
*
|
|
93
|
+
* Which separator is the decimal one:
|
|
94
|
+
* - `.` and `,` both present → the **last** one is decimal, the other groups (`1.234,5` and
|
|
95
|
+
* `1,234.5` are both 1234.5).
|
|
96
|
+
* - one separator, repeated → it groups (`1.234.567` → 1234567).
|
|
97
|
+
* - a single `.` → decimal (`0.125` stays 0.125 on a comma-decimal page — people type dots).
|
|
98
|
+
* - a single `,` → decimal, except when the locale writes decimals with `.` and exactly three
|
|
99
|
+
* digits follow (`1,234` on an English page → 1234).
|
|
100
|
+
*
|
|
101
|
+
* Grouping (by either separator, spaces or apostrophes) must come in threes after a first group of
|
|
102
|
+
* one to three digits — `1,23,4` is `null`. A leading `+`, `-` or `−` sets the sign. Exponents are
|
|
103
|
+
* not read. `locale` defaults to the active `Locale`.
|
|
104
|
+
*/
|
|
105
|
+
function parseNumber(text, locale) {
|
|
106
|
+
const signed = text.trim().match(/^([+\-\u2212]?)(.*)$/s);
|
|
107
|
+
const negative = signed[1] === "-" || signed[1] === "−";
|
|
108
|
+
const body = signed[2];
|
|
109
|
+
if (!body || !/^[\d.,\s\u00A0\u202F\u2009'\u2019]+$/.test(body) || !/\d/.test(body)) return null;
|
|
110
|
+
if (GROUP_MARKS.test(body[0]) || GROUP_MARKS.test(body[body.length - 1])) return null;
|
|
111
|
+
const dots = body.split(".").length - 1;
|
|
112
|
+
const commas = body.split(",").length - 1;
|
|
113
|
+
let decimal;
|
|
114
|
+
if (dots && commas) {
|
|
115
|
+
decimal = body.lastIndexOf(".") > body.lastIndexOf(",") ? "." : ",";
|
|
116
|
+
if ((decimal === "." ? dots : commas) > 1) return null;
|
|
117
|
+
} else if (dots === 1) decimal = ".";
|
|
118
|
+
else if (commas === 1) {
|
|
119
|
+
const after = body.slice(body.indexOf(",") + 1);
|
|
120
|
+
decimal = decimalSeparatorOf(locale ?? Locale.get()) === "." && /^\d{3}$/.test(after) && /\d/.test(body.slice(0, body.indexOf(","))) ? void 0 : ",";
|
|
121
|
+
}
|
|
122
|
+
const cut = decimal ? body.lastIndexOf(decimal) : body.length;
|
|
123
|
+
const intPart = body.slice(0, cut);
|
|
124
|
+
const fracPart = decimal ? body.slice(cut + 1) : "";
|
|
125
|
+
if (!/^\d*$/.test(fracPart)) return null;
|
|
126
|
+
const groups = intPart.split(/[.,\s\u00A0\u202F\u2009'\u2019]/);
|
|
127
|
+
if (groups.length > 1) {
|
|
128
|
+
if (!/^\d{1,3}$/.test(groups[0]) || groups.slice(1).some((g) => !/^\d{3}$/.test(g))) return null;
|
|
129
|
+
} else if (!/^\d*$/.test(intPart)) return null;
|
|
130
|
+
const digits = groups.join("");
|
|
131
|
+
if (!digits && !fracPart) return null;
|
|
132
|
+
const value = Number(`${negative ? "-" : ""}${digits || "0"}.${fracPart || "0"}`);
|
|
133
|
+
return Number.isFinite(value) ? value : null;
|
|
134
|
+
}
|
|
65
135
|
//#endregion
|
|
66
|
-
export { formatCurrency, formatDate, formatNumber };
|
|
136
|
+
export { formatCurrency, formatDate, formatDateRange, formatNumber, parseNumber };
|
package/dist/utilities/icons.js
CHANGED
|
@@ -15,6 +15,8 @@ import info_circle_fill_svg_default from "../_virtual/_glob-assets_raw/info-circ
|
|
|
15
15
|
import layout_sidebar_svg_default from "../_virtual/_glob-assets_raw/layout-sidebar.svg.3fe5a68f.js";
|
|
16
16
|
import menu_2_svg_default from "../_virtual/_glob-assets_raw/menu-2.svg.d6c83cc4.js";
|
|
17
17
|
import minus_svg_default from "../_virtual/_glob-assets_raw/minus.svg.4610de75.js";
|
|
18
|
+
import player_pause_fill_svg_default from "../_virtual/_glob-assets_raw/player-pause-fill.svg.a756c400.js";
|
|
19
|
+
import player_play_fill_svg_default from "../_virtual/_glob-assets_raw/player-play-fill.svg.768b6efc.js";
|
|
18
20
|
import plus_svg_default from "../_virtual/_glob-assets_raw/plus.svg.d83ead68.js";
|
|
19
21
|
import search_svg_default from "../_virtual/_glob-assets_raw/search.svg.0ba2012d.js";
|
|
20
22
|
import star_fill_svg_default from "../_virtual/_glob-assets_raw/star-fill.svg.f24b5a2d.js";
|
|
@@ -58,6 +60,8 @@ var InternalIconBundle = new Map(Object.entries(/* #__PURE__ */ Object.assign({
|
|
|
58
60
|
"../assets/icons/layout-sidebar.svg": layout_sidebar_svg_default,
|
|
59
61
|
"../assets/icons/menu-2.svg": menu_2_svg_default,
|
|
60
62
|
"../assets/icons/minus.svg": minus_svg_default,
|
|
63
|
+
"../assets/icons/player-pause-fill.svg": player_pause_fill_svg_default,
|
|
64
|
+
"../assets/icons/player-play-fill.svg": player_play_fill_svg_default,
|
|
61
65
|
"../assets/icons/plus.svg": plus_svg_default,
|
|
62
66
|
"../assets/icons/search.svg": search_svg_default,
|
|
63
67
|
"../assets/icons/star-fill.svg": star_fill_svg_default,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iyulab/components",
|
|
3
3
|
"description": "web-components library based on lit-element made by iyulab",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.54.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"iyulab",
|
|
7
7
|
"components",
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"tabbable": "^6.5.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@lit/react": "
|
|
74
|
-
"react": "
|
|
73
|
+
"@lit/react": "^1.0.8",
|
|
74
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
75
75
|
"glob": ">=13.0.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependenciesMeta": {
|
|
@@ -68,6 +68,7 @@ import { UButton, UInput } from '@iyulab/components/react';
|
|
|
68
68
|
- [`u-textarea`](./references/components/textarea.md) — Multi-line text input with auto-resize and character counter
|
|
69
69
|
- [`u-select`](./references/components/select.md) — Dropdown select; single or multiple, with search
|
|
70
70
|
- [`u-date-picker`](./references/components/date-picker.md) — Single-date(-time) selection with a popover calendar
|
|
71
|
+
- [`u-date-range-picker`](./references/components/date-range-picker.md) — A period of days in one field (`start/end`), picked in a two-month calendar
|
|
71
72
|
- [`u-file-input`](./references/components/file-input.md) — File picker with a design-system trigger button and selected-file(s) display
|
|
72
73
|
- [`u-checkbox`](./references/components/checkbox.md) — Checkbox with indeterminate state support
|
|
73
74
|
- [`u-radio`](./references/components/radio.md) — Radio group built from `u-option` children
|
|
@@ -21,6 +21,11 @@ Slide carousel. Each direct child element becomes one slide.
|
|
|
21
21
|
</u-carousel>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
With `autoplay`, the carousel renders a stop/start button as the first control of its indicator
|
|
25
|
+
row (WCAG 2.2.2). Rotation pauses while the mouse is over the carousel and stops when keyboard focus
|
|
26
|
+
moves into it, until the user presses start (WAI-ARIA APG carousel pattern). Slides are
|
|
27
|
+
`aria-live="off"` while rotating and `polite` when stopped.
|
|
28
|
+
|
|
24
29
|
---
|
|
25
30
|
|
|
26
31
|
## Slots
|
|
@@ -61,3 +66,4 @@ Slide carousel. Each direct child element becomes one slide.
|
|
|
61
66
|
| `next-button` | Next navigation button |
|
|
62
67
|
| `indicator` | Pagination indicator wrapper |
|
|
63
68
|
| `dot` | Individual pagination dot |
|
|
69
|
+
| `rotation-button` | Stop/start button (only with `autoplay`, inside the indicator) |
|
|
@@ -88,4 +88,6 @@ day preserves whatever time-of-day was already set; only the "Today" button over
|
|
|
88
88
|
|
|
89
89
|
| Property | Description |
|
|
90
90
|
|----------|-------------|
|
|
91
|
+
| `--u-date-picker-display` | Host `display` (default: inline-block). Set `block` to fill the container width in forms and grid cells |
|
|
92
|
+
| `--u-date-picker-width` | Host `width` (default: auto). Set `100%` where `block` alone does not stretch the host (e.g. inside a flex container) |
|
|
91
93
|
| `--date-picker-popover-width` | Width of the calendar popover (default: 296px, independent of trigger width — a fixed-width calendar reads more naturally) |
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# u-date-range-picker
|
|
2
|
+
|
|
3
|
+
```ts
|
|
4
|
+
import '@iyulab/components/dist/components/date-range-picker/UDateRangePicker.js';
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
**Tag:** `u-date-range-picker`
|
|
8
|
+
|
|
9
|
+
A period of calendar days in one field — "ordered between", "valid from … to …". Use it instead of
|
|
10
|
+
two `u-date-picker`s for a start and an end: the user picks both ends in one calendar, and the
|
|
11
|
+
range can never come out reversed.
|
|
12
|
+
|
|
13
|
+
The value is an ISO 8601 time interval of two days, start first: `YYYY-MM-DD/YYYY-MM-DD`. It is one
|
|
14
|
+
string, so it works as an attribute and submits with a form as a single field. Read the halves with
|
|
15
|
+
the `start` and `end` getters. Form-associated.
|
|
16
|
+
|
|
17
|
+
The popover shows two months (on a narrow screen the second month moves below the first). The first
|
|
18
|
+
day picked is an anchor; the range previews up to the day under the pointer or keyboard focus. The
|
|
19
|
+
second day completes the range — if it comes before the anchor it becomes the start — fires
|
|
20
|
+
`change` and closes the calendar. Picking the same day twice gives a one-day range. Escape while a
|
|
21
|
+
range is half picked drops the anchor; Escape again closes the calendar. When the first day is
|
|
22
|
+
picked, an off-screen status region announces it and asks for the end date. A reversed value set from
|
|
23
|
+
code is put in order (no `change`).
|
|
24
|
+
|
|
25
|
+
> The calendar week always starts on Sunday, regardless of locale.
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<u-date-range-picker name="ordered" label="Ordered"></u-date-range-picker>
|
|
29
|
+
|
|
30
|
+
<!-- Bounded, clearable, with an initial range -->
|
|
31
|
+
<u-date-range-picker name="period" label="Period" clearable
|
|
32
|
+
min="2026-01-01" max="2026-12-31" value="2026-03-01/2026-03-31"></u-date-range-picker>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Quick ranges (presets)
|
|
36
|
+
|
|
37
|
+
`presets` lists quick ranges beside the calendar (above it on a narrow screen), in the order given.
|
|
38
|
+
Built-in names can be written as a space-separated attribute; app-defined presets are objects with
|
|
39
|
+
a `label` and a `range()` function returning the two ends (`Date`s or ISO days, either order).
|
|
40
|
+
Picking a preset sets the range at once, fires `change` and closes the calendar. A preset whose
|
|
41
|
+
range reaches outside `min`/`max` is disabled, and the one equal to the current range is marked
|
|
42
|
+
`aria-pressed="true"` (and highlighted). Relative ranges are computed each time the calendar opens,
|
|
43
|
+
so "Last 7 days" is always the last seven days.
|
|
44
|
+
|
|
45
|
+
| Name | Range (both ends inclusive) |
|
|
46
|
+
|------|-----------------------------|
|
|
47
|
+
| `today` | today |
|
|
48
|
+
| `yesterday` | yesterday |
|
|
49
|
+
| `last7Days` | the 7 days ending today |
|
|
50
|
+
| `last30Days` | the 30 days ending today |
|
|
51
|
+
| `thisWeek` | Sunday–Saturday of this week |
|
|
52
|
+
| `lastWeek` | Sunday–Saturday of last week |
|
|
53
|
+
| `thisMonth` | the whole of this month |
|
|
54
|
+
| `lastMonth` | the whole of last month |
|
|
55
|
+
| `thisYear` | January 1 – December 31 of this year |
|
|
56
|
+
|
|
57
|
+
Labels come from the built-in locale tables (14 languages). Organization-specific periods — fiscal
|
|
58
|
+
quarters, half-years — are not built in; define them as presets:
|
|
59
|
+
|
|
60
|
+
```html
|
|
61
|
+
<u-date-range-picker label="Ordered" presets="today last7Days thisMonth lastMonth"></u-date-range-picker>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
picker.presets = [
|
|
66
|
+
'thisMonth',
|
|
67
|
+
{ label: 'Q1 FY2026', range: () => ['2026-01-01', '2026-03-31'] },
|
|
68
|
+
];
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
const picker = document.querySelector('u-date-range-picker')!;
|
|
73
|
+
picker.addEventListener('change', () => {
|
|
74
|
+
const { start, end } = picker; // both undefined when cleared
|
|
75
|
+
load({ from: start, to: end });
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Properties
|
|
82
|
+
|
|
83
|
+
| Property | Type | Default | Reflect | Description |
|
|
84
|
+
|----------|------|---------|---------|-------------|
|
|
85
|
+
| `value` | `string` | — | — | The range as `YYYY-MM-DD/YYYY-MM-DD` (start first) |
|
|
86
|
+
| `start` | `string` (read-only) | — | — | First day of the range (ISO), `undefined` without a complete range |
|
|
87
|
+
| `end` | `string` (read-only) | — | — | Last day of the range (ISO), `undefined` without a complete range |
|
|
88
|
+
| `min` | `string` | — | — | Earliest selectable day (ISO `YYYY-MM-DD`), inclusive |
|
|
89
|
+
| `max` | `string` | — | — | Latest selectable day (ISO `YYYY-MM-DD`), inclusive |
|
|
90
|
+
| `clearable` | `boolean` | `false` | ✓ | Show clear button |
|
|
91
|
+
| `placeholder` | `string` | — | — | Placeholder text |
|
|
92
|
+
| `presets` | `Array<DateRangePresetName \| DateRangePreset>` | `[]` | — | Quick ranges beside the calendar; attribute form is space-separated built-in names |
|
|
93
|
+
| `disabled` | `boolean` | `false` | ✓ | Disable |
|
|
94
|
+
| `readonly` | `boolean` | `false` | ✓ | Read-only |
|
|
95
|
+
| `required` | `boolean` | `false` | ✓ | Required |
|
|
96
|
+
| `invalid` | `boolean` | `false` | ✓ | Validation failed |
|
|
97
|
+
| `name` | `string` | — | — | Form field name |
|
|
98
|
+
| `label` | `string` | — | — | Field label |
|
|
99
|
+
| `description` | `string` | — | — | Helper text |
|
|
100
|
+
| `validationMessage` | `string` | — | — | Custom validation message |
|
|
101
|
+
|
|
102
|
+
Validation: `required` with no value → `valueMissing`; a value that is not two ISO days joined by `/`
|
|
103
|
+
→ `badInput`; start before `min` → `rangeUnderflow`; end after `max` → `rangeOverflow`.
|
|
104
|
+
|
|
105
|
+
## Events
|
|
106
|
+
|
|
107
|
+
| Event | Description |
|
|
108
|
+
|-------|-------------|
|
|
109
|
+
| `change` | Fires when the user completes a range or clears it. Programmatic value assignment does not fire it. |
|
|
110
|
+
|
|
111
|
+
## Methods
|
|
112
|
+
|
|
113
|
+
| Method | Description |
|
|
114
|
+
|--------|--------------|
|
|
115
|
+
| `validate()` | Validate; sets `invalid` |
|
|
116
|
+
| `reset()` | Reset value |
|
|
117
|
+
| `focus(options?)` | Focus the trigger |
|
|
118
|
+
| `blur()` | Blur the trigger |
|
|
119
|
+
|
|
120
|
+
## CSS Parts
|
|
121
|
+
|
|
122
|
+
| Part | Description |
|
|
123
|
+
|------|-------------|
|
|
124
|
+
| `field` | The `u-field` element |
|
|
125
|
+
| `container` | The element wrapping the trigger area |
|
|
126
|
+
| `popover` | The popover element showing the calendar |
|
|
127
|
+
| `calendar` | The calendar container |
|
|
128
|
+
| `calendar-month` | One month block |
|
|
129
|
+
| `calendar-header` | A month navigation header |
|
|
130
|
+
| `calendar-title` | A "Month Year" title |
|
|
131
|
+
| `calendar-weekdays` | A weekday header row |
|
|
132
|
+
| `calendar-grid` | A date grid |
|
|
133
|
+
| `calendar-week` | One week row inside a date grid |
|
|
134
|
+
| `day` | A date cell button |
|
|
135
|
+
| `calendar-footer` | The row holding the "Clear" quick action |
|
|
136
|
+
| `presets` | The list of quick ranges beside the calendar |
|
|
137
|
+
| `preset` | One quick-range button |
|
|
138
|
+
|
|
139
|
+
The range look comes from theme tokens — `--u-primary-color` (end caps), `--u-primary-bg-color`
|
|
140
|
+
(the band between them) and `--u-primary-txt-color` — so a theme restyles it without part selectors.
|
|
141
|
+
|
|
142
|
+
## CSS Custom Properties
|
|
143
|
+
|
|
144
|
+
| Property | Description |
|
|
145
|
+
|----------|-------------|
|
|
146
|
+
| `--u-date-range-picker-display` | Host `display` (default: inline-block). Set `block` to fill the container width |
|
|
147
|
+
| `--u-date-range-picker-width` | Host `width` (default: auto). Set `100%` where `block` alone does not stretch the host |
|
|
@@ -26,10 +26,19 @@ Text input field with prefix/suffix slots and label. Add `u-option` children for
|
|
|
26
26
|
<u-input type="number" value="5000" step="1000" min="0"></u-input>
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
-
`type="number"`
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
`type="number"` reads what the user types **in the page's locale**: `1,5` on a German page and
|
|
30
|
+
`1.5` anywhere are both 1.5; `1.234,5` and `1,234.5` are both 1234.5 (rules: `parseNumber`). The
|
|
31
|
+
inner input is `type="text" inputmode="decimal"` — a native number input drops or rejects a
|
|
32
|
+
decimal comma depending on the browser (`1,5` became `15`, a valid number ten times too large).
|
|
33
|
+
`value` is always the canonical dot-decimal string — `""` when the text is not a number, which
|
|
34
|
+
then reports `badInput` — and `valueAsNumber` is the number. On blur the text is shown with the
|
|
35
|
+
locale's decimal separator; no grouping is inserted.
|
|
36
|
+
|
|
37
|
+
`min`/`max`/`step` are checked on the parsed number with native semantics: no `step` means 1, so a
|
|
38
|
+
field that takes decimals sets `step="any"` or a fractional step. The `−`/`+` icons in the suffix
|
|
39
|
+
area and ArrowUp/ArrowDown step the value, snapping to the step from `min` (or 0) and stopping at
|
|
40
|
+
`min`/`max`. A field-specific step (e.g. `step="1000"` for a KRW amount) is the consumer's call —
|
|
41
|
+
the library does not infer one from field meaning.
|
|
33
42
|
|
|
34
43
|
---
|
|
35
44
|
|
|
@@ -104,6 +113,7 @@ Call `preventDefault()` on the `keydown` to cancel it. Do not also submit on Ent
|
|
|
104
113
|
|--------|-------------|
|
|
105
114
|
| `validate()` | Validate; sets `invalid` |
|
|
106
115
|
| `reset()` | Clear value and validation state |
|
|
116
|
+
| `valueAsNumber` *(getter)* | `type="number"`: the value as a number, `NaN` when empty or not a number |
|
|
107
117
|
| `focus(options?)` | Focus the input |
|
|
108
118
|
| `blur()` | Blur the input |
|
|
109
119
|
|