@mintplayer/web-components 1.0.0 → 1.1.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 (236) hide show
  1. package/a11y/index.mjs +2 -56
  2. package/calendar/index.mjs +2 -363
  3. package/checkbox/index.mjs +4 -0
  4. package/checkbox/src/components/index.d.ts +2 -0
  5. package/checkbox/src/components/mp-checkbox.d.ts +69 -0
  6. package/checkbox/src/index.d.ts +2 -0
  7. package/chunks/color-C4VT0EL7.mjs +847 -0
  8. package/chunks/form-check.styles-jBlHetYX.mjs +151 -0
  9. package/chunks/live-announcer-CZDTKulf.mjs +58 -0
  10. package/chunks/mp-calendar.element-UC68iDbi.mjs +365 -0
  11. package/chunks/mp-checkbox-BokLL7BS.mjs +211 -0
  12. package/chunks/mp-datatable-CpAu8JJD.mjs +750 -0
  13. package/chunks/mp-pagination-BGxsawFL.mjs +326 -0
  14. package/chunks/mp-select-BDS1-YGn.mjs +254 -0
  15. package/chunks/mp-splitter-C8cGCmac.mjs +633 -0
  16. package/chunks/mp-tab-page-D1b4x-y2.mjs +414 -0
  17. package/chunks/mp-timepicker.element-BwEiwX92.mjs +428 -0
  18. package/chunks/mp-toggle-button-dLZNDUVz.mjs +534 -0
  19. package/chunks/mp-treeview-Bfq4_IVW.mjs +474 -0
  20. package/code-snippet/index.mjs +16 -13
  21. package/datatable/index.mjs +7 -0
  22. package/datatable/src/components/index.d.ts +2 -0
  23. package/datatable/src/components/mp-datatable.d.ts +156 -0
  24. package/datatable/src/index.d.ts +6 -0
  25. package/datatable/src/sort/compute-next-sort.d.ts +18 -0
  26. package/datatable/src/sort/index.d.ts +3 -0
  27. package/datatable/src/sort/sort-rows.d.ts +6 -0
  28. package/datatable/src/styles/datatable.styles.d.ts +2 -0
  29. package/datatable/src/styles/index.d.ts +1 -0
  30. package/datatable/src/types/column-def.d.ts +30 -0
  31. package/datatable/src/types/index.d.ts +1 -0
  32. package/datepicker/index.mjs +240 -0
  33. package/datepicker/src/index.d.ts +1 -0
  34. package/datepicker/src/mp-datepicker.element.d.ts +94 -0
  35. package/datepicker/src/mp-datepicker.element.template.d.ts +2 -0
  36. package/datetime-picker/index.mjs +427 -0
  37. package/datetime-picker/src/index.d.ts +1 -0
  38. package/datetime-picker/src/mp-datetime-picker.element.d.ts +174 -0
  39. package/datetime-picker/src/mp-datetime-picker.element.template.d.ts +2 -0
  40. package/dock/index.mjs +2402 -0
  41. package/dock/src/components/index.d.ts +1 -0
  42. package/dock/src/components/mint-dock-manager.element.d.ts +313 -0
  43. package/dock/src/components/mint-dock-manager.element.template.d.ts +2 -0
  44. package/dock/src/index.d.ts +2 -0
  45. package/dock/src/types/dock-layout.d.ts +65 -0
  46. package/dock/src/types/index.d.ts +1 -0
  47. package/file-manager/index.mjs +1263 -0
  48. package/file-manager/src/components/index.d.ts +2 -0
  49. package/file-manager/src/components/mp-file-manager.d.ts +320 -0
  50. package/file-manager/src/index.d.ts +5 -0
  51. package/file-manager/src/styles/file-manager.styles.d.ts +2 -0
  52. package/file-manager/src/styles/index.d.ts +1 -0
  53. package/file-manager/src/types/file-system-node.d.ts +24 -0
  54. package/file-manager/src/types/index.d.ts +3 -0
  55. package/file-manager/src/types/messages.d.ts +43 -0
  56. package/multi-range/index.mjs +407 -0
  57. package/multi-range/src/index.d.ts +2 -0
  58. package/multi-range/src/mint-multi-range.element.d.ts +124 -0
  59. package/multi-range/src/mint-multi-range.element.template.d.ts +2 -0
  60. package/multi-range/src/types/multi-range-orientation.d.ts +1 -0
  61. package/otp-input/index.mjs +362 -0
  62. package/otp-input/src/index.d.ts +4 -0
  63. package/otp-input/src/mint-otp-input.element.d.ts +134 -0
  64. package/otp-input/src/mint-otp-input.element.template.d.ts +2 -0
  65. package/otp-input/src/types/otp-input-case.d.ts +1 -0
  66. package/otp-input/src/types/otp-input-size.d.ts +1 -0
  67. package/otp-input/src/types/otp-input-type.d.ts +1 -0
  68. package/overlay/index.mjs +260 -0
  69. package/overlay/src/index.d.ts +2 -0
  70. package/overlay/src/overlay-controller.d.ts +205 -0
  71. package/package.json +1 -1
  72. package/pagination/index.mjs +5 -0
  73. package/pagination/src/components/index.d.ts +2 -0
  74. package/pagination/src/components/mp-pagination.d.ts +95 -0
  75. package/pagination/src/index.d.ts +2 -0
  76. package/pagination/src/styles/index.d.ts +1 -0
  77. package/pagination/src/styles/pagination.styles.d.ts +2 -0
  78. package/query-builder/index.mjs +3720 -0
  79. package/query-builder/src/context.d.ts +14 -0
  80. package/query-builder/src/dnd/drag-controller.d.ts +69 -0
  81. package/query-builder/src/index.d.ts +23 -0
  82. package/query-builder/src/model/default-tree.d.ts +7 -0
  83. package/query-builder/src/model/editor.d.ts +15 -0
  84. package/query-builder/src/model/errors.d.ts +6 -0
  85. package/query-builder/src/model/expression.d.ts +22 -0
  86. package/query-builder/src/model/field-def.d.ts +17 -0
  87. package/query-builder/src/model/messages.d.ts +17 -0
  88. package/query-builder/src/model/operator-overrides.d.ts +21 -0
  89. package/query-builder/src/model/operators.d.ts +8 -0
  90. package/query-builder/src/model/saved-query.d.ts +6 -0
  91. package/query-builder/src/model/sort.d.ts +9 -0
  92. package/query-builder/src/model/tree-ops.d.ts +56 -0
  93. package/query-builder/src/mp-query-builder.element.d.ts +158 -0
  94. package/query-builder/src/mp-query-builder.element.template.d.ts +2 -0
  95. package/query-builder/src/mp-query-condition.element.d.ts +44 -0
  96. package/query-builder/src/mp-query-condition.element.template.d.ts +2 -0
  97. package/query-builder/src/mp-query-group.element.d.ts +52 -0
  98. package/query-builder/src/mp-query-group.element.template.d.ts +2 -0
  99. package/query-builder/src/mp-query-subquery.element.d.ts +37 -0
  100. package/query-builder/src/mp-query-subquery.element.template.d.ts +2 -0
  101. package/query-builder/src/preview/render-expression.d.ts +23 -0
  102. package/query-builder/src/value-editors/builtin-editors.d.ts +6 -0
  103. package/query-builder/src/visitor/visit-tree.d.ts +29 -0
  104. package/query-builder/src/visitor/visitor-types.d.ts +15 -0
  105. package/radio/index.mjs +162 -0
  106. package/radio/src/components/index.d.ts +2 -0
  107. package/radio/src/components/mp-radio.d.ts +63 -0
  108. package/radio/src/index.d.ts +2 -0
  109. package/ribbon/index.mjs +3151 -0
  110. package/ribbon/src/index.d.ts +10 -0
  111. package/ribbon/src/items/index.d.ts +15 -0
  112. package/ribbon/src/items/mp-ribbon-button.element.d.ts +10 -0
  113. package/ribbon/src/items/mp-ribbon-checkbox.element.d.ts +11 -0
  114. package/ribbon/src/items/mp-ribbon-color-picker.element.d.ts +12 -0
  115. package/ribbon/src/items/mp-ribbon-combobox.element.d.ts +19 -0
  116. package/ribbon/src/items/mp-ribbon-dropdown-button.element.d.ts +16 -0
  117. package/ribbon/src/items/mp-ribbon-gallery-item.element.d.ts +15 -0
  118. package/ribbon/src/items/mp-ribbon-gallery.element.d.ts +11 -0
  119. package/ribbon/src/items/mp-ribbon-group-button.element.d.ts +18 -0
  120. package/ribbon/src/items/mp-ribbon-item-base.d.ts +68 -0
  121. package/ribbon/src/items/mp-ribbon-menu-item.element.d.ts +13 -0
  122. package/ribbon/src/items/mp-ribbon-menu-separator.element.d.ts +6 -0
  123. package/ribbon/src/items/mp-ribbon-split-button.element.d.ts +23 -0
  124. package/ribbon/src/items/mp-ribbon-template-item.element.d.ts +12 -0
  125. package/ribbon/src/items/mp-ribbon-toggle-button.element.d.ts +12 -0
  126. package/ribbon/src/mp-quick-access-toolbar.element.d.ts +35 -0
  127. package/ribbon/src/mp-ribbon-contextual-tab-set.element.d.ts +18 -0
  128. package/ribbon/src/mp-ribbon-group.element.d.ts +59 -0
  129. package/ribbon/src/mp-ribbon-tab.element.d.ts +72 -0
  130. package/ribbon/src/mp-ribbon.element.d.ts +211 -0
  131. package/ribbon/src/types/ribbon.types.d.ts +4 -0
  132. package/scheduler/index.mjs +3567 -0
  133. package/scheduler/src/components/mp-scheduler.d.ts +238 -0
  134. package/scheduler/src/drag/drag-manager.d.ts +90 -0
  135. package/scheduler/src/drag/drag-preview.d.ts +42 -0
  136. package/scheduler/src/drag/drag-state-machine.d.ts +102 -0
  137. package/scheduler/src/drag/drag-types.d.ts +104 -0
  138. package/scheduler/src/drag/index.d.ts +4 -0
  139. package/scheduler/src/events/event-types.d.ts +58 -0
  140. package/scheduler/src/events/index.d.ts +2 -0
  141. package/scheduler/src/events/scheduler-event-emitter.d.ts +52 -0
  142. package/scheduler/src/index.d.ts +6 -0
  143. package/scheduler/src/input/index.d.ts +2 -0
  144. package/scheduler/src/input/input-handler.d.ts +105 -0
  145. package/scheduler/src/input/pointer-event.d.ts +39 -0
  146. package/scheduler/src/state/scheduler-state.d.ts +189 -0
  147. package/scheduler/src/styles/scheduler.styles.d.ts +2 -0
  148. package/scheduler/src/views/base-view.d.ts +87 -0
  149. package/scheduler/src/views/day-view.d.ts +25 -0
  150. package/scheduler/src/views/index.d.ts +6 -0
  151. package/scheduler/src/views/month-view.d.ts +27 -0
  152. package/scheduler/src/views/timeline-view.d.ts +23 -0
  153. package/scheduler/src/views/week-view.d.ts +28 -0
  154. package/scheduler/src/views/year-view.d.ts +25 -0
  155. package/scheduler-core/index.mjs +174 -0
  156. package/scheduler-core/src/index.d.ts +3 -0
  157. package/scheduler-core/src/models/drag-state.d.ts +43 -0
  158. package/scheduler-core/src/models/event.d.ts +111 -0
  159. package/scheduler-core/src/models/events.d.ts +108 -0
  160. package/scheduler-core/src/models/index.d.ts +7 -0
  161. package/scheduler-core/src/models/options.d.ts +88 -0
  162. package/scheduler-core/src/models/resource.d.ts +58 -0
  163. package/scheduler-core/src/models/time-slot.d.ts +31 -0
  164. package/scheduler-core/src/models/types.d.ts +20 -0
  165. package/scheduler-core/src/services/date.service.d.ts +140 -0
  166. package/scheduler-core/src/services/index.d.ts +4 -0
  167. package/scheduler-core/src/services/position.service.d.ts +35 -0
  168. package/scheduler-core/src/services/resource.service.d.ts +83 -0
  169. package/scheduler-core/src/services/timeline.service.d.ts +103 -0
  170. package/scheduler-core/src/utils/color.d.ts +24 -0
  171. package/scheduler-core/src/utils/dom.d.ts +54 -0
  172. package/scheduler-core/src/utils/id.d.ts +16 -0
  173. package/scheduler-core/src/utils/index.d.ts +3 -0
  174. package/select/index.mjs +4 -0
  175. package/select/src/components/index.d.ts +2 -0
  176. package/select/src/components/mp-select.d.ts +82 -0
  177. package/select/src/index.d.ts +2 -0
  178. package/splitter/index.mjs +10 -0
  179. package/splitter/src/components/index.d.ts +2 -0
  180. package/splitter/src/components/mp-splitter.d.ts +109 -0
  181. package/splitter/src/index.d.ts +11 -0
  182. package/splitter/src/input/index.d.ts +4 -0
  183. package/splitter/src/input/input-handler.d.ts +36 -0
  184. package/splitter/src/input/pointer-event.d.ts +9 -0
  185. package/splitter/src/managers/index.d.ts +2 -0
  186. package/splitter/src/managers/resize-manager.d.ts +13 -0
  187. package/splitter/src/state/index.d.ts +2 -0
  188. package/splitter/src/state/splitter-state.d.ts +24 -0
  189. package/splitter/src/styles/index.d.ts +1 -0
  190. package/splitter/src/styles/splitter.styles.d.ts +2 -0
  191. package/splitter/src/types/direction.d.ts +1 -0
  192. package/splitter/src/types/index.d.ts +5 -0
  193. package/splitter/src/types/panel-info.d.ts +6 -0
  194. package/splitter/src/types/point.d.ts +4 -0
  195. package/splitter/src/types/resize-operation.d.ts +13 -0
  196. package/tab-control/index.mjs +6 -0
  197. package/tab-control/src/components/index.d.ts +3 -0
  198. package/tab-control/src/components/mp-tab-control.d.ts +50 -0
  199. package/tab-control/src/components/mp-tab-page.d.ts +35 -0
  200. package/tab-control/src/index.d.ts +4 -0
  201. package/tab-control/src/styles/index.d.ts +1 -0
  202. package/tab-control/src/styles/tab-control.styles.d.ts +2 -0
  203. package/tab-control/src/types/index.d.ts +1 -0
  204. package/tab-control/src/types/tabs-position.d.ts +1 -0
  205. package/tile-manager/index.mjs +867 -0
  206. package/tile-manager/src/components/index.d.ts +2 -0
  207. package/tile-manager/src/components/mint-tile-manager.element.d.ts +204 -0
  208. package/tile-manager/src/components/mint-tile-manager.element.template.d.ts +2 -0
  209. package/tile-manager/src/index.d.ts +4 -0
  210. package/tile-manager/src/types/grid-rect.d.ts +12 -0
  211. package/tile-manager/src/types/index.d.ts +3 -0
  212. package/tile-manager/src/types/tile-layout-snapshot.d.ts +15 -0
  213. package/tile-manager/src/types/tile-position.d.ts +10 -0
  214. package/tile-manager/src/utils/index.d.ts +1 -0
  215. package/tile-manager/src/utils/pack.d.ts +24 -0
  216. package/timepicker/index.mjs +5 -0
  217. package/timepicker/src/index.d.ts +2 -0
  218. package/timepicker/src/mp-time-list.element.d.ts +76 -0
  219. package/timepicker/src/mp-time-list.element.template.d.ts +2 -0
  220. package/timepicker/src/mp-timepicker.element.d.ts +87 -0
  221. package/timepicker/src/mp-timepicker.element.template.d.ts +2 -0
  222. package/toggle-button/index.mjs +5 -0
  223. package/toggle-button/src/components/index.d.ts +2 -0
  224. package/toggle-button/src/components/mp-toggle-button.d.ts +50 -0
  225. package/toggle-button/src/index.d.ts +3 -0
  226. package/toggle-button/src/styles/index.d.ts +1 -0
  227. package/toggle-button/src/styles/toggle-button.styles.d.ts +2 -0
  228. package/treeview/index.mjs +5 -0
  229. package/treeview/src/components/index.d.ts +2 -0
  230. package/treeview/src/components/mp-treeview.d.ts +113 -0
  231. package/treeview/src/index.d.ts +4 -0
  232. package/treeview/src/styles/index.d.ts +1 -0
  233. package/treeview/src/styles/treeview.styles.d.ts +2 -0
  234. package/treeview/src/types/index.d.ts +1 -0
  235. package/treeview/src/types/tree-node.d.ts +14 -0
  236. package/custom-elements.json +0 -1774
