mtrl 0.2.7 → 0.2.8

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 (164) hide show
  1. package/demo/build.ts +349 -0
  2. package/demo/index.html +110 -0
  3. package/demo/main.js +448 -0
  4. package/demo/styles.css +239 -0
  5. package/package.json +14 -3
  6. package/server.ts +86 -0
  7. package/src/components/badge/api.ts +23 -14
  8. package/src/components/badge/badge.ts +2 -2
  9. package/src/components/badge/config.ts +10 -11
  10. package/src/components/badge/features.ts +15 -10
  11. package/src/components/badge/index.ts +27 -2
  12. package/src/components/badge/types.ts +28 -8
  13. package/src/components/bottom-app-bar/bottom-app-bar.ts +2 -44
  14. package/src/components/bottom-app-bar/config.ts +1 -45
  15. package/src/components/bottom-app-bar/index.ts +7 -1
  16. package/src/components/bottom-app-bar/types.ts +7 -1
  17. package/src/components/button/button.ts +0 -1
  18. package/src/components/button/config.ts +1 -2
  19. package/src/components/button/index.ts +10 -2
  20. package/src/components/button/types.ts +14 -2
  21. package/src/components/card/config.ts +17 -9
  22. package/src/components/card/content.ts +8 -10
  23. package/src/components/card/features.ts +4 -6
  24. package/src/components/card/index.ts +29 -2
  25. package/src/components/card/types.ts +6 -23
  26. package/src/components/checkbox/config.ts +3 -4
  27. package/src/components/checkbox/index.ts +1 -2
  28. package/src/components/checkbox/types.ts +12 -3
  29. package/src/components/chip/api.ts +170 -221
  30. package/src/components/chip/chip.ts +34 -302
  31. package/src/components/chip/config.ts +1 -2
  32. package/src/components/chip/index.ts +10 -2
  33. package/src/components/chip/types.ts +224 -35
  34. package/src/components/datepicker/api.ts +18 -25
  35. package/src/components/datepicker/config.ts +9 -12
  36. package/src/components/datepicker/datepicker.ts +7 -12
  37. package/src/components/datepicker/index.ts +10 -7
  38. package/src/components/datepicker/render.ts +16 -18
  39. package/src/components/datepicker/types.ts +164 -35
  40. package/src/components/datepicker/utils.ts +1 -2
  41. package/src/components/dialog/api.ts +7 -8
  42. package/src/components/dialog/config.ts +3 -4
  43. package/src/components/dialog/features.ts +56 -22
  44. package/src/components/dialog/index.ts +38 -8
  45. package/src/components/dialog/types.ts +33 -10
  46. package/src/components/divider/index.ts +5 -1
  47. package/src/components/extended-fab/config.ts +6 -2
  48. package/src/components/extended-fab/index.ts +7 -2
  49. package/src/components/extended-fab/types.ts +21 -4
  50. package/src/components/fab/config.ts +3 -4
  51. package/src/components/fab/fab.ts +1 -1
  52. package/src/components/fab/index.ts +7 -2
  53. package/src/components/fab/types.ts +21 -4
  54. package/src/components/list/config.ts +4 -5
  55. package/src/components/list/features.ts +6 -7
  56. package/src/components/list/index.ts +7 -9
  57. package/src/components/list/list-item.ts +12 -13
  58. package/src/components/list/types.ts +50 -5
  59. package/src/components/list/utils.ts +30 -3
  60. package/src/components/menu/features/items-manager.ts +9 -9
  61. package/src/components/menu/features/positioning.ts +7 -7
  62. package/src/components/menu/features/visibility.ts +7 -7
  63. package/src/components/menu/index.ts +7 -9
  64. package/src/components/menu/menu-item.ts +6 -6
  65. package/src/components/menu/menu.ts +22 -0
  66. package/src/components/menu/types.ts +29 -10
  67. package/src/components/menu/utils.ts +67 -0
  68. package/src/components/navigation/config.ts +22 -10
  69. package/src/components/navigation/features/items.ts +31 -27
  70. package/src/components/navigation/index.ts +0 -6
  71. package/src/components/navigation/nav-item.ts +12 -24
  72. package/src/components/navigation/navigation.ts +4 -6
  73. package/src/components/navigation/types.ts +228 -203
  74. package/src/components/progress/api.ts +2 -3
  75. package/src/components/progress/config.ts +2 -3
  76. package/src/components/progress/index.ts +0 -1
  77. package/src/components/progress/progress.ts +1 -2
  78. package/src/components/progress/types.ts +186 -33
  79. package/src/components/radios/config.ts +1 -1
  80. package/src/components/radios/index.ts +0 -1
  81. package/src/components/radios/types.ts +0 -7
  82. package/src/components/search/config.ts +1 -2
  83. package/src/components/search/features/search.ts +14 -15
  84. package/src/components/search/features/states.ts +5 -1
  85. package/src/components/search/features/structure.ts +3 -4
  86. package/src/components/search/index.ts +0 -3
  87. package/src/components/search/types.ts +18 -6
  88. package/src/components/segmented-button/config.ts +20 -7
  89. package/src/components/segmented-button/segment.ts +6 -7
  90. package/src/components/segmented-button/segmented-button.ts +4 -5
  91. package/src/components/segmented-button/types.ts +37 -2
  92. package/src/components/slider/types.ts +34 -8
  93. package/src/components/snackbar/config.ts +2 -3
  94. package/src/components/snackbar/constants.ts +0 -32
  95. package/src/components/snackbar/index.ts +0 -1
  96. package/src/components/snackbar/position.ts +9 -1
  97. package/src/components/snackbar/types.ts +122 -46
  98. package/src/components/switch/config.ts +2 -3
  99. package/src/components/switch/index.ts +0 -1
  100. package/src/components/switch/types.ts +3 -2
  101. package/src/components/tabs/config.ts +3 -4
  102. package/src/components/tabs/index.ts +0 -15
  103. package/src/components/tabs/tab-api.ts +12 -4
  104. package/src/components/tabs/tab.ts +18 -6
  105. package/src/components/tabs/types.ts +13 -3
  106. package/src/components/textfield/config.ts +2 -3
  107. package/src/components/textfield/index.ts +0 -1
  108. package/src/components/textfield/types.ts +17 -3
  109. package/src/components/timepicker/api.ts +1 -1
  110. package/src/components/timepicker/clockdial.ts +1 -1
  111. package/src/components/timepicker/config.ts +102 -4
  112. package/src/components/timepicker/index.ts +1 -6
  113. package/src/components/timepicker/render.ts +1 -1
  114. package/src/components/timepicker/timepicker.ts +1 -1
  115. package/src/components/tooltip/api.ts +1 -1
  116. package/src/components/tooltip/config.ts +27 -6
  117. package/src/components/tooltip/index.ts +0 -1
  118. package/src/components/tooltip/types.ts +13 -3
  119. package/src/core/compose/features/textlabel.ts +0 -3
  120. package/src/{components/tabs/_styles.scss → styles/components/_tabs.scss} +1 -1
  121. package/src/{components/textfield/_styles.scss → styles/components/_textfield.scss} +70 -67
  122. package/src/styles/main.scss +98 -49
  123. package/src/components/badge/constants.ts +0 -40
  124. package/src/components/button/constants.ts +0 -11
  125. package/src/components/card/constants.ts +0 -84
  126. package/src/components/datepicker/constants.ts +0 -98
  127. package/src/components/dialog/constants.ts +0 -32
  128. package/src/components/extended-fab/constants.ts +0 -36
  129. package/src/components/fab/constants.ts +0 -41
  130. package/src/components/menu/constants.ts +0 -154
  131. package/src/components/navigation/constants.ts +0 -200
  132. package/src/components/progress/constants.ts +0 -29
  133. package/src/components/search/constants.ts +0 -21
  134. package/src/components/segmented-button/constants.ts +0 -42
  135. package/src/components/switch/constants.ts +0 -80
  136. package/src/components/tabs/constants.ts +0 -89
  137. package/src/components/timepicker/constants.ts +0 -138
  138. /package/src/{components/badge/_styles.scss → styles/components/_badge.scss} +0 -0
  139. /package/src/{components/bottom-app-bar/_styles.scss → styles/components/_bottom-app-bar.scss} +0 -0
  140. /package/src/{components/button/_styles.scss → styles/components/_button.scss} +0 -0
  141. /package/src/{components/card/_styles.scss → styles/components/_card.scss} +0 -0
  142. /package/src/{components/carousel/_styles.scss → styles/components/_carousel.scss} +0 -0
  143. /package/src/{components/checkbox/_styles.scss → styles/components/_checkbox.scss} +0 -0
  144. /package/src/{components/chip/_styles.scss → styles/components/_chip.scss} +0 -0
  145. /package/src/{components/datepicker/_styles.scss → styles/components/_datepicker.scss} +0 -0
  146. /package/src/{components/dialog/_styles.scss → styles/components/_dialog.scss} +0 -0
  147. /package/src/{components/divider/_styles.scss → styles/components/_divider.scss} +0 -0
  148. /package/src/{components/extended-fab/_styles.scss → styles/components/_extended-fab.scss} +0 -0
  149. /package/src/{components/fab/_styles.scss → styles/components/_fab.scss} +0 -0
  150. /package/src/{components/list/_styles.scss → styles/components/_list.scss} +0 -0
  151. /package/src/{components/menu/_styles.scss → styles/components/_menu.scss} +0 -0
  152. /package/src/{components/navigation/_styles.scss → styles/components/_navigation.scss} +0 -0
  153. /package/src/{components/progress/_styles.scss → styles/components/_progress.scss} +0 -0
  154. /package/src/{components/radios/_styles.scss → styles/components/_radios.scss} +0 -0
  155. /package/src/{components/search/_styles.scss → styles/components/_search.scss} +0 -0
  156. /package/src/{components/segmented-button/_styles.scss → styles/components/_segmented-button.scss} +0 -0
  157. /package/src/{components/sheet/_styles.scss → styles/components/_sheet.scss} +0 -0
  158. /package/src/{components/slider/_styles.scss → styles/components/_slider.scss} +0 -0
  159. /package/src/{components/snackbar/_styles.scss → styles/components/_snackbar.scss} +0 -0
  160. /package/src/{components/switch/_styles.scss → styles/components/_switch.scss} +0 -0
  161. /package/src/{components/timepicker/_styles.scss → styles/components/_timepicker.scss} +0 -0
  162. /package/src/{components/tooltip/_styles.scss → styles/components/_tooltip.scss} +0 -0
  163. /package/src/{components/top-app-bar/_styles.scss → styles/components/_top-app-bar.scss} +0 -0
  164. /package/src/styles/utilities/{_color.scss → _colors.scss} +0 -0
