@adriansyah/heroui-svelte 0.0.0-stage → 0.0.2
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/README.md +38 -2
- package/dist/components/autocomplete/autocomplete-clear-button.svelte +24 -0
- package/dist/components/autocomplete/autocomplete-clear-button.svelte.d.ts +3 -0
- package/dist/components/autocomplete/autocomplete-filter.svelte +16 -0
- package/dist/components/autocomplete/autocomplete-filter.svelte.d.ts +6 -0
- package/dist/components/autocomplete/autocomplete-indicator.svelte +21 -0
- package/dist/components/autocomplete/autocomplete-indicator.svelte.d.ts +7 -0
- package/dist/components/autocomplete/autocomplete-popover.svelte +19 -0
- package/dist/components/autocomplete/autocomplete-popover.svelte.d.ts +4 -0
- package/dist/components/autocomplete/autocomplete-trigger.svelte +28 -0
- package/dist/components/autocomplete/autocomplete-trigger.svelte.d.ts +6 -0
- package/dist/components/autocomplete/autocomplete-value.svelte +65 -0
- package/dist/components/autocomplete/autocomplete-value.svelte.d.ts +9 -0
- package/dist/components/autocomplete/autocomplete.svelte +52 -0
- package/dist/components/autocomplete/autocomplete.svelte.d.ts +9 -0
- package/dist/components/autocomplete/index.d.ts +8 -0
- package/dist/components/autocomplete/index.js +8 -0
- package/dist/components/autocomplete/index.svelte.d.ts +26 -0
- package/dist/components/autocomplete/index.svelte.js +69 -0
- package/dist/components/avatar/avatar-fallback.svelte +19 -0
- package/dist/components/avatar/avatar-fallback.svelte.d.ts +6 -0
- package/dist/components/avatar/avatar-image.svelte +18 -0
- package/dist/components/avatar/avatar-image.svelte.d.ts +4 -0
- package/dist/components/avatar/avatar.svelte +16 -0
- package/dist/components/avatar/avatar.svelte.d.ts +6 -0
- package/dist/components/avatar/context.svelte.d.ts +7 -0
- package/dist/components/avatar/context.svelte.js +8 -0
- package/dist/components/avatar/index.d.ts +4 -0
- package/dist/components/avatar/index.js +4 -0
- package/dist/components/button/button.svelte +51 -0
- package/dist/components/button/button.svelte.d.ts +6 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +2 -0
- package/dist/components/button/index.svelte.d.ts +27 -0
- package/dist/components/button/index.svelte.js +28 -0
- package/dist/components/button-group/button-group-separator.svelte +20 -0
- package/dist/components/button-group/button-group-separator.svelte.d.ts +5 -0
- package/dist/components/button-group/button-group.svelte +20 -0
- package/dist/components/button-group/button-group.svelte.d.ts +6 -0
- package/dist/components/button-group/context.svelte.d.ts +7 -0
- package/dist/components/button-group/context.svelte.js +8 -0
- package/dist/components/button-group/index.d.ts +3 -0
- package/dist/components/button-group/index.js +3 -0
- package/dist/components/card/card-content.svelte +19 -0
- package/dist/components/card/card-content.svelte.d.ts +5 -0
- package/dist/components/card/card-description.svelte +19 -0
- package/dist/components/card/card-description.svelte.d.ts +5 -0
- package/dist/components/card/card-footer.svelte +19 -0
- package/dist/components/card/card-footer.svelte.d.ts +5 -0
- package/dist/components/card/card-header.svelte +19 -0
- package/dist/components/card/card-header.svelte.d.ts +5 -0
- package/dist/components/card/card-title.svelte +19 -0
- package/dist/components/card/card-title.svelte.d.ts +5 -0
- package/dist/components/card/card.svelte +22 -0
- package/dist/components/card/card.svelte.d.ts +6 -0
- package/dist/components/card/context.svelte.d.ts +6 -0
- package/dist/components/card/context.svelte.js +8 -0
- package/dist/components/card/index.d.ts +7 -0
- package/dist/components/card/index.js +7 -0
- package/dist/components/checkbox/checkbox-content.svelte +26 -0
- package/dist/components/checkbox/checkbox-content.svelte.d.ts +4 -0
- package/dist/components/checkbox/checkbox-control.svelte +25 -0
- package/dist/components/checkbox/checkbox-control.svelte.d.ts +5 -0
- package/dist/components/checkbox/checkbox-indicator.svelte +54 -0
- package/dist/components/checkbox/checkbox-indicator.svelte.d.ts +5 -0
- package/dist/components/checkbox/checkbox.svelte +60 -0
- package/dist/components/checkbox/checkbox.svelte.d.ts +8 -0
- package/dist/components/checkbox/index.d.ts +4 -0
- package/dist/components/checkbox/index.js +4 -0
- package/dist/components/close-button/close-button.svelte +17 -0
- package/dist/components/close-button/close-button.svelte.d.ts +4 -0
- package/dist/components/close-button/index.d.ts +1 -0
- package/dist/components/close-button/index.js +1 -0
- package/dist/components/collection/collection.svelte +77 -0
- package/dist/components/collection/collection.svelte.d.ts +47 -0
- package/dist/components/collection/index.d.ts +1 -0
- package/dist/components/collection/index.js +1 -0
- package/dist/components/description/description.svelte +16 -0
- package/dist/components/description/description.svelte.d.ts +6 -0
- package/dist/components/description/index.d.ts +1 -0
- package/dist/components/description/index.js +1 -0
- package/dist/components/empty-state/empty-state.svelte +16 -0
- package/dist/components/empty-state/empty-state.svelte.d.ts +6 -0
- package/dist/components/empty-state/index.d.ts +1 -0
- package/dist/components/empty-state/index.js +1 -0
- package/dist/components/field-error/field-error.svelte +29 -0
- package/dist/components/field-error/field-error.svelte.d.ts +8 -0
- package/dist/components/field-error/index.d.ts +1 -0
- package/dist/components/field-error/index.js +1 -0
- package/dist/components/fieldset/fieldset-actions.svelte +16 -0
- package/dist/components/fieldset/fieldset-actions.svelte.d.ts +5 -0
- package/dist/components/fieldset/fieldset-group.svelte +16 -0
- package/dist/components/fieldset/fieldset-group.svelte.d.ts +5 -0
- package/dist/components/fieldset/fieldset-legend.svelte +16 -0
- package/dist/components/fieldset/fieldset-legend.svelte.d.ts +5 -0
- package/dist/components/fieldset/fieldset.svelte +16 -0
- package/dist/components/fieldset/fieldset.svelte.d.ts +5 -0
- package/dist/components/fieldset/index.d.ts +4 -0
- package/dist/components/fieldset/index.js +4 -0
- package/dist/components/filter/filter-not-found.svelte +11 -0
- package/dist/components/filter/filter-not-found.svelte.d.ts +5 -0
- package/dist/components/filter/filter-provider.svelte +22 -0
- package/dist/components/filter/filter-provider.svelte.d.ts +9 -0
- package/dist/components/filter/index.d.ts +3 -0
- package/dist/components/filter/index.js +3 -0
- package/dist/components/filter/index.svelte.d.ts +17 -0
- package/dist/components/filter/index.svelte.js +52 -0
- package/dist/components/header/header.svelte +16 -0
- package/dist/components/header/header.svelte.d.ts +6 -0
- package/dist/components/header/index.d.ts +1 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +2 -0
- package/dist/components/input/index.svelte.d.ts +32 -0
- package/dist/components/input/index.svelte.js +48 -0
- package/dist/components/input/input.svelte +66 -0
- package/dist/components/input/input.svelte.d.ts +8 -0
- package/dist/components/input-group/index.d.ts +5 -0
- package/dist/components/input-group/index.js +5 -0
- package/dist/components/input-group/input-group-input.svelte +32 -0
- package/dist/components/input-group/input-group-input.svelte.d.ts +11 -0
- package/dist/components/input-group/input-group-prefix.svelte +24 -0
- package/dist/components/input-group/input-group-prefix.svelte.d.ts +5 -0
- package/dist/components/input-group/input-group-suffix.svelte +24 -0
- package/dist/components/input-group/input-group-suffix.svelte.d.ts +5 -0
- package/dist/components/input-group/input-group-textarea.svelte +32 -0
- package/dist/components/input-group/input-group-textarea.svelte.d.ts +8 -0
- package/dist/components/input-group/input-group.svelte +63 -0
- package/dist/components/input-group/input-group.svelte.d.ts +9 -0
- package/dist/components/label/index.d.ts +1 -0
- package/dist/components/label/index.js +1 -0
- package/dist/components/label/label.svelte +25 -0
- package/dist/components/label/label.svelte.d.ts +9 -0
- package/dist/components/list-box/index.d.ts +5 -0
- package/dist/components/list-box/index.js +5 -0
- package/dist/components/list-box/index.svelte.d.ts +17 -0
- package/dist/components/list-box/index.svelte.js +25 -0
- package/dist/components/list-box/list-box-item-indicator.svelte +37 -0
- package/dist/components/list-box/list-box-item-indicator.svelte.d.ts +4 -0
- package/dist/components/list-box/list-box-item.svelte +83 -0
- package/dist/components/list-box/list-box-item.svelte.d.ts +9 -0
- package/dist/components/list-box/list-box-section.svelte +13 -0
- package/dist/components/list-box/list-box-section.svelte.d.ts +4 -0
- package/dist/components/list-box/list-box.svelte +39 -0
- package/dist/components/list-box/list-box.svelte.d.ts +8 -0
- package/dist/components/modal/index.d.ts +14 -0
- package/dist/components/modal/index.js +14 -0
- package/dist/components/modal/index.svelte.d.ts +15 -0
- package/dist/components/modal/index.svelte.js +16 -0
- package/dist/components/modal/modal-backdrop.svelte +28 -0
- package/dist/components/modal/modal-backdrop.svelte.d.ts +5 -0
- package/dist/components/modal/modal-body.svelte +16 -0
- package/dist/components/modal/modal-body.svelte.d.ts +4 -0
- package/dist/components/modal/modal-close-trigger.svelte +35 -0
- package/dist/components/modal/modal-close-trigger.svelte.d.ts +4 -0
- package/dist/components/modal/modal-container.svelte +34 -0
- package/dist/components/modal/modal-container.svelte.d.ts +4 -0
- package/dist/components/modal/modal-content-template.svelte +19 -0
- package/dist/components/modal/modal-content-template.svelte.d.ts +3 -0
- package/dist/components/modal/modal-content.svelte +30 -0
- package/dist/components/modal/modal-content.svelte.d.ts +4 -0
- package/dist/components/modal/modal-dialog.svelte +17 -0
- package/dist/components/modal/modal-dialog.svelte.d.ts +4 -0
- package/dist/components/modal/modal-footer.svelte +16 -0
- package/dist/components/modal/modal-footer.svelte.d.ts +4 -0
- package/dist/components/modal/modal-header.svelte +18 -0
- package/dist/components/modal/modal-header.svelte.d.ts +4 -0
- package/dist/components/modal/modal-heading.svelte +18 -0
- package/dist/components/modal/modal-heading.svelte.d.ts +4 -0
- package/dist/components/modal/modal-icon.svelte +18 -0
- package/dist/components/modal/modal-icon.svelte.d.ts +4 -0
- package/dist/components/modal/modal-trigger.svelte +23 -0
- package/dist/components/modal/modal-trigger.svelte.d.ts +8 -0
- package/dist/components/modal/modal.svelte +21 -0
- package/dist/components/modal/modal.svelte.d.ts +6 -0
- package/dist/components/pagination/index.d.ts +11 -0
- package/dist/components/pagination/index.js +11 -0
- package/dist/components/pagination/index.svelte.d.ts +26 -0
- package/dist/components/pagination/index.svelte.js +59 -0
- package/dist/components/pagination/pagination-content.svelte +17 -0
- package/dist/components/pagination/pagination-content.svelte.d.ts +4 -0
- package/dist/components/pagination/pagination-ellipsis.svelte +18 -0
- package/dist/components/pagination/pagination-ellipsis.svelte.d.ts +4 -0
- package/dist/components/pagination/pagination-item.svelte +24 -0
- package/dist/components/pagination/pagination-item.svelte.d.ts +9 -0
- package/dist/components/pagination/pagination-link.svelte +26 -0
- package/dist/components/pagination/pagination-link.svelte.d.ts +7 -0
- package/dist/components/pagination/pagination-next-icon.svelte +10 -0
- package/dist/components/pagination/pagination-next-icon.svelte.d.ts +4 -0
- package/dist/components/pagination/pagination-next.svelte +23 -0
- package/dist/components/pagination/pagination-next.svelte.d.ts +4 -0
- package/dist/components/pagination/pagination-previous-icon.svelte +10 -0
- package/dist/components/pagination/pagination-previous-icon.svelte.d.ts +4 -0
- package/dist/components/pagination/pagination-previous.svelte +23 -0
- package/dist/components/pagination/pagination-previous.svelte.d.ts +4 -0
- package/dist/components/pagination/pagination-summary.svelte +23 -0
- package/dist/components/pagination/pagination-summary.svelte.d.ts +9 -0
- package/dist/components/pagination/pagination.svelte +40 -0
- package/dist/components/pagination/pagination.svelte.d.ts +8 -0
- package/dist/components/popover/index.d.ts +7 -0
- package/dist/components/popover/index.js +7 -0
- package/dist/components/popover/index.svelte.d.ts +23 -0
- package/dist/components/popover/index.svelte.js +51 -0
- package/dist/components/popover/popover-arrow.svelte +42 -0
- package/dist/components/popover/popover-arrow.svelte.d.ts +4 -0
- package/dist/components/popover/popover-content.svelte +31 -0
- package/dist/components/popover/popover-content.svelte.d.ts +5 -0
- package/dist/components/popover/popover-dialog.svelte +13 -0
- package/dist/components/popover/popover-dialog.svelte.d.ts +4 -0
- package/dist/components/popover/popover-heading.svelte +15 -0
- package/dist/components/popover/popover-heading.svelte.d.ts +4 -0
- package/dist/components/popover/popover-trigger.svelte +17 -0
- package/dist/components/popover/popover-trigger.svelte.d.ts +9 -0
- package/dist/components/popover/popover.svelte +33 -0
- package/dist/components/popover/popover.svelte.d.ts +11 -0
- package/dist/components/search-input/index.d.ts +1 -0
- package/dist/components/search-input/index.js +1 -0
- package/dist/components/search-input/search-input.svelte +92 -0
- package/dist/components/search-input/search-input.svelte.d.ts +9 -0
- package/dist/components/separator/index.d.ts +1 -0
- package/dist/components/separator/index.js +1 -0
- package/dist/components/separator/separator.svelte +9 -0
- package/dist/components/separator/separator.svelte.d.ts +6 -0
- package/dist/components/spinner/index.d.ts +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/spinner.svelte +59 -0
- package/dist/components/spinner/spinner.svelte.d.ts +9 -0
- package/dist/components/surface/index.d.ts +1 -0
- package/dist/components/surface/index.js +1 -0
- package/dist/components/surface/surface.svelte +15 -0
- package/dist/components/surface/surface.svelte.d.ts +6 -0
- package/dist/components/table/index.d.ts +11 -0
- package/dist/components/table/index.js +11 -0
- package/dist/components/table/index.svelte.d.ts +10 -0
- package/dist/components/table/index.svelte.js +13 -0
- package/dist/components/table/table-body.svelte +20 -0
- package/dist/components/table/table-body.svelte.d.ts +5 -0
- package/dist/components/table/table-cell.svelte +21 -0
- package/dist/components/table/table-cell.svelte.d.ts +4 -0
- package/dist/components/table/table-column.svelte +22 -0
- package/dist/components/table/table-column.svelte.d.ts +6 -0
- package/dist/components/table/table-content.svelte +21 -0
- package/dist/components/table/table-content.svelte.d.ts +6 -0
- package/dist/components/table/table-empty-state.svelte +13 -0
- package/dist/components/table/table-empty-state.svelte.d.ts +26 -0
- package/dist/components/table/table-footer.svelte +21 -0
- package/dist/components/table/table-footer.svelte.d.ts +5 -0
- package/dist/components/table/table-header.svelte +23 -0
- package/dist/components/table/table-header.svelte.d.ts +6 -0
- package/dist/components/table/table-row.svelte +26 -0
- package/dist/components/table/table-row.svelte.d.ts +8 -0
- package/dist/components/table/table-scroll-container.svelte +20 -0
- package/dist/components/table/table-scroll-container.svelte.d.ts +6 -0
- package/dist/components/table/table.svelte +18 -0
- package/dist/components/table/table.svelte.d.ts +8 -0
- package/dist/components/text-field/index.d.ts +1 -0
- package/dist/components/text-field/index.js +1 -0
- package/dist/components/text-field/text-field.svelte +60 -0
- package/dist/components/text-field/text-field.svelte.d.ts +9 -0
- package/dist/components/textarea/index.d.ts +1 -0
- package/dist/components/textarea/index.js +1 -0
- package/dist/components/textarea/textarea.svelte +27 -0
- package/dist/components/textarea/textarea.svelte.d.ts +8 -0
- package/dist/icons/arrow-icon.svelte +14 -0
- package/dist/icons/arrow-icon.svelte.d.ts +4 -0
- package/dist/icons/checkmark-icon.svelte +23 -0
- package/dist/icons/checkmark-icon.svelte.d.ts +7 -0
- package/dist/icons/chevron-down-icon.svelte +22 -0
- package/dist/icons/chevron-down-icon.svelte.d.ts +4 -0
- package/dist/icons/chevron-left-icon.svelte +22 -0
- package/dist/icons/chevron-left-icon.svelte.d.ts +4 -0
- package/dist/icons/chevron-right-icon.svelte +22 -0
- package/dist/icons/chevron-right-icon.svelte.d.ts +4 -0
- package/dist/icons/close-icon.svelte +22 -0
- package/dist/icons/close-icon.svelte.d.ts +4 -0
- package/dist/icons/dot-icon.svelte +21 -0
- package/dist/icons/dot-icon.svelte.d.ts +4 -0
- package/dist/icons/index.d.ts +8 -0
- package/dist/icons/index.js +8 -0
- package/dist/icons/search-icon.svelte +22 -0
- package/dist/icons/search-icon.svelte.d.ts +4 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +29 -0
- package/package.json +70 -5
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { coalesce, Context } from "svelte-utils";
|
|
2
|
+
import { ButtonGroupContext } from "../button-group/context.svelte";
|
|
3
|
+
export class ButtonContext extends Context {
|
|
4
|
+
opts;
|
|
5
|
+
constructor(opts) {
|
|
6
|
+
super();
|
|
7
|
+
const group = ButtonGroupContext.getOr();
|
|
8
|
+
this.opts = $derived.by(() => coalesce(group?.opts, opts()));
|
|
9
|
+
}
|
|
10
|
+
get props() {
|
|
11
|
+
return {
|
|
12
|
+
"data-disabled": this.opts.disabled,
|
|
13
|
+
"data-focused": this.opts.focused,
|
|
14
|
+
"data-pressed": this.opts.pressed,
|
|
15
|
+
"data-focus-visible": this.opts.focused,
|
|
16
|
+
"data-hovered": this.opts.hovered,
|
|
17
|
+
...(this.opts.pending ? { "data-pending": true } : {})
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
get heroui() {
|
|
21
|
+
return {
|
|
22
|
+
fullWidth: this.opts.fullWidth,
|
|
23
|
+
isIconOnly: this.opts.isIconOnly,
|
|
24
|
+
size: this.opts.size,
|
|
25
|
+
variant: this.opts.variant
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { ButtonGroupContext } from "./context.svelte";
|
|
4
|
+
import { buttonGroupVariants } from "@heroui/styles";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLSpanElement>;
|
|
7
|
+
const props: Props = $props();
|
|
8
|
+
|
|
9
|
+
const ctx = ButtonGroupContext.get();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<span
|
|
13
|
+
{...props}
|
|
14
|
+
aria-hidden="true"
|
|
15
|
+
data-slot="button-group-separator"
|
|
16
|
+
class={buttonGroupVariants().separator({
|
|
17
|
+
...ctx.opts,
|
|
18
|
+
class: props.class?.toString(),
|
|
19
|
+
})}
|
|
20
|
+
></span>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type Props = HTMLAttributes<HTMLSpanElement>;
|
|
3
|
+
declare const ButtonGroupSeparator: import("svelte").Component<Props, {}, "">;
|
|
4
|
+
type ButtonGroupSeparator = ReturnType<typeof ButtonGroupSeparator>;
|
|
5
|
+
export default ButtonGroupSeparator;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { ButtonGroupContext, type ButtonGroupOpts } from "./context.svelte";
|
|
4
|
+
import { buttonGroupVariants } from "@heroui/styles";
|
|
5
|
+
|
|
6
|
+
type Props = ButtonGroupOpts & HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
const props: Props = $props();
|
|
8
|
+
|
|
9
|
+
const ctx = new ButtonGroupContext(() => props);
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<div
|
|
13
|
+
{...props}
|
|
14
|
+
class={buttonGroupVariants().base({
|
|
15
|
+
...ctx.opts,
|
|
16
|
+
class: props.class?.toString(),
|
|
17
|
+
})}
|
|
18
|
+
>
|
|
19
|
+
{@render props.children?.()}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
import { type ButtonGroupOpts } from "./context.svelte";
|
|
3
|
+
type Props = ButtonGroupOpts & HTMLAttributes<HTMLDivElement>;
|
|
4
|
+
declare const ButtonGroup: import("svelte").Component<Props, {}, "">;
|
|
5
|
+
type ButtonGroup = ReturnType<typeof ButtonGroup>;
|
|
6
|
+
export default ButtonGroup;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ButtonVariants } from "@heroui/styles";
|
|
2
|
+
import { Context, type Getter } from "svelte-utils";
|
|
3
|
+
export type ButtonGroupOpts = ButtonVariants;
|
|
4
|
+
export declare class ButtonGroupContext extends Context {
|
|
5
|
+
readonly opts: ButtonGroupOpts;
|
|
6
|
+
constructor(opts: Getter<ButtonGroupOpts>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cardVariants } from "@heroui/styles";
|
|
4
|
+
import { CardContext } from "./context.svelte";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
|
|
8
|
+
const props: Props = $props();
|
|
9
|
+
|
|
10
|
+
const ctx = CardContext.get();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
{...props}
|
|
15
|
+
data-slot="card-content"
|
|
16
|
+
class={cardVariants().content({ ...ctx.opts, class: props.class?.toString() })}
|
|
17
|
+
>
|
|
18
|
+
{@render props.children?.()}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cardVariants } from "@heroui/styles";
|
|
4
|
+
import { CardContext } from "./context.svelte";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
|
|
8
|
+
const props: Props = $props();
|
|
9
|
+
|
|
10
|
+
const ctx = CardContext.get();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<p
|
|
14
|
+
{...props}
|
|
15
|
+
data-slot="card-description"
|
|
16
|
+
class={cardVariants().description({ ...ctx.opts, class: props.class?.toString() })}
|
|
17
|
+
>
|
|
18
|
+
{@render props.children?.()}
|
|
19
|
+
</p>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type Props = HTMLAttributes<HTMLDivElement>;
|
|
3
|
+
declare const CardDescription: import("svelte").Component<Props, {}, "">;
|
|
4
|
+
type CardDescription = ReturnType<typeof CardDescription>;
|
|
5
|
+
export default CardDescription;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cardVariants } from "@heroui/styles";
|
|
4
|
+
import { CardContext } from "./context.svelte";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
|
|
8
|
+
const props: Props = $props();
|
|
9
|
+
|
|
10
|
+
const ctx = CardContext.get();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
{...props}
|
|
15
|
+
data-slot="card-footer"
|
|
16
|
+
class={cardVariants().footer({ ...ctx.opts, class: props.class?.toString() })}
|
|
17
|
+
>
|
|
18
|
+
{@render props.children?.()}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cardVariants } from "@heroui/styles";
|
|
4
|
+
import { CardContext } from "./context.svelte";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLDivElement>;
|
|
7
|
+
|
|
8
|
+
const props: Props = $props();
|
|
9
|
+
|
|
10
|
+
const ctx = CardContext.get();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
{...props}
|
|
15
|
+
data-slot="card-header"
|
|
16
|
+
class={cardVariants().header({ ...ctx.opts, class: props.class?.toString() })}
|
|
17
|
+
>
|
|
18
|
+
{@render props.children?.()}
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import { cardVariants } from "@heroui/styles";
|
|
4
|
+
import { CardContext } from "./context.svelte";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLElement>;
|
|
7
|
+
|
|
8
|
+
const props: Props = $props();
|
|
9
|
+
|
|
10
|
+
const ctx = CardContext.get();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<h3
|
|
14
|
+
{...props}
|
|
15
|
+
data-slot="card-title"
|
|
16
|
+
class={cardVariants().title({ ...ctx.opts, class: props.class?.toString() })}
|
|
17
|
+
>
|
|
18
|
+
{@render props.children?.()}
|
|
19
|
+
</h3>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
3
|
+
import {
|
|
4
|
+
cardVariants,
|
|
5
|
+
type CardVariants,
|
|
6
|
+
} from "@heroui/styles";
|
|
7
|
+
import { CardContext } from "./context.svelte";
|
|
8
|
+
|
|
9
|
+
type Props = HTMLAttributes<HTMLDivElement> & CardVariants;
|
|
10
|
+
|
|
11
|
+
const props: Props = $props();
|
|
12
|
+
|
|
13
|
+
new CardContext(() => props);
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<div
|
|
17
|
+
{...props}
|
|
18
|
+
data-slot="label"
|
|
19
|
+
class={cardVariants().base({ ...props, class: props.class?.toString() })}
|
|
20
|
+
>
|
|
21
|
+
{@render props.children?.()}
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
import { type CardVariants } from "@heroui/styles";
|
|
3
|
+
type Props = HTMLAttributes<HTMLDivElement> & CardVariants;
|
|
4
|
+
declare const Card: import("svelte").Component<Props, {}, "">;
|
|
5
|
+
type Card = ReturnType<typeof Card>;
|
|
6
|
+
export default Card;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Card } from "./card.svelte";
|
|
2
|
+
export { default as CardHeader } from "./card-header.svelte";
|
|
3
|
+
export { default as CardContent } from "./card-content.svelte";
|
|
4
|
+
export { default as CardFooter } from "./card-footer.svelte";
|
|
5
|
+
export { default as CardTitle } from "./card-title.svelte";
|
|
6
|
+
export { default as CardDescription } from "./card-description.svelte";
|
|
7
|
+
export * from "./context.svelte";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { default as Card } from "./card.svelte";
|
|
2
|
+
export { default as CardHeader } from "./card-header.svelte";
|
|
3
|
+
export { default as CardContent } from "./card-content.svelte";
|
|
4
|
+
export { default as CardFooter } from "./card-footer.svelte";
|
|
5
|
+
export { default as CardTitle } from "./card-title.svelte";
|
|
6
|
+
export { default as CardDescription } from "./card-description.svelte";
|
|
7
|
+
export * from "./context.svelte";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { checkboxVariants } from "@heroui/styles";
|
|
3
|
+
import type { HTMLLabelAttributes } from "svelte/elements";
|
|
4
|
+
import { InputContext, Input } from "../../index.js";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLLabelAttributes;
|
|
7
|
+
|
|
8
|
+
const props: Props = $props();
|
|
9
|
+
|
|
10
|
+
const input = InputContext.get();
|
|
11
|
+
const contentClass = $derived(
|
|
12
|
+
checkboxVariants().content({
|
|
13
|
+
variant: input.heroui.variant,
|
|
14
|
+
class: props.class?.toString(),
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<label
|
|
20
|
+
{...props}
|
|
21
|
+
data-slot="checkbox-content"
|
|
22
|
+
class={contentClass}
|
|
23
|
+
>
|
|
24
|
+
<Input headless hidden type="checkbox" />
|
|
25
|
+
{@render props.children?.()}
|
|
26
|
+
</label>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { checkboxVariants } from "@heroui/styles";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { InputContext } from "../../index.js";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLSpanElement>;
|
|
7
|
+
|
|
8
|
+
const props: Props = $props();
|
|
9
|
+
|
|
10
|
+
const input = InputContext.get();
|
|
11
|
+
const controlClass = $derived(
|
|
12
|
+
checkboxVariants().control({
|
|
13
|
+
variant: input.heroui.variant,
|
|
14
|
+
class: props.class?.toString(),
|
|
15
|
+
}),
|
|
16
|
+
);
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<span
|
|
20
|
+
{...props}
|
|
21
|
+
data-slot="checkbox-control"
|
|
22
|
+
class={controlClass}
|
|
23
|
+
>
|
|
24
|
+
{@render props.children?.()}
|
|
25
|
+
</span>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type Props = HTMLAttributes<HTMLSpanElement>;
|
|
3
|
+
declare const CheckboxControl: import("svelte").Component<Props, {}, "">;
|
|
4
|
+
type CheckboxControl = ReturnType<typeof CheckboxControl>;
|
|
5
|
+
export default CheckboxControl;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { checkboxVariants } from "@heroui/styles";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { InputContext } from "../../index.js";
|
|
5
|
+
|
|
6
|
+
type Props = HTMLAttributes<HTMLSpanElement>;
|
|
7
|
+
|
|
8
|
+
const { ...props }: Props = $props();
|
|
9
|
+
const input = InputContext.get();
|
|
10
|
+
const indicatorClass = $derived(
|
|
11
|
+
checkboxVariants().indicator({
|
|
12
|
+
variant: input.heroui.variant,
|
|
13
|
+
class: props.class?.toString(),
|
|
14
|
+
}),
|
|
15
|
+
);
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
<span
|
|
19
|
+
{...props}
|
|
20
|
+
data-slot="checkbox-indicator"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
class={indicatorClass}
|
|
23
|
+
>
|
|
24
|
+
{#if input.opts.indeterminate}
|
|
25
|
+
<svg
|
|
26
|
+
aria-hidden="true"
|
|
27
|
+
data-slot="checkbox-default-indicator--indeterminate"
|
|
28
|
+
fill="none"
|
|
29
|
+
role="presentation"
|
|
30
|
+
stroke="currentColor"
|
|
31
|
+
stroke-linecap="round"
|
|
32
|
+
stroke-width={3}
|
|
33
|
+
viewBox="0 0 24 24"
|
|
34
|
+
>
|
|
35
|
+
<line x1="21" x2="3" y1="12" y2="12" />
|
|
36
|
+
</svg>
|
|
37
|
+
{:else}
|
|
38
|
+
<svg
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
data-slot="checkbox-default-indicator--checkmark"
|
|
41
|
+
fill="none"
|
|
42
|
+
role="presentation"
|
|
43
|
+
stroke="currentColor"
|
|
44
|
+
stroke-dasharray={22}
|
|
45
|
+
stroke-dashoffset={input.checked ? 44 : 66}
|
|
46
|
+
stroke-linecap="round"
|
|
47
|
+
stroke-linejoin="round"
|
|
48
|
+
stroke-width={2}
|
|
49
|
+
viewBox="0 0 17 18"
|
|
50
|
+
>
|
|
51
|
+
<polyline points="1 9 7 14 15 4" />
|
|
52
|
+
</svg>
|
|
53
|
+
{/if}
|
|
54
|
+
</span>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
type Props = HTMLAttributes<HTMLSpanElement>;
|
|
3
|
+
declare const CheckboxIndicator: import("svelte").Component<Props, {}, "">;
|
|
4
|
+
type CheckboxIndicator = ReturnType<typeof CheckboxIndicator>;
|
|
5
|
+
export default CheckboxIndicator;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { checkboxVariants } from "@heroui/styles";
|
|
3
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
4
|
+
import { type InputOpts, InputContext } from "../../index.js";
|
|
5
|
+
import { box } from "svelte-utils";
|
|
6
|
+
|
|
7
|
+
type Props = InputOpts &
|
|
8
|
+
HTMLAttributes<HTMLDivElement> & {
|
|
9
|
+
checked?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
checked = $bindable(false),
|
|
14
|
+
indeterminate,
|
|
15
|
+
invalid,
|
|
16
|
+
disabled,
|
|
17
|
+
required,
|
|
18
|
+
name,
|
|
19
|
+
fullWidth,
|
|
20
|
+
variant,
|
|
21
|
+
...props
|
|
22
|
+
}: Props = $props();
|
|
23
|
+
|
|
24
|
+
new InputContext(
|
|
25
|
+
() => ({
|
|
26
|
+
disabled,
|
|
27
|
+
fullWidth,
|
|
28
|
+
invalid,
|
|
29
|
+
name,
|
|
30
|
+
required,
|
|
31
|
+
variant,
|
|
32
|
+
indeterminate,
|
|
33
|
+
}),
|
|
34
|
+
undefined,
|
|
35
|
+
box(
|
|
36
|
+
() => checked,
|
|
37
|
+
(v) => (checked = v),
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const checkboxClass = $derived(
|
|
42
|
+
checkboxVariants().base({
|
|
43
|
+
variant,
|
|
44
|
+
class: props.class?.toString(),
|
|
45
|
+
}),
|
|
46
|
+
);
|
|
47
|
+
</script>
|
|
48
|
+
|
|
49
|
+
<div
|
|
50
|
+
{...props}
|
|
51
|
+
data-slot="checkbox"
|
|
52
|
+
data-selected={checked}
|
|
53
|
+
data-invalid={invalid}
|
|
54
|
+
data-disabled={disabled}
|
|
55
|
+
data-required={required}
|
|
56
|
+
data-indeterminate={indeterminate}
|
|
57
|
+
class={checkboxClass}
|
|
58
|
+
>
|
|
59
|
+
{@render props.children?.()}
|
|
60
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HTMLAttributes } from "svelte/elements";
|
|
2
|
+
import { type InputOpts } from "../../index.js";
|
|
3
|
+
type Props = InputOpts & HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
checked?: boolean;
|
|
5
|
+
};
|
|
6
|
+
declare const Checkbox: import("svelte").Component<Props, {}, "checked">;
|
|
7
|
+
type Checkbox = ReturnType<typeof Checkbox>;
|
|
8
|
+
export default Checkbox;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as CheckboxContent } from "./checkbox-content.svelte";
|
|
2
|
+
export { default as CheckboxControl } from "./checkbox-control.svelte";
|
|
3
|
+
export { default as CheckboxIndicator } from "./checkbox-indicator.svelte";
|
|
4
|
+
export { default as Checkbox } from "./checkbox.svelte";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as CheckboxContent } from "./checkbox-content.svelte";
|
|
2
|
+
export { default as CheckboxControl } from "./checkbox-control.svelte";
|
|
3
|
+
export { default as CheckboxIndicator } from "./checkbox-indicator.svelte";
|
|
4
|
+
export { default as Checkbox } from "./checkbox.svelte";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { closeButtonVariants } from "@heroui/styles";
|
|
3
|
+
import type { HTMLButtonAttributes } from "svelte/elements";
|
|
4
|
+
import CloseIcon from "../../icons/close-icon.svelte";
|
|
5
|
+
|
|
6
|
+
const props: HTMLButtonAttributes = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<button
|
|
10
|
+
{...props}
|
|
11
|
+
type={props.type ?? "button"}
|
|
12
|
+
class={closeButtonVariants({
|
|
13
|
+
class: props.class?.toString(),
|
|
14
|
+
})}
|
|
15
|
+
>
|
|
16
|
+
<CloseIcon />
|
|
17
|
+
</button>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CloseButton } from "./close-button.svelte";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CloseButton } from "./close-button.svelte";
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<script lang="ts" generics="T">
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
import {
|
|
4
|
+
onView,
|
|
5
|
+
useResource,
|
|
6
|
+
type Fn,
|
|
7
|
+
type MaybePromise,
|
|
8
|
+
} from "svelte-utils";
|
|
9
|
+
import type { Attachment } from "svelte/attachments";
|
|
10
|
+
|
|
11
|
+
type ChildProps = {
|
|
12
|
+
item: T;
|
|
13
|
+
isLast: boolean;
|
|
14
|
+
loadMore: Fn;
|
|
15
|
+
loadingMore: boolean;
|
|
16
|
+
index: number;
|
|
17
|
+
key: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type LoaderProps = {
|
|
21
|
+
attach: Attachment<HTMLElement>;
|
|
22
|
+
loadingMore: boolean;
|
|
23
|
+
loadMore: Fn;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type Props = {
|
|
27
|
+
items: T[];
|
|
28
|
+
key?: (item: T) => string;
|
|
29
|
+
loadMore?: Fn<MaybePromise<T[]>, [{ offset: number }]>;
|
|
30
|
+
child: Snippet<[ChildProps]>;
|
|
31
|
+
sentinel?: Snippet<[LoaderProps]>;
|
|
32
|
+
empty?: Snippet;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
let {
|
|
36
|
+
items = $bindable(),
|
|
37
|
+
key = String,
|
|
38
|
+
loadMore,
|
|
39
|
+
child,
|
|
40
|
+
sentinel,
|
|
41
|
+
empty,
|
|
42
|
+
}: Props = $props();
|
|
43
|
+
|
|
44
|
+
let hasMore = $state(true);
|
|
45
|
+
const more = useResource(async () => {
|
|
46
|
+
if (!loadMore || more.fetching) return;
|
|
47
|
+
const offset = items.length;
|
|
48
|
+
const values = await loadMore({ offset });
|
|
49
|
+
hasMore = values.length > 0;
|
|
50
|
+
items = [...items, ...values];
|
|
51
|
+
});
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
{#each items as item, index (key(item))}
|
|
55
|
+
{@const isLast = index === items.length - 1}
|
|
56
|
+
{@render child({
|
|
57
|
+
item,
|
|
58
|
+
isLast,
|
|
59
|
+
loadMore: more.refetch,
|
|
60
|
+
loadingMore: more.fetching,
|
|
61
|
+
index,
|
|
62
|
+
key: key(item),
|
|
63
|
+
})}
|
|
64
|
+
{:else}
|
|
65
|
+
{@render empty?.()}
|
|
66
|
+
{/each}
|
|
67
|
+
|
|
68
|
+
{#if hasMore && loadMore}
|
|
69
|
+
{@render sentinel?.({
|
|
70
|
+
loadMore: more.refetch,
|
|
71
|
+
loadingMore: more.fetching,
|
|
72
|
+
attach: onView(({ isIntersecting }) => isIntersecting && more.refetch(), {
|
|
73
|
+
enabled:
|
|
74
|
+
!more.fetching && loadMore !== undefined && hasMore && !more.failed(),
|
|
75
|
+
}),
|
|
76
|
+
})}
|
|
77
|
+
{/if}
|