@@ -0,0 +1,362 @@
1
+ import { html as b, unsafeCSS as m, LitElement as f } from "lit";
2
+ b`<!-- Hidden input + boxes are rendered dynamically by render(). This file exists
3
+ so the codegen-wc target produces a \`styles\` export from the sibling .scss;
4
+ the \`template\` export it generates here is intentionally unused. -->`;
5
+ const x = m(`:host {
6
+ display: inline-flex;
7
+ position: relative;
8
+ box-sizing: border-box;
9
+ --bs-otp-input-box-bg: var(--bs-body-bg, #fff);
10
+ --bs-otp-input-box-color: var(--bs-body-color, #212529);
11
+ --bs-otp-input-box-border: var(--bs-border-color, #ced4da);
12
+ --bs-otp-input-box-border-active: var(--bs-primary, #0d6efd);
13
+ --bs-otp-input-box-border-invalid: var(--bs-danger, #dc3545);
14
+ --bs-otp-input-box-shadow-focus: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
15
+ --bs-otp-input-box-shadow-invalid: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
16
+ --bs-otp-input-radius: 0.375rem;
17
+ --bs-otp-input-gap: 0.5rem;
18
+ --bs-otp-input-min-box-size: 2.875rem;
19
+ --bs-otp-input-font-size: 1.25rem;
20
+ --bs-otp-input-padding-y: 0.375rem;
21
+ --bs-otp-input-padding-x: 0.5rem;
22
+ }
23
+
24
+ :host([size=sm]) {
25
+ --bs-otp-input-min-box-size: 2.25rem;
26
+ --bs-otp-input-font-size: 1rem;
27
+ --bs-otp-input-gap: 0.375rem;
28
+ --bs-otp-input-padding-y: 0.25rem;
29
+ --bs-otp-input-padding-x: 0.4rem;
30
+ }
31
+
32
+ :host([size=lg]) {
33
+ --bs-otp-input-min-box-size: 3.5rem;
34
+ --bs-otp-input-font-size: 1.5rem;
35
+ --bs-otp-input-gap: 0.625rem;
36
+ --bs-otp-input-padding-y: 0.5rem;
37
+ --bs-otp-input-padding-x: 0.625rem;
38
+ }
39
+
40
+ :host([disabled]) {
41
+ cursor: not-allowed;
42
+ opacity: 0.65;
43
+ }
44
+
45
+ .container {
46
+ position: relative;
47
+ display: inline-flex;
48
+ align-items: center;
49
+ gap: var(--bs-otp-input-gap);
50
+ }
51
+
52
+ .hidden-input {
53
+ position: absolute;
54
+ inset: 0;
55
+ width: 100%;
56
+ height: 100%;
57
+ padding: 0;
58
+ margin: 0;
59
+ border: 0;
60
+ background: transparent;
61
+ color: transparent;
62
+ caret-color: transparent;
63
+ font-size: var(--bs-otp-input-font-size);
64
+ text-shadow: none;
65
+ z-index: 1;
66
+ outline: none;
67
+ -webkit-tap-highlight-color: transparent;
68
+ }
69
+
70
+ .hidden-input:focus {
71
+ outline: none;
72
+ }
73
+
74
+ .box {
75
+ position: relative;
76
+ display: inline-grid;
77
+ grid-template-areas: "stack";
78
+ align-items: center;
79
+ justify-items: center;
80
+ min-width: var(--bs-otp-input-min-box-size);
81
+ height: var(--bs-otp-input-min-box-size);
82
+ padding: var(--bs-otp-input-padding-y) var(--bs-otp-input-padding-x);
83
+ background: var(--bs-otp-input-box-bg);
84
+ color: var(--bs-otp-input-box-color);
85
+ border: 1px solid var(--bs-otp-input-box-border);
86
+ border-radius: var(--bs-otp-input-radius);
87
+ font-size: var(--bs-otp-input-font-size);
88
+ font-weight: 500;
89
+ line-height: 1;
90
+ font-family: var(--bs-font-monospace, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
91
+ letter-spacing: 0.125rem;
92
+ user-select: none;
93
+ white-space: pre;
94
+ transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
95
+ }
96
+
97
+ .box-spacer,
98
+ .box-content {
99
+ grid-area: stack;
100
+ line-height: 1;
101
+ white-space: pre;
102
+ }
103
+
104
+ .box-spacer {
105
+ visibility: hidden;
106
+ pointer-events: none;
107
+ }
108
+
109
+ .box.box-active {
110
+ border-color: var(--bs-otp-input-box-border-active);
111
+ box-shadow: var(--bs-otp-input-box-shadow-focus);
112
+ }
113
+
114
+ .box.box-invalid {
115
+ border-color: var(--bs-otp-input-box-border-invalid);
116
+ }
117
+
118
+ .box.box-invalid.box-active {
119
+ box-shadow: var(--bs-otp-input-box-shadow-invalid);
120
+ }
121
+
122
+ @media (prefers-reduced-motion: reduce) {
123
+ .box {
124
+ transition: none;
125
+ }
126
+ }`);
127
+ class o extends f {
128
+ constructor() {
129
+ super(...arguments), this.type = "numeric", this.case = "upper", this.size = "md", this.disabled = !1, this.label = null, this.invalid = !1, this._value = "", this._groups = [...o.DEFAULT_GROUPS], this._revealedIndex = null, this._revealedUntil = 0, this._revealTimer = null, this._inputEl = null, this._isFocused = !1, this.onInput = (e) => {
130
+ const t = e.target, s = t.value, i = this._value, a = i.length === this.totalLength() && i.length > 0, r = this.normaliseValue(s), n = r.length - i.length;
131
+ this.type === "password" && n === 1 ? this.scheduleReveal(r.length - 1) : n !== 1 && this.clearReveal(), this._value = r, t.value !== r && (t.value = r), this.requestUpdate(), this.dispatchValueChange(), r.length === this.totalLength() && !a && (this.clearReveal(), this.dispatchComplete());
132
+ }, this.onPaste = (e) => {
133
+ if (this.disabled) return;
134
+ e.preventDefault();
135
+ const t = e.clipboardData?.getData("text") ?? "", s = this._value, i = s.length === this.totalLength() && s.length > 0, a = this.normaliseValue(t);
136
+ this._value = a, this._inputEl && (this._inputEl.value = a), this.clearReveal(), this.requestUpdate(), this.dispatchValueChange(), a.length === this.totalLength() && !i && this.dispatchComplete();
137
+ }, this.onFocus = () => {
138
+ this._isFocused = !0, this.requestUpdate();
139
+ }, this.onBlur = () => {
140
+ this._isFocused = !1, this.clearReveal(), this.requestUpdate();
141
+ }, this.onCaretMove = () => {
142
+ this.requestUpdate();
143
+ };
144
+ }
145
+ static {
146
+ this.styles = [x];
147
+ }
148
+ static get observedAttributes() {
149
+ return [
150
+ ...super.observedAttributes ?? [],
151
+ "type",
152
+ "case",
153
+ "size",
154
+ "disabled",
155
+ "label",
156
+ "invalid",
157
+ "groups"
158
+ ];
159
+ }
160
+ static {
161
+ this.properties = {
162
+ value: { attribute: !1 },
163
+ groups: {
164
+ attribute: "groups",
165
+ converter: {
166
+ fromAttribute: (e) => {
167
+ if (!e) return [...o.DEFAULT_GROUPS];
168
+ const t = e.split(",").map((s) => Number(s.trim())).filter((s) => Number.isFinite(s));
169
+ return t.length > 0 ? t : [...o.DEFAULT_GROUPS];
170
+ },
171
+ toAttribute: (e) => Array.isArray(e) ? e.join(",") : null
172
+ },
173
+ reflect: !1
174
+ },
175
+ type: { attribute: "type", type: String, reflect: !0 },
176
+ case: { attribute: "case", type: String, reflect: !0 },
177
+ size: { attribute: "size", type: String, reflect: !0 },
178
+ disabled: { attribute: "disabled", type: Boolean, reflect: !0 },
179
+ label: { attribute: "label", type: String, reflect: !1 },
180
+ invalid: { attribute: "invalid", type: Boolean, reflect: !0 }
181
+ };
182
+ }
183
+ static {
184
+ this.MAX_GROUP_SIZE = 10;
185
+ }
186
+ static {
187
+ this.MAX_TOTAL = 40;
188
+ }
189
+ static {
190
+ this.DEFAULT_GROUPS = [1, 1, 1, 1, 1, 1];
191
+ }
192
+ static {
193
+ this.REVEAL_MS = 700;
194
+ }
195
+ static {
196
+ this.MASK_CHAR = "•";
197
+ }
198
+ get value() {
199
+ return this._value;
200
+ }
201
+ set value(e) {
202
+ const t = this._value, s = this.normaliseValue(e ?? "");
203
+ t !== s && (this._value = s, this.clearReveal(), this.requestUpdate("value", t));
204
+ }
205
+ get groups() {
206
+ return this._groups;
207
+ }
208
+ set groups(e) {
209
+ const t = this._groups, s = this.normaliseGroups(e);
210
+ if (this.arraysEqual(t, s)) return;
211
+ this._groups = s;
212
+ const i = this.totalLength();
213
+ let a = !1;
214
+ this._value.length > i && (this._value = this._value.slice(0, i), a = !0), this.requestUpdate("groups", t), a && this.dispatchValueChange();
215
+ }
216
+ disconnectedCallback() {
217
+ super.disconnectedCallback(), this._revealTimer && (clearTimeout(this._revealTimer), this._revealTimer = null);
218
+ }
219
+ willUpdate(e) {
220
+ if (super.willUpdate(e), e.has("type") || e.has("case")) {
221
+ const t = this.normaliseValue(this._value);
222
+ t !== this._value && (this._value = t, this.clearReveal(), this.dispatchValueChange());
223
+ }
224
+ }
225
+ firstUpdated() {
226
+ this._inputEl = this.renderRoot.querySelector(".hidden-input");
227
+ }
228
+ focus(e) {
229
+ (this._inputEl ?? this.renderRoot.querySelector(".hidden-input"))?.focus(e);
230
+ }
231
+ clear() {
232
+ this._value !== "" && (this._value = "", this.clearReveal(), this._inputEl && (this._inputEl.value = ""), this.requestUpdate(), this.dispatchValueChange());
233
+ }
234
+ // ------- internals -------
235
+ totalLength() {
236
+ return this._groups.reduce((e, t) => e + t, 0);
237
+ }
238
+ boundaries() {
239
+ const e = [0];
240
+ for (const t of this._groups) e.push(e[e.length - 1] + t);
241
+ return e;
242
+ }
243
+ normaliseGroups(e) {
244
+ if (!e || !Array.isArray(e) || e.length === 0)
245
+ return console.warn("[mp-otp-input] groups must be a non-empty array; falling back to default."), [...o.DEFAULT_GROUPS];
246
+ let t = !1;
247
+ const s = e.map((a) => {
248
+ const r = Math.round(Number(a));
249
+ return !Number.isFinite(r) || r < 1 ? (t = !0, 1) : r > o.MAX_GROUP_SIZE ? (t = !0, o.MAX_GROUP_SIZE) : r;
250
+ });
251
+ let i = s.reduce((a, r) => a + r, 0);
252
+ for (; i > o.MAX_TOTAL && s.length > 1; )
253
+ i -= s.pop(), t = !0;
254
+ return s.length === 1 && s[0] > o.MAX_TOTAL && (s[0] = o.MAX_TOTAL, t = !0), t && console.warn(`[mp-otp-input] groups clamped to ${JSON.stringify(s)} (per-element max ${o.MAX_GROUP_SIZE}, total max ${o.MAX_TOTAL}).`), s;
255
+ }
256
+ arraysEqual(e, t) {
257
+ return e === t ? !0 : e.length !== t.length ? !1 : e.every((s, i) => s === t[i]);
258
+ }
259
+ /** Filter to allowed chars per `type`, normalise per `case`, truncate. */
260
+ normaliseValue(e) {
261
+ const t = this.type === "numeric" ? e.replace(/[^0-9]/g, "") : e.replace(/[^a-zA-Z0-9]/g, "");
262
+ return (this.type === "numeric" ? t : this.case === "upper" ? t.toUpperCase() : this.case === "lower" ? t.toLowerCase() : t).slice(0, this.totalLength());
263
+ }
264
+ // ------- reveal helpers -------
265
+ scheduleReveal(e) {
266
+ this._revealTimer && clearTimeout(this._revealTimer), this._revealedIndex = e, this._revealedUntil = performance.now() + o.REVEAL_MS, this._revealTimer = setTimeout(() => {
267
+ this._revealedIndex = null, this._revealedUntil = 0, this._revealTimer = null, this.requestUpdate();
268
+ }, o.REVEAL_MS);
269
+ }
270
+ clearReveal() {
271
+ this._revealTimer && (clearTimeout(this._revealTimer), this._revealTimer = null), this._revealedIndex = null, this._revealedUntil = 0;
272
+ }
273
+ // ------- event dispatch -------
274
+ dispatchValueChange() {
275
+ this.dispatchEvent(new CustomEvent("value-change", {
276
+ detail: this._value,
277
+ bubbles: !0,
278
+ composed: !0
279
+ }));
280
+ }
281
+ dispatchComplete() {
282
+ this.dispatchEvent(new CustomEvent("complete", {
283
+ detail: this._value,
284
+ bubbles: !0,
285
+ composed: !0
286
+ }));
287
+ }
288
+ // ------- render -------
289
+ render() {
290
+ const e = this._groups, t = this._value, s = this.boundaries(), i = s[s.length - 1], a = this._inputEl?.selectionEnd ?? t.length, r = this._isFocused ? this.activeBoxIndex(a, t.length, s) : null, l = this.type === "numeric" && e.every((u) => u === 1) ? "one-time-code" : "off", h = this.type === "numeric" ? "numeric" : "text", c = this.label ?? "One-time code";
291
+ return b`
292
+ <div class="container" part="container">
293
+ <input
294
+ class="hidden-input"
295
+ part="input"
296
+ .value=${t}
297
+ autocomplete=${l}
298
+ autocorrect="off"
299
+ autocapitalize="off"
300
+ spellcheck="false"
301
+ inputmode=${h}
302
+ maxlength=${i}
303
+ ?disabled=${this.disabled}
304
+ aria-label=${c}
305
+ aria-invalid=${this.invalid ? "true" : "false"}
306
+ @input=${this.onInput}
307
+ @paste=${this.onPaste}
308
+ @focus=${this.onFocus}
309
+ @blur=${this.onBlur}
310
+ @keyup=${this.onCaretMove}
311
+ @click=${this.onCaretMove}
312
+ />
313
+ ${e.map(
314
+ (u, d) => this.renderBox(d, u, s, t, r)
315
+ )}
316
+ </div>
317
+ `;
318
+ }
319
+ renderBox(e, t, s, i, a) {
320
+ const r = s[e], n = s[e + 1], l = i.slice(r, Math.min(n, i.length)), h = i.length >= n, c = !h && l.length > 0, u = a === e, d = this.renderSliceContent(l, r), p = ["box"];
321
+ (h || c) && p.push("box-filled"), u && p.push("box-active"), this.invalid && p.push("box-invalid");
322
+ const v = p.join(" "), g = "M".repeat(t);
323
+ return b`
324
+ <span class=${v} part=${p.join(" ")} aria-hidden="true">
325
+ <span class="box-spacer">${g}</span>
326
+ <span class="box-content">${d}</span>
327
+ </span>
328
+ `;
329
+ }
330
+ /** Build the displayed string for a slice, applying password reveal. */
331
+ renderSliceContent(e, t) {
332
+ if (this.type !== "password" || e.length === 0) return e;
333
+ const s = performance.now();
334
+ let i = "";
335
+ for (let a = 0; a < e.length; a++)
336
+ t + a === this._revealedIndex && s < this._revealedUntil ? i += e[a] : i += o.MASK_CHAR;
337
+ return i;
338
+ }
339
+ /**
340
+ * Returns the index of the visual box that should be highlighted as "active"
341
+ * given the caret position and current value length.
342
+ *
343
+ * Rules:
344
+ * - Caret before all boxes (rare): first box.
345
+ * - Caret at the end of a filled value with more boxes to fill: the next
346
+ * box (the one the user is about to type into).
347
+ * - Caret at totalLength (everything filled): last box.
348
+ * - Otherwise: the box whose [start, end) range contains caretPos.
349
+ */
350
+ activeBoxIndex(e, t, s) {
351
+ if (this._groups.length === 0) return null;
352
+ const i = s[s.length - 1], a = Math.min(e, i);
353
+ if (a >= i) return this._groups.length - 1;
354
+ for (let r = 0; r < s.length - 1; r++)
355
+ if (a >= s[r] && a < s[r + 1]) return r;
356
+ return this._groups.length - 1;
357
+ }
358
+ }
359
+ typeof customElements < "u" && !customElements.get("mp-otp-input") && customElements.define("mp-otp-input", o);
360
+ export {
361
+ o as MintOtpInputElement
362
+ };
@@ -0,0 +1,4 @@
1
+ export * from './mint-otp-input.element';
2
+ export * from './types/otp-input-type';
3
+ export * from './types/otp-input-case';
4
+ export * from './types/otp-input-size';
@@ -0,0 +1,134 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ import { OtpInputType } from './types/otp-input-type';
3
+ import { OtpInputCase } from './types/otp-input-case';
4
+ import { OtpInputSize } from './types/otp-input-size';
5
+ /**
6
+ * Bootstrap-flavoured OTP / segmented-code input.
7
+ *
8
+ * Architecture: one hidden full-width `<input>` owns focus / paste / IME /
9
+ * SMS autofill; decorative `<span>` boxes render slices of the value at fixed
10
+ * positions. Boxes are `aria-hidden`; screen readers see one text input.
11
+ *
12
+ * Layout via `groups: number[]` — each array element is the character capacity
13
+ * of one visual box. `[1,1,1,1,1,1]` (default) is the classic 6-digit OTP;
14
+ * `[6,6,4,4,6,6]` is the MS Office product-key shape.
15
+ *
16
+ * Events:
17
+ * - `value-change` fires on every keystroke, paste, and clear, payload is the
18
+ * current (possibly partial) value string.
19
+ * - `complete` fires once when the value transitions from incomplete to
20
+ * `length === sum(groups)` via user interaction. Re-fires on re-completion.
21
+ * Does NOT fire on programmatic writes via the `value` setter.
22
+ *
23
+ * Both bubble and compose so an Angular wrapper's host listeners pick them up.
24
+ */
25
+ export declare class MintOtpInputElement extends LitElement {
26
+ static styles: import('lit').CSSResult[];
27
+ static get observedAttributes(): string[];
28
+ static properties: {
29
+ value: {
30
+ attribute: boolean;
31
+ };
32
+ groups: {
33
+ attribute: string;
34
+ converter: {
35
+ fromAttribute: (s: string | null) => number[];
36
+ toAttribute: (v: number[] | null) => string | null;
37
+ };
38
+ reflect: boolean;
39
+ };
40
+ type: {
41
+ attribute: string;
42
+ type: StringConstructor;
43
+ reflect: boolean;
44
+ };
45
+ case: {
46
+ attribute: string;
47
+ type: StringConstructor;
48
+ reflect: boolean;
49
+ };
50
+ size: {
51
+ attribute: string;
52
+ type: StringConstructor;
53
+ reflect: boolean;
54
+ };
55
+ disabled: {
56
+ attribute: string;
57
+ type: BooleanConstructor;
58
+ reflect: boolean;
59
+ };
60
+ label: {
61
+ attribute: string;
62
+ type: StringConstructor;
63
+ reflect: boolean;
64
+ };
65
+ invalid: {
66
+ attribute: string;
67
+ type: BooleanConstructor;
68
+ reflect: boolean;
69
+ };
70
+ };
71
+ type: OtpInputType;
72
+ case: OtpInputCase;
73
+ size: OtpInputSize;
74
+ disabled: boolean;
75
+ label: string | null;
76
+ invalid: boolean;
77
+ static readonly MAX_GROUP_SIZE = 10;
78
+ static readonly MAX_TOTAL = 40;
79
+ static readonly DEFAULT_GROUPS: readonly number[];
80
+ static readonly REVEAL_MS = 700;
81
+ static readonly MASK_CHAR = "\u2022";
82
+ private _value;
83
+ private _groups;
84
+ private _revealedIndex;
85
+ private _revealedUntil;
86
+ private _revealTimer;
87
+ private _inputEl;
88
+ private _isFocused;
89
+ get value(): string;
90
+ set value(next: string | null | undefined);
91
+ get groups(): number[];
92
+ set groups(next: number[] | null | undefined);
93
+ disconnectedCallback(): void;
94
+ protected willUpdate(changedProperties: Map<string, unknown>): void;
95
+ protected firstUpdated(): void;
96
+ focus(options?: FocusOptions): void;
97
+ clear(): void;
98
+ private totalLength;
99
+ private boundaries;
100
+ private normaliseGroups;
101
+ private arraysEqual;
102
+ /** Filter to allowed chars per `type`, normalise per `case`, truncate. */
103
+ private normaliseValue;
104
+ private onInput;
105
+ private onPaste;
106
+ private onFocus;
107
+ private onBlur;
108
+ private onCaretMove;
109
+ private scheduleReveal;
110
+ private clearReveal;
111
+ private dispatchValueChange;
112
+ private dispatchComplete;
113
+ protected render(): TemplateResult;
114
+ private renderBox;
115
+ /** Build the displayed string for a slice, applying password reveal. */
116
+ private renderSliceContent;
117
+ /**
118
+ * Returns the index of the visual box that should be highlighted as "active"
119
+ * given the caret position and current value length.
120
+ *
121
+ * Rules:
122
+ * - Caret before all boxes (rare): first box.
123
+ * - Caret at the end of a filled value with more boxes to fill: the next
124
+ * box (the one the user is about to type into).
125
+ * - Caret at totalLength (everything filled): last box.
126
+ * - Otherwise: the box whose [start, end) range contains caretPos.
127
+ */
128
+ private activeBoxIndex;
129
+ }
130
+ declare global {
131
+ interface HTMLElementTagNameMap {
132
+ 'mp-otp-input': MintOtpInputElement;
133
+ }
134
+ }
@@ -0,0 +1,2 @@
1
+ export declare const template: import('lit-html').TemplateResult<1>;
2
+ export declare const styles: import('lit').CSSResult;
@@ -0,0 +1 @@
1
+ export type OtpInputCase = 'upper' | 'lower' | 'preserve';
@@ -0,0 +1 @@
1
+ export type OtpInputSize = 'sm' | 'md' | 'lg';
@@ -0,0 +1 @@
1
+ export type OtpInputType = 'numeric' | 'alphanumeric' | 'password';