@mirai/ui 1.1.0-f → 1.1.1

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 (186) hide show
  1. package/README.md +109 -60
  2. package/build/components/Action/Action.js +1 -1
  3. package/build/components/Action/Action.js.map +1 -1
  4. package/build/components/Action/Action.module.css +4 -7
  5. package/build/components/Action/Action.stories.js +1 -1
  6. package/build/components/Action/Action.stories.js.map +1 -1
  7. package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +26 -40
  8. package/build/components/Button/Button.module.css +30 -33
  9. package/build/components/Button/Button.stories.js +9 -0
  10. package/build/components/Button/Button.stories.js.map +1 -1
  11. package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +21 -30
  12. package/build/components/Calendar/Calendar.Month.js +12 -8
  13. package/build/components/Calendar/Calendar.Month.js.map +1 -1
  14. package/build/components/Calendar/Calendar.Week.js +7 -10
  15. package/build/components/Calendar/Calendar.Week.js.map +1 -1
  16. package/build/components/Calendar/Calendar.js +10 -2
  17. package/build/components/Calendar/Calendar.js.map +1 -1
  18. package/build/components/Calendar/Calendar.module.css +8 -9
  19. package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +15768 -15800
  20. package/build/components/Form/Form.constants.js +1 -1
  21. package/build/components/Form/Form.constants.js.map +1 -1
  22. package/build/components/Form/Form.js +3 -1
  23. package/build/components/Form/Form.js.map +1 -1
  24. package/build/components/Form/Form.stories.js +6 -1
  25. package/build/components/Form/Form.stories.js.map +1 -1
  26. package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +9 -9
  27. package/build/components/InputDate/__tests__/__snapshots__/InputDate.test.js.snap +42 -42
  28. package/build/components/InputNumber/InputNumber.js +2 -1
  29. package/build/components/InputNumber/InputNumber.js.map +1 -1
  30. package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +138 -153
  31. package/build/components/InputOption/InputOption.js +8 -1
  32. package/build/components/InputOption/InputOption.js.map +1 -1
  33. package/build/components/InputOption/InputOption.module.css +13 -2
  34. package/build/components/InputOption/InputOption.stories.js +2 -1
  35. package/build/components/InputOption/InputOption.stories.js.map +1 -1
  36. package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +96 -90
  37. package/build/components/InputPhone/InputPhone.js +23 -20
  38. package/build/components/InputPhone/InputPhone.js.map +1 -1
  39. package/build/components/InputPhone/InputPhone.module.css +19 -6
  40. package/build/components/InputPhone/InputPhone.stories.js +3 -3
  41. package/build/components/InputPhone/InputPhone.stories.js.map +1 -1
  42. package/build/components/InputPhone/__tests__/__snapshots__/InputPhone.test.js.snap +410 -410
  43. package/build/components/InputPhone/helpers/index.js +11 -0
  44. package/build/components/InputPhone/helpers/index.js.map +1 -1
  45. package/build/components/InputPhone/helpers/sanitizePrefixes.js +24 -0
  46. package/build/components/InputPhone/helpers/sanitizePrefixes.js.map +1 -0
  47. package/build/components/InputSelect/InputSelect.js +3 -5
  48. package/build/components/InputSelect/InputSelect.js.map +1 -1
  49. package/build/components/InputSelect/InputSelect.stories.js +1 -0
  50. package/build/components/InputSelect/InputSelect.stories.js.map +1 -1
  51. package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +136 -136
  52. package/build/components/InputSelect/partials/InputSelect.Expand.js +23 -0
  53. package/build/components/InputSelect/partials/InputSelect.Expand.js.map +1 -0
  54. package/build/components/InputSelect/partials/index.js +17 -0
  55. package/build/components/InputSelect/partials/index.js.map +1 -0
  56. package/build/components/InputText/InputText.js +6 -4
  57. package/build/components/InputText/InputText.js.map +1 -1
  58. package/build/components/InputText/InputText.module.css +18 -6
  59. package/build/components/InputText/InputText.stories.js +7 -2
  60. package/build/components/InputText/InputText.stories.js.map +1 -1
  61. package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +142 -143
  62. package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +72 -70
  63. package/build/components/Modal/Modal.js +15 -8
  64. package/build/components/Modal/Modal.js.map +1 -1
  65. package/build/components/Modal/Modal.module.css +30 -14
  66. package/build/components/Modal/Modal.stories.js +1 -0
  67. package/build/components/Modal/Modal.stories.js.map +1 -1
  68. package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +92 -98
  69. package/build/components/Notification/Notification.js +20 -12
  70. package/build/components/Notification/Notification.js.map +1 -1
  71. package/build/components/Notification/Notification.module.css +44 -58
  72. package/build/components/Notification/Notification.stories.js +15 -2
  73. package/build/components/Notification/Notification.stories.js.map +1 -1
  74. package/build/components/Notification/__tests__/__snapshots__/Notification.test.js.snap +600 -254
  75. package/build/components/Progress/Progress.js +2 -0
  76. package/build/components/Progress/Progress.js.map +1 -1
  77. package/build/components/Progress/__tests__/__snapshots__/Progress.test.jsx.snap +18 -18
  78. package/build/components/Slider/Slider.constants.js +3 -1
  79. package/build/components/Slider/Slider.constants.js.map +1 -1
  80. package/build/components/Slider/Slider.js +67 -66
  81. package/build/components/Slider/Slider.js.map +1 -1
  82. package/build/components/Slider/Slider.module.css +55 -52
  83. package/build/components/Slider/Slider.stories.js +9 -6
  84. package/build/components/Slider/Slider.stories.js.map +1 -1
  85. package/build/components/Slider/__tests__/__snapshots__/Slider.test.js.snap +714 -333
  86. package/build/components/Table/Table.ColumnFilter.js +17 -14
  87. package/build/components/Table/Table.ColumnFilter.js.map +1 -1
  88. package/build/components/Table/Table.Row.js +2 -1
  89. package/build/components/Table/Table.Row.js.map +1 -1
  90. package/build/components/Table/Table.constants.js +3 -1
  91. package/build/components/Table/Table.constants.js.map +1 -1
  92. package/build/components/Table/Table.js +54 -17
  93. package/build/components/Table/Table.js.map +1 -1
  94. package/build/components/Table/Table.module.css +12 -6
  95. package/build/components/Table/Table.stories.js +39 -19
  96. package/build/components/Table/Table.stories.js.map +1 -1
  97. package/build/components/Table/Table.stories.module.css +4 -5
  98. package/build/components/Table/__tests__/__snapshots__/Table.ColumnFilter.test.js.snap +221 -240
  99. package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +1725 -1085
  100. package/build/components/Table/helpers/exists.js +2 -3
  101. package/build/components/Table/helpers/exists.js.map +1 -1
  102. package/build/components/Table/helpers/select.js +24 -16
  103. package/build/components/Table/helpers/select.js.map +1 -1
  104. package/build/components/Tooltip/Tooltip.js +29 -6
  105. package/build/components/Tooltip/Tooltip.js.map +1 -1
  106. package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +51 -44
  107. package/build/components/index.js +11 -0
  108. package/build/components/index.js.map +1 -1
  109. package/build/helpers/getInputPhoneErrors.js +3 -2
  110. package/build/helpers/getInputPhoneErrors.js.map +1 -1
  111. package/build/hooks/useDevice.js +1 -1
  112. package/build/hooks/useDevice.js.map +1 -1
  113. package/build/primitives/Checkbox/Checkbox.js +4 -3
  114. package/build/primitives/Checkbox/Checkbox.js.map +1 -1
  115. package/build/primitives/Checkbox/Checkbox.module.css +42 -6
  116. package/build/primitives/Checkbox/__tests__/__snapshots__/Checkbox.test.js.snap +47 -16
  117. package/build/primitives/Icon/Icon.constants.js +43 -21
  118. package/build/primitives/Icon/Icon.constants.js.map +1 -1
  119. package/build/primitives/Icon/Icon.js +15 -5
  120. package/build/primitives/Icon/Icon.js.map +1 -1
  121. package/build/primitives/Icon/Icon.module.css +32 -19
  122. package/build/primitives/Icon/Icon.stories.js +5 -0
  123. package/build/primitives/Icon/Icon.stories.js.map +1 -1
  124. package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +291 -100
  125. package/build/primitives/Input/Input.js +9 -3
  126. package/build/primitives/Input/Input.js.map +1 -1
  127. package/build/primitives/Input/Input.stories.js +2 -0
  128. package/build/primitives/Input/Input.stories.js.map +1 -1
  129. package/build/primitives/Input/__tests__/__snapshots__/Input.test.js.snap +22 -0
  130. package/build/primitives/Layer/Layer.js +11 -5
  131. package/build/primitives/Layer/Layer.js.map +1 -1
  132. package/build/primitives/Layer/Layer.module.css +4 -0
  133. package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +78 -42
  134. package/build/primitives/Layer/helpers/index.js +11 -0
  135. package/build/primitives/Layer/helpers/index.js.map +1 -1
  136. package/build/primitives/Layer/helpers/isComponentFixed.js +32 -0
  137. package/build/primitives/Layer/helpers/isComponentFixed.js.map +1 -0
  138. package/build/primitives/Pressable/Pressable.constants.js +1 -1
  139. package/build/primitives/Pressable/Pressable.constants.js.map +1 -1
  140. package/build/primitives/Pressable/Pressable.js +3 -7
  141. package/build/primitives/Pressable/Pressable.js.map +1 -1
  142. package/build/primitives/Pressable/Pressable.module.css +0 -1
  143. package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +10 -14
  144. package/build/primitives/Primitive/Primitive.js +2 -2
  145. package/build/primitives/Primitive/Primitive.js.map +1 -1
  146. package/build/primitives/Primitive/__tests__/__snapshots__/Primitive.test.js.snap +7 -7
  147. package/build/primitives/Primitive/helpers/index.js +0 -11
  148. package/build/primitives/Primitive/helpers/index.js.map +1 -1
  149. package/build/primitives/Radio/Radio.js +1 -1
  150. package/build/primitives/Radio/Radio.js.map +1 -1
  151. package/build/primitives/Radio/Radio.module.css +18 -2
  152. package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +21 -21
  153. package/build/primitives/ScrollView/ScrollView.js +1 -1
  154. package/build/primitives/ScrollView/ScrollView.js.map +1 -1
  155. package/build/primitives/ScrollView/ScrollView.module.css +1 -0
  156. package/build/primitives/ScrollView/ScrollView.stories.js +5 -6
  157. package/build/primitives/ScrollView/ScrollView.stories.js.map +1 -1
  158. package/build/primitives/ScrollView/__tests__/__snapshots__/ScrollView.test.js.snap +20 -20
  159. package/build/primitives/Select/Select.js +13 -6
  160. package/build/primitives/Select/Select.js.map +1 -1
  161. package/build/primitives/Select/Select.stories.js +1 -0
  162. package/build/primitives/Select/Select.stories.js.map +1 -1
  163. package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +36 -0
  164. package/build/primitives/Switch/Switch.js +5 -3
  165. package/build/primitives/Switch/Switch.js.map +1 -1
  166. package/build/primitives/Switch/Switch.module.css +36 -8
  167. package/build/primitives/Switch/Switch.stories.js +1 -0
  168. package/build/primitives/Switch/Switch.stories.js.map +1 -1
  169. package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +88 -25
  170. package/build/primitives/Text/Text.js +12 -5
  171. package/build/primitives/Text/Text.js.map +1 -1
  172. package/build/primitives/Text/Text.module.css +29 -14
  173. package/build/primitives/Text/Text.stories.js +4 -0
  174. package/build/primitives/Text/Text.stories.js.map +1 -1
  175. package/build/primitives/Text/__tests__/__snapshots__/Text.test.js.snap +78 -38
  176. package/build/primitives/View/View.js +1 -1
  177. package/build/primitives/View/View.js.map +1 -1
  178. package/build/primitives/View/__tests__/__snapshots__/View.test.js.snap +10 -10
  179. package/build/theme/default.theme.css +54 -53
  180. package/build/theme/theme.constants.js +3 -1
  181. package/build/theme/theme.constants.js.map +1 -1
  182. package/build/theme/theme.js +34 -11
  183. package/build/theme/theme.js.map +1 -1
  184. package/package.json +4 -5
  185. package/build/primitives/Primitive/helpers/getTag.js +0 -33
  186. package/build/primitives/Primitive/helpers/getTag.js.map +0 -1
