@de-kit/st-ui 0.1.5 → 0.1.6

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 (72) hide show
  1. package/README.md +59 -17
  2. package/dist/components/button/button.cjs +37 -17
  3. package/dist/components/button/button.cjs.map +1 -1
  4. package/dist/components/button/button.d.cts +7 -2
  5. package/dist/components/button/button.d.ts +7 -2
  6. package/dist/components/button/button.js +37 -17
  7. package/dist/components/button/button.js.map +1 -1
  8. package/dist/components/button/button.scss +65 -27
  9. package/dist/components/checkbox/checkbox.cjs +50 -8
  10. package/dist/components/checkbox/checkbox.cjs.map +1 -1
  11. package/dist/components/checkbox/checkbox.d.cts +11 -4
  12. package/dist/components/checkbox/checkbox.d.ts +11 -4
  13. package/dist/components/checkbox/checkbox.js +51 -9
  14. package/dist/components/checkbox/checkbox.js.map +1 -1
  15. package/dist/components/checkbox/checkbox.scss +55 -26
  16. package/dist/components/field/field-context.cjs +9 -0
  17. package/dist/components/field/field-context.cjs.map +1 -0
  18. package/dist/components/field/field-context.js +8 -0
  19. package/dist/components/field/field-context.js.map +1 -0
  20. package/dist/components/field/field.cjs +105 -0
  21. package/dist/components/field/field.cjs.map +1 -0
  22. package/dist/components/field/field.d.cts +24 -0
  23. package/dist/components/field/field.d.ts +24 -0
  24. package/dist/components/field/field.js +105 -0
  25. package/dist/components/field/field.js.map +1 -0
  26. package/dist/components/field/field.scss +43 -0
  27. package/dist/components/field/index.d.cts +2 -0
  28. package/dist/components/field/index.d.ts +2 -0
  29. package/dist/components/input/index.d.cts +2 -2
  30. package/dist/components/input/index.d.ts +2 -2
  31. package/dist/components/input/input.cjs +88 -8
  32. package/dist/components/input/input.cjs.map +1 -1
  33. package/dist/components/input/input.d.cts +8 -1
  34. package/dist/components/input/input.d.ts +8 -1
  35. package/dist/components/input/input.js +90 -10
  36. package/dist/components/input/input.js.map +1 -1
  37. package/dist/components/input/input.scss +77 -14
  38. package/dist/components/radio/index.d.cts +2 -2
  39. package/dist/components/radio/index.d.ts +2 -2
  40. package/dist/components/radio/radio.cjs +47 -5
  41. package/dist/components/radio/radio.cjs.map +1 -1
  42. package/dist/components/radio/radio.d.cts +12 -2
  43. package/dist/components/radio/radio.d.ts +12 -2
  44. package/dist/components/radio/radio.js +48 -7
  45. package/dist/components/radio/radio.js.map +1 -1
  46. package/dist/components/radio/radio.scss +50 -15
  47. package/dist/components/spinner/spinner.cjs +38 -16
  48. package/dist/components/spinner/spinner.cjs.map +1 -1
  49. package/dist/components/spinner/spinner.d.cts +5 -3
  50. package/dist/components/spinner/spinner.d.ts +5 -3
  51. package/dist/components/spinner/spinner.js +39 -17
  52. package/dist/components/spinner/spinner.js.map +1 -1
  53. package/dist/components/spinner/spinner.scss +18 -1
  54. package/dist/components/textarea/index.d.cts +2 -2
  55. package/dist/components/textarea/index.d.ts +2 -2
  56. package/dist/components/textarea/textarea.cjs +68 -9
  57. package/dist/components/textarea/textarea.cjs.map +1 -1
  58. package/dist/components/textarea/textarea.d.cts +4 -2
  59. package/dist/components/textarea/textarea.d.ts +4 -2
  60. package/dist/components/textarea/textarea.js +69 -10
  61. package/dist/components/textarea/textarea.js.map +1 -1
  62. package/dist/components/textarea/textarea.scss +50 -23
  63. package/dist/icons/index.cjs +2 -2
  64. package/dist/icons/index.js +2 -2
  65. package/dist/index.cjs +3 -0
  66. package/dist/index.d.cts +6 -4
  67. package/dist/index.d.ts +6 -4
  68. package/dist/index.js +3 -2
  69. package/dist/styles/global.scss +33 -27
  70. package/dist/styles/mixins.scss +37 -174
  71. package/dist/styles/vars.scss +73 -22
  72. package/package.json +1 -1
