@sondor-technology/sondor-components 1.0.1-develop.13 → 1.0.1-develop.15

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 (266) hide show
  1. package/dist/components/alert/alert.constants.d.ts +3 -0
  2. package/dist/components/alert/alert.constants.d.ts.map +1 -0
  3. package/dist/components/alert/alert.constants.js +2 -0
  4. package/dist/components/alert/alert.constants.js.map +1 -0
  5. package/dist/components/alert/alert.d.ts +4 -3
  6. package/dist/components/alert/alert.d.ts.map +1 -1
  7. package/dist/components/alert/alert.js +21 -11
  8. package/dist/components/alert/alert.js.map +1 -0
  9. package/dist/components/badge/badge.constants.d.ts +3 -0
  10. package/dist/components/badge/badge.constants.d.ts.map +1 -0
  11. package/dist/components/badge/badge.constants.js +2 -0
  12. package/dist/components/badge/badge.constants.js.map +1 -0
  13. package/dist/components/badge/badge.d.ts +1 -1
  14. package/dist/components/badge/badge.d.ts.map +1 -1
  15. package/dist/components/badge/badge.js +3 -2
  16. package/dist/components/badge/badge.js.map +1 -0
  17. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -1
  18. package/dist/components/breadcrumb/breadcrumb.js +2 -1
  19. package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
  20. package/dist/components/button/button.constants.d.ts +7 -0
  21. package/dist/components/button/button.constants.d.ts.map +1 -0
  22. package/dist/components/button/button.constants.js +4 -0
  23. package/dist/components/button/button.constants.js.map +1 -0
  24. package/dist/components/button/button.d.ts +8 -4
  25. package/dist/components/button/button.d.ts.map +1 -1
  26. package/dist/components/button/button.js +181 -137
  27. package/dist/components/button/button.js.map +1 -0
  28. package/dist/components/button-group/button-group.d.ts +1 -0
  29. package/dist/components/button-group/button-group.d.ts.map +1 -1
  30. package/dist/components/button-group/button-group.js +17 -21
  31. package/dist/components/button-group/button-group.js.map +1 -0
  32. package/dist/components/calendar/calendar.d.ts +36 -0
  33. package/dist/components/calendar/calendar.d.ts.map +1 -0
  34. package/dist/components/calendar/calendar.js +439 -0
  35. package/dist/components/calendar/calendar.js.map +1 -0
  36. package/dist/components/checkbox/checkbox.constants.d.ts +3 -0
  37. package/dist/components/checkbox/checkbox.constants.d.ts.map +1 -0
  38. package/dist/components/checkbox/checkbox.constants.js +2 -0
  39. package/dist/components/checkbox/checkbox.constants.js.map +1 -0
  40. package/dist/components/checkbox/checkbox.d.ts +5 -1
  41. package/dist/components/checkbox/checkbox.d.ts.map +1 -1
  42. package/dist/components/checkbox/checkbox.js +21 -5
  43. package/dist/components/checkbox/checkbox.js.map +1 -0
  44. package/dist/components/code-block/code-block.d.ts +7 -7
  45. package/dist/components/code-block/code-block.d.ts.map +1 -1
  46. package/dist/components/code-block/code-block.js +130 -66
  47. package/dist/components/code-block/code-block.js.map +1 -0
  48. package/dist/components/content-card/content-card.d.ts.map +1 -1
  49. package/dist/components/content-card/content-card.js +10 -15
  50. package/dist/components/content-card/content-card.js.map +1 -0
  51. package/dist/components/cron-builder/cron-builder.d.ts +34 -0
  52. package/dist/components/cron-builder/cron-builder.d.ts.map +1 -0
  53. package/dist/components/cron-builder/cron-builder.js +456 -0
  54. package/dist/components/cron-builder/cron-builder.js.map +1 -0
  55. package/dist/components/divider/divider.constants.d.ts +5 -0
  56. package/dist/components/divider/divider.constants.d.ts.map +1 -0
  57. package/dist/components/divider/divider.constants.js +3 -0
  58. package/dist/components/divider/divider.constants.js.map +1 -0
  59. package/dist/components/divider/divider.d.ts +4 -2
  60. package/dist/components/divider/divider.d.ts.map +1 -1
  61. package/dist/components/divider/divider.js +18 -9
  62. package/dist/components/divider/divider.js.map +1 -0
  63. package/dist/components/drawer/drawer.d.ts +7 -4
  64. package/dist/components/drawer/drawer.d.ts.map +1 -1
  65. package/dist/components/drawer/drawer.js +73 -30
  66. package/dist/components/drawer/drawer.js.map +1 -0
  67. package/dist/components/field/field.d.ts +2 -2
  68. package/dist/components/field/field.d.ts.map +1 -1
  69. package/dist/components/field/field.js +8 -9
  70. package/dist/components/field/field.js.map +1 -0
  71. package/dist/components/footer/footer.d.ts +8 -1
  72. package/dist/components/footer/footer.d.ts.map +1 -1
  73. package/dist/components/footer/footer.js +42 -12
  74. package/dist/components/footer/footer.js.map +1 -0
  75. package/dist/components/form/form-step.js +1 -0
  76. package/dist/components/form/form-step.js.map +1 -0
  77. package/dist/components/form/form.d.ts +3 -0
  78. package/dist/components/form/form.d.ts.map +1 -1
  79. package/dist/components/form/form.js +109 -69
  80. package/dist/components/form/form.js.map +1 -0
  81. package/dist/components/grid/grid-row.d.ts +3 -3
  82. package/dist/components/grid/grid-row.d.ts.map +1 -1
  83. package/dist/components/grid/grid-row.js +36 -22
  84. package/dist/components/grid/grid-row.js.map +1 -0
  85. package/dist/components/grid/grid.d.ts +2 -2
  86. package/dist/components/grid/grid.d.ts.map +1 -1
  87. package/dist/components/grid/grid.js +5 -2
  88. package/dist/components/grid/grid.js.map +1 -0
  89. package/dist/components/icon/icon-paths.d.ts +161 -86
  90. package/dist/components/icon/icon-paths.d.ts.map +1 -1
  91. package/dist/components/icon/icon-paths.js +176 -106
  92. package/dist/components/icon/icon-paths.js.map +1 -0
  93. package/dist/components/icon/icon.d.ts +1 -1
  94. package/dist/components/icon/icon.d.ts.map +1 -1
  95. package/dist/components/icon/icon.js +6 -5
  96. package/dist/components/icon/icon.js.map +1 -0
  97. package/dist/components/input/input.d.ts +10 -0
  98. package/dist/components/input/input.d.ts.map +1 -1
  99. package/dist/components/input/input.js +59 -43
  100. package/dist/components/input/input.js.map +1 -0
  101. package/dist/components/link/link.d.ts +6 -6
  102. package/dist/components/link/link.d.ts.map +1 -1
  103. package/dist/components/link/link.js +42 -19
  104. package/dist/components/link/link.js.map +1 -0
  105. package/dist/components/metadata/metadata.d.ts +3 -3
  106. package/dist/components/metadata/metadata.d.ts.map +1 -1
  107. package/dist/components/metadata/metadata.js +23 -20
  108. package/dist/components/metadata/metadata.js.map +1 -0
  109. package/dist/components/modal/modal.d.ts +4 -16
  110. package/dist/components/modal/modal.d.ts.map +1 -1
  111. package/dist/components/modal/modal.js +99 -62
  112. package/dist/components/modal/modal.js.map +1 -0
  113. package/dist/components/page-layout/page-layout.d.ts +4 -3
  114. package/dist/components/page-layout/page-layout.d.ts.map +1 -1
  115. package/dist/components/page-layout/page-layout.js +95 -68
  116. package/dist/components/page-layout/page-layout.js.map +1 -0
  117. package/dist/components/pin-input/pin-input.d.ts +33 -0
  118. package/dist/components/pin-input/pin-input.d.ts.map +1 -0
  119. package/dist/components/pin-input/pin-input.js +253 -0
  120. package/dist/components/pin-input/pin-input.js.map +1 -0
  121. package/dist/components/popover/popover.d.ts +26 -0
  122. package/dist/components/popover/popover.d.ts.map +1 -0
  123. package/dist/components/popover/popover.js +196 -0
  124. package/dist/components/popover/popover.js.map +1 -0
  125. package/dist/components/radio/radio.d.ts +8 -0
  126. package/dist/components/radio/radio.d.ts.map +1 -1
  127. package/dist/components/radio/radio.js +8 -12
  128. package/dist/components/radio/radio.js.map +1 -0
  129. package/dist/components/radio-group/radio-group.d.ts +6 -1
  130. package/dist/components/radio-group/radio-group.d.ts.map +1 -1
  131. package/dist/components/radio-group/radio-group.js +44 -18
  132. package/dist/components/radio-group/radio-group.js.map +1 -0
  133. package/dist/components/router/router.d.ts +5 -7
  134. package/dist/components/router/router.d.ts.map +1 -1
  135. package/dist/components/router/router.js +54 -38
  136. package/dist/components/router/router.js.map +1 -0
  137. package/dist/components/select/select.d.ts +5 -4
  138. package/dist/components/select/select.d.ts.map +1 -1
  139. package/dist/components/select/select.js +40 -9
  140. package/dist/components/select/select.js.map +1 -0
  141. package/dist/components/skeleton/skeleton.d.ts +3 -2
  142. package/dist/components/skeleton/skeleton.d.ts.map +1 -1
  143. package/dist/components/skeleton/skeleton.js +10 -13
  144. package/dist/components/skeleton/skeleton.js.map +1 -0
  145. package/dist/components/switch/switch.d.ts +12 -0
  146. package/dist/components/switch/switch.d.ts.map +1 -1
  147. package/dist/components/switch/switch.js +28 -22
  148. package/dist/components/switch/switch.js.map +1 -0
  149. package/dist/components/table/data-table.d.ts +3 -25
  150. package/dist/components/table/data-table.d.ts.map +1 -1
  151. package/dist/components/table/data-table.js +211 -146
  152. package/dist/components/table/data-table.js.map +1 -0
  153. package/dist/components/table/table.d.ts +3 -3
  154. package/dist/components/table/table.d.ts.map +1 -1
  155. package/dist/components/table/table.js +39 -20
  156. package/dist/components/table/table.js.map +1 -0
  157. package/dist/components/tabs/tab-panel.d.ts +3 -1
  158. package/dist/components/tabs/tab-panel.d.ts.map +1 -1
  159. package/dist/components/tabs/tab-panel.js +21 -11
  160. package/dist/components/tabs/tab-panel.js.map +1 -0
  161. package/dist/components/tabs/tab.d.ts +5 -1
  162. package/dist/components/tabs/tab.d.ts.map +1 -1
  163. package/dist/components/tabs/tab.js +46 -28
  164. package/dist/components/tabs/tab.js.map +1 -0
  165. package/dist/components/tabs/tabs.d.ts +4 -0
  166. package/dist/components/tabs/tabs.d.ts.map +1 -1
  167. package/dist/components/tabs/tabs.js +76 -13
  168. package/dist/components/tabs/tabs.js.map +1 -0
  169. package/dist/components/textarea/textarea.d.ts +13 -0
  170. package/dist/components/textarea/textarea.d.ts.map +1 -1
  171. package/dist/components/textarea/textarea.js +59 -13
  172. package/dist/components/textarea/textarea.js.map +1 -0
  173. package/dist/components/theme-toggle/theme-toggle.constants.d.ts +3 -0
  174. package/dist/components/theme-toggle/theme-toggle.constants.d.ts.map +1 -0
  175. package/dist/components/theme-toggle/theme-toggle.constants.js +2 -0
  176. package/dist/components/theme-toggle/theme-toggle.constants.js.map +1 -0
  177. package/dist/components/theme-toggle/theme-toggle.d.ts +3 -2
  178. package/dist/components/theme-toggle/theme-toggle.d.ts.map +1 -1
  179. package/dist/components/theme-toggle/theme-toggle.js +46 -19
  180. package/dist/components/theme-toggle/theme-toggle.js.map +1 -0
  181. package/dist/components/time-picker/time-picker.d.ts +38 -0
  182. package/dist/components/time-picker/time-picker.d.ts.map +1 -0
  183. package/dist/components/time-picker/time-picker.js +280 -0
  184. package/dist/components/time-picker/time-picker.js.map +1 -0
  185. package/dist/components/toggle-group/toggle-button.d.ts +23 -0
  186. package/dist/components/toggle-group/toggle-button.d.ts.map +1 -0
  187. package/dist/components/toggle-group/toggle-button.js +115 -0
  188. package/dist/components/toggle-group/toggle-button.js.map +1 -0
  189. package/dist/components/toggle-group/toggle-group.d.ts +32 -0
  190. package/dist/components/toggle-group/toggle-group.d.ts.map +1 -0
  191. package/dist/components/toggle-group/toggle-group.js +150 -0
  192. package/dist/components/toggle-group/toggle-group.js.map +1 -0
  193. package/dist/components/tooltip/tooltip.d.ts +33 -0
  194. package/dist/components/tooltip/tooltip.d.ts.map +1 -0
  195. package/dist/components/tooltip/tooltip.js +293 -0
  196. package/dist/components/tooltip/tooltip.js.map +1 -0
  197. package/dist/components/vertical-nav/vertical-nav-group.d.ts +5 -2
  198. package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -1
  199. package/dist/components/vertical-nav/vertical-nav-group.js +50 -14
  200. package/dist/components/vertical-nav/vertical-nav-group.js.map +1 -0
  201. package/dist/components/vertical-nav/vertical-nav-item.d.ts +3 -2
  202. package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -1
  203. package/dist/components/vertical-nav/vertical-nav-item.js +30 -8
  204. package/dist/components/vertical-nav/vertical-nav-item.js.map +1 -0
  205. package/dist/styles/index.css +49 -17
  206. package/dist/styles/reset.js +1 -0
  207. package/dist/styles/reset.js.map +1 -0
  208. package/package.json +30 -1
  209. package/src/components/alert/alert.constants.ts +2 -0
  210. package/src/components/alert/alert.ts +24 -15
  211. package/src/components/badge/badge.constants.ts +2 -0
  212. package/src/components/badge/badge.ts +3 -4
  213. package/src/components/breadcrumb/breadcrumb.ts +2 -2
  214. package/src/components/button/button.constants.ts +8 -0
  215. package/src/components/button/button.ts +184 -144
  216. package/src/components/button-group/button-group.ts +18 -22
  217. package/src/components/calendar/calendar.ts +444 -0
  218. package/src/components/checkbox/checkbox.constants.ts +2 -0
  219. package/src/components/checkbox/checkbox.ts +33 -18
  220. package/src/components/code-block/code-block.ts +151 -84
  221. package/src/components/content-card/content-card.ts +10 -16
  222. package/src/components/cron-builder/cron-builder.ts +452 -0
  223. package/src/components/divider/divider.constants.ts +5 -0
  224. package/src/components/divider/divider.ts +22 -11
  225. package/src/components/drawer/drawer.ts +79 -34
  226. package/src/components/field/field.ts +9 -11
  227. package/src/components/footer/footer.ts +43 -12
  228. package/src/components/form/form.ts +121 -84
  229. package/src/components/grid/grid-row.ts +45 -32
  230. package/src/components/grid/grid.ts +7 -4
  231. package/src/components/icon/icon-paths.ts +175 -106
  232. package/src/components/icon/icon.ts +6 -6
  233. package/src/components/input/input.ts +59 -45
  234. package/src/components/link/link.ts +45 -21
  235. package/src/components/metadata/metadata.ts +26 -24
  236. package/src/components/modal/modal.ts +108 -74
  237. package/src/components/page-layout/page-layout.ts +97 -72
  238. package/src/components/pin-input/pin-input.ts +249 -0
  239. package/src/components/popover/popover.ts +192 -0
  240. package/src/components/radio/radio.ts +8 -13
  241. package/src/components/radio-group/radio-group.ts +45 -21
  242. package/src/components/router/router.ts +73 -50
  243. package/src/components/select/select.ts +41 -80
  244. package/src/components/skeleton/skeleton.ts +14 -14
  245. package/src/components/switch/switch.ts +31 -25
  246. package/src/components/table/data-table.ts +248 -177
  247. package/src/components/table/table.ts +52 -29
  248. package/src/components/tabs/tab-panel.ts +25 -13
  249. package/src/components/tabs/tab.ts +58 -33
  250. package/src/components/tabs/tabs.ts +77 -15
  251. package/src/components/textarea/textarea.ts +63 -15
  252. package/src/components/theme-toggle/theme-toggle.constants.ts +2 -0
  253. package/src/components/theme-toggle/theme-toggle.ts +47 -22
  254. package/src/components/time-picker/time-picker.ts +272 -0
  255. package/src/components/toggle-group/toggle-button.ts +104 -0
  256. package/src/components/toggle-group/toggle-group.ts +148 -0
  257. package/src/components/tooltip/tooltip.ts +286 -0
  258. package/src/components/vertical-nav/vertical-nav-group.ts +57 -18
  259. package/src/components/vertical-nav/vertical-nav-item.ts +35 -12
  260. package/src/styles/globals.css +27 -4
  261. package/src/styles/theme.css +40 -32
  262. package/tsconfig.json +2 -1
  263. package/dist/components/card/card.d.ts +0 -11
  264. package/dist/components/card/card.d.ts.map +0 -1
  265. package/dist/components/card/card.js +0 -54
  266. package/src/components/card/card.ts +0 -53
