@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.
Files changed (245) hide show
  1. package/CHANGELOG.md +150 -0
  2. package/dist/cjs/base/dds-element.cjs +1 -1
  3. package/dist/cjs/components/accordion-item/daikin-accordion-item.cjs +1 -0
  4. package/dist/cjs/components/avatar/daikin-avatar.cjs +1 -0
  5. package/dist/cjs/components/calendar/daikin-calendar.cjs +2 -0
  6. package/dist/cjs/components/card-header/daikin-card-header.cjs +1 -1
  7. package/dist/cjs/components/carousel/daikin-carousel.cjs +7 -3
  8. package/dist/cjs/components/carousel-item/daikin-carousel-item.cjs +2 -2
  9. package/dist/cjs/components/chip/daikin-chip.cjs +106 -0
  10. package/dist/cjs/components/chip/daikin-chip.d.cts +36 -0
  11. package/dist/cjs/components/chip/index.cjs +7 -0
  12. package/dist/cjs/components/chip/index.d.cts +1 -0
  13. package/dist/cjs/components/combobox/daikin-combobox.cjs +604 -0
  14. package/dist/cjs/components/combobox/daikin-combobox.d.cts +134 -0
  15. package/dist/cjs/components/combobox/index.cjs +8 -0
  16. package/dist/cjs/components/combobox/index.d.cts +1 -0
  17. package/dist/cjs/components/date-picker/daikin-date-picker.cjs +31 -16
  18. package/dist/cjs/components/date-picker/daikin-date-picker.d.cts +2 -1
  19. package/dist/cjs/components/dropdown/daikin-dropdown.cjs +52 -37
  20. package/dist/cjs/components/dropdown/daikin-dropdown.d.cts +4 -3
  21. package/dist/cjs/components/icon/daikin-icon.cjs +117 -12
  22. package/dist/cjs/components/icon/daikin-icon.d.cts +141 -9
  23. package/dist/cjs/components/icon/icons.json.cjs +5 -1
  24. package/dist/cjs/components/icon-button/daikin-icon-button.cjs +12 -2
  25. package/dist/cjs/components/icon-button/daikin-icon-button.d.cts +8 -0
  26. package/dist/cjs/components/index.cjs +36 -0
  27. package/dist/cjs/components/index.d.cts +5 -0
  28. package/dist/cjs/components/input-group/daikin-input-group.cjs +1 -1
  29. package/dist/cjs/components/input-group/daikin-input-group.d.cts +40 -13
  30. package/dist/cjs/components/list-item/daikin-list-item.cjs +2 -2
  31. package/dist/cjs/components/modal-header/daikin-modal-header.cjs +1 -1
  32. package/dist/cjs/components/progress-bar/daikin-progress-bar.cjs +3 -3
  33. package/dist/cjs/components/select/daikin-select.cjs +6 -1
  34. package/dist/cjs/components/tab/daikin-tab.cjs +1 -0
  35. package/dist/cjs/components/table/daikin-table.cjs +33 -12
  36. package/dist/cjs/components/table/daikin-table.d.cts +67 -34
  37. package/dist/cjs/components/table-header-cell/daikin-table-header-cell.cjs +31 -6
  38. package/dist/cjs/components/table-header-cell/daikin-table-header-cell.d.cts +7 -0
  39. package/dist/cjs/components/text-field/daikin-text-field.cjs +191 -56
  40. package/dist/cjs/components/text-field/daikin-text-field.d.cts +32 -3
  41. package/dist/cjs/components/text-field/number-utils.cjs +61 -0
  42. package/dist/cjs/components/text-field/number-utils.d.cts +26 -0
  43. package/dist/cjs/components/text-masked-field/daikin-text-masked-field.cjs +312 -0
  44. package/dist/cjs/components/text-masked-field/daikin-text-masked-field.d.cts +136 -0
  45. package/dist/cjs/components/text-masked-field/index.cjs +7 -0
  46. package/dist/cjs/components/text-masked-field/index.d.cts +1 -0
  47. package/dist/cjs/components/time-picker/daikin-time-picker.cjs +577 -0
  48. package/dist/cjs/components/time-picker/daikin-time-picker.d.cts +165 -0
  49. package/dist/cjs/components/time-picker/index.cjs +17 -0
  50. package/dist/cjs/components/time-picker/index.d.cts +1 -0
  51. package/dist/cjs/components/toast-notification-manager/daikin-toast-notification-manager.d.cts +1 -1
  52. package/dist/cjs/components/tooltip/daikin-tooltip.cjs +12 -2
  53. package/dist/cjs/components/tooltip/daikin-tooltip.d.cts +8 -1
  54. package/dist/cjs/controllers/floating-ui-auto-update.cjs +22 -4
  55. package/dist/cjs/controllers/floating-ui-auto-update.d.cts +12 -0
  56. package/dist/cjs/icon-registry.cjs +170 -0
  57. package/dist/cjs/icon-registry.d.cts +120 -0
  58. package/dist/cjs/index.cjs +39 -0
  59. package/dist/cjs/index.d.cts +1 -0
  60. package/dist/cjs/tailwind.css.cjs +1 -1
  61. package/dist/cjs/utils/notification-common.d.cts +1 -1
  62. package/dist/cjs-dev/base/dds-element.cjs +1 -1
  63. package/dist/cjs-dev/components/accordion-item/daikin-accordion-item.cjs +1 -0
  64. package/dist/cjs-dev/components/avatar/daikin-avatar.cjs +1 -0
  65. package/dist/cjs-dev/components/calendar/daikin-calendar.cjs +2 -0
  66. package/dist/cjs-dev/components/card-header/daikin-card-header.cjs +1 -1
  67. package/dist/cjs-dev/components/carousel/daikin-carousel.cjs +7 -3
  68. package/dist/cjs-dev/components/carousel-item/daikin-carousel-item.cjs +2 -2
  69. package/dist/cjs-dev/components/chip/daikin-chip.cjs +106 -0
  70. package/dist/cjs-dev/components/chip/daikin-chip.d.cts +36 -0
  71. package/dist/cjs-dev/components/chip/index.cjs +7 -0
  72. package/dist/cjs-dev/components/chip/index.d.cts +1 -0
  73. package/dist/cjs-dev/components/combobox/daikin-combobox.cjs +604 -0
  74. package/dist/cjs-dev/components/combobox/daikin-combobox.d.cts +134 -0
  75. package/dist/cjs-dev/components/combobox/index.cjs +8 -0
  76. package/dist/cjs-dev/components/combobox/index.d.cts +1 -0
  77. package/dist/cjs-dev/components/date-picker/daikin-date-picker.cjs +31 -16
  78. package/dist/cjs-dev/components/date-picker/daikin-date-picker.d.cts +2 -1
  79. package/dist/cjs-dev/components/dropdown/daikin-dropdown.cjs +52 -37
  80. package/dist/cjs-dev/components/dropdown/daikin-dropdown.d.cts +4 -3
  81. package/dist/cjs-dev/components/icon/daikin-icon.cjs +141 -16
  82. package/dist/cjs-dev/components/icon/daikin-icon.d.cts +141 -9
  83. package/dist/cjs-dev/components/icon/icons.json.cjs +5 -1
  84. package/dist/cjs-dev/components/icon-button/daikin-icon-button.cjs +12 -2
  85. package/dist/cjs-dev/components/icon-button/daikin-icon-button.d.cts +8 -0
  86. package/dist/cjs-dev/components/index.cjs +36 -0
  87. package/dist/cjs-dev/components/index.d.cts +5 -0
  88. package/dist/cjs-dev/components/input-group/daikin-input-group.cjs +1 -1
  89. package/dist/cjs-dev/components/input-group/daikin-input-group.d.cts +40 -13
  90. package/dist/cjs-dev/components/list-item/daikin-list-item.cjs +2 -2
  91. package/dist/cjs-dev/components/modal-header/daikin-modal-header.cjs +1 -1
  92. package/dist/cjs-dev/components/progress-bar/daikin-progress-bar.cjs +3 -3
  93. package/dist/cjs-dev/components/select/daikin-select.cjs +6 -1
  94. package/dist/cjs-dev/components/tab/daikin-tab.cjs +1 -0
  95. package/dist/cjs-dev/components/table/daikin-table.cjs +36 -15
  96. package/dist/cjs-dev/components/table/daikin-table.d.cts +67 -34
  97. package/dist/cjs-dev/components/table-header-cell/daikin-table-header-cell.cjs +31 -6
  98. package/dist/cjs-dev/components/table-header-cell/daikin-table-header-cell.d.cts +7 -0
  99. package/dist/cjs-dev/components/text-field/daikin-text-field.cjs +191 -56
  100. package/dist/cjs-dev/components/text-field/daikin-text-field.d.cts +32 -3
  101. package/dist/cjs-dev/components/text-field/number-utils.cjs +64 -0
  102. package/dist/cjs-dev/components/text-field/number-utils.d.cts +26 -0
  103. package/dist/cjs-dev/components/text-masked-field/daikin-text-masked-field.cjs +312 -0
  104. package/dist/cjs-dev/components/text-masked-field/daikin-text-masked-field.d.cts +136 -0
  105. package/dist/cjs-dev/components/text-masked-field/index.cjs +7 -0
  106. package/dist/cjs-dev/components/text-masked-field/index.d.cts +1 -0
  107. package/dist/cjs-dev/components/time-picker/daikin-time-picker.cjs +589 -0
  108. package/dist/cjs-dev/components/time-picker/daikin-time-picker.d.cts +165 -0
  109. package/dist/cjs-dev/components/time-picker/index.cjs +17 -0
  110. package/dist/cjs-dev/components/time-picker/index.d.cts +1 -0
  111. package/dist/cjs-dev/components/toast-notification-manager/daikin-toast-notification-manager.d.cts +1 -1
  112. package/dist/cjs-dev/components/tooltip/daikin-tooltip.cjs +12 -2
  113. package/dist/cjs-dev/components/tooltip/daikin-tooltip.d.cts +8 -1
  114. package/dist/cjs-dev/controllers/floating-ui-auto-update.cjs +22 -4
  115. package/dist/cjs-dev/controllers/floating-ui-auto-update.d.cts +12 -0
  116. package/dist/cjs-dev/icon-registry.cjs +170 -0
  117. package/dist/cjs-dev/icon-registry.d.cts +120 -0
  118. package/dist/cjs-dev/index.cjs +39 -0
  119. package/dist/cjs-dev/index.d.cts +1 -0
  120. package/dist/cjs-dev/tailwind.css.cjs +1 -1
  121. package/dist/cjs-dev/utils/notification-common.d.cts +1 -1
  122. package/dist/es/base/dds-element.js +1 -1
  123. package/dist/es/components/accordion-item/daikin-accordion-item.js +1 -0
  124. package/dist/es/components/avatar/daikin-avatar.js +1 -0
  125. package/dist/es/components/calendar/daikin-calendar.js +2 -0
  126. package/dist/es/components/card-header/daikin-card-header.js +1 -1
  127. package/dist/es/components/carousel/daikin-carousel.js +7 -3
  128. package/dist/es/components/carousel-item/daikin-carousel-item.js +2 -2
  129. package/dist/es/components/chip/daikin-chip.d.ts +36 -0
  130. package/dist/es/components/chip/daikin-chip.js +107 -0
  131. package/dist/es/components/chip/index.d.ts +1 -0
  132. package/dist/es/components/chip/index.js +4 -0
  133. package/dist/es/components/combobox/daikin-combobox.d.ts +134 -0
  134. package/dist/es/components/combobox/daikin-combobox.js +605 -0
  135. package/dist/es/components/combobox/index.d.ts +1 -0
  136. package/dist/es/components/combobox/index.js +5 -0
  137. package/dist/es/components/date-picker/daikin-date-picker.d.ts +2 -1
  138. package/dist/es/components/date-picker/daikin-date-picker.js +32 -17
  139. package/dist/es/components/dropdown/daikin-dropdown.d.ts +4 -3
  140. package/dist/es/components/dropdown/daikin-dropdown.js +52 -37
  141. package/dist/es/components/icon/daikin-icon.d.ts +141 -9
  142. package/dist/es/components/icon/daikin-icon.js +118 -13
  143. package/dist/es/components/icon/icons.json.js +4 -0
  144. package/dist/es/components/icon-button/daikin-icon-button.d.ts +8 -0
  145. package/dist/es/components/icon-button/daikin-icon-button.js +12 -2
  146. package/dist/es/components/index.d.ts +5 -0
  147. package/dist/es/components/index.js +22 -1
  148. package/dist/es/components/input-group/daikin-input-group.d.ts +40 -13
  149. package/dist/es/components/input-group/daikin-input-group.js +1 -1
  150. package/dist/es/components/list-item/daikin-list-item.js +2 -2
  151. package/dist/es/components/modal-header/daikin-modal-header.js +1 -1
  152. package/dist/es/components/progress-bar/daikin-progress-bar.js +3 -3
  153. package/dist/es/components/select/daikin-select.js +6 -1
  154. package/dist/es/components/tab/daikin-tab.js +1 -0
  155. package/dist/es/components/table/daikin-table.d.ts +67 -34
  156. package/dist/es/components/table/daikin-table.js +33 -12
  157. package/dist/es/components/table-header-cell/daikin-table-header-cell.d.ts +7 -0
  158. package/dist/es/components/table-header-cell/daikin-table-header-cell.js +31 -6
  159. package/dist/es/components/text-field/daikin-text-field.d.ts +32 -3
  160. package/dist/es/components/text-field/daikin-text-field.js +191 -56
  161. package/dist/es/components/text-field/number-utils.d.ts +26 -0
  162. package/dist/es/components/text-field/number-utils.js +61 -0
  163. package/dist/es/components/text-masked-field/daikin-text-masked-field.d.ts +136 -0
  164. package/dist/es/components/text-masked-field/daikin-text-masked-field.js +313 -0
  165. package/dist/es/components/text-masked-field/index.d.ts +1 -0
  166. package/dist/es/components/text-masked-field/index.js +4 -0
  167. package/dist/es/components/time-picker/daikin-time-picker.d.ts +165 -0
  168. package/dist/es/components/time-picker/daikin-time-picker.js +578 -0
  169. package/dist/es/components/time-picker/index.d.ts +1 -0
  170. package/dist/es/components/time-picker/index.js +14 -0
  171. package/dist/es/components/toast-notification-manager/daikin-toast-notification-manager.d.ts +1 -1
  172. package/dist/es/components/tooltip/daikin-tooltip.d.ts +8 -1
  173. package/dist/es/components/tooltip/daikin-tooltip.js +12 -2
  174. package/dist/es/controllers/floating-ui-auto-update.d.ts +12 -0
  175. package/dist/es/controllers/floating-ui-auto-update.js +22 -4
  176. package/dist/es/icon-registry.d.ts +120 -0
  177. package/dist/es/icon-registry.js +170 -0
  178. package/dist/es/index.d.ts +1 -0
  179. package/dist/es/index.js +25 -1
  180. package/dist/es/tailwind.css.js +1 -1
  181. package/dist/es/utils/notification-common.d.ts +1 -1
  182. package/dist/es-dev/base/dds-element.js +1 -1
  183. package/dist/es-dev/components/accordion-item/daikin-accordion-item.js +1 -0
  184. package/dist/es-dev/components/avatar/daikin-avatar.js +1 -0
  185. package/dist/es-dev/components/calendar/daikin-calendar.js +2 -0
  186. package/dist/es-dev/components/card-header/daikin-card-header.js +1 -1
  187. package/dist/es-dev/components/carousel/daikin-carousel.js +7 -3
  188. package/dist/es-dev/components/carousel-item/daikin-carousel-item.js +2 -2
  189. package/dist/es-dev/components/chip/daikin-chip.d.ts +36 -0
  190. package/dist/es-dev/components/chip/daikin-chip.js +107 -0
  191. package/dist/es-dev/components/chip/index.d.ts +1 -0
  192. package/dist/es-dev/components/chip/index.js +4 -0
  193. package/dist/es-dev/components/combobox/daikin-combobox.d.ts +134 -0
  194. package/dist/es-dev/components/combobox/daikin-combobox.js +605 -0
  195. package/dist/es-dev/components/combobox/index.d.ts +1 -0
  196. package/dist/es-dev/components/combobox/index.js +5 -0
  197. package/dist/es-dev/components/date-picker/daikin-date-picker.d.ts +2 -1
  198. package/dist/es-dev/components/date-picker/daikin-date-picker.js +32 -17
  199. package/dist/es-dev/components/dropdown/daikin-dropdown.d.ts +4 -3
  200. package/dist/es-dev/components/dropdown/daikin-dropdown.js +52 -37
  201. package/dist/es-dev/components/icon/daikin-icon.d.ts +141 -9
  202. package/dist/es-dev/components/icon/daikin-icon.js +142 -17
  203. package/dist/es-dev/components/icon/icons.json.js +4 -0
  204. package/dist/es-dev/components/icon-button/daikin-icon-button.d.ts +8 -0
  205. package/dist/es-dev/components/icon-button/daikin-icon-button.js +12 -2
  206. package/dist/es-dev/components/index.d.ts +5 -0
  207. package/dist/es-dev/components/index.js +22 -1
  208. package/dist/es-dev/components/input-group/daikin-input-group.d.ts +40 -13
  209. package/dist/es-dev/components/input-group/daikin-input-group.js +1 -1
  210. package/dist/es-dev/components/list-item/daikin-list-item.js +2 -2
  211. package/dist/es-dev/components/modal-header/daikin-modal-header.js +1 -1
  212. package/dist/es-dev/components/progress-bar/daikin-progress-bar.js +3 -3
  213. package/dist/es-dev/components/select/daikin-select.js +6 -1
  214. package/dist/es-dev/components/tab/daikin-tab.js +1 -0
  215. package/dist/es-dev/components/table/daikin-table.d.ts +67 -34
  216. package/dist/es-dev/components/table/daikin-table.js +36 -15
  217. package/dist/es-dev/components/table-header-cell/daikin-table-header-cell.d.ts +7 -0
  218. package/dist/es-dev/components/table-header-cell/daikin-table-header-cell.js +31 -6
  219. package/dist/es-dev/components/text-field/daikin-text-field.d.ts +32 -3
  220. package/dist/es-dev/components/text-field/daikin-text-field.js +191 -56
  221. package/dist/es-dev/components/text-field/number-utils.d.ts +26 -0
  222. package/dist/es-dev/components/text-field/number-utils.js +64 -0
  223. package/dist/es-dev/components/text-masked-field/daikin-text-masked-field.d.ts +136 -0
  224. package/dist/es-dev/components/text-masked-field/daikin-text-masked-field.js +313 -0
  225. package/dist/es-dev/components/text-masked-field/index.d.ts +1 -0
  226. package/dist/es-dev/components/text-masked-field/index.js +4 -0
  227. package/dist/es-dev/components/time-picker/daikin-time-picker.d.ts +165 -0
  228. package/dist/es-dev/components/time-picker/daikin-time-picker.js +590 -0
  229. package/dist/es-dev/components/time-picker/index.d.ts +1 -0
  230. package/dist/es-dev/components/time-picker/index.js +14 -0
  231. package/dist/es-dev/components/toast-notification-manager/daikin-toast-notification-manager.d.ts +1 -1
  232. package/dist/es-dev/components/tooltip/daikin-tooltip.d.ts +8 -1
  233. package/dist/es-dev/components/tooltip/daikin-tooltip.js +12 -2
  234. package/dist/es-dev/controllers/floating-ui-auto-update.d.ts +12 -0
  235. package/dist/es-dev/controllers/floating-ui-auto-update.js +22 -4
  236. package/dist/es-dev/icon-registry.d.ts +120 -0
  237. package/dist/es-dev/icon-registry.js +170 -0
  238. package/dist/es-dev/index.d.ts +1 -0
  239. package/dist/es-dev/index.js +25 -1
  240. package/dist/es-dev/tailwind.css.js +1 -1
  241. package/dist/es-dev/utils/notification-common.d.ts +1 -1
  242. package/icons/number-minus.svg +5 -0
  243. package/icons/number-plus.svg +5 -0
  244. package/package.json +14 -4
  245. package/icons/dropdown-chevron-down.svg +0 -3
