@krometra/ui-kit 0.6.0 → 0.7.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krometra/ui-kit",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "UI-kit на Vue 3 со сменными темами, светлой и тёмной схемой; интерактивные компоненты на zag.js",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -7,6 +7,9 @@
7
7
  * inputmode, min, @blur, …) прокидываются на <input>.
8
8
  *
9
9
  * <KInput v-model="query" label="Поиск" prefix-icon="search" :error="err" />
10
+ *
11
+ * size — 'md' (по умолчанию) | 'sm' — компактное поле внутри строки текста или таблицы
12
+ * inline — подпись слева от поля, а не над ним
10
13
  */
11
14
  import { computed, useAttrs } from 'vue'
12
15
  import KIcon from './KIcon.vue'
@@ -37,13 +40,15 @@ defineProps({
37
40
  required: { type: Boolean, default: false },
38
41
  disabled: { type: Boolean, default: false },
39
42
  readonly: { type: Boolean, default: false },
43
+ size: { type: String, default: 'md' },
44
+ inline: { type: Boolean, default: false },
40
45
  })
41
46
 
42
47
  defineEmits(['update:modelValue'])
43
48
  </script>
44
49
 
45
50
  <template>
46
- <label class="k-input" v-bind="rootAttrs">
51
+ <label class="k-input" :class="[`k-input--${size}`, { 'k-input--inline': inline }]" v-bind="rootAttrs">
47
52
  <span v-if="label" class="k-input__label">
48
53
  {{ label }}<span v-if="required" class="k-input__req">*</span>
49
54
  </span>
@@ -105,4 +110,9 @@ defineEmits(['update:modelValue'])
105
110
  .k-input__suffix { font-size: 0.875rem; color: var(--k-text-muted); white-space: nowrap; }
106
111
  .k-input__hint { font-size: 0.75rem; color: var(--k-text-muted); }
107
112
  .k-input__error { font-size: 0.75rem; color: var(--k-danger); }
113
+ .k-input--inline { flex-direction: row; align-items: center; gap: 0.4rem; }
114
+ .k-input--inline .k-input__label { white-space: nowrap; }
115
+ .k-input--sm .k-input__box { height: var(--k-control-h-sm); padding: 0 0.5rem; gap: 0.35rem; }
116
+ .k-input--sm .k-input__field { font-size: 0.8125rem; }
117
+ .k-input--sm .k-input__suffix { font-size: 0.8125rem; }
108
118
  </style>
package/src/theme.js CHANGED
@@ -25,7 +25,9 @@ export const schemes = ['light', 'dark', 'system']
25
25
  * Нейтрали задаются отдельно от акцента: одинаковый синий на холодном и на
26
26
  * тёплом сером выглядит как два разных бренда, и подбирать их порознь удобнее,
27
27
  * чем держать десяток почти одинаковых палитр. Пресет может уточнить нейтрали
28
- * точечно через `neutralOverrides` — так живут проектные темы.
28
+ * точечно через `neutralOverrides` — так живут проектные темы. Ещё пресет
29
+ * может задать свои `radius`, `density`, `elevation` и `font`: они действуют,
30
+ * пока ось не задана в теме явно.
29
31
  */