@@ -13,21 +13,19 @@
13
13
  --mirai-ui-font-bold: var(--mirai-ui-font);
14
14
  --mirai-ui-font-bold-weight: 700;
15
15
  --mirai-ui-font-size-headline-1: 32px;
16
- --mirai-ui-line-height-headline-1: 38px;
16
+ --mirai-ui-line-height-headline-1: 40px;
17
17
  --mirai-ui-font-size-headline-2: 24px;
18
- --mirai-ui-line-height-headline-2: 25px;
19
- --mirai-ui-font-size-headline-3: 18px;
20
- --mirai-ui-line-height-headline-3: 22px;
21
- --mirai-ui-font-size-headline-4: 16px;
22
- --mirai-ui-line-height-headline-4: 19px;
18
+ --mirai-ui-line-height-headline-2: 32px;
19
+ --mirai-ui-font-size-headline-3: 20px;
20
+ --mirai-ui-line-height-headline-3: 24px;
23
21
  --mirai-ui-font-size-paragraph: 16px;
24
- --mirai-ui-line-height-paragraph: 22px;
22
+ --mirai-ui-line-height-paragraph: 20px;
25
23
  --mirai-ui-font-size-action: 14px;
26
- --mirai-ui-line-height-action: 20px;
24
+ --mirai-ui-line-height-action: 18px;
27
25
  --mirai-ui-font-size-small: 12px;