@@ -44,11 +44,31 @@ const cvaHeaderCell = cva(
44
44
  "focus-visible:-outline-offset-2",
45
45
  "focus-visible:outline-ddt-color-common-border-focus",
46
46
  "after:flex-none",
47
- "after:size-6",
48
- "after:i-daikin-sort"
47
+ "after:size-6"
49
48
  ]
49
+ },
50
+ order: {
51
+ asc: [],
52
+ desc: []
50
53
  }
51
- }
54
+ },
55
+ compoundVariants: [
56
+ {
57
+ sortable: true,
58
+ order: null,
59
+ class: ["after:i-daikin-sort"]
60
+ },
61
+ {
62
+ sortable: true,
63
+ order: "asc",
64
+ class: ["after:i-daikin-chevron-up"]
65
+ },
66
+ {
67
+ sortable: true,
68
+ order: "desc",
69
+ class: ["after:i-daikin-chevron-up", "after:rotate-180"]
70
+ }
71
+ ]
52
72
  }
53
73
  );
54
74
  let DaikinTableHeaderCell = class extends DDSElement {
@@ -56,14 +76,16 @@ let DaikinTableHeaderCell = class extends DDSElement {
56
76
  super(...arguments);
57
77
  this.alignment = "left";
58
78
  this.sortable = false;
79
+ this.order = null;
59
80
  }
60
81
  render() {
61
82
  const headerCellCN = cvaHeaderCell({
62
83
  alignment: this.alignment,
63
- sortable: this.sortable
84
+ sortable: this.sortable,
85
+ order: this.order === "asc" || this.order === "desc" ? this.order : null
64
86
  });
65
- const content = html`<slot name="left-icon" class="icon-size-6"></slot>
66
- <slot></slot>`;
87
+ const content = html`<slot name="left-icon" class="icon-size-6"></slot
88
+ ><slot></slot>`;
67
89
  return this.sortable ? html`<button
68
90
  type="button"
69
91
  class=${headerCellCN}
@@ -88,6 +110,9 @@ __decorateClass([
88
110
  __decorateClass([
89
111
  property({ type: Boolean, reflect: true })
90
112
  ], DaikinTableHeaderCell.prototype, "sortable", 2);
113
+ __decorateClass([
114
+ property({ type: String, reflect: true })
115
+ ], DaikinTableHeaderCell.prototype, "order", 2);
91
116
  DaikinTableHeaderCell = __decorateClass([
92
117
  ddsElement("daikin-table-header-cell")
93
118
  ], DaikinTableHeaderCell);
@@ -15,10 +15,18 @@ import { DaikinInputGroup } from "../input-group/index.js";
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
- * Ignored if the type is "search" since the default icon is used.
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
- * Ignored if the type is "search" since the default icon is used.
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>;
@@ -7,7 +7,9 @@ import { ddsElement } from "../../base/decorators.js";
7
7
  import "../../base/define.js";
8
8
  import { DDSFormElement } from "../../base/dds-form-element.js";
9
9
  import tailwindStyles from "../../tailwind.css.js";
10
+ import { isSimpleKeyEvent } from "../../utils/is-simple-key.js";
10
11
  import "../icon-button/daikin-icon-button.js";
12
+ import { updateNumberValue } from "./number-utils.js";
11
13
  var __defProp = Object.defineProperty;
12
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
15
  var __decorateClass = (decorators, target, key, kind) => {
@@ -24,6 +26,8 @@ const cvaInput = cva(
24
26
  "items-center",
25
27
  "w-full",
26
28
  "h-full",
29
+ "pl-[--pl,1rem]",
30
+ "pr-[--pr,1rem]",
27
31
  "bg-ddt-color-common-background-default",
28
32
  "relative",
29
33
  "rounded",
@@ -62,21 +66,38 @@ const cvaInput = cva(
62
66
  true: ["enabled:var-color-ddt-color-common-danger-default/color-base"]
63
67
  },
64
68
  leftIcon: {
65
- false: ["pl-4"],
66
- true: ["pl-11"]
69
+ false: [],
70
+ true: []
67
71
  },
68
72
  rightIcon: {
69
- false: ["pr-4"],
70
- true: ["pr-11"]
73
+ false: [],
74
+ true: []
71
75
  },
72
76
  type: {
73
77
  text: [],
74
- password: [],
78
+ number: ["[--pr:5.5rem]"],
79
+ password: ["[--pr:2.75rem]"],
75
80
  email: [],
76
81
  tel: [],
77
- search: ["[&::-webkit-search-cancel-button]:appearance-none"]
82
+ search: [
83
+ "[&::-webkit-search-cancel-button]:appearance-none",
84
+ "[--pl:2.75rem]",
85
+ "[--pr:2.75rem]"
86
+ ]
78
87
  }
79
- }
88
+ },
89
+ compoundVariants: [
90
+ {
91
+ type: ["text", "email", "tel", "number", "password"],
92
+ leftIcon: true,
93
+ class: ["[--pl:2.75rem]"]
94
+ },
95
+ {
96
+ type: ["text", "email", "tel"],
97
+ rightIcon: true,
98
+ class: ["[--pr:2.75rem]"]
99
+ }
100
+ ]
80
101
  }
81
102
  );
82
103
  const cvaIcon = cva(
@@ -113,6 +134,9 @@ let DaikinTextField = class extends DDSFormElement {
113
134
  this.error = false;
114
135
  this.minlength = null;
115
136
  this.maxlength = null;
137
+ this.step = null;
138
+ this.min = null;
139
+ this.max = null;
116
140
  this.pattern = null;
117
141
  this.showPassword = false;
118
142
  this._label = null;
@@ -137,26 +161,140 @@ let DaikinTextField = class extends DDSFormElement {
137
161
  }
138
162
  _handleInput(event) {
139
163
  this.value = event.target.value;
140
- this.setFormValue(this.value);
141
164
  }
142
165
  _handleClearClick() {
143
166
  this.value = "";
167
+ this.dispatchEvent(
168
+ new Event("input", {
169
+ bubbles: true,
170
+ composed: true
171
+ })
172
+ );
173
+ this.dispatchEvent(
174
+ new Event("change", {
175
+ bubbles: true
176
+ })
177
+ );
178
+ }
179
+ _handleKeyDown(event) {
180
+ if (this.type === "number") {
181
+ if (isSimpleKeyEvent(event) && event.key.length === 1) {
182
+ const { value, selectionStart, selectionEnd } = event.target;
183
+ const selectionText = value.substring(
184
+ selectionStart ?? 0,
185
+ selectionEnd ?? 0
186
+ );
187
+ if (/^[0-9]$/.test(event.key)) {
188
+ return;
189
+ }
190
+ if (event.key === "-") {
191
+ if ((!value.includes("-") || selectionText.includes("-")) && selectionStart === 0) {
192
+ return;
193
+ }
194
+ }
195
+ if (event.key === ".") {
196
+ if (!value.includes(".") || selectionText.includes(".")) {
197
+ return;
198
+ }
199
+ }
200
+ event.preventDefault();
201
+ return;
202
+ }
203
+ const direction = {
204
+ ArrowUp: 1,
205
+ ArrowDown: -1
206
+ }[event.key];
207
+ if (direction != null) {
208
+ event.preventDefault();
209
+ this._updateNumberValue(direction);
210
+ }
211
+ }
212
+ }
213
+ _updateNumberValue(sign) {
214
+ const newValue = updateNumberValue(this.value || "0", sign, {
215
+ step: this.step,
216
+ min: this.min,
217
+ max: this.max
218
+ });
219
+ if (newValue === this.value) {
220
+ return;
221
+ }
222
+ this.value = newValue;
223
+ this.dispatchEvent(
224
+ new Event("input", {
225
+ bubbles: true,
226
+ composed: true
227
+ })
228
+ );
229
+ this.dispatchEvent(
230
+ new Event("change", {
231
+ bubbles: true
232
+ })
233
+ );
144
234
  }
145
235
  _createIcon() {
236
+ const leftIconSlot = html`<span
237
+ class=${cvaIcon({
238
+ icon: "left",
239
+ disabled: this.disabled
240
+ })}
241
+ >
242
+ <slot
243
+ name="left-icon"
244
+ class="icon-size-6"
245
+ @slotchange=${this._handleSlotChange}
246
+ ></slot>
247
+ </span>`;
248
+ const rightIconSlot = html`<span
249
+ class=${cvaIcon({
250
+ icon: "right",
251
+ disabled: this.disabled
252
+ })}
253
+ >
254
+ <slot
255
+ name="right-icon"
256
+ class="icon-size-6"
257
+ @slotchange=${this._handleSlotChange}
258
+ ></slot>
259
+ </span>`;
146
260
  switch (this.type) {
261
+ case "number":
262
+ return html`${leftIconSlot}
263
+ <span class="inline-flex items-center gap-1 absolute right-2">
264
+ <daikin-icon-button
265
+ color="neutral"
266
+ variant="ghost"
267
+ ?disabled=${this.disabled}
268
+ button-aria-label="Decrease"
269
+ tabindex="-1"
270
+ @click=${() => this._updateNumberValue(-1)}
271
+ >
272
+ <span class="i-daikin-number-minus icon-size-6"></span>
273
+ </daikin-icon-button>
274
+ <daikin-icon-button
275
+ color="neutral"
276
+ variant="ghost"
277
+ ?disabled=${this.disabled}
278
+ button-aria-label="Increase"
279
+ tabindex="-1"
280
+ @click=${() => this._updateNumberValue(1)}
281
+ >
282
+ <span class="i-daikin-number-plus icon-size-6"></span>
283
+ </daikin-icon-button>
284
+ </span>`;
147
285
  case "password":
148
- return html`<daikin-icon-button
149
- color="neutral"
150
- variant="ghost"
151
- ?disabled=${this.disabled}
152
- button-aria-label=${this.showPassword ? "Hide password" : "Show password"}
153
- class="absolute right-3"
154
- @click=${this._handleShowPasswordClick}
155
- >
156
- <span
157
- class=${cvaShowPasswordIcon({ showPassword: this.showPassword })}
158
- ></span>
159
- </daikin-icon-button>`;
286
+ return html`${leftIconSlot}<daikin-icon-button
287
+ color="neutral"
288
+ variant="ghost"
289
+ ?disabled=${this.disabled}
290
+ button-aria-label=${this.showPassword ? "Hide password" : "Show password"}
291
+ class="absolute right-3"
292
+ @click=${this._handleShowPasswordClick}
293
+ >
294
+ <span
295
+ class=${cvaShowPasswordIcon({ showPassword: this.showPassword })}
296
+ ></span>
297
+ </daikin-icon-button>`;
160
298
  case "search":
161
299
  return html`<span
162
300
  class=${cvaIcon({
@@ -177,30 +315,7 @@ let DaikinTextField = class extends DDSFormElement {
177
315
  <span class="i-daikin-close"></span>
178
316
  </daikin-icon-button>` : nothing}`;
179
317
  default:
180
- return html`<span
181
- class=${cvaIcon({
182
- icon: "left",
183
- disabled: this.disabled
184
- })}
185
- >
186
- <slot
187
- name="left-icon"
188
- class="icon-size-6"
189
- @slotchange=${this._handleSlotChange}
190
- ></slot>
191
- </span>
192
- <span
193
- class=${cvaIcon({
194
- icon: "right",
195
- disabled: this.disabled
196
- })}
197
- >
198
- <slot
199
- name="right-icon"
200
- class="icon-size-6"
201
- @slotchange=${this._handleSlotChange}
202
- ></slot>
203
- </span>`;
318
+ return html`${leftIconSlot}${rightIconSlot}`;
204
319
  }
205
320
  }
206
321
  _handleShowPasswordClick() {
@@ -209,38 +324,49 @@ let DaikinTextField = class extends DDSFormElement {
209
324
  }
210
325
  render() {
211
326
  const error = !this.disabled && this.error;
212
- const hasLeftSlot = this._hasLeftSlot;
213
- const hasRightSlot = this._hasRightSlot;
214
- const [leftIcon, rightIcon] = {
215
- password: [false, true],
216
- search: [true, !!this.value.length],
217
- email: [hasLeftSlot, hasRightSlot],
218
- tel: [hasLeftSlot, hasRightSlot],
219
- text: [hasLeftSlot, hasRightSlot]
220
- }[this.type];
221
- const type = this.type === "password" && this.showPassword ? "text" : this.type;
327
+ const type = this.type === "password" && this.showPassword ? "text" : this.type === "number" ? "text" : this.type;
328
+ const role = this.type === "number" ? "spinbutton" : void 0;
329
+ const inputMode = this.type === "number" ? "numeric" : void 0;
222
330
  return html`<input
223
331
  class=${cvaInput({
224
332
  error,
225
- leftIcon,
226
- rightIcon,
333
+ leftIcon: this._hasLeftSlot,
334
+ rightIcon: this._hasRightSlot,
227
335
  type: this.type
228
336
  })}
337
+ role=${ifDefined(role)}
229
338
  type=${type}
339
+ inputmode=${ifDefined(inputMode)}
230
340
  placeholder=${ifDefined(this.placeholder ?? void 0)}
231
341
  name=${ifDefined(this.name)}
232
342
  minlength=${ifDefined(this.minlength ?? void 0)}
233
343
  maxlength=${ifDefined(this.maxlength ?? void 0)}
344
+ step=${ifDefined(
345
+ this.type === "number" && this.step != null ? (
346
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
347
+ this.step
348
+ ) : void 0
349
+ )}
234
350
  pattern=${ifDefined(this.pattern ?? void 0)}
235
351
  autocomplete=${// eslint-disable-next-line @typescript-eslint/no-explicit-any -- workaround lit-analyzer checking
236
352
  ifDefined(this.autocomplete)}
237
353
  aria-label=${ifDefined(this._label ?? void 0)}
354
+ aria-valuemin=${ifDefined(
355
+ this.type === "number" && this.min != null ? this.min : void 0
356
+ )}
357
+ aria-valuemax=${ifDefined(
358
+ this.type === "number" && this.max != null ? this.max : void 0
359
+ )}
360
+ aria-valuenow=${ifDefined(
361
+ this.type === "number" ? this.value : void 0
362
+ )}
238
363
  .value=${this.value}
239
364
  ?disabled=${this.disabled}
240
365
  ?readonly=${this.readonly}
241
366
  ?required=${this.required}
242
367
  @change=${this._handleChange}
243
368
  @input=${this._handleInput}
369
+ @keydown=${this._handleKeyDown}
244
370
  />
245
371
  ${this._createIcon()}`;
246
372
  }
@@ -304,6 +430,15 @@ __decorateClass([
304
430
  __decorateClass([
305
431
  property({ type: Number, reflect: true })
306
432
  ], DaikinTextField.prototype, "maxlength", 2);
433
+ __decorateClass([
434
+ property({ type: String, reflect: true })
435
+ ], DaikinTextField.prototype, "step", 2);
436
+ __decorateClass([
437
+ property({ type: String, reflect: true })
438
+ ], DaikinTextField.prototype, "min", 2);
439
+ __decorateClass([
440
+ property({ type: String, reflect: true })
441
+ ], DaikinTextField.prototype, "max", 2);
307
442
  __decorateClass([
308
443
  property({ type: String, reflect: true })
309
444
  ], DaikinTextField.prototype, "pattern", 2);
@@ -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;
@@ -0,0 +1,61 @@
1
+ import Big from "big.js";
2
+ function updateNumberValue(currentValue, direction, options) {
3
+ const { step, min, max } = options;
4
+ try {
5
+ const current = new Big(currentValue || "0");
6
+ const stepBig = new Big(step || "1");
7
+ const minBig = min != null && min !== "" ? new Big(min) : null;
8
+ const maxBig = max != null && max !== "" ? new Big(max) : null;
9
+ if (minBig && maxBig && maxBig.lt(minBig)) {
10
+ return direction === 1 ? minBig.toString() : maxBig.toString();
11
+ }
12
+ const isOnStepBoundary = (value) => {
13
+ const diff = value.sub(minBig ?? 0);
14
+ return diff.mod(stepBig).eq(0);
15
+ };
16
+ const findNearestStepInDirection = (value, dir) => {
17
+ const base = minBig || new Big(0);
18
+ const offset = value.sub(base);
19
+ const steps = offset.div(stepBig);
20
+ let targetSteps;
21
+ if (dir === 1) {
22
+ targetSteps = steps.round(0, Big.roundUp);
23
+ } else {
24
+ targetSteps = steps.round(0, Big.roundDown);
25
+ }
26
+ return base.add(targetSteps.mul(stepBig));
27
+ };
28
+ const isInRange = (!minBig || current.gte(minBig)) && (!maxBig || current.lte(maxBig));
29
+ if (!isInRange || !isOnStepBoundary(current)) {
30
+ if (!isInRange) {
31
+ const isBelowMin = minBig && current.lt(minBig);
32
+ const isAboveMax = maxBig && current.gt(maxBig);
33
+ if (isBelowMin && direction === -1 || isAboveMax && direction === 1) {
34
+ return currentValue;
35
+ }
36
+ }
37
+ let nearestStep = findNearestStepInDirection(current, direction);
38
+ if (minBig && nearestStep.lt(minBig)) {
39
+ nearestStep = minBig;
40
+ }
41
+ if (maxBig && nearestStep.gt(maxBig)) {
42
+ nearestStep = maxBig;
43
+ }
44
+ return nearestStep.toString();
45
+ }
46
+ const newValue = direction === 1 ? current.add(stepBig) : current.sub(stepBig);
47
+ let result = newValue;
48
+ if (minBig && result.lt(minBig)) {
49
+ result = minBig;
50
+ }
51
+ if (maxBig && result.gt(maxBig)) {
52
+ result = maxBig;
53
+ }
54
+ return result.toString();
55
+ } catch (error) {
56
+ return currentValue;
57
+ }
58
+ }
59
+ export {
60
+ updateNumberValue
61
+ };
@@ -0,0 +1,136 @@
1
+ import { InputMask, FactoryOpts } from 'imask';
2
+ import { PropertyValues, TemplateResult } from 'lit';
3
+ import { DDSFormElement } from "../../base/dds-form-element.js";
4
+ import { DaikinInputGroup } from "../input-group/index.js";
5
+ export type { FactoryOpts, InputMask };
6
+ /**
7
+ * The text masked field component is a UI element that allows users to input single-line text data with input masking support.
8
+ * It functions similarly to the HTML `<input type="text">` tag, providing a simple and efficient way for users to enter and edit short pieces of texts with masking functionality using IMask.js.
9
+ * Can be used within `daikin-input-group` component.
10
+ *
11
+ * Hierarchies:
12
+ * - `daikin-text-masked-field` (can be used solely)
13
+ * - `daikin-input-group` > `daikin-text-masked-field`
14
+ *
15
+ * @fires change - A cloned event of a [change event](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/change_event) emitted from the inner `<input>` element.
16
+ * @fires input - A retargeted event of a [input event](https://developer.mozilla.org/en-US/docs/Web/API/Element/input_event).
17
+ *
18
+ * @slot left-icon - Specify the icon you want to use on the left. You can also use something other than `daikin-icon`.
19
+ *
20
+ * @slot right-icon - Specify the icon you want to use on the right. You can also use something other than `daikin-icon`.
21
+ *
22
+ * @example
23
+ *
24
+ * ```js
25
+ * import "@daikin-oss/design-system-web-components/components/text-masked-field/index.js";
26
+ * ```
27
+ *
28
+ * ```html
29
+ * <!-- See `daikin-input-group` component for complete example. -->
30
+ * <daikin-text-masked-field name="name"></daikin-text-masked-field>
31
+ *
32
+ * <script>
33
+ * const textField = document.querySelector("daikin-text-masked-field");
34
+ * textField.mask = "00/00/0000";
35
+ * </script>
36
+ * ```
37
+ */
38
+ export declare class DaikinTextMaskedField extends DDSFormElement {
39
+ static readonly styles: import('lit').CSSResult;
40
+ /**
41
+ * Placeholder text.
42
+ */
43
+ placeholder: string | null;
44
+ /**
45
+ * Whether the text masked field is readonly.
46
+ */
47
+ readonly: boolean;
48
+ /**
49
+ * Whether the text masked field is disabled.
50
+ * Controlled by `daikin-input-group` when used within `daikin-input-group`.
51
+ */
52
+ disabled: boolean;
53
+ /**
54
+ * Whether the text masked field is required.
55
+ * Controlled by `daikin-input-group` when used within `daikin-input-group`.
56
+ */
57
+ required: boolean;
58
+ /**
59
+ * Whether or not to display error states.
60
+ * Ignored if the `disabled` is `true`.
61
+ * Controlled by `daikin-input-group` when used within `daikin-input-group`.
62
+ */
63
+ error: boolean;
64
+ /**
65
+ * Minimum length of value.
66
+ */
67
+ minlength: number | null;
68
+ /**
69
+ * Maximum length of value.
70
+ */
71
+ maxlength: number | null;
72
+ /**
73
+ * The pattern of value.
74
+ */
75
+ pattern: string | null;
76
+ /**
77
+ * Input mask configuration. When provided as a string, it will be used as `{ mask: string, lazy: false }`.
78
+ * When provided as an object, it will be passed directly to IMask.
79
+ *
80
+ * Pattern symbols:
81
+ * - `0` - any digit
82
+ * - `a` - any letter
83
+ * - `*` - any char
84
+ * - `[]` - make input optional
85
+ * - `{}` - include fixed part in unmasked value
86
+ * - `` ` `` - prevent symbols shift back
87
+ * - Other chars are treated as fixed
88
+ * - Use `\\` to escape definition characters (e.g., `\\0`)
89
+ *
90
+ * Examples:
91
+ * - `"00/00/0000"` - date format (MM/DD/YYYY)
92
+ * - `"{#}000[aaa]/NIC-\`*[**]"` - complex pattern with optional parts
93
+ *
94
+ * For more details, see: https://imask.js.org/guide.html#masked-pattern
95
+ */
96
+ mask: string | FactoryOpts | null;
97
+ /**
98
+ * Value of `autocomplete` attribute of the internal `<input>`.
99
+ */
100
+ autocomplete?: HTMLInputElement["autocomplete"];
101
+ private _unmaskedValue;
102
+ /**
103
+ * The label text used as the value of aria-label.
104
+ * Set automatically by `reflectInputGroup` method.
105
+ */
106
+ private _label;
107
+ private _hasLeftSlot;
108
+ private _hasRightSlot;
109
+ private _inputRef;
110
+ private _maskInstance;
111
+ private _initializeMask;
112
+ private _destroyMask;
113
+ /**
114
+ * The unmasked value of the input.
115
+ */
116
+ get unmaskedValue(): string;
117
+ set unmaskedValue(value: string);
118
+ connectedCallback(): void;
119
+ disconnectedCallback(): void;
120
+ private _handleChange;
121
+ private _handleSlotChange;
122
+ private _handleInput;
123
+ private _createIcon;
124
+ render(): TemplateResult<1>;
125
+ updated(changedProperties: PropertyValues<this>): void;
126
+ /**
127
+ * This method is used by `daikin-input-group` to reflect it's attributes to this component.
128
+ * @private
129
+ */
130
+ reflectInputGroup(inputGroup: DaikinInputGroup): void;
131
+ }
132
+ declare global {
133
+ interface HTMLElementTagNameMap {
134
+ "daikin-text-masked-field": DaikinTextMaskedField;
135
+ }
136
+ }