@streamscloud/kit 0.14.0 → 0.15.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.
@@ -13,11 +13,11 @@ A placeholder image stub showing a generic image icon, used as a fallback when n
13
13
  ### CSS Custom Properties
14
14
  | Property | Description | Default |
15
15
  |---|---|---|
16
- | `--sc-kit--image-stub--color` | Icon and border color | `var(--sc-kit--color--bg--images)` |
16
+ | `--sc-kit--image-stub--color` | Icon color | `var(--sc-kit--color--text--on-accent)` |
17
17
  -->
18
18
 
19
19
  <style>.image-stub {
20
- --_image-stub--color: var(--sc-kit--image-stub--color, var(--sc-kit--color--bg--images));
20
+ --_image-stub--color: var(--sc-kit--image-stub--color, var(--sc-kit--color--text--on-accent));
21
21
  width: 100%;
22
22
  height: 100%;
23
23
  z-index: 2;
@@ -25,6 +25,4 @@ A placeholder image stub showing a generic image icon, used as a fallback when n
25
25
  justify-content: center;
26
26
  align-items: center;
27
27
  color: var(--_image-stub--color);
28
- border: 1px solid var(--_image-stub--color);
29
- border-radius: 0.25rem;
30
28
  }</style>
@@ -17,7 +17,7 @@ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> =
17
17
  * ### CSS Custom Properties
18
18
  * | Property | Description | Default |
19
19
  * |---|---|---|
20
- * | `--sc-kit--image-stub--color` | Icon and border color | `var(--sc-kit--color--bg--images)` |
20
+ * | `--sc-kit--image-stub--color` | Icon color | `var(--sc-kit--color--text--on-accent)` |
21
21
  */
22
22
  declare const Cmp: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
23
23
  [evt: string]: CustomEvent<any>;
@@ -7,9 +7,8 @@ import { isSelectGroup } from './types';
7
7
  const { options, value, compare = defaultCompare, size = 'md', placeholder = '', disabled = false, readonly = false, inert = false, error = false, borderless = false, searchable = false, groupHeader = 'toggle-all', selectionMode = 'children-only', selectedDisplay = 'checkbox', canCreate, icon, chevronIcon, optionSnippet, selectionSnippet, id, name, autocomplete = 'off', 'aria-label': ariaLabel, 'aria-describedby': ariaDescribedby, 'aria-required': ariaRequired, on } = $props();
8
8
  const fuse = $derived(buildFuseIndex(options));
9
9
  const loadOptionsShim = (q) => Promise.resolve(runFuseSearch(fuse, q, options));