@@ -0,0 +1,452 @@
1
+ import {LitElement, html, css, PropertyValues} from "lit";
2
+ import {customElement, property, state} from "lit/decorators.js";
3
+ import {resetStyles} from "../../styles/reset";
4
+
5
+ @customElement("st-cron-builder")
6
+ export class StCronBuilder extends LitElement {
7
+ static formAssociated = true;
8
+ private _internals: ElementInternals;
9
+
10
+ @property({type: String, reflect: true}) name = "";
11
+ @property({type: String}) value = "";
12
+ @property({type: Boolean, reflect: true}) required = false;
13
+
14
+ @state() private _frequency = "weekly";
15
+ @state() private _time = "12:00";
16
+ @state() private _days = "1,3,5";
17
+ @state() private _monthDay = "1";
18
+ @state() private _date = "";
19
+
20
+ @state() private _customCron = "0 * * * *";
21
+ @state() private _customCronError = "";
22
+ @state() private _customCronText = "";
23
+
24
+ private _defaultValue = "";
25
+
26
+ constructor() {
27
+ super();
28
+ this._internals = this.attachInternals();
29
+
30
+ const today = new Date();
31
+ const pad = (n: number) => n.toString().padStart(2, "0");
32
+ this._date = `${today.getFullYear()}-${pad(today.getMonth() + 1)}-${pad(today.getDate())}`;
33
+ }
34
+
35
+ static styles = [
36
+ resetStyles,
37
+ css`
38
+ :host {
39
+ display: block;
40
+ background: var(--st-color-surface);
41
+ border: 1px solid var(--st-color-border);
42
+ border-radius: var(--st-radius-lg);
43
+ padding: var(--st-spacing-lg);
44
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
45
+ }
46
+
47
+ .builder-grid {
48
+ display: flex;
49
+ flex-direction: column;
50
+ gap: var(--st-spacing-lg);
51
+ }
52
+
53
+ .row {
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: var(--st-spacing-xs);
57
+ }
58
+
59
+ label {
60
+ font-size: var(--st-font-size-sm);
61
+ font-weight: 600;
62
+ color: var(--st-color-text);
63
+ }
64
+
65
+ .helper-text {
66
+ font-size: var(--st-font-size-xs);
67
+ color: var(--st-color-text-muted);
68
+ margin-top: 4px;
69
+ }
70
+
71
+ .cron-segments {
72
+ display: flex;
73
+ gap: 4px;
74
+ margin-top: var(--st-spacing-xs);
75
+ margin-bottom: var(--st-spacing-xs);
76
+ }
77
+
78
+ .segment-badge {
79
+ flex: 1;
80
+ text-align: center;
81
+ font-size: 11px;
82
+ padding: 4px;
83
+ background: var(--st-color-surface-muted, #f1f5f9);
84
+ border-radius: var(--st-radius-sm);
85
+ color: var(--st-color-text-muted);
86
+ border: 1px solid var(--st-color-border);
87
+ transition: all 0.2s;
88
+ }
89
+
90
+ .segment-badge.active {
91
+ background: var(--st-color-primary, #eff6ff);
92
+ color: var(--st-color-surface);
93
+ border-color: var(--st-color-primary);
94
+ font-weight: 600;
95
+ }
96
+
97
+ .success-text {
98
+ color: var(--st-color-success, #16a34a);
99
+ }
100
+
101
+ .error-text {
102
+ color: var(--st-color-danger, #dc2626);
103
+ font-weight: 500;
104
+ }
105
+
106
+ .output-preview {
107
+ margin-top: var(--st-spacing-md);
108
+ padding: var(--st-spacing-md);
109
+ background: var(--st-color-surface-muted, #f8fafc);
110
+ border-radius: var(--st-radius-md);
111
+ border: 1px dashed var(--st-color-border);
112
+ }
113
+
114
+ .output-preview code {
115
+ font-family: monospace;
116
+ color: var(--st-color-primary);
117
+ font-weight: bold;
118
+ font-size: var(--st-font-size-lg);
119
+ }
120
+ `,
121
+ ];
122
+
123
+ override firstUpdated() {
124
+ this._generateOutput();
125
+ this._defaultValue = this.value;
126
+ }
127
+
128
+ private _translateCron(cron: string): {valid: boolean; text: string} {
129
+ const parts = cron.trim().split(/\s+/);
130
+
131
+ if (parts.length !== 5) {
132
+ return {
133
+ valid: false,
134
+ text: `A cron expression must contain exactly 5 segments (currently ${parts.length}).`,
135
+ };
136
+ }
137
+
138
+ const types = ["Minute", "Hour", "Day of Month", "Month", "Day of Week"];
139
+
140
+ const bounds = [
141
+ {min: 0, max: 59}, // Minute
142
+ {min: 0, max: 23}, // Hour
143
+ {min: 1, max: 31}, // DOM
144
+ {min: 1, max: 12}, // Month
145
+ {min: 0, max: 7}, // DOW
146
+ ];
147
+
148
+ for (let i = 0; i < 5; i++) {
149
+ const part = parts[i];
150
+ const type = types[i];
151
+ const bound = bounds[i];
152
+
153
+ // Prevent consecutive or hanging symbols like 1- or */
154
+ if (/(^[\/\-\,])|([\/\-\,]$)|([\/\-\,]{2,})/.test(part)) {
155
+ return {valid: false, text: `Invalid formatting in ${type} segment.`};
156
+ }
157
+
158
+ // First 3 segments (min, hour, dom) cannot have letters
159
+ if (i < 3 && /[A-Za-z]/.test(part)) {
160
+ return {valid: false, text: `${type} cannot contain letters.`};
161
+ }
162
+
163
+ // Last 2 segments can only have specific valid keywords
164
+ if (/[A-Za-z]/.test(part)) {
165
+ const words = part.match(/[A-Za-z]+/g) || [];
166
+ const validWords =
167
+ i === 3
168
+ ? ["JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"]
169
+ : ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
170
+
171
+ for (const word of words) {
172
+ if (!validWords.includes(word.toUpperCase())) {
173
+ return {valid: false, text: `"${word}" is not a valid ${type}.`};
174
+ }
175
+ }
176
+ }
177
+
178
+ const numbers = part.match(/\d+/g);
179
+ if (numbers) {
180
+ for (const numStr of numbers) {
181
+ const num = parseInt(numStr, 10);
182
+ if (num < bound.min || num > bound.max) {
183
+ return {
184
+ valid: false,
185
+ text: `${type} values must be between ${bound.min} and ${bound.max}.`,
186
+ };
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+ const [min, hour, dom, mon, dow] = parts;
193
+ let desc = "Runs ";
194
+
195
+ if (min === "*") desc += "every minute";
196
+ else if (min.startsWith("*/")) desc += `every ${min.substring(2)} minutes`;
197
+ else desc += `at minute ${min}`;
198
+
199
+ if (hour !== "*") {
200
+ if (hour.startsWith("*/")) desc += `, past every ${hour.substring(2)} hours`;
201
+ else desc += `, past hour ${hour}`;
202
+ }
203
+
204
+ if (dom !== "*") {
205
+ if (dom.startsWith("*/")) desc += `, every ${dom.substring(2)} days`;
206
+ else desc += `, on day ${dom} of the month`;
207
+ }
208
+
209
+ if (mon !== "*") {
210
+ if (mon.startsWith("*/")) desc += `, every ${mon.substring(2)} months`;
211
+ else desc += `, in month ${mon}`;
212
+ }
213
+
214
+ if (dow !== "*") {
215
+ const days = [
216
+ "Sunday",
217
+ "Monday",
218
+ "Tuesday",
219
+ "Wednesday",
220
+ "Thursday",
221
+ "Friday",
222
+ "Saturday",
223
+ "Sunday",
224
+ ];
225
+ let dayStr = dow;
226
+
227
+ if (dow.length === 1 && /[0-7]/.test(dow)) {
228
+ dayStr = days[parseInt(dow, 10)];
229
+ } else if (dow.includes("-") && /[0-7]-[0-7]/.test(dow)) {
230
+ dayStr = dow
231
+ .split("-")
232
+ .map((d) => days[parseInt(d, 10)])
233
+ .join(" through ");
234
+ }
235
+ desc += `, on ${dayStr}`;
236
+ }
237
+
238
+ return {valid: true, text: desc + "."};
239
+ }
240
+
241
+ private _generateOutput() {
242
+ let output = "";
243
+ this._customCronError = "";
244
+ this._customCronText = "";
245
+ this._internals.setValidity({});
246
+
247
+ if (this._frequency === "custom") {
248
+ const analysis = this._translateCron(this._customCron);
249
+
250
+ if (!analysis.valid) {
251
+ this._customCronError = analysis.text;
252
+ this._internals.setValidity({customError: true}, analysis.text);
253
+ } else {
254
+ this._customCronText = analysis.text;
255
+ }
256
+ output = this._customCron;
257
+ } else if (this._frequency === "one-off") {
258
+ output = `${this._date}T${this._time}`;
259
+ } else {
260
+ const [hh, mm] = this._time.split(":");
261
+ const minute = mm ? parseInt(mm, 10).toString() : "0";
262
+ const hour = hh ? parseInt(hh, 10).toString() : "0";
263
+
264
+ switch (this._frequency) {
265
+ case "daily":
266
+ output = `${minute} ${hour} * * *`;
267
+ break;
268
+ case "weekly":
269
+ const safeDays = this._days || "1";
270
+ output = `${minute} ${hour} * * ${safeDays}`;
271
+ break;
272
+ case "monthly":
273
+ output = `${minute} ${hour} ${this._monthDay} * *`;
274
+ break;
275
+ }
276
+ }
277
+
278
+ this.value = output;
279
+ this._internals.setFormValue(output);
280
+ this.dispatchEvent(new Event("change", {bubbles: true, composed: true}));
281
+ }
282
+
283
+ private _handleCustomCronInput(e: any) {
284
+ const inputEl = e.target;
285
+ const sanitized = inputEl.value.replace(/[^0-9A-Za-z\s\*\/\-\,]/g, "");
286
+
287
+ if (inputEl.value !== sanitized) {
288
+ inputEl.value = sanitized;
289
+ }
290
+
291
+ this._customCron = sanitized;
292
+ this._generateOutput();
293
+ }
294
+
295
+ private _handleFrequencyChange(e: any) {
296
+ this._frequency = e.target.value;
297
+ this._generateOutput();
298
+ }
299
+
300
+ public checkValidity() {
301
+ return this._internals.checkValidity();
302
+ }
303
+ public reportValidity() {
304
+ return this._internals.reportValidity();
305
+ }
306
+
307
+ formResetCallback() {
308
+ this.value = this._defaultValue;
309
+ this._frequency = "weekly";
310
+ this._generateOutput();
311
+ }
312
+
313
+ render() {
314
+ const frequencyOptions = [
315
+ {label: "One-Off Execution", value: "one-off"},
316
+ {label: "Daily", value: "daily"},
317
+ {label: "Weekly", value: "weekly"},
318
+ {label: "Monthly", value: "monthly"},
319
+ {label: "Custom Cron", value: "custom"},
320
+ ];
321
+
322
+ const monthDayOptions = Array.from({length: 31}, (_, i) => ({
323
+ label: `${i + 1}${i === 0 ? "st" : i === 1 ? "nd" : i === 2 ? "rd" : "th"}`,
324
+ value: String(i + 1),
325
+ }));
326
+
327
+ // Calculate which segment the user is currently typing in
328
+ const activeSegmentIndex = Math.min(this._customCron.trimStart().split(/\s+/).length - 1, 4);
329
+
330
+ return html`
331
+ <div class="builder-grid">
332
+ <div class="row">
333
+ <st-select
334
+ label="Schedule Type"
335
+ .options=${frequencyOptions}
336
+ .value=${this._frequency}
337
+ @change=${this._handleFrequencyChange}
338
+ ></st-select>
339
+ </div>
340
+
341
+ ${this._frequency === "weekly"
342
+ ? html`
343
+ <div class="row">
344
+ <label>Run on days</label>
345
+ <st-toggle-group
346
+ multiple
347
+ .value=${this._days}
348
+ @change=${(e: any) => {
349
+ this._days = e.target.value;
350
+ this._generateOutput();
351
+ }}
352
+ >
353
+ <st-toggle-button value="1">Mon</st-toggle-button>
354
+ <st-toggle-button value="2">Tue</st-toggle-button>
355
+ <st-toggle-button value="3">Wed</st-toggle-button>
356
+ <st-toggle-button value="4">Thu</st-toggle-button>
357
+ <st-toggle-button value="5">Fri</st-toggle-button>
358
+ <st-toggle-button value="6">Sat</st-toggle-button>
359
+ <st-toggle-button value="0">Sun</st-toggle-button>
360
+ </st-toggle-group>
361
+ </div>
362
+ `
363
+ : ""}
364
+ ${this._frequency === "monthly"
365
+ ? html`
366
+ <div class="row">
367
+ <st-select
368
+ label="Run on day of month"
369
+ .options=${monthDayOptions}
370
+ .value=${this._monthDay}
371
+ @change=${(e: any) => {
372
+ this._monthDay = e.target.value;
373
+ this._generateOutput();
374
+ }}
375
+ ></st-select>
376
+ </div>
377
+ `
378
+ : ""}
379
+ ${this._frequency === "one-off"
380
+ ? html`
381
+ <div class="row">
382
+ <label>Execution Date</label>
383
+ <st-calendar
384
+ .value=${this._date}
385
+ @change=${(e: any) => {
386
+ this._date = e.target.value;
387
+ this._generateOutput();
388
+ }}
389
+ ></st-calendar>
390
+ </div>
391
+ `
392
+ : ""}
393
+ ${this._frequency === "custom"
394
+ ? html`
395
+ <div class="row">
396
+ <st-input
397
+ label="Raw Cron Expression"
398
+ placeholder="*/15 * * * *"
399
+ .value=${this._customCron}
400
+ .error=${this._customCronError}
401
+ ?invalid=${!!this._customCronError}
402
+ @input=${this._handleCustomCronInput}
403
+ ></st-input>
404
+ <div class="cron-segments" aria-hidden="true">
405
+ ${["Minute", "Hour", "Day", "Month", "Weekday"].map(
406
+ (label, i) => html`
407
+ <div class="segment-badge ${activeSegmentIndex === i ? "active" : ""}">
408
+ ${label}
409
+ </div>
410
+ `,
411
+ )}
412
+ </div>
413
+
414
+ ${this._customCronText && !this._customCronError
415
+ ? html`
416
+ <div class="helper-text success-text">
417
+ <strong>Schedule:</strong> ${this._customCronText}
418
+ </div>
419
+ `
420
+ : ""}
421
+ </div>
422
+ `
423
+ : ""}
424
+ ${this._frequency !== "custom"
425
+ ? html`
426
+ <div class="row">
427
+ <st-time-picker
428
+ label="Execution Time"
429
+ .value=${this._time}
430
+ @change=${(e: any) => {
431
+ this._time = e.target.value;
432
+ this._generateOutput();
433
+ }}
434
+ ></st-time-picker>
435
+ </div>
436
+ `
437
+ : ""}
438
+
439
+ <div class="output-preview">
440
+ <div class="helper-text">Generated Payload</div>
441
+ <code>${this.value}</code>
442
+ </div>
443
+ </div>
444
+ `;
445
+ }
446
+ }
447
+
448
+ declare global {
449
+ interface HTMLElementTagNameMap {
450
+ "st-cron-builder": StCronBuilder;
451
+ }
452
+ }
@@ -0,0 +1,5 @@
1
+ export const dividerDirections = ['horizontal', 'vertical'] as const;
2
+ export type DividerDirection = typeof dividerDirections[number];
3
+
4
+ export const dividerColors = ['default', 'primary', 'border'] as const;
5
+ export type DividerColor = typeof dividerColors[number];
@@ -1,13 +1,14 @@
1
1
  import { LitElement, html, css } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
3
  import { resetStyles } from '../../styles/reset.js';
4
+ import { DividerColor, DividerDirection } from './divider.constants.js';
4
5
 
5
6
  @customElement('st-divider')
6
7
  export class StDivider extends LitElement {
7
- @property({ type: String, reflect: true }) direction: 'horizontal' | 'vertical' = 'horizontal';
8
+ @property({ type: String, reflect: true }) direction: DividerDirection = 'horizontal';
8
9
  @property({ type: String }) thickness = '1px';
9
10
  @property({ type: String }) margin = '0';
10
- @property({ type: String, reflect: true }) color: 'default' | 'primary' | 'border' = 'border';
11
+ @property({ type: String, reflect: true }) color: DividerColor = 'border';
11
12
 
12
13
  static styles = [
13
14
  resetStyles,
@@ -43,22 +44,32 @@ export class StDivider extends LitElement {
43
44
  `
44
45
  ];
45
46
 
47
+ connectedCallback() {
48
+ super.connectedCallback();
49
+ // Semantic role belongs on the host element
50
+ if (!this.hasAttribute('role')) {
51
+ this.setAttribute('role', 'separator');
52
+ }
53
+ }
54
+
46
55
  updated(changedProperties: Map<string, any>) {
47
56
  super.updated(changedProperties);
48
57
 
49
58
  // Sync properties to CSS variables for dynamic adjustment
50
- this.style.setProperty('--divider-thickness', this.thickness);
51
- this.style.setProperty('--divider-margin', this.margin);
59
+ if (changedProperties.has('thickness') || changedProperties.has('margin')) {
60
+ this.style.setProperty('--divider-thickness', this.thickness);
61
+ this.style.setProperty('--divider-margin', this.margin);
62
+ }
63
+
64
+ // Keep native ARIA attributes perfectly synced with our Lit properties
65
+ if (changedProperties.has('direction')) {
66
+ this.setAttribute('aria-orientation', this.direction);
67
+ }
52
68
  }
53
69
 
54
70
  render() {
55
- // Accessibility: Set role and aria-orientation
56
- return html`
57
- <div
58
- role="separator"
59
- aria-orientation="${this.direction === 'horizontal' ? 'horizontal' : 'vertical'}"
60
- ></div>
61
- `;
71
+ // The host element itself is the structural divider. No inner DOM bloat needed.
72
+ return html``;
62
73
  }
63
74
  }
64
75