@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
|
@@ -9,7 +9,9 @@ const decorators = require("../../base/decorators.cjs");
|
|
|
9
9
|
require("../../base/define.cjs");
|
|
10
10
|
const ddsFormElement = require("../../base/dds-form-element.cjs");
|
|
11
11
|
const tailwind = require("../../tailwind.css.cjs");
|
|
12
|
+
const isSimpleKey = require("../../utils/is-simple-key.cjs");
|
|
12
13
|
require("../icon-button/daikin-icon-button.cjs");
|
|
14
|
+
const numberUtils = require("./number-utils.cjs");
|
|
13
15
|
var __defProp = Object.defineProperty;
|
|
14
16
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
17
|
var __decorateClass = (decorators2, target, key, kind) => {
|
|
@@ -26,6 +28,8 @@ const cvaInput = classVarianceAuthority.cva(
|
|
|
26
28
|
"items-center",
|
|
27
29
|
"w-full",
|
|
28
30
|
"h-full",
|
|
31
|
+
"pl-[--pl,1rem]",
|
|
32
|
+
"pr-[--pr,1rem]",
|
|
29
33
|
"bg-ddt-color-common-background-default",
|
|
30
34
|
"relative",
|
|
31
35
|
"rounded",
|
|
@@ -64,21 +68,38 @@ const cvaInput = classVarianceAuthority.cva(
|
|
|
64
68
|
true: ["enabled:var-color-ddt-color-common-danger-default/color-base"]
|
|
65
69
|
},
|
|
66
70
|
leftIcon: {
|
|
67
|
-
false: [
|
|
68
|
-
true: [
|
|
71
|
+
false: [],
|
|
72
|
+
true: []
|
|
69
73
|
},
|
|
70
74
|
rightIcon: {
|
|
71
|
-
false: [
|
|
72
|
-
true: [
|
|
75
|
+
false: [],
|
|
76
|
+
true: []
|
|
73
77
|
},
|
|
74
78
|
type: {
|
|
75
79
|
text: [],
|
|
76
|
-
|
|
80
|
+
number: ["[--pr:5.5rem]"],
|
|
81
|
+
password: ["[--pr:2.75rem]"],
|
|
77
82
|
email: [],
|
|
78
83
|
tel: [],
|
|
79
|
-
search: [
|
|
84
|
+
search: [
|
|
85
|
+
"[&::-webkit-search-cancel-button]:appearance-none",
|
|
86
|
+
"[--pl:2.75rem]",
|
|
87
|
+
"[--pr:2.75rem]"
|
|
88
|
+
]
|
|
80
89
|
}
|
|
81
|
-
}
|
|
90
|
+
},
|
|
91
|
+
compoundVariants: [
|
|
92
|
+
{
|
|
93
|
+
type: ["text", "email", "tel", "number", "password"],
|
|
94
|
+
leftIcon: true,
|
|
95
|
+
class: ["[--pl:2.75rem]"]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
type: ["text", "email", "tel"],
|
|
99
|
+
rightIcon: true,
|
|
100
|
+
class: ["[--pr:2.75rem]"]
|
|
101
|
+
}
|
|
102
|
+
]
|
|
82
103
|
}
|
|
83
104
|
);
|
|
84
105
|
const cvaIcon = classVarianceAuthority.cva(
|
|
@@ -115,6 +136,9 @@ exports.DaikinTextField = class DaikinTextField extends ddsFormElement.DDSFormEl
|
|
|
115
136
|
this.error = false;
|
|
116
137
|
this.minlength = null;
|
|
117
138
|
this.maxlength = null;
|
|
139
|
+
this.step = null;
|
|
140
|
+
this.min = null;
|
|
141
|
+
this.max = null;
|
|
118
142
|
this.pattern = null;
|
|
119
143
|
this.showPassword = false;
|
|
120
144
|
this._label = null;
|
|
@@ -139,26 +163,140 @@ exports.DaikinTextField = class DaikinTextField extends ddsFormElement.DDSFormEl
|
|
|
139
163
|
}
|
|
140
164
|
_handleInput(event) {
|
|
141
165
|
this.value = event.target.value;
|
|
142
|
-
this.setFormValue(this.value);
|
|
143
166
|
}
|
|
144
167
|
_handleClearClick() {
|
|
145
168
|
this.value = "";
|
|
169
|
+
this.dispatchEvent(
|
|
170
|
+
new Event("input", {
|
|
171
|
+
bubbles: true,
|
|
172
|
+
composed: true
|
|
173
|
+
})
|
|
174
|
+
);
|
|
175
|
+
this.dispatchEvent(
|
|
176
|
+
new Event("change", {
|
|
177
|
+
bubbles: true
|
|
178
|
+
})
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
_handleKeyDown(event) {
|
|
182
|
+
if (this.type === "number") {
|
|
183
|
+
if (isSimpleKey.isSimpleKeyEvent(event) && event.key.length === 1) {
|
|
184
|
+
const { value, selectionStart, selectionEnd } = event.target;
|
|
185
|
+
const selectionText = value.substring(
|
|
186
|
+
selectionStart ?? 0,
|
|
187
|
+
selectionEnd ?? 0
|
|
188
|
+
);
|
|
189
|
+
if (/^[0-9]$/.test(event.key)) {
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (event.key === "-") {
|
|
193
|
+
if ((!value.includes("-") || selectionText.includes("-")) && selectionStart === 0) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (event.key === ".") {
|
|
198
|
+
if (!value.includes(".") || selectionText.includes(".")) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
event.preventDefault();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const direction = {
|
|
206
|
+
ArrowUp: 1,
|
|
207
|
+
ArrowDown: -1
|
|
208
|
+
}[event.key];
|
|
209
|
+
if (direction != null) {
|
|
210
|
+
event.preventDefault();
|
|
211
|
+
this._updateNumberValue(direction);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
_updateNumberValue(sign) {
|
|
216
|
+
const newValue = numberUtils.updateNumberValue(this.value || "0", sign, {
|
|
217
|
+
step: this.step,
|
|
218
|
+
min: this.min,
|
|
219
|
+
max: this.max
|
|
220
|
+
});
|
|
221
|
+
if (newValue === this.value) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
this.value = newValue;
|
|
225
|
+
this.dispatchEvent(
|
|
226
|
+
new Event("input", {
|
|
227
|
+
bubbles: true,
|
|
228
|
+
composed: true
|
|
229
|
+
})
|
|
230
|
+
);
|
|
231
|
+
this.dispatchEvent(
|
|
232
|
+
new Event("change", {
|
|
233
|
+
bubbles: true
|
|
234
|
+
})
|
|
235
|
+
);
|
|
146
236
|
}
|
|
147
237
|
_createIcon() {
|
|
238
|
+
const leftIconSlot = lit.html`<span
|
|
239
|
+
class=${cvaIcon({
|
|
240
|
+
icon: "left",
|
|
241
|
+
disabled: this.disabled
|
|
242
|
+
})}
|
|
243
|
+
>
|
|
244
|
+
<slot
|
|
245
|
+
name="left-icon"
|
|
246
|
+
class="icon-size-6"
|
|
247
|
+
@slotchange=${this._handleSlotChange}
|
|
248
|
+
></slot>
|
|
249
|
+
</span>`;
|
|
250
|
+
const rightIconSlot = lit.html`<span
|
|
251
|
+
class=${cvaIcon({
|
|
252
|
+
icon: "right",
|
|
253
|
+
disabled: this.disabled
|
|
254
|
+
})}
|
|
255
|
+
>
|
|
256
|
+
<slot
|
|
257
|
+
name="right-icon"
|
|
258
|
+
class="icon-size-6"
|
|
259
|
+
@slotchange=${this._handleSlotChange}
|
|
260
|
+
></slot>
|
|
261
|
+
</span>`;
|
|
148
262
|
switch (this.type) {
|
|
263
|
+
case "number":
|
|
264
|
+
return lit.html`${leftIconSlot}
|
|
265
|
+
<span class="inline-flex items-center gap-1 absolute right-2">
|
|
266
|
+
<daikin-icon-button
|
|
267
|
+
color="neutral"
|
|
268
|
+
variant="ghost"
|
|
269
|
+
?disabled=${this.disabled}
|
|
270
|
+
button-aria-label="Decrease"
|
|
271
|
+
tabindex="-1"
|
|
272
|
+
@click=${() => this._updateNumberValue(-1)}
|
|
273
|
+
>
|
|
274
|
+
<span class="i-daikin-number-minus icon-size-6"></span>
|
|
275
|
+
</daikin-icon-button>
|
|
276
|
+
<daikin-icon-button
|
|
277
|
+
color="neutral"
|
|
278
|
+
variant="ghost"
|
|
279
|
+
?disabled=${this.disabled}
|
|
280
|
+
button-aria-label="Increase"
|
|
281
|
+
tabindex="-1"
|
|
282
|
+
@click=${() => this._updateNumberValue(1)}
|
|
283
|
+
>
|
|
284
|
+
<span class="i-daikin-number-plus icon-size-6"></span>
|
|
285
|
+
</daikin-icon-button>
|
|
286
|
+
</span>`;
|
|
149
287
|
case "password":
|
|
150
|
-
return lit.html
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
288
|
+
return lit.html`${leftIconSlot}<daikin-icon-button
|
|
289
|
+
color="neutral"
|
|
290
|
+
variant="ghost"
|
|
291
|
+
?disabled=${this.disabled}
|
|
292
|
+
button-aria-label=${this.showPassword ? "Hide password" : "Show password"}
|
|
293
|
+
class="absolute right-3"
|
|
294
|
+
@click=${this._handleShowPasswordClick}
|
|
295
|
+
>
|
|
296
|
+
<span
|
|
297
|
+
class=${cvaShowPasswordIcon({ showPassword: this.showPassword })}
|
|
298
|
+
></span>
|
|
299
|
+
</daikin-icon-button>`;
|
|
162
300
|
case "search":
|
|
163
301
|
return lit.html`<span
|
|
164
302
|
class=${cvaIcon({
|
|
@@ -179,30 +317,7 @@ exports.DaikinTextField = class DaikinTextField extends ddsFormElement.DDSFormEl
|
|
|
179
317
|
<span class="i-daikin-close"></span>
|
|
180
318
|
</daikin-icon-button>` : lit.nothing}`;
|
|
181
319
|
default:
|
|
182
|
-
return lit.html
|
|
183
|
-
class=${cvaIcon({
|
|
184
|
-
icon: "left",
|
|
185
|
-
disabled: this.disabled
|
|
186
|
-
})}
|
|
187
|
-
>
|
|
188
|
-
<slot
|
|
189
|
-
name="left-icon"
|
|
190
|
-
class="icon-size-6"
|
|
191
|
-
@slotchange=${this._handleSlotChange}
|
|
192
|
-
></slot>
|
|
193
|
-
</span>
|
|
194
|
-
<span
|
|
195
|
-
class=${cvaIcon({
|
|
196
|
-
icon: "right",
|
|
197
|
-
disabled: this.disabled
|
|
198
|
-
})}
|
|
199
|
-
>
|
|
200
|
-
<slot
|
|
201
|
-
name="right-icon"
|
|
202
|
-
class="icon-size-6"
|
|
203
|
-
@slotchange=${this._handleSlotChange}
|
|
204
|
-
></slot>
|
|
205
|
-
</span>`;
|
|
320
|
+
return lit.html`${leftIconSlot}${rightIconSlot}`;
|
|
206
321
|
}
|
|
207
322
|
}
|
|
208
323
|
_handleShowPasswordClick() {
|
|
@@ -211,38 +326,49 @@ exports.DaikinTextField = class DaikinTextField extends ddsFormElement.DDSFormEl
|
|
|
211
326
|
}
|
|
212
327
|
render() {
|
|
213
328
|
const error = !this.disabled && this.error;
|
|
214
|
-
const
|
|
215
|
-
const
|
|
216
|
-
const
|
|
217
|
-
password: [false, true],
|
|
218
|
-
search: [true, !!this.value.length],
|
|
219
|
-
email: [hasLeftSlot, hasRightSlot],
|
|
220
|
-
tel: [hasLeftSlot, hasRightSlot],
|
|
221
|
-
text: [hasLeftSlot, hasRightSlot]
|
|
222
|
-
}[this.type];
|
|
223
|
-
const type = this.type === "password" && this.showPassword ? "text" : this.type;
|
|
329
|
+
const type = this.type === "password" && this.showPassword ? "text" : this.type === "number" ? "text" : this.type;
|
|
330
|
+
const role = this.type === "number" ? "spinbutton" : void 0;
|
|
331
|
+
const inputMode = this.type === "number" ? "numeric" : void 0;
|
|
224
332
|
return lit.html`<input
|
|
225
333
|
class=${cvaInput({
|
|
226
334
|
error,
|
|
227
|
-
leftIcon,
|
|
228
|
-
rightIcon,
|
|
335
|
+
leftIcon: this._hasLeftSlot,
|
|
336
|
+
rightIcon: this._hasRightSlot,
|
|
229
337
|
type: this.type
|
|
230
338
|
})}
|
|
339
|
+
role=${ifDefined_js.ifDefined(role)}
|
|
231
340
|
type=${type}
|
|
341
|
+
inputmode=${ifDefined_js.ifDefined(inputMode)}
|
|
232
342
|
placeholder=${ifDefined_js.ifDefined(this.placeholder ?? void 0)}
|
|
233
343
|
name=${ifDefined_js.ifDefined(this.name)}
|
|
234
344
|
minlength=${ifDefined_js.ifDefined(this.minlength ?? void 0)}
|
|
235
345
|
maxlength=${ifDefined_js.ifDefined(this.maxlength ?? void 0)}
|
|
346
|
+
step=${ifDefined_js.ifDefined(
|
|
347
|
+
this.type === "number" && this.step != null ? (
|
|
348
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
349
|
+
this.step
|
|
350
|
+
) : void 0
|
|
351
|
+
)}
|
|
236
352
|
pattern=${ifDefined_js.ifDefined(this.pattern ?? void 0)}
|
|
237
353
|
autocomplete=${// eslint-disable-next-line @typescript-eslint/no-explicit-any -- workaround lit-analyzer checking
|
|
238
354
|
ifDefined_js.ifDefined(this.autocomplete)}
|
|
239
355
|
aria-label=${ifDefined_js.ifDefined(this._label ?? void 0)}
|
|
356
|
+
aria-valuemin=${ifDefined_js.ifDefined(
|
|
357
|
+
this.type === "number" && this.min != null ? this.min : void 0
|
|
358
|
+
)}
|
|
359
|
+
aria-valuemax=${ifDefined_js.ifDefined(
|
|
360
|
+
this.type === "number" && this.max != null ? this.max : void 0
|
|
361
|
+
)}
|
|
362
|
+
aria-valuenow=${ifDefined_js.ifDefined(
|
|
363
|
+
this.type === "number" ? this.value : void 0
|
|
364
|
+
)}
|
|
240
365
|
.value=${this.value}
|
|
241
366
|
?disabled=${this.disabled}
|
|
242
367
|
?readonly=${this.readonly}
|
|
243
368
|
?required=${this.required}
|
|
244
369
|
@change=${this._handleChange}
|
|
245
370
|
@input=${this._handleInput}
|
|
371
|
+
@keydown=${this._handleKeyDown}
|
|
246
372
|
/>
|
|
247
373
|
${this._createIcon()}`;
|
|
248
374
|
}
|
|
@@ -306,6 +432,15 @@ __decorateClass([
|
|
|
306
432
|
__decorateClass([
|
|
307
433
|
decorators_js.property({ type: Number, reflect: true })
|
|
308
434
|
], exports.DaikinTextField.prototype, "maxlength", 2);
|
|
435
|
+
__decorateClass([
|
|
436
|
+
decorators_js.property({ type: String, reflect: true })
|
|
437
|
+
], exports.DaikinTextField.prototype, "step", 2);
|
|
438
|
+
__decorateClass([
|
|
439
|
+
decorators_js.property({ type: String, reflect: true })
|
|
440
|
+
], exports.DaikinTextField.prototype, "min", 2);
|
|
441
|
+
__decorateClass([
|
|
442
|
+
decorators_js.property({ type: String, reflect: true })
|
|
443
|
+
], exports.DaikinTextField.prototype, "max", 2);
|
|
309
444
|
__decorateClass([
|
|
310
445
|
decorators_js.property({ type: String, reflect: true })
|
|
311
446
|
], exports.DaikinTextField.prototype, "pattern", 2);
|
|
@@ -15,10 +15,18 @@ import { DaikinInputGroup } from "../input-group/index.cjs";
|
|
|
15
15
|
* @fires toggle - Emitted when the user toggles the password mask.
|
|
16
16
|
*
|
|
17
17
|
* @slot left-icon - Specify the icon you want to use on the left. You can also use something other than `daikin-icon`.
|
|
18
|
-
*
|
|
18
|
+
* Available only if the type is one of:
|
|
19
|
+
* - `"text"`
|
|
20
|
+
* - `"number"`
|
|
21
|
+
* - `"password"`
|
|
22
|
+
* - `"email"`
|
|
23
|
+
* - `"tel"`
|
|
19
24
|
*
|
|
20
25
|
* @slot right-icon - Specify the icon you want to use on the right. You can also use something other than `daikin-icon`.
|
|
21
|
-
*
|
|
26
|
+
* Available only if the type is one of:
|
|
27
|
+
* - `"text"`
|
|
28
|
+
* - `"email"`
|
|
29
|
+
* - `"tel"`
|
|
22
30
|
*
|
|
23
31
|
* @example
|
|
24
32
|
*
|
|
@@ -35,8 +43,15 @@ export declare class DaikinTextField extends DDSFormElement {
|
|
|
35
43
|
static readonly styles: import('lit').CSSResult;
|
|
36
44
|
/**
|
|
37
45
|
* Type of field.
|
|
46
|
+
*
|
|
47
|
+
* - `"text"`: Basic text input with optional left and right icon slots.
|
|
48
|
+
* - `"number"`: Numeric input with increment/decrement buttons, arrow key support, and optional left icon slot.
|
|
49
|
+
* - `"password"`: Password input with show/hide toggle button to control mask of password and optional left icon slot.
|
|
50
|
+
* - `"email"`: Email input with optional left and right icon slots.
|
|
51
|
+
* - `"tel"`: Telephone input with optional left and right icon slots.
|
|
52
|
+
* - `"search"`: Search input with built-in search icon and clear button when value is present.
|
|
38
53
|
*/
|
|
39
|
-
type: "text" | "password" | "email" | "tel" | "search";
|
|
54
|
+
type: "text" | "number" | "password" | "email" | "tel" | "search";
|
|
40
55
|
/**
|
|
41
56
|
* Placeholder text.
|
|
42
57
|
*/
|
|
@@ -69,6 +84,18 @@ export declare class DaikinTextField extends DDSFormElement {
|
|
|
69
84
|
* Maximum length of value.
|
|
70
85
|
*/
|
|
71
86
|
maxlength: number | null;
|
|
87
|
+
/**
|
|
88
|
+
* Interval between values. This is valid when `type="number"`.
|
|
89
|
+
*/
|
|
90
|
+
step: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* The minimum value. This is valid when `type="number"`.
|
|
93
|
+
*/
|
|
94
|
+
min: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* The maximum value. This is valid when `type="number"`.
|
|
97
|
+
*/
|
|
98
|
+
max: string | null;
|
|
72
99
|
/**
|
|
73
100
|
* The pattern of value.
|
|
74
101
|
*/
|
|
@@ -92,6 +119,8 @@ export declare class DaikinTextField extends DDSFormElement {
|
|
|
92
119
|
private _handleSlotChange;
|
|
93
120
|
private _handleInput;
|
|
94
121
|
private _handleClearClick;
|
|
122
|
+
private _handleKeyDown;
|
|
123
|
+
private _updateNumberValue;
|
|
95
124
|
private _createIcon;
|
|
96
125
|
private _handleShowPasswordClick;
|
|
97
126
|
render(): TemplateResult<1>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const Big = require("big.js");
|
|
4
|
+
function updateNumberValue(currentValue, direction, options) {
|
|
5
|
+
const { step, min, max } = options;
|
|
6
|
+
try {
|
|
7
|
+
const current = new Big(currentValue || "0");
|
|
8
|
+
const stepBig = new Big(step || "1");
|
|
9
|
+
const minBig = min != null && min !== "" ? new Big(min) : null;
|
|
10
|
+
const maxBig = max != null && max !== "" ? new Big(max) : null;
|
|
11
|
+
if (minBig && maxBig && maxBig.lt(minBig)) {
|
|
12
|
+
return direction === 1 ? minBig.toString() : maxBig.toString();
|
|
13
|
+
}
|
|
14
|
+
const isOnStepBoundary = (value) => {
|
|
15
|
+
const diff = value.sub(minBig ?? 0);
|
|
16
|
+
return diff.mod(stepBig).eq(0);
|
|
17
|
+
};
|
|
18
|
+
const findNearestStepInDirection = (value, dir) => {
|
|
19
|
+
const base = minBig || new Big(0);
|
|
20
|
+
const offset = value.sub(base);
|
|
21
|
+
const steps = offset.div(stepBig);
|
|
22
|
+
let targetSteps;
|
|
23
|
+
if (dir === 1) {
|
|
24
|
+
targetSteps = steps.round(0, Big.roundUp);
|
|
25
|
+
} else {
|
|
26
|
+
targetSteps = steps.round(0, Big.roundDown);
|
|
27
|
+
}
|
|
28
|
+
return base.add(targetSteps.mul(stepBig));
|
|
29
|
+
};
|
|
30
|
+
const isInRange = (!minBig || current.gte(minBig)) && (!maxBig || current.lte(maxBig));
|
|
31
|
+
if (!isInRange || !isOnStepBoundary(current)) {
|
|
32
|
+
if (!isInRange) {
|
|
33
|
+
const isBelowMin = minBig && current.lt(minBig);
|
|
34
|
+
const isAboveMax = maxBig && current.gt(maxBig);
|
|
35
|
+
if (isBelowMin && direction === -1 || isAboveMax && direction === 1) {
|
|
36
|
+
return currentValue;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let nearestStep = findNearestStepInDirection(current, direction);
|
|
40
|
+
if (minBig && nearestStep.lt(minBig)) {
|
|
41
|
+
nearestStep = minBig;
|
|
42
|
+
}
|
|
43
|
+
if (maxBig && nearestStep.gt(maxBig)) {
|
|
44
|
+
nearestStep = maxBig;
|
|
45
|
+
}
|
|
46
|
+
return nearestStep.toString();
|
|
47
|
+
}
|
|
48
|
+
const newValue = direction === 1 ? current.add(stepBig) : current.sub(stepBig);
|
|
49
|
+
let result = newValue;
|
|
50
|
+
if (minBig && result.lt(minBig)) {
|
|
51
|
+
result = minBig;
|
|
52
|
+
}
|
|
53
|
+
if (maxBig && result.gt(maxBig)) {
|
|
54
|
+
result = maxBig;
|
|
55
|
+
}
|
|
56
|
+
return result.toString();
|
|
57
|
+
} catch (error) {
|
|
58
|
+
{
|
|
59
|
+
console.warn("Number update operation failed:", error);
|
|
60
|
+
}
|
|
61
|
+
return currentValue;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.updateNumberValue = updateNumberValue;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Options for updating number values with step constraints.
|
|
3
|
+
*/
|
|
4
|
+
export interface NumberUpdateOptions {
|
|
5
|
+
/** Step increment/decrement amount */
|
|
6
|
+
step?: string | null;
|
|
7
|
+
/** Minimum allowed value */
|
|
8
|
+
min?: string | null;
|
|
9
|
+
/** Maximum allowed value */
|
|
10
|
+
max?: string | null;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Updates a number value according to step constraints and min/max bounds.
|
|
14
|
+
*
|
|
15
|
+
* Logic (compliant with Google Chrome behavior):
|
|
16
|
+
* 0. Valid output range: min <= value <= max, and (value - min) is a multiple of step, or value equals min/max
|
|
17
|
+
* 1. If max < min, direction up goes to min (max value), direction down goes to max (min value)
|
|
18
|
+
* 2. If value is out of range or not on step boundary, round to nearest step in the direction and finish
|
|
19
|
+
* 3. Otherwise, increment/decrement by step
|
|
20
|
+
*
|
|
21
|
+
* @param currentValue Current value as string
|
|
22
|
+
* @param direction Direction: 1 for increment, -1 for decrement
|
|
23
|
+
* @param options The update options
|
|
24
|
+
* @returns The new value as string
|
|
25
|
+
*/
|
|
26
|
+
export declare function updateNumberValue(currentValue: string, direction: 1 | -1, options: NumberUpdateOptions): string;
|