30
32
  export const presets = {
31
33
  default: {
@@ -95,6 +97,38 @@ export const presets = {
95
97
  accentSoft: '#f4f4f5',
96
98
  neutral: 'plain',
97
99
  },
100
+ blocky: {
101
+ label: 'Blocky',
102
+ accent: '#4f8a25',
103
+ accentHover: '#3f711c',
104
+ accentSoft: '#e8f3dc',
105
+ neutral: 'warm',
106
+ radius: 'square',
107
+ elevation: 'hard',
108
+ font: 'rounded',
109
+ neutralOverrides: {
110
+ light: {
111
+ bg: '#e7e1d3',
112
+ surface: '#fbf8f1',
113
+ surfaceMuted: '#f1ebdf',
114
+ border: '#cdc3ae',
115
+ borderStrong: '#8a7a5c',
116
+ text: '#2b2418',
117
+ textMuted: '#675a43',
118
+ textFaint: '#9a8c72',
119
+ },
120
+ dark: {
121
+ bg: '#1b1814',
122
+ surface: '#27231d',
123
+ surfaceMuted: '#302b24',
124
+ border: '#443d32',
125
+ borderStrong: '#6b5f4c',
126
+ text: '#efe8da',
127
+ textMuted: '#b2a58c',
128
+ textFaint: '#7c715f',
129
+ },
130
+ },
131
+ },
98
132
  }
99
133
 
100
134
  /** Нейтральные шкалы: фон, поверхности, границы, текст — для обеих схем. */
@@ -193,6 +227,7 @@ export const radiusScales = {
193
227
  default: { sm: '6px', md: '8px', lg: '14px' },
194
228
  soft: { sm: '9px', md: '12px', lg: '20px' },
195
229
  pill: { sm: '12px', md: '16px', lg: '28px' },
230
+ square: { sm: '0px', md: '0px', lg: '0px' },
196
231
  }
197
232
 
198
233
  /** Плотность: высота контролов и базовый шаг. */
@@ -216,6 +251,10 @@ export const elevations = {
216
251
  light: { sm: '0 1px 3px rgba(15, 23, 42, 0.08)', md: '0 8px 24px rgba(15, 23, 42, 0.12)', lg: '0 24px 60px rgba(15, 23, 42, 0.20)' },
217
252
  dark: { sm: '0 1px 3px rgba(0, 0, 0, 0.45)', md: '0 8px 24px rgba(0, 0, 0, 0.55)', lg: '0 24px 60px rgba(0, 0, 0, 0.7)' },
218
253
  },
254
+ hard: {
255
+ light: { sm: '0 3px 0 rgba(43, 36, 24, 0.28)', md: '0 4px 0 rgba(43, 36, 24, 0.16)', lg: '0 8px 0 rgba(43, 36, 24, 0.22)' },
256
+ dark: { sm: '0 3px 0 rgba(0, 0, 0, 0.55)', md: '0 4px 0 rgba(0, 0, 0, 0.45)', lg: '0 8px 0 rgba(0, 0, 0, 0.6)' },
257
+ },
219
258
  }
220
259
 
221
260
  /** Шрифтовые пары. */
@@ -224,6 +263,7 @@ export const fontStacks = {
224
263
  grotesk: "'Inter', 'Segoe UI', system-ui, sans-serif",
225
264
  serif: "'Georgia', 'Times New Roman', serif",
226
265
  mono: "ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace",
266
+ rounded: "ui-rounded, 'SF Pro Rounded', 'Nunito', 'Varela Round', 'Segoe UI', system-ui, sans-serif",
227
267
  }
228
268
 
229
269
  /** Сводит `system` к конкретной схеме по настройке ОС; вне браузера — light. */
@@ -254,10 +294,11 @@ export function buildTheme(theme = {}) {
254
294
  ...(spec.textMuted ? { textMuted: spec.textMuted } : {}),
255
295
  ...(spec.textFaint ? { textFaint: spec.textFaint } : {}),
256
296
  }
257
- const radius = radiusScales[spec.radius] ?? radiusScales.default
258
- const density = densities[spec.density] ?? densities.default
259
- const elevation = (elevations[spec.elevation] ?? elevations.default)[scheme]
260
- const font = fontStacks[spec.font] ?? spec.font ?? fontStacks.system
297
+ const radius = radiusScales[spec.radius ?? preset.radius] ?? radiusScales.default
298
+ const density = densities[spec.density ?? preset.density] ?? densities.default
299
+ const elevation = (elevations[spec.elevation ?? preset.elevation] ?? elevations.default)[scheme]
300
+ const fontKey = spec.font ?? preset.font
301
+ const font = fontStacks[fontKey] ?? fontKey ?? fontStacks.system
261
302
 
262
303
  const baseAccent = spec.accent ?? preset.accent
263
304
  const accent = dark ? tint(baseAccent, 0.12) : baseAccent