@@ -1,188 +1,51 @@
1
- @mixin btn-focus {
2
- &:focus {
3
- outline: initial;
4
- }
5
-
6
- &:focus:not(:focus-visible) {
7
- outline: none;
8
- }
9
-
10
- &:focus-visible {
11
- outline: 1px solid var(--color-black);
12
- background: transparent;
13
- }
14
- }
1
+ @use 'sass:list';
2
+ @use 'sass:map';
3
+ @use 'sass:math';
4
+ @use 'sass:meta';
15
5
 
16
- @mixin reset-list {
17
- padding: 0;
18
- margin: 0;
19
- list-style: none;
20
- }
21
-
22
- @mixin reset-btn {
23
- padding: 0;
24
- border: none;
25
- background-color: transparent;
26
- }
27
-
28
- @mixin reset-input {
29
- border: none;
30
- background-color: transparent;
31
- }
6
+ // Брейкпоинты для адаптивной вёрстки и единственный их источник: vars.scss
7
+ // генерирует из этого же списка --breakpoint-*. Отдельный список нужен потому,
8
+ // что в @media custom properties не работают.
9
+ $breakpoints: (
10
+ sm: 480px,
11
+ md: 680px,
12
+ lg: 1000px,
13
+ xl: 1200px,
14
+ );
32
15
 
