ui-ingredients 0.0.43 → 0.0.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. package/README.md +3 -0
  2. package/dist/accordion/create-accordion.svelte.js +3 -4
  3. package/dist/accordion/item-content.svelte +7 -11
  4. package/dist/accordion/item.svelte +2 -2
  5. package/dist/accordion/root.svelte +4 -6
  6. package/dist/avatar/create-avatar.svelte.js +3 -4
  7. package/dist/avatar/root.svelte +2 -2
  8. package/dist/carousel/create-carousel.svelte.js +3 -4
  9. package/dist/carousel/indicator.svelte +2 -2
  10. package/dist/carousel/item.svelte +2 -2
  11. package/dist/carousel/root.svelte +2 -2
  12. package/dist/checkbox/create-checkbox.svelte.js +4 -5
  13. package/dist/checkbox/root.svelte +2 -2
  14. package/dist/clipboard/create-clipboard.svelte.js +3 -4
  15. package/dist/clipboard/root.svelte +2 -2
  16. package/dist/collapsible/create-collapsible.svelte.js +3 -4
  17. package/dist/collapsible/root.svelte +2 -2
  18. package/dist/color-picker/create-color-picker.svelte.js +3 -4
  19. package/dist/color-picker/root.svelte +2 -2
  20. package/dist/combobox/create-combobox.svelte.js +4 -5
  21. package/dist/combobox/item.svelte +2 -2
  22. package/dist/combobox/root.svelte +10 -16
  23. package/dist/create-context.svelte.js +1 -9
  24. package/dist/date-picker/create-date-picker.svelte.js +2 -3
  25. package/dist/date-picker/day-table-cell.svelte +2 -2
  26. package/dist/date-picker/month-table-cell.svelte +2 -2
  27. package/dist/date-picker/root.svelte +10 -18
  28. package/dist/date-picker/year-table-cell.svelte +2 -2
  29. package/dist/dialog/backdrop.svelte +7 -12
  30. package/dist/dialog/create-dialog.svelte.js +3 -4
  31. package/dist/dialog/root.svelte +6 -12
  32. package/dist/editable/create-editable.svelte.js +4 -5
  33. package/dist/editable/root.svelte +2 -2
  34. package/dist/environment-provider/root.svelte +5 -8
  35. package/dist/field/create-field.svelte.d.ts +1 -22
  36. package/dist/field/create-field.svelte.js +9 -20
  37. package/dist/field/root.svelte +2 -2
  38. package/dist/file-upload/create-file-upload.svelte.js +4 -5
  39. package/dist/file-upload/item.svelte +2 -2
  40. package/dist/file-upload/root.svelte +2 -2
  41. package/dist/floating-panel/body.svelte +24 -0
  42. package/dist/floating-panel/body.svelte.d.ts +18 -0
  43. package/dist/floating-panel/close-trigger.svelte +27 -0
  44. package/dist/floating-panel/close-trigger.svelte.d.ts +18 -0
  45. package/dist/floating-panel/content.svelte +36 -0
  46. package/dist/floating-panel/content.svelte.d.ts +18 -0
  47. package/dist/floating-panel/context.svelte.d.ts +2 -0
  48. package/dist/floating-panel/context.svelte.js +2 -0
  49. package/dist/floating-panel/create-floating-panel.svelte.d.ts +2 -1
  50. package/dist/floating-panel/create-floating-panel.svelte.js +4 -4
  51. package/dist/floating-panel/drag-trigger.svelte +27 -0
  52. package/dist/floating-panel/drag-trigger.svelte.d.ts +18 -0
  53. package/dist/floating-panel/floating-panel.d.ts +13 -0
  54. package/dist/floating-panel/floating-panel.js +13 -0
  55. package/dist/floating-panel/header.svelte +25 -0
  56. package/dist/floating-panel/header.svelte.d.ts +18 -0
  57. package/dist/floating-panel/index.d.ts +16 -0
  58. package/dist/floating-panel/index.js +3 -0
  59. package/dist/floating-panel/maximize-trigger.svelte +28 -0
  60. package/dist/floating-panel/maximize-trigger.svelte.d.ts +18 -0
  61. package/dist/floating-panel/minimize-trigger.svelte +28 -0
  62. package/dist/floating-panel/minimize-trigger.svelte.d.ts +18 -0
  63. package/dist/floating-panel/positioner.svelte +35 -0
  64. package/dist/floating-panel/positioner.svelte.d.ts +18 -0
  65. package/dist/floating-panel/resize-trigger.svelte +36 -0
  66. package/dist/floating-panel/resize-trigger.svelte.d.ts +18 -0
  67. package/dist/floating-panel/restore-trigger.svelte +28 -0
  68. package/dist/floating-panel/restore-trigger.svelte.d.ts +18 -0
  69. package/dist/floating-panel/root.svelte +45 -0
  70. package/dist/floating-panel/root.svelte.d.ts +18 -0
  71. package/dist/floating-panel/title.svelte +25 -0
  72. package/dist/floating-panel/title.svelte.d.ts +18 -0
  73. package/dist/floating-panel/trigger.svelte +27 -0
  74. package/dist/floating-panel/trigger.svelte.d.ts +18 -0
  75. package/dist/highlight/highlight.svelte +42 -0
  76. package/dist/highlight/highlight.svelte.d.ts +18 -0
  77. package/dist/highlight/index.d.ts +1 -0
  78. package/dist/highlight/index.js +1 -0
  79. package/dist/hover-card/create-hover-card.svelte.js +3 -4
  80. package/dist/hover-card/root.svelte +6 -11
  81. package/dist/index.d.ts +3 -0
  82. package/dist/index.js +3 -0
  83. package/dist/is-object.d.ts +2 -0
  84. package/dist/is-object.js +4 -0
  85. package/dist/locale-provider/root.svelte +8 -6
  86. package/dist/menu/create-menu.svelte.js +3 -4
  87. package/dist/menu/item.svelte +2 -2
  88. package/dist/menu/option-item.svelte +2 -2
  89. package/dist/menu/root.svelte +6 -12
  90. package/dist/merge-props.js +1 -4
  91. package/dist/number-input/create-number-input.svelte.js +4 -5
  92. package/dist/number-input/root.svelte +2 -2
  93. package/dist/pagination/create-pagination.svelte.js +3 -4
  94. package/dist/pagination/root.svelte +2 -2
  95. package/dist/pin-input/create-pin-input.svelte.js +4 -5
  96. package/dist/pin-input/root.svelte +2 -2
  97. package/dist/popover/create-popover.svelte.js +3 -4
  98. package/dist/popover/root.svelte +6 -11
  99. package/dist/presence/root.svelte +7 -3
  100. package/dist/progress/create-progress.svelte.js +3 -4
  101. package/dist/progress/root.svelte +2 -2
  102. package/dist/qr-code/create-qr-code.svelte.js +3 -4
  103. package/dist/qr-code/root.svelte +2 -2
  104. package/dist/radio-group/create-radio-group.svelte.js +3 -4
  105. package/dist/radio-group/item.svelte +2 -2
  106. package/dist/radio-group/root.svelte +2 -2
  107. package/dist/rating-group/create-rating-group.svelte.js +4 -5
  108. package/dist/rating-group/root.svelte +2 -2
  109. package/dist/segment-group/create-segment-group.svelte.js +3 -4
  110. package/dist/segment-group/item.svelte +2 -2
  111. package/dist/segment-group/root.svelte +2 -2
  112. package/dist/select/create-select.svelte.js +2 -3
  113. package/dist/select/item.svelte +2 -2
  114. package/dist/select/root.svelte +11 -19
  115. package/dist/signature-pad/create-signature-pad.svelte.js +3 -4
  116. package/dist/signature-pad/root.svelte +2 -2
  117. package/dist/slider/create-slider.svelte.js +3 -4
  118. package/dist/slider/root.svelte +2 -2
  119. package/dist/slider/thumb.svelte +2 -2
  120. package/dist/splitter/create-splitter.svelte.js +3 -4
  121. package/dist/splitter/panel.svelte +2 -2
  122. package/dist/splitter/resize-trigger.svelte +2 -2
  123. package/dist/splitter/root.svelte +2 -2
  124. package/dist/steps/create-steps.svelte.js +3 -4
  125. package/dist/steps/item.svelte +2 -2
  126. package/dist/steps/root.svelte +2 -2
  127. package/dist/switch/create-switch.svelte.js +4 -5
  128. package/dist/switch/root.svelte +2 -2
  129. package/dist/tabs/content.svelte +2 -2
  130. package/dist/tabs/create-tabs.svelte.js +3 -4
  131. package/dist/tabs/root.svelte +2 -2
  132. package/dist/tabs/trigger.svelte +2 -2
  133. package/dist/tags-input/create-tags-input.svelte.js +4 -5
  134. package/dist/tags-input/item.svelte +2 -2
  135. package/dist/tags-input/root.svelte +2 -2
  136. package/dist/time-picker/create-time-picker.svelte.js +3 -4
  137. package/dist/time-picker/root.svelte +11 -21
  138. package/dist/timer/create-timer.svelte.js +3 -4
  139. package/dist/timer/item.svelte +2 -2
  140. package/dist/timer/root.svelte +2 -2
  141. package/dist/toast/create-toast.svelte.js +1 -2
  142. package/dist/toast/create-toaster.svelte.js +2 -3
  143. package/dist/toggle-group/create-toggle-group.svelte.js +3 -4
  144. package/dist/toggle-group/item.svelte +2 -2
  145. package/dist/toggle-group/root.svelte +2 -2
  146. package/dist/tooltip/create-tooltip.svelte.js +3 -4
  147. package/dist/tooltip/root.svelte +6 -12
  148. package/dist/tour/arrow-tip.svelte +24 -0
  149. package/dist/tour/arrow-tip.svelte.d.ts +18 -0
  150. package/dist/tour/arrow.svelte +24 -0
  151. package/dist/tour/arrow.svelte.d.ts +18 -0
  152. package/dist/tour/close-trigger.svelte +25 -0
  153. package/dist/tour/close-trigger.svelte.d.ts +18 -0
  154. package/dist/tour/content.svelte +30 -0
  155. package/dist/tour/content.svelte.d.ts +18 -0
  156. package/dist/tour/context.svelte.d.ts +2 -0
  157. package/dist/tour/context.svelte.js +3 -0
  158. package/dist/tour/create-tour.svelte.js +4 -4
  159. package/dist/tour/description.svelte +24 -0
  160. package/dist/tour/description.svelte.d.ts +18 -0
  161. package/dist/tour/index.d.ts +17 -0
  162. package/dist/tour/index.js +3 -0
  163. package/dist/tour/next-trigger.svelte +24 -0
  164. package/dist/tour/next-trigger.svelte.d.ts +18 -0
  165. package/dist/tour/overlay.svelte +38 -0
  166. package/dist/tour/overlay.svelte.d.ts +18 -0
  167. package/dist/tour/positioner.svelte +30 -0
  168. package/dist/tour/positioner.svelte.d.ts +18 -0
  169. package/dist/tour/prev-trigger.svelte +24 -0
  170. package/dist/tour/prev-trigger.svelte.d.ts +18 -0
  171. package/dist/tour/progress-text.svelte +28 -0
  172. package/dist/tour/progress-text.svelte.d.ts +18 -0
  173. package/dist/tour/root.svelte +47 -0
  174. package/dist/tour/root.svelte.d.ts +18 -0
  175. package/dist/tour/skip-trigger.svelte +24 -0
  176. package/dist/tour/skip-trigger.svelte.d.ts +18 -0
  177. package/dist/tour/spotlight.svelte +24 -0
  178. package/dist/tour/spotlight.svelte.d.ts +18 -0
  179. package/dist/tour/title.svelte +24 -0
  180. package/dist/tour/title.svelte.d.ts +18 -0
  181. package/dist/tour/tour.d.ts +14 -0
  182. package/dist/tour/tour.js +14 -0
  183. package/dist/tree-view/branch.svelte +2 -2
  184. package/dist/tree-view/create-tree-view.svelte.js +3 -4
  185. package/dist/tree-view/item.svelte +2 -2
  186. package/dist/tree-view/root.svelte +2 -2
  187. package/dist/types.d.ts +10 -16
  188. package/package.json +2 -1
