@daikin-oss/design-system-web-components 1.2.0 → 1.3.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 +150 -0
- package/dist/cjs/base/dds-element.cjs +1 -1
- package/dist/cjs/components/accordion-item/daikin-accordion-item.cjs +1 -0
- package/dist/cjs/components/avatar/daikin-avatar.cjs +1 -0
- package/dist/cjs/components/calendar/daikin-calendar.cjs +2 -0
- package/dist/cjs/components/card-header/daikin-card-header.cjs +1 -1
- package/dist/cjs/components/carousel/daikin-carousel.cjs +7 -3
- package/dist/cjs/components/carousel-item/daikin-carousel-item.cjs +2 -2
- package/dist/cjs/components/chip/daikin-chip.cjs +106 -0
- package/dist/cjs/components/chip/daikin-chip.d.cts +36 -0
- package/dist/cjs/components/chip/index.cjs +7 -0
- package/dist/cjs/components/chip/index.d.cts +1 -0
- package/dist/cjs/components/combobox/daikin-combobox.cjs +604 -0
- package/dist/cjs/components/combobox/daikin-combobox.d.cts +134 -0
- package/dist/cjs/components/combobox/index.cjs +8 -0
- package/dist/cjs/components/combobox/index.d.cts +1 -0
- package/dist/cjs/components/date-picker/daikin-date-picker.cjs +31 -16
- package/dist/cjs/components/date-picker/daikin-date-picker.d.cts +2 -1
- package/dist/cjs/components/dropdown/daikin-dropdown.cjs +52 -37
- package/dist/cjs/components/dropdown/daikin-dropdown.d.cts +4 -3
- package/dist/cjs/components/icon/daikin-icon.cjs +117 -12
- package/dist/cjs/components/icon/daikin-icon.d.cts +141 -9
- package/dist/cjs/components/icon/icons.json.cjs +5 -1
- package/dist/cjs/components/icon-button/daikin-icon-button.cjs +12 -2
- package/dist/cjs/components/icon-button/daikin-icon-button.d.cts +8 -0
- package/dist/cjs/components/index.cjs +36 -0
- package/dist/cjs/components/index.d.cts +5 -0
- package/dist/cjs/components/input-group/daikin-input-group.cjs +1 -1
- package/dist/cjs/components/input-group/daikin-input-group.d.cts +40 -13
- package/dist/cjs/components/list-item/daikin-list-item.cjs +2 -2
- package/dist/cjs/components/modal-header/daikin-modal-header.cjs +1 -1
- package/dist/cjs/components/progress-bar/daikin-progress-bar.cjs +3 -3
- package/dist/cjs/components/select/daikin-select.cjs +6 -1
- package/dist/cjs/components/tab/daikin-tab.cjs +1 -0
- package/dist/cjs/components/table/daikin-table.cjs +33 -12
- package/dist/cjs/components/table/daikin-table.d.cts +67 -34
- package/dist/cjs/components/table-header-cell/daikin-table-header-cell.cjs +31 -6
- package/dist/cjs/components/table-header-cell/daikin-table-header-cell.d.cts +7 -0
- package/dist/cjs/components/text-field/daikin-text-field.cjs +191 -56
- package/dist/cjs/components/text-field/daikin-text-field.d.cts +32 -3
- package/dist/cjs/components/text-field/number-utils.cjs +61 -0
- package/dist/cjs/components/text-field/number-utils.d.cts +26 -0
- package/dist/cjs/components/text-masked-field/daikin-text-masked-field.cjs +312 -0
- package/dist/cjs/components/text-masked-field/daikin-text-masked-field.d.cts +136 -0
- package/dist/cjs/components/text-masked-field/index.cjs +7 -0
- package/dist/cjs/components/text-masked-field/index.d.cts +1 -0
- package/dist/cjs/components/time-picker/daikin-time-picker.cjs +577 -0
- package/dist/cjs/components/time-picker/daikin-time-picker.d.cts +165 -0
- package/dist/cjs/components/time-picker/index.cjs +17 -0
- package/dist/cjs/components/time-picker/index.d.cts +1 -0
- package/dist/cjs/components/toast-notification-manager/daikin-toast-notification-manager.d.cts +1 -1
- package/dist/cjs/components/tooltip/daikin-tooltip.cjs +12 -2
- package/dist/cjs/components/tooltip/daikin-tooltip.d.cts +8 -1
- package/dist/cjs/controllers/floating-ui-auto-update.cjs +22 -4
- package/dist/cjs/controllers/floating-ui-auto-update.d.cts +12 -0
- package/dist/cjs/icon-registry.cjs +170 -0
- package/dist/cjs/icon-registry.d.cts +120 -0
- package/dist/cjs/index.cjs +39 -0
- package/dist/cjs/index.d.cts +1 -0
- package/dist/cjs/tailwind.css.cjs +1 -1
- package/dist/cjs/utils/notification-common.d.cts +1 -1
- package/dist/cjs-dev/base/dds-element.cjs +1 -1
- package/dist/cjs-dev/components/accordion-item/daikin-accordion-item.cjs +1 -0
- package/dist/cjs-dev/components/avatar/daikin-avatar.cjs +1 -0
- package/dist/cjs-dev/components/calendar/daikin-calendar.cjs +2 -0
- package/dist/cjs-dev/components/card-header/daikin-card-header.cjs +1 -1
- package/dist/cjs-dev/components/carousel/daikin-carousel.cjs +7 -3
- package/dist/cjs-dev/components/carousel-item/daikin-carousel-item.cjs +2 -2
- package/dist/cjs-dev/components/chip/daikin-chip.cjs +106 -0
- package/dist/cjs-dev/components/chip/daikin-chip.d.cts +36 -0
- package/dist/cjs-dev/components/chip/index.cjs +7 -0
- package/dist/cjs-dev/components/chip/index.d.cts +1 -0
- package/dist/cjs-dev/components/combobox/daikin-combobox.cjs +604 -0
- package/dist/cjs-dev/components/combobox/daikin-combobox.d.cts +134 -0
- package/dist/cjs-dev/components/combobox/index.cjs +8 -0
- package/dist/cjs-dev/components/combobox/index.d.cts +1 -0
- package/dist/cjs-dev/components/date-picker/daikin-date-picker.cjs +31 -16
- package/dist/cjs-dev/components/date-picker/daikin-date-picker.d.cts +2 -1
- package/dist/cjs-dev/components/dropdown/daikin-dropdown.cjs +52 -37
- package/dist/cjs-dev/components/dropdown/daikin-dropdown.d.cts +4 -3
- package/dist/cjs-dev/components/icon/daikin-icon.cjs +141 -16
- package/dist/cjs-dev/components/icon/daikin-icon.d.cts +141 -9
- package/dist/cjs-dev/components/icon/icons.json.cjs +5 -1
- package/dist/cjs-dev/components/icon-button/daikin-icon-button.cjs +12 -2
- package/dist/cjs-dev/components/icon-button/daikin-icon-button.d.cts +8 -0
- package/dist/cjs-dev/components/index.cjs +36 -0
- package/dist/cjs-dev/components/index.d.cts +5 -0
- package/dist/cjs-dev/components/input-group/daikin-input-group.cjs +1 -1
- package/dist/cjs-dev/components/input-group/daikin-input-group.d.cts +40 -13
- package/dist/cjs-dev/components/list-item/daikin-list-item.cjs +2 -2
- package/dist/cjs-dev/components/modal-header/daikin-modal-header.cjs +1 -1
- package/dist/cjs-dev/components/progress-bar/daikin-progress-bar.cjs +3 -3
- package/dist/cjs-dev/components/select/daikin-select.cjs +6 -1
- package/dist/cjs-dev/components/tab/daikin-tab.cjs +1 -0
- package/dist/cjs-dev/components/table/daikin-table.cjs +36 -15
- package/dist/cjs-dev/components/table/daikin-table.d.cts +67 -34
- package/dist/cjs-dev/components/table-header-cell/daikin-table-header-cell.cjs +31 -6
- package/dist/cjs-dev/components/table-header-cell/daikin-table-header-cell.d.cts +7 -0
- package/dist/cjs-dev/components/text-field/daikin-text-field.cjs +191 -56
- package/dist/cjs-dev/components/text-field/daikin-text-field.d.cts +32 -3
- package/dist/cjs-dev/components/text-field/number-utils.cjs +64 -0
- package/dist/cjs-dev/components/text-field/number-utils.d.cts +26 -0
- package/dist/cjs-dev/components/text-masked-field/daikin-text-masked-field.cjs +312 -0
- package/dist/cjs-dev/components/text-masked-field/daikin-text-masked-field.d.cts +136 -0
- package/dist/cjs-dev/components/text-masked-field/index.cjs +7 -0
- package/dist/cjs-dev/components/text-masked-field/index.d.cts +1 -0
- package/dist/cjs-dev/components/time-picker/daikin-time-picker.cjs +589 -0
- package/dist/cjs-dev/components/time-picker/daikin-time-picker.d.cts +165 -0
- package/dist/cjs-dev/components/time-picker/index.cjs +17 -0
- package/dist/cjs-dev/components/time-picker/index.d.cts +1 -0
- package/dist/cjs-dev/components/toast-notification-manager/daikin-toast-notification-manager.d.cts +1 -1
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.cjs +12 -2
- package/dist/cjs-dev/components/tooltip/daikin-tooltip.d.cts +8 -1
- package/dist/cjs-dev/controllers/floating-ui-auto-update.cjs +22 -4
- package/dist/cjs-dev/controllers/floating-ui-auto-update.d.cts +12 -0
- package/dist/cjs-dev/icon-registry.cjs +170 -0
- package/dist/cjs-dev/icon-registry.d.cts +120 -0
- package/dist/cjs-dev/index.cjs +39 -0
- package/dist/cjs-dev/index.d.cts +1 -0
- package/dist/cjs-dev/tailwind.css.cjs +1 -1
- package/dist/cjs-dev/utils/notification-common.d.cts +1 -1
- package/dist/es/base/dds-element.js +1 -1
- package/dist/es/components/accordion-item/daikin-accordion-item.js +1 -0
- package/dist/es/components/avatar/daikin-avatar.js +1 -0
- package/dist/es/components/calendar/daikin-calendar.js +2 -0
- package/dist/es/components/card-header/daikin-card-header.js +1 -1
- package/dist/es/components/carousel/daikin-carousel.js +7 -3
- package/dist/es/components/carousel-item/daikin-carousel-item.js +2 -2
- package/dist/es/components/chip/daikin-chip.d.ts +36 -0
- package/dist/es/components/chip/daikin-chip.js +107 -0
- package/dist/es/components/chip/index.d.ts +1 -0
- package/dist/es/components/chip/index.js +4 -0
- package/dist/es/components/combobox/daikin-combobox.d.ts +134 -0
- package/dist/es/components/combobox/daikin-combobox.js +605 -0
- package/dist/es/components/combobox/index.d.ts +1 -0
- package/dist/es/components/combobox/index.js +5 -0
- package/dist/es/components/date-picker/daikin-date-picker.d.ts +2 -1
- package/dist/es/components/date-picker/daikin-date-picker.js +32 -17
- package/dist/es/components/dropdown/daikin-dropdown.d.ts +4 -3
- package/dist/es/components/dropdown/daikin-dropdown.js +52 -37
- package/dist/es/components/icon/daikin-icon.d.ts +141 -9
- package/dist/es/components/icon/daikin-icon.js +118 -13
- package/dist/es/components/icon/icons.json.js +4 -0
- package/dist/es/components/icon-button/daikin-icon-button.d.ts +8 -0
- package/dist/es/components/icon-button/daikin-icon-button.js +12 -2
- package/dist/es/components/index.d.ts +5 -0
- package/dist/es/components/index.js +22 -1
- package/dist/es/components/input-group/daikin-input-group.d.ts +40 -13
- package/dist/es/components/input-group/daikin-input-group.js +1 -1
- package/dist/es/components/list-item/daikin-list-item.js +2 -2
- package/dist/es/components/modal-header/daikin-modal-header.js +1 -1
- package/dist/es/components/progress-bar/daikin-progress-bar.js +3 -3
- package/dist/es/components/select/daikin-select.js +6 -1
- package/dist/es/components/tab/daikin-tab.js +1 -0
- package/dist/es/components/table/daikin-table.d.ts +67 -34
- package/dist/es/components/table/daikin-table.js +33 -12
- package/dist/es/components/table-header-cell/daikin-table-header-cell.d.ts +7 -0
- package/dist/es/components/table-header-cell/daikin-table-header-cell.js +31 -6
- package/dist/es/components/text-field/daikin-text-field.d.ts +32 -3
- package/dist/es/components/text-field/daikin-text-field.js +191 -56
- package/dist/es/components/text-field/number-utils.d.ts +26 -0
- package/dist/es/components/text-field/number-utils.js +61 -0
- package/dist/es/components/text-masked-field/daikin-text-masked-field.d.ts +136 -0
- package/dist/es/components/text-masked-field/daikin-text-masked-field.js +313 -0
- package/dist/es/components/text-masked-field/index.d.ts +1 -0
- package/dist/es/components/text-masked-field/index.js +4 -0
- package/dist/es/components/time-picker/daikin-time-picker.d.ts +165 -0
- package/dist/es/components/time-picker/daikin-time-picker.js +578 -0
- package/dist/es/components/time-picker/index.d.ts +1 -0
- package/dist/es/components/time-picker/index.js +14 -0
- package/dist/es/components/toast-notification-manager/daikin-toast-notification-manager.d.ts +1 -1
- package/dist/es/components/tooltip/daikin-tooltip.d.ts +8 -1
- package/dist/es/components/tooltip/daikin-tooltip.js +12 -2
- package/dist/es/controllers/floating-ui-auto-update.d.ts +12 -0
- package/dist/es/controllers/floating-ui-auto-update.js +22 -4
- package/dist/es/icon-registry.d.ts +120 -0
- package/dist/es/icon-registry.js +170 -0
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +25 -1
- package/dist/es/tailwind.css.js +1 -1
- package/dist/es/utils/notification-common.d.ts +1 -1
- package/dist/es-dev/base/dds-element.js +1 -1
- package/dist/es-dev/components/accordion-item/daikin-accordion-item.js +1 -0
- package/dist/es-dev/components/avatar/daikin-avatar.js +1 -0
- package/dist/es-dev/components/calendar/daikin-calendar.js +2 -0
- package/dist/es-dev/components/card-header/daikin-card-header.js +1 -1
- package/dist/es-dev/components/carousel/daikin-carousel.js +7 -3
- package/dist/es-dev/components/carousel-item/daikin-carousel-item.js +2 -2
- package/dist/es-dev/components/chip/daikin-chip.d.ts +36 -0
- package/dist/es-dev/components/chip/daikin-chip.js +107 -0
- package/dist/es-dev/components/chip/index.d.ts +1 -0
- package/dist/es-dev/components/chip/index.js +4 -0
- package/dist/es-dev/components/combobox/daikin-combobox.d.ts +134 -0
- package/dist/es-dev/components/combobox/daikin-combobox.js +605 -0
- package/dist/es-dev/components/combobox/index.d.ts +1 -0
- package/dist/es-dev/components/combobox/index.js +5 -0
- package/dist/es-dev/components/date-picker/daikin-date-picker.d.ts +2 -1
- package/dist/es-dev/components/date-picker/daikin-date-picker.js +32 -17
- package/dist/es-dev/components/dropdown/daikin-dropdown.d.ts +4 -3
- package/dist/es-dev/components/dropdown/daikin-dropdown.js +52 -37
- package/dist/es-dev/components/icon/daikin-icon.d.ts +141 -9
- package/dist/es-dev/components/icon/daikin-icon.js +142 -17
- package/dist/es-dev/components/icon/icons.json.js +4 -0
- package/dist/es-dev/components/icon-button/daikin-icon-button.d.ts +8 -0
- package/dist/es-dev/components/icon-button/daikin-icon-button.js +12 -2
- package/dist/es-dev/components/index.d.ts +5 -0
- package/dist/es-dev/components/index.js +22 -1
- package/dist/es-dev/components/input-group/daikin-input-group.d.ts +40 -13
- package/dist/es-dev/components/input-group/daikin-input-group.js +1 -1
- package/dist/es-dev/components/list-item/daikin-list-item.js +2 -2
- package/dist/es-dev/components/modal-header/daikin-modal-header.js +1 -1
- package/dist/es-dev/components/progress-bar/daikin-progress-bar.js +3 -3
- package/dist/es-dev/components/select/daikin-select.js +6 -1
- package/dist/es-dev/components/tab/daikin-tab.js +1 -0
- package/dist/es-dev/components/table/daikin-table.d.ts +67 -34
- package/dist/es-dev/components/table/daikin-table.js +36 -15
- package/dist/es-dev/components/table-header-cell/daikin-table-header-cell.d.ts +7 -0
- package/dist/es-dev/components/table-header-cell/daikin-table-header-cell.js +31 -6
- package/dist/es-dev/components/text-field/daikin-text-field.d.ts +32 -3
- package/dist/es-dev/components/text-field/daikin-text-field.js +191 -56
- package/dist/es-dev/components/text-field/number-utils.d.ts +26 -0
- package/dist/es-dev/components/text-field/number-utils.js +64 -0
- package/dist/es-dev/components/text-masked-field/daikin-text-masked-field.d.ts +136 -0
- package/dist/es-dev/components/text-masked-field/daikin-text-masked-field.js +313 -0
- package/dist/es-dev/components/text-masked-field/index.d.ts +1 -0
- package/dist/es-dev/components/text-masked-field/index.js +4 -0
- package/dist/es-dev/components/time-picker/daikin-time-picker.d.ts +165 -0
- package/dist/es-dev/components/time-picker/daikin-time-picker.js +590 -0
- package/dist/es-dev/components/time-picker/index.d.ts +1 -0
- package/dist/es-dev/components/time-picker/index.js +14 -0
- package/dist/es-dev/components/toast-notification-manager/daikin-toast-notification-manager.d.ts +1 -1
- package/dist/es-dev/components/tooltip/daikin-tooltip.d.ts +8 -1
- package/dist/es-dev/components/tooltip/daikin-tooltip.js +12 -2
- package/dist/es-dev/controllers/floating-ui-auto-update.d.ts +12 -0
- package/dist/es-dev/controllers/floating-ui-auto-update.js +22 -4
- package/dist/es-dev/icon-registry.d.ts +120 -0
- package/dist/es-dev/icon-registry.js +170 -0
- package/dist/es-dev/index.d.ts +1 -0
- package/dist/es-dev/index.js +25 -1
- package/dist/es-dev/tailwind.css.js +1 -1
- package/dist/es-dev/utils/notification-common.d.ts +1 -1
- package/icons/number-minus.svg +5 -0
- package/icons/number-plus.svg +5 -0
- package/package.json +14 -4
- package/icons/dropdown-chevron-down.svg +0 -3
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { DDSFormElement } from "../../base/dds-form-element.cjs";
|
|
3
|
+
import { default as DaikinInputGroup } from "../input-group/daikin-input-group.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* Represents the hour and minute parts of a time value.
|
|
6
|
+
* The `hour` and `minute` values can be placeholder strings ('hh', 'mm') or numeric strings representing time values.
|
|
7
|
+
*/
|
|
8
|
+
type TimeParts = {
|
|
9
|
+
hour: string;
|
|
10
|
+
minute: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Type for time input item: hour or minute.
|
|
14
|
+
*/
|
|
15
|
+
type TimeItem = "hour" | "minute";
|
|
16
|
+
/**
|
|
17
|
+
* Converts a 12-hour time string and AM/PM to 24-hour format (e.g. "02:30", "PM" => "14:30").
|
|
18
|
+
*/
|
|
19
|
+
export declare function to24HourFormat(time: string, meridiem: "AM" | "PM"): string;
|
|
20
|
+
/**
|
|
21
|
+
* Converts a 24-hour time string to 12-hour format and AM/PM (e.g. "14:30" => { time: "02:30", meridiem: "PM" }).
|
|
22
|
+
*/
|
|
23
|
+
export declare function from24HourFormat(time: string): {
|
|
24
|
+
time: string;
|
|
25
|
+
meridiem: "AM" | "PM";
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Validates if a time string matches the 24-hour format.
|
|
29
|
+
*/
|
|
30
|
+
export declare function isValidValueTime(str: string): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if a time is out of the given range.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isTimeOutOfRange(time: string, min: string, max: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Formats a time object as a UI display string (HH:MM).
|
|
37
|
+
* The hour/minute values do not have to be valid.
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatPartsForUI({ hour, minute, }: Readonly<TimeParts>): string;
|
|
40
|
+
/**
|
|
41
|
+
* Parses a UI time string (HH:MM) and returns an hour/minute object.
|
|
42
|
+
* The result is not guaranteed to be valid.
|
|
43
|
+
*/
|
|
44
|
+
export declare function parsePartsFromUIValue(value: string): TimeParts;
|
|
45
|
+
/**
|
|
46
|
+
* Attempts to parse a valid time string from a UI value (HH:MM).
|
|
47
|
+
* Returns null if invalid.
|
|
48
|
+
*/
|
|
49
|
+
export declare function tryParseTimeFromUIValue(value: string): string | null;
|
|
50
|
+
/**
|
|
51
|
+
* Formats a valid time string as a UI display string (HH:MM).
|
|
52
|
+
*/
|
|
53
|
+
export declare function formatTimeForUI(timeString: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Determines whether the current selection is on the hour or minute part.
|
|
56
|
+
* Returns null if no match.
|
|
57
|
+
*/
|
|
58
|
+
export declare function getTimeItemInSelection(selectionStart: number, selectionEnd: number): TimeItem | null;
|
|
59
|
+
/**
|
|
60
|
+
* Calculate digit key input, returns new time parts and whether input is complete.
|
|
61
|
+
* @returns { parts, done } or null
|
|
62
|
+
*/
|
|
63
|
+
export declare function calcDigitInput(parts: Readonly<TimeParts>, item: TimeItem, digit: string, hourDigitIndex: number): {
|
|
64
|
+
parts: TimeParts;
|
|
65
|
+
done: boolean;
|
|
66
|
+
} | null;
|
|
67
|
+
/**
|
|
68
|
+
* The time picker provides a time input field and a dropdown button for selecting AM/PM, allowing users to quickly enter a specific time in 12-hour format.
|
|
69
|
+
* Please note that while the value displayed on the UI is in 12-hour format, the value you get from the component's value property will be automatically converted to 24-hour format.
|
|
70
|
+
*
|
|
71
|
+
* @fires change - A custom event emitted when the value of component changed. Validation errors will not trigger this event.
|
|
72
|
+
* @fires input - A retargeted event of a [input event](https://developer.mozilla.org/en-US/docs/Web/API/Element/input_event). Triggered when user type value to input area and change the value of component. change dropdown or validation errors will not trigger this event.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
*
|
|
76
|
+
* ```js
|
|
77
|
+
* import "@daikin-oss/design-system-web-components/components/time-picker/index.js";
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* ```html
|
|
81
|
+
* <daikin-time-picker></daikin-time-picker>
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare class DaikinTimePicker extends DDSFormElement {
|
|
85
|
+
static readonly styles: import('lit').CSSResult;
|
|
86
|
+
/**
|
|
87
|
+
* Placeholder text.
|
|
88
|
+
*/
|
|
89
|
+
placeholder: string | null;
|
|
90
|
+
/**
|
|
91
|
+
* Minimum time (00:00 - 23:59). If the user's input value is less than this value, the component will display an error state.
|
|
92
|
+
* Please note that while the UI displays time in a 12-hour format (AM/PM), the component's value is stored in a 24-hour format. The `min` property must also be provided in 24-hour format.
|
|
93
|
+
*/
|
|
94
|
+
min: string;
|
|
95
|
+
/**
|
|
96
|
+
* Maximum time (00:00 - 23:59). If the user's input value is more than this value, the component will display an error state.
|
|
97
|
+
* Please note that while the UI displays time in a 12-hour format (AM/PM), the component's value is stored in a 24-hour format. The `max` property must also be provided in 24-hour format.
|
|
98
|
+
*/
|
|
99
|
+
max: string;
|
|
100
|
+
/**
|
|
101
|
+
* Whether the field is disabled. Controlled by daikin-input-group.
|
|
102
|
+
*/
|
|
103
|
+
disabled: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* Whether the field is required. Controlled by daikin-input-group.
|
|
106
|
+
*/
|
|
107
|
+
required: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Whether to show error state. Controlled by daikin-input-group. Ignored if disabled.
|
|
110
|
+
*/
|
|
111
|
+
error: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Minutes step. Specify the step size for the minutes when using the up and down arrow keys.
|
|
114
|
+
*/
|
|
115
|
+
minutesStep: string;
|
|
116
|
+
private _label;
|
|
117
|
+
private _inputValue;
|
|
118
|
+
private _currentSelection;
|
|
119
|
+
private _meridiem;
|
|
120
|
+
private _timeInputElement;
|
|
121
|
+
/**
|
|
122
|
+
* Tracks the current digit index for hour input (0: first digit, 1: second digit).
|
|
123
|
+
*/
|
|
124
|
+
private _hourDigitIndex;
|
|
125
|
+
/**
|
|
126
|
+
* Returns the value to display in the input field (from _inputValue state).
|
|
127
|
+
*/
|
|
128
|
+
private get _timeValue();
|
|
129
|
+
/**
|
|
130
|
+
* Syncs the AM/PM value with the current value (24-hour) if value changes externally.
|
|
131
|
+
*/
|
|
132
|
+
private _syncMeridiemWithValue;
|
|
133
|
+
private get _min();
|
|
134
|
+
private get _max();
|
|
135
|
+
private _convertZeroHourToTwelve;
|
|
136
|
+
private _handleFocusIn;
|
|
137
|
+
private _handleFocusOut;
|
|
138
|
+
private _handleChange;
|
|
139
|
+
private _handleMouseUp;
|
|
140
|
+
private _handleDigitInput;
|
|
141
|
+
private _handleKeyDown;
|
|
142
|
+
private _updateTimeByOffset;
|
|
143
|
+
private _handleBeforeInput;
|
|
144
|
+
/**
|
|
145
|
+
* Updates the value in 24-hour format if the input is valid, keeps UI in 12-hour format.
|
|
146
|
+
*/
|
|
147
|
+
private _updateValue;
|
|
148
|
+
private _updateInputSelection;
|
|
149
|
+
private _updateSelection;
|
|
150
|
+
private _handleDropdownChange;
|
|
151
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
152
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
153
|
+
protected updated(changedProperties: PropertyValues<this>): void;
|
|
154
|
+
/**
|
|
155
|
+
* This method is used by `daikin-input-group` to reflect it's attributes to this component.
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
reflectInputGroup(inputGroup: DaikinInputGroup): void;
|
|
159
|
+
}
|
|
160
|
+
declare global {
|
|
161
|
+
interface HTMLElementTagNameMap {
|
|
162
|
+
"daikin-time-picker": DaikinTimePicker;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const daikinTimePicker = require("./daikin-time-picker.cjs");
|
|
4
|
+
Object.defineProperty(exports, "DaikinTimePicker", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: () => daikinTimePicker.DaikinTimePicker
|
|
7
|
+
});
|
|
8
|
+
exports.calcDigitInput = daikinTimePicker.calcDigitInput;
|
|
9
|
+
exports.formatPartsForUI = daikinTimePicker.formatPartsForUI;
|
|
10
|
+
exports.formatTimeForUI = daikinTimePicker.formatTimeForUI;
|
|
11
|
+
exports.from24HourFormat = daikinTimePicker.from24HourFormat;
|
|
12
|
+
exports.getTimeItemInSelection = daikinTimePicker.getTimeItemInSelection;
|
|
13
|
+
exports.isTimeOutOfRange = daikinTimePicker.isTimeOutOfRange;
|
|
14
|
+
exports.isValidValueTime = daikinTimePicker.isValidValueTime;
|
|
15
|
+
exports.parsePartsFromUIValue = daikinTimePicker.parsePartsFromUIValue;
|
|
16
|
+
exports.to24HourFormat = daikinTimePicker.to24HourFormat;
|
|
17
|
+
exports.tryParseTimeFromUIValue = daikinTimePicker.tryParseTimeFromUIValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./daikin-time-picker.cjs";
|
package/dist/cjs/components/toast-notification-manager/daikin-toast-notification-manager.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DDSElement } from "../../base/index.cjs";
|
|
2
2
|
import { MergeVariantProps } from "../../type-utils.cjs";
|
|
3
3
|
declare const cvaContainer: (props?: ({
|
|
4
|
-
position?: "
|
|
4
|
+
position?: "bottom" | "top" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | null | undefined;
|
|
5
5
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
6
|
export type ToastPosition = MergeVariantProps<typeof cvaContainer>["position"];
|
|
7
7
|
/**
|
|
@@ -63,6 +63,7 @@ exports.DaikinTooltip = class DaikinTooltip extends ddsElement.DDSElement {
|
|
|
63
63
|
this.description = "";
|
|
64
64
|
this.popoverValue = "auto";
|
|
65
65
|
this.trigger = "hover";
|
|
66
|
+
this._willBeFocusedByPress = false;
|
|
66
67
|
this._autoUpdateController = new floatingUiAutoUpdate.FloatingUIAutoUpdateController(this);
|
|
67
68
|
this._hostStyles = isClient.isClient ? window.getComputedStyle(this) : null;
|
|
68
69
|
}
|
|
@@ -84,10 +85,14 @@ exports.DaikinTooltip = class DaikinTooltip extends ddsElement.DDSElement {
|
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
_handleFocusIn() {
|
|
87
|
-
this.
|
|
88
|
+
if (this.trigger !== "manual" && !this._willBeFocusedByPress) {
|
|
89
|
+
this.open = true;
|
|
90
|
+
}
|
|
88
91
|
}
|
|
89
92
|
_handleFocusOut() {
|
|
90
|
-
this.
|
|
93
|
+
if (this.trigger !== "manual") {
|
|
94
|
+
this.open = false;
|
|
95
|
+
}
|
|
91
96
|
}
|
|
92
97
|
_handlePointerEnter(event) {
|
|
93
98
|
if (this.trigger === "hover" && event.pointerType === "mouse") {
|
|
@@ -99,7 +104,11 @@ exports.DaikinTooltip = class DaikinTooltip extends ddsElement.DDSElement {
|
|
|
99
104
|
this.open = false;
|
|
100
105
|
}
|
|
101
106
|
}
|
|
107
|
+
_handlePointerDown() {
|
|
108
|
+
this._willBeFocusedByPress = this.trigger === "click" && !this.matches(":focus-within");
|
|
109
|
+
}
|
|
102
110
|
_handlePointerUp(event) {
|
|
111
|
+
this._willBeFocusedByPress = false;
|
|
103
112
|
if (this.trigger === "hover" && event.pointerType === "touch") {
|
|
104
113
|
this.open = !this.open;
|
|
105
114
|
}
|
|
@@ -133,6 +142,7 @@ exports.DaikinTooltip = class DaikinTooltip extends ddsElement.DDSElement {
|
|
|
133
142
|
@focusout=${this._handleFocusOut}
|
|
134
143
|
@pointerenter=${this._handlePointerEnter}
|
|
135
144
|
@pointerleave=${this._handlePointerLeave}
|
|
145
|
+
@pointerdown=${this._handlePointerDown}
|
|
136
146
|
@pointerup=${this._handlePointerUp}
|
|
137
147
|
></slot>
|
|
138
148
|
</div>
|
|
@@ -12,7 +12,7 @@ type TooltipVariantProps = MergeVariantProps<typeof cvaTooltip>;
|
|
|
12
12
|
* @fires toggle - A event emitted when the tooltip is opened or closed.
|
|
13
13
|
*
|
|
14
14
|
* @slot - A slot for the element to which the tooltip is attached (the trigger element).
|
|
15
|
-
* @slot description - A slot for the tooltip description content.
|
|
15
|
+
* @slot description - A slot for the tooltip description content. Tooltips don't have a prescribed maximum or minimum width. If you plan to use longer text, please note that you'll need to manually implement line breaks.
|
|
16
16
|
*
|
|
17
17
|
* @cssprop [--ddc-tooltip-spacing=20px] - Spacing between the tooltip and the trigger.
|
|
18
18
|
*
|
|
@@ -55,6 +55,7 @@ export declare class DaikinTooltip extends DDSElement {
|
|
|
55
55
|
/**
|
|
56
56
|
* Specifies the content of the tooltip.
|
|
57
57
|
* Ignored if the `tooltip` slot exists.
|
|
58
|
+
* Tooltips don't have a prescribed maximum or minimum width. If you plan to use longer text, please note that you'll need to manually implement line breaks.
|
|
58
59
|
*/
|
|
59
60
|
description: string;
|
|
60
61
|
/**
|
|
@@ -70,6 +71,11 @@ export declare class DaikinTooltip extends DDSElement {
|
|
|
70
71
|
* - `manual`: The tooltip does not respond to user interaction. Use this to control the tooltip programmatically.
|
|
71
72
|
*/
|
|
72
73
|
trigger: "hover" | "click" | "manual";
|
|
74
|
+
/**
|
|
75
|
+
* Internal state to track whether the element will be focused by a press interaction.
|
|
76
|
+
* In this case, the tooltip will not be open via focus to prevent it from disappearing immediately afterward.
|
|
77
|
+
*/
|
|
78
|
+
private _willBeFocusedByPress;
|
|
73
79
|
private _autoUpdateController;
|
|
74
80
|
private _hostStyles;
|
|
75
81
|
private _handleClick;
|
|
@@ -77,6 +83,7 @@ export declare class DaikinTooltip extends DDSElement {
|
|
|
77
83
|
private _handleFocusOut;
|
|
78
84
|
private _handlePointerEnter;
|
|
79
85
|
private _handlePointerLeave;
|
|
86
|
+
private _handlePointerDown;
|
|
80
87
|
private _handlePointerUp;
|
|
81
88
|
private _handleBeforeToggle;
|
|
82
89
|
private _handleToggle;
|
|
@@ -5,7 +5,7 @@ const lit = require("lit");
|
|
|
5
5
|
const ref_js = require("lit/directives/ref.js");
|
|
6
6
|
const controllerDirective = require("./helpers/controller-directive.cjs");
|
|
7
7
|
const floatingUIAutoUpdateDirective = controllerDirective.createControllerDirective(
|
|
8
|
-
(referenceElement, floatingElement, options) => {
|
|
8
|
+
(referenceElement, floatingElement, options, _isOptionsUpdated, triggerContext) => {
|
|
9
9
|
const cleanupAutoUpdate = dom.autoUpdate(
|
|
10
10
|
referenceElement,
|
|
11
11
|
floatingElement,
|
|
@@ -18,7 +18,10 @@ const floatingUIAutoUpdateDirective = controllerDirective.createControllerDirect
|
|
|
18
18
|
floatingElement.style.setProperty("--floating-y", `${y}px`);
|
|
19
19
|
floatingElement.setAttribute("data-floating-ready", "");
|
|
20
20
|
if (isFirst) {
|
|
21
|
-
|
|
21
|
+
const event = new CustomEvent("floating-ready", {
|
|
22
|
+
detail: triggerContext
|
|
23
|
+
});
|
|
24
|
+
floatingElement.dispatchEvent(event);
|
|
22
25
|
}
|
|
23
26
|
}).catch((error) => {
|
|
24
27
|
});
|
|
@@ -36,7 +39,8 @@ const floatingUIAutoUpdateDirective = controllerDirective.createControllerDirect
|
|
|
36
39
|
current[0] !== previous[0] || // Check if the floating element is changed
|
|
37
40
|
current[1] !== previous[1] || // Check if the options is changed.
|
|
38
41
|
// If option comparison function (current[3]) is provided, use it to compare options. Otherwise, use `!==` to compare options.
|
|
39
|
-
(((_a = current[3]) == null ? void 0 : _a.call(current, current[2], previous[2])) ?? current[2] !== previous[2])
|
|
42
|
+
(((_a = current[3]) == null ? void 0 : _a.call(current, current[2], previous[2])) ?? current[2] !== previous[2]) || // Check if the trigger context is changed
|
|
43
|
+
current[4] !== previous[4]
|
|
40
44
|
);
|
|
41
45
|
}
|
|
42
46
|
);
|
|
@@ -44,6 +48,7 @@ class FloatingUIAutoUpdateController {
|
|
|
44
48
|
constructor(_host, _isOptionsUpdated) {
|
|
45
49
|
this._host = _host;
|
|
46
50
|
this._isOptionsUpdated = _isOptionsUpdated;
|
|
51
|
+
this._triggerContext = {};
|
|
47
52
|
this._refCallbackFloating = (element) => {
|
|
48
53
|
this._floatingElement = element;
|
|
49
54
|
this._host.requestUpdate();
|
|
@@ -54,6 +59,18 @@ class FloatingUIAutoUpdateController {
|
|
|
54
59
|
};
|
|
55
60
|
_host.addController(this);
|
|
56
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Set context information that will be included in the floating-ready event
|
|
64
|
+
*/
|
|
65
|
+
setTriggerContext(context) {
|
|
66
|
+
this._triggerContext = { ...context };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Clear the trigger context
|
|
70
|
+
*/
|
|
71
|
+
clearTriggerContext() {
|
|
72
|
+
this._triggerContext = {};
|
|
73
|
+
}
|
|
57
74
|
get floatingElement() {
|
|
58
75
|
return this._floatingElement;
|
|
59
76
|
}
|
|
@@ -74,7 +91,8 @@ class FloatingUIAutoUpdateController {
|
|
|
74
91
|
this._referenceElement,
|
|
75
92
|
this._floatingElement,
|
|
76
93
|
options,
|
|
77
|
-
this._isOptionsUpdated
|
|
94
|
+
this._isOptionsUpdated,
|
|
95
|
+
this._triggerContext
|
|
78
96
|
);
|
|
79
97
|
}
|
|
80
98
|
}
|
|
@@ -13,7 +13,19 @@ export declare class FloatingUIAutoUpdateController<T extends ReactiveController
|
|
|
13
13
|
private readonly _isOptionsUpdated?;
|
|
14
14
|
private _floatingElement;
|
|
15
15
|
private _referenceElement;
|
|
16
|
+
/**
|
|
17
|
+
* Context information to be passed with floating-ready event
|
|
18
|
+
*/
|
|
19
|
+
private _triggerContext;
|
|
16
20
|
constructor(_host: T, _isOptionsUpdated?: ((current: Partial<ComputePositionConfig>, previous: Partial<ComputePositionConfig>) => boolean) | undefined);
|
|
21
|
+
/**
|
|
22
|
+
* Set context information that will be included in the floating-ready event
|
|
23
|
+
*/
|
|
24
|
+
setTriggerContext(context: Record<string, unknown>): void;
|
|
25
|
+
/**
|
|
26
|
+
* Clear the trigger context
|
|
27
|
+
*/
|
|
28
|
+
clearTriggerContext(): void;
|
|
17
29
|
private readonly _refCallbackFloating;
|
|
18
30
|
private readonly _refCallbackReference;
|
|
19
31
|
get floatingElement(): HTMLElement | undefined;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
5
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
6
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
7
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
8
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
9
|
+
var _instance, _icons, _dynamicRegistrations, _cache;
|
|
10
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
11
|
+
function isDynamicRegistration(registration) {
|
|
12
|
+
return "match" in registration && "fetch" in registration;
|
|
13
|
+
}
|
|
14
|
+
function isDirectRegistration(registration) {
|
|
15
|
+
return "name" in registration && "svg" in registration;
|
|
16
|
+
}
|
|
17
|
+
function normalizeIconData(svg) {
|
|
18
|
+
if (typeof svg === "string") {
|
|
19
|
+
return { mode: "mask", svg };
|
|
20
|
+
}
|
|
21
|
+
return { mode: "mask", ...svg };
|
|
22
|
+
}
|
|
23
|
+
const _IconRegistry = class _IconRegistry {
|
|
24
|
+
constructor() {
|
|
25
|
+
/** Map of registered icons by name */
|
|
26
|
+
__privateAdd(this, _icons, /* @__PURE__ */ new Map());
|
|
27
|
+
/** Array of dynamic icon registrations */
|
|
28
|
+
__privateAdd(this, _dynamicRegistrations, []);
|
|
29
|
+
/** Cache for dynamically fetched icons */
|
|
30
|
+
__privateAdd(this, _cache, /* @__PURE__ */ new Map());
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Get the singleton instance of IconRegistry
|
|
34
|
+
*/
|
|
35
|
+
static getGlobalInstance() {
|
|
36
|
+
const instance = __privateGet(_IconRegistry, _instance) ?? __privateSet(_IconRegistry, _instance, new _IconRegistry());
|
|
37
|
+
return instance;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Register an icon or dynamic icon fetcher
|
|
41
|
+
* @param registration Icon registration configuration
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Direct registration
|
|
45
|
+
* registry.register({ name: "custom-icon", svg: "<svg>...</svg>" });
|
|
46
|
+
*
|
|
47
|
+
* // Dynamic registration
|
|
48
|
+
* registry.register({
|
|
49
|
+
* match: /^custom-/,
|
|
50
|
+
* fetch: async (name) => {
|
|
51
|
+
* const response = await fetch(`/icons/${name}.svg`);
|
|
52
|
+
* return response.text();
|
|
53
|
+
* }
|
|
54
|
+
* });
|
|
55
|
+
*/
|
|
56
|
+
register(registration) {
|
|
57
|
+
if (isDirectRegistration(registration)) {
|
|
58
|
+
const iconData = normalizeIconData(registration.svg);
|
|
59
|
+
__privateGet(this, _icons).set(registration.name, iconData);
|
|
60
|
+
} else if (isDynamicRegistration(registration)) {
|
|
61
|
+
__privateGet(this, _dynamicRegistrations).push(registration);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get an icon by name
|
|
66
|
+
* @param name Icon name
|
|
67
|
+
* @returns Promise that resolves to IconData or null if not found
|
|
68
|
+
*/
|
|
69
|
+
async getIcon(name) {
|
|
70
|
+
const registered = __privateGet(this, _icons).get(name);
|
|
71
|
+
if (registered) {
|
|
72
|
+
return registered;
|
|
73
|
+
}
|
|
74
|
+
for (const registration of __privateGet(this, _dynamicRegistrations)) {
|
|
75
|
+
if (registration.match.test(name)) {
|
|
76
|
+
return this.fetchDynamicIcon(registration, name);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Check if an icon is registered (either directly or through dynamic registration)
|
|
83
|
+
* @param name Icon name
|
|
84
|
+
* @returns true if icon is available
|
|
85
|
+
*/
|
|
86
|
+
hasIcon(name) {
|
|
87
|
+
if (__privateGet(this, _icons).has(name)) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
return __privateGet(this, _dynamicRegistrations).some(
|
|
91
|
+
(registration) => registration.match.test(name)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Get all directly registered icon names
|
|
96
|
+
* @returns Array of icon names
|
|
97
|
+
*/
|
|
98
|
+
getRegisteredIconNames() {
|
|
99
|
+
return Array.from(__privateGet(this, _icons).keys());
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get all dynamic registration patterns
|
|
103
|
+
* @returns Array of regex patterns
|
|
104
|
+
*/
|
|
105
|
+
getDynamicPatterns() {
|
|
106
|
+
return __privateGet(this, _dynamicRegistrations).map((reg) => reg.match);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Clear all registrations and cache
|
|
110
|
+
*/
|
|
111
|
+
clear() {
|
|
112
|
+
__privateGet(this, _icons).clear();
|
|
113
|
+
__privateGet(this, _dynamicRegistrations).length = 0;
|
|
114
|
+
__privateGet(this, _cache).clear();
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Remove a specific icon registration
|
|
118
|
+
* @param name Icon name to remove
|
|
119
|
+
*/
|
|
120
|
+
unregister(name) {
|
|
121
|
+
const existed = __privateGet(this, _icons).has(name);
|
|
122
|
+
__privateGet(this, _icons).delete(name);
|
|
123
|
+
return existed;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Fetch icon from dynamic registration
|
|
127
|
+
* @param registration Dynamic registration
|
|
128
|
+
* @param name Icon name
|
|
129
|
+
* @returns Promise that resolves to IconData or null
|
|
130
|
+
*/
|
|
131
|
+
async fetchDynamicIcon(registration, name) {
|
|
132
|
+
const cacheKey = `${registration.match.source}\0${name}`;
|
|
133
|
+
const cached = __privateGet(this, _cache).get(cacheKey);
|
|
134
|
+
if (cached) {
|
|
135
|
+
return cached;
|
|
136
|
+
}
|
|
137
|
+
const fetchPromise = this.performDynamicFetch(registration, name).then(
|
|
138
|
+
(result) => {
|
|
139
|
+
__privateGet(this, _cache).set(cacheKey, result);
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
__privateGet(this, _cache).set(cacheKey, fetchPromise);
|
|
144
|
+
return fetchPromise;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Perform the actual dynamic fetch
|
|
148
|
+
* @param registration Dynamic registration
|
|
149
|
+
* @param name Icon name
|
|
150
|
+
* @returns Promise that resolves to IconData or null
|
|
151
|
+
*/
|
|
152
|
+
async performDynamicFetch(registration, name) {
|
|
153
|
+
try {
|
|
154
|
+
const result = await registration.fetch(name);
|
|
155
|
+
return normalizeIconData(result);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
console.warn(`Failed to fetch dynamic icon "${name}":`, error);
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
_instance = new WeakMap();
|
|
163
|
+
_icons = new WeakMap();
|
|
164
|
+
_dynamicRegistrations = new WeakMap();
|
|
165
|
+
_cache = new WeakMap();
|
|
166
|
+
__privateAdd(_IconRegistry, _instance);
|
|
167
|
+
let IconRegistry = _IconRegistry;
|
|
168
|
+
const iconRegistry = IconRegistry.getGlobalInstance();
|
|
169
|
+
exports.IconRegistry = IconRegistry;
|
|
170
|
+
exports.iconRegistry = iconRegistry;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon data structure containing SVG information
|
|
3
|
+
*/
|
|
4
|
+
export interface IconData {
|
|
5
|
+
/** SVG content as a string */
|
|
6
|
+
svg: string;
|
|
7
|
+
/** Default color for the icon */
|
|
8
|
+
defaultColor?: string | null;
|
|
9
|
+
/**
|
|
10
|
+
* Determines how the SVG is rendered.
|
|
11
|
+
* This affects the styling and behavior of the icon.
|
|
12
|
+
*
|
|
13
|
+
* - "mask": Uses the SVG as a CSS mask, allowing for color customization. Use this for monochrome icons.
|
|
14
|
+
* - "background": Uses the SVG as a CSS background image. Use this for colorful icons with no complex styling.
|
|
15
|
+
* - "inline": Renders the SVG inline, allowing for more complex styling.
|
|
16
|
+
* **Be cautious with this mode as it can introduce security risks if the SVG content is not trusted.**
|
|
17
|
+
*
|
|
18
|
+
* @default "mask"
|
|
19
|
+
*/
|
|
20
|
+
mode?: "mask" | "background" | "inline";
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Direct icon registration configuration
|
|
24
|
+
*/
|
|
25
|
+
export interface DirectIconRegistration {
|
|
26
|
+
/** Icon name */
|
|
27
|
+
name: string;
|
|
28
|
+
/** SVG content or icon data */
|
|
29
|
+
svg: string | IconData;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Dynamic icon registration configuration using regex pattern matching
|
|
33
|
+
*/
|
|
34
|
+
export interface DynamicIconRegistration {
|
|
35
|
+
/** Regular expression to match icon names */
|
|
36
|
+
match: RegExp;
|
|
37
|
+
/** Function to fetch SVG content for matched names */
|
|
38
|
+
fetch: (name: string) => Promise<string | IconData> | string | IconData;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Icon registration configuration
|
|
42
|
+
*/
|
|
43
|
+
export type IconRegistration = DirectIconRegistration | DynamicIconRegistration;
|
|
44
|
+
/**
|
|
45
|
+
* Icon registry class that manages icon registration and retrieval
|
|
46
|
+
*/
|
|
47
|
+
export declare class IconRegistry {
|
|
48
|
+
#private;
|
|
49
|
+
/**
|
|
50
|
+
* Get the singleton instance of IconRegistry
|
|
51
|
+
*/
|
|
52
|
+
static getGlobalInstance(): IconRegistry;
|
|
53
|
+
/**
|
|
54
|
+
* Register an icon or dynamic icon fetcher
|
|
55
|
+
* @param registration Icon registration configuration
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* // Direct registration
|
|
59
|
+
* registry.register({ name: "custom-icon", svg: "<svg>...</svg>" });
|
|
60
|
+
*
|
|
61
|
+
* // Dynamic registration
|
|
62
|
+
* registry.register({
|
|
63
|
+
* match: /^custom-/,
|
|
64
|
+
* fetch: async (name) => {
|
|
65
|
+
* const response = await fetch(`/icons/${name}.svg`);
|
|
66
|
+
* return response.text();
|
|
67
|
+
* }
|
|
68
|
+
* });
|
|
69
|
+
*/
|
|
70
|
+
register(registration: IconRegistration): void;
|
|
71
|
+
/**
|
|
72
|
+
* Get an icon by name
|
|
73
|
+
* @param name Icon name
|
|
74
|
+
* @returns Promise that resolves to IconData or null if not found
|
|
75
|
+
*/
|
|
76
|
+
getIcon(name: string): Promise<IconData | null>;
|
|
77
|
+
/**
|
|
78
|
+
* Check if an icon is registered (either directly or through dynamic registration)
|
|
79
|
+
* @param name Icon name
|
|
80
|
+
* @returns true if icon is available
|
|
81
|
+
*/
|
|
82
|
+
hasIcon(name: string): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Get all directly registered icon names
|
|
85
|
+
* @returns Array of icon names
|
|
86
|
+
*/
|
|
87
|
+
getRegisteredIconNames(): string[];
|
|
88
|
+
/**
|
|
89
|
+
* Get all dynamic registration patterns
|
|
90
|
+
* @returns Array of regex patterns
|
|
91
|
+
*/
|
|
92
|
+
getDynamicPatterns(): RegExp[];
|
|
93
|
+
/**
|
|
94
|
+
* Clear all registrations and cache
|
|
95
|
+
*/
|
|
96
|
+
clear(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Remove a specific icon registration
|
|
99
|
+
* @param name Icon name to remove
|
|
100
|
+
*/
|
|
101
|
+
unregister(name: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Fetch icon from dynamic registration
|
|
104
|
+
* @param registration Dynamic registration
|
|
105
|
+
* @param name Icon name
|
|
106
|
+
* @returns Promise that resolves to IconData or null
|
|
107
|
+
*/
|
|
108
|
+
private fetchDynamicIcon;
|
|
109
|
+
/**
|
|
110
|
+
* Perform the actual dynamic fetch
|
|
111
|
+
* @param registration Dynamic registration
|
|
112
|
+
* @param name Icon name
|
|
113
|
+
* @returns Promise that resolves to IconData or null
|
|
114
|
+
*/
|
|
115
|
+
private performDynamicFetch;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Global icon registry instance
|
|
119
|
+
*/
|
|
120
|
+
export declare const iconRegistry: IconRegistry;
|