@ark-ui/svelte 5.4.0 → 5.6.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.
@@ -1,5 +1,6 @@
1
1
  export { createGridCollection, type GridCollection, type GridCollectionOptions } from './grid-collection';
2
2
  export { createListCollection, type CollectionItem, type CollectionOptions, type ListCollection, } from './list-collection';
3
3
  export { createFileTreeCollection, createTreeCollection, type FilePathTreeNode, type FlatTreeNode, type TreeCollection, type TreeCollectionOptions, type TreeNode, } from './tree-collection';
4
+ export { useAsyncList, type UseAsyncListProps, type UseAsyncListReturn } from './use-async-list.svelte';
4
5
  export { useListCollection, type UseListCollectionProps, type UseListCollectionReturn, } from './use-list-collection.svelte';
5
6
  export { useListSelection, type UseListSelectionProps, type UseListSelectionReturn } from './use-list-selection.svelte';
@@ -1,5 +1,6 @@
1
1
  export { createGridCollection } from './grid-collection';
2
2
  export { createListCollection, } from './list-collection';
3
3
  export { createFileTreeCollection, createTreeCollection, } from './tree-collection';
4
+ export { useAsyncList } from './use-async-list.svelte';
4
5
  export { useListCollection, } from './use-list-collection.svelte';
5
6
  export { useListSelection } from './use-list-selection.svelte';
@@ -0,0 +1,8 @@
1
+ import type { Accessor } from '../../types';
2
+ import * as asyncList from '@zag-js/async-list';
3
+ import { type MaybeFunction } from '@zag-js/utils';
4
+ export interface UseAsyncListProps<T, C = string> extends asyncList.Props<T, C> {
5
+ }
6
+ export interface UseAsyncListReturn<T, C = string> extends Accessor<asyncList.Api<T, C>> {
7
+ }
8
+ export declare const useAsyncList: <T, C = string>(props?: MaybeFunction<UseAsyncListProps<T, C>>) => UseAsyncListReturn<T, C>;
@@ -0,0 +1,9 @@
1
+ import * as asyncList from '@zag-js/async-list';
2
+ import { useMachine } from '@zag-js/svelte';
3
+ import { runIfFn } from '@zag-js/utils';
4
+ export const useAsyncList = (props) => {
5
+ const machineProps = $derived.by(() => runIfFn(props));
6
+ const service = useMachine(asyncList.machine, () => machineProps);
7
+ const api = $derived(asyncList.connect(service));
8
+ return () => api;
9
+ };
@@ -1,8 +1,8 @@
1
1
  <script module lang="ts">
2
2
  import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types'
3
3
 
4
- export interface FieldsetLegendBaseProps extends PolymorphicProps<'legend'>, RefAttribute {}
5
- export interface FieldsetLegendProps extends Assign<HTMLProps<'legend'>, FieldsetLegendBaseProps> {}
4
+ export interface FieldsetLegendBaseProps extends PolymorphicProps<'div'>, RefAttribute {}
5
+ export interface FieldsetLegendProps extends Assign<HTMLProps<'div'>, FieldsetLegendBaseProps> {}
6
6
  </script>
7
7
 
8
8
  <script lang="ts">
@@ -15,4 +15,4 @@
15
15
  const mergedProps = $derived(mergeProps(fieldset?.().getLegendProps(), props))
16
16
  </script>
17
17
 
18
- <Ark as="legend" bind:ref {...mergedProps} />
18
+ <Ark as="div" bind:ref {...mergedProps} />
@@ -1,7 +1,7 @@
1
1
  import type { Assign, HTMLProps, PolymorphicProps, RefAttribute } from '../../types';