@@ -7,15 +7,14 @@ export function createDialog(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
- const context = $derived(reflect(() => ({
10
+ const context = reflect(() => ({
11
11
  ...props,
12
12
  id: props.id ?? id,
13
13
  dir: locale?.dir,
14
14
  open: props.defaultOpen ?? props.open,
15
15
  getRootNode: environment?.getRootNode,
16
16
  'open.controlled': props.open != null,
17
- })));
17
+ }));
18
18
  const [state, send] = useMachine(dialog.machine(context), { context });
19
- const api = $derived(reflect(() => dialog.connect(state, send, normalizeProps)));
20
- return api;
19
+ return reflect(() => dialog.connect(state, send, normalizeProps));
21
20
  }
@@ -33,18 +33,12 @@
33
33
  );
34
34
 
35
35
  let dialog = createDialog(reflect(() => dialogProps));
36
-
37
- let presence = createPresence({
38
- get present() {
39
- return dialog.open;
40
- },
41
- get lazyMount() {
42
- return presenceStrategyProps.lazyMount;
43
- },
44
- get keepMounted() {
45
- return presenceStrategyProps.keepMounted;
46
- },
47
- });
36
+ let presence = createPresence(
37
+ reflect(() => ({
38
+ ...presenceStrategyProps,
39
+ present: dialog.open,
40
+ })),
41
+ );
48
42
 