@@ -1,200 +0,0 @@
1
- // src/components/navigation/constants.ts
2
-
3
- /**
4
- * Navigation variants following Material Design 3
5
- */
6
- export const NAV_VARIANTS = {
7
- RAIL: 'rail', // Vertical slim navigation
8
- DRAWER: 'drawer', // Expandable side navigation
9
- BAR: 'bar', // Bottom or top navigation bar
10
- DRAWER_MODAL: 'modal', // Modal drawer overlay
11
- DRAWER_STANDARD: 'standard' // Standard permanent drawer
12
- } as const;
13
-
14
- /**
15
- * Navigation positions
16
- */
17
- export const NAV_POSITIONS = {
18
- LEFT: 'left',
19
- RIGHT: 'right',
20
- TOP: 'top',
21
- BOTTOM: 'bottom'
22
- } as const;
23
-
24
- /**
25
- * Navigation behaviors
26
- */
27
- export const NAV_BEHAVIORS = {
28
- FIXED: 'fixed', // Always visible
29
- DISMISSIBLE: 'dismissible', // Can be dismissed/hidden
30
- MODAL: 'modal' // Overlays content with scrim
31
- } as const;
32
-
33
- /**
34
- * Navigation state classes
35
- */
36
- export const NAV_STATES = {
37
- ACTIVE: 'active', // Currently selected item
38
- DISABLED: 'disabled', // Disabled state
39
- EXPANDED: 'expanded', // Drawer expanded state
40
- COLLAPSED: 'collapsed', // Drawer collapsed state
41
- HOVERED: 'hovered', // Hover state
42
- FOCUSED: 'focused', // Keyboard focus state
43
- PRESSED: 'pressed' // Press/click state
44
- } as const;
45
-
46
- /**
47
- * Navigation element classes
48
- */
49
- export const NAV_CLASSES = {
50
- ROOT: 'nav',
51
- ITEM: 'nav-item',
52
- ITEM_CONTAINER: 'nav-item-container',
53
- ICON: 'nav-item-icon',
54
- LABEL: 'nav-item-label',
55
- BADGE: 'nav-item-badge',
56
- DIVIDER: 'nav-divider',
57
- SCRIM: 'nav-scrim',
58
- GROUP: 'nav-group',
59
- GROUP_TITLE: 'nav-group-title',
60
- SUBTITLE: 'nav-subtitle',
61
- NESTED_CONTAINER: 'nav-nested-container',
62
- NESTED_ITEM: 'nav-nested-item',
63
- EXPAND_ICON: 'nav-expand-icon'
64
- } as const;
65
-
66
- /**
67
- * Validation schema for navigation configuration
68
- */
69
- export const NAV_SCHEMA = {
70
- type: 'object',
71
- properties: {
72
- variant: {
73
- type: 'string',
74
- enum: Object.values(NAV_VARIANTS),
75
- optional: true,
76
- default: NAV_VARIANTS.RAIL
77
- },
78
- position: {
79
- type: 'string',
80
- enum: Object.values(NAV_POSITIONS),
81
- optional: true,
82
- default: NAV_POSITIONS.LEFT
83
- },
84
- behavior: {
85
- type: 'string',
86
- enum: Object.values(NAV_BEHAVIORS),
87
- optional: true,
88
- default: NAV_BEHAVIORS.FIXED
89
- },
90
- items: {
91
- type: 'array',
92
- optional: true,
93
- default: []
94
- },
95
- groups: {
96
- type: 'array',
97
- optional: true
98
- },
99
- disabled: {
100
- type: 'boolean',
101
- optional: true
102
- },
103
- expanded: {
104
- type: 'boolean',
105
- optional: true
106
- },
107
- showLabels: {
108
- type: 'boolean',
109
- optional: true,
110
- default: true
111
- },
112
- scrimEnabled: {
113
- type: 'boolean',
114
- optional: true,
115
- default: false
116
- },
117
- class: {
118
- type: 'string',
119
- optional: true
120
- }
121
- }
122
- } as const;
123
-
124
- /**
125
- * Navigation item states
126
- */
127
- export const NAV_ITEM_STATES = {
128
- EXPANDED: 'expanded',
129
- COLLAPSED: 'collapsed'
130
- } as const;
131
-
132
- /**
133
- * Navigation item schema
134
- * Enhanced with support for nested items
135
- */
136
- export const NAV_ITEM_SCHEMA = {
137
- type: 'object',
138
- properties: {
139
- id: {
140
- type: 'string',
141
- required: true
142
- },
143
- icon: {
144
- type: 'string',
145
- required: true
146
- },
147
- label: {
148
- type: 'string',
149
- required: true
150
- },
151
- badge: {
152
- type: 'string',
153
- optional: true
154
- },
155
- disabled: {
156
- type: 'boolean',
157
- optional: true
158
- },
159
- subtitle: {
160
- type: 'string',
161
- optional: true
162
- },
163
- groupId: {
164
- type: 'string',
165
- optional: true
166
- },
167
- items: {
168
- type: 'array',
169
- optional: true,
170
- description: 'Nested navigation items'
171
- },
172
- expanded: {
173
- type: 'boolean',
174
- optional: true,
175
- default: false
176
- }
177
- }
178
- } as const;
179
-
180
- /**
181
- * Navigation group schema
182
- */
183
- export const NAV_GROUP_SCHEMA = {
184
- type: 'object',
185
- properties: {
186
- id: {
187
- type: 'string',
188
- required: true
189
- },
190
- title: {
191
- type: 'string',
192
- required: true
193
- },
194
- expanded: {
195
- type: 'boolean',
196
- optional: true,
197
- default: true
198
- }
199
- }
200
- } as const;
@@ -1,29 +0,0 @@
1
- // src/components/progress/constants.ts
2
-
3
- /**
4
- * Progress component variants
5
- */
6
- export const PROGRESS_VARIANTS = {
7
- /** Standard linear progress bar */
8
- LINEAR: 'linear',
9
-
10
- /** Circular progress indicator */
11
- CIRCULAR: 'circular',
12
-
13
- /** Progress with known value */
14
- DETERMINATE: 'determinate',
15
-
16
- /** Indeterminate progress animation */
17
- INDETERMINATE: 'indeterminate'
18
- } as const;
19
-
20
- /**
21
- * Progress component events
22
- */
23
- export const PROGRESS_EVENTS = {
24
- /** Fired when value changes */
25
- VALUE_CHANGE: 'valueChange',
26
-
27
- /** Fired when component becomes determinate/indeterminate */
28
- STATE_CHANGE: 'stateChange'
29
- } as const;
@@ -1,21 +0,0 @@
1
- // src/components/search/constants.ts
2
-
3
- /**
4
- * Available search component variants
5
- */
6
- export const SEARCH_VARIANTS = {
7
- BAR: 'bar',
8
- VIEW: 'view'
9
- } as const;
10
-
11
- /**
12
- * Available search component events
13
- */
14
- export const SEARCH_EVENTS = {
15
- FOCUS: 'focus',
16
- BLUR: 'blur',
17
- INPUT: 'input',
18
- SUBMIT: 'submit',
19
- CLEAR: 'clear',
20
- ICON_CLICK: 'iconClick'
21
- } as const;
@@ -1,42 +0,0 @@
1
- // src/components/segmented-button/constants.ts
2
- import { SelectionMode } from './types';
3
-
4
- /**
5
- * Default checkbox icon SVG used for selected state
6
- * @internal
7
- */
8
- export const DEFAULT_CHECKMARK_ICON = `
9
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
10
- <polyline points="20 6 9 17 4 12"></polyline>
11
- </svg>`;
12
-
13
- /**
14
- * Default configuration values for segmented buttons
15
- * @internal
16
- */
17
- export const DEFAULT_CONFIG = {
18
- mode: SelectionMode.SINGLE,
19
- ripple: true
20
- };
21
-
22
- /**
23
- * Event names used by the segmented button component
24
- * @internal
25
- */
26
- export const EVENTS = {
27
- CHANGE: 'change'
28
- };
29
-
30
- /**
31
- * CSS classes used by the segmented button component
32
- * @internal
33
- */
34
- export const CLASSES = {
35
- CONTAINER: 'segmented-button',
36
- SEGMENT: 'segmented-button-segment',
37
- SELECTED: 'selected',
38
- DISABLED: 'disabled',
39
- ICON: 'icon',
40
- CHECKMARK: 'checkmark',
41
- TEXT: 'text'
42
- };
@@ -1,80 +0,0 @@
1
- // src/components/switch/constants.ts
2
-
3
- /**
4
- * Label position options
5
- */
6
- export const SWITCH_LABEL_POSITION = {
7
- START: 'start',
8
- END: 'end'
9
- } as const;
10
-
11
- /**
12
- * Validation schema for switch configuration
13
- */
14
- export const SWITCH_SCHEMA = {
15
- type: 'object',
16
- properties: {
17
- name: {
18
- type: 'string',
19
- optional: true
20
- },
21
- checked: {
22
- type: 'boolean',
23
- optional: true
24
- },
25
- required: {
26
- type: 'boolean',
27
- optional: true
28
- },
29
- disabled: {
30
- type: 'boolean',
31
- optional: true
32
- },
33
- value: {
34
- type: 'string',
35
- optional: true
36
- },
37
- label: {
38
- type: 'string',
39
- optional: true
40
- },
41
- labelPosition: {
42
- type: 'string',
43
- enum: Object.values(SWITCH_LABEL_POSITION),
44
- optional: true
45
- },
46
- icon: {
47
- type: 'string',
48
- optional: true
49
- },
50
- ariaLabel: {
51
- type: 'string',
52
- optional: true
53
- },
54
- class: {
55
- type: 'string',
56
- optional: true
57
- }
58
- }
59
- } as const;
60
-
61
- /**
62
- * Switch state classes
63
- */
64
- export const SWITCH_STATES = {
65
- CHECKED: 'checked',
66
- DISABLED: 'disabled',
67
- FOCUSED: 'focused'
68
- } as const;
69
-
70
- /**
71
- * Switch element classes
72
- */
73
- export const SWITCH_CLASSES = {
74
- ROOT: 'switch',
75
- INPUT: 'switch-input',
76
- TRACK: 'switch-track',
77
- THUMB: 'thumb',
78
- THUMB_ICON: 'thumb-icon',
79
- LABEL: 'switch-label'
80
- } as const;
@@ -1,89 +0,0 @@
1
- // src/components/tabs/constants.ts
2
-
3
- /**
4
- * Tab variants
5
- */
6
- export const TABS_VARIANTS = {
7
- /** Primary tabs (standard MD3 style) */
8
- PRIMARY: 'primary',
9
- /** Secondary tabs (less prominent variant) */
10
- SECONDARY: 'secondary'
11
- };
12
-
13
- /**
14
- * Tab states
15
- */
16
- export const TAB_STATES = {
17
- /** Active (selected) tab state */
18
- ACTIVE: 'active',
19
- /** Inactive (unselected) tab state */
20
- INACTIVE: 'inactive',
21
- /** Disabled tab state */
22
- DISABLED: 'disabled'
23
- };
24
-
25
- /**
26
- * Tab layout types
27
- */
28
- export const TAB_LAYOUT = {
29
- /** Icon-only tab layout */
30
- ICON_ONLY: 'icon-only',
31
- /** Text-only tab layout */
32
- TEXT_ONLY: 'text-only',
33
- /** Icon and text layout */
34
- ICON_AND_TEXT: 'icon-and-text'
35
- };
36
-
37
- /**
38
- * Tab interaction states (for styling)
39
- */
40
- export const TAB_INTERACTION_STATES = {
41
- /** Default enabled state */
42
- ENABLED: 'enabled',
43
- /** Hover state */
44
- HOVER: 'hover',
45
- /** Focus state */
46
- FOCUS: 'focus',
47
- /** Pressed/active state */
48
- PRESSED: 'pressed'
49
- };
50
-
51
- /**
52
- * Tab animation constants
53
- */
54
- export const TAB_ANIMATION = {
55
- /** Standard transition duration in ms */
56
- TRANSITION_DURATION: 200,
57
- /** Standard transition timing function */
58
- TRANSITION_TIMING: 'cubic-bezier(0.4, 0, 0.2, 1)',
59
- /** Ripple animation duration in ms */
60
- RIPPLE_DURATION: 400
61
- };
62
-
63
- /**
64
- * Tab accessibility roles
65
- */
66
- export const TAB_A11Y = {
67
- /** Tab role */
68
- TAB_ROLE: 'tab',
69
- /** Tablist role */
70
- TABLIST_ROLE: 'tablist',
71
- /** Tabpanel role */
72
- TABPANEL_ROLE: 'tabpanel'
73
- };
74
-
75
- /**
76
- * MD3 tokens for tab colors
77
- */
78
- export const TAB_COLORS = {
79
- /** Surface color for container */
80
- SURFACE: 'surface',
81
- /** Primary color for active tab and indicator */
82
- PRIMARY: 'primary',
83
- /** On-surface color for active secondary tabs */
84
- ON_SURFACE: 'on-surface',
85
- /** On-surface-variant for inactive tabs */
86
- ON_SURFACE_VARIANT: 'on-surface-variant',
87
- /** Outline variant for divider */
88
- OUTLINE_VARIANT: 'outline-variant'
89
- };
@@ -1,138 +0,0 @@
1
- // src/components/timepicker/constants.ts
2
-
3
- import {
4
- TIME_PICKER_TYPE,
5
- TIME_PICKER_ORIENTATION,
6
- TIME_FORMAT,
7
- TIME_PERIOD
8
- } from './types';
9
-
10
- /**
11
- * Default clock icon for time picker.
12
- * Simple clock SVG.
13
- */
14
- export const DEFAULT_CLOCK_ICON = `
15
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
16
- <circle cx="12" cy="12" r="10"></circle>
17
- <polyline points="12 6 12 12 16 14"></polyline>
18
- </svg>
19
- `;
20
-
21
- /**
22
- * Default keyboard icon for time picker.
23
- * Simple keyboard SVG.
24
- */
25
- export const DEFAULT_KEYBOARD_ICON = `
26
- <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
27
- <rect x="2" y="4" width="20" height="16" rx="2" ry="2"></rect>
28
- <line x1="6" y1="8" x2="6" y2="8"></line>
29
- <line x1="10" y1="8" x2="10" y2="8"></line>
30
- <line x1="14" y1="8" x2="14" y2="8"></line>
31
- <line x1="18" y1="8" x2="18" y2="8"></line>
32
- <line x1="6" y1="12" x2="6" y2="12"></line>
33
- <line x1="10" y1="12" x2="10" y2="12"></line>
34
- <line x1="14" y1="12" x2="14" y2="12"></line>
35
- <line x1="18" y1="12" x2="18" y2="12"></line>
36
- <line x1="6" y1="16" x2="18" y2="16"></line>
37
- </svg>
38
- `;
39
-
40
- /**
41
- * Element selectors for time picker components.
42
- * Used for DOM manipulation and event delegation.
43
- */
44
- export const SELECTORS = {
45
- CONTAINER: '.mtrl-time-picker',
46
- MODAL: '.mtrl-time-picker-modal',
47
- DIALOG: '.mtrl-time-picker-dialog',
48
- TITLE: '.mtrl-time-picker-title',
49
- CONTENT: '.mtrl-time-picker-content',
50
- DIAL: '.mtrl-time-picker-dial',
51
- DIAL_CANVAS: '.mtrl-time-picker-dial-canvas',
52
- DIAL_FACE: '.mtrl-time-picker-dial-face',
53
- DIAL_HAND: '.mtrl-time-picker-dial-hand',
54
- DIAL_CENTER: '.mtrl-time-picker-dial-center',
55
- DIAL_NUMBERS: '.mtrl-time-picker-dial-numbers',
56
- DIAL_NUMBER: '.mtrl-time-picker-dial-number',
57
- INPUT_CONTAINER: '.mtrl-time-picker-input-container',
58
- HOURS_INPUT: '.mtrl-time-picker-hours',
59
- MINUTES_INPUT: '.mtrl-time-picker-minutes',
60
- SECONDS_INPUT: '.mtrl-time-picker-seconds',
61
- SEPARATOR: '.mtrl-time-picker-separator',
62
- PERIOD_CONTAINER: '.mtrl-time-picker-period',
63
- PERIOD_AM: '.mtrl-time-picker-period-am',
64
- PERIOD_PM: '.mtrl-time-picker-period-pm',
65
- ACTIONS: '.mtrl-time-picker-actions',
66
- TOGGLE_TYPE_BUTTON: '.mtrl-time-picker-toggle-type',
67
- CANCEL_BUTTON: '.mtrl-time-picker-cancel',
68
- CONFIRM_BUTTON: '.mtrl-time-picker-confirm',
69
- };
70
-
71
- export const DIAL_CONSTANTS = {
72
- DIAMETER: 256,
73
- INNER_RADIUS: 65,
74
- OUTER_RADIUS: 110,
75
- NUMBER_SIZE: 40,
76
- CENTER_SIZE: 8,
77
- HAND_SIZE: 36,
78
- TRACK_WIDTH: 2,
79
- };
80
-
81
-
82
- /**
83
- * Z-index values for different parts of the time picker.
84
- */
85
- export const Z_INDEX = {
86
- MODAL: 1050,
87
- DIALOG: 1051,
88
- };
89
-
90
- /**
91
- * Time constants used in the time picker.
92
- */
93
- export const TIME_CONSTANTS = {
94
- HOURS_12: Array.from({ length: 12 }, (_, i) => (i === 0 ? 12 : i)),
95
- HOURS_24: Array.from({ length: 24 }, (_, i) => i),
96
- MINUTES: Array.from({ length: 60 }, (_, i) => i),
97
- SECONDS: Array.from({ length: 60 }, (_, i) => i),
98
- };
99
-
100
- /**
101
- * Custom events fired by the time picker.
102
- */
103
- export const EVENTS = {
104
- CHANGE: 'change',
105
- OPEN: 'open',
106
- CLOSE: 'close',
107
- CONFIRM: 'confirm',
108
- CANCEL: 'cancel',
109
- };
110
-
111
- /**
112
- * Animation timing for the time picker.
113
- */
114
- export const ANIMATION = {
115
- OPEN_DURATION: 300,
116
- CLOSE_DURATION: 200,
117
- DIAL_SELECT_DURATION: 150,
118
- };
119
-
120
- /**
121
- * Size constants for the time input fields.
122
- */
123
- export const INPUT_CONSTANTS = {
124
- FIELD_WIDTH: 96,
125
- FIELD_HEIGHT: 72,
126
- PERIOD_WIDTH: 52,
127
- PERIOD_HEIGHT: 72,
128
- };
129
-
130
- /**
131
- * Time picker type exports for convenience.
132
- */
133
- export {
134
- TIME_PICKER_TYPE,
135
- TIME_PICKER_ORIENTATION,
136
- TIME_FORMAT,
137
- TIME_PERIOD
138
- };