28
- --mirai-ui-line-height-small: 18px;
26
+ --mirai-ui-line-height-small: 16px;
29
27
  --mirai-ui-font-size-tiny: 10px;
30
- --mirai-ui-line-height-tiny: 14px;
28
+ --mirai-ui-line-height-tiny: 12px;
31
29
  --mirai-ui-text-direction: ltr;
32
30
  --mirai-ui-text-align: left;
33
31
 
@@ -36,8 +34,8 @@
36
34
 
37
35
  --mirai-ui-content: #484848;
38
36
  --mirai-ui-content-background: #f6f6f6;
39
- --mirai-ui-content-border: #e4e4e4;
40
- --mirai-ui-content-light: #999999;
37
+ --mirai-ui-content-border: #dedede;
38
+ --mirai-ui-content-light: #6e6e6e;
41
39
  --mirai-ui-content-dark: #202020;
42
40
 
43
41
  --mirai-ui-accent: #3978c5;
@@ -46,31 +44,24 @@
46
44
  --mirai-ui-accent-light: #88aedc;
47
45
  --mirai-ui-accent-dark: #224876;
48
46
 
49
- --mirai-ui-error: #cc003a;
50
- --mirai-ui-error-background: #ffece5;
51
- --mirai-ui-error-border: #ff8a7f;
52
- --mirai-ui-error-light: #ff5c4c;
53
- --mirai-ui-error-dark: #99002b;
54
-
55
- --mirai-ui-warning: #ad5a00;
56
- --mirai-ui-warning-background: #fff3cc;
57
- --mirai-ui-warning-border: #ffce66;
58
- --mirai-ui-warning-light: #ffad00;
59
- --mirai-ui-warning-dark: #804200;
60
-
61
- --mirai-ui-success: #067949;
62
- --mirai-ui-success-background: #e7fde7;
63
- --mirai-ui-success-border: #77f18e;
64
- --mirai-ui-success-light: #14be34;
65
- --mirai-ui-success-dark: #04492c;
66
-
67
- --mirai-ui-info-background: #e6f8ff;
68
- --mirai-ui-info-border: #6bc6fe;
69
- --mirai-ui-info-light: #079ffd;
70
- --mirai-ui-info: #005cb2;
71
- --mirai-ui-info-dark: #003566;
47
+ --mirai-ui-error: #d32f2f;
48
+ --mirai-ui-error-background: #fdeded;
49
+ --mirai-ui-error-border: #fad6d6;
50
+
51
+ --mirai-ui-warning: #663c00;
52
+ --mirai-ui-warning-background: #fff4e5;
53
+ --mirai-ui-warning-border: #ffe5c2;
54
+
55
+ --mirai-ui-success: #1e4620;
56
+ --mirai-ui-success-background: #edf7ed;
57
+ --mirai-ui-success-border: #d5ecd5;
58
+
59
+ --mirai-ui-info: #014361;
60
+ --mirai-ui-info-background: #e6f5fd;
61
+ --mirai-ui-info-border: #c6e8fa;
72
62
 
73
63
  /* spacing */
64
+ --mirai-ui-space-XXS: 4px;
74
65
  --mirai-ui-space-XS: 8px;
75
66
  --mirai-ui-space-S: 12px;
76
67
  --mirai-ui-space-M: 16px;
@@ -90,7 +81,7 @@
90
81
 
91
82
  /* input */
92
83
  --mirai-ui-input-font-size: var(--mirai-ui-font-size-paragraph);
93
- --mirai-ui-input-min-height: calc(var(--mirai-ui-space-XL) + var(--mirai-ui-space-XS));
84
+ --mirai-ui-input-min-height: var(--mirai-ui-space-XL);
94
85
 
95
86
  /* border */
96
87
  --mirai-ui-border-radius: 4px;
@@ -99,6 +90,14 @@
99
90
  /* shadow */
100
91
  --mirai-ui-shadow: 0 0 var(--mirai-ui-space-S) rgba(0, 0, 0, 0.1);
101
92
 
93
+ /* focus */
94
+ /* ! TODO: Nice to have */
95
+ /* --mirai-ui-focus-color: var(--mirai-ui-accent-dark); */
96
+ /* --mirai-ui-focus-shadow: 0 0 0 var(--mirai-ui-space-XXS) var(--mirai-ui-accent-border); */
97
+ --mirai-ui-focus-color: var(--mirai-ui-content);
98
+ --mirai-ui-focus-shadow: 0 0 0 var(--mirai-ui-space-XXS) var(--mirai-ui-content-border);
99
+ --mirai-ui-focus-shadow-error: 0 0 0 var(--mirai-ui-space-XXS) var(--mirai-ui-error-border);
100
+
102
101
  /* locale */
103
102
  --mirai-ui-row-direction: row;
104
103
  }
@@ -113,7 +112,9 @@
113
112
  --mirai-ui-checkbox-border-radius: var(--mirai-ui-border-radius);
114
113
  --mirai-ui-checkbox-checked: var(--mirai-ui-accent);
115
114
  --mirai-ui-checkbox-disabled: var(--mirai-ui-content-border);
116
- --mirai-ui-checkbox-size: var(--mirai-ui-space-L);
115
+ --mirai-ui-checkbox-size: calc(var(--mirai-ui-space-M) + calc(var(--mirai-ui-space-XXS) / 2));
116
+ --mirai-ui-checkbox-size-mobile: var(--mirai-ui-space-L);
117
+
117
118
  /* Icon */
