@pzerelles/headlessui-svelte 2.1.2-next.4 → 2.1.2-next.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/button/Button.svelte +15 -18
- package/dist/button/Button.svelte.d.ts +8 -36
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +1 -1
- package/dist/checkbox/Checkbox.svelte +30 -26
- package/dist/checkbox/Checkbox.svelte.d.ts +17 -38
- package/dist/checkbox/index.d.ts +1 -1
- package/dist/checkbox/index.js +1 -1
- package/dist/close-button/CloseButton.svelte +4 -7
- package/dist/close-button/CloseButton.svelte.d.ts +3 -46
- package/dist/close-button/index.d.ts +1 -0
- package/dist/close-button/index.js +1 -0
- package/dist/data-interactive/DataInteractive.svelte +6 -22
- package/dist/data-interactive/DataInteractive.svelte.d.ts +9 -34
- package/dist/data-interactive/index.d.ts +1 -1
- package/dist/data-interactive/index.js +1 -1
- package/dist/description/Description.svelte +28 -23
- package/dist/description/Description.svelte.d.ts +9 -30
- package/dist/description/context.svelte.js +14 -16
- package/dist/description/index.d.ts +1 -1
- package/dist/dialog/Dialog.svelte +315 -31
- package/dist/dialog/Dialog.svelte.d.ts +7 -45
- package/dist/dialog/DialogBackdrop.svelte +11 -14
- package/dist/dialog/DialogBackdrop.svelte.d.ts +8 -33
- package/dist/dialog/DialogPanel.svelte +23 -19
- package/dist/dialog/DialogPanel.svelte.d.ts +8 -34
- package/dist/dialog/DialogTitle.svelte +17 -8
- package/dist/dialog/DialogTitle.svelte.d.ts +9 -30
- package/dist/dialog/context.svelte.js +2 -2
- package/dist/dialog/index.d.ts +4 -4
- package/dist/dialog/index.js +4 -4
- package/dist/field/Field.svelte +27 -26
- package/dist/field/Field.svelte.d.ts +7 -34
- package/dist/field/index.d.ts +1 -1
- package/dist/fieldset/Fieldset.svelte +14 -20
- package/dist/fieldset/Fieldset.svelte.d.ts +8 -35
- package/dist/fieldset/index.d.ts +1 -1
- package/dist/focus-trap/FocusTrap.svelte +30 -54
- package/dist/focus-trap/FocusTrap.svelte.d.ts +10 -52
- package/dist/focus-trap/FocusTrapFeatures.d.ts +14 -0
- package/dist/focus-trap/FocusTrapFeatures.js +15 -0
- package/dist/hooks/use-controllable.svelte.js +2 -1
- package/dist/hooks/use-did-element-move.svelte.js +5 -10
- package/dist/hooks/use-disabled.d.ts +6 -1
- package/dist/hooks/use-disabled.js +10 -5
- package/dist/hooks/use-event-listener.svelte.d.ts +1 -1
- package/dist/hooks/use-event-listener.svelte.js +3 -1
- package/dist/hooks/use-inert-others.svelte.js +10 -10
- package/dist/hooks/use-resolve-button-type.svelte.js +0 -1
- package/dist/hooks/use-root-containers.svelte.d.ts +2 -2
- package/dist/hooks/use-root-containers.svelte.js +5 -5
- package/dist/hooks/use-tab-direction.svelte.js +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/input/Input.svelte +28 -21
- package/dist/input/Input.svelte.d.ts +16 -33
- package/dist/input/index.d.ts +1 -1
- package/dist/input/index.js +1 -1
- package/dist/internal/FloatingProvider.svelte +17 -0
- package/dist/internal/FloatingProvider.svelte.d.ts +8 -0
- package/dist/internal/FocusSentinel.svelte +33 -32
- package/dist/internal/FocusSentinel.svelte.d.ts +4 -18
- package/dist/internal/ForcePortalRoot.svelte.d.ts +4 -18
- package/dist/internal/FormFields.svelte +18 -13
- package/dist/internal/FormFields.svelte.d.ts +4 -18
- package/dist/internal/FormFieldsProvider.svelte +17 -0
- package/dist/internal/FormFieldsProvider.svelte.d.ts +7 -0
- package/dist/internal/FormResolver.svelte +6 -2
- package/dist/internal/FormResolver.svelte.d.ts +4 -18
- package/dist/internal/Hidden.svelte +10 -10
- package/dist/internal/Hidden.svelte.d.ts +6 -33
- package/dist/internal/MainTreeProvider.svelte +1 -1
- package/dist/internal/MainTreeProvider.svelte.d.ts +4 -18
- package/dist/internal/Portal.svelte.d.ts +4 -18
- package/dist/internal/floating-provider.svelte.d.ts +3 -0
- package/dist/internal/floating-provider.svelte.js +206 -0
- package/dist/internal/floating.svelte.d.ts +46 -22
- package/dist/internal/floating.svelte.js +90 -272
- package/dist/internal/form-fields.svelte.d.ts +10 -0
- package/dist/internal/form-fields.svelte.js +23 -0
- package/dist/label/Label.svelte +17 -13
- package/dist/label/Label.svelte.d.ts +8 -33
- package/dist/label/context.svelte.js +1 -1
- package/dist/label/index.d.ts +1 -1
- package/dist/legend/Legend.svelte +21 -15
- package/dist/legend/Legend.svelte.d.ts +9 -34
- package/dist/listbox/Listbox.svelte +79 -163
- package/dist/listbox/Listbox.svelte.d.ts +16 -101
- package/dist/listbox/ListboxButton.svelte +24 -29
- package/dist/listbox/ListboxButton.svelte.d.ts +8 -38
- package/dist/listbox/ListboxOption.svelte +33 -27
- package/dist/listbox/ListboxOption.svelte.d.ts +16 -32
- package/dist/listbox/ListboxOptions.svelte +126 -73
- package/dist/listbox/ListboxOptions.svelte.d.ts +8 -43
- package/dist/listbox/ListboxSelectedOption.svelte +24 -26
- package/dist/listbox/ListboxSelectedOption.svelte.d.ts +14 -39
- package/dist/listbox/context.svelte.d.ts +76 -0
- package/dist/listbox/context.svelte.js +36 -0
- package/dist/listbox/index.d.ts +5 -5
- package/dist/listbox/index.js +4 -4
- package/dist/menu/Menu.svelte +22 -266
- package/dist/menu/Menu.svelte.d.ts +7 -37
- package/dist/menu/MenuButton.svelte +22 -24
- package/dist/menu/MenuButton.svelte.d.ts +8 -39
- package/dist/menu/MenuHeading.svelte +12 -16
- package/dist/menu/MenuHeading.svelte.d.ts +7 -36
- package/dist/menu/MenuItem.svelte +18 -23
- package/dist/menu/MenuItem.svelte.d.ts +9 -39
- package/dist/menu/MenuItems.svelte +33 -34
- package/dist/menu/MenuItems.svelte.d.ts +8 -43
- package/dist/menu/MenuSection.svelte +9 -12
- package/dist/menu/MenuSection.svelte.d.ts +7 -33
- package/dist/menu/MenuSeparator.svelte +9 -12
- package/dist/menu/MenuSeparator.svelte.d.ts +7 -33
- package/dist/menu/context.svelte.d.ts +2 -1
- package/dist/menu/context.svelte.js +212 -2
- package/dist/menu/index.d.ts +7 -7
- package/dist/menu/index.js +3 -3
- package/dist/popover/Popover.svelte +225 -0
- package/dist/popover/Popover.svelte.d.ts +15 -0
- package/dist/popover/PopoverBackdrop.svelte +83 -0
- package/dist/popover/PopoverBackdrop.svelte.d.ts +17 -0
- package/dist/popover/PopoverButton.svelte +324 -0
- package/dist/popover/PopoverButton.svelte.d.ts +21 -0
- package/dist/popover/PopoverGroup.svelte +66 -0
- package/dist/popover/PopoverGroup.svelte.d.ts +9 -0
- package/dist/popover/PopoverPanel.svelte +359 -0
- package/dist/popover/PopoverPanel.svelte.d.ts +22 -0
- package/dist/popover/context.svelte.d.ts +51 -0
- package/dist/popover/context.svelte.js +108 -0
- package/dist/popover/index.d.ts +5 -0
- package/dist/popover/index.js +5 -0
- package/dist/portal/InternalPortal.svelte +17 -17
- package/dist/portal/InternalPortal.svelte.d.ts +6 -33
- package/dist/portal/Portal.svelte +7 -6
- package/dist/portal/Portal.svelte.d.ts +3 -22
- package/dist/portal/PortalGroup.svelte +6 -14
- package/dist/portal/PortalGroup.svelte.d.ts +5 -34
- package/dist/radio-group/Radio.svelte +135 -0
- package/dist/radio-group/Radio.svelte.d.ts +35 -0
- package/dist/radio-group/RadioGroup.svelte +223 -0
- package/dist/radio-group/RadioGroup.svelte.d.ts +34 -0
- package/dist/radio-group/RadioOption.svelte +138 -0
- package/dist/radio-group/RadioOption.svelte.d.ts +37 -0
- package/dist/radio-group/contest.svelte.d.ts +30 -0
- package/dist/radio-group/contest.svelte.js +40 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/index.js +3 -0
- package/dist/select/Select.svelte +112 -0
- package/dist/select/Select.svelte.d.ts +21 -0
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +1 -0
- package/dist/switch/Switch.svelte +27 -28
- package/dist/switch/Switch.svelte.d.ts +9 -42
- package/dist/switch/SwitchGroup.svelte +5 -5
- package/dist/switch/SwitchGroup.svelte.d.ts +8 -30
- package/dist/switch/index.d.ts +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/tabs/Tab.svelte +26 -29
- package/dist/tabs/Tab.svelte.d.ts +8 -36
- package/dist/tabs/TabGroup.svelte +42 -264
- package/dist/tabs/TabGroup.svelte.d.ts +7 -57
- package/dist/tabs/TabList.svelte +13 -16
- package/dist/tabs/TabList.svelte.d.ts +8 -31
- package/dist/tabs/TabPanel.svelte +19 -19
- package/dist/tabs/TabPanel.svelte.d.ts +8 -38
- package/dist/tabs/TabPanels.svelte +11 -9
- package/dist/tabs/TabPanels.svelte.d.ts +8 -30
- package/dist/tabs/context.svelte.d.ts +31 -0
- package/dist/tabs/context.svelte.js +134 -0
- package/dist/tabs/index.d.ts +5 -5
- package/dist/tabs/index.js +4 -4
- package/dist/textarea/Textarea.svelte +23 -19
- package/dist/textarea/Textarea.svelte.d.ts +18 -30
- package/dist/textarea/index.d.ts +1 -1
- package/dist/textarea/index.js +1 -1
- package/dist/transition/InternalTransitionChild.svelte +19 -12
- package/dist/transition/InternalTransitionChild.svelte.d.ts +4 -35
- package/dist/transition/Transition.svelte +16 -17
- package/dist/transition/Transition.svelte.d.ts +8 -38
- package/dist/transition/TransitionChild.svelte +13 -12
- package/dist/transition/TransitionChild.svelte.d.ts +11 -38
- package/dist/transition/context.svelte.js +9 -9
- package/dist/transition/index.d.ts +2 -2
- package/dist/transition/index.js +2 -2
- package/dist/utils/DisabledProvider.svelte +10 -0
- package/dist/utils/DisabledProvider.svelte.d.ts +8 -0
- package/dist/utils/ElementOrComponent.svelte +57 -14
- package/dist/utils/ElementOrComponent.svelte.d.ts +19 -29
- package/dist/utils/StableCollection.svelte.d.ts +4 -18
- package/dist/utils/floating-ui/svelte/components/FloatingNode.svelte +32 -0
- package/dist/utils/floating-ui/svelte/components/FloatingNode.svelte.d.ts +8 -0
- package/dist/utils/floating-ui/svelte/components/FloatingTree.svelte +94 -0
- package/dist/utils/floating-ui/svelte/components/FloatingTree.svelte.d.ts +26 -0
- package/dist/utils/floating-ui/svelte/hooks/useFloating.svelte.d.ts +6 -0
- package/dist/utils/floating-ui/svelte/hooks/useFloating.svelte.js +158 -0
- package/dist/utils/floating-ui/svelte/hooks/useFloatingRootContext.svelte.d.ts +11 -0
- package/dist/utils/floating-ui/svelte/hooks/useFloatingRootContext.svelte.js +53 -0
- package/dist/utils/floating-ui/svelte/hooks/useId.svelte.d.ts +9 -0
- package/dist/utils/floating-ui/svelte/hooks/useId.svelte.js +28 -0
- package/dist/utils/floating-ui/svelte/hooks/useInteractions.svelte.d.ts +23 -0
- package/dist/utils/floating-ui/svelte/hooks/useInteractions.svelte.js +72 -0
- package/dist/utils/floating-ui/svelte/index.d.ts +5 -0
- package/dist/utils/floating-ui/svelte/index.js +5 -0
- package/dist/utils/floating-ui/svelte/inner.svelte.d.ts +83 -0
- package/dist/utils/floating-ui/svelte/inner.svelte.js +178 -0
- package/dist/utils/floating-ui/svelte/types.d.ts +114 -0
- package/dist/utils/floating-ui/svelte/utils/createPubSub.d.ts +5 -0
- package/dist/utils/floating-ui/svelte/utils/createPubSub.js +14 -0
- package/dist/utils/floating-ui/svelte/utils/getFloatingFocusElement.d.ts +2 -0
- package/dist/utils/floating-ui/svelte/utils/getFloatingFocusElement.js +13 -0
- package/dist/utils/floating-ui/svelte/utils/log.d.ts +2 -0
- package/dist/utils/floating-ui/svelte/utils/log.js +19 -0
- package/dist/utils/floating-ui/svelte/utils.d.ts +19 -0
- package/dist/utils/floating-ui/svelte/utils.js +136 -0
- package/dist/utils/floating-ui/svelte-dom/arrow.d.ts +22 -0
- package/dist/utils/floating-ui/svelte-dom/arrow.js +29 -0
- package/dist/utils/floating-ui/svelte-dom/index.d.ts +2 -0
- package/dist/utils/floating-ui/svelte-dom/index.js +2 -0
- package/dist/utils/floating-ui/svelte-dom/types.d.ts +80 -0
- package/dist/utils/floating-ui/svelte-dom/types.js +3 -0
- package/dist/utils/floating-ui/svelte-dom/useFloating.svelte.d.ts +6 -0
- package/dist/utils/floating-ui/svelte-dom/useFloating.svelte.js +182 -0
- package/dist/utils/floating-ui/svelte-dom/utils/deepEqual.d.ts +1 -0
- package/dist/utils/floating-ui/svelte-dom/utils/deepEqual.js +50 -0
- package/dist/utils/floating-ui/svelte-dom/utils/getDPR.d.ts +1 -0
- package/dist/utils/floating-ui/svelte-dom/utils/getDPR.js +7 -0
- package/dist/utils/floating-ui/svelte-dom/utils/roundByDPR.d.ts +1 -0
- package/dist/utils/floating-ui/svelte-dom/utils/roundByDPR.js +5 -0
- package/dist/utils/floating-ui/svelte-dom/utils/useLatestRef.d.ts +4 -0
- package/dist/utils/floating-ui/svelte-dom/utils/useLatestRef.js +7 -0
- package/dist/utils/id.d.ts +1 -1
- package/dist/utils/id.js +1 -1
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/state.js +4 -4
- package/dist/utils/style.d.ts +2 -0
- package/dist/utils/style.js +6 -0
- package/dist/utils/types.d.ts +12 -18
- package/package.json +33 -32
- package/dist/combobox/Combobox.svelte +0 -53
- package/dist/combobox/Combobox.svelte.d.ts +0 -50
- package/dist/dialog/InternalDialog.svelte +0 -294
- package/dist/dialog/InternalDialog.svelte.d.ts +0 -42
- package/dist/internal/HoistFormFields.svelte +0 -14
- package/dist/internal/HoistFormFields.svelte.d.ts +0 -21
- package/dist/internal/id.d.ts +0 -8
- package/dist/internal/id.js +0 -11
- package/dist/utils/Generic.svelte +0 -56
- package/dist/utils/Generic.svelte.d.ts +0 -35
- package/dist/utils/alternative-types.d.ts +0 -21
- /package/dist/utils/{alternative-types.js → floating-ui/svelte/types.js} +0 -0
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type { Props
|
|
2
|
+
import type { Props } from "../utils/types.js"
|
|
3
3
|
|
|
4
4
|
const DEFAULT_BUTTON_TAG = "button" as const
|
|
5
5
|
|
|
6
|
-
type ButtonRenderPropArg = {
|
|
6
|
+
export type ButtonRenderPropArg = {
|
|
7
7
|
disabled: boolean
|
|
8
8
|
hover: boolean
|
|
9
9
|
focus: boolean
|
|
10
10
|
active: boolean
|
|
11
11
|
autofocus: boolean
|
|
12
12
|
}
|
|
13
|
-
type ButtonPropsWeControl = never
|
|
14
13
|
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
>
|
|
14
|
+
export type ButtonOwnProps = {
|
|
15
|
+
element?: HTMLElement
|
|
16
|
+
disabled?: boolean
|
|
17
|
+
autofocus?: boolean
|
|
18
|
+
type?: "button" | "submit" | "reset"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ButtonProps = Props<typeof DEFAULT_BUTTON_TAG, ButtonRenderPropArg, ButtonOwnProps>
|
|
25
22
|
</script>
|
|
26
23
|
|
|
27
|
-
<script lang="ts"
|
|
24
|
+
<script lang="ts">
|
|
28
25
|
import { useActivePress } from "../hooks/use-active-press.svelte.js"
|
|
29
26
|
import { useFocusRing } from "../hooks/use-focus-ring.svelte.js"
|
|
30
27
|
import { useDisabled } from "../hooks/use-disabled.js"
|
|
@@ -35,14 +32,14 @@
|
|
|
35
32
|
const providedDisabled = useDisabled()
|
|
36
33
|
|
|
37
34
|
let {
|
|
38
|
-
|
|
35
|
+
element = $bindable(),
|
|
39
36
|
disabled: ownDisabled = false,
|
|
40
37
|
autofocus = false,
|
|
41
38
|
type = "button",
|
|
42
39
|
...theirProps
|
|
43
|
-
}:
|
|
40
|
+
}: ButtonProps = $props()
|
|
44
41
|
|
|
45
|
-
const disabled = $derived(providedDisabled.
|
|
42
|
+
const disabled = $derived(providedDisabled.current || ownDisabled)
|
|
46
43
|
|
|
47
44
|
const { isHovered: hover, hoverProps } = $derived(
|
|
48
45
|
useHover({
|
|
@@ -88,4 +85,4 @@
|
|
|
88
85
|
)
|
|
89
86
|
</script>
|
|
90
87
|
|
|
91
|
-
<ElementOrComponent {ourProps} {theirProps} {slot} defaultTag={DEFAULT_BUTTON_TAG} name="Button" bind:
|
|
88
|
+
<ElementOrComponent {ourProps} {theirProps} {slot} defaultTag={DEFAULT_BUTTON_TAG} name="Button" bind:element />
|
|
@@ -1,47 +1,19 @@
|
|
|
1
|
-
import type { Props
|
|
1
|
+
import type { Props } from "../utils/types.js";
|
|
2
2
|
declare const DEFAULT_BUTTON_TAG: "button";
|
|
3
|
-
type ButtonRenderPropArg = {
|
|
3
|
+
export type ButtonRenderPropArg = {
|
|
4
4
|
disabled: boolean;
|
|
5
5
|
hover: boolean;
|
|
6
6
|
focus: boolean;
|
|
7
7
|
active: boolean;
|
|
8
8
|
autofocus: boolean;
|
|
9
9
|
};
|
|
10
|
-
type
|
|
11
|
-
|
|
10
|
+
export type ButtonOwnProps = {
|
|
11
|
+
element?: HTMLElement;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
autofocus?: boolean;
|
|
14
14
|
type?: "button" | "submit" | "reset";
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} & (Exclude<keyof import("../utils/types.js").PropsOf<TTag>, ("as" | "children" | "refName" | "class") | "disabled" | "autofocus" | "type"> extends infer T extends keyof import("../utils/types.js").PropsOf<TTag> ? { [P in T]: import("../utils/types.js").PropsOf<TTag>[P]; } : never) & {
|
|
20
|
-
children?: import("../utils/types.js").Children<ButtonRenderPropArg> | undefined;
|
|
21
|
-
ref?: HTMLElement;
|
|
22
|
-
} & (true extends (import("../utils/types.js").PropsOf<TTag> extends infer T_1 ? T_1 extends import("../utils/types.js").PropsOf<TTag> ? T_1 extends never ? never : "class" extends infer T_2 ? T_2 extends "class" ? T_2 extends keyof T_1 ? true : never : never : never : never : never) ? {
|
|
23
|
-
class?: import("../utils/types.js").PropsOf<TTag>["class"] | ((bag: ButtonRenderPropArg) => string) | undefined;
|
|
24
|
-
} : {}) & {
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
autofocus?: boolean;
|
|
27
|
-
type?: "button" | "submit" | "reset";
|
|
28
|
-
};
|
|
29
|
-
events(): {} & {
|
|
30
|
-
[evt: string]: CustomEvent<any>;
|
|
31
|
-
};
|
|
32
|
-
slots(): {};
|
|
33
|
-
bindings(): "ref";
|
|
34
|
-
exports(): {};
|
|
35
|
-
}
|
|
36
|
-
interface $$IsomorphicComponent {
|
|
37
|
-
new <TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TTag>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TTag>['props']>, ReturnType<__sveltets_Render<TTag>['events']>, ReturnType<__sveltets_Render<TTag>['slots']>> & {
|
|
38
|
-
$$bindings?: ReturnType<__sveltets_Render<TTag>['bindings']>;
|
|
39
|
-
} & ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
40
|
-
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(internal: unknown, props: ReturnType<__sveltets_Render<TTag>['props']> & {
|
|
41
|
-
$$events?: ReturnType<__sveltets_Render<TTag>['events']>;
|
|
42
|
-
}): ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
43
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
44
|
-
}
|
|
45
|
-
declare const Button: $$IsomorphicComponent;
|
|
46
|
-
type Button<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = InstanceType<typeof Button<TTag>>;
|
|
15
|
+
};
|
|
16
|
+
export type ButtonProps = Props<typeof DEFAULT_BUTTON_TAG, ButtonRenderPropArg, ButtonOwnProps>;
|
|
17
|
+
declare const Button: import("svelte").Component<ButtonProps, {}, "element">;
|
|
18
|
+
type Button = ReturnType<typeof Button>;
|
|
47
19
|
export default Button;
|
package/dist/button/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Button, type ButtonProps } from "./Button.svelte";
|
|
1
|
+
export { default as Button, type ButtonProps, type ButtonRenderPropArg as ButtonSlot, type ButtonOwnProps, } from "./Button.svelte";
|
package/dist/button/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Button } from "./Button.svelte";
|
|
1
|
+
export { default as Button, } from "./Button.svelte";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { Props } from "../utils/types.js"
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const DEFAULT_CHECKBOX_TAG = "span" as const
|
|
5
|
+
|
|
6
|
+
export type CheckboxRenderPropArg = {
|
|
6
7
|
checked: boolean
|
|
7
8
|
changing: boolean
|
|
8
9
|
focus: boolean
|
|
@@ -12,6 +13,7 @@
|
|
|
12
13
|
disabled: boolean
|
|
13
14
|
indeterminate: boolean
|
|
14
15
|
}
|
|
16
|
+
|
|
15
17
|
type CheckboxPropsWeControl =
|
|
16
18
|
| "aria-checked"
|
|
17
19
|
| "aria-describedby"
|
|
@@ -20,30 +22,31 @@
|
|
|
20
22
|
| "role"
|
|
21
23
|
| "tabIndex"
|
|
22
24
|
|
|
23
|
-
export type
|
|
24
|
-
|
|
25
|
+
export type CheckboxOwnProps<TType = string> = {
|
|
26
|
+
element?: HTMLElement
|
|
27
|
+
id?: string
|
|
28
|
+
value?: TType
|
|
29
|
+
disabled?: boolean
|
|
30
|
+
indeterminate?: boolean
|
|
31
|
+
checked?: boolean
|
|
32
|
+
defaultChecked?: boolean
|
|
33
|
+
autofocus?: boolean
|
|
34
|
+
form?: string
|
|
35
|
+
name?: string
|
|
36
|
+
onchange?: (checked: boolean) => void
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type CheckboxProps<TType = string> = Props<
|
|
40
|
+
typeof DEFAULT_CHECKBOX_TAG,
|
|
25
41
|
CheckboxRenderPropArg,
|
|
26
|
-
|
|
27
|
-
{
|
|
28
|
-
id?: string
|
|
29
|
-
value?: TType
|
|
30
|
-
disabled?: boolean
|
|
31
|
-
indeterminate?: boolean
|
|
32
|
-
|
|
33
|
-
checked?: boolean
|
|
34
|
-
defaultChecked?: boolean
|
|
35
|
-
autofocus?: boolean
|
|
36
|
-
form?: string
|
|
37
|
-
name?: string
|
|
38
|
-
onchange?: (checked: boolean) => void
|
|
39
|
-
}
|
|
42
|
+
CheckboxOwnProps<TType>
|
|
40
43
|
>
|
|
41
44
|
</script>
|
|
42
45
|
|
|
43
|
-
<script lang="ts" generics="TType
|
|
46
|
+
<script lang="ts" generics="TType">
|
|
44
47
|
import { tick } from "svelte"
|
|
45
48
|
import { attemptSubmit } from "../utils/form.js"
|
|
46
|
-
import {
|
|
49
|
+
import { useProvidedId, htmlid } from "../utils/id.js"
|
|
47
50
|
import { useActivePress } from "../hooks/use-active-press.svelte.js"
|
|
48
51
|
import { useFocusRing } from "../hooks/use-focus-ring.svelte.js"
|
|
49
52
|
import FormFields from "../internal/FormFields.svelte"
|
|
@@ -56,11 +59,11 @@
|
|
|
56
59
|
import { useControllable } from "../hooks/use-controllable.svelte.js"
|
|
57
60
|
|
|
58
61
|
const internalId = htmlid()
|
|
59
|
-
const providedId =
|
|
62
|
+
const providedId = useProvidedId()
|
|
60
63
|
const providedDisabled = useDisabled()
|
|
61
64
|
|
|
62
65
|
let {
|
|
63
|
-
|
|
66
|
+
element = $bindable(),
|
|
64
67
|
id = providedId || `headlessui-checkbox-${internalId}`,
|
|
65
68
|
disabled: theirDisabled = false,
|
|
66
69
|
autofocus = false,
|
|
@@ -72,7 +75,7 @@
|
|
|
72
75
|
form,
|
|
73
76
|
indeterminate = false,
|
|
74
77
|
...theirProps
|
|
75
|
-
}:
|
|
78
|
+
}: CheckboxProps<TType> = $props()
|
|
76
79
|
|
|
77
80
|
const defaultChecked = _defaultChecked
|
|
78
81
|
const controllable = useControllable(
|
|
@@ -89,7 +92,7 @@
|
|
|
89
92
|
)
|
|
90
93
|
const { value: checked, onchange } = $derived(controllable)
|
|
91
94
|
|
|
92
|
-
const disabled = $derived(providedDisabled
|
|
95
|
+
const disabled = $derived(providedDisabled.current || theirDisabled)
|
|
93
96
|
|
|
94
97
|
const { isHovered: hover, hoverProps } = $derived(
|
|
95
98
|
useHover({
|
|
@@ -189,12 +192,13 @@
|
|
|
189
192
|
onReset={reset}
|
|
190
193
|
/>
|
|
191
194
|
{/if}
|
|
195
|
+
|
|
192
196
|
<ElementOrComponent
|
|
193
197
|
{ourProps}
|
|
194
198
|
{theirProps}
|
|
195
199
|
{slot}
|
|
196
200
|
defaultTag={DEFAULT_CHECKBOX_TAG}
|
|
197
201
|
name="Checkbox"
|
|
198
|
-
bind:
|
|
202
|
+
bind:element
|
|
199
203
|
bind:value
|
|
200
204
|
/>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare
|
|
3
|
-
type CheckboxRenderPropArg = {
|
|
1
|
+
import type { Props } from "../utils/types.js";
|
|
2
|
+
declare const DEFAULT_CHECKBOX_TAG: "span";
|
|
3
|
+
export type CheckboxRenderPropArg = {
|
|
4
4
|
checked: boolean;
|
|
5
5
|
changing: boolean;
|
|
6
6
|
focus: boolean;
|
|
@@ -10,8 +10,8 @@ type CheckboxRenderPropArg = {
|
|
|
10
10
|
disabled: boolean;
|
|
11
11
|
indeterminate: boolean;
|
|
12
12
|
};
|
|
13
|
-
type
|
|
14
|
-
|
|
13
|
+
export type CheckboxOwnProps<TType = string> = {
|
|
14
|
+
element?: HTMLElement;
|
|
15
15
|
id?: string;
|
|
16
16
|
value?: TType;
|
|
17
17
|
disabled?: boolean;
|
|
@@ -22,43 +22,22 @@ export type CheckboxProps<TTag extends ElementType = typeof DEFAULT_CHECKBOX_TAG
|
|
|
22
22
|
form?: string;
|
|
23
23
|
name?: string;
|
|
24
24
|
onchange?: (checked: boolean) => void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
children?: import("../utils/types.js").Children<CheckboxRenderPropArg> | undefined;
|
|
31
|
-
ref?: HTMLElement;
|
|
32
|
-
} & (true extends (import("../utils/types.js").PropsOf<TTag> extends infer T_1 ? T_1 extends import("../utils/types.js").PropsOf<TTag> ? T_1 extends never ? never : "class" extends infer T_2 ? T_2 extends "class" ? T_2 extends keyof T_1 ? true : never : never : never : never : never) ? {
|
|
33
|
-
class?: import("../utils/types.js").PropsOf<TTag>["class"] | ((bag: CheckboxRenderPropArg) => string) | undefined;
|
|
34
|
-
} : {}) & {
|
|
35
|
-
id?: string;
|
|
36
|
-
value?: TType | undefined;
|
|
37
|
-
disabled?: boolean;
|
|
38
|
-
indeterminate?: boolean;
|
|
39
|
-
checked?: boolean;
|
|
40
|
-
defaultChecked?: boolean;
|
|
41
|
-
autofocus?: boolean;
|
|
42
|
-
form?: string;
|
|
43
|
-
name?: string;
|
|
44
|
-
onchange?: (checked: boolean) => void;
|
|
45
|
-
};
|
|
46
|
-
events(): {} & {
|
|
47
|
-
[evt: string]: CustomEvent<any>;
|
|
48
|
-
};
|
|
25
|
+
};
|
|
26
|
+
export type CheckboxProps<TType = string> = Props<typeof DEFAULT_CHECKBOX_TAG, CheckboxRenderPropArg, CheckboxOwnProps<TType>>;
|
|
27
|
+
declare class __sveltets_Render<TType> {
|
|
28
|
+
props(): CheckboxProps<TType>;
|
|
29
|
+
events(): {};
|
|
49
30
|
slots(): {};
|
|
50
|
-
bindings(): "
|
|
31
|
+
bindings(): "element" | "checked";
|
|
51
32
|
exports(): {};
|
|
52
33
|
}
|
|
53
34
|
interface $$IsomorphicComponent {
|
|
54
|
-
new <TType
|
|
55
|
-
$$bindings?: ReturnType<__sveltets_Render<TType
|
|
56
|
-
} & ReturnType<__sveltets_Render<TType
|
|
57
|
-
<TType
|
|
58
|
-
|
|
59
|
-
}): ReturnType<__sveltets_Render<TType, TTag>['exports']>;
|
|
60
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
35
|
+
new <TType>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TType>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TType>['props']>, ReturnType<__sveltets_Render<TType>['events']>, ReturnType<__sveltets_Render<TType>['slots']>> & {
|
|
36
|
+
$$bindings?: ReturnType<__sveltets_Render<TType>['bindings']>;
|
|
37
|
+
} & ReturnType<__sveltets_Render<TType>['exports']>;
|
|
38
|
+
<TType>(internal: unknown, props: ReturnType<__sveltets_Render<TType>['props']> & {}): ReturnType<__sveltets_Render<TType>['exports']>;
|
|
39
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
61
40
|
}
|
|
62
41
|
declare const Checkbox: $$IsomorphicComponent;
|
|
63
|
-
type Checkbox<TType
|
|
42
|
+
type Checkbox<TType> = InstanceType<typeof Checkbox<TType>>;
|
|
64
43
|
export default Checkbox;
|
package/dist/checkbox/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Checkbox, type CheckboxProps } from "./Checkbox.svelte";
|
|
1
|
+
export { default as Checkbox, type CheckboxProps, type CheckboxRenderPropArg as CheckboxSlot, type CheckboxOwnProps, } from "./Checkbox.svelte";
|
package/dist/checkbox/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as Checkbox } from "./Checkbox.svelte";
|
|
1
|
+
export { default as Checkbox, } from "./Checkbox.svelte";
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
2
|
import Button, { type ButtonProps } from "../button/Button.svelte"
|
|
3
3
|
import { useClose } from "../internal/close-provider.js"
|
|
4
|
-
import type { ElementType } from "../utils/types.js"
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type CloseButtonProps<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = ButtonProps<TTag>
|
|
5
|
+
export type CloseButtonProps = ButtonProps
|
|
9
6
|
</script>
|
|
10
7
|
|
|
11
|
-
<script lang="ts"
|
|
8
|
+
<script lang="ts">
|
|
12
9
|
const closeContext = useClose()
|
|
13
10
|
const close = $derived(closeContext?.close)
|
|
14
|
-
let { ...props }:
|
|
11
|
+
let { element = $bindable(), ...props }: CloseButtonProps = $props()
|
|
15
12
|
</script>
|
|
16
13
|
|
|
17
|
-
<Button onclick={close}
|
|
14
|
+
<Button {...props} onclick={close} bind:element />
|
|
@@ -1,48 +1,5 @@
|
|
|
1
1
|
import { type ButtonProps } from "../button/Button.svelte";
|
|
2
|
-
|
|
3
|
-
declare
|
|
4
|
-
|
|
5
|
-
declare class __sveltets_Render<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> {
|
|
6
|
-
props(): {
|
|
7
|
-
as?: TTag | undefined;
|
|
8
|
-
} & (Exclude<keyof import("../utils/types.js").PropsOf<TTag>, ("as" | "children" | "refName" | "class") | "disabled" | "autofocus" | "type"> extends infer T extends keyof import("../utils/types.js").PropsOf<TTag> ? { [P in T]: import("../utils/types.js").PropsOf<TTag>[P]; } : never) & {
|
|
9
|
-
children?: import("../utils/types.js").Children<{
|
|
10
|
-
disabled: boolean;
|
|
11
|
-
hover: boolean;
|
|
12
|
-
focus: boolean;
|
|
13
|
-
active: boolean;
|
|
14
|
-
autofocus: boolean;
|
|
15
|
-
}> | undefined;
|
|
16
|
-
ref?: HTMLElement;
|
|
17
|
-
} & (true extends (import("../utils/types.js").PropsOf<TTag> extends infer T_1 ? T_1 extends import("../utils/types.js").PropsOf<TTag> ? T_1 extends never ? never : "class" extends infer T_2 ? T_2 extends "class" ? T_2 extends keyof T_1 ? true : never : never : never : never : never) ? {
|
|
18
|
-
class?: import("../utils/types.js").PropsOf<TTag>["class"] | ((bag: {
|
|
19
|
-
disabled: boolean;
|
|
20
|
-
hover: boolean;
|
|
21
|
-
focus: boolean;
|
|
22
|
-
active: boolean;
|
|
23
|
-
autofocus: boolean;
|
|
24
|
-
}) => string) | undefined;
|
|
25
|
-
} : {}) & {
|
|
26
|
-
disabled?: boolean;
|
|
27
|
-
autofocus?: boolean;
|
|
28
|
-
type?: "button" | "submit" | "reset";
|
|
29
|
-
};
|
|
30
|
-
events(): {} & {
|
|
31
|
-
[evt: string]: CustomEvent<any>;
|
|
32
|
-
};
|
|
33
|
-
slots(): {};
|
|
34
|
-
bindings(): "";
|
|
35
|
-
exports(): {};
|
|
36
|
-
}
|
|
37
|
-
interface $$IsomorphicComponent {
|
|
38
|
-
new <TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TTag>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TTag>['props']>, ReturnType<__sveltets_Render<TTag>['events']>, ReturnType<__sveltets_Render<TTag>['slots']>> & {
|
|
39
|
-
$$bindings?: ReturnType<__sveltets_Render<TTag>['bindings']>;
|
|
40
|
-
} & ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
41
|
-
<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG>(internal: unknown, props: ReturnType<__sveltets_Render<TTag>['props']> & {
|
|
42
|
-
$$events?: ReturnType<__sveltets_Render<TTag>['events']>;
|
|
43
|
-
}): ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
44
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
45
|
-
}
|
|
46
|
-
declare const CloseButton: $$IsomorphicComponent;
|
|
47
|
-
type CloseButton<TTag extends ElementType = typeof DEFAULT_BUTTON_TAG> = InstanceType<typeof CloseButton<TTag>>;
|
|
2
|
+
export type CloseButtonProps = ButtonProps;
|
|
3
|
+
declare const CloseButton: import("svelte").Component<ButtonProps, {}, "element">;
|
|
4
|
+
type CloseButton = ReturnType<typeof CloseButton>;
|
|
48
5
|
export default CloseButton;
|
|
@@ -1,33 +1,24 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { PropsAsChild } from "../utils/types.js"
|
|
3
3
|
import { useFocusRing } from "../hooks/use-focus-ring.svelte.js"
|
|
4
4
|
import { useActivePress } from "../hooks/use-active-press.svelte.js"
|
|
5
|
-
import type { Snippet } from "svelte"
|
|
6
5
|
import { useHover } from "../hooks/use-hover.svelte.js"
|
|
7
6
|
import { mergeProps } from "../utils/render.js"
|
|
8
7
|
import ElementOrComponent from "../utils/ElementOrComponent.svelte"
|
|
9
8
|
|
|
10
9
|
const DEFAULT_DATA_INTERACTIVE_TAG = "svelte:fragment" as const
|
|
11
10
|
|
|
12
|
-
type DataInteractiveRenderPropArg = {
|
|
11
|
+
export type DataInteractiveRenderPropArg = {
|
|
13
12
|
hover: boolean
|
|
14
13
|
focus: boolean
|
|
15
14
|
active: boolean
|
|
16
15
|
}
|
|
17
|
-
type DataInteractivePropsWeControl = never
|
|
18
16
|
|
|
19
|
-
export type DataInteractiveProps
|
|
20
|
-
TTag,
|
|
21
|
-
DataInteractiveRenderPropArg,
|
|
22
|
-
DataInteractivePropsWeControl,
|
|
23
|
-
{}
|
|
24
|
-
>
|
|
25
|
-
|
|
26
|
-
export type DataInteractiveChildren = Snippet<[DataInteractiveRenderPropArg]>
|
|
17
|
+
export type DataInteractiveProps = PropsAsChild<DataInteractiveRenderPropArg>
|
|
27
18
|
</script>
|
|
28
19
|
|
|
29
|
-
<script lang="ts"
|
|
30
|
-
let {
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
let { ...theirProps }: DataInteractiveProps = $props()
|
|
31
22
|
|
|
32
23
|
// Ideally we can use a `disabled` prop, but that would depend on the props of the child element
|
|
33
24
|
// and we don't have access to that in this component.
|
|
@@ -59,11 +50,4 @@
|
|
|
59
50
|
const ourProps = $derived(mergeProps(focusProps, hoverProps, pressProps))
|
|
60
51
|
</script>
|
|
61
52
|
|
|
62
|
-
<ElementOrComponent
|
|
63
|
-
{ourProps}
|
|
64
|
-
{theirProps}
|
|
65
|
-
{slot}
|
|
66
|
-
defaultTag={DEFAULT_DATA_INTERACTIVE_TAG}
|
|
67
|
-
name="DataInteractive"
|
|
68
|
-
bind:ref
|
|
69
|
-
/>
|
|
53
|
+
<ElementOrComponent {ourProps} {theirProps} {slot} name="DataInteractive" />
|
|
@@ -1,39 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
declare const DEFAULT_DATA_INTERACTIVE_TAG: "svelte:fragment";
|
|
4
|
-
type DataInteractiveRenderPropArg = {
|
|
1
|
+
import type { PropsAsChild } from "../utils/types.js";
|
|
2
|
+
export type DataInteractiveRenderPropArg = {
|
|
5
3
|
hover: boolean;
|
|
6
4
|
focus: boolean;
|
|
7
5
|
active: boolean;
|
|
8
6
|
};
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
children?: import("../utils/types.js").Children<DataInteractiveRenderPropArg> | undefined;
|
|
17
|
-
ref?: HTMLElement;
|
|
18
|
-
} & (true extends (import("../utils/types.js").PropsOf<TTag> extends infer T_1 ? T_1 extends import("../utils/types.js").PropsOf<TTag> ? T_1 extends never ? never : "class" extends infer T_2 ? T_2 extends "class" ? T_2 extends keyof T_1 ? true : never : never : never : never : never) ? {
|
|
19
|
-
class?: import("../utils/types.js").PropsOf<TTag>["class"] | ((bag: DataInteractiveRenderPropArg) => string) | undefined;
|
|
20
|
-
} : {});
|
|
21
|
-
events(): {} & {
|
|
22
|
-
[evt: string]: CustomEvent<any>;
|
|
23
|
-
};
|
|
24
|
-
slots(): {};
|
|
25
|
-
bindings(): "ref";
|
|
26
|
-
exports(): {};
|
|
27
|
-
}
|
|
28
|
-
interface $$IsomorphicComponent {
|
|
29
|
-
new <TTag extends ElementType = typeof DEFAULT_DATA_INTERACTIVE_TAG>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TTag>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TTag>['props']>, ReturnType<__sveltets_Render<TTag>['events']>, ReturnType<__sveltets_Render<TTag>['slots']>> & {
|
|
30
|
-
$$bindings?: ReturnType<__sveltets_Render<TTag>['bindings']>;
|
|
31
|
-
} & ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
32
|
-
<TTag extends ElementType = typeof DEFAULT_DATA_INTERACTIVE_TAG>(internal: unknown, props: ReturnType<__sveltets_Render<TTag>['props']> & {
|
|
33
|
-
$$events?: ReturnType<__sveltets_Render<TTag>['events']>;
|
|
34
|
-
}): ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
35
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
36
|
-
}
|
|
37
|
-
declare const DataInteractive: $$IsomorphicComponent;
|
|
38
|
-
type DataInteractive<TTag extends ElementType = typeof DEFAULT_DATA_INTERACTIVE_TAG> = InstanceType<typeof DataInteractive<TTag>>;
|
|
7
|
+
export type DataInteractiveProps = PropsAsChild<DataInteractiveRenderPropArg>;
|
|
8
|
+
declare const DataInteractive: import("svelte").Component<{
|
|
9
|
+
children?: import("svelte").Snippet<[DataInteractiveRenderPropArg & {
|
|
10
|
+
props?: Record<string, any>;
|
|
11
|
+
}]> | undefined;
|
|
12
|
+
}, {}, "">;
|
|
13
|
+
type DataInteractive = ReturnType<typeof DataInteractive>;
|
|
39
14
|
export default DataInteractive;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as DataInteractive, type DataInteractiveProps } from "./DataInteractive.svelte";
|
|
1
|
+
export { default as DataInteractive, type DataInteractiveProps, type DataInteractiveRenderPropArg as DataInteractiveSlot, } from "./DataInteractive.svelte";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default as DataInteractive } from "./DataInteractive.svelte";
|
|
1
|
+
export { default as DataInteractive, } from "./DataInteractive.svelte";
|
|
@@ -1,39 +1,44 @@
|
|
|
1
1
|
<script lang="ts" module>
|
|
2
|
-
import type {
|
|
2
|
+
import type { Props } from "../utils/types.js"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
const DEFAULT_DESCRIPTION_TAG = "p" as const
|
|
5
5
|
|
|
6
|
-
export type
|
|
6
|
+
export type DescriptionOwnProps = {
|
|
7
|
+
id?: string
|
|
8
|
+
element?: HTMLElement
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type DescriptionProps = Props<typeof DEFAULT_DESCRIPTION_TAG, {}, DescriptionOwnProps>
|
|
7
12
|
</script>
|
|
8
13
|
|
|
9
|
-
<script lang="ts"
|
|
10
|
-
import {
|
|
11
|
-
import { stateFromSlot } from "../utils/state.js"
|
|
14
|
+
<script lang="ts">
|
|
15
|
+
import { useId } from "../hooks/use-id.js"
|
|
12
16
|
import { useDisabled } from "../hooks/use-disabled.js"
|
|
13
|
-
import { onMount } from "svelte"
|
|
14
17
|
import { useDescriptionContext } from "./context.svelte.js"
|
|
18
|
+
import ElementOrComponent from "../utils/ElementOrComponent.svelte"
|
|
19
|
+
import { untrack } from "svelte"
|
|
15
20
|
|
|
16
|
-
const internalId =
|
|
21
|
+
const internalId = useId()
|
|
17
22
|
const providedDisabled = useDisabled()
|
|
18
23
|
|
|
19
|
-
let {
|
|
20
|
-
as,
|
|
21
|
-
id = `headlessui-description-${internalId}` as PropsOf<TTag>["id"],
|
|
22
|
-
children,
|
|
23
|
-
...theirProps
|
|
24
|
-
}: { as?: TTag } & DescriptionProps<TTag> = $props()
|
|
25
|
-
|
|
26
|
-
const context = useDescriptionContext()
|
|
24
|
+
let { element = $bindable(), id = `headlessui-description-${internalId}`, ...theirProps }: DescriptionProps = $props()
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
const { register } = useDescriptionContext()
|
|
27
|
+
$effect(() => {
|
|
28
|
+
id
|
|
29
|
+
return untrack(() => register(id))
|
|
30
30
|
})
|
|
31
31
|
|
|
32
|
-
const disabled = $derived(providedDisabled.
|
|
32
|
+
const disabled = $derived(providedDisabled.current || false)
|
|
33
33
|
const slot = $derived({ disabled })
|
|
34
|
-
const ourProps = $derived({ id
|
|
34
|
+
const ourProps = $derived({ id })
|
|
35
35
|
</script>
|
|
36
36
|
|
|
37
|
-
<
|
|
38
|
-
{
|
|
39
|
-
|
|
37
|
+
<ElementOrComponent
|
|
38
|
+
{ourProps}
|
|
39
|
+
{theirProps}
|
|
40
|
+
slots={slot}
|
|
41
|
+
defaultTag={DEFAULT_DESCRIPTION_TAG}
|
|
42
|
+
name="Description"
|
|
43
|
+
bind:element
|
|
44
|
+
/>
|
|
@@ -1,31 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
declare
|
|
3
|
-
export type
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} & (true extends (PropsOf<TTag> extends infer T_1 ? T_1 extends PropsOf<TTag> ? T_1 extends never ? never : "class" extends infer T_2 ? T_2 extends "class" ? T_2 extends keyof T_1 ? true : never : never : never : never : never) ? {
|
|
11
|
-
class?: PropsOf<TTag>["class"] | ((bag: {}) => string) | undefined;
|
|
12
|
-
} : {});
|
|
13
|
-
events(): {} & {
|
|
14
|
-
[evt: string]: CustomEvent<any>;
|
|
15
|
-
};
|
|
16
|
-
slots(): {};
|
|
17
|
-
bindings(): "";
|
|
18
|
-
exports(): {};
|
|
19
|
-
}
|
|
20
|
-
interface $$IsomorphicComponent {
|
|
21
|
-
new <TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TTag>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TTag>['props']>, ReturnType<__sveltets_Render<TTag>['events']>, ReturnType<__sveltets_Render<TTag>['slots']>> & {
|
|
22
|
-
$$bindings?: ReturnType<__sveltets_Render<TTag>['bindings']>;
|
|
23
|
-
} & ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
24
|
-
<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG>(internal: unknown, props: ReturnType<__sveltets_Render<TTag>['props']> & {
|
|
25
|
-
$$events?: ReturnType<__sveltets_Render<TTag>['events']>;
|
|
26
|
-
}): ReturnType<__sveltets_Render<TTag>['exports']>;
|
|
27
|
-
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
28
|
-
}
|
|
29
|
-
declare const Description: $$IsomorphicComponent;
|
|
30
|
-
type Description<TTag extends ElementType = typeof DEFAULT_DESCRIPTION_TAG> = InstanceType<typeof Description<TTag>>;
|
|
1
|
+
import type { Props } from "../utils/types.js";
|
|
2
|
+
declare const DEFAULT_DESCRIPTION_TAG: "p";
|
|
3
|
+
export type DescriptionOwnProps = {
|
|
4
|
+
id?: string;
|
|
5
|
+
element?: HTMLElement;
|
|
6
|
+
};
|
|
7
|
+
export type DescriptionProps = Props<typeof DEFAULT_DESCRIPTION_TAG, {}, DescriptionOwnProps>;
|
|
8
|
+
declare const Description: import("svelte").Component<DescriptionProps, {}, "element">;
|
|
9
|
+
type Description = ReturnType<typeof Description>;
|
|
31
10
|
export default Description;
|