mtrl 0.2.7 → 0.2.9

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 (190) hide show
  1. package/index.ts +2 -0
  2. package/package.json +14 -3
  3. package/src/components/badge/api.ts +23 -14
  4. package/src/components/badge/badge.ts +2 -2
  5. package/src/components/badge/config.ts +10 -11
  6. package/src/components/badge/features.ts +15 -10
  7. package/src/components/badge/index.ts +27 -2
  8. package/src/components/badge/types.ts +28 -8
  9. package/src/components/bottom-app-bar/bottom-app-bar.ts +2 -44
  10. package/src/components/bottom-app-bar/config.ts +1 -45
  11. package/src/components/bottom-app-bar/index.ts +7 -1
  12. package/src/components/bottom-app-bar/types.ts +7 -1
  13. package/src/components/button/button.ts +0 -1
  14. package/src/components/button/config.ts +1 -2
  15. package/src/components/button/index.ts +10 -2
  16. package/src/components/button/types.ts +14 -2
  17. package/src/components/card/config.ts +17 -9
  18. package/src/components/card/content.ts +8 -10
  19. package/src/components/card/features.ts +4 -6
  20. package/src/components/card/index.ts +29 -2
  21. package/src/components/card/types.ts +6 -23
  22. package/src/components/checkbox/config.ts +3 -4
  23. package/src/components/checkbox/index.ts +1 -2
  24. package/src/components/checkbox/types.ts +12 -3
  25. package/src/components/chip/api.ts +170 -221
  26. package/src/components/chip/chip.ts +34 -302
  27. package/src/components/chip/config.ts +1 -2
  28. package/src/components/chip/index.ts +10 -2
  29. package/src/components/chip/types.ts +224 -35
  30. package/src/components/datepicker/api.ts +18 -25
  31. package/src/components/datepicker/config.ts +9 -12
  32. package/src/components/datepicker/datepicker.ts +7 -12
  33. package/src/components/datepicker/index.ts +10 -7
  34. package/src/components/datepicker/render.ts +16 -18
  35. package/src/components/datepicker/types.ts +164 -35
  36. package/src/components/datepicker/utils.ts +1 -2
  37. package/src/components/dialog/api.ts +7 -8
  38. package/src/components/dialog/config.ts +3 -4
  39. package/src/components/dialog/features.ts +56 -22
  40. package/src/components/dialog/index.ts +38 -8
  41. package/src/components/dialog/types.ts +33 -10
  42. package/src/components/divider/index.ts +5 -1
  43. package/src/components/extended-fab/config.ts +6 -2
  44. package/src/components/extended-fab/index.ts +7 -2
  45. package/src/components/extended-fab/types.ts +21 -4
  46. package/src/components/fab/config.ts +3 -4
  47. package/src/components/fab/fab.ts +1 -1
  48. package/src/components/fab/index.ts +7 -2
  49. package/src/components/fab/types.ts +21 -4
  50. package/src/components/list/config.ts +4 -5
  51. package/src/components/list/features.ts +6 -7
  52. package/src/components/list/index.ts +7 -9
  53. package/src/components/list/list-item.ts +12 -13
  54. package/src/components/list/types.ts +50 -5
  55. package/src/components/list/utils.ts +30 -3
  56. package/src/components/menu/features/items-manager.ts +9 -9
  57. package/src/components/menu/features/positioning.ts +7 -7
  58. package/src/components/menu/features/visibility.ts +7 -7
  59. package/src/components/menu/index.ts +7 -9
  60. package/src/components/menu/menu-item.ts +6 -6
  61. package/src/components/menu/menu.ts +22 -0
  62. package/src/components/menu/types.ts +29 -10
  63. package/src/components/menu/utils.ts +67 -0
  64. package/src/components/navigation/api.ts +131 -96
  65. package/src/components/navigation/config.ts +22 -10
  66. package/src/components/navigation/features/controller.ts +273 -0
  67. package/src/components/navigation/features/items.ts +160 -87
  68. package/src/components/navigation/index.ts +0 -6
  69. package/src/components/navigation/nav-item.ts +12 -24
  70. package/src/components/navigation/navigation.ts +21 -8
  71. package/src/components/navigation/system-types.ts +124 -0
  72. package/src/components/navigation/system.ts +776 -0
  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/config.ts +20 -2
  93. package/src/components/slider/features/controller.ts +761 -0
  94. package/src/components/slider/features/handlers.ts +18 -15
  95. package/src/components/slider/features/index.ts +3 -2
  96. package/src/components/slider/features/range.ts +104 -0
  97. package/src/components/slider/slider.ts +34 -14
  98. package/src/components/slider/structure.ts +152 -0
  99. package/src/components/slider/types.ts +34 -8
  100. package/src/components/snackbar/config.ts +2 -3
  101. package/src/components/snackbar/constants.ts +0 -32
  102. package/src/components/snackbar/index.ts +0 -1
  103. package/src/components/snackbar/position.ts +9 -1
  104. package/src/components/snackbar/types.ts +122 -46
  105. package/src/components/switch/config.ts +2 -3
  106. package/src/components/switch/index.ts +0 -1
  107. package/src/components/switch/types.ts +3 -2
  108. package/src/components/tabs/config.ts +3 -4
  109. package/src/components/tabs/index.ts +0 -15
  110. package/src/components/tabs/tab-api.ts +12 -4
  111. package/src/components/tabs/tab.ts +18 -6
  112. package/src/components/tabs/types.ts +13 -3
  113. package/src/components/textfield/api.ts +53 -0
  114. package/src/components/textfield/config.ts +2 -3
  115. package/src/components/textfield/features.ts +322 -0
  116. package/src/components/textfield/index.ts +0 -1
  117. package/src/components/textfield/textfield.ts +8 -0
  118. package/src/components/textfield/types.ts +29 -6
  119. package/src/components/timepicker/api.ts +1 -1
  120. package/src/components/timepicker/clockdial.ts +2 -5
  121. package/src/components/timepicker/config.ts +102 -4
  122. package/src/components/timepicker/index.ts +1 -6
  123. package/src/components/timepicker/render.ts +1 -1
  124. package/src/components/timepicker/timepicker.ts +1 -1
  125. package/src/components/tooltip/api.ts +1 -1
  126. package/src/components/tooltip/config.ts +27 -6
  127. package/src/components/tooltip/index.ts +0 -1
  128. package/src/components/tooltip/types.ts +13 -3
  129. package/src/core/compose/features/textinput.ts +15 -2
  130. package/src/core/compose/features/textlabel.ts +0 -3
  131. package/src/core/composition/features/dom.ts +33 -0
  132. package/src/core/composition/features/icon.ts +131 -0
  133. package/src/core/composition/features/index.ts +11 -0
  134. package/src/core/composition/features/label.ts +156 -0
  135. package/src/core/composition/features/structure.ts +22 -0
  136. package/src/core/composition/index.ts +26 -0
  137. package/src/core/index.ts +1 -1
  138. package/src/core/structure.ts +288 -0
  139. package/src/index.ts +1 -0
  140. package/src/styles/components/_navigation-mobile.scss +244 -0
  141. package/src/styles/components/_navigation-system.scss +151 -0
  142. package/src/{components/tabs/_styles.scss → styles/components/_tabs.scss} +1 -1
  143. package/src/{components/textfield/_styles.scss → styles/components/_textfield.scss} +314 -72
  144. package/src/styles/main.scss +98 -49
  145. package/src/components/badge/constants.ts +0 -40
  146. package/src/components/button/constants.ts +0 -11
  147. package/src/components/card/constants.ts +0 -84
  148. package/src/components/datepicker/constants.ts +0 -98
  149. package/src/components/dialog/constants.ts +0 -32
  150. package/src/components/extended-fab/constants.ts +0 -36
  151. package/src/components/fab/constants.ts +0 -41
  152. package/src/components/menu/constants.ts +0 -154
  153. package/src/components/navigation/constants.ts +0 -200
  154. package/src/components/progress/constants.ts +0 -29
  155. package/src/components/search/constants.ts +0 -21
  156. package/src/components/segmented-button/constants.ts +0 -42
  157. package/src/components/slider/features/slider.ts +0 -318
  158. package/src/components/slider/features/structure.ts +0 -181
  159. package/src/components/slider/features/ui.ts +0 -388
  160. package/src/components/switch/constants.ts +0 -80
  161. package/src/components/tabs/constants.ts +0 -89
  162. package/src/components/textfield/constants.ts +0 -100
  163. package/src/components/timepicker/constants.ts +0 -138
  164. /package/src/{components/badge/_styles.scss → styles/components/_badge.scss} +0 -0
  165. /package/src/{components/bottom-app-bar/_styles.scss → styles/components/_bottom-app-bar.scss} +0 -0
  166. /package/src/{components/button/_styles.scss → styles/components/_button.scss} +0 -0
  167. /package/src/{components/card/_styles.scss → styles/components/_card.scss} +0 -0
  168. /package/src/{components/carousel/_styles.scss → styles/components/_carousel.scss} +0 -0
  169. /package/src/{components/checkbox/_styles.scss → styles/components/_checkbox.scss} +0 -0
  170. /package/src/{components/chip/_styles.scss → styles/components/_chip.scss} +0 -0
  171. /package/src/{components/datepicker/_styles.scss → styles/components/_datepicker.scss} +0 -0
  172. /package/src/{components/dialog/_styles.scss → styles/components/_dialog.scss} +0 -0
  173. /package/src/{components/divider/_styles.scss → styles/components/_divider.scss} +0 -0
  174. /package/src/{components/extended-fab/_styles.scss → styles/components/_extended-fab.scss} +0 -0
  175. /package/src/{components/fab/_styles.scss → styles/components/_fab.scss} +0 -0
  176. /package/src/{components/list/_styles.scss → styles/components/_list.scss} +0 -0
  177. /package/src/{components/menu/_styles.scss → styles/components/_menu.scss} +0 -0
  178. /package/src/{components/navigation/_styles.scss → styles/components/_navigation.scss} +0 -0
  179. /package/src/{components/progress/_styles.scss → styles/components/_progress.scss} +0 -0
  180. /package/src/{components/radios/_styles.scss → styles/components/_radios.scss} +0 -0
  181. /package/src/{components/search/_styles.scss → styles/components/_search.scss} +0 -0
  182. /package/src/{components/segmented-button/_styles.scss → styles/components/_segmented-button.scss} +0 -0
  183. /package/src/{components/sheet/_styles.scss → styles/components/_sheet.scss} +0 -0
  184. /package/src/{components/slider/_styles.scss → styles/components/_slider.scss} +0 -0
  185. /package/src/{components/snackbar/_styles.scss → styles/components/_snackbar.scss} +0 -0
  186. /package/src/{components/switch/_styles.scss → styles/components/_switch.scss} +0 -0
  187. /package/src/{components/timepicker/_styles.scss → styles/components/_timepicker.scss} +0 -0
  188. /package/src/{components/tooltip/_styles.scss → styles/components/_tooltip.scss} +0 -0
  189. /package/src/{components/top-app-bar/_styles.scss → styles/components/_top-app-bar.scss} +0 -0
  190. /package/src/styles/utilities/{_color.scss → _colors.scss} +0 -0
