@daikin-oss/design-system-web-components 1.2.0 → 1.3.0-next.2
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 +85 -49
- 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 +129 -9
- package/dist/cjs/components/icon/icons.json.cjs +6 -2
- package/dist/cjs/components/icon/icons.json.d.cts +0 -12
- 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 +2 -2
- 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 +129 -9
- package/dist/cjs-dev/components/icon/icons.json.cjs +6 -2
- package/dist/cjs-dev/components/icon/icons.json.d.cts +0 -12
- 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 +2 -2
- 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 +129 -9
- package/dist/es/components/icon/daikin-icon.js +118 -13
- package/dist/es/components/icon/icons.json.d.ts +0 -12
- package/dist/es/components/icon/icons.json.js +5 -1
- 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 +2 -2
- 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 +129 -9
- package/dist/es-dev/components/icon/daikin-icon.js +142 -17
- package/dist/es-dev/components/icon/icons.json.d.ts +0 -12
- package/dist/es-dev/components/icon/icons.json.js +5 -1
- 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 +2 -2
- 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,313 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import IMask from "imask";
|
|
3
|
+
import { unsafeCSS, css, html } from "lit";
|
|
4
|
+
import { property, state } from "lit/decorators.js";
|
|
5
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
6
|
+
import { createRef, ref } from "lit/directives/ref.js";
|
|
7
|
+
import "../../base/dds-element.js";
|
|
8
|
+
import { ddsElement } from "../../base/decorators.js";
|
|
9
|
+
import "../../base/define.js";
|
|
10
|
+
import { DDSFormElement } from "../../base/dds-form-element.js";
|
|
11
|
+
import tailwindStyles from "../../tailwind.css.js";
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
+
if (kind && result) __defProp(target, key, result);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
const cvaInput = cva(
|
|
23
|
+
[
|
|
24
|
+
"flex",
|
|
25
|
+
"items-center",
|
|
26
|
+
"w-full",
|
|
27
|
+
"h-full",
|
|
28
|
+
"bg-ddt-color-common-background-default",
|
|
29
|
+
"relative",
|
|
30
|
+
"rounded",
|
|
31
|
+
"overflow-hidden",
|
|
32
|
+
"font-daikinSerif",
|
|
33
|
+
"outline",
|
|
34
|
+
"outline-[--color-border]",
|
|
35
|
+
"outline-0",
|
|
36
|
+
"-outline-offset-2",
|
|
37
|
+
"placeholder:text-ddt-color-common-text-secondary",
|
|
38
|
+
// Define `--color-border` as a CSS variable that references `--color-state-focus` and `--color-base` in that order.
|
|
39
|
+
// `--color-base` indicates the color of the border when the element is normal, hovered, or disabled.
|
|
40
|
+
"define-[--color-state-focus,--color-base]/color-border",
|
|
41
|
+
"border",
|
|
42
|
+
"border-[--color-border]",
|
|
43
|
+
"enabled:text-ddt-color-common-text-primary",
|
|
44
|
+
"enabled:data-[empty]:text-ddt-color-common-text-secondary",
|
|
45
|
+
"enabled:hover:bg-ddt-color-common-surface-hover",
|
|
46
|
+
"enabled:active:bg-ddt-color-common-surface-press",
|
|
47
|
+
"focus-visible:outline-2",
|
|
48
|
+
"disabled:var-color-ddt-color-common-disabled/color-base",
|
|
49
|
+
"disabled:text-ddt-color-common-disabled",
|
|
50
|
+
"disabled:bg-ddt-color-common-background-default",
|
|
51
|
+
"disabled:placeholder:text-ddt-color-common-disabled"
|
|
52
|
+
],
|
|
53
|
+
{
|
|
54
|
+
variants: {
|
|
55
|
+
error: {
|
|
56
|
+
false: [
|
|
57
|
+
"enabled:var-color-ddt-color-common-neutral-default/color-base",
|
|
58
|
+
"enabled:hover:var-color-ddt-color-common-neutral-hover/color-base",
|
|
59
|
+
"enabled:active:var-color-ddt-color-common-neutral-press/color-base",
|
|
60
|
+
"focus-visible:var-color-ddt-color-common-border-focus/color-state-focus"
|
|
61
|
+
],
|
|
62
|
+
true: ["enabled:var-color-ddt-color-common-danger-default/color-base"]
|
|
63
|
+
},
|
|
64
|
+
leftIcon: {
|
|
65
|
+
false: ["pl-4"],
|
|
66
|
+
true: ["pl-11"]
|
|
67
|
+
},
|
|
68
|
+
rightIcon: {
|
|
69
|
+
false: ["pr-4"],
|
|
70
|
+
true: ["pr-11"]
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
const cvaIcon = cva(
|
|
76
|
+
["flex", "items-center", "absolute", "pointer-events-none"],
|
|
77
|
+
{
|
|
78
|
+
variants: {
|
|
79
|
+
icon: {
|
|
80
|
+
left: ["left-3"],
|
|
81
|
+
right: ["right-3"]
|
|
82
|
+
},
|
|
83
|
+
disabled: {
|
|
84
|
+
false: ["text-ddt-color-common-text-primary"],
|
|
85
|
+
true: ["text-ddt-color-common-disabled"]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
let DaikinTextMaskedField = class extends DDSFormElement {
|
|
91
|
+
constructor() {
|
|
92
|
+
super(...arguments);
|
|
93
|
+
this.placeholder = null;
|
|
94
|
+
this.readonly = false;
|
|
95
|
+
this.disabled = false;
|
|
96
|
+
this.required = false;
|
|
97
|
+
this.error = false;
|
|
98
|
+
this.minlength = null;
|
|
99
|
+
this.maxlength = null;
|
|
100
|
+
this.pattern = null;
|
|
101
|
+
this.mask = null;
|
|
102
|
+
this._unmaskedValue = "";
|
|
103
|
+
this._label = null;
|
|
104
|
+
this._hasLeftSlot = false;
|
|
105
|
+
this._hasRightSlot = false;
|
|
106
|
+
this._inputRef = createRef();
|
|
107
|
+
this._maskInstance = null;
|
|
108
|
+
}
|
|
109
|
+
_initializeMask() {
|
|
110
|
+
if (!this._inputRef.value || !this.mask) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
this._destroyMask();
|
|
114
|
+
const maskOptions = typeof this.mask === "string" ? { mask: this.mask, lazy: false, placeholderChar: "X" } : this.mask;
|
|
115
|
+
this._maskInstance = IMask(this._inputRef.value, maskOptions);
|
|
116
|
+
this._maskInstance.on("accept", () => {
|
|
117
|
+
if (this._maskInstance) {
|
|
118
|
+
this._unmaskedValue = this._maskInstance.unmaskedValue;
|
|
119
|
+
this.value = this._maskInstance.value;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
_destroyMask() {
|
|
124
|
+
var _a;
|
|
125
|
+
(_a = this._maskInstance) == null ? void 0 : _a.destroy();
|
|
126
|
+
this._maskInstance = null;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The unmasked value of the input.
|
|
130
|
+
*/
|
|
131
|
+
get unmaskedValue() {
|
|
132
|
+
return this._unmaskedValue;
|
|
133
|
+
}
|
|
134
|
+
set unmaskedValue(value) {
|
|
135
|
+
if (this._maskInstance) {
|
|
136
|
+
this._maskInstance.unmaskedValue = value;
|
|
137
|
+
this.value = this._maskInstance.value;
|
|
138
|
+
this._unmaskedValue = this._maskInstance.unmaskedValue;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
connectedCallback() {
|
|
142
|
+
super.connectedCallback();
|
|
143
|
+
this._initializeMask();
|
|
144
|
+
}
|
|
145
|
+
disconnectedCallback() {
|
|
146
|
+
super.disconnectedCallback();
|
|
147
|
+
this._destroyMask();
|
|
148
|
+
}
|
|
149
|
+
_handleChange(event) {
|
|
150
|
+
this.dispatchEvent(new Event("change", event));
|
|
151
|
+
}
|
|
152
|
+
_handleSlotChange(event) {
|
|
153
|
+
const target = event.target;
|
|
154
|
+
const name = target.name;
|
|
155
|
+
const hasIcon = !!target.assignedNodes().length;
|
|
156
|
+
switch (name) {
|
|
157
|
+
case "left-icon":
|
|
158
|
+
this._hasLeftSlot = hasIcon;
|
|
159
|
+
break;
|
|
160
|
+
case "right-icon":
|
|
161
|
+
this._hasRightSlot = hasIcon;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
_handleInput(event) {
|
|
166
|
+
this.value = event.target.value;
|
|
167
|
+
}
|
|
168
|
+
_createIcon() {
|
|
169
|
+
return html`<span
|
|
170
|
+
class=${cvaIcon({
|
|
171
|
+
icon: "left",
|
|
172
|
+
disabled: this.disabled
|
|
173
|
+
})}
|
|
174
|
+
>
|
|
175
|
+
<slot
|
|
176
|
+
name="left-icon"
|
|
177
|
+
class="icon-size-6"
|
|
178
|
+
@slotchange=${this._handleSlotChange}
|
|
179
|
+
></slot>
|
|
180
|
+
</span>
|
|
181
|
+
<span
|
|
182
|
+
class=${cvaIcon({
|
|
183
|
+
icon: "right",
|
|
184
|
+
disabled: this.disabled
|
|
185
|
+
})}
|
|
186
|
+
>
|
|
187
|
+
<slot
|
|
188
|
+
name="right-icon"
|
|
189
|
+
class="icon-size-6"
|
|
190
|
+
@slotchange=${this._handleSlotChange}
|
|
191
|
+
></slot>
|
|
192
|
+
</span>`;
|
|
193
|
+
}
|
|
194
|
+
render() {
|
|
195
|
+
const error = !this.disabled && this.error;
|
|
196
|
+
const hasLeftSlot = this._hasLeftSlot;
|
|
197
|
+
const hasRightSlot = this._hasRightSlot;
|
|
198
|
+
const leftIcon = hasLeftSlot;
|
|
199
|
+
const rightIcon = hasRightSlot;
|
|
200
|
+
return html`<input
|
|
201
|
+
${ref(this._inputRef)}
|
|
202
|
+
class=${cvaInput({
|
|
203
|
+
error,
|
|
204
|
+
leftIcon,
|
|
205
|
+
rightIcon
|
|
206
|
+
})}
|
|
207
|
+
type="text"
|
|
208
|
+
placeholder=${ifDefined(this.placeholder ?? void 0)}
|
|
209
|
+
name=${ifDefined(this.name)}
|
|
210
|
+
minlength=${ifDefined(this.minlength ?? void 0)}
|
|
211
|
+
maxlength=${ifDefined(this.maxlength ?? void 0)}
|
|
212
|
+
pattern=${ifDefined(this.pattern ?? void 0)}
|
|
213
|
+
autocomplete=${// eslint-disable-next-line @typescript-eslint/no-explicit-any -- workaround lit-analyzer checking
|
|
214
|
+
ifDefined(this.autocomplete)}
|
|
215
|
+
aria-label=${ifDefined(this._label ?? void 0)}
|
|
216
|
+
.value=${this.value}
|
|
217
|
+
?data-empty=${!this._unmaskedValue}
|
|
218
|
+
?disabled=${this.disabled}
|
|
219
|
+
?readonly=${this.readonly}
|
|
220
|
+
?required=${this.required}
|
|
221
|
+
@change=${this._handleChange}
|
|
222
|
+
@input=${this._handleInput}
|
|
223
|
+
/>
|
|
224
|
+
${this._createIcon()}`;
|
|
225
|
+
}
|
|
226
|
+
updated(changedProperties) {
|
|
227
|
+
if (changedProperties.has("mask")) {
|
|
228
|
+
this._destroyMask();
|
|
229
|
+
this._initializeMask();
|
|
230
|
+
}
|
|
231
|
+
if (!changedProperties.has("value")) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
this.setFormValue(this.value);
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* This method is used by `daikin-input-group` to reflect it's attributes to this component.
|
|
238
|
+
* @private
|
|
239
|
+
*/
|
|
240
|
+
reflectInputGroup(inputGroup) {
|
|
241
|
+
const isError = !inputGroup.disabled && !!inputGroup.error;
|
|
242
|
+
this.disabled = !!inputGroup.disabled;
|
|
243
|
+
this.required = !!inputGroup.required;
|
|
244
|
+
this.error = isError;
|
|
245
|
+
this._label = inputGroup.label;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
DaikinTextMaskedField.styles = css`
|
|
249
|
+
${unsafeCSS(tailwindStyles)}
|
|
250
|
+
|
|
251
|
+
:host {
|
|
252
|
+
display: flex;
|
|
253
|
+
align-items: center;
|
|
254
|
+
height: 3rem;
|
|
255
|
+
position: relative;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
input::-ms-reveal {
|
|
259
|
+
display: none !important;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
input::-ms-clear {
|
|
263
|
+
display: none !important;
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
__decorateClass([
|
|
267
|
+
property({ type: String })
|
|
268
|
+
], DaikinTextMaskedField.prototype, "placeholder", 2);
|
|
269
|
+
__decorateClass([
|
|
270
|
+
property({ type: Boolean, reflect: true })
|
|
271
|
+
], DaikinTextMaskedField.prototype, "readonly", 2);
|
|
272
|
+
__decorateClass([
|
|
273
|
+
property({ type: Boolean, reflect: true })
|
|
274
|
+
], DaikinTextMaskedField.prototype, "disabled", 2);
|
|
275
|
+
__decorateClass([
|
|
276
|
+
property({ type: Boolean, reflect: true })
|
|
277
|
+
], DaikinTextMaskedField.prototype, "required", 2);
|
|
278
|
+
__decorateClass([
|
|
279
|
+
property({ type: Boolean, reflect: true })
|
|
280
|
+
], DaikinTextMaskedField.prototype, "error", 2);
|
|
281
|
+
__decorateClass([
|
|
282
|
+
property({ type: Number, reflect: true })
|
|
283
|
+
], DaikinTextMaskedField.prototype, "minlength", 2);
|
|
284
|
+
__decorateClass([
|
|
285
|
+
property({ type: Number, reflect: true })
|
|
286
|
+
], DaikinTextMaskedField.prototype, "maxlength", 2);
|
|
287
|
+
__decorateClass([
|
|
288
|
+
property({ type: String, reflect: true })
|
|
289
|
+
], DaikinTextMaskedField.prototype, "pattern", 2);
|
|
290
|
+
__decorateClass([
|
|
291
|
+
property({ attribute: false })
|
|
292
|
+
], DaikinTextMaskedField.prototype, "mask", 2);
|
|
293
|
+
__decorateClass([
|
|
294
|
+
property({ type: String, reflect: true })
|
|
295
|
+
], DaikinTextMaskedField.prototype, "autocomplete", 2);
|
|
296
|
+
__decorateClass([
|
|
297
|
+
state()
|
|
298
|
+
], DaikinTextMaskedField.prototype, "_unmaskedValue", 2);
|
|
299
|
+
__decorateClass([
|
|
300
|
+
state()
|
|
301
|
+
], DaikinTextMaskedField.prototype, "_label", 2);
|
|
302
|
+
__decorateClass([
|
|
303
|
+
state()
|
|
304
|
+
], DaikinTextMaskedField.prototype, "_hasLeftSlot", 2);
|
|
305
|
+
__decorateClass([
|
|
306
|
+
state()
|
|
307
|
+
], DaikinTextMaskedField.prototype, "_hasRightSlot", 2);
|
|
308
|
+
DaikinTextMaskedField = __decorateClass([
|
|
309
|
+
ddsElement("daikin-text-masked-field")
|
|
310
|
+
], DaikinTextMaskedField);
|
|
311
|
+
export {
|
|
312
|
+
DaikinTextMaskedField
|
|
313
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./daikin-text-masked-field.js";
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { DDSFormElement } from "../../base/dds-form-element.js";
|
|
3
|
+
import { default as DaikinInputGroup } from "../input-group/daikin-input-group.js";
|
|
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 {};
|