@ostack.tech/ui 0.16.4 → 1.0.0-rc.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/dist/chunks/{en-DT1KWQei.js → en-DGLb7rrz.js} +3 -1
- package/dist/chunks/en-DGLb7rrz.js.map +1 -0
- package/dist/locales/en-GB.js +2 -2
- package/dist/locales/en-GB.js.map +1 -1
- package/dist/locales/en-US.js +2 -2
- package/dist/locales/en-US.js.map +1 -1
- package/dist/locales/fr-FR.js +3 -1
- package/dist/locales/fr-FR.js.map +1 -1
- package/dist/locales/index.js +5 -0
- package/dist/locales/pt-PT.js +3 -1
- package/dist/locales/pt-PT.js.map +1 -1
- package/dist/ostack-ui.css +32 -9
- package/dist/ostack-ui.js +7632 -7154
- package/dist/ostack-ui.js.map +1 -1
- package/package.json +5 -1
- package/scss/_utils.scss +1 -0
- package/scss/components/Actions/_Actions-variables.scss +5 -0
- package/scss/components/Actions/_Actions.scss +19 -0
- package/scss/components/ButtonGroup/_ButtonGroup.scss +2 -2
- package/scss/components/Root/_Root.scss +3 -3
- package/scss/components/Toast/_Toast.scss +1 -1
- package/scss/index.scss +1 -0
- package/scss/scss/placeholders/menu/_menu.scss +22 -4
- package/types/components/Actions/Action.d.ts +38 -0
- package/types/components/Actions/ActionGroup.d.ts +36 -0
- package/types/components/Actions/ActionMenu.d.ts +48 -0
- package/types/components/Actions/ActionMenuCheckboxItem.d.ts +5 -0
- package/types/components/Actions/ActionMenuRadioGroup.d.ts +5 -0
- package/types/components/Actions/ActionMenuRadioItem.d.ts +5 -0
- package/types/components/Actions/ActionSplit.d.ts +28 -0
- package/types/components/Actions/Actions.d.ts +87 -0
- package/types/components/Actions/ActionsContext.d.ts +13 -0
- package/types/components/Actions/ActionsSecondary.d.ts +6 -0
- package/types/components/Actions/index.d.ts +10 -0
- package/types/components/Actions/useActionsLayouts.d.ts +9 -0
- package/types/components/AlertDialog/AlertDialogContent.d.ts +3 -3
- package/types/components/Button/Button.d.ts +1 -1
- package/types/components/ButtonGroup/ButtonGroup.d.ts +4 -2
- package/types/components/Collapsible/Collapsible.d.ts +1 -1
- package/types/components/CommandMenu/CommandMenu.d.ts +2 -2
- package/types/components/CommandMenu/CommandMenuDialog.d.ts +1 -1
- package/types/components/DataTable/DataTableSelectionTrigger.d.ts +19 -4
- package/types/components/MenuList/MenuList.d.ts +1 -1
- package/types/components/MenuList/MenuListItem.d.ts +2 -2
- package/types/components/Printer/PrinterContentContext.d.ts +1 -1
- package/types/components/Tag/Tag.d.ts +2 -2
- package/types/index.d.ts +1 -1
- package/types/providers/LocalizationProvider/LocalizationObject.d.ts +3 -0
- package/types/utils/breakpoints.d.ts +6 -0
- package/types/utils/useResponsiveValues.d.ts +14 -1
- package/types/utils/useSafeLayoutEffect.d.ts +2 -2
- package/dist/chunks/en-DT1KWQei.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ostack.tech/ui",
|
|
3
3
|
"description": "ostack/UI component library.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.0-rc.1",
|
|
5
5
|
"homepage": "https://ui.ostack.tech/",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Opensoft",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"types": "./types/index.d.ts",
|
|
23
23
|
"import": "./dist/ostack-ui.js"
|
|
24
24
|
},
|
|
25
|
+
"./locales": {
|
|
26
|
+
"types": "./types/locales/index.d.ts",
|
|
27
|
+
"import": "./dist/locales/index.js"
|
|
28
|
+
},
|
|
25
29
|
"./locales/*": {
|
|
26
30
|
"types": "./types/locales/*.d.ts",
|
|
27
31
|
"import": "./dist/locales/*.js"
|
package/scss/_utils.scss
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
@forward "scss/utils/transition";
|
|
13
13
|
|
|
14
14
|
// Component/placeholder variables
|
|
15
|
+
@forward "components/Actions/Actions-variables";
|
|
15
16
|
@forward "scss/placeholders/button/button-variables";
|
|
16
17
|
@forward "scss/placeholders/control/control-variables";
|
|
17
18
|
@forward "components/Label/Label-variables";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
@use "Actions-variables" as *;
|
|
2
|
+
@use "../../scss/base-variables" as *;
|
|
3
|
+
@use "../../scss/utils/declare-var" as *;
|
|
4
|
+
|
|
5
|
+
.#{$prefix}actions {
|
|
6
|
+
min-width: max-content;
|
|
7
|
+
max-width: max-content;
|
|
8
|
+
|
|
9
|
+
&__container {
|
|
10
|
+
flex: 1 1 auto;
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__split-trigger {
|
|
17
|
+
min-width: $actions-split-trigger-min-width !important;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
position: relative;
|
|
18
18
|
flex: 1 1 auto;
|
|
19
19
|
|
|
20
|
-
&:not(:
|
|
20
|
+
&:not(:nth-child(1 of :not([hidden]))) {
|
|
21
21
|
border-top-left-radius: 0;
|
|
22
22
|
border-bottom-left-radius: 0;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
&:not(:last-child) {
|
|
25
|
+
&:not(:nth-last-child(1 of :not([hidden]))) {
|
|
26
26
|
border-top-right-radius: 0;
|
|
27
27
|
border-bottom-right-radius: 0;
|
|
28
28
|
}
|
|
@@ -68,15 +68,15 @@
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
.#{$prefix}root {
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
|
|
71
73
|
font-family: $root-font-family;
|
|
72
74
|
font-size: $root-font-size;
|
|
73
75
|
line-height: $root-line-height;
|
|
74
76
|
color: $root-color;
|
|
75
77
|
|
|
76
78
|
// Global styles
|
|
77
|
-
*,
|
|
78
|
-
*::before,
|
|
79
|
-
*::after {
|
|
79
|
+
:is(*, *::before, *::after) {
|
|
80
80
|
box-sizing: border-box;
|
|
81
81
|
}
|
|
82
82
|
|
package/scss/index.scss
CHANGED
|
@@ -26,10 +26,28 @@
|
|
|
26
26
|
color: $menu-group-label-color;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
&__group-item
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
&__group-item {
|
|
30
|
+
// `cmdk` hides groups when searching via `[hidden]` instead of removing
|
|
31
|
+
// them, thus we use these selectors instead of `:not(:first-child)`,
|
|
32
|
+
// `:not(:last-child)`
|
|
33
|
+
&:not(:nth-child(1 of :not([hidden]))) {
|
|
34
|
+
margin-top: $menu-group-margin-y;
|
|
35
|
+
padding-top: $menu-group-margin-y;
|
|
36
|
+
border-top: $menu-group-separator-width solid $menu-group-separator-color;
|
|
37
|
+
}
|
|
38
|
+
// The dropdown menu content renders a `<span>` for the arrow at the end,
|
|
39
|
+
// which we should exclude from the last-child selector
|
|
40
|
+
&:not(:nth-last-child(1 of :not([hidden], span))) {
|
|
41
|
+
margin-bottom: $menu-group-margin-y;
|
|
42
|
+
padding-bottom: $menu-group-margin-y;
|
|
43
|
+
border-bottom: $menu-group-separator-width solid
|
|
44
|
+
$menu-group-separator-color;
|
|
45
|
+
}
|
|
46
|
+
& + &:not([hidden]) {
|
|
47
|
+
margin-top: 0;
|
|
48
|
+
padding-top: 0;
|
|
49
|
+
border-top: 0;
|
|
50
|
+
}
|
|
33
51
|
}
|
|
34
52
|
|
|
35
53
|
&__group-item,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ReactNode, Ref } from "react";
|
|
2
|
+
import { type Responsive } from "../../utils/useResponsiveValues.ts";
|
|
3
|
+
import { type ButtonProps } from "../Button";
|
|
4
|
+
import { type IconButtonProps } from "../IconButton";
|
|
5
|
+
/** Supported action layouts. */
|
|
6
|
+
export type ActionLayout = "horizontal" | "vertical" | "icon";
|
|
7
|
+
/** Properties of the action component. */
|
|
8
|
+
export type ActionProps = ActionLinkProps | ActionButtonProps;
|
|
9
|
+
/** Own properties of the action component. */
|
|
10
|
+
export interface ActionOwnProps extends Pick<IconButtonProps, "circle"> {
|
|
11
|
+
/** Whether to render the action as a link. */
|
|
12
|
+
asLink?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Layout of the action. This property overrides the layout specified via
|
|
15
|
+
* `Actions`'s `primaryLayout`/`secondaryLayout`.
|
|
16
|
+
*/
|
|
17
|
+
layout?: Responsive<ActionLayout>;
|
|
18
|
+
/** Label of the action. */
|
|
19
|
+
label: ReactNode;
|
|
20
|
+
/** Element reference. */
|
|
21
|
+
ref?: Ref<HTMLElement>;
|
|
22
|
+
}
|
|
23
|
+
/** Properties of the action when `asLink` is set. */
|
|
24
|
+
export interface ActionLinkProps extends ActionOwnProps, Omit<ButtonProps<"a">, "children" | "vertical" | "as" | "ref"> {
|
|
25
|
+
asLink: true;
|
|
26
|
+
}
|
|
27
|
+
/** Properties of the action when `asLink` is not set. */
|
|
28
|
+
export interface ActionButtonProps extends ActionOwnProps, Omit<ButtonProps, "children" | "vertical" | "as" | "ref"> {
|
|
29
|
+
asLink?: false;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Single action which can be rendered inline or within a menu of actions.
|
|
33
|
+
*
|
|
34
|
+
* Renders distinct components depending on the context and layout: within a
|
|
35
|
+
* dropdown menu, it always renders as a `DropdownMenuItem`, otherwise it
|
|
36
|
+
* renders as a `Button` or `IconButton` depending on the specified layout.
|
|
37
|
+
*/
|
|
38
|
+
export declare function Action({ asLink, layout, label, icon, iconPlacement, circle, variant, color, className, ref, ...otherProps }: ActionProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type ButtonGroupProps } from "../ButtonGroup";
|
|
2
|
+
import { type DropdownMenuGroupProps } from "../DropdownMenu";
|
|
3
|
+
/** Properties of the action group component. */
|
|
4
|
+
export interface ActionGroupProps extends ButtonGroupProps, Omit<DropdownMenuGroupProps, keyof ButtonGroupProps> {
|
|
5
|
+
/**
|
|
6
|
+
* Whether the actions should be grouped when rendered inline. When set, all
|
|
7
|
+
* actions will be rendered within a `ButtonGroup` component, unless they are
|
|
8
|
+
* already in one.
|
|
9
|
+
*
|
|
10
|
+
* @default true
|
|
11
|
+
*/
|
|
12
|
+
groupInline?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the actions should be grouped when rendered within a dropdown menu.
|
|
15
|
+
* When set, all actions will be rendered within a `DropdownMenuGroup`
|
|
16
|
+
* component, unless they are already in one.
|
|
17
|
+
*
|
|
18
|
+
* @default true
|
|
19
|
+
*/
|
|
20
|
+
groupCollapsed?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Properties to pass to the `ButtonGroup` component, when rendering the group
|
|
23
|
+
* inline and `groupInline` is set.
|
|
24
|
+
*/
|
|
25
|
+
buttonGroupProps?: Omit<ButtonGroupProps, "children">;
|
|
26
|
+
/**
|
|
27
|
+
* Properties to pass to the `DropdownMenuGroup` component, when rendering the
|
|
28
|
+
* group in a dropdown menu and `groupCollapsed` is set.
|
|
29
|
+
*/
|
|
30
|
+
dropdownMenuGroupProps?: Omit<DropdownMenuGroupProps, "children" | "label">;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Component used to group actions together, both inline or within a dropdown
|
|
34
|
+
* menu.
|
|
35
|
+
*/
|
|
36
|
+
export declare function ActionGroup({ groupInline, groupCollapsed, buttonGroupProps, dropdownMenuGroupProps, children, ...otherProps }: ActionGroupProps): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type DropdownMenuContentProps, type DropdownMenuGroupProps, type DropdownMenuProps, type DropdownMenuSubContentProps, type DropdownMenuSubProps, type DropdownMenuSubTriggerProps } from "../DropdownMenu";
|
|
3
|
+
import { type ActionButtonProps } from "./Action.tsx";
|
|
4
|
+
/** Layout of the collapsed action menu. */
|
|
5
|
+
export type ActionMenuDropdownMenuLayout = "group" | "sub";
|
|
6
|
+
/** Properties of the action menu component. */
|
|
7
|
+
export interface ActionMenuProps extends ActionButtonProps, Pick<DropdownMenuProps, "defaultOpen" | "open" | "onOpenChange" | "modal"> {
|
|
8
|
+
/**
|
|
9
|
+
* Layout of the menu when rendering within a dropdown. Whether to render the
|
|
10
|
+
* menu as a group or a sub-menu within the dropdown.
|
|
11
|
+
*
|
|
12
|
+
* @default "sub"
|
|
13
|
+
*/
|
|
14
|
+
collapsedLayout?: ActionMenuDropdownMenuLayout;
|
|
15
|
+
/**
|
|
16
|
+
* Properties to pass to the `DropdownMenuContent` component when rendering
|
|
17
|
+
* outside a dropdown.
|
|
18
|
+
*/
|
|
19
|
+
dropdownMenuContentProps?: DropdownMenuContentProps;
|
|
20
|
+
/**
|
|
21
|
+
* Properties to pass to the `DropdownMenuGroup` component when rendering
|
|
22
|
+
* within a dropdown and `dropdownMenuLayout` is `"group"`.
|
|
23
|
+
*/
|
|
24
|
+
dropdownMenuGroupProps?: Omit<DropdownMenuGroupProps, "label">;
|
|
25
|
+
/**
|
|
26
|
+
* Properties to pass to the `DropdownMenuSub` component when rendering within
|
|
27
|
+
* a dropdown and `dropdownMenuLayout` is `"sub"`.
|
|
28
|
+
*/
|
|
29
|
+
dropdownMenuSubProps?: Omit<DropdownMenuSubProps, "defaultOpen" | "open" | "onOpenChange">;
|
|
30
|
+
/**
|
|
31
|
+
* Properties to pass to the `DropdownMenuSubTrigger` component when rendering
|
|
32
|
+
* within a dropdown and `dropdownMenuLayout` is `"sub"`.
|
|
33
|
+
*/
|
|
34
|
+
dropdownMenuSubTriggerProps?: Omit<DropdownMenuSubTriggerProps, "children">;
|
|
35
|
+
/**
|
|
36
|
+
* Properties to pass to the `DropdownMenuSubContent` component when rendering
|
|
37
|
+
* within a dropdown and `dropdownMenuLayout` is `"sub"`.
|
|
38
|
+
*/
|
|
39
|
+
dropdownMenuSubContentProps?: Omit<DropdownMenuSubContentProps, "children">;
|
|
40
|
+
/** Children menu items. */
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Action displaying a dropdown menu in uncollapsed mode. In collapsed mode, it
|
|
45
|
+
* is rendered as either a dropdown menu item group or submenu depending on
|
|
46
|
+
* `collapsedLayout`.
|
|
47
|
+
*/
|
|
48
|
+
export declare function ActionMenu({ label, color, collapsedLayout, defaultOpen, open: controlledOpen, onOpenChange, modal, dropdownMenuContentProps, dropdownMenuGroupProps, dropdownMenuSubProps, dropdownMenuSubTriggerProps, dropdownMenuSubContentProps, children, ...otherProps }: ActionMenuProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DropdownMenuCheckboxItemProps } from "../DropdownMenu";
|
|
2
|
+
/** Properties of the action menu checkbox item component. */
|
|
3
|
+
export type ActionMenuCheckboxItemProps = DropdownMenuCheckboxItemProps;
|
|
4
|
+
/** An action menu item that can be controlled and rendered like a checkbox. */
|
|
5
|
+
export declare function ActionMenuCheckboxItem(props: ActionMenuCheckboxItemProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DropdownMenuRadioGroupProps } from "../DropdownMenu";
|
|
2
|
+
/** Properties of the action menu radio group component. */
|
|
3
|
+
export type ActionMenuRadioGroupProps = DropdownMenuRadioGroupProps;
|
|
4
|
+
/** Component used to group multiple action menu radio items. */
|
|
5
|
+
export declare function ActionMenuRadioGroup({ children, ...otherProps }: ActionMenuRadioGroupProps): string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type DropdownMenuRadioItemProps } from "../DropdownMenu";
|
|
2
|
+
/** Properties of the action menu radio item component. */
|
|
3
|
+
export type ActionMenuRadioItemProps = DropdownMenuRadioItemProps;
|
|
4
|
+
/** An action menu item that can be controlled and rendered like a radio. */
|
|
5
|
+
export declare function ActionMenuRadioItem(props: ActionMenuRadioItemProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type ActionButtonProps } from "./Action.tsx";
|
|
3
|
+
import { type ActionGroupProps } from "./ActionGroup.tsx";
|
|
4
|
+
import { type ActionMenuProps } from "./ActionMenu.tsx";
|
|
5
|
+
/** Placement of the action split trigger. */
|
|
6
|
+
export type ActionSplitPlacement = "start" | "end";
|
|
7
|
+
/** Properties of the action split component. */
|
|
8
|
+
export interface ActionSplitProps extends ActionButtonProps, Pick<ActionGroupProps, "groupCollapsed" | "buttonGroupProps" | "dropdownMenuGroupProps">, Pick<ActionMenuProps, "defaultOpen" | "open" | "onOpenChange" | "modal" | "dropdownMenuContentProps"> {
|
|
9
|
+
/** Label of the group. */
|
|
10
|
+
groupLabel?: ReactNode;
|
|
11
|
+
/** Label of the split trigger. */
|
|
12
|
+
splitLabel?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* Where to place the split trigger.
|
|
15
|
+
*
|
|
16
|
+
* @default "end"
|
|
17
|
+
*/
|
|
18
|
+
splitPlacement?: "start" | "end";
|
|
19
|
+
/** Properties to pass to the `ActionMenu` split trigger component. */
|
|
20
|
+
splitProps?: Omit<ActionButtonProps, "label">;
|
|
21
|
+
/** Split actions. */
|
|
22
|
+
children?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Split action component. Actions in provided as `children` as displayed in a
|
|
26
|
+
* dropdown menu triggered via a dedicated split button.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ActionSplit({ variant, color, className, groupCollapsed, groupLabel, splitLabel, splitPlacement, defaultOpen, open, onOpenChange, modal, buttonGroupProps, dropdownMenuGroupProps, dropdownMenuContentProps, splitProps, children, ...otherProps }: ActionSplitProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type ComponentProps } from "react";
|
|
2
|
+
import { type Responsive } from "../../utils/useResponsiveValues.ts";
|
|
3
|
+
import { type StackProps } from "../Stack";
|
|
4
|
+
import type { ActionLayout } from "./Action.tsx";
|
|
5
|
+
/** Layout for primary actions. */
|
|
6
|
+
export type ActionsPrimaryLayout = ActionLayout;
|
|
7
|
+
/** Layout for secondary actions. */
|
|
8
|
+
export type ActionsSecondaryLayout = ActionLayout | "dropdown";
|
|
9
|
+
/** Whether to render all actions within a `ButtonGroup`. */
|
|
10
|
+
export type ActionsGroup = boolean | ActionsSecondaryLayout;
|
|
11
|
+
/** Properties of the actions component. */
|
|
12
|
+
export interface ActionsProps extends Omit<StackProps, "direction" | "divider" | "wrap"> {
|
|
13
|
+
/**
|
|
14
|
+
* Layout of primary actions. An array of layouts indicates the allowed
|
|
15
|
+
* layouts for primary actions, which change according to available space.
|
|
16
|
+
*
|
|
17
|
+
* The layout of primary actions is only ever changed if all secondary layouts
|
|
18
|
+
* have been exhausted and the actions still do not fit in their container.
|
|
19
|
+
*
|
|
20
|
+
* @default "horizontal"
|
|
21
|
+
*/
|
|
22
|
+
primaryLayout?: Responsive<ActionsPrimaryLayout | ActionsPrimaryLayout[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Layout of secondary actions. An array of layouts indicates the allowed
|
|
25
|
+
* layouts for secondary actions, which change according to available space.
|
|
26
|
+
*
|
|
27
|
+
* The layout of secondary actions is always changed prior to that of primary
|
|
28
|
+
* actions.
|
|
29
|
+
*
|
|
30
|
+
* @default ["horizontal", "dropdown"]
|
|
31
|
+
*/
|
|
32
|
+
secondaryLayout?: Responsive<ActionsSecondaryLayout | ActionsSecondaryLayout[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to group all actions in a `ButtonGroup`. It can take either a
|
|
35
|
+
* boolean or a type of secondary layout.
|
|
36
|
+
*
|
|
37
|
+
* If a secondary layout is provided, then the buttons will be grouped
|
|
38
|
+
* whenever the secondary layout of the actions is smaller or equal than the
|
|
39
|
+
* provided layout.
|
|
40
|
+
*
|
|
41
|
+
* E.g. if `"icon"` is provided, then the actions will be grouped when the
|
|
42
|
+
* secondary layout is `"icon"` or `"dropdown"`.
|
|
43
|
+
*
|
|
44
|
+
* @default "dropdown"
|
|
45
|
+
*/
|
|
46
|
+
group?: Responsive<ActionsGroup>;
|
|
47
|
+
/** Properties to pass to the container element. */
|
|
48
|
+
containerProps?: ComponentProps<"div">;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The actions component provides a way of defining a set of actions whose
|
|
52
|
+
* layout scales according to available space.
|
|
53
|
+
*
|
|
54
|
+
* It composes the following subcomponents:
|
|
55
|
+
*
|
|
56
|
+
* - `ActionsSecondary`: A wrapper for defining secondary actions.
|
|
57
|
+
* - `Action`: A single action.
|
|
58
|
+
* - `ActionGroup`: Used to group related actions.
|
|
59
|
+
* - `ActionSplit`: A split action consisting of a main action, together with an
|
|
60
|
+
* action menu containing other related actions.
|
|
61
|
+
* - `ActionMenu`: An action which triggers dropdown menu containing other actions
|
|
62
|
+
* or menu items.
|
|
63
|
+
* - `ActionMenuCheckboxItem`: A menu item that can be controlled and rendered
|
|
64
|
+
* like a checkbox.
|
|
65
|
+
* - `ActionMenuRadioGroup`: Used to group multiple radio items.
|
|
66
|
+
* - `ActionMenuRadioItem`: A menu item that can be controlled and rendered like a
|
|
67
|
+
* radio.
|
|
68
|
+
*
|
|
69
|
+
* Example usage:
|
|
70
|
+
*
|
|
71
|
+
* ```tsx
|
|
72
|
+
* import { Action, Actions, ActionsSecondary } from "@ostack.tech/ui";
|
|
73
|
+
*
|
|
74
|
+
* function DocumentActions() {
|
|
75
|
+
* return (
|
|
76
|
+
* <Actions>
|
|
77
|
+
* <Action label="Save" onClick={saveDocument} />
|
|
78
|
+
* <ActionsSecondary>
|
|
79
|
+
* <Action label="Share" onClick={shareDocument} />
|
|
80
|
+
* <Action label="Export" onClick={exportDocument} />
|
|
81
|
+
* </ActionsSecondary>
|
|
82
|
+
* </Actions>
|
|
83
|
+
* );
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
export declare function Actions({ group, primaryLayout, secondaryLayout, gap, justifyContent, alignItems, alignContent, className, children, containerProps, ...otherProps }: ActionsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActionsPrimaryLayout, ActionsSecondaryLayout } from "./Actions.tsx";
|
|
2
|
+
/** Value of the toolbar context. */
|
|
3
|
+
export interface ActionsContextValue {
|
|
4
|
+
primaryLayout?: ActionsPrimaryLayout;
|
|
5
|
+
secondaryLayout?: ActionsSecondaryLayout;
|
|
6
|
+
hidden?: boolean;
|
|
7
|
+
secondary?: boolean;
|
|
8
|
+
grouped?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Actions context. */
|
|
11
|
+
export declare const ActionsContext: import("react").Context<ActionsContextValue | null>;
|
|
12
|
+
/** Hook providing access to the actions' context. */
|
|
13
|
+
export declare function useActionsContext(): ActionsContextValue | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ActionMenuProps } from "./ActionMenu.tsx";
|
|
2
|
+
/** Properties of the secondary actions component. */
|
|
3
|
+
export interface ActionsSecondaryProps extends Omit<Partial<ActionMenuProps>, "collapsedLayout" | "dropdownMenuGroupProps" | "dropdownMenuSubProps" | "dropdownMenuSubTriggerProps" | "dropdownMenuSubContentProps"> {
|
|
4
|
+
}
|
|
5
|
+
/** Container for secondary actions. */
|
|
6
|
+
export declare function ActionsSecondary({ label, children, ...otherProps }: ActionsSecondaryProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./Action.tsx";
|
|
2
|
+
export * from "./ActionGroup.tsx";
|
|
3
|
+
export * from "./ActionMenu.tsx";
|
|
4
|
+
export * from "./ActionMenuCheckboxItem.tsx";
|
|
5
|
+
export * from "./ActionMenuRadioGroup.tsx";
|
|
6
|
+
export * from "./ActionMenuRadioItem.tsx";
|
|
7
|
+
export * from "./Actions.tsx";
|
|
8
|
+
export { useActionsContext } from "./ActionsContext.ts";
|
|
9
|
+
export * from "./ActionSplit.tsx";
|
|
10
|
+
export * from "./ActionsSecondary.tsx";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ActionsGroup, ActionsPrimaryLayout, ActionsSecondaryLayout } from "./Actions.tsx";
|
|
2
|
+
/** Result of the {@link useActionsLayouts} hook. */
|
|
3
|
+
export interface UseActionsLayoutResult {
|
|
4
|
+
primaryLayout: ActionsPrimaryLayout;
|
|
5
|
+
secondaryLayout: ActionsSecondaryLayout;
|
|
6
|
+
grouped: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Hook that computes the actions layouts to use. */
|
|
9
|
+
export declare function useActionsLayouts(element: HTMLElement | null, bpPrimaryLayout: ActionsPrimaryLayout | ActionsPrimaryLayout[], bpSecondaryLayout: ActionsSecondaryLayout | ActionsSecondaryLayout[], bpGroup: ActionsGroup): UseActionsLayoutResult;
|
|
@@ -13,7 +13,7 @@ export interface AlertDialogContentProps extends ComponentProps<typeof AlertDial
|
|
|
13
13
|
/**
|
|
14
14
|
* Dialog content variant.
|
|
15
15
|
*
|
|
16
|
-
* @default solid
|
|
16
|
+
* @default "solid"
|
|
17
17
|
*/
|
|
18
18
|
variant?: AlertDialogContentVariant;
|
|
19
19
|
/**
|
|
@@ -27,13 +27,13 @@ export interface AlertDialogContentProps extends ComponentProps<typeof AlertDial
|
|
|
27
27
|
/**
|
|
28
28
|
* Dialog content color.
|
|
29
29
|
*
|
|
30
|
-
* @default neutral
|
|
30
|
+
* @default "neutral"
|
|
31
31
|
*/
|
|
32
32
|
color?: AlertDialogContentColor;
|
|
33
33
|
/**
|
|
34
34
|
* Size of the dialog content.
|
|
35
35
|
*
|
|
36
|
-
* @default md
|
|
36
|
+
* @default "md"
|
|
37
37
|
*/
|
|
38
38
|
size?: AlertDialogContentSize;
|
|
39
39
|
/** Properties to pass to the portal component. */
|
|
@@ -141,7 +141,7 @@ export interface ButtonOwnProps {
|
|
|
141
141
|
/** Properties to pass to the tooltip component. */
|
|
142
142
|
tooltipProps?: Omit<TooltipProps, "content" | "children">;
|
|
143
143
|
/** Properties to pass to the keybinds component. */
|
|
144
|
-
keybindsProps?: KeybindsProps
|
|
144
|
+
keybindsProps?: Omit<KeybindsProps, "keybinds">;
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* The button component is used to trigger actions or events, such as opening a
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
2
2
|
/** Properties of the button group component. */
|
|
3
3
|
export interface ButtonGroupProps extends ComponentProps<"div"> {
|
|
4
4
|
/**
|
|
@@ -7,6 +7,8 @@ export interface ButtonGroupProps extends ComponentProps<"div"> {
|
|
|
7
7
|
* element/component and change the underlying DOM node.
|
|
8
8
|
*/
|
|
9
9
|
asChild?: boolean;
|
|
10
|
+
/** Group's label (for assistive technologies). */
|
|
11
|
+
label?: ReactNode;
|
|
10
12
|
}
|
|
11
13
|
/**
|
|
12
14
|
* The button group component can be used to group buttons together.
|
|
@@ -29,4 +31,4 @@ export interface ButtonGroupProps extends ComponentProps<"div"> {
|
|
|
29
31
|
* }
|
|
30
32
|
* ```
|
|
31
33
|
*/
|
|
32
|
-
export declare function ButtonGroup({ asChild, className, ...otherProps }: ButtonGroupProps): import("react").JSX.Element;
|
|
34
|
+
export declare function ButtonGroup({ asChild, label, className, children, ...otherProps }: ButtonGroupProps): import("react").JSX.Element;
|
|
@@ -14,14 +14,14 @@ export interface CommandMenuProps extends ComponentProps<typeof CommandPrimitive
|
|
|
14
14
|
/**
|
|
15
15
|
* Style variant of the command menu list.
|
|
16
16
|
*
|
|
17
|
-
* @default subtle
|
|
17
|
+
* @default "subtle"
|
|
18
18
|
*/
|
|
19
19
|
variant?: CommandMenuVariant;
|
|
20
20
|
/**
|
|
21
21
|
* Default placement of icons within command menu items. This property can be
|
|
22
22
|
* overridden on a per-item basis.
|
|
23
23
|
*
|
|
24
|
-
* @default start
|
|
24
|
+
* @default "start"
|
|
25
25
|
*/
|
|
26
26
|
iconPlacement?: CommandMenuIconPlacement;
|
|
27
27
|
/** Placeholder of the search input. */
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type Key, type MouseEvent, type ReactNode } from "react";
|
|
2
|
-
import { type
|
|
1
|
+
import { type ComponentProps, type Key, type MouseEvent, type ReactNode } from "react";
|
|
2
|
+
import { type ActionButtonProps } from "../Actions";
|
|
3
3
|
import type { DataTableSelectionMode } from "./DataTable.tsx";
|
|
4
4
|
/** Properties of the data table selection trigger component. */
|
|
5
|
-
export
|
|
5
|
+
export type DataTableSelectionTriggerProps = DataTableSelectionTriggerChildlessProps | DataTableSelectionTriggerChildrenProps;
|
|
6
|
+
/** Base properties of the data table selection trigger component. */
|
|
7
|
+
export interface DataTableSelectionTriggerPropsBase {
|
|
6
8
|
/**
|
|
7
9
|
* Whether the component should preferably be aligned to the right. This only
|
|
8
10
|
* has an effect when the component is nested directly under the `DataTable`.
|
|
@@ -24,7 +26,20 @@ export interface DataTableSelectionTriggerProps extends Omit<ButtonProps, "onCli
|
|
|
24
26
|
* @param event Original click event.
|
|
25
27
|
*/
|
|
26
28
|
onClick: (selectedRows: Key[], selectionMode: DataTableSelectionMode, event: MouseEvent) => void;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Properties of the data table selection trigger component when rendered
|
|
32
|
+
* without children.
|
|
33
|
+
*/
|
|
34
|
+
export interface DataTableSelectionTriggerChildlessProps extends DataTableSelectionTriggerPropsBase, Omit<ActionButtonProps, "onClick"> {
|
|
35
|
+
children?: never;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Properties of the data table selection trigger component when rendered with
|
|
39
|
+
* children.
|
|
40
|
+
*/
|
|
41
|
+
export interface DataTableSelectionTriggerChildrenProps extends DataTableSelectionTriggerPropsBase, Omit<ComponentProps<"button">, "onClick"> {
|
|
27
42
|
children: ReactNode;
|
|
28
43
|
}
|
|
29
44
|
/** Trigger used to run an action over selected rows. */
|
|
30
|
-
export declare function DataTableSelectionTrigger({ preferRightAlignment, showWhenNoneSelected, onClick, className, children, ...otherProps }: DataTableSelectionTriggerProps):
|
|
45
|
+
export declare function DataTableSelectionTrigger({ preferRightAlignment, showWhenNoneSelected, onClick, disabled, className, children, ...otherProps }: DataTableSelectionTriggerProps): import("react").JSX.Element | null;
|
|
@@ -20,7 +20,7 @@ export interface MenuListItemProps extends Omit<ComponentProps<"li">, "onSelect"
|
|
|
20
20
|
/**
|
|
21
21
|
* Type of the item.
|
|
22
22
|
*
|
|
23
|
-
* @default button
|
|
23
|
+
* @default "button"
|
|
24
24
|
*/
|
|
25
25
|
type?: MenuListItemType;
|
|
26
26
|
/**
|
|
@@ -84,7 +84,7 @@ export interface MenuListItemProps extends Omit<ComponentProps<"li">, "onSelect"
|
|
|
84
84
|
/**
|
|
85
85
|
* Placement of the icon.
|
|
86
86
|
*
|
|
87
|
-
* @default start
|
|
87
|
+
* @default "start"
|
|
88
88
|
*/
|
|
89
89
|
iconPlacement?: MenuListIconPlacement;
|
|
90
90
|
/**
|
|
@@ -26,7 +26,7 @@ export interface TagProps extends ComponentProps<"span"> {
|
|
|
26
26
|
/**
|
|
27
27
|
* Tag colour.
|
|
28
28
|
*
|
|
29
|
-
* @default neutral
|
|
29
|
+
* @default "neutral"
|
|
30
30
|
*/
|
|
31
31
|
color?: TagColor;
|
|
32
32
|
/**
|
|
@@ -52,7 +52,7 @@ export interface TagProps extends ComponentProps<"span"> {
|
|
|
52
52
|
/**
|
|
53
53
|
* Whether to display the icon at the start or end of the tag.
|
|
54
54
|
*
|
|
55
|
-
* @default start
|
|
55
|
+
* @default "start"
|
|
56
56
|
*/
|
|
57
57
|
iconPlacement?: TagIconPlacement;
|
|
58
58
|
/**
|