@stratakit/structures 0.1.0 → 0.1.1
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 +18 -0
- package/dist/AccordionItem.d.ts +133 -0
- package/dist/AccordionItem.js +103 -0
- package/dist/Banner.d.ts +81 -0
- package/dist/Banner.js +71 -0
- package/dist/Chip.d.ts +35 -0
- package/dist/Chip.js +41 -0
- package/dist/DEV/AccordionItem.js +109 -0
- package/dist/DEV/Banner.js +72 -0
- package/dist/DEV/Chip.js +42 -0
- package/dist/DEV/DropdownMenu.js +235 -0
- package/dist/DEV/ErrorRegion.js +164 -0
- package/dist/DEV/Table.js +151 -0
- package/dist/DEV/Tabs.js +66 -0
- package/dist/DEV/Toolbar.js +27 -0
- package/dist/DEV/Tree.js +26 -0
- package/dist/DEV/TreeItem.js +395 -0
- package/dist/DEV/index.js +21 -0
- package/dist/DEV/styles.css.js +1 -1
- package/dist/DEV/~utils.ListItem.js +49 -0
- package/dist/DEV/~utils.icons.js +61 -0
- package/dist/DropdownMenu.d.ts +113 -0
- package/dist/DropdownMenu.js +228 -0
- package/dist/ErrorRegion.d.ts +83 -0
- package/dist/ErrorRegion.js +162 -0
- package/dist/Table.d.ts +172 -0
- package/dist/Table.js +144 -0
- package/dist/Tabs.d.ts +81 -0
- package/dist/Tabs.js +62 -0
- package/dist/Toolbar.d.ts +36 -0
- package/dist/Toolbar.js +25 -0
- package/dist/Tree.d.ts +22 -0
- package/dist/Tree.js +25 -0
- package/dist/TreeItem.d.ts +183 -0
- package/dist/TreeItem.js +370 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +21 -0
- package/dist/styles.css.js +1 -1
- package/dist/~utils.ListItem.d.ts +14 -0
- package/dist/~utils.ListItem.js +46 -0
- package/dist/~utils.icons.d.ts +10 -0
- package/dist/~utils.icons.js +56 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- [#704](https://github.com/iTwin/design-system/pull/704): The following components have been moved from `@stratakit/bricks` into `@stratakit/structures`.
|
|
6
|
+
|
|
7
|
+
- `unstable_AccordionItem`
|
|
8
|
+
- `unstable_Banner`
|
|
9
|
+
- `Chip`
|
|
10
|
+
- `DropdownMenu`
|
|
11
|
+
- `unstable_ErrorRegion`
|
|
12
|
+
- `Table`
|
|
13
|
+
- `Tabs`
|
|
14
|
+
- `unstable_Toolbar`
|
|
15
|
+
- `Tree`
|
|
16
|
+
|
|
17
|
+
- Updated dependencies:
|
|
18
|
+
- @stratakit/bricks@0.2.0
|
|
19
|
+
- @stratakit/foundations@0.1.3
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
2
|
+
interface AccordionItemProps extends BaseProps {
|
|
3
|
+
/**
|
|
4
|
+
* The accordion item’s initial open state.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The accordion item’s controlled open state.
|
|
11
|
+
*
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
open?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Callback fired when the accordion item is opened.
|
|
17
|
+
*
|
|
18
|
+
* Should be used with the `open` prop.
|
|
19
|
+
*/
|
|
20
|
+
onOpenChange?: (open: boolean) => void;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* An item within an accordion.
|
|
24
|
+
*
|
|
25
|
+
* Bare minimum example:
|
|
26
|
+
* ```tsx
|
|
27
|
+
* <AccordionItem.Root>
|
|
28
|
+
* <AccordionItem.Trigger>
|
|
29
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
30
|
+
* <AccordionItem.Marker />
|
|
31
|
+
* </AccordionItem.Trigger>
|
|
32
|
+
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
33
|
+
* </AccordionItem.Root>
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* Example with a decoration:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <AccordionItem.Root>
|
|
39
|
+
* <AccordionItem.Trigger>
|
|
40
|
+
* <AccordionItem.Decoration render={<Icon href={placeholder} />} />
|
|
41
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
42
|
+
* <AccordionItem.Marker />
|
|
43
|
+
* </AccordionItem.Trigger>
|
|
44
|
+
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
45
|
+
* </AccordionItem.Root>
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
declare const AccordionItemRoot: import("react").ForwardRefExoticComponent<AccordionItemProps & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
49
|
+
/**
|
|
50
|
+
* The trigger for collapsing and expanding an accordion item’s content.
|
|
51
|
+
*
|
|
52
|
+
* Must include an `AccordionItem.Label` as a direct descendant.
|
|
53
|
+
*
|
|
54
|
+
* Example:
|
|
55
|
+
* ```tsx
|
|
56
|
+
* <AccordionItem.Root>
|
|
57
|
+
* <AccordionItem.Trigger>
|
|
58
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
59
|
+
* <AccordionItem.Marker />
|
|
60
|
+
* </AccordionItem.Trigger>
|
|
61
|
+
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
62
|
+
* </AccordionItem.Root>
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare const AccordionItemTrigger: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "render"> & import("react").RefAttributes<HTMLElement | HTMLButtonElement>>;
|
|
66
|
+
/**
|
|
67
|
+
* The always-visible label of an accordion item’s trigger.
|
|
68
|
+
*
|
|
69
|
+
* Use as a direct descendant of `AccordionItem.Trigger`.
|
|
70
|
+
*
|
|
71
|
+
* Example:
|
|
72
|
+
* ```tsx
|
|
73
|
+
* <AccordionItem.Trigger>
|
|
74
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
75
|
+
* <AccordionItem.Marker />
|
|
76
|
+
* </AccordionItem.Trigger>
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare const AccordionItemLabel: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
80
|
+
/**
|
|
81
|
+
* The always-visible, optional decoration of an accordion item’s trigger.
|
|
82
|
+
*
|
|
83
|
+
* Use as a direct descendant of `AccordionItem.Trigger`. This will be visually
|
|
84
|
+
* presented before the trigger’s label.
|
|
85
|
+
*
|
|
86
|
+
* Example:
|
|
87
|
+
* ```tsx
|
|
88
|
+
* <AccordionItem.Trigger>
|
|
89
|
+
* <AccordionItem.Decoration render={<Icon href={placeholder} />} />
|
|
90
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
91
|
+
* <AccordionItem.Marker />
|
|
92
|
+
* </AccordionItem.Trigger>
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
declare const AccordionItemDecoration: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
96
|
+
/**
|
|
97
|
+
* The visual marker of an accordion item’s trigger.
|
|
98
|
+
*
|
|
99
|
+
* Example:
|
|
100
|
+
* ```tsx
|
|
101
|
+
* <AccordionItem.Trigger>
|
|
102
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
103
|
+
* <AccordionItem.Marker />
|
|
104
|
+
* </AccordionItem.Trigger>
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* Pass an icon as a child to override the default chevron icon:
|
|
108
|
+
* ```tsx
|
|
109
|
+
* <AccordionItem.Trigger>
|
|
110
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
111
|
+
* <AccordionItem.Marker>
|
|
112
|
+
* <Icon href={placeholder} />
|
|
113
|
+
* </AccordionItem.Marker>
|
|
114
|
+
* </AccordionItem.Trigger>
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
declare const AccordionItemMarker: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
118
|
+
/**
|
|
119
|
+
* The disclosed content of the accordion item.
|
|
120
|
+
*
|
|
121
|
+
* Example:
|
|
122
|
+
* ```tsx
|
|
123
|
+
* <AccordionItem.Root>
|
|
124
|
+
* <AccordionItem.Trigger>
|
|
125
|
+
* <AccordionItem.Label>Label</AccordionItem.Label>
|
|
126
|
+
* <AccordionItem.Marker />
|
|
127
|
+
* </AccordionItem.Trigger>
|
|
128
|
+
* <AccordionItem.Content>Body</AccordionItem.Content>
|
|
129
|
+
* </AccordionItem.Root>
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
declare const AccordionItemContent: import("react").ForwardRefExoticComponent<Pick<import("@ariakit/react/role").RoleProps, "render"> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref">, "render"> & import("react").RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
133
|
+
export { AccordionItemRoot as Root, AccordionItemContent as Content, AccordionItemTrigger as Trigger, AccordionItemLabel as Label, AccordionItemDecoration as Decoration, AccordionItemMarker as Marker, };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Disclosure,
|
|
4
|
+
DisclosureContent,
|
|
5
|
+
DisclosureProvider
|
|
6
|
+
} from "@ariakit/react/disclosure";
|
|
7
|
+
import { Role } from "@ariakit/react/role";
|
|
8
|
+
import { Text } from "@stratakit/bricks";
|
|
9
|
+
import {
|
|
10
|
+
GhostAligner,
|
|
11
|
+
IconButtonPresentation
|
|
12
|
+
} from "@stratakit/bricks/secret-internals";
|
|
13
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
14
|
+
import cx from "classnames";
|
|
15
|
+
import { ChevronDown } from "./~utils.icons.js";
|
|
16
|
+
const AccordionItemRoot = forwardRef(
|
|
17
|
+
(props, forwardedRef) => {
|
|
18
|
+
const { defaultOpen, open, onOpenChange, ...rest } = props;
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
DisclosureProvider,
|
|
21
|
+
{
|
|
22
|
+
defaultOpen,
|
|
23
|
+
open,
|
|
24
|
+
setOpen: onOpenChange,
|
|
25
|
+
children: /* @__PURE__ */ jsx(
|
|
26
|
+
Role,
|
|
27
|
+
{
|
|
28
|
+
...rest,
|
|
29
|
+
className: cx("\u{1F95D}-accordion-item", props.className),
|
|
30
|
+
ref: forwardedRef
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
const AccordionItemTrigger = forwardRef(
|
|
38
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(GhostAligner, { align: "block", children: /* @__PURE__ */ jsx(
|
|
39
|
+
Disclosure,
|
|
40
|
+
{
|
|
41
|
+
...props,
|
|
42
|
+
className: cx("\u{1F95D}-accordion-item-trigger", props.className),
|
|
43
|
+
ref: forwardedRef
|
|
44
|
+
}
|
|
45
|
+
) })
|
|
46
|
+
);
|
|
47
|
+
const AccordionItemLabel = forwardRef(
|
|
48
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
49
|
+
Text,
|
|
50
|
+
{
|
|
51
|
+
...props,
|
|
52
|
+
variant: "body-sm",
|
|
53
|
+
className: cx("\u{1F95D}-accordion-item-label", props.className),
|
|
54
|
+
ref: forwardedRef
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
const AccordionItemDecoration = forwardRef(
|
|
59
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
60
|
+
Role,
|
|
61
|
+
{
|
|
62
|
+
...props,
|
|
63
|
+
className: cx("\u{1F95D}-accordion-item-decoration", props.className),
|
|
64
|
+
ref: forwardedRef
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
const AccordionItemMarker = forwardRef(
|
|
69
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
70
|
+
IconButtonPresentation,
|
|
71
|
+
{
|
|
72
|
+
...props,
|
|
73
|
+
variant: "ghost",
|
|
74
|
+
className: cx("\u{1F95D}-accordion-item-marker", props.className),
|
|
75
|
+
ref: forwardedRef,
|
|
76
|
+
children: props.children ?? /* @__PURE__ */ jsx(
|
|
77
|
+
ChevronDown,
|
|
78
|
+
{
|
|
79
|
+
"aria-hidden": "true",
|
|
80
|
+
className: "\u{1F95D}-accordion-item-marker-chevron"
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
);
|
|
86
|
+
const AccordionItemContent = forwardRef(
|
|
87
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
88
|
+
DisclosureContent,
|
|
89
|
+
{
|
|
90
|
+
...props,
|
|
91
|
+
className: cx("\u{1F95D}-accordion-item-content", props.className),
|
|
92
|
+
ref: forwardedRef
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
);
|
|
96
|
+
export {
|
|
97
|
+
AccordionItemContent as Content,
|
|
98
|
+
AccordionItemDecoration as Decoration,
|
|
99
|
+
AccordionItemLabel as Label,
|
|
100
|
+
AccordionItemMarker as Marker,
|
|
101
|
+
AccordionItemRoot as Root,
|
|
102
|
+
AccordionItemTrigger as Trigger
|
|
103
|
+
};
|
package/dist/Banner.d.ts
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
+
/**
|
|
4
|
+
* A banner to highlight information and also optionally provide actions.
|
|
5
|
+
* The information could be very important (like a call to action) or reasonably import (like a status message).
|
|
6
|
+
*
|
|
7
|
+
* Example:
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <Banner label="Title" message="Message" icon={placeholderIcon} onDismiss={() => {}} />
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export declare const Banner: React.ForwardRefExoticComponent<Omit<BaseProps, "children"> & {
|
|
13
|
+
/**
|
|
14
|
+
* Icon to be displayed inside the banner.
|
|
15
|
+
*
|
|
16
|
+
* Can be a URL of an SVG from the `@stratakit/icons` package,
|
|
17
|
+
* or a custom JSX icon.
|
|
18
|
+
*
|
|
19
|
+
* - If `icon=undefined` and `tone="neutral"`, no icon is shown.
|
|
20
|
+
* - If `icon=undefined` and `tone!="neutral"`, the status icon will be shown.
|
|
21
|
+
*/
|
|
22
|
+
icon?: string | React.JSX.Element;
|
|
23
|
+
/**
|
|
24
|
+
* The label displayed inside the banner.
|
|
25
|
+
*
|
|
26
|
+
* Either pass a string or a `<VisuallyHidden>` component if you don't want the label to be visible.
|
|
27
|
+
*/
|
|
28
|
+
label: string | React.JSX.Element;
|
|
29
|
+
/**
|
|
30
|
+
* The content of the banner.
|
|
31
|
+
*/
|
|
32
|
+
message: React.ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Callback invoked when the dismiss ("❌") button is clicked.
|
|
35
|
+
*
|
|
36
|
+
* If `undefined`, the dismiss button will not be rendered.
|
|
37
|
+
*
|
|
38
|
+
* @default undefined
|
|
39
|
+
*/
|
|
40
|
+
onDismiss?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* The actions available for the banner.
|
|
43
|
+
*
|
|
44
|
+
* Example with one action:
|
|
45
|
+
* ```tsx
|
|
46
|
+
* actions={<Button key={…} onClick={}>Action</Button>}
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Example with two `Button`s:
|
|
50
|
+
* ```tsx
|
|
51
|
+
* actions={
|
|
52
|
+
* <>
|
|
53
|
+
* <Button key={…} onClick={…}>Action 1</Button>,
|
|
54
|
+
* <Button key={…} onClick={…}>Action 2</Button>,
|
|
55
|
+
* </>
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*
|
|
59
|
+
* Example with two `Anchor`s as `Button`:
|
|
60
|
+
* ```tsx
|
|
61
|
+
* actions={
|
|
62
|
+
* <>
|
|
63
|
+
* <Anchor key={…} render={<button />} onClick={…}>Action 1</Anchor>,
|
|
64
|
+
* <Anchor key={…} render={<button />} onClick={…}>Action 2</Anchor>,
|
|
65
|
+
* </>
|
|
66
|
+
* }
|
|
67
|
+
*/
|
|
68
|
+
actions?: React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* The tone of the banner.
|
|
71
|
+
*
|
|
72
|
+
* @default "neutral"
|
|
73
|
+
*/
|
|
74
|
+
tone?: "neutral" | "info" | "positive" | "attention" | "critical";
|
|
75
|
+
/**
|
|
76
|
+
* The variant of the banner.
|
|
77
|
+
*
|
|
78
|
+
* @default "outline"
|
|
79
|
+
*/
|
|
80
|
+
variant?: "outline";
|
|
81
|
+
} & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
package/dist/Banner.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import { IconButton, Text } from "@stratakit/bricks";
|
|
4
|
+
import { GhostAligner } from "@stratakit/bricks/secret-internals";
|
|
5
|
+
import { Icon } from "@stratakit/foundations";
|
|
6
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
7
|
+
import cx from "classnames";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Dismiss, StatusIcon } from "./~utils.icons.js";
|
|
10
|
+
const Banner = forwardRef((props, forwardedRef) => {
|
|
11
|
+
const {
|
|
12
|
+
message,
|
|
13
|
+
label,
|
|
14
|
+
actions,
|
|
15
|
+
onDismiss,
|
|
16
|
+
tone = "neutral",
|
|
17
|
+
icon = tone !== "neutral" ? /* @__PURE__ */ jsx(StatusIcon, { tone }) : void 0,
|
|
18
|
+
variant = "outline",
|
|
19
|
+
...rest
|
|
20
|
+
} = props;
|
|
21
|
+
const baseId = React.useId();
|
|
22
|
+
const labelId = `${baseId}-label`;
|
|
23
|
+
const dismissId = `${baseId}-dismiss`;
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
Role,
|
|
26
|
+
{
|
|
27
|
+
...rest,
|
|
28
|
+
"data-kiwi-tone": tone,
|
|
29
|
+
"data-kiwi-variant": variant,
|
|
30
|
+
className: cx("\u{1F95D}-banner", props.className),
|
|
31
|
+
ref: forwardedRef,
|
|
32
|
+
children: [
|
|
33
|
+
icon ? /* @__PURE__ */ jsx(
|
|
34
|
+
Icon,
|
|
35
|
+
{
|
|
36
|
+
className: "\u{1F95D}-banner-icon",
|
|
37
|
+
href: typeof icon === "string" ? icon : void 0,
|
|
38
|
+
render: React.isValidElement(icon) ? icon : void 0
|
|
39
|
+
}
|
|
40
|
+
) : null,
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Text,
|
|
43
|
+
{
|
|
44
|
+
className: "\u{1F95D}-banner-label",
|
|
45
|
+
id: labelId,
|
|
46
|
+
variant: "body-sm",
|
|
47
|
+
render: React.isValidElement(label) ? label : /* @__PURE__ */ jsx("span", {}),
|
|
48
|
+
children: !React.isValidElement(label) ? label : void 0
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsx(Text, { render: /* @__PURE__ */ jsx("div", {}), variant: "body-sm", className: "\u{1F95D}-banner-message", children: message }),
|
|
52
|
+
actions != null ? /* @__PURE__ */ jsx("div", { className: "\u{1F95D}-banner-actions", children: actions }) : null,
|
|
53
|
+
onDismiss ? /* @__PURE__ */ jsx(GhostAligner, { align: "block", children: /* @__PURE__ */ jsx(
|
|
54
|
+
IconButton,
|
|
55
|
+
{
|
|
56
|
+
id: dismissId,
|
|
57
|
+
className: "\u{1F95D}-banner-dismiss-button",
|
|
58
|
+
variant: "ghost",
|
|
59
|
+
label: "Dismiss",
|
|
60
|
+
"aria-labelledby": `${dismissId} ${labelId}`,
|
|
61
|
+
icon: /* @__PURE__ */ jsx(Dismiss, {}),
|
|
62
|
+
onClick: onDismiss
|
|
63
|
+
}
|
|
64
|
+
) }) : null
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
export {
|
|
70
|
+
Banner
|
|
71
|
+
};
|
package/dist/Chip.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { BaseProps } from "@stratakit/foundations/secret-internals";
|
|
3
|
+
interface ChipProps extends Omit<BaseProps<"div">, "children"> {
|
|
4
|
+
/**
|
|
5
|
+
* The label displayed inside the chip.
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* The variant style of the Chip.
|
|
10
|
+
* Use "solid" for primary states and "outline" for less prominent states.
|
|
11
|
+
*
|
|
12
|
+
* @default "solid"
|
|
13
|
+
*/
|
|
14
|
+
variant?: "solid" | "outline";
|
|
15
|
+
/**
|
|
16
|
+
* Callback invoked when the dismiss ("❌") button is clicked.
|
|
17
|
+
*
|
|
18
|
+
* If `undefined`, the dismiss button will not be rendered.
|
|
19
|
+
*
|
|
20
|
+
* @default undefined
|
|
21
|
+
*/
|
|
22
|
+
onDismiss?: () => void;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Chip is a UI component used to represent an item, attribute, or action in a compact visual style.
|
|
26
|
+
* It supports two visual variants: `solid` for primary emphasis and `outline` for less prominent states.
|
|
27
|
+
*
|
|
28
|
+
* Example:
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <Chip label="Value" />
|
|
31
|
+
* <Chip label="Value" variant="outline" />
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.RefAttributes<HTMLDivElement | HTMLElement>>;
|
|
35
|
+
export {};
|
package/dist/Chip.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import { IconButton } from "@stratakit/bricks";
|
|
4
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
5
|
+
import cx from "classnames";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { Dismiss } from "./~utils.icons.js";
|
|
8
|
+
const Chip = forwardRef((props, forwardedRef) => {
|
|
9
|
+
const { variant = "solid", onDismiss, label, ...rest } = props;
|
|
10
|
+
const baseId = React.useId();
|
|
11
|
+
const labelId = `${baseId}-label`;
|
|
12
|
+
const dismissIconId = `${baseId}-dismiss`;
|
|
13
|
+
return /* @__PURE__ */ jsxs(
|
|
14
|
+
Role.div,
|
|
15
|
+
{
|
|
16
|
+
"data-kiwi-variant": variant,
|
|
17
|
+
...rest,
|
|
18
|
+
className: cx("\u{1F95D}-chip", props.className),
|
|
19
|
+
ref: forwardedRef,
|
|
20
|
+
children: [
|
|
21
|
+
/* @__PURE__ */ jsx("span", { id: labelId, children: label }),
|
|
22
|
+
onDismiss && /* @__PURE__ */ jsx(
|
|
23
|
+
IconButton,
|
|
24
|
+
{
|
|
25
|
+
id: dismissIconId,
|
|
26
|
+
className: "\u{1F95D}-chip-dismiss-button",
|
|
27
|
+
variant: "ghost",
|
|
28
|
+
"aria-labelledby": `${dismissIconId} ${labelId}`,
|
|
29
|
+
label: "Dismiss",
|
|
30
|
+
labelVariant: "visually-hidden",
|
|
31
|
+
icon: /* @__PURE__ */ jsx(Dismiss, {}),
|
|
32
|
+
onClick: onDismiss
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
export {
|
|
40
|
+
Chip
|
|
41
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
Disclosure,
|
|
4
|
+
DisclosureContent,
|
|
5
|
+
DisclosureProvider
|
|
6
|
+
} from "@ariakit/react/disclosure";
|
|
7
|
+
import { Role } from "@ariakit/react/role";
|
|
8
|
+
import { Text } from "@stratakit/bricks";
|
|
9
|
+
import {
|
|
10
|
+
GhostAligner,
|
|
11
|
+
IconButtonPresentation
|
|
12
|
+
} from "@stratakit/bricks/secret-internals";
|
|
13
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
14
|
+
import cx from "classnames";
|
|
15
|
+
import { ChevronDown } from "./~utils.icons.js";
|
|
16
|
+
const AccordionItemRoot = forwardRef(
|
|
17
|
+
(props, forwardedRef) => {
|
|
18
|
+
const { defaultOpen, open, onOpenChange, ...rest } = props;
|
|
19
|
+
return /* @__PURE__ */ jsx(
|
|
20
|
+
DisclosureProvider,
|
|
21
|
+
{
|
|
22
|
+
defaultOpen,
|
|
23
|
+
open,
|
|
24
|
+
setOpen: onOpenChange,
|
|
25
|
+
children: /* @__PURE__ */ jsx(
|
|
26
|
+
Role,
|
|
27
|
+
{
|
|
28
|
+
...rest,
|
|
29
|
+
className: cx("\u{1F95D}-accordion-item", props.className),
|
|
30
|
+
ref: forwardedRef
|
|
31
|
+
}
|
|
32
|
+
)
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
DEV: AccordionItemRoot.displayName = "AccordionItem.Root";
|
|
38
|
+
const AccordionItemTrigger = forwardRef(
|
|
39
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(GhostAligner, { align: "block", children: /* @__PURE__ */ jsx(
|
|
40
|
+
Disclosure,
|
|
41
|
+
{
|
|
42
|
+
...props,
|
|
43
|
+
className: cx("\u{1F95D}-accordion-item-trigger", props.className),
|
|
44
|
+
ref: forwardedRef
|
|
45
|
+
}
|
|
46
|
+
) })
|
|
47
|
+
);
|
|
48
|
+
DEV: AccordionItemTrigger.displayName = "AccordionItem.Trigger";
|
|
49
|
+
const AccordionItemLabel = forwardRef(
|
|
50
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
51
|
+
Text,
|
|
52
|
+
{
|
|
53
|
+
...props,
|
|
54
|
+
variant: "body-sm",
|
|
55
|
+
className: cx("\u{1F95D}-accordion-item-label", props.className),
|
|
56
|
+
ref: forwardedRef
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
);
|
|
60
|
+
DEV: AccordionItemLabel.displayName = "AccordionItem.Label";
|
|
61
|
+
const AccordionItemDecoration = forwardRef(
|
|
62
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
63
|
+
Role,
|
|
64
|
+
{
|
|
65
|
+
...props,
|
|
66
|
+
className: cx("\u{1F95D}-accordion-item-decoration", props.className),
|
|
67
|
+
ref: forwardedRef
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
DEV: AccordionItemDecoration.displayName = "AccordionItem.Decoration";
|
|
72
|
+
const AccordionItemMarker = forwardRef(
|
|
73
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
74
|
+
IconButtonPresentation,
|
|
75
|
+
{
|
|
76
|
+
...props,
|
|
77
|
+
variant: "ghost",
|
|
78
|
+
className: cx("\u{1F95D}-accordion-item-marker", props.className),
|
|
79
|
+
ref: forwardedRef,
|
|
80
|
+
children: props.children ?? /* @__PURE__ */ jsx(
|
|
81
|
+
ChevronDown,
|
|
82
|
+
{
|
|
83
|
+
"aria-hidden": "true",
|
|
84
|
+
className: "\u{1F95D}-accordion-item-marker-chevron"
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
);
|
|
90
|
+
DEV: AccordionItemMarker.displayName = "AccordionItem.Marker";
|
|
91
|
+
const AccordionItemContent = forwardRef(
|
|
92
|
+
(props, forwardedRef) => /* @__PURE__ */ jsx(
|
|
93
|
+
DisclosureContent,
|
|
94
|
+
{
|
|
95
|
+
...props,
|
|
96
|
+
className: cx("\u{1F95D}-accordion-item-content", props.className),
|
|
97
|
+
ref: forwardedRef
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
);
|
|
101
|
+
DEV: AccordionItemContent.displayName = "AccordionItem.Content";
|
|
102
|
+
export {
|
|
103
|
+
AccordionItemContent as Content,
|
|
104
|
+
AccordionItemDecoration as Decoration,
|
|
105
|
+
AccordionItemLabel as Label,
|
|
106
|
+
AccordionItemMarker as Marker,
|
|
107
|
+
AccordionItemRoot as Root,
|
|
108
|
+
AccordionItemTrigger as Trigger
|
|
109
|
+
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Role } from "@ariakit/react/role";
|
|
3
|
+
import { IconButton, Text } from "@stratakit/bricks";
|
|
4
|
+
import { GhostAligner } from "@stratakit/bricks/secret-internals";
|
|
5
|
+
import { Icon } from "@stratakit/foundations";
|
|
6
|
+
import { forwardRef } from "@stratakit/foundations/secret-internals";
|
|
7
|
+
import cx from "classnames";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { Dismiss, StatusIcon } from "./~utils.icons.js";
|
|
10
|
+
const Banner = forwardRef((props, forwardedRef) => {
|
|
11
|
+
const {
|
|
12
|
+
message,
|
|
13
|
+
label,
|
|
14
|
+
actions,
|
|
15
|
+
onDismiss,
|
|
16
|
+
tone = "neutral",
|
|
17
|
+
icon = tone !== "neutral" ? /* @__PURE__ */ jsx(StatusIcon, { tone }) : void 0,
|
|
18
|
+
variant = "outline",
|
|
19
|
+
...rest
|
|
20
|
+
} = props;
|
|
21
|
+
const baseId = React.useId();
|
|
22
|
+
const labelId = `${baseId}-label`;
|
|
23
|
+
const dismissId = `${baseId}-dismiss`;
|
|
24
|
+
return /* @__PURE__ */ jsxs(
|
|
25
|
+
Role,
|
|
26
|
+
{
|
|
27
|
+
...rest,
|
|
28
|
+
"data-kiwi-tone": tone,
|
|
29
|
+
"data-kiwi-variant": variant,
|
|
30
|
+
className: cx("\u{1F95D}-banner", props.className),
|
|
31
|
+
ref: forwardedRef,
|
|
32
|
+
children: [
|
|
33
|
+
icon ? /* @__PURE__ */ jsx(
|
|
34
|
+
Icon,
|
|
35
|
+
{
|
|
36
|
+
className: "\u{1F95D}-banner-icon",
|
|
37
|
+
href: typeof icon === "string" ? icon : void 0,
|
|
38
|
+
render: React.isValidElement(icon) ? icon : void 0
|
|
39
|
+
}
|
|
40
|
+
) : null,
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Text,
|
|
43
|
+
{
|
|
44
|
+
className: "\u{1F95D}-banner-label",
|
|
45
|
+
id: labelId,
|
|
46
|
+
variant: "body-sm",
|
|
47
|
+
render: React.isValidElement(label) ? label : /* @__PURE__ */ jsx("span", {}),
|
|
48
|
+
children: !React.isValidElement(label) ? label : void 0
|
|
49
|
+
}
|
|
50
|
+
),
|
|
51
|
+
/* @__PURE__ */ jsx(Text, { render: /* @__PURE__ */ jsx("div", {}), variant: "body-sm", className: "\u{1F95D}-banner-message", children: message }),
|
|
52
|
+
actions != null ? /* @__PURE__ */ jsx("div", { className: "\u{1F95D}-banner-actions", children: actions }) : null,
|
|
53
|
+
onDismiss ? /* @__PURE__ */ jsx(GhostAligner, { align: "block", children: /* @__PURE__ */ jsx(
|
|
54
|
+
IconButton,
|
|
55
|
+
{
|
|
56
|
+
id: dismissId,
|
|
57
|
+
className: "\u{1F95D}-banner-dismiss-button",
|
|
58
|
+
variant: "ghost",
|
|
59
|
+
label: "Dismiss",
|
|
60
|
+
"aria-labelledby": `${dismissId} ${labelId}`,
|
|
61
|
+
icon: /* @__PURE__ */ jsx(Dismiss, {}),
|
|
62
|
+
onClick: onDismiss
|
|
63
|
+
}
|
|
64
|
+
) }) : null
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
DEV: Banner.displayName = "Banner";
|
|
70
|
+
export {
|
|
71
|
+
Banner
|
|
72
|
+
};
|