@torpor/ui 0.3.2 → 0.3.4
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/CHANGELOG.md +14 -0
- package/dist/Accordion/Accordion.torp +7 -3
- package/dist/Accordion/AccordionContent.torp +7 -3
- package/dist/Accordion/AccordionHeader.torp +7 -3
- package/dist/Accordion/AccordionItem.torp +7 -3
- package/dist/Accordion/AccordionTrigger.torp +7 -3
- package/dist/Accordion/index.d.ts +20 -10
- package/dist/Breadcrumb/Breadcrumb.torp +7 -3
- package/dist/Breadcrumb/BreadcrumbItem.torp +7 -3
- package/dist/Breadcrumb/BreadcrumbSeparator.torp +7 -3
- package/dist/Breadcrumb/index.d.ts +12 -6
- package/dist/Calendar/Calendar.torp +9 -4
- package/dist/Calendar/CalendarDay.torp +5 -2
- package/dist/Calendar/index.d.ts +8 -4
- package/dist/Contextual/Contextual.torp +7 -3
- package/dist/Contextual/ContextualContent.torp +7 -4
- package/dist/Contextual/ContextualTrigger.torp +7 -3
- package/dist/Contextual/index.d.ts +12 -6
- package/dist/Dialog/Dialog.torp +7 -3
- package/dist/Dialog/DialogBody.torp +7 -3
- package/dist/Dialog/DialogButton.torp +7 -3
- package/dist/Dialog/DialogFooter.torp +7 -3
- package/dist/Dialog/DialogHeader.torp +7 -3
- package/dist/Dialog/index.d.ts +20 -10
- package/dist/Disclosure/Disclosure.torp +7 -3
- package/dist/Disclosure/DisclosureContent.torp +7 -3
- package/dist/Disclosure/DisclosureHeader.torp +7 -3
- package/dist/Disclosure/DisclosureTrigger.torp +7 -3
- package/dist/Disclosure/index.d.ts +16 -8
- package/dist/Drawer/Drawer.torp +7 -3
- package/dist/Drawer/DrawerContent.torp +7 -4
- package/dist/Drawer/DrawerOverlay.torp +7 -3
- package/dist/Drawer/DrawerTrigger.torp +7 -3
- package/dist/Drawer/index.d.ts +16 -8
- package/dist/Form/CheckBox.torp +5 -2
- package/dist/Form/Field.torp +7 -3
- package/dist/Form/File.torp +11 -15
- package/dist/Form/Form.torp +7 -3
- package/dist/Form/Hidden.torp +1 -1
- package/dist/Form/Input.torp +7 -3
- package/dist/Form/Label.torp +7 -3
- package/dist/Form/Message.torp +7 -3
- package/dist/Form/Option.torp +8 -4
- package/dist/Form/Select.torp +7 -3
- package/dist/Form/TextArea.torp +7 -3
- package/dist/Form/index.d.ts +43 -25
- package/dist/Menu/Menu.torp +7 -3
- package/dist/Menu/MenuButton.torp +7 -3
- package/dist/Menu/MenuCheck.torp +7 -3
- package/dist/Menu/MenuGroup.torp +7 -3
- package/dist/Menu/MenuIndicator.torp +7 -3
- package/dist/Menu/MenuPopout.torp +7 -3
- package/dist/Menu/MenuPopoutContent.torp +7 -4
- package/dist/Menu/MenuPopoutTrigger.torp +7 -3
- package/dist/Menu/MenuRadio.torp +7 -3
- package/dist/Menu/MenuRadioGroup.torp +7 -3
- package/dist/Menu/MenuSeparator.torp +7 -3
- package/dist/Menu/index.d.ts +44 -22
- package/dist/MenuBar/MenuBar.torp +7 -3
- package/dist/MenuBar/MenuBarItem.torp +7 -3
- package/dist/MenuBar/MenuBarItemContent.torp +7 -3
- package/dist/MenuBar/MenuBarItemTrigger.torp +7 -3
- package/dist/MenuBar/index.d.ts +16 -8
- package/dist/Modal/Modal.torp +7 -3
- package/dist/Modal/ModalContent.torp +7 -3
- package/dist/Modal/ModalOverlay.torp +7 -3
- package/dist/Modal/ModalTrigger.torp +7 -3
- package/dist/Modal/index.d.ts +16 -8
- package/dist/NavMenu/NavMenu.torp +7 -3
- package/dist/NavMenu/NavMenuButton.torp +7 -3
- package/dist/NavMenu/NavMenuElement.torp +7 -3
- package/dist/NavMenu/NavMenuGroup.torp +7 -3
- package/dist/NavMenu/NavMenuGroupHeader.torp +7 -3
- package/dist/NavMenu/NavMenuLink.torp +7 -4
- package/dist/NavMenu/NavMenuPopout.torp +7 -3
- package/dist/NavMenu/NavMenuPopoutButton.torp +7 -3
- package/dist/NavMenu/NavMenuPopoutContent.torp +7 -4
- package/dist/NavMenu/NavMenuSeparator.torp +5 -2
- package/dist/NavMenu/index.d.ts +40 -20
- package/dist/Notification/Notification.torp +7 -3
- package/dist/Notification/NotificationClose.torp +7 -3
- package/dist/Notification/NotificationContainer.torp +7 -3
- package/dist/Notification/NotificationContent.torp +7 -3
- package/dist/Notification/index.d.ts +16 -8
- package/dist/Popover/Popover.torp +7 -3
- package/dist/Popover/PopoverContent.torp +7 -3
- package/dist/Popover/PopoverTrigger.torp +7 -3
- package/dist/Popover/index.d.ts +8 -4
- package/dist/TabGroup/TabContent.torp +7 -3
- package/dist/TabGroup/TabGroup.torp +7 -3
- package/dist/TabGroup/TabHeader.torp +5 -2
- package/dist/TabGroup/TabList.torp +7 -3
- package/dist/TabGroup/TabTrigger.torp +7 -3
- package/dist/TabGroup/index.d.ts +20 -10
- package/dist/icons/ArrowDown.torp +2 -1
- package/dist/icons/ArrowLeft.torp +2 -1
- package/dist/icons/ArrowRight.torp +2 -1
- package/dist/icons/ArrowUp.torp +2 -1
- package/dist/icons/Bars.torp +2 -1
- package/dist/icons/Check.torp +2 -1
- package/dist/icons/ChevronDown.torp +2 -1
- package/dist/icons/ChevronLeft.torp +2 -1
- package/dist/icons/ChevronRight.torp +2 -1
- package/dist/icons/ChevronUp.torp +2 -1
- package/dist/icons/Cross.torp +2 -1
- package/dist/icons/IconTypes.ts +6 -2
- package/dist/icons/Loading.torp +2 -1
- package/dist/icons/Minus.torp +2 -1
- package/dist/icons/Plus.torp +2 -1
- package/dist/icons/index.d.ts +28 -14
- package/dist/metafile-esm.json +1 -1
- package/package.json +2 -2
- package/src/Accordion/Accordion.torp +7 -3
- package/src/Accordion/AccordionContent.torp +7 -3
- package/src/Accordion/AccordionHeader.torp +7 -3
- package/src/Accordion/AccordionItem.torp +7 -3
- package/src/Accordion/AccordionTrigger.torp +7 -3
- package/src/Breadcrumb/Breadcrumb.torp +7 -3
- package/src/Breadcrumb/BreadcrumbItem.torp +7 -3
- package/src/Breadcrumb/BreadcrumbSeparator.torp +7 -3
- package/src/Calendar/Calendar.torp +9 -4
- package/src/Calendar/CalendarDay.torp +5 -2
- package/src/Contextual/Contextual.torp +7 -3
- package/src/Contextual/ContextualContent.torp +7 -4
- package/src/Contextual/ContextualTrigger.torp +7 -3
- package/src/Dialog/Dialog.torp +7 -3
- package/src/Dialog/DialogBody.torp +7 -3
- package/src/Dialog/DialogButton.torp +7 -3
- package/src/Dialog/DialogFooter.torp +7 -3
- package/src/Dialog/DialogHeader.torp +7 -3
- package/src/Disclosure/Disclosure.torp +7 -3
- package/src/Disclosure/DisclosureContent.torp +7 -3
- package/src/Disclosure/DisclosureHeader.torp +7 -3
- package/src/Disclosure/DisclosureTrigger.torp +7 -3
- package/src/Drawer/Drawer.torp +7 -3
- package/src/Drawer/DrawerContent.torp +7 -4
- package/src/Drawer/DrawerOverlay.torp +7 -3
- package/src/Drawer/DrawerTrigger.torp +7 -3
- package/src/Form/CheckBox.torp +5 -2
- package/src/Form/Field.torp +7 -3
- package/src/Form/File.torp +11 -15
- package/src/Form/Form.torp +7 -3
- package/src/Form/Hidden.torp +1 -1
- package/src/Form/Input.torp +7 -3
- package/src/Form/Label.torp +7 -3
- package/src/Form/Message.torp +7 -3
- package/src/Form/Option.torp +8 -4
- package/src/Form/Select.torp +7 -3
- package/src/Form/TextArea.torp +7 -3
- package/src/Menu/Menu.torp +7 -3
- package/src/Menu/MenuButton.torp +7 -3
- package/src/Menu/MenuCheck.torp +7 -3
- package/src/Menu/MenuGroup.torp +7 -3
- package/src/Menu/MenuIndicator.torp +7 -3
- package/src/Menu/MenuPopout.torp +7 -3
- package/src/Menu/MenuPopoutContent.torp +7 -4
- package/src/Menu/MenuPopoutTrigger.torp +7 -3
- package/src/Menu/MenuRadio.torp +7 -3
- package/src/Menu/MenuRadioGroup.torp +7 -3
- package/src/Menu/MenuSeparator.torp +7 -3
- package/src/MenuBar/MenuBar.torp +7 -3
- package/src/MenuBar/MenuBarItem.torp +7 -3
- package/src/MenuBar/MenuBarItemContent.torp +7 -3
- package/src/MenuBar/MenuBarItemTrigger.torp +7 -3
- package/src/Modal/Modal.torp +7 -3
- package/src/Modal/ModalContent.torp +7 -3
- package/src/Modal/ModalOverlay.torp +7 -3
- package/src/Modal/ModalTrigger.torp +7 -3
- package/src/NavMenu/NavMenu.torp +7 -3
- package/src/NavMenu/NavMenuButton.torp +7 -3
- package/src/NavMenu/NavMenuElement.torp +7 -3
- package/src/NavMenu/NavMenuGroup.torp +7 -3
- package/src/NavMenu/NavMenuGroupHeader.torp +7 -3
- package/src/NavMenu/NavMenuLink.torp +7 -4
- package/src/NavMenu/NavMenuPopout.torp +7 -3
- package/src/NavMenu/NavMenuPopoutButton.torp +7 -3
- package/src/NavMenu/NavMenuPopoutContent.torp +7 -4
- package/src/NavMenu/NavMenuSeparator.torp +5 -2
- package/src/Notification/Notification.torp +7 -3
- package/src/Notification/NotificationClose.torp +7 -3
- package/src/Notification/NotificationContainer.torp +7 -3
- package/src/Notification/NotificationContent.torp +7 -3
- package/src/Popover/Popover.torp +7 -3
- package/src/Popover/PopoverContent.torp +7 -3
- package/src/Popover/PopoverTrigger.torp +7 -3
- package/src/Slider/Slider.torp +2 -1
- package/src/TabGroup/TabContent.torp +7 -3
- package/src/TabGroup/TabGroup.torp +7 -3
- package/src/TabGroup/TabHeader.torp +5 -2
- package/src/TabGroup/TabList.torp +7 -3
- package/src/TabGroup/TabTrigger.torp +7 -3
- package/src/icons/ArrowDown.torp +2 -1
- package/src/icons/ArrowLeft.torp +2 -1
- package/src/icons/ArrowRight.torp +2 -1
- package/src/icons/ArrowUp.torp +2 -1
- package/src/icons/Bars.torp +2 -1
- package/src/icons/Check.torp +2 -1
- package/src/icons/ChevronDown.torp +2 -1
- package/src/icons/ChevronLeft.torp +2 -1
- package/src/icons/ChevronRight.torp +2 -1
- package/src/icons/ChevronUp.torp +2 -1
- package/src/icons/Cross.torp +2 -1
- package/src/icons/IconTypes.ts +6 -2
- package/src/icons/Loading.torp +2 -1
- package/src/icons/Minus.torp +2 -1
- package/src/icons/Plus.torp +2 -1
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { AccordionContextName, type AccordionContext, type ItemState } from "./AccordionTypes";
|
|
2
3
|
|
|
3
4
|
interface AccordionProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** Whether a single AccordionItem or multiple AccordionItems can be expanded at the same time */
|
|
9
12
|
type?: "single" | "multiple",
|
|
10
13
|
/** The value of the expanded AccordionItem, or an array of values if the type is "multiple" */
|
|
@@ -218,7 +221,8 @@ export default function Accordion($props: AccordionProps | undefined) {
|
|
|
218
221
|
@render {
|
|
219
222
|
<div
|
|
220
223
|
{$props?.id}
|
|
221
|
-
class={
|
|
224
|
+
class={["torp-accordion", $props?.class]}
|
|
225
|
+
{$props?.style}
|
|
222
226
|
>
|
|
223
227
|
<slot />
|
|
224
228
|
</div>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import getId from "../utils/getId";
|
|
2
3
|
import { AccordionItemContextName, type AccordionItemContext } from "./AccordionTypes";
|
|
3
4
|
|
|
4
5
|
interface AccordionContentProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
/** Whether this content should act as a region. Set this when the content contains heading elements or a nested Accordion */
|
|
10
13
|
ariaRegion?: boolean,
|
|
11
14
|
}
|
|
@@ -28,7 +31,8 @@ export default function AccordionContent($props: AccordionContentProps | undefin
|
|
|
28
31
|
@render {
|
|
29
32
|
<div
|
|
30
33
|
id={$props?.id ?? defaultId}
|
|
31
|
-
class={
|
|
34
|
+
class={["torp-accordion-content", $props?.class]}
|
|
35
|
+
{$props?.style}
|
|
32
36
|
role={$props?.ariaRegion ? "region" : undefined}
|
|
33
37
|
aria-labelledby={$state.headerId}
|
|
34
38
|
data-state={$state.expanded ? "open" : "closed"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { AccordionItemContextName, type AccordionItemContext } from "./AccordionTypes";
|
|
2
3
|
|
|
3
4
|
interface AccordionHeaderProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** The type of HTML header to use */
|
|
9
12
|
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6",
|
|
10
13
|
}
|
|
@@ -31,7 +34,8 @@ export default function AccordionHeader($props: AccordionHeaderProps | undefined
|
|
|
31
34
|
@// TODO: $props.as
|
|
32
35
|
<h4
|
|
33
36
|
{$props?.id}
|
|
34
|
-
class={
|
|
37
|
+
class={["torp-accordion-header", $props?.class]}
|
|
38
|
+
{$props?.style}
|
|
35
39
|
data-state={$state.expanded ? "open" : "closed"}
|
|
36
40
|
data-disabled={$state.disabled ? "true" : undefined}
|
|
37
41
|
>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { AccordionContextName, AccordionItemContextName, type ItemState, type AccordionContext, type AccordionItemContext } from "./AccordionTypes";
|
|
2
3
|
|
|
3
4
|
interface AccordionItemProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** The index of this item in the Accordion. Set this if you will be inserting, removing or sorting items. If you don't set this, it will be set automatically */
|
|
9
12
|
index?: number,
|
|
10
13
|
/** A value for the item. Set this if you need more control over which item(s) are expanded. If you don't set this, the value will be set to the item's initial index */
|
|
@@ -87,7 +90,8 @@ export default function AccordionItem($props: AccordionItemProps | undefined) {
|
|
|
87
90
|
@render {
|
|
88
91
|
<div
|
|
89
92
|
{$props?.id}
|
|
90
|
-
class={
|
|
93
|
+
class={["torp-accordion-item", $props?.class]}
|
|
94
|
+
{$props?.style}
|
|
91
95
|
data-state={$state.expanded ? "open" : "closed"}
|
|
92
96
|
data-disabled={$state.disabled ? "true" : undefined}
|
|
93
97
|
>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import getId from "../utils/getId";
|
|
2
3
|
import { AccordionItemContextName, type AccordionItemContext } from "./AccordionTypes";
|
|
3
4
|
|
|
4
5
|
interface AccordionTriggerProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
/**
|
|
@@ -49,7 +52,8 @@ export default function AccordionTrigger($props: AccordionTriggerProps | undefin
|
|
|
49
52
|
<button
|
|
50
53
|
type="button"
|
|
51
54
|
id={$props?.id ?? defaultId}
|
|
52
|
-
class={
|
|
55
|
+
class={["torp-accordion-trigger", $props?.class]}
|
|
56
|
+
{$props?.style}
|
|
53
57
|
disabled={$state.disabled || $state.parentDisabled}
|
|
54
58
|
aria-expanded={$state.expanded.toString()}
|
|
55
59
|
aria-disabled={$state.disabled ? "true" : undefined}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
|
|
2
3
|
interface BreadcrumbProps {
|
|
3
4
|
/** An ID for the root element */
|
|
4
5
|
id?: string;
|
|
5
|
-
/**
|
|
6
|
-
class?:
|
|
6
|
+
/** Classes for the root element */
|
|
7
|
+
class?: ClassValue,
|
|
8
|
+
/** Styles for the root element */
|
|
9
|
+
style?: StyleValue,
|
|
7
10
|
/** An ARIA label for describing the popover to screen readers */
|
|
8
11
|
ariaLabel?: string | undefined,
|
|
9
12
|
}
|
|
@@ -32,7 +35,8 @@ export default function Breadcrumb($props: BreadcrumbProps | undefined) {
|
|
|
32
35
|
@render {
|
|
33
36
|
<nav
|
|
34
37
|
{$props?.id}
|
|
35
|
-
class={
|
|
38
|
+
class={["torp-breadcrumb", $props?.class]}
|
|
39
|
+
{$props?.style}
|
|
36
40
|
aria-label={$props?.ariaLabel}
|
|
37
41
|
>
|
|
38
42
|
<slot />
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
|
|
2
3
|
interface BreadcrumbItemProps {
|
|
3
4
|
/** An ID for the root element */
|
|
4
5
|
id?: string;
|
|
5
|
-
/**
|
|
6
|
-
class?:
|
|
6
|
+
/** Classes for the root element */
|
|
7
|
+
class?: ClassValue,
|
|
8
|
+
/** Styles for the root element */
|
|
9
|
+
style?: StyleValue,
|
|
7
10
|
/** Whether this is the current page */
|
|
8
11
|
current?: boolean,
|
|
9
12
|
}
|
|
@@ -16,7 +19,8 @@ export default function BreadcrumbItem($props: BreadcrumbItemProps | undefined)
|
|
|
16
19
|
@render {
|
|
17
20
|
<div
|
|
18
21
|
{$props?.id}
|
|
19
|
-
class={
|
|
22
|
+
class={["torp-breadcrumb", $props?.class]}
|
|
23
|
+
{$props?.style}
|
|
20
24
|
aria-current={$props?.current ? "page" : undefined}
|
|
21
25
|
data-current={$props?.current ? "current" : undefined}
|
|
22
26
|
>
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
|
|
2
3
|
interface BreadcrumbSeparatorProps {
|
|
3
4
|
/** An ID for the root element */
|
|
4
5
|
id?: string;
|
|
5
|
-
/**
|
|
6
|
-
class?:
|
|
6
|
+
/** Classes for the root element */
|
|
7
|
+
class?: ClassValue,
|
|
8
|
+
/** Styles for the root element */
|
|
9
|
+
style?: StyleValue,
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
/**
|
|
@@ -14,7 +17,8 @@ export default function BreadcrumbSeparator($props: BreadcrumbSeparatorProps | u
|
|
|
14
17
|
@render {
|
|
15
18
|
<div
|
|
16
19
|
{$props?.id}
|
|
17
|
-
class={
|
|
20
|
+
class={["torp-breadcrumb-separator", $props?.class]}
|
|
21
|
+
{$props?.style}
|
|
18
22
|
aria-hidden="true"
|
|
19
23
|
>
|
|
20
24
|
<slot />
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { ReactiveDate } from "@torpor/view";
|
|
2
3
|
import { areDatesEqual, dayNames, monthNames } from "../utils/dateUtils";
|
|
3
4
|
import CalendarDay from "./CalendarDay.torp";
|
|
@@ -10,8 +11,10 @@ import ChevronRight from "../icons/ChevronRight.torp";
|
|
|
10
11
|
interface CalendarProps {
|
|
11
12
|
/** An ID for the root element */
|
|
12
13
|
id?: string;
|
|
13
|
-
/**
|
|
14
|
-
class?:
|
|
14
|
+
/** Classes for the root element */
|
|
15
|
+
class?: ClassValue,
|
|
16
|
+
/** Styles for the root element */
|
|
17
|
+
style?: StyleValue,
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
export default function Calendar($props: CalendarProps) {
|
|
@@ -219,7 +222,8 @@ export default function Calendar($props: CalendarProps) {
|
|
|
219
222
|
@render {
|
|
220
223
|
<div
|
|
221
224
|
{$props?.id}
|
|
222
|
-
class={
|
|
225
|
+
class={["torp-calendar", $props?.class]}
|
|
226
|
+
{$props?.style}
|
|
223
227
|
&ref={container}
|
|
224
228
|
>
|
|
225
229
|
<div class={`torp-calendar-header ${$props?.class ?? ""}`.trim()}>
|
|
@@ -238,7 +242,8 @@ export default function Calendar($props: CalendarProps) {
|
|
|
238
242
|
</button>
|
|
239
243
|
</div>
|
|
240
244
|
<div
|
|
241
|
-
class={
|
|
245
|
+
class={["torp-calendar-grid", $props?.class]}
|
|
246
|
+
{$props?.style}
|
|
242
247
|
tabindex={$props.selectable ? 0 : -1}
|
|
243
248
|
onfocus={handleFocus}
|
|
244
249
|
onkeydown={handleKey}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { areDatesEqual } from "../utils/dateUtils";
|
|
2
3
|
import { type CalendarContext, type CalendarEvent, CalendarContextName } from "./CalendarTypes";
|
|
3
4
|
|
|
4
5
|
interface CalendarDayProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
export default function CalendarDay($props: CalendarDayProps) {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { ContextualContextName, type Point, type ContextualContext, type ContextualState } from "./ContextualTypes";
|
|
2
3
|
|
|
3
4
|
interface ContextualProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** Whether the contextual is modal. If true, an overlay should be supplied to obscure outside content, and only the context content will be visible to screen readers */
|
|
9
12
|
modal?: boolean,
|
|
10
13
|
/** Whether the contextual is visible */
|
|
@@ -117,7 +120,8 @@ export default function Contextual($props: ContextualProps | undefined) {
|
|
|
117
120
|
@render {
|
|
118
121
|
<div
|
|
119
122
|
{$props?.id}
|
|
120
|
-
class={
|
|
123
|
+
class={["torp-context", $props?.class]}
|
|
124
|
+
{$props?.style}
|
|
121
125
|
>
|
|
122
126
|
<slot />
|
|
123
127
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
2
2
|
import { addDocumentEvent, removeDocumentEvent } from "../utils/documentEvents";
|
|
3
3
|
import getScrollParent from "../utils/getScrollParent";
|
|
4
4
|
import setContextPosition from "../utils/setContextPosition";
|
|
@@ -7,8 +7,10 @@ import { ContextualContextName, type ContextualContext } from "./ContextualTypes
|
|
|
7
7
|
interface ContextualContentProps {
|
|
8
8
|
/** An ID for the root element */
|
|
9
9
|
id?: string;
|
|
10
|
-
/**
|
|
11
|
-
class?:
|
|
10
|
+
/** Classes for the root element */
|
|
11
|
+
class?: ClassValue,
|
|
12
|
+
/** Styles for the root element */
|
|
13
|
+
style?: StyleValue,
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
/**
|
|
@@ -98,7 +100,8 @@ export default function ContextualContent($props: ContextualContentProps | undef
|
|
|
98
100
|
@if ($state.visible) {
|
|
99
101
|
<div
|
|
100
102
|
{$props?.id}
|
|
101
|
-
class={
|
|
103
|
+
class={["torp-popover-content-contextual", $props?.class]}
|
|
104
|
+
{$props?.style}
|
|
102
105
|
&ref={div}
|
|
103
106
|
onmount={show}
|
|
104
107
|
>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { ContextualContextName, type ContextualContext } from "./ContextualTypes";
|
|
2
3
|
import hoverTrigger from "../mount/hoverTrigger";
|
|
3
4
|
|
|
4
5
|
interface ContextualTriggerProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
/** Whether the popover is activated by click/press or by hover **/
|
|
10
13
|
activation?: "press" | "hover"
|
|
11
14
|
}
|
|
@@ -55,7 +58,8 @@ export default function ContextualTrigger($props: ContextualTriggerProps | undef
|
|
|
55
58
|
@render {
|
|
56
59
|
<div
|
|
57
60
|
{$props?.id}
|
|
58
|
-
class={
|
|
61
|
+
class={["torp-popover-trigger-contextual", $props?.class]}
|
|
62
|
+
{$props?.style}
|
|
59
63
|
oncontextmenu={handleContextualMenu}
|
|
60
64
|
onmount={(el) => hoverTrigger(el, { onHover: handleHover, onExit: handleHover })}
|
|
61
65
|
&ref={context.anchorElement}
|
package/src/Dialog/Dialog.torp
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import getId from "../utils/getId";
|
|
2
3
|
import { trapFocus, type TrapFocusOptions } from "../mount/trapFocus";
|
|
3
4
|
import { ModalContextName, type ModalContext } from "../Modal/ModalTypes";
|
|
@@ -7,8 +8,10 @@ import { DialogContextName, type DialogContext, type DialogState, type HandleBut
|
|
|
7
8
|
interface DialogProps {
|
|
8
9
|
/** An ID for the root element */
|
|
9
10
|
id?: string;
|
|
10
|
-
/**
|
|
11
|
-
class?:
|
|
11
|
+
/** Classes for the root element */
|
|
12
|
+
class?: ClassValue,
|
|
13
|
+
/** Styles for the root element */
|
|
14
|
+
style?: StyleValue,
|
|
12
15
|
/** An ARIA label for describing the popover to screen readers */
|
|
13
16
|
ariaLabel?: string,
|
|
14
17
|
/** Whether the dialog should alert the user via the screen reader */
|
|
@@ -115,7 +118,8 @@ export default function Dialog($props: DialogProps | undefined) {
|
|
|
115
118
|
@render {
|
|
116
119
|
<div
|
|
117
120
|
id={$props?.id ?? defaultId}
|
|
118
|
-
class={
|
|
121
|
+
class={["torp-dialog", $props?.class]}
|
|
122
|
+
{$props?.style}
|
|
119
123
|
tabindex="0"
|
|
120
124
|
role={$props?.alert === true ? "alertdialog" : "dialog"}
|
|
121
125
|
aria-modal={modal}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import getId from "../utils/getId";
|
|
2
3
|
import { DialogContextName, type DialogContext } from "./DialogTypes";
|
|
3
4
|
|
|
4
5
|
interface DialogBodyProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
/** Whether the body content will be announced by screen readers when the Dialog is opened */
|
|
10
13
|
ariaAnnounce?: boolean,
|
|
11
14
|
}
|
|
@@ -32,7 +35,8 @@ export default function DialogBody($props: DialogBodyProps | undefined) {
|
|
|
32
35
|
@render {
|
|
33
36
|
<div
|
|
34
37
|
id={$props?.id ?? defaultId}
|
|
35
|
-
class={
|
|
38
|
+
class={["torp-dialog-body", $props?.class]}
|
|
39
|
+
{$props?.style}
|
|
36
40
|
>
|
|
37
41
|
<slot />
|
|
38
42
|
</div>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { DialogContextName, type DialogContext } from "./DialogTypes";
|
|
2
3
|
|
|
3
4
|
interface DialogButtonProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** The value that should be returned when this button is pressed and the Dialog was invoked by calling showContextual, showPrompt or showPopover */
|
|
9
12
|
value?: any,
|
|
10
13
|
/** "confirm" if the button should respond to the Enter key or "cancel" if the button should respond to the Escape key */
|
|
@@ -51,7 +54,8 @@ export default function DialogButton($props: DialogButtonProps | undefined) {
|
|
|
51
54
|
<button
|
|
52
55
|
type="button"
|
|
53
56
|
{$props?.id}
|
|
54
|
-
class={
|
|
57
|
+
class={["torp-dialog-button", $props?.class]}
|
|
58
|
+
{$props?.style}
|
|
55
59
|
disabled={$props?.disabled}
|
|
56
60
|
onclick={handleClick}
|
|
57
61
|
&ref={button}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
|
|
2
3
|
interface DialogFooterProps {
|
|
3
4
|
/** An ID for the root element */
|
|
4
5
|
id?: string;
|
|
5
|
-
/**
|
|
6
|
-
class?:
|
|
6
|
+
/** Classes for the root element */
|
|
7
|
+
class?: ClassValue,
|
|
8
|
+
/** Styles for the root element */
|
|
9
|
+
style?: StyleValue,
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
/**
|
|
@@ -13,7 +16,8 @@ export default function DialogFooter($props: DialogFooterProps | undefined) {
|
|
|
13
16
|
@render {
|
|
14
17
|
<div
|
|
15
18
|
{$props?.id}
|
|
16
|
-
class={
|
|
19
|
+
class={["torp-dialog-footer", $props?.class]}
|
|
20
|
+
{$props?.style}
|
|
17
21
|
>
|
|
18
22
|
<slot />
|
|
19
23
|
</div>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import getId from "../utils/getId";
|
|
2
3
|
import { DialogContextName, type DialogContext } from "./DialogTypes";
|
|
3
4
|
|
|
4
5
|
interface DialogHeaderProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
/** Whether the header will be announced by screen readers when the Dialog is opened */
|
|
10
13
|
ariaAnnounce?: boolean,
|
|
11
14
|
}
|
|
@@ -33,7 +36,8 @@ export default function DialogHeader($props: DialogHeaderProps | undefined) {
|
|
|
33
36
|
@render {
|
|
34
37
|
<div
|
|
35
38
|
id={$props?.id ?? defaultId}
|
|
36
|
-
class={
|
|
39
|
+
class={["torp-dialog-footer", $props?.class]}
|
|
40
|
+
{$props?.style}
|
|
37
41
|
>
|
|
38
42
|
<slot />
|
|
39
43
|
</div>
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { DisclosureContextName, type DisclosureContext, type DisclosureState } from "./DisclosureTypes";
|
|
2
3
|
|
|
3
4
|
interface DisclosureProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** Whether the disclosure is expanded and its content visible */
|
|
9
12
|
expanded?: boolean,
|
|
10
13
|
/** If set to true, the user cannot interact with this disclosure */
|
|
@@ -68,7 +71,8 @@ export default function Disclosure($props: DisclosureProps | undefined) {
|
|
|
68
71
|
@render {
|
|
69
72
|
<div
|
|
70
73
|
{$props?.id}
|
|
71
|
-
class={
|
|
74
|
+
class={["torp-disclosure-item", $props?.class]}
|
|
75
|
+
{$props?.style}
|
|
72
76
|
data-state={$state.expanded ? "open" : "closed"}
|
|
73
77
|
data-disabled={$state.disabled ? "true" : undefined}
|
|
74
78
|
>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import getId from "../utils/getId";
|
|
2
3
|
import { DisclosureContextName, type DisclosureContext } from "./DisclosureTypes";
|
|
3
4
|
|
|
4
5
|
interface DisclosureContentProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
/** Whether this content should act as a region. Set this when the content contains heading elements or a nested Disclosure */
|
|
10
13
|
ariaRegion?: boolean,
|
|
11
14
|
}
|
|
@@ -28,7 +31,8 @@ export default function DisclosureContent($props: DisclosureContentProps | undef
|
|
|
28
31
|
@render {
|
|
29
32
|
<div
|
|
30
33
|
id={$props?.id ?? defaultId}
|
|
31
|
-
class={
|
|
34
|
+
class={["torp-disclosure-content", $props?.class]}
|
|
35
|
+
{$props?.style}
|
|
32
36
|
role={$props?.ariaRegion ? "region" : undefined}
|
|
33
37
|
aria-labelledby={$state.headerId}
|
|
34
38
|
data-state={$state.expanded ? "open" : "closed"}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { DisclosureContextName, type DisclosureContext } from "./DisclosureTypes";
|
|
2
3
|
|
|
3
4
|
interface DisclosureHeaderProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** The type of HTML header to use */
|
|
9
12
|
as?: "h1" | "h2" | "h3" | "h4" | "h5" | "h6",
|
|
10
13
|
}
|
|
@@ -31,7 +34,8 @@ export default function DisclosureHeader($props: DisclosureHeaderProps | undefin
|
|
|
31
34
|
@// TODO: $props.as
|
|
32
35
|
<h4
|
|
33
36
|
{$props?.id}
|
|
34
|
-
class={
|
|
37
|
+
class={["torp-disclosure-header", $props?.class]}
|
|
38
|
+
{$props?.style}
|
|
35
39
|
data-state={$state.expanded ? "open" : "closed"}
|
|
36
40
|
data-disabled={$state.disabled ? "true" : undefined}
|
|
37
41
|
>
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import getId from "../utils/getId";
|
|
2
3
|
import { DisclosureContextName, type DisclosureContext } from "./DisclosureTypes";
|
|
3
4
|
|
|
4
5
|
interface DisclosureTriggerProps {
|
|
5
6
|
/** An ID for the root element */
|
|
6
7
|
id?: string;
|
|
7
|
-
/**
|
|
8
|
-
class?:
|
|
8
|
+
/** Classes for the root element */
|
|
9
|
+
class?: ClassValue,
|
|
10
|
+
/** Styles for the root element */
|
|
11
|
+
style?: StyleValue,
|
|
9
12
|
}
|
|
10
13
|
|
|
11
14
|
/**
|
|
@@ -28,7 +31,8 @@ export default function DisclosureTrigger($props: DisclosureTriggerProps | undef
|
|
|
28
31
|
<button
|
|
29
32
|
type="button"
|
|
30
33
|
id={$props?.id ?? defaultId}
|
|
31
|
-
class={
|
|
34
|
+
class={["torp-disclosure-trigger", $props?.class]}
|
|
35
|
+
{$props?.style}
|
|
32
36
|
disabled={$state.disabled}
|
|
33
37
|
aria-expanded={$state.expanded.toString()}
|
|
34
38
|
aria-disabled={$state.disabled}
|
package/src/Drawer/Drawer.torp
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
1
2
|
import { DrawerContextName, type DrawerContext, type DrawerState } from "./DrawerTypes";
|
|
2
3
|
|
|
3
4
|
interface DrawerProps {
|
|
4
5
|
/** An ID for the root element */
|
|
5
6
|
id?: string;
|
|
6
|
-
/**
|
|
7
|
-
class?:
|
|
7
|
+
/** Classes for the root element */
|
|
8
|
+
class?: ClassValue,
|
|
9
|
+
/** Styles for the root element */
|
|
10
|
+
style?: StyleValue,
|
|
8
11
|
/** Whether the drawer is modal. If true, an overlay should be supplied to obscure outside content, and only the drawer content will be visible to screen readers */
|
|
9
12
|
modal?: boolean,
|
|
10
13
|
/** Whether the drawer is visible */
|
|
@@ -115,7 +118,8 @@ export default function Drawer($props: DrawerProps | undefined) {
|
|
|
115
118
|
@render {
|
|
116
119
|
<div
|
|
117
120
|
{$props?.id}
|
|
118
|
-
class={
|
|
121
|
+
class={["torp-drawer", $props?.class]}
|
|
122
|
+
{$props?.style}
|
|
119
123
|
>
|
|
120
124
|
<slot />
|
|
121
125
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ClassValue, StyleValue } from "@torpor/view";
|
|
2
2
|
import { slide } from "../motion";
|
|
3
3
|
import { addDocumentEvent, removeDocumentEvent } from "../utils/documentEvents";
|
|
4
4
|
import { DrawerContextName, type DrawerContext } from "./DrawerTypes";
|
|
@@ -6,8 +6,10 @@ import { DrawerContextName, type DrawerContext } from "./DrawerTypes";
|
|
|
6
6
|
interface DrawerContentProps {
|
|
7
7
|
/** An ID for the root element */
|
|
8
8
|
id?: string;
|
|
9
|
-
/**
|
|
10
|
-
class?:
|
|
9
|
+
/** Classes for the root element */
|
|
10
|
+
class?: ClassValue,
|
|
11
|
+
/** Styles for the root element */
|
|
12
|
+
style?: StyleValue,
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -67,7 +69,8 @@ export default function DrawerContent($props: DrawerContentProps | undefined) {
|
|
|
67
69
|
@if ($state.visible) {
|
|
68
70
|
<div
|
|
69
71
|
{$props?.id}
|
|
70
|
-
class={
|
|
72
|
+
class={["torp-drawer-content", $props?.class]}
|
|
73
|
+
{$props?.style}
|
|
71
74
|
style="position: fixed;"
|
|
72
75
|
transition={(e) => slide(e, { side: $state.position })}
|
|
73
76
|
&ref={drawer}
|