@salt-ds/lab 1.0.0-alpha.15 → 1.0.0-alpha.16
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-cjs/combo-box-next/ComboBoxNext.css.js +6 -0
- package/dist-cjs/combo-box-next/ComboBoxNext.css.js.map +1 -0
- package/dist-cjs/combo-box-next/ComboBoxNext.js +177 -0
- package/dist-cjs/combo-box-next/ComboBoxNext.js.map +1 -0
- package/dist-cjs/combo-box-next/useComboBox.js +137 -0
- package/dist-cjs/combo-box-next/useComboBox.js.map +1 -0
- package/dist-cjs/combo-box-next/useComboboxPortal.js +69 -0
- package/dist-cjs/combo-box-next/useComboboxPortal.js.map +1 -0
- package/dist-cjs/combo-box-next/utils.js +40 -0
- package/dist-cjs/combo-box-next/utils.js.map +1 -0
- package/dist-cjs/dialog/Dialog.css.js +1 -1
- package/dist-cjs/dialog/Dialog.js +53 -56
- package/dist-cjs/dialog/Dialog.js.map +1 -1
- package/dist-cjs/dialog/DialogActions.css.js +1 -1
- package/dist-cjs/dialog/DialogActions.js +15 -17
- package/dist-cjs/dialog/DialogActions.js.map +1 -1
- package/dist-cjs/dialog/DialogCloseButton.css.js +6 -0
- package/dist-cjs/dialog/DialogCloseButton.css.js.map +1 -0
- package/dist-cjs/dialog/DialogCloseButton.js +39 -0
- package/dist-cjs/dialog/DialogCloseButton.js.map +1 -0
- package/dist-cjs/dialog/DialogContent.css.js +1 -1
- package/dist-cjs/dialog/DialogContent.js +20 -29
- package/dist-cjs/dialog/DialogContent.js.map +1 -1
- package/dist-cjs/dialog/{internal/DialogContext.js → DialogContext.js} +4 -0
- package/dist-cjs/dialog/DialogContext.js.map +1 -0
- package/dist-cjs/dialog/DialogTitle.css.js +1 -1
- package/dist-cjs/dialog/DialogTitle.js +40 -41
- package/dist-cjs/dialog/DialogTitle.js.map +1 -1
- package/dist-cjs/dialog/useDialog.js +31 -0
- package/dist-cjs/dialog/useDialog.js.map +1 -0
- package/dist-cjs/dropdown-next/DropdownNext.css.js +6 -0
- package/dist-cjs/dropdown-next/DropdownNext.css.js.map +1 -0
- package/dist-cjs/dropdown-next/DropdownNext.js +181 -0
- package/dist-cjs/dropdown-next/DropdownNext.js.map +1 -0
- package/dist-cjs/dropdown-next/useDropdownNext.js +169 -0
- package/dist-cjs/dropdown-next/useDropdownNext.js.map +1 -0
- package/dist-cjs/index.js +15 -6
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/list/Highlighter.js +1 -1
- package/dist-cjs/list/Highlighter.js.map +1 -1
- package/dist-cjs/list-next/useList.js.map +1 -1
- package/dist-cjs/logo/Logo.css.js +1 -1
- package/dist-cjs/logo/LogoImage.css.js +6 -0
- package/dist-cjs/logo/LogoImage.css.js.map +1 -0
- package/dist-cjs/logo/LogoImage.js +9 -0
- package/dist-cjs/logo/LogoImage.js.map +1 -1
- package/dist-cjs/logo/LogoSeparator.css.js +1 -1
- package/dist-cjs/{nav-item/ExpansionButton.js → navigation-item/ExpansionIcon.js} +7 -12
- package/dist-cjs/navigation-item/ExpansionIcon.js.map +1 -0
- package/dist-cjs/navigation-item/NavigationItem.css.js +6 -0
- package/dist-cjs/navigation-item/NavigationItem.css.js.map +1 -0
- package/dist-cjs/navigation-item/NavigationItem.js +96 -0
- package/dist-cjs/navigation-item/NavigationItem.js.map +1 -0
- package/dist-es/combo-box-next/ComboBoxNext.css.js +4 -0
- package/dist-es/combo-box-next/ComboBoxNext.css.js.map +1 -0
- package/dist-es/combo-box-next/ComboBoxNext.js +173 -0
- package/dist-es/combo-box-next/ComboBoxNext.js.map +1 -0
- package/dist-es/combo-box-next/useComboBox.js +133 -0
- package/dist-es/combo-box-next/useComboBox.js.map +1 -0
- package/dist-es/combo-box-next/useComboboxPortal.js +65 -0
- package/dist-es/combo-box-next/useComboboxPortal.js.map +1 -0
- package/dist-es/combo-box-next/utils.js +35 -0
- package/dist-es/combo-box-next/utils.js.map +1 -0
- package/dist-es/dialog/Dialog.css.js +1 -1
- package/dist-es/dialog/Dialog.js +53 -56
- package/dist-es/dialog/Dialog.js.map +1 -1
- package/dist-es/dialog/DialogActions.css.js +1 -1
- package/dist-es/dialog/DialogActions.js +15 -17
- package/dist-es/dialog/DialogActions.js.map +1 -1
- package/dist-es/dialog/DialogCloseButton.css.js +4 -0
- package/dist-es/dialog/DialogCloseButton.css.js.map +1 -0
- package/dist-es/dialog/DialogCloseButton.js +31 -0
- package/dist-es/dialog/DialogCloseButton.js.map +1 -0
- package/dist-es/dialog/DialogContent.css.js +1 -1
- package/dist-es/dialog/DialogContent.js +20 -29
- package/dist-es/dialog/DialogContent.js.map +1 -1
- package/dist-es/dialog/DialogContext.js +9 -0
- package/dist-es/dialog/DialogContext.js.map +1 -0
- package/dist-es/dialog/DialogTitle.css.js +1 -1
- package/dist-es/dialog/DialogTitle.js +37 -42
- package/dist-es/dialog/DialogTitle.js.map +1 -1
- package/dist-es/dialog/useDialog.js +27 -0
- package/dist-es/dialog/useDialog.js.map +1 -0
- package/dist-es/dropdown-next/DropdownNext.css.js +4 -0
- package/dist-es/dropdown-next/DropdownNext.css.js.map +1 -0
- package/dist-es/dropdown-next/DropdownNext.js +177 -0
- package/dist-es/dropdown-next/DropdownNext.js.map +1 -0
- package/dist-es/dropdown-next/useDropdownNext.js +165 -0
- package/dist-es/dropdown-next/useDropdownNext.js.map +1 -0
- package/dist-es/index.js +7 -3
- package/dist-es/index.js.map +1 -1
- package/dist-es/list/Highlighter.js +1 -1
- package/dist-es/list/Highlighter.js.map +1 -1
- package/dist-es/list-next/useList.js.map +1 -1
- package/dist-es/logo/Logo.css.js +1 -1
- package/dist-es/logo/LogoImage.css.js +4 -0
- package/dist-es/logo/LogoImage.css.js.map +1 -0
- package/dist-es/logo/LogoImage.js +9 -0
- package/dist-es/logo/LogoImage.js.map +1 -1
- package/dist-es/logo/LogoSeparator.css.js +1 -1
- package/dist-es/{nav-item/ExpansionButton.js → navigation-item/ExpansionIcon.js} +7 -12
- package/dist-es/navigation-item/ExpansionIcon.js.map +1 -0
- package/dist-es/navigation-item/NavigationItem.css.js +4 -0
- package/dist-es/navigation-item/NavigationItem.css.js.map +1 -0
- package/dist-es/navigation-item/NavigationItem.js +92 -0
- package/dist-es/navigation-item/NavigationItem.js.map +1 -0
- package/dist-types/combo-box-next/ComboBoxNext.d.ts +70 -0
- package/dist-types/combo-box-next/index.d.ts +1 -0
- package/dist-types/combo-box-next/useComboBox.d.ts +34 -0
- package/dist-types/combo-box-next/useComboboxPortal.d.ts +15 -0
- package/dist-types/combo-box-next/utils.d.ts +8 -0
- package/dist-types/dialog/Dialog.d.ts +17 -12
- package/dist-types/dialog/DialogActions.d.ts +1 -3
- package/dist-types/dialog/DialogCloseButton.d.ts +3 -0
- package/dist-types/dialog/DialogContent.d.ts +1 -3
- package/dist-types/dialog/{internal/DialogContext.d.ts → DialogContext.d.ts} +5 -2
- package/dist-types/dialog/DialogTitle.d.ts +7 -8
- package/dist-types/dialog/index.d.ts +4 -2
- package/dist-types/dialog/useDialog.d.ts +27 -0
- package/dist-types/dropdown-next/DropdownNext.d.ts +42 -0
- package/dist-types/dropdown-next/index.d.ts +1 -0
- package/dist-types/dropdown-next/useDropdownNext.d.ts +31 -0
- package/dist-types/index.d.ts +3 -1
- package/dist-types/list-next/useList.d.ts +2 -3
- package/dist-types/navigation-item/ExpansionIcon.d.ts +3 -0
- package/dist-types/navigation-item/NavigationItem.d.ts +36 -0
- package/dist-types/navigation-item/index.d.ts +1 -0
- package/package.json +4 -4
- package/dist-cjs/dialog/internal/DialogContext.js.map +0 -1
- package/dist-cjs/nav-item/ExpansionButton.js.map +0 -1
- package/dist-cjs/nav-item/NavItem.css.js +0 -6
- package/dist-cjs/nav-item/NavItem.css.js.map +0 -1
- package/dist-cjs/nav-item/NavItem.js +0 -88
- package/dist-cjs/nav-item/NavItem.js.map +0 -1
- package/dist-es/dialog/internal/DialogContext.js +0 -6
- package/dist-es/dialog/internal/DialogContext.js.map +0 -1
- package/dist-es/nav-item/ExpansionButton.js.map +0 -1
- package/dist-es/nav-item/NavItem.css.js +0 -4
- package/dist-es/nav-item/NavItem.css.js.map +0 -1
- package/dist-es/nav-item/NavItem.js +0 -84
- package/dist-es/nav-item/NavItem.js.map +0 -1
- package/dist-types/nav-item/ExpansionButton.d.ts +0 -3
- package/dist-types/nav-item/NavItem.d.ts +0 -45
- package/dist-types/nav-item/index.d.ts +0 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var css_248z = "/* Vars applied to root NavigationItem component */\n.saltNavigationItem {\n --navigationItem-color: var(--salt-text-secondary-foreground);\n --navigationItem-fill: var(--salt-text-secondary-foreground);\n --navigationItem-bar-inset: var(--salt-spacing-25);\n --navigationItem-bar-size: calc(var(--salt-size-bar) / 2);\n --navigationItem-indicator-background: var(--salt-navigable-indicator-active);\n --navigationItem-gap: var(--salt-spacing-100);\n}\n\n/* Vars applied to NavigationItem component when active or selected */\n.saltNavigationItem-active,\n.saltNavigationItem-blurSelected {\n --navigationItem-color: var(--salt-text-primary-foreground);\n --navigationItem-fill: var(--salt-text-primary-foreground);\n}\n\n/* Styles applied to NavigationItem wrapper */\n.saltNavigationItem-wrapper {\n display: flex;\n align-items: center;\n position: relative;\n gap: var(--navigationItem-gap);\n font-weight: var(--salt-text-fontWeight-strong);\n text-decoration: none;\n /* Hover off animation */\n transition: all var(--salt-duration-instant) ease-in-out;\n}\n\n/* Styles applied to NavigationItem link */\n.saltNavigationItem-wrapper.saltLink {\n --link-textDecoration: none;\n}\n\n/* Styles applied to NavigationItem icon */\n.saltNavigationItem-wrapper .saltIcon {\n fill: var(--navigationItem-fill);\n}\n\n/* Styles applied to NavigationItem Badge */\n.saltNavigationItem-label .saltBadge {\n margin-left: auto;\n}\n\n/* Styles applied to root NavigationItem component */\n.saltNavigationItem {\n margin: 0 var(--navigationItem-gap);\n}\n\n/* Styles applied when orientation = \"horizontal\" */\n.saltNavigationItem-wrapper.saltNavigationItem-horizontal {\n min-height: calc(var(--salt-size-base) + var(--navigationItem-gap) + var(--navigationItem-gap));\n padding: calc(var(--navigationItem-gap) + var(--navigationItem-bar-inset)) 0 var(--navigationItem-gap) 0;\n width: fit-content;\n}\n\n/* Styles applied when orientation = \"vertical\" */\n.saltNavigationItem-wrapper.saltNavigationItem-vertical {\n min-height: calc(var(--salt-size-base));\n padding-left: calc(var(--navigationItem-gap) + var(--navigationItem-bar-inset));\n padding-right: var(--navigationItem-gap);\n margin: var(--salt-spacing-50) 0;\n}\n\n/* Styles applied to NavigationItem label */\n.saltNavigationItem-wrapper .saltNavigationItem-label {\n --link-color-visited: var(--navigationItem-color);\n --link-color-hover: var(--navigationItem-color);\n\n color: var(--navigationItem-color);\n line-height: var(--salt-text-lineHeight);\n font-family: var(--salt-text-fontFamily);\n padding-left: calc(var(--saltNavigationItem-level, 0) * var(--navigationItem-gap));\n flex: 1;\n text-align: left;\n display: flex;\n align-items: center;\n gap: var(--navigationItem-gap);\n}\n\n/* Styles applied when level is not 0 */\n.saltNavigationItem-wrapper.saltNavigationItem-nested {\n font-weight: var(--salt-text-fontWeight);\n padding-left: calc(var(--salt-spacing-250) + (var(--saltNavigationItem-level, 0) * var(--navigationItem-gap)));\n}\n\n/* Styles applied to expand button */\n.saltNavigationItem-wrapper.saltNavigationItem-expandButton {\n --saltButton-background-hover: none;\n --saltButton-background-active: none;\n --saltButton-textTransform: none;\n --saltButton-width: 100%;\n --saltButton-letterSpacing: none;\n\n gap: var(--navigationItem-gap);\n /* Required to match link's outline offset */\n outline-offset: var(--salt-size-border);\n}\n\n/* Styles applied to expand icon */\n.saltNavigationItem-wrapper .saltNavigationItem-expandIcon {\n --saltIcon-color: var(--navigationItem-fill);\n}\n\n/* Styles applied to NavigationItem when focus is visible */\n.saltNavigationItem-wrapper:focus-visible {\n outline: var(--salt-focused-outline);\n}\n\n/* Styles applied to NavigationItem when when orientation = \"horizontal\" and focus is visible */\n.saltNavigationItem-horizontal:focus-visible {\n border-right: var(--navigationItem-gap) solid transparent;\n border-left: var(--navigationItem-gap) solid transparent;\n margin: 0 calc(var(--navigationItem-gap) * -1);\n}\n\n/* Styles applied to NavigationItem for non-keyboard focus */\n.saltNavigationItem-wrapper:focus:not(:focus-visible) {\n outline: 0;\n}\n\n/* Styles applied to activation line */\n.saltNavigationItem-wrapper::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n display: block;\n}\n\n/* Styles applied to activation line when orientation = \"horizontal\" */\n.saltNavigationItem-horizontal::after {\n width: 100%;\n height: var(--navigationItem-bar-size);\n top: var(--navigationItem-bar-inset);\n}\n\n/* Styles applied to activation line when orientation = \"vertical\" */\n.saltNavigationItem-vertical::after {\n width: var(--navigationItem-bar-size);\n left: var(--navigationItem-bar-inset);\n top: var(--navigationItem-bar-inset);\n height: calc(100% - var(--salt-spacing-50));\n}\n\n/* Styles applied to activation line on hover and on focus */\n.saltNavigationItem-wrapper:hover::after,\n.saltNavigationItem-wrapper:focus::after {\n background: var(--salt-navigable-indicator-hover);\n /* Hover on animation */\n transition: all var(--salt-duration-perceptible) ease-in-out;\n}\n\n/* Styles applied to activation line when item has active children */\n.saltNavigationItem-wrapper.saltNavigationItem-blurSelected::after,\n.saltNavigationItem-wrapper.saltNavigationItem-blurSelected:hover::after,\n.saltNavigationItem-wrapper.saltNavigationItem-blurSelected:focus::after {\n --navigationItem-indicator-background: none;\n}\n\n/* Styles applied to activation line when item is active */\n.saltNavigationItem-wrapper.saltNavigationItem-active::after,\n.saltNavigationItem-wrapper.saltNavigationItem-active:hover::after,\n.saltNavigationItem-wrapper.saltNavigationItem-active:focus::after {\n background: var(--navigationItem-indicator-background);\n /* Hover on animation */\n transition: all var(--salt-duration-perceptible) ease-in-out;\n}\n";
|
|
2
|
+
|
|
3
|
+
export { css_248z as default };
|
|
4
|
+
//# sourceMappingURL=NavigationItem.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationItem.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { makePrefixer, Button, Link } from '@salt-ds/core';
|
|
4
|
+
import { clsx } from 'clsx';
|
|
5
|
+
import { ExpansionIcon } from './ExpansionIcon.js';
|
|
6
|
+
import css_248z from './NavigationItem.css.js';
|
|
7
|
+
import { useWindow } from '@salt-ds/window';
|
|
8
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
9
|
+
|
|
10
|
+
const withBaseName = makePrefixer("saltNavigationItem");
|
|
11
|
+
const NavigationItem = forwardRef(
|
|
12
|
+
function NavigationItem2(props, ref) {
|
|
13
|
+
const {
|
|
14
|
+
active,
|
|
15
|
+
blurSelected,
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
expanded = false,
|
|
19
|
+
orientation = "horizontal",
|
|
20
|
+
parent,
|
|
21
|
+
level = 0,
|
|
22
|
+
onExpand,
|
|
23
|
+
href,
|
|
24
|
+
style: styleProp,
|
|
25
|
+
...rest
|
|
26
|
+
} = props;
|
|
27
|
+
const targetWindow = useWindow();
|
|
28
|
+
useComponentCssInjection({
|
|
29
|
+
testId: "salt-navigation-item",
|
|
30
|
+
css: css_248z,
|
|
31
|
+
window: targetWindow
|
|
32
|
+
});
|
|
33
|
+
const style = {
|
|
34
|
+
...styleProp,
|
|
35
|
+
"--saltNavigationItem-level": `${level}`
|
|
36
|
+
};
|
|
37
|
+
const handleExpand = (event) => {
|
|
38
|
+
event.stopPropagation();
|
|
39
|
+
onExpand == null ? void 0 : onExpand(event);
|
|
40
|
+
};
|
|
41
|
+
const ConditionalWrapper = ({
|
|
42
|
+
children: children2,
|
|
43
|
+
className: className2,
|
|
44
|
+
...rest2
|
|
45
|
+
}) => parent ? /* @__PURE__ */ jsx(Button, {
|
|
46
|
+
"aria-label": "expand",
|
|
47
|
+
variant: "secondary",
|
|
48
|
+
"aria-expanded": expanded,
|
|
49
|
+
className: clsx(withBaseName("expandButton"), className2),
|
|
50
|
+
onClick: handleExpand,
|
|
51
|
+
...rest2,
|
|
52
|
+
children: children2
|
|
53
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
54
|
+
"aria-current": active ? "page" : void 0,
|
|
55
|
+
href,
|
|
56
|
+
className: className2,
|
|
57
|
+
...rest2,
|
|
58
|
+
children: children2
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ jsx("div", {
|
|
61
|
+
ref,
|
|
62
|
+
style,
|
|
63
|
+
className: clsx(withBaseName(), className),
|
|
64
|
+
...rest,
|
|
65
|
+
children: /* @__PURE__ */ jsxs(ConditionalWrapper, {
|
|
66
|
+
className: clsx(
|
|
67
|
+
withBaseName("wrapper"),
|
|
68
|
+
{
|
|
69
|
+
[withBaseName("active")]: active,
|
|
70
|
+
[withBaseName("blurSelected")]: blurSelected,
|
|
71
|
+
[withBaseName("nested")]: level !== 0
|
|
72
|
+
},
|
|
73
|
+
withBaseName(orientation)
|
|
74
|
+
),
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ jsx("span", {
|
|
77
|
+
className: withBaseName("label"),
|
|
78
|
+
children
|
|
79
|
+
}),
|
|
80
|
+
parent && /* @__PURE__ */ jsx(ExpansionIcon, {
|
|
81
|
+
expanded,
|
|
82
|
+
orientation,
|
|
83
|
+
className: withBaseName("expandIcon")
|
|
84
|
+
})
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
export { NavigationItem };
|
|
92
|
+
//# sourceMappingURL=NavigationItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationItem.js","sources":["../src/navigation-item/NavigationItem.tsx"],"sourcesContent":["import {\n ComponentPropsWithoutRef,\n forwardRef,\n MouseEventHandler,\n MouseEvent,\n ReactNode,\n} from \"react\";\nimport { makePrefixer, Link, Button } from \"@salt-ds/core\";\nimport { clsx } from \"clsx\";\nimport { ExpansionIcon } from \"./ExpansionIcon\";\n\nimport navigationItemCss from \"./NavigationItem.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nexport interface NavigationItemProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Whether the navigation item is active.\n */\n active?: boolean;\n /**\n * Whether the parent navigation item has active nested items.\n */\n blurSelected?: boolean;\n /**\n * Whether the navigation item is expanded.\n */\n expanded?: boolean;\n /**\n * Level of nesting.\n */\n level?: number;\n /**\n * The orientation of the navigation item.\n */\n orientation?: \"horizontal\" | \"vertical\";\n /**\n * Whether the navigation item is a parent with nested items.\n */\n parent?: boolean;\n /**\n * Action to be triggered when the navigation item is expanded.\n */\n onExpand?: MouseEventHandler<HTMLButtonElement>;\n /**\n * Href to be passed to the Link element.\n */\n href?: string;\n}\n\nconst withBaseName = makePrefixer(\"saltNavigationItem\");\n\ntype ConditionalWrapper = {\n children: ReactNode;\n className: string;\n};\n\nexport const NavigationItem = forwardRef<HTMLDivElement, NavigationItemProps>(\n function NavigationItem(props, ref) {\n const {\n active,\n blurSelected,\n children,\n className,\n expanded = false,\n orientation = \"horizontal\",\n parent,\n level = 0,\n onExpand,\n href,\n style: styleProp,\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-navigation-item\",\n css: navigationItemCss,\n window: targetWindow,\n });\n\n const style = {\n ...styleProp,\n \"--saltNavigationItem-level\": `${level}`,\n };\n\n const handleExpand = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n onExpand?.(event);\n };\n\n const ConditionalWrapper = ({\n children,\n className,\n ...rest\n }: ConditionalWrapper) =>\n parent ? (\n <Button\n aria-label=\"expand\"\n variant=\"secondary\"\n aria-expanded={expanded}\n className={clsx(withBaseName(\"expandButton\"), className)}\n onClick={handleExpand}\n {...rest}\n >\n {children}\n </Button>\n ) : (\n <Link\n aria-current={active ? \"page\" : undefined}\n href={href}\n className={className}\n {...rest}\n >\n {children}\n </Link>\n );\n\n return (\n <div\n ref={ref}\n style={style}\n className={clsx(withBaseName(), className)}\n {...rest}\n >\n <ConditionalWrapper\n className={clsx(\n withBaseName(\"wrapper\"),\n {\n [withBaseName(\"active\")]: active,\n [withBaseName(\"blurSelected\")]: blurSelected,\n [withBaseName(\"nested\")]: level !== 0,\n },\n withBaseName(orientation)\n )}\n >\n <span className={withBaseName(\"label\")}>{children}</span>\n {parent && (\n <ExpansionIcon\n expanded={expanded}\n orientation={orientation}\n className={withBaseName(\"expandIcon\")}\n />\n )}\n </ConditionalWrapper>\n </div>\n );\n }\n);\n"],"names":["NavigationItem","navigationItemCss","children","className","rest"],"mappings":"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"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, FocusEvent, KeyboardEvent, ReactElement, Ref, SyntheticEvent } from "react";
|
|
2
|
+
import { InputProps } from "@salt-ds/core";
|
|
3
|
+
import { ListNextProps } from "../list-next";
|
|
4
|
+
import { ComboBoxItemProps } from "./utils";
|
|
5
|
+
import { UseComboBoxPortalProps } from "./useComboboxPortal";
|
|
6
|
+
export interface ComboBoxNextProps<T> extends Omit<ComponentPropsWithoutRef<"input">, "onChange"> {
|
|
7
|
+
/**
|
|
8
|
+
* Additional props for the input component.
|
|
9
|
+
*/
|
|
10
|
+
InputProps?: InputProps;
|
|
11
|
+
/**
|
|
12
|
+
* Additional props for the list component.
|
|
13
|
+
*/
|
|
14
|
+
ListProps?: ListNextProps;
|
|
15
|
+
/**
|
|
16
|
+
* Additional props for the portal.
|
|
17
|
+
*/
|
|
18
|
+
PortalProps?: UseComboBoxPortalProps;
|
|
19
|
+
/**
|
|
20
|
+
* If `true`, the component will be disabled.
|
|
21
|
+
*/
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
highlightedItem?: string;
|
|
24
|
+
selected?: string;
|
|
25
|
+
defaultSelected?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The source of combobox items.
|
|
28
|
+
*/
|
|
29
|
+
source: T[];
|
|
30
|
+
/**
|
|
31
|
+
* Callback for blur event
|
|
32
|
+
*/
|
|
33
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
34
|
+
/**
|
|
35
|
+
* Callback for focus event
|
|
36
|
+
*/
|
|
37
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
38
|
+
/**
|
|
39
|
+
* Callback for keyDown event
|
|
40
|
+
*/
|
|
41
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Callback for mouse over event
|
|
44
|
+
*/
|
|
45
|
+
onMouseOver?: (event: SyntheticEvent) => void;
|
|
46
|
+
/**
|
|
47
|
+
* Optional ref for the input component
|
|
48
|
+
*/
|
|
49
|
+
inputRef?: Ref<HTMLInputElement>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional ref for the list component
|
|
52
|
+
*/
|
|
53
|
+
listRef?: Ref<HTMLUListElement>;
|
|
54
|
+
/**
|
|
55
|
+
* The component used for item instead of the default.
|
|
56
|
+
*/
|
|
57
|
+
ListItem: (props: ComboBoxItemProps<T>) => ReactElement<ComboBoxItemProps<T>>;
|
|
58
|
+
/**
|
|
59
|
+
* Function to be used as filter.
|
|
60
|
+
*/
|
|
61
|
+
itemFilter?: (source: T[], filterValue?: string) => T[];
|
|
62
|
+
onChange?: (event: SyntheticEvent, data: {
|
|
63
|
+
value: string;
|
|
64
|
+
}) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Styling variant. Defaults to "primary".
|
|
67
|
+
*/
|
|
68
|
+
variant?: "primary" | "secondary";
|
|
69
|
+
}
|
|
70
|
+
export declare const ComboBoxNext: import("react").ForwardRefExoticComponent<ComboBoxNextProps<unknown> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./ComboBoxNext";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FocusEvent, KeyboardEvent, SyntheticEvent } from "react";
|
|
2
|
+
import { UseListProps } from "../list-next/useList";
|
|
3
|
+
import { UseComboBoxPortalProps } from "./useComboboxPortal";
|
|
4
|
+
interface UseComboBoxProps {
|
|
5
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
6
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
7
|
+
onMouseOver?: (event: SyntheticEvent) => void;
|
|
8
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
9
|
+
PortalProps?: UseComboBoxPortalProps;
|
|
10
|
+
listProps: UseListProps;
|
|
11
|
+
}
|
|
12
|
+
export declare const useComboBox: ({ onFocus, onBlur, onMouseOver, onKeyDown, PortalProps, listProps, }: UseComboBoxProps) => {
|
|
13
|
+
portalProps: {
|
|
14
|
+
open: boolean;
|
|
15
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
16
|
+
floating: (node: HTMLElement | null) => void;
|
|
17
|
+
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
18
|
+
getTriggerProps: () => Record<string, unknown>;
|
|
19
|
+
getPortalProps: () => import("react").HTMLProps<HTMLDivElement>;
|
|
20
|
+
};
|
|
21
|
+
inputValue: string | undefined;
|
|
22
|
+
setInputValue: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
23
|
+
selectedItem: string | undefined;
|
|
24
|
+
setSelectedItem: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
25
|
+
highlightedItem: string | undefined;
|
|
26
|
+
setHighlightedItem: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
27
|
+
activeDescendant: string | undefined;
|
|
28
|
+
focusVisibleRef: import("react").Ref<HTMLElement>;
|
|
29
|
+
keyDownHandler: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
30
|
+
focusHandler: (event: FocusEvent<HTMLInputElement>) => void;
|
|
31
|
+
blurHandler: (event: FocusEvent<HTMLInputElement>) => void;
|
|
32
|
+
mouseOverHandler: (event: SyntheticEvent<HTMLElement>) => void;
|
|
33
|
+
};
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Placement } from "@floating-ui/react";
|
|
2
|
+
import { HTMLProps } from "react";
|
|
3
|
+
export interface UseComboBoxPortalProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
placement?: Placement;
|
|
7
|
+
}
|
|
8
|
+
export declare function useComboboxPortal(props?: UseComboBoxPortalProps): {
|
|
9
|
+
open: boolean;
|
|
10
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
11
|
+
floating: (node: HTMLElement | null) => void;
|
|
12
|
+
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
13
|
+
getPortalProps: () => HTMLProps<HTMLDivElement>;
|
|
14
|
+
getTriggerProps: () => Record<string, unknown>;
|
|
15
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ListItemNextProps } from "../list-next";
|
|
3
|
+
export declare const defaultFilter: (source: string[], filterValue?: string | undefined) => string[];
|
|
4
|
+
export interface ComboBoxItemProps<T> extends Omit<ListItemNextProps, "value"> {
|
|
5
|
+
value: T;
|
|
6
|
+
matchPattern?: RegExp | string;
|
|
7
|
+
}
|
|
8
|
+
export declare const DefaultListItem: ({ value, matchPattern, onMouseDown, ...rest }: ComboBoxItemProps<string>) => JSX.Element;
|
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
import { HTMLAttributes, ComponentProps } from "react";
|
|
2
|
+
import { FloatingFocusManager } from "@floating-ui/react";
|
|
1
3
|
import { ValidationStatus } from "@salt-ds/core";
|
|
2
|
-
import { HTMLAttributes } from "react";
|
|
3
|
-
import { ScrimProps } from "../scrim";
|
|
4
4
|
export interface DialogProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Display or hide the component.
|
|
7
|
+
*/
|
|
8
8
|
open?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Callback function triggered when open state changes.
|
|
11
|
+
*/
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Status indicator
|
|
15
|
+
* */
|
|
9
16
|
status?: ValidationStatus;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.
|
|
19
|
+
* Default value is 0 (first tabbable element).
|
|
20
|
+
* */
|
|
21
|
+
initialFocus?: ComponentProps<typeof FloatingFocusManager>["initialFocus"];
|
|
13
22
|
}
|
|
14
|
-
/**
|
|
15
|
-
* The Dialog is a window that contains text and interactive components.
|
|
16
|
-
* By default, Dialog is non-modal, but supports modal behaviour as well.
|
|
17
|
-
*/
|
|
18
23
|
export declare const Dialog: import("react").ForwardRefExoticComponent<DialogProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
export
|
|
3
|
-
}
|
|
4
|
-
export declare const DialogActions: import("react").ForwardRefExoticComponent<DialogActionsProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
2
|
+
export declare const DialogActions: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
|
-
export
|
|
3
|
-
}
|
|
4
|
-
export declare const DialogContent: import("react").ForwardRefExoticComponent<DialogContentProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
2
|
+
export declare const DialogContent: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
export declare const DialogContext: import("react").Context<{
|
|
3
|
-
status?: "error" | "warning" | "success" | "info" | undefined;
|
|
4
3
|
dialogId?: string | undefined;
|
|
5
|
-
|
|
4
|
+
status?: "error" | "warning" | "success" | "info" | undefined;
|
|
6
5
|
}>;
|
|
6
|
+
export declare const useDialogContext: () => {
|
|
7
|
+
dialogId?: string | undefined;
|
|
8
|
+
status?: "error" | "warning" | "success" | "info" | undefined;
|
|
9
|
+
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
disableAria?: boolean;
|
|
7
|
-
onClose?: (event: SyntheticEvent) => void;
|
|
1
|
+
import { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { ValidationStatus } from "@salt-ds/core";
|
|
3
|
+
interface DialogTitleProps extends ComponentPropsWithoutRef<"h2"> {
|
|
4
|
+
status?: ValidationStatus;
|
|
5
|
+
accent?: boolean;
|
|
8
6
|
}
|
|
9
|
-
export declare const DialogTitle:
|
|
7
|
+
export declare const DialogTitle: ({ children, className, accent, status: statusProp, ...rest }: DialogTitleProps) => JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { UseFloatingUIProps } from "@salt-ds/core";
|
|
3
|
+
export declare type UseDialogProps = Partial<Pick<UseFloatingUIProps, "onOpenChange" | "open">>;
|
|
4
|
+
export declare function useDialog(props: UseDialogProps): {
|
|
5
|
+
getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
6
|
+
getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
7
|
+
floating: (node: HTMLElement | null) => void;
|
|
8
|
+
context: {
|
|
9
|
+
x: number | null;
|
|
10
|
+
y: number | null;
|
|
11
|
+
placement: import("@floating-ui/react").Placement;
|
|
12
|
+
strategy: import("@floating-ui/react").Strategy;
|
|
13
|
+
middlewareData: import("@floating-ui/react").MiddlewareData;
|
|
14
|
+
update: () => void;
|
|
15
|
+
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
16
|
+
floating: (node: HTMLElement | null) => void;
|
|
17
|
+
isPositioned: boolean;
|
|
18
|
+
open: boolean;
|
|
19
|
+
onOpenChange: (open: boolean) => void;
|
|
20
|
+
events: import("@floating-ui/react").FloatingEvents;
|
|
21
|
+
dataRef: import("react").MutableRefObject<import("@floating-ui/react").ContextData>;
|
|
22
|
+
nodeId: string | undefined;
|
|
23
|
+
floatingId: string;
|
|
24
|
+
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
25
|
+
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ListNextProps } from "../list-next";
|
|
2
|
+
import { UseFloatingUIProps } from "@salt-ds/core";
|
|
3
|
+
import { HTMLAttributes, Ref } from "react";
|
|
4
|
+
import { Placement } from "@floating-ui/react";
|
|
5
|
+
export interface DropdownNextProps extends Pick<UseFloatingUIProps, "open" | "onOpenChange" | "placement">, HTMLAttributes<HTMLButtonElement> {
|
|
6
|
+
/**
|
|
7
|
+
* If `true`, dropdown will be disabled.
|
|
8
|
+
*/
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Initially selected value for the dropdown, for use only in uncontrolled component.
|
|
12
|
+
*/
|
|
13
|
+
defaultSelected?: string;
|
|
14
|
+
/**
|
|
15
|
+
* List of options when using a dropdown.
|
|
16
|
+
*/
|
|
17
|
+
source: string[];
|
|
18
|
+
/**
|
|
19
|
+
* If `true`, dropdown is read only.
|
|
20
|
+
*/
|
|
21
|
+
readOnly?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Background styling variant. Defaults to `primary` .
|
|
24
|
+
*/
|
|
25
|
+
variant?: "primary" | "secondary";
|
|
26
|
+
/**
|
|
27
|
+
* Placement of dropdown list. Defaults to `bottom` .
|
|
28
|
+
*/
|
|
29
|
+
placement?: Placement;
|
|
30
|
+
/**
|
|
31
|
+
* Optional ref for the list component.
|
|
32
|
+
*/
|
|
33
|
+
listRef?: Ref<HTMLUListElement>;
|
|
34
|
+
/**
|
|
35
|
+
* Additional props for dropdown list.
|
|
36
|
+
*/
|
|
37
|
+
ListProps?: ListNextProps;
|
|
38
|
+
open?: boolean;
|
|
39
|
+
selected?: string;
|
|
40
|
+
highlightedItem?: string;
|
|
41
|
+
}
|
|
42
|
+
export declare const DropdownNext: import("react").ForwardRefExoticComponent<DropdownNextProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./DropdownNext";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { UseFloatingUIProps } from "@salt-ds/core";
|
|
2
|
+
import { HTMLProps, KeyboardEvent, FocusEvent } from "react";
|
|
3
|
+
import { UseListProps } from "../list-next/useList";
|
|
4
|
+
interface UseDropdownNextProps extends Partial<Pick<UseFloatingUIProps, "onOpenChange" | "open" | "placement">> {
|
|
5
|
+
listProps: UseListProps;
|
|
6
|
+
openControlProp?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const useDropdownNext: ({ listProps, openControlProp, onOpenChange: onOpenChangeProp, placement: placementProp, }: UseDropdownNextProps) => {
|
|
9
|
+
handlers: {
|
|
10
|
+
focusHandler: (event: FocusEvent<HTMLElement>) => void;
|
|
11
|
+
keyDownHandler: (event: KeyboardEvent<HTMLElement>) => void;
|
|
12
|
+
blurHandler: () => void;
|
|
13
|
+
mouseOverHandler: () => void;
|
|
14
|
+
mouseDownHandler: () => void;
|
|
15
|
+
};
|
|
16
|
+
activeDescendant: string | undefined;
|
|
17
|
+
selectedItem: string | undefined;
|
|
18
|
+
setSelectedItem: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
19
|
+
highlightedItem: string | undefined;
|
|
20
|
+
setHighlightedItem: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
|
|
21
|
+
focusVisibleRef: import("react").Ref<HTMLElement>;
|
|
22
|
+
getListItems: (source: string[]) => JSX.Element[] | undefined;
|
|
23
|
+
portalProps: {
|
|
24
|
+
open: boolean;
|
|
25
|
+
setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
26
|
+
floating: (node: HTMLElement | null) => void;
|
|
27
|
+
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
28
|
+
getDropdownNextProps: () => HTMLProps<HTMLDivElement>;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export {};
|
package/dist-types/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from "./carousel";
|
|
|
10
10
|
export * from "./cascading-menu";
|
|
11
11
|
export * from "./color-chooser";
|
|
12
12
|
export * from "./combo-box";
|
|
13
|
+
export * from "./combo-box-next";
|
|
13
14
|
export * from "./combo-box-deprecated";
|
|
14
15
|
export * from "./contact-details";
|
|
15
16
|
export * from "./content-status";
|
|
@@ -18,6 +19,7 @@ export * from "./deck-layout";
|
|
|
18
19
|
export * from "./dialog";
|
|
19
20
|
export * from "./drawer";
|
|
20
21
|
export * from "./dropdown";
|
|
22
|
+
export * from "./dropdown-next";
|
|
21
23
|
export * from "./editable-label";
|
|
22
24
|
export * from "./file-drop-zone";
|
|
23
25
|
export { FormFieldLegacy as FormField, type FormFieldLegacyProps as FormFieldProps, FormLabel, } from "./form-field-legacy";
|
|
@@ -31,7 +33,7 @@ export * from "./list-next";
|
|
|
31
33
|
export * from "./logo";
|
|
32
34
|
export * from "./menu-button";
|
|
33
35
|
export * from "./metric";
|
|
34
|
-
export * from "./
|
|
36
|
+
export * from "./navigation-item";
|
|
35
37
|
export * from "./overlay";
|
|
36
38
|
export * from "./pagination";
|
|
37
39
|
export * from "./parent-child-item";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FocusEvent, KeyboardEvent, RefObject, SyntheticEvent } from "react";
|
|
2
|
-
interface UseListProps {
|
|
2
|
+
export interface UseListProps {
|
|
3
3
|
/**
|
|
4
4
|
* If true, all items in list will be disabled.
|
|
5
5
|
*/
|
|
@@ -14,7 +14,7 @@ interface UseListProps {
|
|
|
14
14
|
ref: RefObject<HTMLUListElement>;
|
|
15
15
|
}
|
|
16
16
|
export declare const useList: ({ disabled, highlightedItem: highLightedItemProp, selected: selectedProp, defaultSelected, onChange, id, ref, }: UseListProps) => {
|
|
17
|
-
focusHandler: (event: FocusEvent<HTMLUListElement>) => void;
|
|
17
|
+
focusHandler: (event: FocusEvent<HTMLUListElement | HTMLElement>) => void;
|
|
18
18
|
keyDownHandler: (event: KeyboardEvent<HTMLElement>) => void;
|
|
19
19
|
blurHandler: () => void;
|
|
20
20
|
mouseOverHandler: () => void;
|
|
@@ -34,4 +34,3 @@ export declare const useList: ({ disabled, highlightedItem: highLightedItemProp,
|
|
|
34
34
|
};
|
|
35
35
|
focusVisibleRef: import("react").Ref<HTMLElement>;
|
|
36
36
|
};
|
|
37
|
-
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef, MouseEventHandler } from "react";
|
|
2
|
+
export interface NavigationItemProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
|
+
/**
|
|
4
|
+
* Whether the navigation item is active.
|
|
5
|
+
*/
|
|
6
|
+
active?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the parent navigation item has active nested items.
|
|
9
|
+
*/
|
|
10
|
+
blurSelected?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the navigation item is expanded.
|
|
13
|
+
*/
|
|
14
|
+
expanded?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Level of nesting.
|
|
17
|
+
*/
|
|
18
|
+
level?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The orientation of the navigation item.
|
|
21
|
+
*/
|
|
22
|
+
orientation?: "horizontal" | "vertical";
|
|
23
|
+
/**
|
|
24
|
+
* Whether the navigation item is a parent with nested items.
|
|
25
|
+
*/
|
|
26
|
+
parent?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Action to be triggered when the navigation item is expanded.
|
|
29
|
+
*/
|
|
30
|
+
onExpand?: MouseEventHandler<HTMLButtonElement>;
|
|
31
|
+
/**
|
|
32
|
+
* Href to be passed to the Link element.
|
|
33
|
+
*/
|
|
34
|
+
href?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const NavigationItem: import("react").ForwardRefExoticComponent<NavigationItemProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./NavigationItem";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/lab",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist-cjs/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"module": "dist-es/index.js",
|
|
22
22
|
"typings": "dist-types/index.d.ts",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@salt-ds/core": "^1.8.
|
|
24
|
+
"@salt-ds/core": "^1.8.1",
|
|
25
25
|
"clsx": "^2.0.0",
|
|
26
26
|
"react-window": "^1.8.6",
|
|
27
27
|
"compute-scroll-into-view": "^3.0.0",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"react-color": "^2.19.3",
|
|
35
35
|
"deepmerge": "^4.2.2",
|
|
36
36
|
"clipboard-copy": "^4.0.1",
|
|
37
|
-
"aria-hidden": "^1.1.1",
|
|
38
|
-
"no-scroll": "^2.1.1",
|
|
39
37
|
"attr-accept": "^2.0.0",
|
|
40
38
|
"rifm": "^0.12.0",
|
|
39
|
+
"aria-hidden": "^1.1.1",
|
|
40
|
+
"no-scroll": "^2.1.1",
|
|
41
41
|
"@fluentui/react-overflow": "^9.0.19"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DialogContext.js","sources":["../src/dialog/internal/DialogContext.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport { ValidationStatus } from \"@salt-ds/core\";\n\nexport const DialogContext = createContext<{\n status?: ValidationStatus;\n dialogId?: string;\n setContentElement?: (node: HTMLDivElement) => void;\n}>({});\n"],"names":["createContext"],"mappings":";;;;;;AAGa,MAAA,aAAA,GAAgBA,mBAI1B,CAAA,EAAE;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ExpansionButton.js","sources":["../src/nav-item/ExpansionButton.tsx"],"sourcesContent":["import { ChevronDownIcon, ChevronRightIcon } from \"@salt-ds/icons\";\nimport { ComponentPropsWithoutRef } from \"react\";\nimport { Button } from \"@salt-ds/core\";\nimport { NavItemProps } from \"./NavItem\";\n\nconst iconExpansionMap = {\n vertical: {\n expanded: ChevronDownIcon,\n collapsed: ChevronRightIcon,\n },\n horizontal: {\n expanded: ChevronDownIcon,\n collapsed: ChevronDownIcon,\n },\n};\n\nexport function ExpansionButton({\n expanded = false,\n orientation = \"horizontal\",\n ...rest\n}: Pick<NavItemProps, \"expanded\" | \"orientation\"> &\n ComponentPropsWithoutRef<\"button\">) {\n const Icon =\n iconExpansionMap[orientation][expanded ? \"expanded\" : \"collapsed\"];\n return (\n <Button aria-label=\"expand\" variant=\"secondary\" {...rest}>\n <Icon aria-hidden=\"true\" />\n </Button>\n );\n}\n"],"names":["ChevronDownIcon","ChevronRightIcon","jsx","Button"],"mappings":";;;;;;;;AAKA,MAAM,gBAAmB,GAAA;AAAA,EACvB,QAAU,EAAA;AAAA,IACR,QAAU,EAAAA,qBAAA;AAAA,IACV,SAAW,EAAAC,sBAAA;AAAA,GACb;AAAA,EACA,UAAY,EAAA;AAAA,IACV,QAAU,EAAAD,qBAAA;AAAA,IACV,SAAW,EAAAA,qBAAA;AAAA,GACb;AACF,CAAA,CAAA;AAEO,SAAS,eAAgB,CAAA;AAAA,EAC9B,QAAW,GAAA,KAAA;AAAA,EACX,WAAc,GAAA,YAAA;AAAA,EACX,GAAA,IAAA;AACL,CACsC,EAAA;AACpC,EAAA,MAAM,IACJ,GAAA,gBAAA,CAAiB,WAAa,CAAA,CAAA,QAAA,GAAW,UAAa,GAAA,WAAA,CAAA,CAAA;AACxD,EAAA,uBACGE,cAAA,CAAAC,WAAA,EAAA;AAAA,IAAO,YAAW,EAAA,QAAA;AAAA,IAAS,OAAQ,EAAA,WAAA;AAAA,IAAa,GAAG,IAAA;AAAA,IAClD,QAAC,kBAAAD,cAAA,CAAA,IAAA,EAAA;AAAA,MAAK,aAAY,EAAA,MAAA;AAAA,KAAO,CAAA;AAAA,GAC3B,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var css_248z = "/* Vars applied to root NavItem component */\n.saltNavItem {\n --navItem-color: var(--salt-text-secondary-foreground);\n --navItem-fill: var(--salt-text-secondary-foreground);\n --navItem-bar-inset: var(--salt-spacing-25);\n --navItem-bar-size: calc(var(--salt-size-bar) / 2);\n --navItem-indicator-background: var(--salt-navigable-indicator-active);\n}\n\n/* Vars applied to NavItem component when active or selected */\n.saltNavItem-active,\n.saltNavItem-blurSelected {\n --navItem-color: var(--salt-text-primary-foreground);\n --navItem-fill: var(--salt-text-primary-foreground);\n}\n\n/* Styles applied to root NavItem component */\n.saltNavItem {\n display: flex;\n align-items: center;\n position: relative;\n gap: var(--salt-spacing-100);\n font-weight: var(--salt-text-fontWeight-strong);\n /* Hover off animation */\n transition: all var(--salt-duration-instant) ease-in-out;\n}\n\n/* Styles applied to NavItem icon */\n.saltNavItem .saltNavItem-icon {\n fill: var(--navItem-fill);\n}\n\n/* Styles applied when orientation = \"horizontal\" */\n.saltNavItem-horizontal {\n min-height: calc(var(--salt-size-base) + var(--salt-spacing-100) + var(--salt-spacing-100));\n padding: calc(var(--salt-spacing-100) + var(--navItem-bar-inset)) 0 var(--salt-spacing-100) 0;\n margin: 0 var(--salt-spacing-100);\n}\n\n/* Styles applied when orientation = \"vertical\" */\n.saltNavItem-vertical {\n min-height: calc(var(--salt-size-base));\n padding-left: calc(var(--salt-spacing-100) + var(--navItem-bar-inset));\n margin: var(--salt-spacing-50) 0;\n}\n\n/* Styles applied to NavItem label */\n.saltNavItem .saltNavItem-label {\n --link-color-visited: var(--navItem-color);\n --link-color-hover: var(--navItem-color);\n\n text-decoration: none;\n color: var(--navItem-color);\n line-height: var(--salt-text-lineHeight);\n font-family: var(--salt-text-fontFamily);\n padding-left: calc(var(--saltNavItem-level, 0) * var(--salt-spacing-100));\n flex: 1;\n}\n\n/* Styles applied when level is not 0 */\n.saltNavItem-nested {\n padding-left: calc(var(--salt-spacing-250) + (var(--saltNavItem-level, 0) * var(--salt-spacing-100)));\n}\n\n/* Styles applied to expand button icon */\n.saltNavItem .saltNavItem-expandButton {\n --saltIcon-color: var(--navItem-fill);\n --saltButton-background-hover: none;\n --saltButton-background-active: none;\n}\n\n/* Styles applied to NavItem when focus is visible */\n.saltNavItem:focus-visible {\n outline: var(--salt-focused-outline);\n}\n\n/* Styles applied to activation line */\n.saltNavItem::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n display: block;\n}\n\n/* Styles applied to activation line when orientation = \"horizontal\" */\n.saltNavItem-horizontal::after {\n width: 100%;\n height: var(--navItem-bar-size);\n top: var(--navItem-bar-inset);\n}\n\n/* Styles applied to activation line when orientation = \"vertical\" */\n.saltNavItem-vertical::after {\n width: var(--navItem-bar-size);\n height: 100%;\n left: var(--navItem-bar-inset);\n}\n\n/* Styles applied to activation line on hover and on focus */\n.saltNavItem:hover::after,\n.saltNavItem:focus::after {\n background: var(--salt-navigable-indicator-hover);\n /* Hover on animation */\n transition: all var(--salt-duration-perceptible) ease-in-out;\n}\n\n/* Styles applied to activation line when item has active children */\n.saltNavItem.saltNavItem-blurSelected::after,\n.saltNavItem.saltNavItem-blurSelected:hover::after,\n.saltNavItem.saltNavItem-blurSelected:focus::after {\n --navItem-indicator-background: none;\n}\n\n/* Styles applied to activation line when item is active */\n.saltNavItem.saltNavItem-active::after,\n.saltNavItem.saltNavItem-active:hover::after,\n.saltNavItem.saltNavItem-active:focus::after {\n background: var(--navItem-indicator-background);\n /* Hover on animation */\n transition: all var(--salt-duration-perceptible) ease-in-out;\n}\n";
|
|
4
|
-
|
|
5
|
-
module.exports = css_248z;
|
|
6
|
-
//# sourceMappingURL=NavItem.css.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NavItem.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|