10
- // Full unfiltered group listfed to the create-with-parent section's parent picker so it
11
- // stays stable across listbox filtering.
12
- const parentSource = $derived(options.filter(isSelectGroup).reduce((acc, g) => (g.value !== undefined ? [...acc, { label: g.label, value: g.value }] : acc), []));
10
+ // Include flat roots, not only groups else a childless root can't be picked as a create-parent.
11
+ const parentSource = $derived(options.flatMap((item) => (item.value !== undefined ? [{ label: item.label, value: item.value }] : [])));
13
12
  const resolvedValue = $derived.by(() => {
14
13
  const out = [];
15
14
  for (const v of value) {
@@ -57,7 +57,7 @@ declare function $$render<T>(): {
57
57
  selectedDisplay?: "checkmark" | "checkbox" | "highlight";
58
58
  /** Equality comparator for `T`. Required when `T` is an object. @default (a, b) => a === b */
59
59
  compare?: (a: T, b: T) => boolean;
60
- /** Enables creatable mode. The predicate validates each query. When the current `options` contain groups, the "Create …" UI expands into a section with a parent picker. */
60
+ /** Enables creatable mode. The predicate validates each query. When at least one top-level root has a `value`, the "Create …" UI expands into a section whose parent picker offers those roots (group or flat); otherwise a plain "Create …" row is shown. */
61
61
  canCreate?: (query: string) => boolean;
62
62
  /** Leading icon — string SVG source, `{ src, color?, size? }` object, or custom snippet. */
63
63
  icon?: IconProp;
@@ -80,7 +80,7 @@ declare function $$render<T>(): {
80
80
  on?: {
81
81
  /** Fires when the user picks/unpicks (and on group toggle-all). Emits the full new selection (array of values). */
82
82
  change?: (value: T[]) => void;
83
- /** Fires when the user confirms the create-with-parent section. `parentValue` is the group's `value` picked via the parent dropdown — undefined when no parent was selected. Return a Promise to keep the spinner up. */
83
+ /** Fires when the user confirms the create-with-parent section. `parentValue` is the chosen parent root's `value` from the parent dropdown — undefined when no parent was selected. Return a Promise to keep the spinner up. */
84
84
  create?: (payload: {
85
85
  query: string;
86
86
  parentValue?: T;
@@ -103,8 +103,8 @@ const isExternalChips = $derived(chipMode === 'external');
103
103
  const inlineVisible = $derived(isExternalChips || selectionSnippet ? [] : value.slice(0, maxVisible));
104
104
  const inlineOverflow = $derived(isExternalChips || selectionSnippet ? 0 : Math.max(0, value.length - maxVisible));
105
105
  // Create-with-parent section: shown when canCreate is gated true by core AND the proxy
106
- // passed a non-empty `parentSource`. The source is the FULL unfiltered group list so the
107
- // parent picker is stable regardless of which groups currently survive the listbox filter.
106
+ // passed a non-empty `parentSource`. The source is the FULL unfiltered parent-candidate list
107
+ // so the parent picker is stable regardless of which roots currently survive the listbox filter.
108
108
  const parentSourceList = $derived(parentSource ?? []);
109
109
  const showCreateSection = $derived(core.canShowCreate && parentSourceList.length > 0);
110
110
  let selectedParent = $state.raw(null);
@@ -156,7 +156,7 @@ export type MultiselectBaseProps<T> = {
156
156
  * @default 'checkmark'
157
157
  */
158
158
  selectedDisplay?: 'checkmark' | 'checkbox' | 'highlight';
159
- /** Enables creatable mode. The predicate validates each query — only when it returns true does the create UI appear. When options contain groups, a create-with-parent section replaces the simple "Create …" row. */
159
+ /** Enables creatable mode. The predicate validates each query — only when it returns true does the create UI appear. When `parentSource` is non-empty, a create-with-parent section replaces the simple "Create …" row. */
160
160
  canCreate?: (query: string) => boolean;
161
161
  /** Where chips render. `'external'` puts them in a row above the trigger and unlocks `reorderable`. @default 'inline' */
162
162
  chipMode?: 'inline' | 'external';
@@ -190,8 +190,8 @@ export type MultiselectBaseProps<T> = {
190
190
  }]>;
191
191
  /**
192
192
  * Enables the create-with-parent section (shown above the listbox when `canCreate` gates true).
193
- * Receives the FULL group list independent of current filter — so the parent picker offers every
194
- * group regardless of what's currently visible in the listbox. When undefined or empty, a
193
+ * Receives the FULL parent-candidate list independent of current filter — so the parent picker offers
194
+ * every candidate regardless of what's currently visible in the listbox. When undefined or empty, a
195
195
  * single "Create …" row is shown instead.
196
196
  */
197
197
  parentSource?: SelectOption<T>[];
@@ -204,7 +204,7 @@ export type MultiselectBaseProps<T> = {
204
204
  on?: {
205
205
  /** Fires when the user picks/unpicks/reorders. Emits the full new selection. */
206
206
  change?: (value: SelectOption<T>[]) => void;
207
- /** Fires when the user activates "Create …". When `parentValue` is present, the user picked it via the create-with-parent section (shown when options contain groups). Return a Promise to keep the spinner up until the consumer finishes. */
207
+ /** Fires when the user activates "Create …". When `parentValue` is present, the user picked it via the create-with-parent section. Return a Promise to keep the spinner up until the consumer finishes. */
208
208
  create?: (payload: {
209
209
  query: string;
210
210
  parentValue?: T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/kit",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "author": "StreamsCloud",
5
5
  "repository": {
6
6
  "type": "git",