@@ -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,100 +0,0 @@
1
- // src/components/textfield/constants.ts
2
-
3
- /**
4
- * Textfield visual variants
5
- */
6
- export const TEXTFIELD_VARIANTS = {
7
- FILLED: 'filled',
8
- OUTLINED: 'outlined'
9
- } as const;
10
-
11
- /**
12
- * Textfield input types
13
- */
14
- export const TEXTFIELD_TYPES = {
15
- TEXT: 'text',
16
- PASSWORD: 'password',
17
- EMAIL: 'email',
18
- NUMBER: 'number',
19
- TEL: 'tel',
20
- URL: 'url',
21
- SEARCH: 'search',
22
- MULTILINE: 'multiline'
23
- } as const;
24
-
25
- /**
26
- * Validation schema for textfield configuration
27
- */
28
- export const TEXTFIELD_SCHEMA = {
29
- type: {
30
- type: 'string',
31
- enum: Object.values(TEXTFIELD_TYPES),
32
- required: false
33
- },
34
- variant: {
35
- type: 'string',
36
- enum: Object.values(TEXTFIELD_VARIANTS),
37
- required: false
38
- },
39
- name: {
40
- type: 'string',
41
- required: false
42
- },
43
- label: {
44
- type: 'string',
45
- required: false
46
- },
47
- placeholder: {
48
- type: 'string',
49
- required: false
50
- },
51
- value: {
52
- type: 'string',
53
- required: false
54
- },
55
- required: {
56
- type: 'boolean',
57
- required: false
58
- },
59
- disabled: {
60
- type: 'boolean',
61
- required: false
62
- },
63
- maxLength: {
64
- type: 'number',
65
- required: false
66
- },
67
- pattern: {
68
- type: 'string',
69
- required: false
70
- },
71
- autocomplete: {
72
- type: 'string',
73
- required: false
74
- },
75
- class: {
76
- type: 'string',
77
- required: false
78
- }
79
- } as const;
80
-
81
- /**
82
- * Textfield state classes
83
- */
84
- export const TEXTFIELD_STATES = {
85
- FOCUSED: 'focused',
86
- FILLED: 'filled',
87
- DISABLED: 'disabled',
88
- INVALID: 'invalid'
89
- } as const;
90
-
91
- /**
92
- * Textfield element classes
93
- */
94
- export const TEXTFIELD_CLASSES = {
95
- ROOT: 'textfield',
96
- INPUT: 'textfield-input',
97
- LABEL: 'textfield-label',
98
- HELPER: 'textfield-helper',
99
- COUNTER: 'textfield-counter'
100
- } as const;
@@ -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
- };