118
119
 
119
120
  /* Input */
@@ -136,7 +137,8 @@
136
137
  --mirai-ui-radio-border: var(--mirai-ui-content-light);
137
138
  --mirai-ui-radio-checked: var(--mirai-ui-accent);
138
139
  --mirai-ui-radio-disabled: var(--mirai-ui-content-border);
139
- --mirai-ui-radio-size: var(--mirai-ui-space-L);
140
+ --mirai-ui-radio-size: var(--mirai-ui-checkbox-size);
141
+ --mirai-ui-radio-size-mobile: var(--mirai-ui-checkbox-size-mobile);
140
142
 
141
143
  /* ScrollView */
142
144
 
@@ -145,12 +147,12 @@
145
147
  /* Switch */
146
148
  --mirai-ui-switch-base: var(--mirai-ui-base);
147
149
  --mirai-ui-switch-border-color: var(--mirai-ui-content-light);
148
- --mirai-ui-switch-border-size: calc(var(--mirai-ui-space-XS) / 4);
150
+ --mirai-ui-switch-border-size: var(--mirai-ui-space-XXS);
149
151
  --mirai-ui-switch-border-radius: var(--mirai-ui-space-L);
150
152
  --mirai-ui-switch-checked: var(--mirai-ui-accent);
151
153
  --mirai-ui-switch-disabled: var(--mirai-ui-content-border);
152
- --mirai-ui-switch-color-hover: var(--mirai-ui-content);
153
- --mirai-ui-switch-size: var(--mirai-ui-space-L);
154
+ --mirai-ui-switch-size: var(--mirai-ui-space-M);
155
+ --mirai-ui-switch-size-mobile: calc(var(--mirai-ui-space-L) - var(--mirai-ui-space-XXS));
154
156
 
155
157
  /* Text */
156
158
 
