@xleddyl/443-components-vue 0.16.16 → 0.16.18

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/CATALOG.md CHANGED
@@ -158,28 +158,28 @@ Playground paths in this file are relative to `playground/nuxt/app/pages/compone
158
158
 
159
159
  All field components work inside `FormField` and take `invalid`, `disabled`, `readonly`, `required` and `size`. They use `v-model`.
160
160
 
161
- | Component | Purpose and when to use it | Main props, models, slots, events | Playground |
162
- | ------------------ | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
163
- | `Checkbox` | One boolean, or one value in an array model. Use `Switch` for an instant setting. | Model: boolean or array. Props: `label`, `description`, `value`, `indeterminate`. Slots: default, `description`. | `forms/checkbox.vue` |
164
- | `CheckboxGroup` | Several choices as checkboxes from `options`. | Model: `T[]`. Props: `options` (`label`, `value`, `description`, `disabled`, `icon`), `legend`, `orientation`, `columns`, `variant` (default, filled), `name`. | `forms/checkbox-group.vue` |
165
- | `Radio` | One radio option, used inside `RadioGroup`. | Props: `value`, `label`, `description`, `icon`. Slots: default, `description`. | `forms/radio-group.vue` |
166
- | `RadioGroup` | One choice from a short list. Use `Select` for long lists, `SegmentedControl` for a compact toggle. | Model: value or null. Props: `options`, `legend`, `orientation`, `variant` (default, card), `name`. | `forms/radio-group.vue` |
167
- | `SegmentedControl` | Compact toggle between 2 to 5 options (view mode, period). | Model: value (with `required` it is never null). Props: `options` (`label`, `value`, `icon`, `title`, `muted`), `iconOnly`, `block`, `label`. Slot: `option`. | `forms/segmented-control.vue` |
168
- | `Select` | Native styled select. Use `Combobox` when search or async options are needed. | Model: `T or null`. Props: `options` (items or groups with `label`, `value`, `disabled`), `placeholder`, `icon`. Option values can be string, number or boolean. | `forms/select.vue` |
169
- | `Combobox` | Searchable select. Local filter, async `search`, `multiple` with tags, `creatable`. | Models: `v-model`, `v-model:query`. Props: `options` (`label`, `value`, `description` (also the tooltip of a selected tag), `icon`, `color` (dot and tag color), `keywords`), `search(query, signal)`, `filter`, `multiple`, `hideTags`, `creatable`, `createTransform`, `createValidate` (a returned string is the inline error), `debounce`, `minQueryLength`, `maxSelected`, `clearable`, `loading`, `placeholder`, `emptyText`. Slots: `option`, `empty`, `header` (top of the panel, for example quick filter pills). Events: `create`, `open`, `close`. | `forms/combobox.vue` |
170
- | `Switch` | On or off setting that applies at once. | Model: boolean. Props: `label`, `description`, `labelPosition`, `checkedIcon`, `uncheckedIcon`, `name`. Slots: default, `description`. | `forms/switch.vue` |
171
- | `NumberInput` | Locale aware number with stepper, min, max, step. | Model: number or null. Props: `min`, `max`, `step`, `largeStep`, `locale`, `formatOptions` (currency, percent), `stepper`, `wheel`, `align`, `icon`, `placeholder`. | `forms/number-input.vue` |
172
- | `PasswordInput` | Password with show or hide, optional generator, copy and strength meter. | Model: string. Props: `generate` (true or a function), `copy`, `strength`, `minLength`, `autocomplete`. Event: `generate`. | `forms/password-input.vue` |
173
- | `PinInput` | One time code or PIN in separate cells. | Model: string. Props: `length`, `mode` (numeric, alphanumeric, alphabetic), `mask`, `uppercase`, `separatorAfter`, `autocomplete`. Event: `complete(value)`. | `forms/pin-input.vue` |
174
- | `InputGroup` | Join an input with addons or buttons on its sides. | Props: `label`, `size`, `block`. Slot: default (inputs, `InputAddon`, `Button`). | `forms/input-group.vue` |
175
- | `InputAddon` | Static text or icon (currency, domain, unit) inside an `InputGroup`. | Props: `label`, `icon`, `size`. Slot: default. | `forms/input-group.vue` |
176
- | `DateInput` | Native date, datetime-local, month or week input. Use `DatePicker` for a calendar popover or ranges. | Model: ISO string or null. Props: `type`, `min`, `max`, `step`, `clearable`. | `forms/date-input.vue` |
177
- | `DatePicker` | Input with a calendar popover. Single date or `range`. | Model: ISO string, range object (`start`, `end`) or null. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `format`, `closeOnSelect`, `clearable`. Slot: `footer`. | `forms/date-picker.vue` |
178
- | `Calendar` | Inline calendar. Use it for availability views, or as a building block. | Models: `v-model` (date or range), `v-model:month`. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `dayText(iso)`. Slots: `day`, `footer`. Event: `select`. | `forms/calendar.vue` |
179
- | `TimeInput` | Time of day (HH:MM, optional seconds). | Model: string or null. Props: `min`, `max`, `step`, `seconds`, `clearable`. | `forms/time-input.vue` |
180
- | `ColorInput` | Color text field with picker and swatches. | Model: hex string or null. Props: `swatches` (strings or `{ value, label }`), `placeholder`, `invalidText`. | `forms/color-input.vue` |
181
- | `Slider` | Number in a range with drag handle. | Model: number. Props: `min`, `max`, `step`, `bubble` (true, always), `marks`, `format(value)`, `label`. Event: `change` (on release). | `forms/slider.vue` |
182
- | `FileInput` | Drop zone and file picker. Validates type, size and count. Supports folders and previews. | Model: `File`, `File[]` or null. Props: `accept`, `acceptMode`, `maxSize`, `maxFiles`, `multiple`, `directory`, `directoryAction`, `previews`, `list`, `loading`, `capture`, `title`, `dropText`, `hint`. Slots: `title`, `hint`, `actions`. Events: `add`, `remove`, `invalid`, `reject`. | `forms/file-input.vue` |
161
+ | Component | Purpose and when to use it | Main props, models, slots, events | Playground |
162
+ | ------------------ | ---------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
163
+ | `Checkbox` | One boolean, or one value in an array model. Use `Switch` for an instant setting. | Model: boolean or array. Props: `label`, `description`, `value`, `indeterminate`. Slots: default, `description`. | `forms/checkbox.vue` |
164
+ | `CheckboxGroup` | Several choices as checkboxes from `options`. | Model: `T[]`. Props: `options` (`label`, `value`, `description`, `disabled`, `icon`), `legend`, `orientation`, `columns`, `variant` (default, filled), `name`. | `forms/checkbox-group.vue` |
165
+ | `Radio` | One radio option, used inside `RadioGroup`. | Props: `value`, `label`, `description`, `icon`. Slots: default, `description`. | `forms/radio-group.vue` |
166
+ | `RadioGroup` | One choice from a short list. Use `Select` for long lists, `SegmentedControl` for a compact toggle. | Model: value or null. Props: `options`, `legend`, `orientation`, `variant` (default, card), `name`. | `forms/radio-group.vue` |
167
+ | `SegmentedControl` | Compact toggle between 2 to 5 options (view mode, period). | Model: value (with `required` it is never null). Props: `options` (`label`, `value`, `icon`, `title`, `muted`), `iconOnly`, `block`, `label`. Slot: `option`. | `forms/segmented-control.vue` |
168
+ | `Select` | Native styled select. Use `Combobox` when search or async options are needed. | Model: `T or null`. Props: `options` (items or groups with `label`, `value`, `disabled`), `placeholder`, `icon`. Option values can be string, number or boolean. | `forms/select.vue` |
169
+ | `Combobox` | Searchable select. Local filter, async `search`, `multiple` with tags, `creatable`. | Models: `v-model`, `v-model:query`. Props: `options` (`label`, `value`, `description`, `icon`, `color` (dot and tag color), `group` (divider with the group name, also the tooltip of a selected tag), `keywords`), `search(query, signal)`, `filter`, `multiple`, `hideTags`, `creatable`, `createTransform`, `createValidate` (a returned string is the inline error), `debounce`, `minQueryLength`, `maxSelected`, `clearable`, `loading`, `placeholder`, `emptyText`. Slots: `option`, `empty`, `header` (top of the panel, for example quick filter pills). Events: `create`, `open`, `close`. | `forms/combobox.vue` |
170
+ | `Switch` | On or off setting that applies at once. | Model: boolean. Props: `label`, `description`, `labelPosition`, `checkedIcon`, `uncheckedIcon`, `name`. Slots: default, `description`. | `forms/switch.vue` |
171
+ | `NumberInput` | Locale aware number with stepper, min, max, step. | Model: number or null. Props: `min`, `max`, `step`, `largeStep`, `locale`, `formatOptions` (currency, percent), `stepper`, `wheel`, `align`, `icon`, `placeholder`. | `forms/number-input.vue` |
172
+ | `PasswordInput` | Password with show or hide, optional generator, copy and strength meter. | Model: string. Props: `generate` (true or a function), `copy`, `strength`, `minLength`, `autocomplete`. Event: `generate`. | `forms/password-input.vue` |
173
+ | `PinInput` | One time code or PIN in separate cells. | Model: string. Props: `length`, `mode` (numeric, alphanumeric, alphabetic), `mask`, `uppercase`, `separatorAfter`, `autocomplete`. Event: `complete(value)`. | `forms/pin-input.vue` |
174
+ | `InputGroup` | Join an input with addons or buttons on its sides. | Props: `label`, `size`, `block`. Slot: default (inputs, `InputAddon`, `Button`). | `forms/input-group.vue` |
175
+ | `InputAddon` | Static text or icon (currency, domain, unit) inside an `InputGroup`. | Props: `label`, `icon`, `size`. Slot: default. | `forms/input-group.vue` |
176
+ | `DateInput` | Native date, datetime-local, month or week input. Use `DatePicker` for a calendar popover or ranges. | Model: ISO string or null. Props: `type`, `min`, `max`, `step`, `clearable`. | `forms/date-input.vue` |
177
+ | `DatePicker` | Input with a calendar popover. Single date or `range`. | Model: ISO string, range object (`start`, `end`) or null. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `format`, `closeOnSelect`, `clearable`. Slot: `footer`. | `forms/date-picker.vue` |
178
+ | `Calendar` | Inline calendar. Use it for availability views, or as a building block. | Models: `v-model` (date or range), `v-model:month`. Props: `range`, `min`, `max`, `isDateDisabled`, `locale`, `weekStartsOn`, `dayText(iso)`. Slots: `day`, `footer`. Event: `select`. | `forms/calendar.vue` |
179
+ | `TimeInput` | Time of day (HH:MM, optional seconds). | Model: string or null. Props: `min`, `max`, `step`, `seconds`, `clearable`. | `forms/time-input.vue` |
180
+ | `ColorInput` | Color text field with picker and swatches. | Model: hex string or null. Props: `swatches` (strings or `{ value, label }`), `placeholder`, `invalidText`. | `forms/color-input.vue` |
181
+ | `Slider` | Number in a range with drag handle. | Model: number. Props: `min`, `max`, `step`, `bubble` (true, always), `marks`, `format(value)`, `label`. Event: `change` (on release). | `forms/slider.vue` |
182
+ | `FileInput` | Drop zone and file picker. Validates type, size and count. Supports folders and previews. | Model: `File`, `File[]` or null. Props: `accept`, `acceptMode`, `maxSize`, `maxFiles`, `multiple`, `directory`, `directoryAction`, `previews`, `list`, `loading`, `capture`, `title`, `dropText`, `hint`. Slots: `title`, `hint`, `actions`. Events: `add`, `remove`, `invalid`, `reject`. | `forms/file-input.vue` |
183
183
 
184
184
  ## Overlays
185
185
 
@@ -34,7 +34,7 @@
34
34
  :key="keyOf(value)"
35
35
  class="k-combobox-tag"
36
36
  :class="tagClass(value)"
37
- :title="optionFor(value)?.description"
37
+ :title="optionFor(value)?.group ?? optionFor(value)?.description"
38
38
  >
39
39
  <span class="k-combobox-tag-label">{{ labelFor(value) }}</span>
40
40
  <button
@@ -125,60 +125,74 @@
125
125
  :aria-multiselectable="multiple ? 'true' : void 0"
126
126
  :aria-busy="busy ? 'true' : void 0"
127
127
  >
128
- <li
128
+ <template
129
129
  v-for="(item, index) in items"
130
- :id="optionId(index)"
131
130
  :key="item.kind === 'create' ? '__create' : keyOf(item.option.value)"
132
- role="option"
133
- class="k-combobox-option"
134
- :class="{
131
+ >
132
+ <li v-if="groupStarts(index)" role="presentation" class="k-combobox-group">
133
+ <span
134
+ v-if="item.option.color"
135
+ class="k-combobox-option-dot"
136
+ :class="paletteClass(item.option.color)"
137
+ aria-hidden="true"
138
+ />
139
+ {{ item.option.group }}
140
+ </li>
141
+ <li
142
+ :id="optionId(index)"
143
+ role="option"
144
+ class="k-combobox-option"
145
+ :class="{
135
146
  'is-active': index === activeIndex,
136
147
  'is-selected': item.selected,
137
148
  'is-create': item.kind === 'create'
138
149
  }"
139
- :aria-selected="item.selected ? 'true' : 'false'"
140
- :aria-disabled="item.option.disabled ? 'true' : void 0"
141
- @mousemove="activate(index)"
142
- @click="choose(item)"
143
- >
144
- <span v-if="multiple && item.kind === 'option'" class="k-combobox-check">
145
- <Icon v-if="item.selected" name="check" />
146
- </span>
147
- <Icon v-if="item.kind === 'create'" name="plus" class="k-combobox-option-icon" />
148
- <span
149
- v-else-if="item.option.color && !item.option.icon"
150
- class="k-combobox-option-dot"
151
- :class="paletteClass(item.option.color)"
152
- aria-hidden="true"
153
- />
154
- <Icon
155
- v-else-if="item.option.icon"
156
- :name="item.option.icon"
157
- class="k-combobox-option-icon"
158
- />
159
- <span class="k-combobox-option-text">
160
- <slot
161
- v-if="item.kind === 'option'"
162
- name="option"
163
- :option="item.option"
164
- :selected="item.selected"
165
- :query="query"
166
- >
167
- <span class="k-combobox-option-label">{{ item.option.label }}</span>
168
- <span v-if="item.option.description" class="k-combobox-option-description">{{
169
- item.option.description
150
+ :aria-selected="item.selected ? 'true' : 'false'"
151
+ :aria-disabled="item.option.disabled ? 'true' : void 0"
152
+ @mousemove="activate(index)"
153
+ @click="choose(item)"
154
+ >
155
+ <span v-if="multiple && item.kind === 'option'" class="k-combobox-check">
156
+ <Icon v-if="item.selected" name="check" />
157
+ </span>
158
+ <Icon v-if="item.kind === 'create'" name="plus" class="k-combobox-option-icon" />
159
+ <span
160
+ v-else-if="item.option.color && !item.option.icon && !item.option.group"
161
+ class="k-combobox-option-dot"
162
+ :class="paletteClass(item.option.color)"
163
+ aria-hidden="true"
164
+ />
165
+ <Icon
166
+ v-else-if="item.option.icon"
167
+ :name="item.option.icon"
168
+ class="k-combobox-option-icon"
169
+ />
170
+ <span class="k-combobox-option-text">
171
+ <slot
172
+ v-if="item.kind === 'option'"
173
+ name="option"
174
+ :option="item.option"
175
+ :selected="item.selected"
176
+ :query="query"
177
+ >
178
+ <span class="k-combobox-option-label">{{ item.option.label }}</span>
179
+ <span
180
+ v-if="item.option.description"
181
+ class="k-combobox-option-description"
182
+ >{{ item.option.description }}</span
183
+ >
184
+ </slot>
185
+ <span v-else class="k-combobox-option-label">{{
186
+ buildCreateText(item.option.label)
170
187
  }}</span>
171
- </slot>
172
- <span v-else class="k-combobox-option-label">{{
173
- buildCreateText(item.option.label)
174
- }}</span>
175
- </span>
176
- <Icon
177
- v-if="!multiple && item.selected"
178
- name="check"
179
- class="k-combobox-option-selected"
180
- />
181
- </li>
188
+ </span>
189
+ <Icon
190
+ v-if="!multiple && item.selected"
191
+ name="check"
192
+ class="k-combobox-option-selected"
193
+ />
194
+ </li>
195
+ </template>
182
196
  </ul>
183
197
  <div v-if="busy && !items.length" class="k-combobox-state">
184
198
  <Spinner decorative size="xs" />
@@ -382,7 +396,7 @@ const createCandidate = computed(() => {
382
396
  if (!text) return void 0;
383
397
  const needle = normalizeSearch(text);
384
398
  const exists = [...filteredOptions.value, ...known.values()].some(
385
- (option) => normalizeSearch(option.label) === needle
399
+ (option) => normalizeSearch(option.label) === needle || normalizeSearch(keyOf(option.value)) === needle
386
400
  );
387
401
  return exists ? void 0 : text;
388
402
  });
@@ -425,6 +439,12 @@ function optionId(index) {
425
439
  function remember(option) {
426
440
  known.set(keyOf(option.value), option);
427
441
  }
442
+ function groupStarts(index) {
443
+ const item = items.value[index];
444
+ if (!item || item.kind !== "option" || !item.option.group) return false;
445
+ const previous = items.value[index - 1];
446
+ return previous?.kind !== "option" || previous.option.group !== item.option.group;
447
+ }
428
448
  function optionFor(value) {
429
449
  const key = keyOf(value);
430
450
  return props.options.find((option) => keyOf(option.value) === key) ?? results.value.find((option) => keyOf(option.value) === key) ?? known.get(key);
@@ -30,6 +30,7 @@ export interface ComboboxOption<T = string | number> {
30
30
  disabled?: boolean;
31
31
  icon?: IconName;
32
32
  color?: PaletteColor;
33
+ group?: string;
33
34
  keywords?: string[];
34
35
  }
35
36
  export type ComboboxSearch<T = string | number> = (query: string, signal: AbortSignal) => Promise<ComboboxOption<T>[]> | ComboboxOption<T>[];
@@ -87,7 +87,6 @@
87
87
  color: var(--k-accent-text);
88
88
  }
89
89
 
90
- .k-filter-pill-sm,
91
90
  .k-filter-pill-dot {
92
91
  width: 0.5rem;
93
92
  height: 0.5rem;
@@ -96,6 +95,7 @@
96
95
  background: var(--k-palette);
97
96
  }
98
97
 
98
+ .k-filter-pill-sm,
99
99
  .k-filter-pills-sm .k-filter-pill {
100
100
  height: var(--k-size-sm);
101
101
  padding: 0 0.625rem;
@@ -180,6 +180,21 @@
180
180
  background: inherit;
181
181
  }
182
182
 
183
+ .k-combobox-group {
184
+ display: flex;
185
+ align-items: center;
186
+ gap: 0.5rem;
187
+ padding: 0.5rem 0.5rem 0.25rem;
188
+ font-size: 0.75rem;
189
+ font-weight: var(--k-font-weight-medium, 500);
190
+ color: var(--k-text-muted);
191
+ }
192
+
193
+ .k-combobox-group:not(:first-child) {
194
+ margin-top: 0.25rem;
195
+ border-top: 1px solid var(--k-line);
196
+ }
197
+
183
198
  .k-combobox-option-dot {
184
199
  width: 0.5rem;
185
200
  height: 0.5rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xleddyl/443-components-vue",
3
- "version": "0.16.16",
3
+ "version": "0.16.18",
4
4
  "description": "Compact, scoped dashboard components for Vue and Nuxt",
5
5
  "license": "MIT",
6
6
  "author": "Edoardo Alberti (https://github.com/xleddyl)",