@mineui/utils 0.0.2 → 0.0.4

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.
@@ -0,0 +1,383 @@
1
+ // @mineui/responsive (RESPONSIVE & STATE VARIANTS)
2
+ //
3
+ // Made with ❤️ by Maysara.
4
+
5
+
6
+
7
+ // ----------------------------------------------------------------------------
8
+ // PACK
9
+ // ----------------------------------------------------------------------------
10
+ @use '../../../node_modules/@mineui/tokens' as *;
11
+
12
+
13
+ // ----------------------------------------------------------------------------
14
+ // RESPONSIVE VARIANTS (sm, md, lg, xl, 2xl)
15
+ // ----------------------------------------------------------------------------
16
+
17
+ // Macro to generate responsive variants
18
+ @mixin responsive-variants($class-name, $property, $value) {
19
+ @each $breakpoint-name, $breakpoint-value in $breakpoints {
20
+ @if $breakpoint-value != 0 {
21
+ @media (min-width: $breakpoint-value) {
22
+ .#{$breakpoint-name}\:#{$class-name} {
23
+ #{$property}: $value !important;
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+
30
+ // Generate responsive classes for most common utilities
31
+ @each $breakpoint-name, $breakpoint-value in $breakpoints {
32
+ @if $breakpoint-value != 0 {
33
+ @media (min-width: $breakpoint-value) {
34
+
35
+ // Display
36
+ .#{$breakpoint-name}\:block { display: block !important; }
37
+ .#{$breakpoint-name}\:inline-block { display: inline-block !important; }
38
+ .#{$breakpoint-name}\:inline { display: inline !important; }
39
+ .#{$breakpoint-name}\:flex { display: flex !important; }
40
+ .#{$breakpoint-name}\:inline-flex { display: inline-flex !important; }
41
+ .#{$breakpoint-name}\:grid { display: grid !important; }
42
+ .#{$breakpoint-name}\:hidden { display: none !important; }
43
+
44
+ // Flex Direction
45
+ .#{$breakpoint-name}\:flex-row { flex-direction: row !important; }
46
+ .#{$breakpoint-name}\:flex-col { flex-direction: column !important; }
47
+
48
+ // Justify & Align
49
+ .#{$breakpoint-name}\:justify-start { justify-content: flex-start !important; }
50
+ .#{$breakpoint-name}\:justify-center { justify-content: center !important; }
51
+ .#{$breakpoint-name}\:justify-end { justify-content: flex-end !important; }
52
+ .#{$breakpoint-name}\:justify-between { justify-content: space-between !important; }
53
+
54
+ .#{$breakpoint-name}\:items-start { align-items: flex-start !important; }
55
+ .#{$breakpoint-name}\:items-center { align-items: center !important; }
56
+ .#{$breakpoint-name}\:items-end { align-items: flex-end !important; }
57
+
58
+ // Grid Columns
59
+ @for $i from 1 through 12 {
60
+ .#{$breakpoint-name}\:grid-cols-#{$i} {
61
+ grid-template-columns: repeat($i, minmax(0, 1fr)) !important;
62
+ }
63
+ .#{$breakpoint-name}\:col-span-#{$i} {
64
+ grid-column: span $i / span $i !important;
65
+ }
66
+ }
67
+
68
+ // Width
69
+ .#{$breakpoint-name}\:w-auto { width: auto !important; }
70
+ .#{$breakpoint-name}\:w-full { width: 100% !important; }
71
+ .#{$breakpoint-name}\:w-1\/2 { width: 50% !important; }
72
+ .#{$breakpoint-name}\:w-1\/3 { width: 33.333333% !important; }
73
+ .#{$breakpoint-name}\:w-2\/3 { width: 66.666667% !important; }
74
+ .#{$breakpoint-name}\:w-1\/4 { width: 25% !important; }
75
+ .#{$breakpoint-name}\:w-3\/4 { width: 75% !important; }
76
+
77
+ // Text Alignment
78
+ .#{$breakpoint-name}\:text-start { text-align: start !important; }
79
+ .#{$breakpoint-name}\:text-center { text-align: center !important; }
80
+ .#{$breakpoint-name}\:text-end { text-align: end !important; }
81
+
82
+ // Text Size
83
+ .#{$breakpoint-name}\:text-xs { font-size: $fs-xs !important; }
84
+ .#{$breakpoint-name}\:text-sm { font-size: $fs-sm !important; }
85
+ .#{$breakpoint-name}\:text-base { font-size: $fs-base !important; }
86
+ .#{$breakpoint-name}\:text-lg { font-size: $fs-lg !important; }
87
+ .#{$breakpoint-name}\:text-xl { font-size: $fs-xl !important; }
88
+ .#{$breakpoint-name}\:text-2xl { font-size: $fs-2xl !important; }
89
+ .#{$breakpoint-name}\:text-3xl { font-size: $fs-3xl !important; }
90
+
91
+ // Common Spacing
92
+ @each $sp-key, $sp-value in (0: $sp-0, 1: $sp-1, 2: $sp-2, 3: $sp-3, 4: $sp-4, 6: $sp-6, 8: $sp-8, 12: $sp-12) {
93
+ .#{$breakpoint-name}\:p-#{$sp-key} { padding: $sp-value !important; }
94
+ .#{$breakpoint-name}\:px-#{$sp-key} { padding-inline: $sp-value !important; }
95
+ .#{$breakpoint-name}\:py-#{$sp-key} { padding-block: $sp-value !important; }
96
+ .#{$breakpoint-name}\:m-#{$sp-key} { margin: $sp-value !important; }
97
+ .#{$breakpoint-name}\:mx-#{$sp-key} { margin-inline: $sp-value !important; }
98
+ .#{$breakpoint-name}\:my-#{$sp-key} { margin-block: $sp-value !important; }
99
+ .#{$breakpoint-name}\:gap-#{$sp-key} { gap: $sp-value !important; }
100
+ }
101
+
102
+ .#{$breakpoint-name}\:mx-auto { margin-inline: auto !important; }
103
+ }
104
+ }
105
+ }
106
+
107
+ // ----------------------------------------------------------------------------
108
+ // HOVER STATE VARIANTS
109
+ // ----------------------------------------------------------------------------
110
+
111
+ // Background
112
+ .hover\:bg-brand:hover { background-color: var(--brand-hover) !important; }
113
+ .hover\:bg-success:hover { background-color: var(--success-hover) !important; }
114
+ .hover\:bg-warning:hover { background-color: var(--warning-hover) !important; }
115
+ .hover\:bg-error:hover { background-color: var(--error-hover) !important; }
116
+
117
+ // Opacity
118
+ @each $key, $value in (0: $opacity-0, 50: $opacity-50, 75: $opacity-75, 100: $opacity-100) {
119
+ .hover\:opacity-#{$key}:hover { opacity: $value !important; }
120
+ }
121
+
122
+ // Scale
123
+ .hover\:scale-105:hover { transform: scale(1.05) !important; }
124
+ .hover\:scale-110:hover { transform: scale(1.1) !important; }
125
+ .hover\:scale-125:hover { transform: scale(1.25) !important; }
126
+
127
+ // Shadow
128
+ .hover\:shadow-sm:hover { box-shadow: var(--shadow-sm) !important; }
129
+ .hover\:shadow-md:hover { box-shadow: var(--shadow-md) !important; }
130
+ .hover\:shadow-lg:hover { box-shadow: var(--shadow-lg) !important; }
131
+
132
+ // Translate
133
+ .hover\:-translate-y-1:hover { transform: translateY(-#{$sp-1}) !important; }
134
+ .hover\:-translate-y-2:hover { transform: translateY(-#{$sp-2}) !important; }
135
+
136
+ // Brightness
137
+ .hover\:brightness-110:hover { filter: brightness(1.1) !important; }
138
+ .hover\:brightness-125:hover { filter: brightness(1.25) !important; }
139
+
140
+ // ----------------------------------------------------------------------------
141
+ // FOCUS STATE VARIANTS
142
+ // ----------------------------------------------------------------------------
143
+
144
+ // Outline
145
+ .focus\:outline-none:focus { outline: none !important; }
146
+ .focus\:outline-brand:focus { outline: 2px solid var(--border-focus) !important; }
147
+
148
+ // Ring (Focus Ring)
149
+ .focus\:ring:focus-visible {
150
+ outline: 2px solid var(--border-focus) !important;
151
+ outline-offset: 2px !important;
152
+ }
153
+
154
+ .focus\:ring-inset:focus-visible {
155
+ outline: 2px solid var(--border-focus) !important;
156
+ outline-offset: -2px !important;
157
+ }
158
+
159
+ // Scale
160
+ .focus\:scale-105:focus { transform: scale(1.05) !important; }
161
+
162
+ // ----------------------------------------------------------------------------
163
+ // ACTIVE STATE VARIANTS
164
+ // ----------------------------------------------------------------------------
165
+
166
+ // Scale
167
+ .active\:scale-95:active { transform: scale(0.95) !important; }
168
+ .active\:scale-90:active { transform: scale(0.9) !important; }
169
+
170
+ // Opacity
171
+ .active\:opacity-80:active { opacity: $opacity-80 !important; }
172
+
173
+ // Background
174
+ .active\:bg-brand:active { background-color: var(--brand-active) !important; }
175
+
176
+ // ----------------------------------------------------------------------------
177
+ // DISABLED STATE VARIANTS
178
+ // ----------------------------------------------------------------------------
179
+
180
+ // Opacity
181
+ .disabled\:opacity-50:disabled,
182
+ .disabled\:opacity-50[aria-disabled="true"] {
183
+ opacity: var(--disabled-opacity) !important;
184
+ }
185
+
186
+ // Cursor
187
+ .disabled\:cursor-not-allowed:disabled,
188
+ .disabled\:cursor-not-allowed[aria-disabled="true"] {
189
+ cursor: not-allowed !important;
190
+ }
191
+
192
+ // ----------------------------------------------------------------------------
193
+ // GROUP HOVER VARIANTS
194
+ // ----------------------------------------------------------------------------
195
+
196
+ .group:hover .group-hover\:opacity-100 { opacity: $opacity-100 !important; }
197
+ .group:hover .group-hover\:scale-105 { transform: scale(1.05) !important; }
198
+ .group:hover .group-hover\:translate-x-1 { transform: translateX($sp-1) !important; }
199
+ .group:hover .group-hover\:block { display: block !important; }
200
+
201
+ // ----------------------------------------------------------------------------
202
+ // DARK MODE VARIANTS
203
+ // ----------------------------------------------------------------------------
204
+
205
+ [data-theme="dark"] {
206
+ .dark\:bg-page { background-color: var(--bg-page) !important; }
207
+ .dark\:bg-surface { background-color: var(--bg-surface) !important; }
208
+ .dark\:bg-raised { background-color: var(--bg-raised) !important; }
209
+
210
+ .dark\:text-1 { color: var(--text-1) !important; }
211
+ .dark\:text-2 { color: var(--text-2) !important; }
212
+ .dark\:text-3 { color: var(--text-3) !important; }
213
+
214
+ .dark\:border-1 { border-color: var(--border-1) !important; }
215
+ .dark\:border-2 { border-color: var(--border-2) !important; }
216
+
217
+ .dark\:hidden { display: none !important; }
218
+ .dark\:block { display: block !important; }
219
+ }
220
+
221
+ // Auto dark mode (system preference)
222
+ @media (prefers-color-scheme: dark) {
223
+ :root:not([data-theme]) {
224
+ .dark\:bg-page { background-color: var(--bg-page) !important; }
225
+ .dark\:bg-surface { background-color: var(--bg-surface) !important; }
226
+ .dark\:text-1 { color: var(--text-1) !important; }
227
+ .dark\:hidden { display: none !important; }
228
+ .dark\:block { display: block !important; }
229
+ }
230
+ }
231
+
232
+ // ----------------------------------------------------------------------------
233
+ // RTL VARIANTS
234
+ // ----------------------------------------------------------------------------
235
+
236
+ [dir="rtl"] {
237
+ .rtl\:hidden { display: none !important; }
238
+ .rtl\:block { display: block !important; }
239
+ .rtl\:flex-row-reverse { flex-direction: row-reverse !important; }
240
+ .rtl\:text-start { text-align: start !important; }
241
+ .rtl\:text-end { text-align: end !important; }
242
+ .rtl\:rotate-180 { transform: rotate(180deg) !important; }
243
+ }
244
+
245
+ [dir="ltr"] {
246
+ .ltr\:hidden { display: none !important; }
247
+ .ltr\:block { display: block !important; }
248
+ }
249
+
250
+ // ----------------------------------------------------------------------------
251
+ // MOTION SAFE/REDUCE
252
+ // ----------------------------------------------------------------------------
253
+
254
+ @media (prefers-reduced-motion: no-preference) {
255
+ .motion-safe\:animate-spin { animation: spin 1s linear infinite !important; }
256
+ .motion-safe\:animate-bounce { animation: bounce 1s infinite !important; }
257
+ }
258
+
259
+ @media (prefers-reduced-motion: reduce) {
260
+ .motion-reduce\:transition-none { transition: none !important; }
261
+ .motion-reduce\:animate-none { animation: none !important; }
262
+ }
263
+
264
+ // ----------------------------------------------------------------------------
265
+ // PRINT VARIANTS
266
+ // ----------------------------------------------------------------------------
267
+
268
+ @media print {
269
+ .print\:hidden { display: none !important; }
270
+ .print\:block { display: block !important; }
271
+ .print\:inline { display: inline !important; }
272
+ .print\:flex { display: flex !important; }
273
+ .print\:grid { display: grid !important; }
274
+ }
275
+
276
+ // ----------------------------------------------------------------------------
277
+ // FIRST/LAST CHILD VARIANTS
278
+ // ----------------------------------------------------------------------------
279
+
280
+ .first\:mt-0:first-child { margin-block-start: 0 !important; }
281
+ .last\:mb-0:last-child { margin-block-end: 0 !important; }
282
+
283
+ .first\:rounded-t:first-child {
284
+ border-start-start-radius: $br-base !important;
285
+ border-start-end-radius: $br-base !important;
286
+ }
287
+
288
+ .last\:rounded-b:last-child {
289
+ border-end-start-radius: $br-base !important;
290
+ border-end-end-radius: $br-base !important;
291
+ }
292
+
293
+ // ----------------------------------------------------------------------------
294
+ // ODD/EVEN VARIANTS (Table Stripes)
295
+ // ----------------------------------------------------------------------------
296
+
297
+ .odd\:bg-surface:nth-child(odd) { background-color: var(--bg-surface) !important; }
298
+ .even\:bg-raised:nth-child(even) { background-color: var(--bg-raised) !important; }
299
+
300
+ // ----------------------------------------------------------------------------
301
+ // PLACEHOLDER VARIANT
302
+ // ----------------------------------------------------------------------------
303
+
304
+ .placeholder\:text-3::placeholder { color: var(--text-3) !important; }
305
+ .placeholder\:opacity-50::placeholder { opacity: $opacity-50 !important; }
306
+
307
+ // ----------------------------------------------------------------------------
308
+ // FILE INPUT VARIANT
309
+ // ----------------------------------------------------------------------------
310
+
311
+ .file\:border-0::file-selector-button { border: 0 !important; }
312
+ .file\:bg-brand::file-selector-button { background-color: var(--brand) !important; }
313
+ .file\:text-inverse::file-selector-button { color: var(--text-inverse) !important; }
314
+
315
+ // ----------------------------------------------------------------------------
316
+ // PEER VARIANTS (Sibling States)
317
+ // ----------------------------------------------------------------------------
318
+
319
+ .peer:checked ~ .peer-checked\:block { display: block !important; }
320
+ .peer:checked ~ .peer-checked\:hidden { display: none !important; }
321
+ .peer:focus ~ .peer-focus\:ring {
322
+ outline: 2px solid var(--border-focus) !important;
323
+ outline-offset: 2px !important;
324
+ }
325
+
326
+ // ----------------------------------------------------------------------------
327
+ // CONTAINER QUERIES (Modern!)
328
+ // ----------------------------------------------------------------------------
329
+
330
+ @container (min-width: 320px) {
331
+ .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
332
+ }
333
+
334
+ @container (min-width: 640px) {
335
+ .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
336
+ }
337
+
338
+ @container (min-width: 1024px) {
339
+ .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
340
+ }
341
+
342
+ // ----------------------------------------------------------------------------
343
+ // CONTAINER CLASS
344
+ // ----------------------------------------------------------------------------
345
+
346
+ .container {
347
+ width: 100%;
348
+ margin-inline: auto;
349
+ padding-inline: $sp-4;
350
+
351
+ @media (min-width: $bp-sm) { max-width: $bp-sm; }
352
+ @media (min-width: $bp-md) { max-width: $bp-md; }
353
+ @media (min-width: $bp-lg) { max-width: $bp-lg; }
354
+ @media (min-width: $bp-xl) { max-width: $bp-xl; }
355
+ @media (min-width: $bp-2xl) { max-width: $bp-2xl; }
356
+ }
357
+
358
+ // ----------------------------------------------------------------------------
359
+ // SCREEN READER ONLY
360
+ // ----------------------------------------------------------------------------
361
+
362
+ .sr-only {
363
+ position: absolute;
364
+ width: 1px;
365
+ height: 1px;
366
+ padding: 0;
367
+ margin: -1px;
368
+ overflow: hidden;
369
+ clip: rect(0, 0, 0, 0);
370
+ white-space: nowrap;
371
+ border-width: 0;
372
+ }
373
+
374
+ .not-sr-only {
375
+ position: static;
376
+ width: auto;
377
+ height: auto;
378
+ padding: 0;
379
+ margin: 0;
380
+ overflow: visible;
381
+ clip: auto;
382
+ white-space: normal;
383
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mineui/utils",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "utils",
5
5
  "keywords": ["mine", "ui", "utils"],
6
6
  "license": "MIT",
@@ -26,10 +26,11 @@
26
26
  "types": "./dist/index.d.ts",
27
27
  "import": "./dist/index.js",
28
28
  "require": "./dist/index.js"
29
- }
29
+ },
30
+ "./style": "./dist/scss/index.scss"
30
31
  },
31
32
  "scripts": {
32
- "build": "sass src/style/index.scss dist/index.css --style=compressed",
33
+ "build": "bun scripts/copy-scss.js",
33
34
  "lint": "eslint src --ext .ts",
34
35
  "test": "bun test"
35
36
  },
@@ -39,6 +40,9 @@
39
40
  "peerDependencies": {
40
41
  "bun": "^1.3.3"
41
42
  },
43
+ "dependencies": {
44
+ "@mineui/tokens": "^0.0.7"
45
+ },
42
46
  "devDependencies": {
43
47
  "@eslint/js": "^9.39.2",
44
48
  "@stylistic/eslint-plugin": "^5.6.1",
@@ -52,5 +56,6 @@
52
56
  "tsup": "^8.5.1",
53
57
  "typescript": "^5.9.3",
54
58
  "typescript-eslint": "^8.51.0"
55
- }
59
+ },
60
+ "style": "./dist/index.css"
56
61
  }