@@ -163,7 +165,6 @@
163
165
  :root {
164
166
  /* Action */
165
167
  --mirai-ui-action-color: var(--mirai-ui-accent);
166
- --mirai-ui-action-color-active: var(--mirai-ui-content);
167
168
  --mirai-ui-action-color-disabled: var(--mirai-ui-content-light);
168
169
  --mirai-ui-action-font-weight: var(--mirai-ui-font-weight);
169
170
 
@@ -173,7 +174,6 @@
173
174
  --mirai-ui-button-busy-motion: calc(var(--mirai-ui-motion-expand) * 10);
174
175
  --mirai-ui-button-color: var(--mirai-ui-base);
175
176
  --mirai-ui-button-color-active: rgba(255, 255, 255, 0.2);
176
- --mirai-ui-button-color-hover: var(--mirai-ui-content);
177
177
  --mirai-ui-button-disabled-background: var(--mirai-ui-content-border);
178
178
  --mirai-ui-button-disabled-color: var(--mirai-ui-content-light);
179
179
  --mirai-ui-button-font-weight: var(--mirai-ui-font-weight);
@@ -205,7 +205,7 @@
205
205
 
206
206
  /* InputOption */
207
207
  --mirai-ui-input-option-disabled: var(--mirai-ui-content-light);
208
- --mirai-ui-input-option-label-margin: var(--mirai-ui-space-S);
208
+ --mirai-ui-input-option-gap: var(--mirai-ui-space-XS);
209
209
  --mirai-ui-input-option-padding-y: var(--mirai-ui-space-S);
210
210
 
211
211
  /* InputSelect */
@@ -217,17 +217,17 @@
217
217
  --mirai-ui-input-text-focus: var(--mirai-ui-content);
218
218
  --mirai-ui-input-text-icon: var(--mirai-ui-font-size-headline-3);
219
219
  --mirai-ui-input-text-padding-x: var(--mirai-ui-space-M);
220
- --mirai-ui-input-text-padding-y: var(--mirai-ui-space-S);
220
+ --mirai-ui-input-text-padding-y: var(--mirai-ui-space-XS);
221
221
  --mirai-ui-input-text-radius: var(--mirai-ui-border-radius);
222
222
 
223
223
  /* Menu */
224
224
  --mirai-ui-menu-base: var(--mirai-ui-base);
225
225
  --mirai-ui-menu-border-radius: var(--mirai-ui-border-radius);
226
- --mirai-ui-menu-min-width: 192px;
226
+ --mirai-ui-menu-min-width: calc(var(--mirai-ui-breakpoint-S) / 2);
227
227
  --mirai-ui-menu-shadow: var(--mirai-ui-shadow);
228
228
  --mirai-ui-menu-option-disabled: var(--mirai-ui-content-border);
229
- --mirai-ui-menu-option-hover-background: var(--mirai-ui-accent);
230
- --mirai-ui-menu-option-hover-color: var(--mirai-ui-base);
229
+ --mirai-ui-menu-option-hover-background: var(--mirai-ui-content-background);
230
+ --mirai-ui-menu-option-hover-color: var(--mirai-ui-content);
231
231
  --mirai-ui-menu-option-padding: var(--mirai-ui-space-M);
232
232
 
233
233
  /* Modal */
@@ -252,9 +252,10 @@
252
252
  --mirai-ui-progress-motion: calc(var(--mirai-ui-motion-expand) * 3);
253
253
 
254
254
  /* Slider */
255
- --mirai-ui-slider-background: var(--mirai-ui-content-dark);
255
+ --mirai-ui-slider-button: var(--mirai-ui-base);
256
+ --mirai-ui-slider-button-icon: var(--mirai-ui-content);
256
257
  --mirai-ui-slider-overlay: rgba(0, 0, 0, 0.66);
257
- --mirai-ui-slider-color: var(--mirai-ui-base);
258
+ --mirai-ui-slider-overlay-color: var(--mirai-ui-base);
258
259
  --mirai-ui-slider-border-radius: var(--mirai-ui-border-radius);
259
260
 
260
261
  /* Table */
@@ -265,11 +266,11 @@
265
266
  --mirai-ui-table-color-disabled: var(--mirai-ui-content-border);
266
267
  --mirai-ui-table-padding-x: var(--mirai-ui-space-M);
267
268
  --mirai-ui-table-padding-y: var(--mirai-ui-space-M);
268
- --mirai-ui-table-selected-background: var(--mirai-ui-accent-background);
269
- --mirai-ui-table-selected-color: var(--mirai-ui-accent);
269
+ --mirai-ui-table-selected-background: var(--mirai-ui-content-background);
270
+ --mirai-ui-table-selected-color: var(--mirai-ui-content);
270
271
 
271
272
  /* Tooltip */
272
- --mirai-ui-tooltip-background: rgba(0, 0, 0, 0.8);
273
+ --mirai-ui-tooltip-background: var(--mirai-ui-content-dark);
273
274
  --mirai-ui-tooltip-border-radius: var(--mirai-ui-border-radius);
274
275
  --mirai-ui-tooltip-color: var(--mirai-ui-base);
275
276
  --mirai-ui-tooltip-space: var(--mirai-ui-space-XS);
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.MAGNITUDES = exports.DOMAIN = exports.DIRECTION_TYPE = exports.DIRECTION = exports.COLORS = void 0;
6
+ exports.MAGNITUDES = exports.DOMAIN = exports.DIRECTION_TYPE = exports.DIRECTION = exports.DEBOUNCE_TIMEOUT_CACHE = exports.COLORS = void 0;
7
7
  var _DIRECTION;
8
8
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9
9
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -11,6 +11,8 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
11
11
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
12
12
  var COLORS = ['accent'];
13
13
  exports.COLORS = COLORS;
14
+ var DEBOUNCE_TIMEOUT_CACHE = 2000;
15
+ exports.DEBOUNCE_TIMEOUT_CACHE = DEBOUNCE_TIMEOUT_CACHE;
14
16
  var DIRECTION_TYPE = {
15
17
  LEFT: 0,
16
18
  RIGHT: 1
@@ -1 +1 @@
1
- {"version":3,"file":"theme.constants.js","names":["COLORS","DIRECTION_TYPE","LEFT","RIGHT","DIRECTION","DOMAIN","MAGNITUDES"],"sources":["../../src/theme/theme.constants.js"],"sourcesContent":["const COLORS = ['accent'];\n\nconst DIRECTION_TYPE = {\n LEFT: 0,\n RIGHT: 1,\n};\nconst DIRECTION = {\n [DIRECTION_TYPE.LEFT]: {\n 'text-align': 'left',\n 'text-direction': 'ltr',\n 'row-direction': 'row',\n },\n [DIRECTION_TYPE.RIGHT]: {\n 'text-align': 'right',\n 'text-direction': 'rtl',\n 'row-direction': 'row-reverse',\n },\n};\nconst DOMAIN = '--mirai-ui-';\n\nconst MAGNITUDES = [400, 300, 200];\n\nexport { COLORS, DIRECTION, DIRECTION_TYPE, DOMAIN, MAGNITUDES };\n"],"mappings":";;;;;;;;;;;AAAA,IAAMA,MAAM,GAAG,CAAC,QAAQ,CAAC;AAAC;AAE1B,IAAMC,cAAc,GAAG;EACrBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE;AACT,CAAC;AAAC;AACF,IAAMC,SAAS,iDACZH,cAAc,CAACC,IAAI,EAAG;EACrB,YAAY,EAAE,MAAM;EACpB,gBAAgB,EAAE,KAAK;EACvB,eAAe,EAAE;AACnB,CAAC,+BACAD,cAAc,CAACE,KAAK,EAAG;EACtB,YAAY,EAAE,OAAO;EACrB,gBAAgB,EAAE,KAAK;EACvB,eAAe,EAAE;AACnB,CAAC,cACF;AAAC;AACF,IAAME,MAAM,GAAG,aAAa;AAAC;AAE7B,IAAMC,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAAC"}
1
+ {"version":3,"file":"theme.constants.js","names":["COLORS","DEBOUNCE_TIMEOUT_CACHE","DIRECTION_TYPE","LEFT","RIGHT","DIRECTION","DOMAIN","MAGNITUDES"],"sources":["../../src/theme/theme.constants.js"],"sourcesContent":["const COLORS = ['accent'];\n\nconst DEBOUNCE_TIMEOUT_CACHE = 2000;\n\nconst DIRECTION_TYPE = {\n LEFT: 0,\n RIGHT: 1,\n};\nconst DIRECTION = {\n [DIRECTION_TYPE.LEFT]: {\n 'text-align': 'left',\n 'text-direction': 'ltr',\n 'row-direction': 'row',\n },\n [DIRECTION_TYPE.RIGHT]: {\n 'text-align': 'right',\n 'text-direction': 'rtl',\n 'row-direction': 'row-reverse',\n },\n};\nconst DOMAIN = '--mirai-ui-';\n\nconst MAGNITUDES = [400, 300, 200];\n\nexport { COLORS, DEBOUNCE_TIMEOUT_CACHE, DIRECTION, DIRECTION_TYPE, DOMAIN, MAGNITUDES };\n"],"mappings":";;;;;;;;;;;AAAA,IAAMA,MAAM,GAAG,CAAC,QAAQ,CAAC;AAAC;AAE1B,IAAMC,sBAAsB,GAAG,IAAI;AAAC;AAEpC,IAAMC,cAAc,GAAG;EACrBC,IAAI,EAAE,CAAC;EACPC,KAAK,EAAE;AACT,CAAC;AAAC;AACF,IAAMC,SAAS,iDACZH,cAAc,CAACC,IAAI,EAAG;EACrB,YAAY,EAAE,MAAM;EACpB,gBAAgB,EAAE,KAAK;EACvB,eAAe,EAAE;AACnB,CAAC,+BACAD,cAAc,CAACE,KAAK,EAAG;EACtB,YAAY,EAAE,OAAO;EACrB,gBAAgB,EAAE,KAAK;EACvB,eAAe,EAAE;AACnB,CAAC,cACF;AAAC;AACF,IAAME,MAAM,GAAG,aAAa;AAAC;AAE7B,IAAMC,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAAC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -10,6 +11,11 @@ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArra
10
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
12
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
12
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
16
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
17
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
18
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
19
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
14
20
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
21
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -19,6 +25,11 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
19
25
  var Theme = {
20
26
  get: function get() {
21
27
  var domain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _theme.DOMAIN;
28
+ var _ref = window || {},
29
+ _ref$Mirai = _ref.Mirai;
30
+ _ref$Mirai = _ref$Mirai === void 0 ? {} : _ref$Mirai;
31
+ var themeCache = _ref$Mirai.themeCache;
32
+ if (themeCache) return themeCache;
22
33
  var style = getComputedStyle(document.querySelector(':root'));
23
34
  var variables = {};
24
35
  var keys = Array.from(document.styleSheets).filter(function (stylesheet) {
@@ -29,14 +40,14 @@ var Theme = {
29
40
  return false;
30
41
  }
31
42
  }).reduce(function (stylesheet) {
32
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
33
- cssRules = _ref.cssRules;
43
+ var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
44
+ cssRules = _ref2.cssRules;
34
45
  return [].concat(_toConsumableArray(stylesheet), _toConsumableArray(Array.from(cssRules).reduce(function (value) {
35
- var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
36
- _ref2$selectorText = _ref2.selectorText,
37
- selectorText = _ref2$selectorText === void 0 ? '' : _ref2$selectorText,
38
- _ref2$style = _ref2.style,
39
- style = _ref2$style === void 0 ? [] : _ref2$style;
46
+ var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
47
+ _ref3$selectorText = _ref3.selectorText,
48
+ selectorText = _ref3$selectorText === void 0 ? '' : _ref3$selectorText,
49
+ _ref3$style = _ref3.style,
50
+ style = _ref3$style === void 0 ? [] : _ref3$style;
40
51
  return selectorText === ':root' ? [].concat(_toConsumableArray(value), _toConsumableArray(Array.from(style).filter(function (name) {
41
52
  return name.startsWith(domain);
42
53
  }))) : value;
@@ -46,6 +57,12 @@ var Theme = {
46
57
  var _style$getPropertyVal;
47
58
  return variables[(0, _helpers.camelcase)(key.replace(domain, ''))] = (_style$getPropertyVal = style.getPropertyValue(key)) === null || _style$getPropertyVal === void 0 ? void 0 : _style$getPropertyVal.trim();
48
59
  });
60
+ window.Mirai = _objectSpread(_objectSpread({}, window.Mirai), {}, {
61
+ themeCache: variables
62
+ });
63
+ setTimeout(function () {
64
+ return Theme.clearCache();
65
+ }, _theme.DEBOUNCE_TIMEOUT_CACHE);
49
66
  return variables;
50
67
  },
51
68
  setVariable: function setVariable(variable, value) {
@@ -53,6 +70,7 @@ var Theme = {
53
70
  var _document$querySelect = document.querySelector(':root'),
54
71
  style = _document$querySelect.style;
55
72
  style.setProperty("".concat(domain).concat(variable), value);
73
+ Theme.clearCache();
56
74
 
57
75
  // ! TODO: Should revisit this "algo"
58
76
  // Theme.shadeColors();
@@ -77,13 +95,18 @@ var Theme = {
77
95
  var direction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _theme.DIRECTION_TYPE.LEFT;
78
96
  if (!Object.values(_theme.DIRECTION_TYPE).includes(direction)) return;
79
97
  var variables = _theme.DIRECTION[direction] || {};
80
- Object.entries(variables).map(function (_ref3) {
81
- var _ref4 = _slicedToArray(_ref3, 2),
82
- key = _ref4[0],
83
- value = _ref4[1];
98
+ Object.entries(variables).map(function (_ref4) {
99
+ var _ref5 = _slicedToArray(_ref4, 2),
100
+ key = _ref5[0],
101
+ value = _ref5[1];
84
102
  return Theme.setVariable(key, value);
85
103
  });
86
104
  return direction;
105
+ },
106
+ clearCache: function clearCache() {
107
+ var _window;
108
+ if (!((_window = window) !== null && _window !== void 0 && _window.Mirai)) return;
109
+ window.Mirai.themeCache = undefined;
87
110
  }
88
111
  };
89
112
  exports.Theme = Theme;
@@ -1 +1 @@
1
- {"version":3,"file":"theme.js","names":["Theme","get","domain","DOMAIN","style","getComputedStyle","document","querySelector","variables","keys","Array","from","styleSheets","filter","stylesheet","href","startsWith","window","location","origin","cssRules","reduce","value","selectorText","name","forEach","key","camelcase","replace","getPropertyValue","trim","setVariable","variable","setProperty","shadeColors","theme","COLORS","color","undefined","MAGNITUDES","magnitude","colorShade","getDirection","textDirection","DIRECTION","DIRECTION_TYPE","RIGHT","LEFT","setDirection","direction","Object","values","includes","entries","map"],"sources":["../../src/theme/theme.js"],"sourcesContent":["import { camelcase, colorShade } from './helpers';\nimport { COLORS, DIRECTION, DIRECTION_TYPE, DOMAIN, MAGNITUDES } from './theme.constants';\n\nexport const Theme = {\n get: (domain = DOMAIN) => {\n const style = getComputedStyle(document.querySelector(':root'));\n const variables = {};\n\n const keys = Array.from(document.styleSheets)\n .filter((stylesheet) => {\n try {\n return (\n (stylesheet.href === null || stylesheet.href.startsWith(window.location.origin)) &&\n (stylesheet.cssRules ?? {})\n );\n } catch {\n return false;\n }\n })\n .reduce(\n (stylesheet, { cssRules } = {}) => [\n ...stylesheet,\n ...Array.from(cssRules).reduce(\n (value, { selectorText = '', style = [] } = {}) =>\n selectorText === ':root'\n ? [...value, ...Array.from(style).filter((name) => name.startsWith(domain))]\n : value,\n [],\n ),\n ],\n [],\n );\n\n keys.forEach((key) => (variables[camelcase(key.replace(domain, ''))] = style.getPropertyValue(key)?.trim()));\n\n return variables;\n },\n\n setVariable: (variable, value, domain = DOMAIN) => {\n const { style } = document.querySelector(':root');\n\n style.setProperty(`${domain}${variable}`, value);\n\n // ! TODO: Should revisit this \"algo\"\n // Theme.shadeColors();\n },\n\n shadeColors: () => {\n const theme = Theme.get();\n\n COLORS.filter((color) => theme[color] !== undefined).forEach((color) =>\n MAGNITUDES.forEach((magnitude) =>\n Theme.setVariable(`${color}-${magnitude}`, colorShade(theme[color], magnitude)),\n ),\n );\n },\n\n getDirection: () => {\n const { textDirection } = Theme.get();\n\n return textDirection !== DIRECTION[DIRECTION_TYPE.RIGHT]['text-direction']\n ? DIRECTION_TYPE.LEFT\n : DIRECTION_TYPE.RIGHT;\n },\n\n setDirection: (direction = DIRECTION_TYPE.LEFT) => {\n if (!Object.values(DIRECTION_TYPE).includes(direction)) return;\n\n const variables = DIRECTION[direction] || {};\n Object.entries(variables).map(([key, value]) => Theme.setVariable(key, value));\n\n return direction;\n },\n};\n"],"mappings":";;;;;;AAAA;AACA;AAA0F;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEnF,IAAMA,KAAK,GAAG;EACnBC,GAAG,EAAE,eAAqB;IAAA,IAApBC,MAAM,uEAAGC,aAAM;IACnB,IAAMC,KAAK,GAAGC,gBAAgB,CAACC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/D,IAAMC,SAAS,GAAG,CAAC,CAAC;IAEpB,IAAMC,IAAI,GAAGC,KAAK,CAACC,IAAI,CAACL,QAAQ,CAACM,WAAW,CAAC,CAC1CC,MAAM,CAAC,UAACC,UAAU,EAAK;MACtB,IAAI;QAAA;QACF,OACE,CAACA,UAAU,CAACC,IAAI,KAAK,IAAI,IAAID,UAAU,CAACC,IAAI,CAACC,UAAU,CAACC,MAAM,CAACC,QAAQ,CAACC,MAAM,CAAC,8BAC9EL,UAAU,CAACM,QAAQ,uEAAI,CAAC,CAAC,CAAC;MAE/B,CAAC,CAAC,gBAAM;QACN,OAAO,KAAK;MACd;IACF,CAAC,CAAC,CACDC,MAAM,CACL,UAACP,UAAU;MAAA,+EAAiB,CAAC,CAAC;QAAfM,QAAQ,QAARA,QAAQ;MAAA,oCAClBN,UAAU,sBACVJ,KAAK,CAACC,IAAI,CAACS,QAAQ,CAAC,CAACC,MAAM,CAC5B,UAACC,KAAK;QAAA,gFAAsC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KAAK,cAAIG,SAAS,GAAI,IAAAC,mBAAU,EAACN,KAAK,CAACE,KAAK,CAAC,EAAEG,SAAS,CAAC,CAAC;MAAA,EAChF;IAAA,EACF;EACH,CAAC;EAEDE,YAAY,EAAE,wBAAM;IAClB,iBAA0B1C,KAAK,CAACC,GAAG,EAAE;MAA7B0C,aAAa,cAAbA,aAAa;IAErB,OAAOA,aAAa,KAAKC,gBAAS,CAACC,qBAAc,CAACC,KAAK,CAAC,CAAC,gBAAgB,CAAC,GACtED,qBAAc,CAACE,IAAI,GACnBF,qBAAc,CAACC,KAAK;EAC1B,CAAC;EAEDE,YAAY,EAAE,wBAAqC;IAAA,IAApCC,SAAS,uEAAGJ,qBAAc,CAACE,IAAI;IAC5C,IAAI,CAACG,MAAM,CAACC,MAAM,CAACN,qBAAc,CAAC,CAACO,QAAQ,CAACH,SAAS,CAAC,EAAE;IAExD,IAAMzC,SAAS,GAAGoC,gBAAS,CAACK,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5CC,MAAM,CAACG,OAAO,CAAC7C,SAAS,CAAC,CAAC8C,GAAG,CAAC;MAAA;QAAE5B,GAAG;QAAEJ,KAAK;MAAA,OAAMtB,KAAK,CAAC+B,WAAW,CAACL,GAAG,EAAEJ,KAAK,CAAC;IAAA,EAAC;IAE9E,OAAO2B,SAAS;EAClB;AACF,CAAC;AAAC"}
1
+ {"version":3,"file":"theme.js","names":["Theme","get","domain","DOMAIN","window","Mirai","themeCache","style","getComputedStyle","document","querySelector","variables","keys","Array","from","styleSheets","filter","stylesheet","href","startsWith","location","origin","cssRules","reduce","value","selectorText","name","forEach","key","camelcase","replace","getPropertyValue","trim","setTimeout","clearCache","DEBOUNCE_TIMEOUT_CACHE","setVariable","variable","setProperty","shadeColors","theme","COLORS","color","undefined","MAGNITUDES","magnitude","colorShade","getDirection","textDirection","DIRECTION","DIRECTION_TYPE","RIGHT","LEFT","setDirection","direction","Object","values","includes","entries","map"],"sources":["../../src/theme/theme.js"],"sourcesContent":["import { camelcase, colorShade } from './helpers';\nimport { COLORS, DEBOUNCE_TIMEOUT_CACHE, DIRECTION, DIRECTION_TYPE, DOMAIN, MAGNITUDES } from './theme.constants';\n\nexport const Theme = {\n get: (domain = DOMAIN) => {\n const { Mirai: { themeCache } = {} } = window || {};\n if (themeCache) return themeCache;\n\n const style = getComputedStyle(document.querySelector(':root'));\n const variables = {};\n\n const keys = Array.from(document.styleSheets)\n .filter((stylesheet) => {\n try {\n return (\n (stylesheet.href === null || stylesheet.href.startsWith(window.location.origin)) &&\n (stylesheet.cssRules ?? {})\n );\n } catch {\n return false;\n }\n })\n .reduce(\n (stylesheet, { cssRules } = {}) => [\n ...stylesheet,\n ...Array.from(cssRules).reduce(\n (value, { selectorText = '', style = [] } = {}) =>\n selectorText === ':root'\n ? [...value, ...Array.from(style).filter((name) => name.startsWith(domain))]\n : value,\n [],\n ),\n ],\n [],\n );\n\n keys.forEach((key) => (variables[camelcase(key.replace(domain, ''))] = style.getPropertyValue(key)?.trim()));\n\n window.Mirai = { ...window.Mirai, themeCache: variables };\n setTimeout(() => Theme.clearCache(), DEBOUNCE_TIMEOUT_CACHE);\n\n return variables;\n },\n\n setVariable: (variable, value, domain = DOMAIN) => {\n const { style } = document.querySelector(':root');\n\n style.setProperty(`${domain}${variable}`, value);\n Theme.clearCache();\n\n // ! TODO: Should revisit this \"algo\"\n // Theme.shadeColors();\n },\n\n shadeColors: () => {\n const theme = Theme.get();\n\n COLORS.filter((color) => theme[color] !== undefined).forEach((color) =>\n MAGNITUDES.forEach((magnitude) =>\n Theme.setVariable(`${color}-${magnitude}`, colorShade(theme[color], magnitude)),\n ),\n );\n },\n\n getDirection: () => {\n const { textDirection } = Theme.get();\n\n return textDirection !== DIRECTION[DIRECTION_TYPE.RIGHT]['text-direction']\n ? DIRECTION_TYPE.LEFT\n : DIRECTION_TYPE.RIGHT;\n },\n\n setDirection: (direction = DIRECTION_TYPE.LEFT) => {\n if (!Object.values(DIRECTION_TYPE).includes(direction)) return;\n\n const variables = DIRECTION[direction] || {};\n Object.entries(variables).map(([key, value]) => Theme.setVariable(key, value));\n\n return direction;\n },\n\n clearCache: () => {\n if (!window?.Mirai) return;\n\n window.Mirai.themeCache = undefined;\n },\n};\n"],"mappings":";;;;;;;AAAA;AACA;AAAkH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE3G,IAAMA,KAAK,GAAG;EACnBC,GAAG,EAAE,eAAqB;IAAA,IAApBC,MAAM,uEAAGC,aAAM;IACnB,WAAuCC,MAAM,IAAI,CAAC,CAAC;MAAA,kBAA3CC,KAAK;IAAb,qCAAgC,CAAC,CAAC;IAAlC,IAAiBC,UAAU,cAAVA,UAAU;IAC3B,IAAIA,UAAU,EAAE,OAAOA,UAAU;IAEjC,IAAMC,KAAK,GAAGC,gBAAgB,CAACC,QAAQ,CAACC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC/D,IAAMC,SAAS,GAAG,CAAC,CAAC;IAEpB,IAAMC,IAAI,GAAGC,KAAK,CAACC,IAAI,CAACL,QAAQ,CAACM,WAAW,CAAC,CAC1CC,MAAM,CAAC,UAACC,UAAU,EAAK;MACtB,IAAI;QAAA;QACF,OACE,CAACA,UAAU,CAACC,IAAI,KAAK,IAAI,IAAID,UAAU,CAACC,IAAI,CAACC,UAAU,CAACf,MAAM,CAACgB,QAAQ,CAACC,MAAM,CAAC,8BAC9EJ,UAAU,CAACK,QAAQ,uEAAI,CAAC,CAAC,CAAC;MAE/B,CAAC,CAAC,gBAAM;QACN,OAAO,KAAK;MACd;IACF,CAAC,CAAC,CACDC,MAAM,CACL,UAACN,UAAU;MAAA,gFAAiB,CAAC,CAAC;QAAfK,QAAQ,SAARA,QAAQ;MAAA,oCAClBL,UAAU,sBACVJ,KAAK,CAACC,IAAI,CAACQ,QAAQ,CAAC,CAACC,MAAM,CAC5B,UAACC,KAAK;QAAA,gFAAsC,CAAC,CAAC;UAAA,2B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": "@mirai/ui",
3
- "version": "1.1.0-f",
3
+ "version": "1.1.1",
4
4
  "repository": "git@gitlab.com:miraicorp/dev/frontend/ui.git",
5
5
  "author": "JΛVI <hello@soyjavi.com>",
6
6
  "license": "MIT",
@@ -25,9 +25,9 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@mirai/locale": "^0.2",
28
+ "@react-icons/all-files": "https://github.com/react-icons/react-icons/releases/download/v5.0.1/react-icons-all-files-5.0.1.tgz",
28
29
  "react": "^17.0.2",
29
- "react-dom": "^17.0.2",
30
- "react-icons": "^4.10.1"
30
+ "react-dom": "^17.0.2"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@babel/cli": "7.19.3",
@@ -48,8 +48,7 @@
48
48
  "node": ">=18.18.0"
49
49
  },
50
50
  "resolutions": {
51
- "@mirai/locale": "^0.2",
52
- "react-icons": "^4.10.1"
51
+ "@mirai/locale": "^0.2"
53
52
  },
54
53
  "browserslist": {
55
54
  "production": [
@@ -1,33 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.getTag = void 0;
7
- var NATIVE_TAGS = [
8
- // -- PRIMITIVES -------------------------------------------------------------
9
- 'iframe', 'img',
10
- // <Input>
11
- 'input', 'textarea',
12
- // <Select>
13
- 'select', 'option',
14
- // -- COMPONENTS -------------------------------------------------------------
15
- // <Action>
16
- 'a',
17
- // <Button>
18
- 'button',
19
- // <Form>
20
- 'form',
21
- // <Table>
22
- 'table', 'thead', 'tbody', 'tr', 'th', 'td'];
23
- var getTag = function getTag() {
24
- var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'primitive';
25
- var isNative = NATIVE_TAGS.includes(tag);
26
-
27
- // * Experimental
28
- // if (tag === 'button' && props.type !== 'submit') isNative = false;
29
-
30
- return isNative ? tag : "ui_".concat(tag);
31
- };
32
- exports.getTag = getTag;
33
- //# sourceMappingURL=getTag.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getTag.js","names":["NATIVE_TAGS","getTag","tag","isNative","includes"],"sources":["../../../../src/primitives/Primitive/helpers/getTag.js"],"sourcesContent":["const NATIVE_TAGS = [\n // -- PRIMITIVES -------------------------------------------------------------\n 'iframe',\n 'img',\n // <Input>\n 'input',\n 'textarea',\n // <Select>\n 'select',\n 'option',\n // -- COMPONENTS -------------------------------------------------------------\n // <Action>\n 'a',\n // <Button>\n 'button',\n // <Form>\n 'form',\n // <Table>\n 'table',\n 'thead',\n 'tbody',\n 'tr',\n 'th',\n 'td',\n];\n\nexport const getTag = (\n tag = 'primitive',\n // * experimental\n // props = {}\n) => {\n let isNative = NATIVE_TAGS.includes(tag);\n\n // * Experimental\n // if (tag === 'button' && props.type !== 'submit') isNative = false;\n\n return isNative ? tag : `ui_${tag}`;\n};\n"],"mappings":";;;;;;AAAA,IAAMA,WAAW,GAAG;AAClB;AACA,QAAQ,EACR,KAAK;AACL;AACA,OAAO,EACP,UAAU;AACV;AACA,QAAQ,EACR,QAAQ;AACR;AACA;AACA,GAAG;AACH;AACA,QAAQ;AACR;AACA,MAAM;AACN;AACA,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,IAAI,CACL;AAEM,IAAMC,MAAM,GAAG,SAATA,MAAM,GAId;EAAA,IAHHC,GAAG,uEAAG,WAAW;EAIjB,IAAIC,QAAQ,GAAGH,WAAW,CAACI,QAAQ,CAACF,GAAG,CAAC;;EAExC;EACA;;EAEA,OAAOC,QAAQ,GAAGD,GAAG,gBAASA,GAAG,CAAE;AACrC,CAAC;AAAC"}