49
43
  setDialogContext(dialog);
50
44
  setPresenceContext(presence);
@@ -9,7 +9,7 @@ export function createEditable(props) {
9
9
  const locale = getLocaleContext();
10
10
  const environment = getEnvironmentContext();
11
11
  const id = uid();
12
- const context = $derived(reflect(() => ({
12
+ const context = reflect(() => ({
13
13
  ids: {
14
14
  label: field?.ids.label,
15
15
  input: field?.ids.control,
@@ -24,9 +24,9 @@ export function createEditable(props) {
24
24
  edit: props.defaultEdit ?? props.edit,
25
25
  getRootNode: environment?.getRootNode,
26
26
  'edit.controlled': props.edit != null,
27
- })));
27
+ }));
28
28
  const [state, send] = useMachine(editable.machine(context), { context });
29
- const api = $derived(reflect(() => {
29
+ return reflect(() => {
30
30
  const o = editable.connect(state, send, normalizeProps);
31
31
  return {
32
32
  ...o,
@@ -37,6 +37,5 @@ export function createEditable(props) {
37
37
  };
38
38
  },
39
39
  };
40
- }));
41
- return api;
40
+ });
42
41
  }
@@ -21,7 +21,7 @@
21
21
 
22
22
  let {asChild, children, ...props}: EditableProps = $props();
23
23
 
24
- let [editableProps, otherProps] = $derived(
24
+ let [editableProps, localProps] = $derived(
25
25
  createSplitProps<CreateEditableProps>([
26
26
  'id',
27
27
  'ids',
@@ -54,7 +54,7 @@
54
54
 
55
55
  let editable = createEditable(reflect(() => editableProps));
56
56
 
57
- let mergedProps = $derived(mergeProps(otherProps, editable.getRootProps()));
57
+ let mergedProps = $derived(mergeProps(localProps, editable.getRootProps()));
58
58
 
59
59
  setEditableContext(editable);
60
60
  </script>
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" module>
2
2
  import type {Snippet} from 'svelte';
3
- import {type Environment} from './context.svelte.js';
4
3
 
5
4
  export interface EnvironmentProviderProps {
6
5
  rootNode?:
@@ -20,21 +19,19 @@
20
19
 
21
20
  let elem: HTMLSpanElement | null = $state(null);
22
21
 
23
- let getRootNode = $derived.by(() => {
22
+ function getRootNode() {
24
23
  if (rootNode) {
25
- return typeof rootNode === 'function' ? rootNode : () => rootNode;
24
+ return typeof rootNode === 'function' ? rootNode() : rootNode;
26
25
  } else {
27
- return () => elem?.ownerDocument ?? document;
26
+ return elem?.ownerDocument ?? document;
28
27
  }
29
- });
28
+ }
30
29
 
31
- let environment: Environment = $derived({
30
+ setEnvironmentContext({
32
31
  getRootNode,
33
32
  getDocument: () => getDocument(getRootNode()),
34
33
  getWindow: () => getWindow(getRootNode()),
35
34
  });
36
-
37
- setEnvironmentContext(() => environment);
38
35
  </script>
39
36
 
40
37
  {@render children()}
@@ -1,4 +1,3 @@
1
- import type { HtmlProps } from '../types.js';
2
1
  interface ElementIds {
3
2
  root?: string;
4
3
  label?: string;
@@ -16,25 +15,5 @@ export interface CreateFieldProps {
16
15
  }
17
16
  export interface CreateFieldReturn extends ReturnType<typeof createField> {
18
17
  }
19
- export declare function createField(props: CreateFieldProps): {
20
- readonly ids: {
21
- root: string;
22
- label: string;
23
- control: string;
24
- errorText: string;
25
- helperText: string;
26
- };
27
- readonly disabled: boolean;
28
- readonly required: boolean;
29
- readonly readOnly: boolean;
30
- readonly invalid: boolean;
31
- readonly 'aria-describedby': string;
32
- getRootProps: () => HtmlProps<"div">;
33
- getLabelProps: () => HtmlProps<"label">;
34
- getErrorTextProps: () => HtmlProps<"div">;
35
- getHelperTextProps: () => HtmlProps<"div">;
36
- getInputProps: () => HtmlProps<"input">;
37
- getSelectProps: () => HtmlProps<"select">;
38
- getTextareaProps: () => HtmlProps<"textarea">;
39
- };
18
+ export declare function createField(props: CreateFieldProps): any;
40
19
  export {};
@@ -1,5 +1,6 @@
1
1
  import { getEnvironmentContext } from '../environment-provider/context.svelte.js';
2
2
  import { ariaAttr, dataAttr, getDocument, getWindow } from '@zag-js/dom-query';
3
+ import { reflect } from '@zag-js/svelte';
3
4
  import { uid } from 'uid';
4
5
  import { parts } from './anatomy.js';
5
6
  export function createField(props) {
@@ -136,25 +137,13 @@ export function createField(props) {
136
137
  'data-readonly': dataAttr(readOnly),
137
138
  };
138
139
  }
139
- return {
140
- get ids() {
141
- return ids;
142
- },
143
- get disabled() {
144
- return disabled;
145
- },
146
- get required() {
147
- return required;
148
- },
149
- get readOnly() {
150
- return readOnly;
151
- },
152
- get invalid() {
153
- return invalid;
154
- },
155
- get 'aria-describedby'() {
156
- return ariaDescribedby;
157
- },
140
+ return reflect(() => ({
141
+ ids,
142
+ disabled,
143
+ required,
144
+ readOnly,
145
+ invalid,
146
+ 'aria-describedby': ariaDescribedby,
158
147
  getRootProps,
159
148
  getLabelProps,
160
149
  getErrorTextProps,
@@ -162,5 +151,5 @@ export function createField(props) {
162
151
  getInputProps,
163
152
  getSelectProps,
164
153
  getTextareaProps,
165
- };
154
+ }));
166
155
  }
@@ -21,7 +21,7 @@
21
21
 
22
22
  let {asChild, children, ...props}: FieldProps = $props();
23
23
 
24
- let [fieldProps, otherProps] = $derived(
24
+ let [fieldProps, localProps] = $derived(
25
25
  createSplitProps<CreateFieldProps>([
26
26
  'id',
27
27
  'ids',
@@ -34,7 +34,7 @@
34
34
 
35
35
  let field = createField(reflect(() => fieldProps));
36
36
 
37
- let mergedProps = $derived(mergeProps(otherProps, field.getRootProps()));
37
+ let mergedProps = $derived(mergeProps(localProps, field.getRootProps()));
38
38
 
39
39
  setFieldContext(field);
40
40
  </script>
@@ -9,7 +9,7 @@ export function createFileUpload(props) {
9
9
  const locale = getLocaleContext();
10
10
  const environment = getEnvironmentContext();
11
11
  const id = uid();
12
- const context = $derived(reflect(() => ({
12
+ const context = reflect(() => ({
13
13
  ids: {
14
14
  label: field?.ids.label,
15
15
  hiddenInput: field?.ids.control,
@@ -22,9 +22,9 @@ export function createFileUpload(props) {
22
22
  dir: locale?.dir,
23
23
  locale: props.locale ?? locale?.locale,
24
24
  getRootNode: environment?.getRootNode,
25
- })));
25
+ }));
26
26
  const [state, send] = useMachine(fileUpload.machine(context), { context });
27
- const api = $derived(reflect(() => {
27
+ return reflect(() => {
28
28
  const o = fileUpload.connect(state, send, normalizeProps);
29
29
  return {
30
30
  ...o,
@@ -35,6 +35,5 @@ export function createFileUpload(props) {
35
35
  };
36
36
  },
37
37
  };
38
- }));
39
- return api;
38
+ });
40
39
  }
@@ -18,12 +18,12 @@
18
18
 
19
19
  let fileUpload = getFileUploadContext();
20
20
 
21
- let [itemProps, otherProps] = $derived(
21
+ let [itemProps, localProps] = $derived(
22
22
  createSplitProps<ItemProps>(['file'])(props),
23
23
  );
24
24
 
25
25
  let mergedProps = $derived(
26
- mergeProps(otherProps, fileUpload.getItemProps(itemProps)),
26
+ mergeProps(localProps, fileUpload.getItemProps(itemProps)),
27
27
  );
28
28
 
29
29
  setFileUploadItemPropsContext(() => itemProps);
@@ -21,7 +21,7 @@
21
21
 
22
22
  let {asChild, children, ...props}: FileUploadProps = $props();
23
23
 
24
- let [fileUploadProps, otherProps] = $derived(
24
+ let [fileUploadProps, localProps] = $derived(
25
25
  createSplitProps<CreateFileUploadProps>([
26
26
  'id',
27
27
  'ids',
@@ -47,7 +47,7 @@
47
47
 
48
48
  let fileUpload = createFileUpload(reflect(() => fileUploadProps));
49
49
 
50
- let mergedProps = $derived(mergeProps(otherProps, fileUpload.getRootProps()));
50
+ let mergedProps = $derived(mergeProps(localProps, fileUpload.getRootProps()));
51
51
 
52
52
  setFileUploadContext(fileUpload);
53
53
  </script>
@@ -0,0 +1,24 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface FloatingPanelBodyProps extends HtmlIngredientProps<'div'> {}
5
+ </script>
6
+
7
+ <script lang="ts">
8
+ import {mergeProps} from '../merge-props.js';
9
+ import {getFloatingPanelContext} from './context.svelte.js';
10
+
11
+ let {asChild, children, ...props}: FloatingPanelBodyProps = $props();
12
+
13
+ let floatingPanel = getFloatingPanelContext();
14
+
15
+ let mergedProps = $derived(mergeProps(props, floatingPanel.getBodyProps()));
16
+ </script>
17
+
18
+ {#if asChild}
19
+ {@render asChild(mergedProps)}
20
+ {:else}
21
+ <div {...mergedProps}>
22
+ {@render children?.()}
23
+ </div>
24
+ {/if}
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Body: $$__sveltets_2_IsomorphicComponent<FloatingPanelBodyProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Body = InstanceType<typeof Body>;
18
+ export default Body;
@@ -0,0 +1,27 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface FloatingPanelCloseTriggerProps
5
+ extends HtmlIngredientProps<'button'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getFloatingPanelContext} from './context.svelte.js';
11
+
12
+ let {asChild, children, ...props}: FloatingPanelCloseTriggerProps = $props();
13
+
14
+ let floatingPanel = getFloatingPanelContext();
15
+
16
+ let mergedProps = $derived(
17
+ mergeProps(props, floatingPanel.getCloseTriggerProps()),
18
+ );
19
+ </script>
20
+
21
+ {#if asChild}
22
+ {@render asChild(mergedProps)}
23
+ {:else}
24
+ <button type="button" {...mergedProps}>
25
+ {@render children?.()}
26
+ </button>
27
+ {/if}
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const CloseTrigger: $$__sveltets_2_IsomorphicComponent<FloatingPanelCloseTriggerProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type CloseTrigger = InstanceType<typeof CloseTrigger>;
18
+ export default CloseTrigger;
@@ -0,0 +1,36 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+ import type {Action} from 'svelte/action';
4
+
5
+ export interface FloatingPanelContentProps
6
+ extends HtmlIngredientProps<'div', never, Action> {}
7
+ </script>
8
+
9
+ <script lang="ts">
10
+ import {mergeProps} from '../merge-props.js';
11
+ import {getPresenceContext} from '../presence/context.svelte.js';
12
+ import {getFloatingPanelContext} from './context.svelte.js';
13
+
14
+ let {asChild, children, ...props}: FloatingPanelContentProps = $props();
15
+
16
+ let floatingPanel = getFloatingPanelContext();
17
+ let presence = getPresenceContext();
18
+
19
+ let mergedProps = $derived(
20
+ mergeProps(
21
+ props,
22
+ floatingPanel.getContentProps(),
23
+ presence.getPresenceProps(),
24
+ ),
25
+ );
26
+ </script>
27
+
28
+ {#if presence.mounted}
29
+ {#if asChild}
30
+ {@render asChild(presence.ref, mergedProps)}
31
+ {:else}
32
+ <div use:presence.ref {...mergedProps}>
33
+ {@render children?.()}
34
+ </div>
35
+ {/if}
36
+ {/if}
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Content: $$__sveltets_2_IsomorphicComponent<FloatingPanelContentProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Content = InstanceType<typeof Content>;
18
+ export default Content;
@@ -0,0 +1,2 @@
1
+ import type { CreateFloatingPanelReturn } from './create-floating-panel.svelte.js';
2
+ export declare const getFloatingPanelContext: () => CreateFloatingPanelReturn, setFloatingPanelContext: (context: CreateFloatingPanelReturn | (() => CreateFloatingPanelReturn)) => void;
@@ -0,0 +1,2 @@
1
+ import { createContext } from '../create-context.svelte.js';
2
+ export const [getFloatingPanelContext, setFloatingPanelContext] = createContext('FloatingPanel');
@@ -1,5 +1,6 @@
1
1
  import * as floatingPanel from '@zag-js/floating-panel';
2
- export interface CreateFloatingPanelProps extends Omit<floatingPanel.Context, 'dir' | 'getRootNode'> {
2
+ export interface CreateFloatingPanelProps extends Omit<floatingPanel.Context, 'id' | 'dir' | 'getRootNode'> {
3
+ id?: string | null;
3
4
  }
4
5
  export interface CreateFloatingPanelReturn extends floatingPanel.Api<any> {
5
6
  }
@@ -7,12 +7,12 @@ export function createFloatingPanel(props) {
7
7
  const locale = getLocaleContext();
8
8
  const environment = getEnvironmentContext();
9
9
  const id = uid();
10
- const context = $derived(reflect(() => ({
10
+ const context = reflect(() => ({
11
+ ...props,
11
12
  id: props.id ?? id,
12
13
  dir: locale?.dir,
13
14
  getRootNode: environment?.getRootNode,
14
- })));
15
+ }));
15
16
  const [state, send] = useMachine(floatingPanel.machine(context), { context });
16
- const api = $derived(reflect(() => floatingPanel.connect(state, send, normalizeProps)));
17
- return api;
17
+ return reflect(() => floatingPanel.connect(state, send, normalizeProps));
18
18
  }
@@ -0,0 +1,27 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface FloatingPanelDragTriggerProps
5
+ extends HtmlIngredientProps<'button'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getFloatingPanelContext} from './context.svelte.js';
11
+
12
+ let {asChild, children, ...props}: FloatingPanelDragTriggerProps = $props();
13
+
14
+ let floatingPanel = getFloatingPanelContext();
15
+
16
+ let mergedProps = $derived(
17
+ mergeProps(props, floatingPanel.getDragTriggerProps()),
18
+ );
19
+ </script>
20
+
21
+ {#if asChild}
22
+ {@render asChild(mergedProps)}
23
+ {:else}
24
+ <button type="button" {...mergedProps}>
25
+ {@render children?.()}
26
+ </button>
27
+ {/if}
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const DragTrigger: $$__sveltets_2_IsomorphicComponent<FloatingPanelDragTriggerProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type DragTrigger = InstanceType<typeof DragTrigger>;
18
+ export default DragTrigger;
@@ -0,0 +1,13 @@
1
+ export { default as Body } from './body.svelte';
2
+ export { default as CloseTrigger } from './close-trigger.svelte';
3
+ export { default as Content } from './content.svelte';
4
+ export { default as DragTrigger } from './drag-trigger.svelte';
5
+ export { default as Header } from './header.svelte';
6
+ export { default as MaximizeTrigger } from './maximize-trigger.svelte';
7
+ export { default as MinimizeTrigger } from './minimize-trigger.svelte';
8
+ export { default as Positioner } from './positioner.svelte';
9
+ export { default as ResizeTrigger } from './resize-trigger.svelte';
10
+ export { default as RestoreTrigger } from './restore-trigger.svelte';
11
+ export { default as Root } from './root.svelte';
12
+ export { default as Title } from './title.svelte';
13
+ export { default as Trigger } from './trigger.svelte';
@@ -0,0 +1,13 @@
1
+ export { default as Body } from './body.svelte';
2
+ export { default as CloseTrigger } from './close-trigger.svelte';
3
+ export { default as Content } from './content.svelte';
4
+ export { default as DragTrigger } from './drag-trigger.svelte';
5
+ export { default as Header } from './header.svelte';
6
+ export { default as MaximizeTrigger } from './maximize-trigger.svelte';
7
+ export { default as MinimizeTrigger } from './minimize-trigger.svelte';
8
+ export { default as Positioner } from './positioner.svelte';
9
+ export { default as ResizeTrigger } from './resize-trigger.svelte';
10
+ export { default as RestoreTrigger } from './restore-trigger.svelte';
11
+ export { default as Root } from './root.svelte';
12
+ export { default as Title } from './title.svelte';
13
+ export { default as Trigger } from './trigger.svelte';
@@ -0,0 +1,25 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface FloatingPanelHeaderProps
5
+ extends HtmlIngredientProps<'div'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getFloatingPanelContext} from './context.svelte.js';
11
+
12
+ let {asChild, children, ...props}: FloatingPanelHeaderProps = $props();
13
+
14
+ let floatingPanel = getFloatingPanelContext();
15
+
16
+ let mergedProps = $derived(mergeProps(props, floatingPanel.getHeaderProps()));
17
+ </script>
18
+
19
+ {#if asChild}
20
+ {@render asChild(mergedProps)}
21
+ {:else}
22
+ <div {...mergedProps}>
23
+ {@render children?.()}
24
+ </div>
25
+ {/if}
@@ -0,0 +1,18 @@
1
+ interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
2
+ new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
3
+ $$bindings?: Bindings;
4
+ } & Exports;
5
+ (internal: unknown, props: Props & {
6
+ $$events?: Events;
7
+ $$slots?: Slots;
8
+ }): Exports & {
9
+ $set?: any;
10
+ $on?: any;
11
+ };
12
+ z_$$bindings?: Bindings;
13
+ }
14
+ declare const Header: $$__sveltets_2_IsomorphicComponent<FloatingPanelHeaderProps, {
15
+ [evt: string]: CustomEvent<any>;
16
+ }, {}, {}, "">;
17
+ type Header = InstanceType<typeof Header>;
18
+ export default Header;
@@ -0,0 +1,16 @@
1
+ export * as FloatingPanel from './floating-panel.js';
2
+ export type { FloatingPanelBodyProps } from './body.svelte';
3
+ export type { FloatingPanelCloseTriggerProps } from './close-trigger.svelte';
4
+ export type { FloatingPanelContentProps } from './content.svelte';
5
+ export type { FloatingPanelDragTriggerProps } from './drag-trigger.svelte';
6
+ export type { FloatingPanelHeaderProps } from './header.svelte';
7
+ export type { FloatingPanelMaximizeTriggerProps } from './maximize-trigger.svelte';
8
+ export type { FloatingPanelMinimizeTriggerProps } from './minimize-trigger.svelte';
9
+ export type { FloatingPanelPositionerProps } from './positioner.svelte';
10
+ export type { FloatingPanelResizeTriggerProps } from './resize-trigger.svelte';
11
+ export type { FloatingPanelRestoreTriggerProps } from './restore-trigger.svelte';
12
+ export type { FloatingPanelProps } from './root.svelte';
13
+ export type { FloatingPanelTitleProps } from './title.svelte';
14
+ export type { FloatingPanelTriggerProps } from './trigger.svelte';
15
+ export { anatomy as floatingPanelAnatomy } from '@zag-js/floating-panel';
16
+ export { getFloatingPanelContext } from './context.svelte.js';
@@ -0,0 +1,3 @@
1
+ export * as FloatingPanel from './floating-panel.js';
2
+ export { anatomy as floatingPanelAnatomy } from '@zag-js/floating-panel';
3
+ export { getFloatingPanelContext } from './context.svelte.js';
@@ -0,0 +1,28 @@
1
+ <script lang="ts" module>
2
+ import type {HtmlIngredientProps} from '../types.js';
3
+
4
+ export interface FloatingPanelMaximizeTriggerProps
5
+ extends HtmlIngredientProps<'button'> {}
6
+ </script>
7
+
8
+ <script lang="ts">
9
+ import {mergeProps} from '../merge-props.js';
10
+ import {getFloatingPanelContext} from './context.svelte.js';
11
+
12
+ let {asChild, children, ...props}: FloatingPanelMaximizeTriggerProps =
13
+ $props();
14
+
15
+ let floatingPanel = getFloatingPanelContext();
16
+
17
+ let mergedProps = $derived(
18
+ mergeProps(props, floatingPanel.getMaximizeTriggerProps()),
19
+ );
20
+ </script>
21
+
22
+ {#if asChild}
23
+ {@render asChild(mergedProps)}
24
+ {:else}
25
+ <button type="button" {...mergedProps}>
26
+ {@render children?.()}
27
+ </button>
28
+ {/if}