diff --git a/README.md b/README.md index 68dcab75..829a12f0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ npm install ui-ingredients ## Usage ```svelte - diff --git a/docs/accordion.md b/docs/accordion.md index b10cf47d..1224a2c9 100644 --- a/docs/accordion.md +++ b/docs/accordion.md @@ -5,7 +5,7 @@ A toggle component for expanding and collapsing sections of content. ## Usage ```svelte - ``` - -## Props - -### Root - -- `ids` - - The ids of the elements - -- `value` - - The `value` of the accordion items that are currently being expanded. - -- `disabled` - - Whether the accordion items are disabled - -- `multiple` - - Whether multple accordion items can be expanded at the same time. - -- `orientation` - - The orientation of the accordion items. - -- `collapsible` - - Whether an accordion item can be closed after it has been expanded. - -- `onFocusChange` - - The callback fired when the focused accordion item changes. - -- `onValueChange` - - The callback fired when the state of expanded/collapsed accordion items changes. - -- `lazyMount` - - Should the item be mounted only when expanded? - -- `keepMounted` - - Should the item stays in the DOM when it is not expanded? - -### Item - -- `value` - - The value of the accordion item. - -- `disabled` - - Whether the accordion item is disabled. diff --git a/docs/alert.md b/docs/alert.md index e8ba1ba9..ffc6ffce 100644 --- a/docs/alert.md +++ b/docs/alert.md @@ -5,7 +5,7 @@ A component for displaying important messages or notifications. ## Usage ```svelte - diff --git a/docs/aschild.md b/docs/aschild.md index 08696a69..d6137658 100644 --- a/docs/aschild.md +++ b/docs/aschild.md @@ -5,7 +5,7 @@ The `asChild` prop lets you render a custom component to ensure consistent styli ## Usage ```svelte - @@ -24,7 +24,7 @@ In this example, the `asChild` prop allows the `Button` to be used as the trigge In some components, you also need to delegate the `action` apart from `attrs` for the component to work properly. See below: ```svelte - @@ -14,15 +14,3 @@ A visual component for displaying a user’s profile image or initials. JD ``` - -## Props - -### Root - -- `ids` - - The ids of the elements - -- `onStatusChange` - - Function called when the image loading status changes. diff --git a/docs/breadcrumbs.md b/docs/breadcrumbs.md index ccd4e4ce..3bdd0f82 100644 --- a/docs/breadcrumbs.md +++ b/docs/breadcrumbs.md @@ -5,7 +5,7 @@ A component for displaying the navigation path or hierarchy of a user's location ## Usage ```svelte - diff --git a/docs/carousel.md b/docs/carousel.md index 3a9f28a0..546dec83 100644 --- a/docs/carousel.md +++ b/docs/carousel.md @@ -5,7 +5,7 @@ A rotating component for cycling through images or content slides. ## Usage ```svelte - @@ -51,47 +51,3 @@ An interactive component for selecting one or multiple options in a list. This is an error text ``` - -## Props - -### Root - -- `ids` - - The ids of the elements - -- `form` - - The id of the form that the checkbox belongs to. - -- `name` - - The name of the input field in a checkbox. - -- `value` - - The value of checkbox input. Useful for form submission. - -- `checked` - - The checked state of the checkbox - -- `invalid` - - Whether the checkbox is invalid - -- `disabled` - - Whether the checkbox is disabled - -- `readOnly` - - Whether the checkbox is read-only - -- `required` - - Whether the checkbox is required - -- `onCheckedChange` - - The callback invoked when the checked state changes. diff --git a/docs/clipboard.md b/docs/clipboard.md index f6fbb33a..8bad1995 100644 --- a/docs/clipboard.md +++ b/docs/clipboard.md @@ -5,7 +5,7 @@ A component for copying text or content to the user's clipboard. ## Usage ```svelte - @@ -27,15 +27,3 @@ A component for copying text or content to the user's clipboard. ``` - -## Props - -### Root - -- `ids` - -- `value` - -- `timeout` - -- `onStatusChange` diff --git a/docs/collapsible.md b/docs/collapsible.md index 11858e92..dd3459ed 100644 --- a/docs/collapsible.md +++ b/docs/collapsible.md @@ -5,7 +5,7 @@ A component that expands or collapses to show or hide content. ## Usage ```svelte - diff --git a/docs/color-picker.md b/docs/color-picker.md index 50fa7872..4f54c64d 100644 --- a/docs/color-picker.md +++ b/docs/color-picker.md @@ -5,12 +5,19 @@ A component for selecting and customizing colors. ## Usage ```svelte - - + {#snippet children(context)} Label diff --git a/docs/combobox.md b/docs/combobox.md index 77fe1e3c..02b9be89 100644 --- a/docs/combobox.md +++ b/docs/combobox.md @@ -5,45 +5,35 @@ A component that combines a text input with a dropdown list for selecting or ent ## Usage ```svelte - Label @@ -76,7 +57,7 @@ A component that combines a text input with a dropdown list for selecting or ent - {#each matches as item (item.value)} + {#each collection.items as item} {item.label} @@ -92,29 +73,24 @@ A component that combines a text input with a dropdown list for selecting or ent ### Using the `Field` component ```svelte - @@ -135,15 +117,6 @@ A component that combines a text input with a dropdown list for selecting or ent onInputValueChange={function (detail) { inputValue = detail.inputValue; }} - isItemDisabled={function (item) { - return item.disabled ?? false; - }} - itemToString={function (item) { - return item.label; - }} - itemToValue={function (item) { - return item.value; - }} > Label diff --git a/docs/date-picker.md b/docs/date-picker.md index 685627f1..3d50f046 100644 --- a/docs/date-picker.md +++ b/docs/date-picker.md @@ -7,18 +7,17 @@ A component for selecting a date from a calendar interface. ### Single ```svelte - {#snippet children(context)} @@ -142,8 +141,8 @@ A component for selecting a date from a calendar interface. ### Range ```svelte - + diff --git a/docs/drawer.md b/docs/drawer.md index ae2ddb8a..7f3ceeb2 100644 --- a/docs/drawer.md +++ b/docs/drawer.md @@ -5,7 +5,7 @@ A component that slides in from the edge of the screen to display additional con ## Usage ```svelte - diff --git a/docs/editable.md b/docs/editable.md index d0ccfcf7..6c584653 100644 --- a/docs/editable.md +++ b/docs/editable.md @@ -5,7 +5,7 @@ A component that allows users to modify its content. ## Usage ```svelte - diff --git a/docs/field.md b/docs/field.md index feeab3fe..9c320532 100644 --- a/docs/field.md +++ b/docs/field.md @@ -40,7 +40,7 @@ A component for organizing related form elements into a cohesive unit. Label - + This is a helper text This is an error text diff --git a/docs/file-upload.md b/docs/file-upload.md index 64b4ccaa..bf8f467a 100644 --- a/docs/file-upload.md +++ b/docs/file-upload.md @@ -5,7 +5,7 @@ A component for selecting and uploading files from the user's device. ## Usage ```svelte - @@ -40,7 +40,7 @@ A component for selecting and uploading files from the user's device. ### Using the `Field` component ```svelte - diff --git a/docs/highlight.md b/docs/highlight.md index dfc982e3..af7a60ff 100644 --- a/docs/highlight.md +++ b/docs/highlight.md @@ -5,7 +5,7 @@ A component for emphasizing text or content to draw attention. ## Usage ```svelte - diff --git a/docs/menu.md b/docs/menu.md index bfdd16b1..1887772b 100644 --- a/docs/menu.md +++ b/docs/menu.md @@ -7,7 +7,7 @@ A component for navigating through a list of options or actions. ### Basic Menu ```svelte - @@ -100,7 +97,7 @@ A component for navigating through a list of options or actions. ### Nested Menu ```svelte - @@ -141,7 +138,7 @@ A component for navigating through a list of options or actions. ### Context Menu ```svelte - diff --git a/docs/pagination.md b/docs/pagination.md index 070fb5ee..feffd50c 100644 --- a/docs/pagination.md +++ b/docs/pagination.md @@ -5,7 +5,7 @@ A component for navigating through multiple pages of content. ## Usage ```svelte - + diff --git a/docs/popover.md b/docs/popover.md index caf2bb11..7d41ea11 100644 --- a/docs/popover.md +++ b/docs/popover.md @@ -5,7 +5,7 @@ A component that displays additional content or information in a small overlay w ## Usage ```svelte - diff --git a/docs/portal.md b/docs/portal.md index d2c3713d..d7652264 100644 --- a/docs/portal.md +++ b/docs/portal.md @@ -5,7 +5,7 @@ A component for rendering content in a different part of the DOM hierarchy, ofte ## Usage ```svelte - diff --git a/docs/presence.md b/docs/presence.md index 4f335597..27f099f0 100644 --- a/docs/presence.md +++ b/docs/presence.md @@ -5,7 +5,7 @@ A component that controls content rendering and unmounting based on state. ## Usage ```svelte - @@ -24,7 +24,7 @@ A component for displaying the completion status of a task or process. ### Circular Progress ```svelte - diff --git a/docs/qr-code.md b/docs/qr-code.md index 93c74d04..e2e07daa 100644 --- a/docs/qr-code.md +++ b/docs/qr-code.md @@ -5,7 +5,7 @@ A component for generating and displaying QR codes for quick scanning and access ## Usage ```svelte - diff --git a/docs/radio-group.md b/docs/radio-group.md index bfc4b7ab..d910953e 100644 --- a/docs/radio-group.md +++ b/docs/radio-group.md @@ -5,7 +5,7 @@ A component for selecting one option from a set of mutually exclusive choices. ## Usage ```svelte - diff --git a/docs/segment-group.md b/docs/segment-group.md index 387ce82e..325665e4 100644 --- a/docs/segment-group.md +++ b/docs/segment-group.md @@ -5,7 +5,7 @@ A component for grouping and toggling between different sections or options, oft ## Usage ```svelte - Label @@ -46,7 +38,7 @@ A component for choosing an option from a dropdown list. - {#each items as item} + {#each collection.items as item} @@ -62,30 +54,29 @@ A component for choosing an option from a dropdown list. ### Using the `Field` component ```svelte - diff --git a/docs/signature-pad.md b/docs/signature-pad.md index 33edc635..974b897a 100644 --- a/docs/signature-pad.md +++ b/docs/signature-pad.md @@ -5,7 +5,7 @@ A component for capturing and displaying handwritten signatures. ## Usage ```svelte - diff --git a/docs/slider.md b/docs/slider.md index a2502e91..ae17448d 100644 --- a/docs/slider.md +++ b/docs/slider.md @@ -5,7 +5,7 @@ A component for adjusting values or selecting ranges through a draggable handle. ## Usage ```svelte - diff --git a/docs/steps.md b/docs/steps.md index 3470f3d5..6942135d 100644 --- a/docs/steps.md +++ b/docs/steps.md @@ -5,7 +5,7 @@ A component for displaying a sequence of steps or stages in a process, often use ## Usage ```svelte - diff --git a/docs/switch.md b/docs/switch.md index 9d3c50c4..5a3936b6 100644 --- a/docs/switch.md +++ b/docs/switch.md @@ -5,7 +5,7 @@ A component for toggling between two states, such as on/off or enabled/disabled. ## Usage ```svelte - diff --git a/docs/tabs.md b/docs/tabs.md index d80aee95..13907986 100644 --- a/docs/tabs.md +++ b/docs/tabs.md @@ -5,7 +5,7 @@ A component for organizing and switching between multiple sections of content wi ## Usage ```svelte - + diff --git a/docs/time-picker.md b/docs/time-picker.md index 7bc35576..86869919 100644 --- a/docs/time-picker.md +++ b/docs/time-picker.md @@ -5,12 +5,27 @@ A component for selecting a time from a dropdown or input interface. ## Usage ```svelte - - + {#snippet children(context)} Label diff --git a/docs/timer.md b/docs/timer.md index 9d6d5b54..b4d67d8d 100644 --- a/docs/timer.md +++ b/docs/timer.md @@ -5,7 +5,7 @@ A component for counting down or tracking elapsed time. ## Usage ```svelte - diff --git a/docs/toast.md b/docs/toast.md index d1e0048a..6ec04dc5 100644 --- a/docs/toast.md +++ b/docs/toast.md @@ -20,7 +20,7 @@ export const toaster = createToaster({ ```svelte - {/if} diff --git a/packages/core/src/lib/alert-dialog/alert-dialog-close-trigger.svelte b/packages/core/src/lib/alert-dialog/alert-dialog-close-trigger.svelte index fd8f0846..bb0647e0 100644 --- a/packages/core/src/lib/alert-dialog/alert-dialog-close-trigger.svelte +++ b/packages/core/src/lib/alert-dialog/alert-dialog-close-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/alert-dialog/alert-dialog-trigger.svelte b/packages/core/src/lib/alert-dialog/alert-dialog-trigger.svelte index f6c357b3..6ca349e3 100644 --- a/packages/core/src/lib/alert-dialog/alert-dialog-trigger.svelte +++ b/packages/core/src/lib/alert-dialog/alert-dialog-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/carousel/carousel-indicator.svelte b/packages/core/src/lib/carousel/carousel-indicator.svelte index 04f9e6b6..70208523 100644 --- a/packages/core/src/lib/carousel/carousel-indicator.svelte +++ b/packages/core/src/lib/carousel/carousel-indicator.svelte @@ -35,7 +35,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/carousel/carousel-next-trigger.svelte b/packages/core/src/lib/carousel/carousel-next-trigger.svelte index 049693ed..4ed03cc0 100644 --- a/packages/core/src/lib/carousel/carousel-next-trigger.svelte +++ b/packages/core/src/lib/carousel/carousel-next-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/carousel/carousel-prev-trigger.svelte b/packages/core/src/lib/carousel/carousel-prev-trigger.svelte index 561eca1a..3e413495 100644 --- a/packages/core/src/lib/carousel/carousel-prev-trigger.svelte +++ b/packages/core/src/lib/carousel/carousel-prev-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/clipboard/clipboard-trigger.svelte b/packages/core/src/lib/clipboard/clipboard-trigger.svelte index a84f809b..85f7a466 100644 --- a/packages/core/src/lib/clipboard/clipboard-trigger.svelte +++ b/packages/core/src/lib/clipboard/clipboard-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/collapsible/collapsible-trigger.svelte b/packages/core/src/lib/collapsible/collapsible-trigger.svelte index 666e0437..d224bfce 100644 --- a/packages/core/src/lib/collapsible/collapsible-trigger.svelte +++ b/packages/core/src/lib/collapsible/collapsible-trigger.svelte @@ -23,7 +23,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/color-picker/color-picker-swatch-trigger.svelte b/packages/core/src/lib/color-picker/color-picker-swatch-trigger.svelte index 67bb976f..2278f44a 100644 --- a/packages/core/src/lib/color-picker/color-picker-swatch-trigger.svelte +++ b/packages/core/src/lib/color-picker/color-picker-swatch-trigger.svelte @@ -38,7 +38,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/color-picker/create-color-picker.svelte.ts b/packages/core/src/lib/color-picker/create-color-picker.svelte.ts index 16fd5cbc..68542280 100644 --- a/packages/core/src/lib/color-picker/create-color-picker.svelte.ts +++ b/packages/core/src/lib/color-picker/create-color-picker.svelte.ts @@ -6,12 +6,11 @@ import * as colorPicker from '@zag-js/color-picker'; import {normalizeProps, reflect, useMachine} from '@zag-js/svelte'; import {parts} from './color-picker-anatomy.js'; -type Omitted = 'id' | 'dir' | 'value' | 'getRootNode' | 'open.controlled'; +type Omitted = 'id' | 'dir' | 'getRootNode' | 'open.controlled'; export interface CreateColorPickerProps extends Omit { id?: string; - value?: string; openControlled?: boolean; } @@ -32,7 +31,6 @@ export function createColorPicker( id, dir: locale?.dir, ...props, - value: props.value ? colorPicker.parse(props.value) : undefined, getRootNode: environment?.getRootNode, 'open.controlled': props.openControlled, })); diff --git a/packages/core/src/lib/color-picker/index.ts b/packages/core/src/lib/color-picker/index.ts index 472d94e3..03321515 100644 --- a/packages/core/src/lib/color-picker/index.ts +++ b/packages/core/src/lib/color-picker/index.ts @@ -28,5 +28,6 @@ export type {ColorPickerValueSwatchProps} from './color-picker-value-swatch.svel export type {ColorPickerValueTextProps} from './color-picker-value-text.svelte'; export type {ColorPickerViewTextProps} from './color-picker-view.svelte'; +export type {Color} from '@zag-js/color-picker'; export {anatomy as colorPickerAnatomy} from './color-picker-anatomy.js'; export {getColorPickerContext} from './color-picker-context.svelte.js'; diff --git a/packages/core/src/lib/combobox/combobox-clear-trigger.svelte b/packages/core/src/lib/combobox/combobox-clear-trigger.svelte index 3bc28080..0abbf2fe 100644 --- a/packages/core/src/lib/combobox/combobox-clear-trigger.svelte +++ b/packages/core/src/lib/combobox/combobox-clear-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/combobox/combobox-root.svelte b/packages/core/src/lib/combobox/combobox-root.svelte index 037d11e8..bf0b5673 100644 --- a/packages/core/src/lib/combobox/combobox-root.svelte +++ b/packages/core/src/lib/combobox/combobox-root.svelte @@ -6,15 +6,15 @@ CreateComboboxReturn, } from './create-combobox.svelte.js'; - export interface ComboboxProps + export interface ComboboxProps extends Assign< HtmlIngredientProps<'div', HTMLDivElement, CreateComboboxReturn>, - CreateComboboxProps + CreateComboboxProps >, PresenceStrategyProps {} - {#if asChild} - {@render asChild(mergedProps)} + {@render asChild(wrappedAction, mergedProps)} {:else} - + {/if} diff --git a/packages/core/src/lib/file-upload/file-upload-clear-trigger.svelte b/packages/core/src/lib/file-upload/file-upload-clear-trigger.svelte index 0c1e1c28..f16a6cb7 100644 --- a/packages/core/src/lib/file-upload/file-upload-clear-trigger.svelte +++ b/packages/core/src/lib/file-upload/file-upload-clear-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/file-upload/file-upload-item-delete-trigger.svelte b/packages/core/src/lib/file-upload/file-upload-item-delete-trigger.svelte index de2e32e9..cbe274ed 100644 --- a/packages/core/src/lib/file-upload/file-upload-item-delete-trigger.svelte +++ b/packages/core/src/lib/file-upload/file-upload-item-delete-trigger.svelte @@ -30,7 +30,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/file-upload/file-upload-trigger.svelte b/packages/core/src/lib/file-upload/file-upload-trigger.svelte index 8655d5cb..d9f1e441 100644 --- a/packages/core/src/lib/file-upload/file-upload-trigger.svelte +++ b/packages/core/src/lib/file-upload/file-upload-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/floating-panel/floating-panel-close-trigger.svelte b/packages/core/src/lib/floating-panel/floating-panel-close-trigger.svelte index c7f5bee1..745a586f 100644 --- a/packages/core/src/lib/floating-panel/floating-panel-close-trigger.svelte +++ b/packages/core/src/lib/floating-panel/floating-panel-close-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/floating-panel/floating-panel-drag-trigger.svelte b/packages/core/src/lib/floating-panel/floating-panel-drag-trigger.svelte index a04c8ded..3ec3a2eb 100644 --- a/packages/core/src/lib/floating-panel/floating-panel-drag-trigger.svelte +++ b/packages/core/src/lib/floating-panel/floating-panel-drag-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/floating-panel/floating-panel-maximize-trigger.svelte b/packages/core/src/lib/floating-panel/floating-panel-maximize-trigger.svelte index 7394d277..0872b741 100644 --- a/packages/core/src/lib/floating-panel/floating-panel-maximize-trigger.svelte +++ b/packages/core/src/lib/floating-panel/floating-panel-maximize-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/floating-panel/floating-panel-minimize-trigger.svelte b/packages/core/src/lib/floating-panel/floating-panel-minimize-trigger.svelte index 7ef17cd5..457085ee 100644 --- a/packages/core/src/lib/floating-panel/floating-panel-minimize-trigger.svelte +++ b/packages/core/src/lib/floating-panel/floating-panel-minimize-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/floating-panel/floating-panel-resize-trigger.svelte b/packages/core/src/lib/floating-panel/floating-panel-resize-trigger.svelte index 9774b147..fd496ae3 100644 --- a/packages/core/src/lib/floating-panel/floating-panel-resize-trigger.svelte +++ b/packages/core/src/lib/floating-panel/floating-panel-resize-trigger.svelte @@ -38,7 +38,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/floating-panel/floating-panel-restore-trigger.svelte b/packages/core/src/lib/floating-panel/floating-panel-restore-trigger.svelte index d64ea979..03ed6a04 100644 --- a/packages/core/src/lib/floating-panel/floating-panel-restore-trigger.svelte +++ b/packages/core/src/lib/floating-panel/floating-panel-restore-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/floating-panel/floating-panel-trigger.svelte b/packages/core/src/lib/floating-panel/floating-panel-trigger.svelte index cab06777..15eb0818 100644 --- a/packages/core/src/lib/floating-panel/floating-panel-trigger.svelte +++ b/packages/core/src/lib/floating-panel/floating-panel-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/menu/menu-context-trigger.svelte b/packages/core/src/lib/menu/menu-context-trigger.svelte index 3ccf718a..33595a45 100644 --- a/packages/core/src/lib/menu/menu-context-trigger.svelte +++ b/packages/core/src/lib/menu/menu-context-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/menu/menu-trigger-item.svelte b/packages/core/src/lib/menu/menu-trigger-item.svelte index a038e413..85b3e370 100644 --- a/packages/core/src/lib/menu/menu-trigger-item.svelte +++ b/packages/core/src/lib/menu/menu-trigger-item.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/menu/menu-trigger.svelte b/packages/core/src/lib/menu/menu-trigger.svelte index 5cfcf36c..7616fc36 100644 --- a/packages/core/src/lib/menu/menu-trigger.svelte +++ b/packages/core/src/lib/menu/menu-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/number-input/number-input-decrement-trigger.svelte b/packages/core/src/lib/number-input/number-input-decrement-trigger.svelte index 2aea4062..ab563447 100644 --- a/packages/core/src/lib/number-input/number-input-decrement-trigger.svelte +++ b/packages/core/src/lib/number-input/number-input-decrement-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/number-input/number-input-increment-trigger.svelte b/packages/core/src/lib/number-input/number-input-increment-trigger.svelte index 0c4f0dd6..67237122 100644 --- a/packages/core/src/lib/number-input/number-input-increment-trigger.svelte +++ b/packages/core/src/lib/number-input/number-input-increment-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/pagination/pagination-item.svelte b/packages/core/src/lib/pagination/pagination-item.svelte index 0e2d362e..2f03880b 100644 --- a/packages/core/src/lib/pagination/pagination-item.svelte +++ b/packages/core/src/lib/pagination/pagination-item.svelte @@ -37,7 +37,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/pagination/pagination-prev-trigger.svelte b/packages/core/src/lib/pagination/pagination-prev-trigger.svelte index 59da7ed5..7c169615 100644 --- a/packages/core/src/lib/pagination/pagination-prev-trigger.svelte +++ b/packages/core/src/lib/pagination/pagination-prev-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/pin-input/create-pin-input.svelte.ts b/packages/core/src/lib/pin-input/create-pin-input.svelte.ts index f7fbe6b0..aefc78ea 100644 --- a/packages/core/src/lib/pin-input/create-pin-input.svelte.ts +++ b/packages/core/src/lib/pin-input/create-pin-input.svelte.ts @@ -50,6 +50,7 @@ export function createPinInputContext( ...o, getClearTriggerProps(): HtmlProps<'button'> { return { + type: 'button', onclick() { o.clearValue(); }, diff --git a/packages/core/src/lib/pin-input/pin-input-clear-trigger.svelte b/packages/core/src/lib/pin-input/pin-input-clear-trigger.svelte index 2db91e28..0cc622d9 100644 --- a/packages/core/src/lib/pin-input/pin-input-clear-trigger.svelte +++ b/packages/core/src/lib/pin-input/pin-input-clear-trigger.svelte @@ -26,7 +26,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/popover/popover-close-trigger.svelte b/packages/core/src/lib/popover/popover-close-trigger.svelte index 826b7245..ea8a49b6 100644 --- a/packages/core/src/lib/popover/popover-close-trigger.svelte +++ b/packages/core/src/lib/popover/popover-close-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/popover/popover-trigger.svelte b/packages/core/src/lib/popover/popover-trigger.svelte index a3ca7151..0c6e6f49 100644 --- a/packages/core/src/lib/popover/popover-trigger.svelte +++ b/packages/core/src/lib/popover/popover-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/select/create-select.svelte.ts b/packages/core/src/lib/select/create-select.svelte.ts index 06f3f536..16c0150a 100644 --- a/packages/core/src/lib/select/create-select.svelte.ts +++ b/packages/core/src/lib/select/create-select.svelte.ts @@ -4,33 +4,17 @@ import {getFieldContext} from '$lib/field/field-context.svelte.js'; import {getLocaleContext} from '$lib/locale-provider/local-provider-context.svelte.js'; import * as select from '@zag-js/select'; import {normalizeProps, reflect, useMachine} from '@zag-js/svelte'; -import {createSplitProps} from '@zag-js/utils'; -type Omitted = 'id' | 'dir' | 'getRootNode' | 'collection' | 'open.controlled'; +type Omitted = 'id' | 'dir' | 'getRootNode' | 'open.controlled'; -export interface CreateSelectProps - extends select.CollectionOptions, - Omit { +export interface CreateSelectProps extends Omit { id?: string; openControlled?: boolean; } export interface CreateSelectReturn extends select.Api {} -export function createSelect( - props: CreateSelectProps, -): CreateSelectReturn { - const [collectionProps, selectProps] = $derived( - createSplitProps>([ - 'items', - 'itemToValue', - 'itemToString', - 'isItemDisabled', - ])(props), - ); - - const collection = $derived(select.collection(collectionProps)); - +export function createSelect(props: CreateSelectProps): CreateSelectReturn { const field = getFieldContext(); const locale = getLocaleContext(); const environment = getEnvironmentContext(); @@ -48,10 +32,9 @@ export function createSelect( disabled: field?.disabled, readOnly: field?.readOnly, required: field?.required, - ...selectProps, + ...props, getRootNode: environment?.getRootNode, 'open.controlled': props.openControlled, - collection, })); const [state, send] = useMachine(select.machine(context), {context}); diff --git a/packages/core/src/lib/select/select-clear-trigger.svelte b/packages/core/src/lib/select/select-clear-trigger.svelte index 3869dec4..83421275 100644 --- a/packages/core/src/lib/select/select-clear-trigger.svelte +++ b/packages/core/src/lib/select/select-clear-trigger.svelte @@ -24,7 +24,7 @@ {#if asChild} {@render asChild(mergedProps)} {:else} - {/if} diff --git a/packages/core/src/lib/select/select-root.svelte b/packages/core/src/lib/select/select-root.svelte index d0ca75ee..e91bf479 100644 --- a/packages/core/src/lib/select/select-root.svelte +++ b/packages/core/src/lib/select/select-root.svelte @@ -6,15 +6,15 @@ CreateSelectReturn, } from './create-select.svelte.js'; - export interface SelectProps + export interface SelectProps extends Assign< HtmlIngredientProps<'div', HTMLDivElement, CreateSelectReturn>, - CreateSelectProps + CreateSelectProps >, PresenceStrategyProps {} - diff --git a/packages/core/src/lib/tree-view/tree-view-branch-indent-guide.svelte b/packages/core/src/lib/tree-view/tree-view-branch-indent-guide.svelte new file mode 100644 index 00000000..e6f9e751 --- /dev/null +++ b/packages/core/src/lib/tree-view/tree-view-branch-indent-guide.svelte @@ -0,0 +1,35 @@ + + + + +{#if asChild} + {@render asChild(mergedProps)} +{:else} +
+ {@render children?.()} +
+{/if} diff --git a/packages/core/src/lib/tree-view/tree-view-branch-indicator.svelte b/packages/core/src/lib/tree-view/tree-view-branch-indicator.svelte index 059948da..27ce1b4a 100644 --- a/packages/core/src/lib/tree-view/tree-view-branch-indicator.svelte +++ b/packages/core/src/lib/tree-view/tree-view-branch-indicator.svelte @@ -2,14 +2,14 @@ import type {HtmlIngredientProps} from '$lib/types.js'; export interface TreeViewBranchIndicatorProps - extends HtmlIngredientProps<'span', HTMLSpanElement> {} + extends HtmlIngredientProps<'div', HTMLDivElement> {} {#if asChild} {@render asChild(mergedProps)} {:else} - +
{@render children?.()} - +
{/if} diff --git a/packages/core/src/lib/tree-view/tree-view-branch-text.svelte b/packages/core/src/lib/tree-view/tree-view-branch-text.svelte index 9b87c8ee..71a7e1bb 100644 --- a/packages/core/src/lib/tree-view/tree-view-branch-text.svelte +++ b/packages/core/src/lib/tree-view/tree-view-branch-text.svelte @@ -8,8 +8,8 @@ diff --git a/packages/core/src/lib/tree-view/tree-view-branch-trigger.svelte b/packages/core/src/lib/tree-view/tree-view-branch-trigger.svelte index 95159695..4318643c 100644 --- a/packages/core/src/lib/tree-view/tree-view-branch-trigger.svelte +++ b/packages/core/src/lib/tree-view/tree-view-branch-trigger.svelte @@ -8,8 +8,8 @@ diff --git a/packages/core/src/lib/tree-view/tree-view-branch.svelte b/packages/core/src/lib/tree-view/tree-view-branch.svelte index a4b31c91..7f3914e4 100644 --- a/packages/core/src/lib/tree-view/tree-view-branch.svelte +++ b/packages/core/src/lib/tree-view/tree-view-branch.svelte @@ -1,22 +1,20 @@ {#if asChild} - {@render asChild(mergedProps, branchState)} + {@render asChild(mergedProps, nodeState)} {:else}
- {@render children?.(branchState)} + {@render children?.(nodeState)}
{/if} diff --git a/packages/core/src/lib/tree-view/tree-view-context.svelte.ts b/packages/core/src/lib/tree-view/tree-view-context.svelte.ts index 24bd4c60..22ef48c3 100644 --- a/packages/core/src/lib/tree-view/tree-view-context.svelte.ts +++ b/packages/core/src/lib/tree-view/tree-view-context.svelte.ts @@ -1,15 +1,9 @@ import {createContext} from '$lib/create-context.svelte.js'; -import type {BranchProps, ItemProps} from '@zag-js/tree-view'; +import type {NodeProps} from '@zag-js/tree-view'; import type {CreateTreeViewReturn} from './create-tree-view.svelte.js'; export const [getTreeViewContext, setTreeViewContext] = createContext('TreeView'); -export const [getTreeViewItemPropsContext, setTreeViewItemPropsContext] = - createContext('TreeViewItem [PROPS]'); - -export const [getTreeViewBranchPropsContext, setTreeViewBranchPropsContext] = - createContext('TreeViewBranch [PROPS]'); - -export const [getTreeViewTreePropsContext, setTreeViewTreePropsContext] = - createContext<{depth: number}>('TreeViewTree [PROPS]'); +export const [getTreeViewNodePropsContext, setTreeViewNodePropsContext] = + createContext('TreeViewNodeProps'); diff --git a/packages/core/src/lib/tree-view/tree-view-item-indicator.svelte b/packages/core/src/lib/tree-view/tree-view-item-indicator.svelte index 493959f8..b20011bc 100644 --- a/packages/core/src/lib/tree-view/tree-view-item-indicator.svelte +++ b/packages/core/src/lib/tree-view/tree-view-item-indicator.svelte @@ -9,7 +9,7 @@ import {mergeProps} from '$lib/merge-props.js'; import { getTreeViewContext, - getTreeViewItemPropsContext, + getTreeViewNodePropsContext, } from './tree-view-context.svelte.js'; let { @@ -20,11 +20,9 @@ }: TreeViewItemIndicatorProps = $props(); let treeView = getTreeViewContext(); - - let itemProps = getTreeViewItemPropsContext(); - + let nodeProps = getTreeViewNodePropsContext(); let mergedProps = $derived( - mergeProps(treeView.getItemIndicatorProps(itemProps), props), + mergeProps(treeView.getItemIndicatorProps(nodeProps), props), ); diff --git a/packages/core/src/lib/tree-view/tree-view-item-text.svelte b/packages/core/src/lib/tree-view/tree-view-item-text.svelte index c44f15b0..4fd793a3 100644 --- a/packages/core/src/lib/tree-view/tree-view-item-text.svelte +++ b/packages/core/src/lib/tree-view/tree-view-item-text.svelte @@ -9,7 +9,7 @@ import {mergeProps} from '$lib/merge-props.js'; import { getTreeViewContext, - getTreeViewItemPropsContext, + getTreeViewNodePropsContext, } from './tree-view-context.svelte.js'; let { @@ -20,11 +20,9 @@ }: TreeViewItemTextProps = $props(); let treeView = getTreeViewContext(); - - let itemProps = getTreeViewItemPropsContext(); - + let nodeProps = getTreeViewNodePropsContext(); let mergedProps = $derived( - mergeProps(treeView.getItemTextProps(itemProps), props), + mergeProps(treeView.getItemTextProps(nodeProps), props), ); diff --git a/packages/core/src/lib/tree-view/tree-view-item.svelte b/packages/core/src/lib/tree-view/tree-view-item.svelte index bbba5302..06374f90 100644 --- a/packages/core/src/lib/tree-view/tree-view-item.svelte +++ b/packages/core/src/lib/tree-view/tree-view-item.svelte @@ -1,22 +1,17 @@ {#if asChild} - {@render asChild(mergedProps, itemState)} + {@render asChild(mergedProps)} {:else}
- {@render children?.(itemState)} + {@render children?.()}
{/if} diff --git a/packages/core/src/lib/tree-view/tree-view-label.svelte b/packages/core/src/lib/tree-view/tree-view-label.svelte index c8824661..761000d9 100644 --- a/packages/core/src/lib/tree-view/tree-view-label.svelte +++ b/packages/core/src/lib/tree-view/tree-view-label.svelte @@ -17,7 +17,6 @@ }: TreeViewLabelProps = $props(); let treeView = getTreeViewContext(); - let mergedProps = $derived(mergeProps(treeView.getLabelProps(), props)); diff --git a/packages/core/src/lib/tree-view/tree-view-root.svelte b/packages/core/src/lib/tree-view/tree-view-root.svelte index 766c3aa7..5b9c5bac 100644 --- a/packages/core/src/lib/tree-view/tree-view-root.svelte +++ b/packages/core/src/lib/tree-view/tree-view-root.svelte @@ -40,6 +40,7 @@ 'id', 'ids', 'typeahead', + 'collection', 'focusedValue', 'expandedValue', 'expandOnClick', diff --git a/packages/core/src/lib/tree-view/tree-view-tree.svelte b/packages/core/src/lib/tree-view/tree-view-tree.svelte index 0e05cc84..2993cd93 100644 --- a/packages/core/src/lib/tree-view/tree-view-tree.svelte +++ b/packages/core/src/lib/tree-view/tree-view-tree.svelte @@ -2,31 +2,22 @@ import type {HtmlIngredientProps} from '$lib/types.js'; export interface TreeViewTreeProps - extends HtmlIngredientProps<'div', HTMLDivElement> { - depth?: number; - } + extends HtmlIngredientProps<'div', HTMLDivElement> {} {#if asChild} diff --git a/packages/core/src/lib/tree-view/tree-view.ts b/packages/core/src/lib/tree-view/tree-view.ts index ac0fb487..26bc9d8f 100644 --- a/packages/core/src/lib/tree-view/tree-view.ts +++ b/packages/core/src/lib/tree-view/tree-view.ts @@ -1,5 +1,7 @@ +export {collection} from '@zag-js/tree-view'; export {default as BranchContent} from './tree-view-branch-content.svelte'; export {default as BranchControl} from './tree-view-branch-control.svelte'; +export {default as BranchIndentGuide} from './tree-view-branch-indent-guide.svelte'; export {default as BranchIndicator} from './tree-view-branch-indicator.svelte'; export {default as BranchText} from './tree-view-branch-text.svelte'; export {default as BranchTrigger} from './tree-view-branch-trigger.svelte'; diff --git a/packages/core/src/lib/tree-view/types.ts b/packages/core/src/lib/tree-view/types.ts new file mode 100644 index 00000000..a1a971c8 --- /dev/null +++ b/packages/core/src/lib/tree-view/types.ts @@ -0,0 +1,4 @@ +export interface NodeProps { + node: T; + indexPath: number[]; +} diff --git a/packages/core/src/routes/color-picker/+page.svelte b/packages/core/src/routes/color-picker/+page.svelte index 12a563ab..72f30a26 100644 --- a/packages/core/src/routes/color-picker/+page.svelte +++ b/packages/core/src/routes/color-picker/+page.svelte @@ -15,9 +15,16 @@ 'hsl(280, 81%, 59%)', 'hsl(350, 81%, 59%)', ]; + + let value = $state(ColorPicker.parse('#9863BF')); - + { + value = detail.value; + }} +> {#snippet children(context)} {#snippet asChild(attrs)} diff --git a/packages/core/src/routes/combobox/+page.svelte b/packages/core/src/routes/combobox/+page.svelte index 3af375ba..25eefc01 100644 --- a/packages/core/src/routes/combobox/+page.svelte +++ b/packages/core/src/routes/combobox/+page.svelte @@ -7,13 +7,7 @@ } from '@untitled-theme/icons-svelte'; import {IconButton, Input, Label} from '../shared/index.js'; - interface Option { - label: string; - value: string; - disabled?: boolean; - } - - let items: Option[] = [ + let items = [ {label: 'Option 1', value: '1'}, {label: 'Option 2', value: '2'}, {label: 'Option 3', value: '3'}, @@ -30,15 +24,15 @@ ), ); - $effect(() => { - setTimeout(() => { - value = ['1']; - }, 1000); - }); + let collection = $derived( + Combobox.collection({ + items: matches, + }), + ); { value = detail.value; @@ -88,7 +82,7 @@ - {#each matches as item (item.value)} + {#each collection.items as item} - import {DatePicker, Portal} from '$lib/index.js'; + import {DatePicker, Portal, type DateValue} from '$lib/index.js'; import { CalendarIcon, ChevronLeftIcon, @@ -7,11 +7,7 @@ } from '@untitled-theme/icons-svelte'; import {IconButton, Input, Label} from '../shared/index.js'; - let value: string[] = $state([]); - - setTimeout(() => { - value = ['2022-01-01']; - }, 1000); + let value: DateValue[] = $state([]); { - value = detail.valueAsString; + value = detail.value; }} positioning={{ sameWidth: true, diff --git a/packages/core/src/routes/date-picker/range/+page.svelte b/packages/core/src/routes/date-picker/range/+page.svelte index 8bdf6dfb..8583a545 100644 --- a/packages/core/src/routes/date-picker/range/+page.svelte +++ b/packages/core/src/routes/date-picker/range/+page.svelte @@ -1,5 +1,5 @@ { - value = detail.valueAsString; + value = detail.value; }} selectionMode="range" > @@ -125,6 +125,8 @@ 'data-range-end:bg-accent', 'data-in-range:bg-accent/75', 'data-in-range:text-white', + 'data-disabled:opacity-50', + 'data-disabled:cursor-not-allowed', 'data-disabled:hover:bg-transparent', 'data-disabled:data-range-start:bg-transparent', 'data-disabled:data-range-start:text-inherit', diff --git a/packages/core/src/routes/field/+page.svelte b/packages/core/src/routes/field/+page.svelte index 9ad18457..9d73d7f7 100644 --- a/packages/core/src/routes/field/+page.svelte +++ b/packages/core/src/routes/field/+page.svelte @@ -1,7 +1,8 @@ { value = detail.value; @@ -65,7 +67,7 @@ - {#each items as item} + {#each collection.items as item}