2
- export interface FieldsetLegendBaseProps extends PolymorphicProps<'legend'>, RefAttribute {
2
+ export interface FieldsetLegendBaseProps extends PolymorphicProps<'div'>, RefAttribute {
3
3
  }
4
- export interface FieldsetLegendProps extends Assign<HTMLProps<'legend'>, FieldsetLegendBaseProps> {
4
+ export interface FieldsetLegendProps extends Assign<HTMLProps<'div'>, FieldsetLegendBaseProps> {
5
5
  }
6
6
  declare const FieldsetLegend: import("svelte").Component<FieldsetLegendProps, {}, "ref">;
7
7
  type FieldsetLegend = ReturnType<typeof FieldsetLegend>;
@@ -20,6 +20,7 @@ export const useFieldset = (inProps = {}) => {
20
20
  const setRootRef = (el) => {
21
21
  rootRef = el;
22
22
  };
23
+ const legendId = $derived(`fieldset::${id}::legend`);
23
24
  const errorTextId = $derived(`fieldset::${id}::error-text`);
24
25
  const helperTextId = $derived(`fieldset::${id}::helper-text`);
25
26
  const checkTextElements = () => {
@@ -51,9 +52,11 @@ export const useFieldset = (inProps = {}) => {
51
52
  disabled,
52
53
  'data-disabled': dataAttr(disabled),
53
54
  'data-invalid': dataAttr(invalid),
55
+ 'aria-labelledby': legendId,
54
56
  'aria-describedby': labelIds(),
55
57
  });
56
58
  const getLegendProps = () => ({
59
+ id: legendId,
57
60
  ...parts.legend.attrs,
58
61
  'data-disabled': dataAttr(disabled),
59
62
  'data-invalid': dataAttr(invalid),
@@ -9,7 +9,7 @@
9
9
  const props: HighlightProps = $props()
10
10
 
11
11
  const [highlightProps, localProps] = $derived(
12
- createSplitProps<HighlightBaseProps>()(props, ['query', 'text', 'ignoreCase', 'matchAll']),
12
+ createSplitProps<HighlightBaseProps>()(props, ['query', 'text', 'ignoreCase', 'matchAll', 'exactMatch']),
13
13
  )
14
14
 
15
15
  if (typeof props.text !== 'string') {
@@ -1,3 +1,4 @@
1
+ export type { ActionOptions as ToastActionOptions, Placement as ToastPlacement, PromiseOptions as ToastPromiseOptions, Status as ToastStatus, StatusChangeDetails as ToastStatusChangeDetails, Type as ToastType, } from '@zag-js/toast';
1
2
  export { createToaster, type CreateToasterProps, type CreateToasterReturn } from './create-toaster.js';
2
3
  export { default as ToastActionTrigger, type ToastActionTriggerBaseProps, type ToastActionTriggerProps, } from './toast-action-trigger.svelte';
3
4
  export { default as ToastCloseTrigger, type ToastCloseTriggerBaseProps, type ToastCloseTriggerProps, } from './toast-close-trigger.svelte';
@@ -1,3 +1,4 @@
1
1
  export { default as LocaleProvider, type LocaleProviderProps } from './locale-provider.svelte';
2
+ export { useCollator, type UseCollatorProps, type UseCollatorReturn } from './use-collator.svelte';
2
3
  export { useFilter, type UseFilterProps, type UseFilterReturn } from './use-filter.svelte';
3
4
  export { useLocaleContext, type UseLocaleContext } from './use-locale-context';
@@ -1,3 +1,4 @@
1
1
  export { default as LocaleProvider } from './locale-provider.svelte';
2
+ export { useCollator } from './use-collator.svelte';
2
3
  export { useFilter } from './use-filter.svelte';
3
4
  export { useLocaleContext } from './use-locale-context';
@@ -0,0 +1,7 @@
1
+ import type { Accessor } from '../../types';
2
+ export interface UseCollatorProps extends Intl.CollatorOptions {
3
+ locale?: string;
4
+ }
5
+ export interface UseCollatorReturn extends Accessor<Intl.Collator> {
6
+ }
7
+ export declare function useCollator(props?: UseCollatorProps): UseCollatorReturn;
@@ -0,0 +1,11 @@
1
+ import { createCollator } from '@zag-js/i18n-utils';
2
+ import { useLocaleContext } from './use-locale-context';
3
+ export function useCollator(props = {}) {
4
+ const env = useLocaleContext();
5
+ const locale = $derived(props.locale ?? env().locale);
6
+ const collator = $derived.by(() => {
7
+ const { locale: _, ...options } = props;
8
+ return createCollator(locale, options);
9
+ });
10
+ return () => collator;
11
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ark-ui/svelte",
3
3
  "type": "module",
4
- "version": "5.4.0",
4
+ "version": "5.6.0",
5
5
  "description": "A collection of unstyled, accessible UI components for Svelte",
6
6
  "keywords": [
7
7
  "accordion",
@@ -120,65 +120,66 @@
120
120
  "sideEffects": false,
121
121
  "dependencies": {
122
122
  "@internationalized/date": "3.8.2",
123
- "@zag-js/accordion": "1.21.6",
124
- "@zag-js/anatomy": "1.21.6",
125
- "@zag-js/angle-slider": "1.21.6",
126
- "@zag-js/auto-resize": "1.21.6",
127
- "@zag-js/avatar": "1.21.6",
128
- "@zag-js/carousel": "1.21.6",
129
- "@zag-js/checkbox": "1.21.6",
130
- "@zag-js/clipboard": "1.21.6",
131
- "@zag-js/collapsible": "1.21.6",
132
- "@zag-js/collection": "1.21.6",
133
- "@zag-js/color-picker": "1.21.6",
134
- "@zag-js/color-utils": "1.21.6",
135
- "@zag-js/combobox": "1.21.6",
136
- "@zag-js/core": "1.21.6",
137
- "@zag-js/date-picker": "1.21.6",
138
- "@zag-js/date-utils": "1.21.6",
139
- "@zag-js/dialog": "1.21.6",
140
- "@zag-js/dom-query": "1.21.6",
141
- "@zag-js/editable": "1.21.6",
142
- "@zag-js/file-upload": "1.21.6",
143
- "@zag-js/file-utils": "1.21.6",
144
- "@zag-js/floating-panel": "1.21.6",
145
- "@zag-js/focus-trap": "1.21.6",
146
- "@zag-js/highlight-word": "1.21.6",
147
- "@zag-js/hover-card": "1.21.6",
148
- "@zag-js/i18n-utils": "1.21.6",
149
- "@zag-js/json-tree-utils": "1.21.6",
150
- "@zag-js/listbox": "1.21.6",
151
- "@zag-js/menu": "1.21.6",
152
- "@zag-js/number-input": "1.21.6",
153
- "@zag-js/pagination": "1.21.6",
154
- "@zag-js/password-input": "1.21.6",
155
- "@zag-js/pin-input": "1.21.6",
156
- "@zag-js/popover": "1.21.6",
157
- "@zag-js/presence": "1.21.6",
158
- "@zag-js/progress": "1.21.6",
159
- "@zag-js/qr-code": "1.21.6",
160
- "@zag-js/radio-group": "1.21.6",
161
- "@zag-js/rating-group": "1.21.6",
162
- "@zag-js/scroll-area": "1.21.6",
163
- "@zag-js/select": "1.21.6",
164
- "@zag-js/signature-pad": "1.21.6",
165
- "@zag-js/slider": "1.21.6",
166
- "@zag-js/splitter": "1.21.6",
167
- "@zag-js/steps": "1.21.6",
168
- "@zag-js/svelte": "1.21.6",
169
- "@zag-js/switch": "1.21.6",
170
- "@zag-js/tabs": "1.21.6",
171
- "@zag-js/tags-input": "1.21.6",
172
- "@zag-js/time-picker": "1.21.6",
173
- "@zag-js/timer": "1.21.6",
174
- "@zag-js/toast": "1.21.6",
175
- "@zag-js/toggle": "1.21.6",
176
- "@zag-js/toggle-group": "1.21.6",
177
- "@zag-js/tooltip": "1.21.6",
178
- "@zag-js/tour": "1.21.6",
179
- "@zag-js/tree-view": "1.21.6",
180
- "@zag-js/types": "1.21.6",
181
- "@zag-js/utils": "1.21.6"
123
+ "@zag-js/accordion": "1.21.9",
124
+ "@zag-js/anatomy": "1.21.9",
125
+ "@zag-js/angle-slider": "1.21.9",
126
+ "@zag-js/async-list": "1.21.9",
127
+ "@zag-js/auto-resize": "1.21.9",
128
+ "@zag-js/avatar": "1.21.9",
129
+ "@zag-js/carousel": "1.21.9",
130
+ "@zag-js/checkbox": "1.21.9",
131
+ "@zag-js/clipboard": "1.21.9",
132
+ "@zag-js/collapsible": "1.21.9",
133
+ "@zag-js/collection": "1.21.9",
134
+ "@zag-js/color-picker": "1.21.9",
135
+ "@zag-js/color-utils": "1.21.9",
136
+ "@zag-js/combobox": "1.21.9",
137
+ "@zag-js/core": "1.21.9",
138
+ "@zag-js/date-picker": "1.21.9",
139
+ "@zag-js/date-utils": "1.21.9",
140
+ "@zag-js/dialog": "1.21.9",
141
+ "@zag-js/dom-query": "1.21.9",
142
+ "@zag-js/editable": "1.21.9",
143
+ "@zag-js/file-upload": "1.21.9",
144
+ "@zag-js/file-utils": "1.21.9",
145
+ "@zag-js/floating-panel": "1.21.9",
146
+ "@zag-js/focus-trap": "1.21.9",
147
+ "@zag-js/highlight-word": "1.21.9",
148
+ "@zag-js/hover-card": "1.21.9",
149
+ "@zag-js/i18n-utils": "1.21.9",
150
+ "@zag-js/json-tree-utils": "1.21.9",
151
+ "@zag-js/listbox": "1.21.9",
152
+ "@zag-js/menu": "1.21.9",
153
+ "@zag-js/number-input": "1.21.9",
154
+ "@zag-js/pagination": "1.21.9",
155
+ "@zag-js/password-input": "1.21.9",
156
+ "@zag-js/pin-input": "1.21.9",
157
+ "@zag-js/popover": "1.21.9",
158
+ "@zag-js/presence": "1.21.9",
159
+ "@zag-js/progress": "1.21.9",
160
+ "@zag-js/qr-code": "1.21.9",
161
+ "@zag-js/radio-group": "1.21.9",
162
+ "@zag-js/rating-group": "1.21.9",
163
+ "@zag-js/scroll-area": "1.21.9",
164
+ "@zag-js/select": "1.21.9",
165
+ "@zag-js/signature-pad": "1.21.9",
166
+ "@zag-js/slider": "1.21.9",
167
+ "@zag-js/splitter": "1.21.9",
168
+ "@zag-js/steps": "1.21.9",
169
+ "@zag-js/svelte": "1.21.9",
170
+ "@zag-js/switch": "1.21.9",
171
+ "@zag-js/tabs": "1.21.9",
172
+ "@zag-js/tags-input": "1.21.9",
173
+ "@zag-js/time-picker": "1.21.9",
174
+ "@zag-js/timer": "1.21.9",
175
+ "@zag-js/toast": "1.21.9",
176
+ "@zag-js/toggle": "1.21.9",
177
+ "@zag-js/toggle-group": "1.21.9",
178
+ "@zag-js/tooltip": "1.21.9",
179
+ "@zag-js/tour": "1.21.9",
180
+ "@zag-js/tree-view": "1.21.9",
181
+ "@zag-js/types": "1.21.9",
182
+ "@zag-js/utils": "1.21.9"
182
183
  },
183
184
  "devDependencies": {
184
185
  "@storybook/addon-a11y": "9.1.2",
@@ -194,9 +195,9 @@
194
195
  "@vitest/coverage-v8": "3.2.4",
195
196
  "clean-package": "2.2.0",
196
197
  "image-conversion": "2.1.1",
197
- "lucide-svelte": "0.539.0",
198
+ "lucide-svelte": "0.540.0",
198
199
  "storybook": "9.1.2",
199
- "svelte": "5.38.1",
200
+ "svelte": "5.38.2",
200
201
  "svelte-check": "4.3.1",
201
202
  "tslib": "2.8.1",
202
203
  "typescript": "5.9.2",