33
- @mixin btn-min {
34
- display: block;
35
- width: fit-content;
36
- height: 30px;
37
- padding: 0 9px;
38
- font-size: 14px;
39
- font-weight: 700;
40
- color: var(--color-white);
41
- background-color: var(--color-blue);
42
- border: none;
43
- border-radius: 5px;
44
- cursor: pointer;
45
- transition: all var(--default-transition-duration)
46
- var(--default-transition-timing-function);
16
+ // Единицы, которые понимает @media. Проверяем их, потому что sass разбирает
17
+ // имя вроде `2xl` как число 2 с единицей xl: без проверки оно уехало бы в
18
+ // @media как есть и правило молча пропало бы.
19
+ $-length-units: 'px', 'em', 'rem';
47
20
 
48
- &:disabled {
49
- background-color: rgba(0, 0, 0, 0.1);
50
- color: rgba(0, 0, 0, 0.5);
51
- pointer-events: none;
21
+ // Имя брейкпоинта или произвольный размер: breakpoint(md), breakpoint(900px).
22
+ // Список проверяем первым, иначе имя, начинающееся с цифры, до него не дойдёт.
23
+ @function breakpoint($point) {
24
+ @if map.has-key($breakpoints, $point) {
25
+ @return map.get($breakpoints, $point);
52
26
  }
53
27
 
54
- &:active,
55
- &:hover {
56
- background-color: var(--color-black);
57
- }
58
- }
59
-
60
- @mixin input-min {
61
- height: 38px;
62
- border-radius: var(--radius-sm);
63
- border: 4px solid var(--color-white);
64
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
65
- padding: 0 15px;
66
- font-size: 14px;
67
- transition: all var(--default-transition-duration)
68
- var(--default-transition-timing-function);
69
- background-color: var(--color-white);
70
- appearance: none;
71
- outline: none;
72
-
73
- &:hover,
74
- &:focus {
75
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
76
- }
77
-
78
- &--recommend {
79
- background-color: color-mix(in srgb, var(--color-yellow) 10%, transparent);
80
-
81
- &:not([value='']) {
82
- background-color: var(--color-white);
83
- }
84
- }
85
-
86
- &:required {
87
- background-color: rgba(#ff002a, 0.1);
88
-
89
- &:valid {
90
- background-color: var(--color-white);
91
- }
28
+ @if meta.type-of($point) ==
29
+ 'number' and
30
+ list.index($-length-units, math.unit($point))
31
+ {
32
+ @return $point;
92
33
  }
93
34
 
94
- &:disabled {
95
- background-color: rgba(0, 0, 0, 0.1);
96
- border-color: var(--color-border);
97
- color: color-mix(in srgb, var(--color-black) 50%, transparent);
98
- outline-offset: 0;
99
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
100
-
101
- &:hover,
102
- &:focus {
103
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
104
- }
105
- }
106
-
107
- &::-webkit-input-placeholder {
108
- color: color-mix(in srgb, var(--color-black) 50%, transparent);
109
- }
110
-
111
- @media (max-width: 680px) {
112
- font-size: 16px;
113
- }
114
- }
115
-
116
- @mixin linkActiveElement {
117
- content: '';
118
- position: absolute;
119
- z-index: 1;
120
- bottom: -2px;
121
- left: 0;
122
- display: block;
123
- width: calc(100% - 1px);
124
- height: 2px;
125
- background-color: var(--color-black);
126
- }
127
-
128
- @mixin popupShow {
129
- visibility: visible;
130
- opacity: 1;
131
- z-index: 12;
35
+ @error 'Нет брейкпоинта «#{$point}». Есть: #{map.keys($breakpoints)} или размер в px, em, rem.';
132
36
  }
133
37
 
134
- @mixin popupHide {
135
- visibility: hidden;
136
- opacity: 0;
137
- }
138
-
139
- @mixin popupStyle($maxWidth: 360px, $padding: 24px 30px) {
140
- position: absolute;
141
- z-index: 0;
142
- max-width: $maxWidth;
143
- padding: $padding;
144
- box-shadow: var(--shadow-xl);
145
- background: var(--color-white);
146
- border-radius: 5px;
147
- text-align: left;
148
- color: var(--color-black);
149
- }
150
-
151
- @mixin buttonArea($width: 20px) {
152
- position: relative;
153
-
154
- &::after {
155
- content: '';
156
- display: block;
157
- position: absolute;
158
- top: -#{$width * 0.5};
159
- left: -#{$width * 0.5};
160
- width: calc(100% + #{$width});
161
- height: calc(100% + #{$width});
38
+ // От брейкпоинта и шире, включая его.
39
+ @mixin min-width($point) {
40
+ @media (min-width: breakpoint($point)) {
41
+ @content;
162
42
  }
163
43
  }
164
44
 
165
- @mixin h2 {
166
- margin: 0 0 10px;
167
- font-size: 18px;
168
- line-height: 20px;
169
- font-weight: 900;
170
-
171
- @media (min-width: 680px) {
172
- margin-bottom: 15px;
173
- }
174
- }
175
-
176
- @mixin imgWrap {
177
- display: flex;
178
- align-items: center;
179
- justify-content: center;
180
- border: 1px solid var(--color-border);
181
- overflow: hidden;
182
-
183
- img {
184
- z-index: -1;
185
- object-fit: contain;
186
- margin-inline: auto;
45
+ // Уже брейкпоинта, не включая его: граница 679.98px, а не 680px, иначе на
46
+ // ровно 680px сработали бы оба правила сразу.
47
+ @mixin max-width($point) {
48
+ @media (max-width: (breakpoint($point) - 0.02px)) {
49
+ @content;
187
50
  }
188
51
  }
@@ -1,35 +1,86 @@
1
- // Токены splittest. Имена как у Tailwind, значения свои — не дефолтная шкала.
2
- // В @media custom properties нельзя: там те же px, что у --breakpoint-*.
1
+ // Токены splittest. Роли как у Tailwind v4 (`--color-primary`), значения свои.
2
+ // Компоненты не знают про пигмент. Тема — переопределение этих --color-* на
3
+ // [data-theme='dark'], стили кнопок и полей не трогать.
4
+ // В @media custom properties нельзя, поэтому брейкпоинты живут в mixins.scss,
5
+ // а --breakpoint-* ниже генерируются из того же списка — значения не разъедутся.
6
+ @use './mixins.scss' as mixins;
7
+
3
8
  :root {
4
- --color-black: #000;
5
- --color-white: #fff;
6
- --color-blue: #002bff;
7
- --color-red: #ff0000;
8
- --color-green: #00a66f;
9
- --color-yellow: #ffbf00;
10
- --color-orange: #ff7f00;
11
- --color-gray: #808080;
12
- --color-neutral-100: #f7f7f7;
13
- --color-neutral-200: #e5e5e5;
14
- --color-neutral-500: #727272;
9
+ // Текст и страница. Сейчас оба чёрный/белый, как и кнопка ниже — роли разные.
10
+ --color-background: #fff;
11
+ --color-foreground: #000;
12
+
13
+ // Залитая кнопка: фон и текст на нём. Outline берёт --color-foreground, не primary.
14
+ --color-primary: #000;
15
+ --color-primary-foreground: #fff;
16
+ --color-primary-hover: #727272;
17
+
18
+ // Ховер outline. Выключенный контрол и вторичный текст/иконка.
19
+ --color-secondary: #f7f7f7;
20
+ --color-muted: #e5e5e5;
21
+ --color-muted-foreground: #727272;
22
+
23
+ --color-border: color-mix(in srgb, var(--color-foreground) 10%, transparent);
15
24
  --color-input: #d9d9d9;
16
- --color-border: color-mix(in srgb, var(--color-black) 10%, transparent);
17
- --color-sidebar: color-mix(in srgb, var(--color-black) 3%, transparent);
25
+ --color-ring: var(--color-foreground);
26
+ // Вуаль модалки и тень не от foreground: в тёмной теме свет не падает снизу,
27
+ // они остаются тёмными. Нужен другой оттенок — переопределять эти две роли.
28
+ --color-overlay: rgb(0 0 0 / 0.3);
29
+ --color-shadow: rgb(0 0 0 / 0.15);
30
+ --color-sidebar: color-mix(in srgb, var(--color-foreground) 3%, transparent);
31
+
32
+ // Акцент, ошибка, успех. Текст на акценте отдельный: в тёмной теме primary-foreground инвертируется, этот нет.
33
+ --color-accent: #002bff;
34
+ --color-accent-foreground: #fff;
35
+ --color-destructive: #ff0000;
36
+ --color-success: #00a66f;
37
+ --color-warning: #ffbf00;
38
+
39
+ // Фон recommended — разбавленный warning, компоненты этот процент не знают.
40
+ // В тёмной теме достаточно переопределить --color-warning.
41
+ --color-recommended: color-mix(
42
+ in srgb,
43
+ var(--color-warning) 10%,
44
+ transparent
45
+ );
18
46
 
19
47
  --radius-sm: 5px;
20
48
  --radius-lg: 10px;
21
49
 
22
50
  --font-sans: 'Inter', sans-serif;
51
+
52
+ // Шкала текста: размер и парная к нему высота строки. Других размеров в splittest нет,
53
+ // по умолчанию почти везде --text-sm. Заголовки: h1 и h2 — 2xl (h1 с 680px — 3xl), h3 — lg, h4 — sm.
54
+ --text-xs: 11px;
55
+ --text-xs--line-height: 15px;
23
56
  --text-sm: 14px;
57
+ --text-sm--line-height: 20px;
58
+ --text-base: 16px;
59
+ --text-base--line-height: 20px;
60
+ --text-lg: 18px;
61
+ --text-lg--line-height: 20px;
62
+ --text-2xl: 28px;
63
+ --text-2xl--line-height: 30px;
64
+ --text-3xl: 45px;
65
+ --text-3xl--line-height: 50px;
66
+
67
+ // Сетка 5px. Паддинги кнопки и инпута сняты с макета вне сетки и остаются литералами.
68
+ --space-1: 5px;
69
+ --space-2: 10px;
70
+ --space-3: 15px;
71
+ --space-4: 20px;
72
+ --space-6: 30px;
73
+
74
+ // Фокус. Одна обводка на всю библиотеку: и box-shadow у инпута, и outline у кнопки.
75
+ --focus-ring-width: 1px;
76
+ --focus-ring-color: var(--color-ring);
77
+ --focus-ring-offset: 2px;
24
78
 
25
- --shadow-xl: 0 10px 40px 0 rgb(0 0 0 / 0.15);
26
- --shadow-t: 0 -1px 0 0 var(--color-border);
27
- --shadow-b: 0 1px 0 0 var(--color-border);
79
+ --shadow-xl: 0 10px 40px 0 var(--color-shadow);
28
80
 
29
- --breakpoint-sm: 576px;
30
- --breakpoint-md: 680px;
31
- --breakpoint-lg: 1000px;
32
- --breakpoint-xl: 1200px;
81
+ @each $name, $value in mixins.$breakpoints {
82
+ --breakpoint-#{$name}: #{$value};
83
+ }
33
84
 
34
85
  --default-transition-duration: 0.3s;
35
86
  --default-transition-timing-function: ease;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@de-kit/st-ui",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "React-компоненты splittest: глобальный SCSS и токены из основного фронтенда",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {