@salt-ds/lab 1.0.0-alpha.14 → 1.0.0-alpha.15
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/badge/Badge.css.js +1 -1
- package/dist-cjs/badge/Badge.js +7 -23
- package/dist-cjs/badge/Badge.js.map +1 -1
- package/dist-cjs/content-status/ContentStatus.js +0 -2
- package/dist-cjs/content-status/ContentStatus.js.map +1 -1
- package/dist-cjs/content-status/internal/StatusIndicator.js +0 -2
- package/dist-cjs/content-status/internal/StatusIndicator.js.map +1 -1
- package/dist-cjs/drawer/Drawer.css.js +1 -1
- package/dist-cjs/drawer/Drawer.js +39 -45
- package/dist-cjs/drawer/Drawer.js.map +1 -1
- package/dist-cjs/drawer/useDrawer.js +31 -0
- package/dist-cjs/drawer/useDrawer.js.map +1 -0
- package/dist-cjs/form-field-legacy/FormFieldLegacy.css.js +1 -1
- package/dist-cjs/index.js +4 -7
- package/dist-cjs/index.js.map +1 -1
- package/dist-cjs/list-next/ListItemNext.css.js +1 -1
- package/dist-cjs/list-next/ListItemNext.js +17 -6
- package/dist-cjs/list-next/ListItemNext.js.map +1 -1
- package/dist-cjs/list-next/ListNext.js +21 -10
- package/dist-cjs/list-next/ListNext.js.map +1 -1
- package/dist-cjs/list-next/ListNextContext.js.map +1 -1
- package/dist-cjs/list-next/useList.js +96 -37
- package/dist-cjs/list-next/useList.js.map +1 -1
- package/dist-cjs/nav-item/ExpansionButton.js +1 -1
- package/dist-cjs/nav-item/ExpansionButton.js.map +1 -1
- package/dist-cjs/nav-item/NavItem.css.js +1 -1
- package/dist-cjs/nav-item/NavItem.js +11 -1
- package/dist-cjs/nav-item/NavItem.js.map +1 -1
- package/dist-cjs/progress/CircularProgress/CircularProgress.css.js +1 -1
- package/dist-cjs/progress/CircularProgress/CircularProgress.js +44 -51
- package/dist-cjs/progress/CircularProgress/CircularProgress.js.map +1 -1
- package/dist-cjs/progress/LinearProgress/LinearProgress.css.js +1 -1
- package/dist-cjs/progress/LinearProgress/LinearProgress.js +9 -49
- package/dist-cjs/progress/LinearProgress/LinearProgress.js.map +1 -1
- package/dist-cjs/stepped-tracker/StepLabel/StepLabel.css.js +1 -1
- package/dist-cjs/stepped-tracker/StepLabel/StepLabel.js +5 -13
- package/dist-cjs/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
- package/dist-cjs/stepped-tracker/SteppedTracker.css.js +1 -1
- package/dist-cjs/stepped-tracker/SteppedTracker.js +0 -5
- package/dist-cjs/stepped-tracker/SteppedTracker.js.map +1 -1
- package/dist-cjs/stepped-tracker/SteppedTrackerContext.js +1 -7
- package/dist-cjs/stepped-tracker/SteppedTrackerContext.js.map +1 -1
- package/dist-cjs/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.js +2 -14
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStep.js.map +1 -1
- package/dist-cjs/switch/Switch.css.js +1 -1
- package/dist-cjs/switch/Switch.js +67 -72
- package/dist-cjs/switch/Switch.js.map +1 -1
- package/dist-cjs/toast-group/ToastGroup.css.js +6 -0
- package/dist-cjs/toast-group/ToastGroup.css.js.map +1 -0
- package/dist-cjs/toast-group/ToastGroup.js +32 -0
- package/dist-cjs/toast-group/ToastGroup.js.map +1 -0
- package/dist-es/badge/Badge.css.js +1 -1
- package/dist-es/badge/Badge.js +9 -25
- package/dist-es/badge/Badge.js.map +1 -1
- package/dist-es/content-status/ContentStatus.js +0 -2
- package/dist-es/content-status/ContentStatus.js.map +1 -1
- package/dist-es/content-status/internal/StatusIndicator.js +0 -2
- package/dist-es/content-status/internal/StatusIndicator.js.map +1 -1
- package/dist-es/drawer/Drawer.css.js +1 -1
- package/dist-es/drawer/Drawer.js +40 -46
- package/dist-es/drawer/Drawer.js.map +1 -1
- package/dist-es/drawer/useDrawer.js +27 -0
- package/dist-es/drawer/useDrawer.js.map +1 -0
- package/dist-es/form-field-legacy/FormFieldLegacy.css.js +1 -1
- package/dist-es/index.js +2 -3
- package/dist-es/index.js.map +1 -1
- package/dist-es/list-next/ListItemNext.css.js +1 -1
- package/dist-es/list-next/ListItemNext.js +17 -6
- package/dist-es/list-next/ListItemNext.js.map +1 -1
- package/dist-es/list-next/ListNext.js +21 -10
- package/dist-es/list-next/ListNext.js.map +1 -1
- package/dist-es/list-next/ListNextContext.js.map +1 -1
- package/dist-es/list-next/useList.js +98 -39
- package/dist-es/list-next/useList.js.map +1 -1
- package/dist-es/nav-item/ExpansionButton.js +2 -2
- package/dist-es/nav-item/ExpansionButton.js.map +1 -1
- package/dist-es/nav-item/NavItem.css.js +1 -1
- package/dist-es/nav-item/NavItem.js +11 -1
- package/dist-es/nav-item/NavItem.js.map +1 -1
- package/dist-es/progress/CircularProgress/CircularProgress.css.js +1 -1
- package/dist-es/progress/CircularProgress/CircularProgress.js +45 -52
- package/dist-es/progress/CircularProgress/CircularProgress.js.map +1 -1
- package/dist-es/progress/LinearProgress/LinearProgress.css.js +1 -1
- package/dist-es/progress/LinearProgress/LinearProgress.js +9 -49
- package/dist-es/progress/LinearProgress/LinearProgress.js.map +1 -1
- package/dist-es/stepped-tracker/StepLabel/StepLabel.css.js +1 -1
- package/dist-es/stepped-tracker/StepLabel/StepLabel.js +7 -15
- package/dist-es/stepped-tracker/StepLabel/StepLabel.js.map +1 -1
- package/dist-es/stepped-tracker/SteppedTracker.css.js +1 -1
- package/dist-es/stepped-tracker/SteppedTracker.js +1 -6
- package/dist-es/stepped-tracker/SteppedTracker.js.map +1 -1
- package/dist-es/stepped-tracker/SteppedTrackerContext.js +1 -7
- package/dist-es/stepped-tracker/SteppedTrackerContext.js.map +1 -1
- package/dist-es/stepped-tracker/TrackerConnector/TrackerConnector.css.js +1 -1
- package/dist-es/stepped-tracker/TrackerStep/TrackerStep.css.js +1 -1
- package/dist-es/stepped-tracker/TrackerStep/TrackerStep.js +3 -15
- package/dist-es/stepped-tracker/TrackerStep/TrackerStep.js.map +1 -1
- package/dist-es/switch/Switch.css.js +1 -1
- package/dist-es/switch/Switch.js +70 -75
- package/dist-es/switch/Switch.js.map +1 -1
- package/dist-es/toast-group/ToastGroup.css.js +4 -0
- package/dist-es/toast-group/ToastGroup.css.js.map +1 -0
- package/dist-es/toast-group/ToastGroup.js +28 -0
- package/dist-es/toast-group/ToastGroup.js.map +1 -0
- package/dist-types/badge/Badge.d.ts +5 -16
- package/dist-types/content-status/internal/StatusIndicator.d.ts +2 -2
- package/dist-types/dialog/internal/DialogContext.d.ts +1 -1
- package/dist-types/drawer/Drawer.d.ts +3 -12
- package/dist-types/drawer/index.d.ts +1 -0
- package/dist-types/drawer/useDrawer.d.ts +27 -0
- package/dist-types/index.d.ts +1 -2
- package/dist-types/list-next/ListItemNext.d.ts +6 -1
- package/dist-types/list-next/ListNext.d.ts +7 -2
- package/dist-types/list-next/ListNextContext.d.ts +4 -2
- package/dist-types/list-next/useList.d.ts +15 -7
- package/dist-types/nav-item/NavItem.d.ts +29 -1
- package/dist-types/progress/CircularProgress/CircularProgress.d.ts +1 -21
- package/dist-types/progress/LinearProgress/LinearProgress.d.ts +1 -26
- package/dist-types/stepped-tracker/StepLabel/StepLabel.d.ts +3 -5
- package/dist-types/stepped-tracker/SteppedTrackerContext.d.ts +1 -4
- package/dist-types/stepped-tracker/TrackerStep/index.d.ts +0 -1
- package/dist-types/switch/Switch.d.ts +43 -6
- package/dist-types/toast-group/ToastGroup.d.ts +5 -0
- package/dist-types/toast-group/index.d.ts +1 -0
- package/package.json +3 -3
- package/dist-cjs/control-label/ControlLabel.css.js +0 -6
- package/dist-cjs/control-label/ControlLabel.css.js.map +0 -1
- package/dist-cjs/control-label/ControlLabel.js +0 -48
- package/dist-cjs/control-label/ControlLabel.js.map +0 -1
- package/dist-cjs/multiline-input/MultilineInput.css.js +0 -6
- package/dist-cjs/multiline-input/MultilineInput.css.js.map +0 -1
- package/dist-cjs/multiline-input/MultilineInput.js +0 -162
- package/dist-cjs/multiline-input/MultilineInput.js.map +0 -1
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js +0 -21
- package/dist-cjs/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js.map +0 -1
- package/dist-cjs/stepped-tracker/useDetectTruncatedText.js +0 -71
- package/dist-cjs/stepped-tracker/useDetectTruncatedText.js.map +0 -1
- package/dist-cjs/switch/assets/CheckedIcon.js +0 -34
- package/dist-cjs/switch/assets/CheckedIcon.js.map +0 -1
- package/dist-es/control-label/ControlLabel.css.js +0 -4
- package/dist-es/control-label/ControlLabel.css.js.map +0 -1
- package/dist-es/control-label/ControlLabel.js +0 -43
- package/dist-es/control-label/ControlLabel.js.map +0 -1
- package/dist-es/multiline-input/MultilineInput.css.js +0 -4
- package/dist-es/multiline-input/MultilineInput.css.js.map +0 -1
- package/dist-es/multiline-input/MultilineInput.js +0 -158
- package/dist-es/multiline-input/MultilineInput.js.map +0 -1
- package/dist-es/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js +0 -16
- package/dist-es/stepped-tracker/TrackerStep/TrackerStepTooltipContext.js.map +0 -1
- package/dist-es/stepped-tracker/useDetectTruncatedText.js +0 -69
- package/dist-es/stepped-tracker/useDetectTruncatedText.js.map +0 -1
- package/dist-es/switch/assets/CheckedIcon.js +0 -30
- package/dist-es/switch/assets/CheckedIcon.js.map +0 -1
- package/dist-types/control-label/ControlLabel.d.ts +0 -8
- package/dist-types/control-label/index.d.ts +0 -1
- package/dist-types/multiline-input/MultilineInput.d.ts +0 -40
- package/dist-types/multiline-input/index.d.ts +0 -1
- package/dist-types/stepped-tracker/TrackerStep/TrackerStepTooltipContext.d.ts +0 -7
- package/dist-types/stepped-tracker/useDetectTruncatedText.d.ts +0 -11
- package/dist-types/switch/assets/CheckedIcon.d.ts +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/*
|
|
3
|
+
var css_248z = "/* Style applied to the root element */\n.saltBadge {\n display: inline-flex;\n position: relative;\n flex-shrink: 0;\n vertical-align: middle;\n}\n\n.saltBadge-badge {\n /* Should this vary according to touch size */\n padding-inline: var(--salt-spacing-50);\n line-height: var(--salt-accent-lineHeight);\n height: var(--salt-accent-lineHeight);\n min-width: var(--salt-accent-lineHeight);\n border-radius: 9999px;\n white-space: nowrap;\n z-index: var(--salt-zIndex-notification);\n\n align-items: center;\n justify-content: center;\n display: inline-flex;\n margin: auto;\n\n font-size: var(--salt-accent-fontSize);\n font-weight: var(--salt-accent-fontWeight);\n background: var(--salt-accent-background);\n color: var(--salt-accent-foreground);\n\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.saltBadge-topRight {\n position: relative;\n top: calc(-1 * var(--salt-spacing-100));\n right: var(--salt-spacing-100);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=Badge.css.js.map
|
package/dist-cjs/badge/Badge.js
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var core = require('@salt-ds/core');
|
|
7
|
-
var icons = require('@salt-ds/icons');
|
|
8
7
|
var clsx = require('clsx');
|
|
9
8
|
var React = require('react');
|
|
10
9
|
var window = require('@salt-ds/window');
|
|
@@ -12,40 +11,25 @@ var styles = require('@salt-ds/styles');
|
|
|
12
11
|
var Badge$1 = require('./Badge.css.js');
|
|
13
12
|
|
|
14
13
|
const withBaseName = core.makePrefixer("saltBadge");
|
|
15
|
-
const Badge = React.forwardRef(function Badge2({
|
|
16
|
-
badgeContent = 0,
|
|
17
|
-
max = 1e3,
|
|
18
|
-
className,
|
|
19
|
-
children = /* @__PURE__ */ jsxRuntime.jsx(icons.MessageIcon, {}),
|
|
20
|
-
...rest
|
|
21
|
-
}, ref) {
|
|
22
|
-
var _a;
|
|
14
|
+
const Badge = React.forwardRef(function Badge2({ value, max = 999, className, children, ...rest }, ref) {
|
|
23
15
|
const targetWindow = window.useWindow();
|
|
24
16
|
styles.useComponentCssInjection({
|
|
25
17
|
testId: "salt-badge",
|
|
26
18
|
css: Badge$1,
|
|
27
19
|
window: targetWindow
|
|
28
20
|
});
|
|
29
|
-
const
|
|
30
|
-
const childId = core.useId(
|
|
31
|
-
React.isValidElement(children) ? (_a = children.props) == null ? void 0 : _a.id : void 0
|
|
32
|
-
);
|
|
33
|
-
let badgeContentValue = badgeContent;
|
|
34
|
-
if (badgeContentValue > max) {
|
|
35
|
-
badgeContentValue = `${max}+`;
|
|
36
|
-
}
|
|
21
|
+
const valueText = typeof value === "number" && value > max ? `${max}+` : value;
|
|
37
22
|
return /* @__PURE__ */ jsxRuntime.jsxs("span", {
|
|
38
23
|
className: clsx.clsx(withBaseName(), className),
|
|
39
24
|
ref,
|
|
40
|
-
role: "img",
|
|
41
|
-
"aria-labelledby": clsx.clsx(childId, badgeId),
|
|
42
25
|
...rest,
|
|
43
26
|
children: [
|
|
44
|
-
children
|
|
27
|
+
children,
|
|
45
28
|
/* @__PURE__ */ jsxRuntime.jsx("span", {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
className: clsx.clsx(withBaseName("badge"), {
|
|
30
|
+
[withBaseName("topRight")]: children
|
|
31
|
+
}),
|
|
32
|
+
children: valueText
|
|
49
33
|
})
|
|
50
34
|
]
|
|
51
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../src/badge/Badge.tsx"],"sourcesContent":["import { makePrefixer
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../src/badge/Badge.tsx"],"sourcesContent":["import { makePrefixer } from \"@salt-ds/core\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, ReactNode } from \"react\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport badgeCss from \"./Badge.css\";\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n /**\n * The number to display on the badge\n */\n value: number | string;\n /**\n * If a child is provided the Badge will render top right. By defualt renders inline.\n */\n children?: ReactNode;\n /**\n * The max number to display on the badge.\n */\n max?: number;\n}\nconst withBaseName = makePrefixer(\"saltBadge\");\n\nexport const Badge = forwardRef<HTMLSpanElement, BadgeProps>(function Badge(\n { value, max = 999, className, children, ...rest },\n ref\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-badge\",\n css: badgeCss,\n window: targetWindow,\n });\n\n const valueText =\n typeof value === \"number\" && value > max ? `${max}+` : value;\n\n return (\n <span className={clsx(withBaseName(), className)} ref={ref} {...rest}>\n {children}\n <span\n className={clsx(withBaseName(\"badge\"), {\n [withBaseName(\"topRight\")]: children,\n })}\n >\n {valueText}\n </span>\n </span>\n );\n});\n"],"names":["makePrefixer","forwardRef","Badge","useWindow","useComponentCssInjection","badgeCss","jsxs","clsx","jsx"],"mappings":";;;;;;;;;;;;AAsBA,MAAM,YAAA,GAAeA,kBAAa,WAAW,CAAA,CAAA;AAEtC,MAAM,KAAQ,GAAAC,gBAAA,CAAwC,SAASC,MAAAA,CACpE,EAAE,KAAA,EAAO,GAAM,GAAA,GAAA,EAAK,SAAW,EAAA,QAAA,EAAA,GAAa,IAAK,EAAA,EACjD,GACA,EAAA;AACA,EAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,YAAA;AAAA,IACR,GAAK,EAAAC,OAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAA,MAAM,YACJ,OAAO,KAAA,KAAU,YAAY,KAAQ,GAAA,GAAA,GAAM,GAAG,GAAS,CAAA,CAAA,CAAA,GAAA,KAAA,CAAA;AAEzD,EAAA,uBACGC,eAAA,CAAA,MAAA,EAAA;AAAA,IAAK,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,IAAG,GAAA;AAAA,IAAW,GAAG,IAAA;AAAA,IAC7D,QAAA,EAAA;AAAA,MAAA,QAAA;AAAA,sBACAC,cAAA,CAAA,MAAA,EAAA;AAAA,QACC,SAAW,EAAAD,SAAA,CAAK,YAAa,CAAA,OAAO,CAAG,EAAA;AAAA,UACrC,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,SAC7B,CAAA;AAAA,QAEA,QAAA,EAAA,SAAA;AAAA,OACH,CAAA;AAAA,KAAA;AAAA,GACF,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -25,7 +25,6 @@ const ContentStatus = React.forwardRef(
|
|
|
25
25
|
onActionClick,
|
|
26
26
|
status = "info",
|
|
27
27
|
title,
|
|
28
|
-
unit = "%",
|
|
29
28
|
value,
|
|
30
29
|
...rest
|
|
31
30
|
}, ref) {
|
|
@@ -70,7 +69,6 @@ const ContentStatus = React.forwardRef(
|
|
|
70
69
|
message,
|
|
71
70
|
status,
|
|
72
71
|
title,
|
|
73
|
-
unit,
|
|
74
72
|
value,
|
|
75
73
|
...rest
|
|
76
74
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContentStatus.js","sources":["../src/content-status/ContentStatus.tsx"],"sourcesContent":["import {\n Button,\n makePrefixer,\n Text,\n useAriaAnnouncer,\n useId,\n} from \"@salt-ds/core\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, MouseEvent, Ref, useEffect } from \"react\";\n\nimport {\n StatusIndicator,\n StatusIndicatorProps,\n} from \"./internal/StatusIndicator\";\n\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport contentStatusCss from \"./ContentStatus.css\";\n\nconst withBaseName = makePrefixer(\"saltContentStatus\");\n\nexport interface ContentStatusProps\n extends HTMLAttributes<HTMLDivElement>,\n StatusIndicatorProps {\n actionLabel?: string;\n buttonRef?: Ref<any>;\n onActionClick?: (evt: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport const ContentStatus = forwardRef<HTMLDivElement, ContentStatusProps>(\n function ContentStatus(\n {\n CircularProgressProps,\n SpinnerProps,\n actionLabel,\n buttonRef,\n className,\n children,\n disableAnnouncer,\n message,\n onActionClick,\n status = \"info\",\n title,\n
|
|
1
|
+
{"version":3,"file":"ContentStatus.js","sources":["../src/content-status/ContentStatus.tsx"],"sourcesContent":["import {\n Button,\n makePrefixer,\n Text,\n useAriaAnnouncer,\n useId,\n} from \"@salt-ds/core\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, MouseEvent, Ref, useEffect } from \"react\";\n\nimport {\n StatusIndicator,\n StatusIndicatorProps,\n} from \"./internal/StatusIndicator\";\n\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport contentStatusCss from \"./ContentStatus.css\";\n\nconst withBaseName = makePrefixer(\"saltContentStatus\");\n\nexport interface ContentStatusProps\n extends HTMLAttributes<HTMLDivElement>,\n StatusIndicatorProps {\n actionLabel?: string;\n buttonRef?: Ref<any>;\n onActionClick?: (evt: MouseEvent<HTMLButtonElement>) => void;\n}\n\nexport const ContentStatus = forwardRef<HTMLDivElement, ContentStatusProps>(\n function ContentStatus(\n {\n CircularProgressProps,\n SpinnerProps,\n actionLabel,\n buttonRef,\n className,\n children,\n disableAnnouncer,\n message,\n onActionClick,\n status = \"info\",\n title,\n value,\n ...rest\n },\n ref\n ) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-content-status\",\n css: contentStatusCss,\n window: targetWindow,\n });\n\n const id = useId();\n\n const hasDefaultActionContent = actionLabel && onActionClick;\n const hasActions = children || hasDefaultActionContent;\n const hasContent = title || message || hasActions;\n\n const { announce } = useAriaAnnouncer();\n\n useEffect(() => {\n if (disableAnnouncer) return;\n\n const toBeAnnounced = [];\n if (title) {\n toBeAnnounced.push(title);\n }\n if (message) {\n toBeAnnounced.push(message);\n }\n // Loading is announced by the spinner\n if (status !== \"loading\") {\n toBeAnnounced.push(status);\n }\n if (toBeAnnounced.length > 0) {\n announce(toBeAnnounced.join(\" \"));\n }\n }, [announce, disableAnnouncer, message, status, title]);\n\n return (\n <div className={clsx(withBaseName(), className)} ref={ref} {...rest}>\n <StatusIndicator\n CircularProgressProps={CircularProgressProps}\n SpinnerProps={SpinnerProps}\n disableAnnouncer={disableAnnouncer}\n id={id}\n message={message}\n status={status}\n title={title}\n value={value}\n {...rest}\n />\n {hasContent && (\n <div\n // `aria-labelledby` to itself so that children of this div will show up in screen reader, and we don't need to join to aria-label\n aria-labelledby={id}\n className={clsx(withBaseName(\"content\"))}\n id={id}\n role=\"region\"\n >\n {title && (\n <Text className={clsx(withBaseName(\"title\"))}>{title}</Text>\n )}\n {message && (\n <Text className={clsx(withBaseName(\"message\"))}>{message}</Text>\n )}\n {hasActions && (\n <div className={clsx(withBaseName(\"actions\"))}>\n {children || (\n <Button onClick={onActionClick} ref={buttonRef}>\n {actionLabel}\n </Button>\n )}\n </div>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","ContentStatus","useWindow","useComponentCssInjection","contentStatusCss","useId","useAriaAnnouncer","useEffect","jsxs","clsx","jsx","StatusIndicator","Text","Button"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,YAAA,GAAeA,kBAAa,mBAAmB,CAAA,CAAA;AAU9C,MAAM,aAAgB,GAAAC,gBAAA;AAAA,EAC3B,SAASC,cACP,CAAA;AAAA,IACE,qBAAA;AAAA,IACA,YAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,gBAAA;AAAA,IACA,OAAA;AAAA,IACA,aAAA;AAAA,IACA,MAAS,GAAA,MAAA;AAAA,IACT,KAAA;AAAA,IACA,KAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACA,EAAA;AACA,IAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,qBAAA;AAAA,MACR,GAAK,EAAAC,eAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,MAAM,KAAKC,UAAM,EAAA,CAAA;AAEjB,IAAA,MAAM,0BAA0B,WAAe,IAAA,aAAA,CAAA;AAC/C,IAAA,MAAM,aAAa,QAAY,IAAA,uBAAA,CAAA;AAC/B,IAAM,MAAA,UAAA,GAAa,SAAS,OAAW,IAAA,UAAA,CAAA;AAEvC,IAAM,MAAA,EAAE,QAAS,EAAA,GAAIC,qBAAiB,EAAA,CAAA;AAEtC,IAAAC,eAAA,CAAU,MAAM;AACd,MAAI,IAAA,gBAAA;AAAkB,QAAA,OAAA;AAEtB,MAAA,MAAM,gBAAgB,EAAC,CAAA;AACvB,MAAA,IAAI,KAAO,EAAA;AACT,QAAA,aAAA,CAAc,KAAK,KAAK,CAAA,CAAA;AAAA,OAC1B;AACA,MAAA,IAAI,OAAS,EAAA;AACX,QAAA,aAAA,CAAc,KAAK,OAAO,CAAA,CAAA;AAAA,OAC5B;AAEA,MAAA,IAAI,WAAW,SAAW,EAAA;AACxB,QAAA,aAAA,CAAc,KAAK,MAAM,CAAA,CAAA;AAAA,OAC3B;AACA,MAAI,IAAA,aAAA,CAAc,SAAS,CAAG,EAAA;AAC5B,QAAS,QAAA,CAAA,aAAA,CAAc,IAAK,CAAA,GAAG,CAAC,CAAA,CAAA;AAAA,OAClC;AAAA,OACC,CAAC,QAAA,EAAU,kBAAkB,OAAS,EAAA,MAAA,EAAQ,KAAK,CAAC,CAAA,CAAA;AAEvD,IAAA,uBACGC,eAAA,CAAA,KAAA,EAAA;AAAA,MAAI,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MAAG,GAAA;AAAA,MAAW,GAAG,IAAA;AAAA,MAC7D,QAAA,EAAA;AAAA,wBAACC,cAAA,CAAAC,+BAAA,EAAA;AAAA,UACC,qBAAA;AAAA,UACA,YAAA;AAAA,UACA,gBAAA;AAAA,UACA,EAAA;AAAA,UACA,OAAA;AAAA,UACA,MAAA;AAAA,UACA,KAAA;AAAA,UACA,KAAA;AAAA,UACC,GAAG,IAAA;AAAA,SACN,CAAA;AAAA,QACC,8BACEH,eAAA,CAAA,KAAA,EAAA;AAAA,UAEC,iBAAiB,EAAA,EAAA;AAAA,UACjB,SAAW,EAAAC,SAAA,CAAK,YAAa,CAAA,SAAS,CAAC,CAAA;AAAA,UACvC,EAAA;AAAA,UACA,IAAK,EAAA,QAAA;AAAA,UAEJ,QAAA,EAAA;AAAA,YAAA,KAAA,oBACEC,cAAA,CAAAE,SAAA,EAAA;AAAA,cAAK,SAAW,EAAAH,SAAA,CAAK,YAAa,CAAA,OAAO,CAAC,CAAA;AAAA,cAAI,QAAA,EAAA,KAAA;AAAA,aAAM,CAAA;AAAA,YAEtD,2BACEC,cAAA,CAAAE,SAAA,EAAA;AAAA,cAAK,SAAW,EAAAH,SAAA,CAAK,YAAa,CAAA,SAAS,CAAC,CAAA;AAAA,cAAI,QAAA,EAAA,OAAA;AAAA,aAAQ,CAAA;AAAA,YAE1D,8BACEC,cAAA,CAAA,KAAA,EAAA;AAAA,cAAI,SAAW,EAAAD,SAAA,CAAK,YAAa,CAAA,SAAS,CAAC,CAAA;AAAA,cACzC,sCACEC,cAAA,CAAAG,WAAA,EAAA;AAAA,gBAAO,OAAS,EAAA,aAAA;AAAA,gBAAe,GAAK,EAAA,SAAA;AAAA,gBAClC,QAAA,EAAA,WAAA;AAAA,eACH,CAAA;AAAA,aAEJ,CAAA;AAAA,WAAA;AAAA,SAEJ,CAAA;AAAA,OAAA;AAAA,KAEJ,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -12,7 +12,6 @@ const withBaseName = core.makePrefixer("saltContentStatus");
|
|
|
12
12
|
function StatusIndicator({
|
|
13
13
|
status = "info",
|
|
14
14
|
disableAnnouncer,
|
|
15
|
-
unit,
|
|
16
15
|
value,
|
|
17
16
|
title,
|
|
18
17
|
message,
|
|
@@ -31,7 +30,6 @@ function StatusIndicator({
|
|
|
31
30
|
withBaseName("determinateLoading"),
|
|
32
31
|
circularProgressClassName
|
|
33
32
|
),
|
|
34
|
-
unit,
|
|
35
33
|
value,
|
|
36
34
|
...restCircularProgressProps
|
|
37
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusIndicator.js","sources":["../src/content-status/internal/StatusIndicator.tsx"],"sourcesContent":["import {\n makePrefixer,\n StatusIndicator as BaseStatusIndicator,\n StatusIndicatorProps as BaseStatusIndicatorProps,\n Spinner,\n SpinnerProps,\n} from \"@salt-ds/core\";\nimport { ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport { CircularProgress, CircularProgressProps } from \"../../progress\";\n\nexport interface StatusIndicatorProps\n extends Pick<SpinnerProps, \"disableAnnouncer\">,\n Pick<CircularProgressProps, \"
|
|
1
|
+
{"version":3,"file":"StatusIndicator.js","sources":["../src/content-status/internal/StatusIndicator.tsx"],"sourcesContent":["import {\n makePrefixer,\n StatusIndicator as BaseStatusIndicator,\n StatusIndicatorProps as BaseStatusIndicatorProps,\n Spinner,\n SpinnerProps,\n} from \"@salt-ds/core\";\nimport { ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport { CircularProgress, CircularProgressProps } from \"../../progress\";\n\nexport interface StatusIndicatorProps\n extends Pick<SpinnerProps, \"disableAnnouncer\">,\n Pick<CircularProgressProps, \"value\"> {\n title?: string;\n message?: string;\n CircularProgressProps?: Partial<CircularProgressProps>;\n SpinnerProps?: Partial<SpinnerProps>;\n id?: string;\n status?: BaseStatusIndicatorProps[\"status\"] | \"loading\";\n}\n\nconst withBaseName = makePrefixer(\"saltContentStatus\");\n\nexport function StatusIndicator({\n status = \"info\",\n disableAnnouncer,\n value,\n title,\n message,\n CircularProgressProps: {\n className: circularProgressClassName,\n ...restCircularProgressProps\n } = {},\n SpinnerProps: { className: spinnerClassName, ...restSpinnerProps } = {},\n id,\n}: StatusIndicatorProps): ReactElement {\n if (status === \"loading\") {\n if (value !== undefined) {\n return (\n <CircularProgress\n aria-label={title || message}\n className={clsx(\n withBaseName(\"determinateLoading\"),\n circularProgressClassName\n )}\n value={value}\n {...restCircularProgressProps}\n />\n );\n }\n return (\n <Spinner\n className={clsx(withBaseName(\"indeterminateLoading\"), spinnerClassName)}\n // Announcement of the content status is more useful than completion announcement from spinner\n completionAnnouncement={null}\n data-testid={`spinner-${id!}`}\n disableAnnouncer={disableAnnouncer}\n {...restSpinnerProps}\n />\n );\n }\n\n return (\n <BaseStatusIndicator\n status={status}\n data-jpmui-test={`icon-${status}-${id!}`}\n size={2}\n />\n );\n}\n"],"names":["makePrefixer","jsx","CircularProgress","clsx","Spinner","BaseStatusIndicator"],"mappings":";;;;;;;;;;AAuBA,MAAM,YAAA,GAAeA,kBAAa,mBAAmB,CAAA,CAAA;AAE9C,SAAS,eAAgB,CAAA;AAAA,EAC9B,MAAS,GAAA,MAAA;AAAA,EACT,gBAAA;AAAA,EACA,KAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,qBAAuB,EAAA;AAAA,IACrB,SAAW,EAAA,yBAAA;AAAA,IACR,GAAA,yBAAA;AAAA,MACD,EAAC;AAAA,EACL,cAAc,EAAE,SAAA,EAAW,gBAAqB,EAAA,GAAA,gBAAA,KAAqB,EAAC;AAAA,EACtE,EAAA;AACF,CAAuC,EAAA;AACrC,EAAA,IAAI,WAAW,SAAW,EAAA;AACxB,IAAA,IAAI,UAAU,KAAW,CAAA,EAAA;AACvB,MAAA,uBACGC,cAAA,CAAAC,iCAAA,EAAA;AAAA,QACC,cAAY,KAAS,IAAA,OAAA;AAAA,QACrB,SAAW,EAAAC,SAAA;AAAA,UACT,aAAa,oBAAoB,CAAA;AAAA,UACjC,yBAAA;AAAA,SACF;AAAA,QACA,KAAA;AAAA,QACC,GAAG,yBAAA;AAAA,OACN,CAAA,CAAA;AAAA,KAEJ;AACA,IAAA,uBACGF,cAAA,CAAAG,YAAA,EAAA;AAAA,MACC,SAAW,EAAAD,SAAA,CAAK,YAAa,CAAA,sBAAsB,GAAG,gBAAgB,CAAA;AAAA,MAEtE,sBAAwB,EAAA,IAAA;AAAA,MACxB,eAAa,CAAW,QAAA,EAAA,EAAA,CAAA,CAAA;AAAA,MACxB,gBAAA;AAAA,MACC,GAAG,gBAAA;AAAA,KACN,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,uBACGF,cAAA,CAAAI,oBAAA,EAAA;AAAA,IACC,MAAA;AAAA,IACA,iBAAA,EAAiB,QAAQ,MAAU,CAAA,CAAA,EAAA,EAAA,CAAA,CAAA;AAAA,IACnC,IAAM,EAAA,CAAA;AAAA,GACR,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/* Styles applied to Drawer component
|
|
3
|
+
var css_248z = "/* Styles applied to Drawer component */\n.saltDrawer {\n background: var(--drawer-background);\n display: flex;\n flex-direction: column;\n max-height: 100%;\n max-width: 100%;\n overflow: auto;\n padding: var(--salt-spacing-300);\n box-shadow: var(--salt-overlayable-shadow-modal);\n z-index: calc(var(--salt-zIndex-appHeader) - 1);\n position: fixed;\n top: 0;\n}\n\n.saltDrawer-overlay {\n background: var(--salt-overlayable-background);\n z-index: var(--salt-zIndex-drawer);\n}\n\n/* Styles applied when variant = \"primary\" */\n.saltDrawer-primary {\n --drawer-background: var(--salt-container-primary-background);\n}\n\n/* Styles applied when variant = \"secondary\" */\n.saltDrawer-secondary {\n --drawer-background: var(--salt-container-secondary-background);\n}\n\n/* Styles applied when position = \"top\" */\n.saltDrawer-top {\n left: 0;\n right: 0;\n bottom: auto;\n}\n\n/* Styles applied when position = \"top\" and the component mounts */\n.saltDrawer-top.saltDrawer-enterAnimation {\n animation: var(--salt-animation-slide-in-bottom);\n}\n\n/* Styles applied when position = \"top\" and the component unmounts */\n.saltDrawer-top.saltDrawer-exitAnimation {\n animation: var(--salt-animation-slide-out-bottom);\n}\n\n/* Styles applied when position = \"right\" or position = \"left\" */\n.saltDrawer-right,\n.saltDrawer-left {\n width: calc(10 * var(--salt-size-base));\n}\n\n/* Styles applied when position = \"right\" */\n.saltDrawer-right {\n left: auto;\n right: 0;\n height: 100%;\n}\n\n/* Styles applied when position = \"right\" and the component mounts */\n.saltDrawer-right.saltDrawer-enterAnimation {\n animation: var(--salt-animation-slide-in-right);\n}\n\n/* Styles applied when position = \"right\" and the component unmounts */\n.saltDrawer-right.saltDrawer-exitAnimation {\n animation: var(--salt-animation-slide-out-right);\n}\n\n/* Styles applied when position = \"left\" */\n.saltDrawer-left {\n left: 0;\n right: auto;\n height: 100%;\n}\n\n/* Styles applied when position = \"left\" and the component mounts */\n.saltDrawer-left.saltDrawer-enterAnimation {\n animation: var(--salt-animation-slide-in-left);\n}\n\n/* Styles applied when position = \"left\" and the component unmounts */\n.saltDrawer-left.saltDrawer-exitAnimation {\n animation: var(--salt-animation-slide-out-left);\n}\n\n/* Styles applied when position = \"bottom\" */\n.saltDrawer-bottom {\n left: 0;\n right: 0;\n bottom: 0;\n top: auto;\n}\n\n/* Styles applied when position = \"bottom\" and the component mounts */\n.saltDrawer-bottom.saltDrawer-enterAnimation {\n animation: var(--salt-animation-slide-in-top);\n}\n\n/* Styles applied when position = \"bottom\" and the component unmounts */\n.saltDrawer-bottom.saltDrawer-exitAnimation {\n animation: var(--salt-animation-slide-out-top);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=Drawer.css.js.map
|
|
@@ -5,25 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var clsx = require('clsx');
|
|
8
|
-
var
|
|
9
|
-
require('../scrim/ScrimContext.js');
|
|
8
|
+
var react = require('@floating-ui/react');
|
|
10
9
|
var core = require('@salt-ds/core');
|
|
11
10
|
var window = require('@salt-ds/window');
|
|
12
11
|
var styles = require('@salt-ds/styles');
|
|
12
|
+
var useDrawer = require('./useDrawer.js');
|
|
13
13
|
var Drawer$1 = require('./Drawer.css.js');
|
|
14
14
|
|
|
15
15
|
const DRAWER_POSITIONS = ["left", "top", "right", "bottom"];
|
|
16
16
|
const withBaseName = core.makePrefixer("saltDrawer");
|
|
17
|
-
const ariaAttributes = { role: "dialog", "aria-modal": true };
|
|
18
17
|
const Drawer = React.forwardRef(function Drawer2(props, ref) {
|
|
19
18
|
const {
|
|
20
19
|
children,
|
|
21
20
|
className,
|
|
22
|
-
disableScrim = false,
|
|
23
21
|
position = "left",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
isOpen = true,
|
|
22
|
+
open = true,
|
|
23
|
+
onOpenChange,
|
|
27
24
|
variant = "primary",
|
|
28
25
|
...rest
|
|
29
26
|
} = props;
|
|
@@ -34,47 +31,44 @@ const Drawer = React.forwardRef(function Drawer2(props, ref) {
|
|
|
34
31
|
window: targetWindow
|
|
35
32
|
});
|
|
36
33
|
const [showComponent, setShowComponent] = React.useState(false);
|
|
37
|
-
const
|
|
34
|
+
const { floating, context } = useDrawer.useDrawer({
|
|
35
|
+
open,
|
|
36
|
+
onOpenChange
|
|
37
|
+
});
|
|
38
|
+
const floatingRef = core.useForkRef(floating, ref);
|
|
38
39
|
React.useEffect(() => {
|
|
39
|
-
if (
|
|
40
|
-
setShowComponent(false);
|
|
41
|
-
}
|
|
42
|
-
if (isOpen && !showComponent) {
|
|
40
|
+
if (open && !showComponent) {
|
|
43
41
|
setShowComponent(true);
|
|
44
42
|
}
|
|
45
|
-
}, [
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
[withBaseName("exitAnimation")]: exitAnimation
|
|
75
|
-
}),
|
|
76
|
-
...scrimProps,
|
|
77
|
-
children: drawer
|
|
43
|
+
}, [open, showComponent]);
|
|
44
|
+
return /* @__PURE__ */ jsxRuntime.jsx(react.FloatingPortal, {
|
|
45
|
+
children: showComponent && /* @__PURE__ */ jsxRuntime.jsx(react.FloatingOverlay, {
|
|
46
|
+
className: withBaseName("overlay"),
|
|
47
|
+
lockScroll: true,
|
|
48
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(react.FloatingFocusManager, {
|
|
49
|
+
context,
|
|
50
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
51
|
+
ref: floatingRef,
|
|
52
|
+
className: clsx.clsx(
|
|
53
|
+
withBaseName(),
|
|
54
|
+
withBaseName(position),
|
|
55
|
+
{
|
|
56
|
+
[withBaseName("enterAnimation")]: open,
|
|
57
|
+
[withBaseName("exitAnimation")]: !open,
|
|
58
|
+
[withBaseName(variant)]: variant
|
|
59
|
+
},
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
onAnimationEnd: () => {
|
|
63
|
+
if (!open && showComponent) {
|
|
64
|
+
setShowComponent(false);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
...rest,
|
|
68
|
+
children
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
})
|
|
78
72
|
});
|
|
79
73
|
});
|
|
80
74
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, useEffect, useState } from \"react\";\nimport { clsx } from \"clsx\";\
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import { forwardRef, HTMLAttributes, useEffect, useState } from \"react\";\nimport { clsx } from \"clsx\";\nimport {\n FloatingFocusManager,\n FloatingOverlay,\n FloatingPortal,\n} from \"@floating-ui/react\";\nimport { makePrefixer, useForkRef } from \"@salt-ds/core\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useDrawer } from \"./useDrawer\";\n\nimport drawerCss from \"./Drawer.css\";\n\nexport const DRAWER_POSITIONS = [\"left\", \"top\", \"right\", \"bottom\"] as const;\n\nexport type DrawerPositions = typeof DRAWER_POSITIONS[number];\n\nexport interface DrawerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Defines the drawer position within the screen.\n */\n position?: DrawerPositions;\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (open: boolean) => void;\n /**\n * Change background color palette\n */\n variant?: \"primary\" | \"secondary\";\n}\n\nconst withBaseName = makePrefixer(\"saltDrawer\");\n\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(function Drawer(\n props,\n ref\n) {\n const {\n children,\n className,\n position = \"left\",\n open = true,\n onOpenChange,\n variant = \"primary\",\n ...rest\n } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-drawer\",\n css: drawerCss,\n window: targetWindow,\n });\n\n const [showComponent, setShowComponent] = useState(false);\n\n const { floating, context } = useDrawer({\n open,\n onOpenChange,\n });\n\n const floatingRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n }, [open, showComponent]);\n\n return (\n <FloatingPortal>\n {showComponent && (\n <FloatingOverlay className={withBaseName(\"overlay\")} lockScroll>\n <FloatingFocusManager context={context}>\n <div\n ref={floatingRef}\n className={clsx(\n withBaseName(),\n withBaseName(position),\n {\n [withBaseName(\"enterAnimation\")]: open,\n [withBaseName(\"exitAnimation\")]: !open,\n [withBaseName(variant)]: variant,\n },\n className\n )}\n onAnimationEnd={() => {\n if (!open && showComponent) {\n setShowComponent(false);\n }\n }}\n {...rest}\n >\n {children}\n </div>\n </FloatingFocusManager>\n </FloatingOverlay>\n )}\n </FloatingPortal>\n );\n});\n"],"names":["makePrefixer","forwardRef","Drawer","useWindow","useComponentCssInjection","drawerCss","useState","useDrawer","useForkRef","useEffect","jsx","FloatingPortal","FloatingOverlay","FloatingFocusManager","clsx"],"mappings":";;;;;;;;;;;;;;AAcO,MAAM,gBAAmB,GAAA,CAAC,MAAQ,EAAA,KAAA,EAAO,SAAS,QAAQ,EAAA;AAuBjE,MAAM,YAAA,GAAeA,kBAAa,YAAY,CAAA,CAAA;AAEvC,MAAM,MAAS,GAAAC,gBAAA,CAAwC,SAASC,OAAAA,CACrE,OACA,GACA,EAAA;AACA,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAW,GAAA,MAAA;AAAA,IACX,IAAO,GAAA,IAAA;AAAA,IACP,YAAA;AAAA,IACA,OAAU,GAAA,SAAA;AAAA,IACP,GAAA,IAAA;AAAA,GACD,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,aAAA;AAAA,IACR,GAAK,EAAAC,QAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAA,MAAM,CAAC,aAAA,EAAe,gBAAgB,CAAA,GAAIC,eAAS,KAAK,CAAA,CAAA;AAExD,EAAA,MAAM,EAAE,QAAA,EAAU,OAAQ,EAAA,GAAIC,mBAAU,CAAA;AAAA,IACtC,IAAA;AAAA,IACA,YAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAM,MAAA,WAAA,GAAcC,eAA2B,CAAA,QAAA,EAAU,GAAG,CAAA,CAAA;AAE5D,EAAAC,eAAA,CAAU,MAAM;AACd,IAAI,IAAA,IAAA,IAAQ,CAAC,aAAe,EAAA;AAC1B,MAAA,gBAAA,CAAiB,IAAI,CAAA,CAAA;AAAA,KACvB;AAAA,GACC,EAAA,CAAC,IAAM,EAAA,aAAa,CAAC,CAAA,CAAA;AAExB,EAAA,uBACGC,cAAA,CAAAC,oBAAA,EAAA;AAAA,IACE,2CACED,cAAA,CAAAE,qBAAA,EAAA;AAAA,MAAgB,SAAA,EAAW,aAAa,SAAS,CAAA;AAAA,MAAG,UAAU,EAAA,IAAA;AAAA,MAC7D,QAAC,kBAAAF,cAAA,CAAAG,0BAAA,EAAA;AAAA,QAAqB,OAAA;AAAA,QACpB,QAAC,kBAAAH,cAAA,CAAA,KAAA,EAAA;AAAA,UACC,GAAK,EAAA,WAAA;AAAA,UACL,SAAW,EAAAI,SAAA;AAAA,YACT,YAAa,EAAA;AAAA,YACb,aAAa,QAAQ,CAAA;AAAA,YACrB;AAAA,cACE,CAAC,YAAa,CAAA,gBAAgB,CAAI,GAAA,IAAA;AAAA,cAClC,CAAC,YAAA,CAAa,eAAe,CAAA,GAAI,CAAC,IAAA;AAAA,cAClC,CAAC,YAAa,CAAA,OAAO,CAAI,GAAA,OAAA;AAAA,aAC3B;AAAA,YACA,SAAA;AAAA,WACF;AAAA,UACA,gBAAgB,MAAM;AACpB,YAAI,IAAA,CAAC,QAAQ,aAAe,EAAA;AAC1B,cAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,aACxB;AAAA,WACF;AAAA,UACC,GAAG,IAAA;AAAA,UAEH,QAAA;AAAA,SACH,CAAA;AAAA,OACF,CAAA;AAAA,KACF,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ,CAAC;;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var react = require('@floating-ui/react');
|
|
6
|
+
var core = require('@salt-ds/core');
|
|
7
|
+
|
|
8
|
+
function useDrawer(props) {
|
|
9
|
+
const { open, onOpenChange } = props;
|
|
10
|
+
const { context, floating } = core.useFloatingUI({
|
|
11
|
+
open,
|
|
12
|
+
onOpenChange
|
|
13
|
+
});
|
|
14
|
+
const click = react.useClick(context);
|
|
15
|
+
const role = react.useRole(context);
|
|
16
|
+
const dismiss = react.useDismiss(context);
|
|
17
|
+
const { getFloatingProps, getReferenceProps } = react.useInteractions([
|
|
18
|
+
role,
|
|
19
|
+
dismiss,
|
|
20
|
+
click
|
|
21
|
+
]);
|
|
22
|
+
return {
|
|
23
|
+
getFloatingProps,
|
|
24
|
+
getReferenceProps,
|
|
25
|
+
floating,
|
|
26
|
+
context
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
exports.useDrawer = useDrawer;
|
|
31
|
+
//# sourceMappingURL=useDrawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDrawer.js","sources":["../src/drawer/useDrawer.ts"],"sourcesContent":["import {\n useClick,\n useDismiss,\n useInteractions,\n useRole,\n} from \"@floating-ui/react\";\nimport { useFloatingUI, UseFloatingUIProps } from \"@salt-ds/core\";\n\nexport type UseDrawerProps = Partial<\n Pick<UseFloatingUIProps, \"onOpenChange\" | \"open\">\n>;\n\nexport function useDrawer(props: UseDrawerProps) {\n const { open, onOpenChange } = props;\n\n const { context, floating } = useFloatingUI({\n open,\n onOpenChange,\n });\n\n const click = useClick(context);\n const role = useRole(context);\n const dismiss = useDismiss(context);\n\n const { getFloatingProps, getReferenceProps } = useInteractions([\n role,\n dismiss,\n click,\n ]);\n\n return {\n getFloatingProps,\n getReferenceProps,\n floating,\n context,\n };\n}\n"],"names":["useFloatingUI","useClick","useRole","useDismiss","useInteractions"],"mappings":";;;;;;;AAYO,SAAS,UAAU,KAAuB,EAAA;AAC/C,EAAM,MAAA,EAAE,IAAM,EAAA,YAAA,EAAiB,GAAA,KAAA,CAAA;AAE/B,EAAA,MAAM,EAAE,OAAA,EAAS,QAAS,EAAA,GAAIA,kBAAc,CAAA;AAAA,IAC1C,IAAA;AAAA,IACA,YAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAM,MAAA,KAAA,GAAQC,eAAS,OAAO,CAAA,CAAA;AAC9B,EAAM,MAAA,IAAA,GAAOC,cAAQ,OAAO,CAAA,CAAA;AAC5B,EAAM,MAAA,OAAA,GAAUC,iBAAW,OAAO,CAAA,CAAA;AAElC,EAAA,MAAM,EAAE,gBAAA,EAAkB,iBAAkB,EAAA,GAAIC,qBAAgB,CAAA;AAAA,IAC9D,IAAA;AAAA,IACA,OAAA;AAAA,IACA,KAAA;AAAA,GACD,CAAA,CAAA;AAED,EAAO,OAAA;AAAA,IACL,gBAAA;AAAA,IACA,iBAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".salt-density-high {\n --formFieldLegacy-label-top-marginBottom: 2px;\n}\n.salt-density-medium {\n --formFieldLegacy-label-top-marginBottom: 2px;\n}\n.salt-density-low {\n --formFieldLegacy-label-top-marginBottom: 4px;\n}\n.salt-density-touch {\n --formFieldLegacy-label-top-marginBottom: 8px;\n}\n\n/* Style applied to the root element */\n.saltFormFieldLegacy {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle);\n --formFieldLegacy-background: var(--salt-editable-primary-background);\n --formFieldLegacy-focused-outlineColor: var(--salt-focused-outlineColor);\n /* Set to 0 until helper text class provided */\n --formFieldLegacy-helperText-height: 0px;\n}\n\n.saltFormFieldLegacy-secondary.saltFormFieldLegacy {\n --formFieldLegacy-background: var(--salt-editable-secondary-background);\n}\n\n.saltFormFieldLegacy {\n border: 0;\n display: inline-grid;\n font-size: var(--saltFormFieldLegacy-fontSize, var(--salt-text-fontSize));\n margin: var(--saltFormFieldLegacy-margin, 0);\n padding: 0;\n position: relative;\n min-width: 0;\n vertical-align: top;\n width: var(--saltFormFieldLegacy-width, auto);\n}\n\n/* Class applied to the root element on hover */\n.saltFormFieldLegacy:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-hover);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-hover);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-hover);\n}\n\n/* Class applied to the root element when focused */\n.saltFormFieldLegacy-focused,\n.saltFormFieldLegacy-lowFocused,\n.saltFormFieldLegacy.saltFormFieldLegacy-focused:hover,\n.saltFormFieldLegacy.saltFormFieldLegacy-lowFocused:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-active);\n --formFieldLegacy-activationIndicator-size: var(--salt-editable-borderWidth-active);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-active);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-active);\n}\n\n/* Class applied when helper text is provided */\n.saltFormFieldLegacy-withHelperText {\n --formFieldLegacy-helperText-marginTop: var(--formFieldLegacy-helperText-marginTop-default);\n --formFieldLegacy-activationIndicator-offsetBottom: calc(var(--formFieldLegacy-helperText-marginTop) + var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height)));\n}\n\n/* Class applied if `fullWidth={true}` and helper text is provided */\n.saltFormFieldLegacy-fullWidth.saltFormFieldLegacy-withHelperText {\n --formFieldLegacy-helperText-marginTop: var(--formFieldLegacy-helperText-marginTop-fullWidth);\n --formFieldLegacy-activationIndicator-offsetBottom: calc(\n var(--formFieldLegacy-helperText-marginTop-fullWidth) + var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height))\n );\n}\n\n/* Class applied when helper text is provided */\n.saltFormFieldLegacy-withHelperText {\n --formFieldLegacy-helperText-fontSize: var(--saltFormFieldLegacy-helperText-fontSize, var(--salt-text-fontSize));\n --formFieldLegacy-helperText-baseHeight: calc(1.3 * var(--formFieldLegacy-helperText-fontSize));\n --formFieldLegacy-helperText-calculatedHeight: max(var(--salt-text-label-minHeight), var(--formFieldLegacy-helperText-baseHeight));\n --formFieldLegacy-helperText-height: calc(var(--formFieldLegacy-helperText-calculatedHeight) + var(--formFieldLegacy-helperText-marginTop));\n}\n\n/* Class applied to the root element if `fillWidth={true}` */\n.saltFormFieldLegacy-fullWidth {\n width: 100%;\n}\n\n/* Class applied to the root element if `disabled={true}` */\n.saltFormFieldLegacy-disabled {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-disabled);\n --formFieldLegacy-activationIndicator-opacity: var(--salt-palette-opacity-disabled);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-disabled);\n --formFieldLegacy-helperText-opacity: var(--salt-palette-opacity-disabled);\n\n --saltControlLabel-color: var(--salt-text-primary-foreground-disabled);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-disabled);\n}\n\n/* Class applied to the root element on hover if `disabled={true}` */\n.saltFormFieldLegacy.saltFormFieldLegacy-disabled:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-disabled);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-disabled);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-disabled);\n}\n\n/* Class applied to the root element on warning state */\n.saltFormFieldLegacy.saltFormFieldLegacy-warning {\n --formFieldLegacy-focused-outlineColor: var(--salt-status-warning-borderColor);\n --formFieldLegacy-activationIndicator-color: var(--salt-status-warning-borderColor);\n}\n\n/* Class applied to the root element on warning state on hover */\n.saltFormFieldLegacy.saltFormFieldLegacy-warning:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-status-warning-borderColor);\n}\n\n/* Class applied to the root element on error state */\n.saltFormFieldLegacy.saltFormFieldLegacy-error {\n --formFieldLegacy-focused-outlineColor: var(--salt-status-error-borderColor);\n --formFieldLegacy-activationIndicator-color: var(--salt-status-error-borderColor);\n}\n\n/* Class applied to the root element on error state on hover */\n.saltFormFieldLegacy.saltFormFieldLegacy-error:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-status-error-borderColor);\n}\n\n/* Error state styling when `variant=\"secondary\"` */\n.saltFormFieldLegacy-secondary.saltFormFieldLegacy-error {\n --formFieldLegacy-background: var(--salt-status-error-background);\n}\n\n/* Warning state styling when `variant=\"secondary\"` */\n.saltFormFieldLegacy-secondary.saltFormFieldLegacy-warning {\n --formFieldLegacy-background: var(--salt-status-warning-background);\n}\n\n/* Class applied to the root element if `labelPlacement=\"left\"` */\n.saltFormFieldLegacy-labelLeft {\n --formFieldLegacy-label-marginTop: var(--salt-size-unit);\n --formFieldLegacy-label-paddingLeft: 0px;\n --formFieldLegacy-label-paddingRight: calc(0.75 * var(--salt-size-unit));\n\n align-self: start;\n grid-template-columns: auto 1fr;\n}\n\n/* Class applied to the root element if `labelPlacement=\"top\"` or labelPlacement omitted (default is 'top') */\n.saltFormFieldLegacy-labelTop {\n --formFieldLegacy-label-marginBottom: var(--formFieldLegacy-label-top-marginBottom);\n --formFieldLegacy-label-marginTop: 0;\n --formFieldLegacy-label-paddingLeft: var(--salt-size-unit);\n --formFieldLegacy-label-paddingRight: var(--salt-size-unit);\n /* Uses density invariant value unless helper text provided */\n --formFieldLegacy-background-offset-height: calc(var(--formFieldLegacy-helperText-marginTop, 0px) + var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height)));\n\n background: linear-gradient(\n to top,\n transparent var(--formFieldLegacy-background-offset-height),\n var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background)) var(--formFieldLegacy-background-offset-height)\n );\n}\n\n/* Class applied if `labelPlacement=\"top\"` and helper text is provided */\n.saltFormFieldLegacy-labelTop.saltFormFieldLegacy-withHelperText {\n /* Uses density aware value from FormHelperText */\n --formFieldLegacy-background-offset-height: var(--formFieldLegacy-helperText-background-offset-height);\n}\n\n.saltFormFieldLegacy > * {\n grid-column-start: 1;\n grid-column-end: 2;\n grid-row-start: 2;\n grid-row-end: 3;\n}\n\n.saltFormFieldLegacy-labelLeft > * {\n grid-row-start: 1;\n grid-row-end: 2;\n}\n\n.saltFormFieldLegacy > .saltFormLabel {\n grid-row-start: 1;\n grid-row-end: 2;\n}\n\n.saltFormFieldLegacy > .saltFormActivationIndicator {\n grid-row-start: 3;\n grid-row-end: 4;\n}\n\n.saltFormFieldLegacy > .saltFormHelperText {\n grid-row-start: 4;\n grid-row-end: 5;\n}\n\n.saltFormFieldLegacy-labelLeft > .saltFormLabel ~ * {\n grid-column-start: 2;\n grid-column-end: 2;\n}\n\n/* Class applied if `readOnly={true}\"` */\n.saltFormFieldLegacy-readOnly {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-readonly);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-readonly);\n}\n\n/* Class applied to the root element if `readOnly={true}\"` on hover */\n.saltFormFieldLegacy.saltFormFieldLegacy-readOnly:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-readonly);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-readonly);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-readonly);\n}\n\n/* Class applied on focus with `labelTop={true}` and no helper text provided */\n.saltFormFieldLegacy:not(.saltFormFieldLegacy-withHelperText):not(.saltFormFieldLegacy-labelLeft).saltFormFieldLegacy-focused:before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height, 0px));\n outline-color: var(--formFieldLegacy-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n}\n\n/* Class applied on focus with `labelTop={true}` and helper text provided */\n.saltFormFieldLegacy-withHelperText:not(.saltFormFieldLegacy-labelLeft).saltFormFieldLegacy-focused:before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: var(--formFieldLegacy-helperText-height, 0px);\n outline-color: var(--formFieldLegacy-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused:before {\n content: none;\n}\n\n/* Class applied on focus with `labelLeft={true}` */\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused > *:before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0px;\n outline-color: var(--formFieldLegacy-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n z-index: -1;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused > :is(.saltFormActivationIndicator, .saltFormHelperText, .saltFormLabel):before {\n content: none;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused {\n outline: none;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused > :is(.saltFormFieldLegacy-activationIndicator, .saltFormFieldLegacy-helperText, .saltFormLabel):before {\n content: none;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused .saltFormLabel + * {\n outline: none;\n}\n\n.saltFormFieldLegacy-tertiary.saltFormFieldLegacy.saltFormFieldLegacy-labelLeft > .saltFormLabel ~ * {\n background: var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background));\n}\n\n/* TODO: I don't think this is needed, but commenting until work on FF done\n.saltFormFieldLegacy-primary.saltFormFieldLegacy > :not(.saltFormLabel):first-child {\n background: var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background));\n} */\n\n.saltFormFieldLegacy-labelLeft > .saltFormLabel ~ :not(.saltFormHelperText) {\n background: var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background));\n}\n\n/* **Deprecated:** Tertiary variant no longer supported */\n.saltFormFieldLegacy-tertiary.saltFormFieldLegacy {\n --formFieldLegacy-background: var(--salt-editable-tertiary-background);\n}\n";
|
|
3
|
+
var css_248z = ".salt-density-high {\n --formFieldLegacy-label-top-marginBottom: 2px;\n}\n.salt-density-medium {\n --formFieldLegacy-label-top-marginBottom: 2px;\n}\n.salt-density-low {\n --formFieldLegacy-label-top-marginBottom: 4px;\n}\n.salt-density-touch {\n --formFieldLegacy-label-top-marginBottom: 8px;\n}\n\n/* Style applied to the root element */\n.saltFormFieldLegacy {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle);\n --formFieldLegacy-background: var(--salt-editable-primary-background);\n --formFieldLegacy-focused-outlineColor: var(--salt-focused-outlineColor);\n /* Set to 0 until helper text class provided */\n --formFieldLegacy-helperText-height: 0px;\n}\n\n.saltFormFieldLegacy-secondary.saltFormFieldLegacy {\n --formFieldLegacy-background: var(--salt-editable-secondary-background);\n}\n\n.saltFormFieldLegacy {\n border: 0;\n display: inline-grid;\n font-size: var(--saltFormFieldLegacy-fontSize, var(--salt-text-fontSize));\n margin: var(--saltFormFieldLegacy-margin, 0);\n padding: 0;\n position: relative;\n min-width: 0;\n vertical-align: top;\n width: var(--saltFormFieldLegacy-width, auto);\n}\n\n/* Class applied to the root element on hover */\n.saltFormFieldLegacy:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-hover);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-hover);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-hover);\n}\n\n/* Class applied to the root element when focused */\n.saltFormFieldLegacy-focused,\n.saltFormFieldLegacy-lowFocused,\n.saltFormFieldLegacy.saltFormFieldLegacy-focused:hover,\n.saltFormFieldLegacy.saltFormFieldLegacy-lowFocused:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-active);\n --formFieldLegacy-activationIndicator-size: var(--salt-editable-borderWidth-active);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-active);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-active);\n}\n\n/* Class applied when helper text is provided */\n.saltFormFieldLegacy-withHelperText {\n --formFieldLegacy-helperText-marginTop: var(--formFieldLegacy-helperText-marginTop-default);\n --formFieldLegacy-activationIndicator-offsetBottom: calc(var(--formFieldLegacy-helperText-marginTop) + var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height)));\n}\n\n/* Class applied if `fullWidth={true}` and helper text is provided */\n.saltFormFieldLegacy-fullWidth.saltFormFieldLegacy-withHelperText {\n --formFieldLegacy-helperText-marginTop: var(--formFieldLegacy-helperText-marginTop-fullWidth);\n --formFieldLegacy-activationIndicator-offsetBottom: calc(\n var(--formFieldLegacy-helperText-marginTop-fullWidth) + var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height))\n );\n}\n\n/* Class applied when helper text is provided */\n.saltFormFieldLegacy-withHelperText {\n --formFieldLegacy-helperText-fontSize: var(--saltFormFieldLegacy-helperText-fontSize, var(--salt-text-fontSize));\n --formFieldLegacy-helperText-baseHeight: calc(1.3 * var(--formFieldLegacy-helperText-fontSize));\n --formFieldLegacy-helperText-calculatedHeight: max(var(--salt-text-label-minHeight), var(--formFieldLegacy-helperText-baseHeight));\n --formFieldLegacy-helperText-height: calc(var(--formFieldLegacy-helperText-calculatedHeight) + var(--formFieldLegacy-helperText-marginTop));\n}\n\n/* Class applied to the root element if `fillWidth={true}` */\n.saltFormFieldLegacy-fullWidth {\n width: 100%;\n}\n\n/* Class applied to the root element if `disabled={true}` */\n.saltFormFieldLegacy-disabled {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-disabled);\n --formFieldLegacy-activationIndicator-opacity: var(--salt-palette-opacity-disabled);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-disabled);\n --formFieldLegacy-helperText-opacity: var(--salt-palette-opacity-disabled);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-disabled);\n}\n\n/* Class applied to the root element on hover if `disabled={true}` */\n.saltFormFieldLegacy.saltFormFieldLegacy-disabled:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-disabled);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-disabled);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-disabled);\n}\n\n/* Class applied to the root element on warning state */\n.saltFormFieldLegacy.saltFormFieldLegacy-warning {\n --formFieldLegacy-focused-outlineColor: var(--salt-status-warning-borderColor);\n --formFieldLegacy-activationIndicator-color: var(--salt-status-warning-borderColor);\n}\n\n/* Class applied to the root element on warning state on hover */\n.saltFormFieldLegacy.saltFormFieldLegacy-warning:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-status-warning-borderColor);\n}\n\n/* Class applied to the root element on error state */\n.saltFormFieldLegacy.saltFormFieldLegacy-error {\n --formFieldLegacy-focused-outlineColor: var(--salt-status-error-borderColor);\n --formFieldLegacy-activationIndicator-color: var(--salt-status-error-borderColor);\n}\n\n/* Class applied to the root element on error state on hover */\n.saltFormFieldLegacy.saltFormFieldLegacy-error:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-status-error-borderColor);\n}\n\n/* Error state styling when `variant=\"secondary\"` */\n.saltFormFieldLegacy-secondary.saltFormFieldLegacy-error {\n --formFieldLegacy-background: var(--salt-status-error-background);\n}\n\n/* Warning state styling when `variant=\"secondary\"` */\n.saltFormFieldLegacy-secondary.saltFormFieldLegacy-warning {\n --formFieldLegacy-background: var(--salt-status-warning-background);\n}\n\n/* Class applied to the root element if `labelPlacement=\"left\"` */\n.saltFormFieldLegacy-labelLeft {\n --formFieldLegacy-label-marginTop: var(--salt-size-unit);\n --formFieldLegacy-label-paddingLeft: 0px;\n --formFieldLegacy-label-paddingRight: calc(0.75 * var(--salt-size-unit));\n\n align-self: start;\n grid-template-columns: auto 1fr;\n}\n\n/* Class applied to the root element if `labelPlacement=\"top\"` or labelPlacement omitted (default is 'top') */\n.saltFormFieldLegacy-labelTop {\n --formFieldLegacy-label-marginBottom: var(--formFieldLegacy-label-top-marginBottom);\n --formFieldLegacy-label-marginTop: 0;\n --formFieldLegacy-label-paddingLeft: var(--salt-size-unit);\n --formFieldLegacy-label-paddingRight: var(--salt-size-unit);\n /* Uses density invariant value unless helper text provided */\n --formFieldLegacy-background-offset-height: calc(var(--formFieldLegacy-helperText-marginTop, 0px) + var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height)));\n\n background: linear-gradient(\n to top,\n transparent var(--formFieldLegacy-background-offset-height),\n var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background)) var(--formFieldLegacy-background-offset-height)\n );\n}\n\n/* Class applied if `labelPlacement=\"top\"` and helper text is provided */\n.saltFormFieldLegacy-labelTop.saltFormFieldLegacy-withHelperText {\n /* Uses density aware value from FormHelperText */\n --formFieldLegacy-background-offset-height: var(--formFieldLegacy-helperText-background-offset-height);\n}\n\n.saltFormFieldLegacy > * {\n grid-column-start: 1;\n grid-column-end: 2;\n grid-row-start: 2;\n grid-row-end: 3;\n}\n\n.saltFormFieldLegacy-labelLeft > * {\n grid-row-start: 1;\n grid-row-end: 2;\n}\n\n.saltFormFieldLegacy > .saltFormLabel {\n grid-row-start: 1;\n grid-row-end: 2;\n}\n\n.saltFormFieldLegacy > .saltFormActivationIndicator {\n grid-row-start: 3;\n grid-row-end: 4;\n}\n\n.saltFormFieldLegacy > .saltFormHelperText {\n grid-row-start: 4;\n grid-row-end: 5;\n}\n\n.saltFormFieldLegacy-labelLeft > .saltFormLabel ~ * {\n grid-column-start: 2;\n grid-column-end: 2;\n}\n\n/* Class applied if `readOnly={true}\"` */\n.saltFormFieldLegacy-readOnly {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-readonly);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-readonly);\n}\n\n/* Class applied to the root element if `readOnly={true}\"` on hover */\n.saltFormFieldLegacy.saltFormFieldLegacy-readOnly:hover {\n --formFieldLegacy-activationIndicator-color: var(--salt-editable-borderColor-readonly);\n --formFieldLegacy-activationIndicator-size: var(--salt-size-border);\n --formFieldLegacy-activationIndicator-style: var(--salt-editable-borderStyle-readonly);\n\n --saltInputLegacy-cursor: var(--salt-editable-cursor-readonly);\n}\n\n/* Class applied on focus with `labelTop={true}` and no helper text provided */\n.saltFormFieldLegacy:not(.saltFormFieldLegacy-withHelperText):not(.saltFormFieldLegacy-labelLeft).saltFormFieldLegacy-focused:before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: var(--saltFormFieldLegacy-helperText-lineHeight, var(--formFieldLegacy-helperText-height, 0px));\n outline-color: var(--formFieldLegacy-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n}\n\n/* Class applied on focus with `labelTop={true}` and helper text provided */\n.saltFormFieldLegacy-withHelperText:not(.saltFormFieldLegacy-labelLeft).saltFormFieldLegacy-focused:before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: var(--formFieldLegacy-helperText-height, 0px);\n outline-color: var(--formFieldLegacy-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused:before {\n content: none;\n}\n\n/* Class applied on focus with `labelLeft={true}` */\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused > *:before {\n content: \" \";\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0px;\n outline-color: var(--formFieldLegacy-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n z-index: -1;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused > :is(.saltFormActivationIndicator, .saltFormHelperText, .saltFormLabel):before {\n content: none;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused {\n outline: none;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused > :is(.saltFormFieldLegacy-activationIndicator, .saltFormFieldLegacy-helperText, .saltFormLabel):before {\n content: none;\n}\n\n.saltFormFieldLegacy-labelLeft.saltFormFieldLegacy-focused .saltFormLabel + * {\n outline: none;\n}\n\n.saltFormFieldLegacy-tertiary.saltFormFieldLegacy.saltFormFieldLegacy-labelLeft > .saltFormLabel ~ * {\n background: var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background));\n}\n\n/* TODO: I don't think this is needed, but commenting until work on FF done\n.saltFormFieldLegacy-primary.saltFormFieldLegacy > :not(.saltFormLabel):first-child {\n background: var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background));\n} */\n\n.saltFormFieldLegacy-labelLeft > .saltFormLabel ~ :not(.saltFormHelperText) {\n background: var(--saltFormFieldLegacy-background, var(--formFieldLegacy-background));\n}\n\n/* **Deprecated:** Tertiary variant no longer supported */\n.saltFormFieldLegacy-tertiary.saltFormFieldLegacy {\n --formFieldLegacy-background: var(--salt-editable-tertiary-background);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=FormFieldLegacy.css.js.map
|
package/dist-cjs/index.js
CHANGED
|
@@ -59,7 +59,6 @@ var ContactTertiaryInfo = require('./contact-details/ContactTertiaryInfo.js');
|
|
|
59
59
|
var ContactFavoriteToggle = require('./contact-details/ContactFavoriteToggle.js');
|
|
60
60
|
var MailLinkComponent = require('./contact-details/MailLinkComponent.js');
|
|
61
61
|
var ContentStatus = require('./content-status/ContentStatus.js');
|
|
62
|
-
var ControlLabel = require('./control-label/ControlLabel.js');
|
|
63
62
|
var DeckItem = require('./deck-item/DeckItem.js');
|
|
64
63
|
var DeckLayout = require('./deck-layout/DeckLayout.js');
|
|
65
64
|
var DialogActions = require('./dialog/DialogActions.js');
|
|
@@ -67,6 +66,7 @@ var DialogContent = require('./dialog/DialogContent.js');
|
|
|
67
66
|
var DialogTitle = require('./dialog/DialogTitle.js');
|
|
68
67
|
var Dialog = require('./dialog/Dialog.js');
|
|
69
68
|
var Drawer = require('./drawer/Drawer.js');
|
|
69
|
+
var useDrawer = require('./drawer/useDrawer.js');
|
|
70
70
|
var DropdownBase = require('./dropdown/DropdownBase.js');
|
|
71
71
|
var DropdownButton = require('./dropdown/DropdownButton.js');
|
|
72
72
|
var Dropdown = require('./dropdown/Dropdown.js');
|
|
@@ -99,7 +99,6 @@ var MenuButton = require('./menu-button/MenuButton.js');
|
|
|
99
99
|
var Metric = require('./metric/Metric.js');
|
|
100
100
|
var MetricHeader = require('./metric/MetricHeader.js');
|
|
101
101
|
var MetricContent = require('./metric/MetricContent.js');
|
|
102
|
-
var MultilineInput = require('./multiline-input/MultilineInput.js');
|
|
103
102
|
var NavItem = require('./nav-item/NavItem.js');
|
|
104
103
|
var Overlay = require('./overlay/Overlay.js');
|
|
105
104
|
var useOverlay = require('./overlay/useOverlay.js');
|
|
@@ -135,7 +134,6 @@ var SkipLinks = require('./skip-link/SkipLinks.js');
|
|
|
135
134
|
var Slider = require('./slider/Slider.js');
|
|
136
135
|
var SteppedTracker = require('./stepped-tracker/SteppedTracker.js');
|
|
137
136
|
var TrackerStep = require('./stepped-tracker/TrackerStep/TrackerStep.js');
|
|
138
|
-
var TrackerStepTooltipContext = require('./stepped-tracker/TrackerStep/TrackerStepTooltipContext.js');
|
|
139
137
|
var StepLabel = require('./stepped-tracker/StepLabel/StepLabel.js');
|
|
140
138
|
var useStepperInput = require('./stepper-input/useStepperInput.js');
|
|
141
139
|
var StepperInput = require('./stepper-input/StepperInput.js');
|
|
@@ -147,6 +145,7 @@ var TabPanel = require('./tabs/TabPanel.js');
|
|
|
147
145
|
var Tabs = require('./tabs/Tabs.js');
|
|
148
146
|
var TabNext = require('./tabs-next/TabNext.js');
|
|
149
147
|
var TabstripNext = require('./tabs-next/TabstripNext.js');
|
|
148
|
+
var ToastGroup = require('./toast-group/ToastGroup.js');
|
|
150
149
|
var TokenizedInput = require('./tokenized-input/TokenizedInput.js');
|
|
151
150
|
var TokenizedInputBase = require('./tokenized-input/TokenizedInputBase.js');
|
|
152
151
|
var useTokenizedInput = require('./tokenized-input/useTokenizedInput.js');
|
|
@@ -219,8 +218,6 @@ exports.ContactTertiaryInfo = ContactTertiaryInfo.ContactTertiaryInfo;
|
|
|
219
218
|
exports.ContactFavoriteToggle = ContactFavoriteToggle.ContactFavoriteToggle;
|
|
220
219
|
exports.MailLinkComponent = MailLinkComponent.MailLinkComponent;
|
|
221
220
|
exports.ContentStatus = ContentStatus.ContentStatus;
|
|
222
|
-
exports.ControlLabel = ControlLabel.ControlLabel;
|
|
223
|
-
exports.baseName = ControlLabel.baseName;
|
|
224
221
|
exports.DeckItem = DeckItem.DeckItem;
|
|
225
222
|
exports.DeckLayout = DeckLayout.DeckLayout;
|
|
226
223
|
exports.DialogActions = DialogActions.DialogActions;
|
|
@@ -229,6 +226,7 @@ exports.DialogTitle = DialogTitle.DialogTitle;
|
|
|
229
226
|
exports.Dialog = Dialog.Dialog;
|
|
230
227
|
exports.DRAWER_POSITIONS = Drawer.DRAWER_POSITIONS;
|
|
231
228
|
exports.Drawer = Drawer.Drawer;
|
|
229
|
+
exports.useDrawer = useDrawer.useDrawer;
|
|
232
230
|
exports.DropdownBase = DropdownBase.DropdownBase;
|
|
233
231
|
exports.DropdownButton = DropdownButton.DropdownButton;
|
|
234
232
|
exports.Dropdown = Dropdown.Dropdown;
|
|
@@ -264,7 +262,6 @@ exports.MenuButton = MenuButton.MenuButton;
|
|
|
264
262
|
exports.Metric = Metric.Metric;
|
|
265
263
|
exports.MetricHeader = MetricHeader.MetricHeader;
|
|
266
264
|
exports.MetricContent = MetricContent.MetricContent;
|
|
267
|
-
exports.MultilineInput = MultilineInput.MultilineInput;
|
|
268
265
|
exports.NavItem = NavItem.NavItem;
|
|
269
266
|
exports.Overlay = Overlay.Overlay;
|
|
270
267
|
exports.useOverlay = useOverlay.useOverlay;
|
|
@@ -325,7 +322,6 @@ exports.SkipLinks = SkipLinks.SkipLinks;
|
|
|
325
322
|
exports.Slider = Slider.Slider;
|
|
326
323
|
exports.SteppedTracker = SteppedTracker.SteppedTracker;
|
|
327
324
|
exports.TrackerStep = TrackerStep.TrackerStep;
|
|
328
|
-
exports.useTrackerStepTooltipContext = TrackerStepTooltipContext.useTrackerStepTooltipContext;
|
|
329
325
|
exports.StepLabel = StepLabel.StepLabel;
|
|
330
326
|
exports.useStepperInput = useStepperInput.useStepperInput;
|
|
331
327
|
exports.StepperInput = StepperInput.StepperInput;
|
|
@@ -337,6 +333,7 @@ exports.TabPanel = TabPanel.TabPanel;
|
|
|
337
333
|
exports.Tabs = Tabs.Tabs;
|
|
338
334
|
exports.TabNext = TabNext.TabNext;
|
|
339
335
|
exports.TabstripNext = TabstripNext.TabstripNext;
|
|
336
|
+
exports.ToastGroup = ToastGroup.ToastGroup;
|
|
340
337
|
exports.TokenizedInput = TokenizedInput.TokenizedInput;
|
|
341
338
|
exports.TokenizedInputBase = TokenizedInputBase.TokenizedInputBase;
|
|
342
339
|
exports.useTokenizedInput = useTokenizedInput.useTokenizedInput;
|
package/dist-cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/* Default variables applied to the root element */\n.saltListItemNext {\n --listNext-item-text-color: var(--salt-text-primary-foreground);\n --listNext-item-background: none;\n}\n\n.saltListItemNext {\n color: var(--listNext-item-text-color);\n background: var(--listNext-item-background);\n height: calc(var(--salt-size-base) + var(--salt-spacing-100));\n padding-inline: var(--salt-spacing-100);\n display: flex;\n gap: var(--salt-size-unit);\n position: relative;\n align-items: center;\n white-space: nowrap;\n margin-block: var(--salt-size-border);\n border: var(--salt-focused-outlineWidth) var(--salt-focused-outlineStyle) transparent;\n}\n\n/* Class applied to list item on focus using keyboard navigation only */\n.saltListItemNext-focused {\n border: var(--salt-focused-outline);\n}\n\n/* Active list item on
|
|
3
|
+
var css_248z = "/* Default variables applied to the root element */\n.saltListItemNext {\n --listNext-item-text-color: var(--salt-text-primary-foreground);\n --listNext-item-background: none;\n}\n\n.saltListItemNext {\n color: var(--listNext-item-text-color);\n background: var(--listNext-item-background);\n height: calc(var(--salt-size-base) + var(--salt-spacing-100));\n padding-inline: var(--salt-spacing-100);\n display: flex;\n gap: var(--salt-size-unit);\n position: relative;\n align-items: center;\n white-space: nowrap;\n margin-block: var(--salt-size-border);\n border: var(--salt-focused-outlineWidth) var(--salt-focused-outlineStyle) transparent;\n}\n\n/* Class applied to list item on focus using keyboard navigation only */\n.saltListItemNext-focused {\n border: var(--salt-focused-outline);\n}\n\n/* Active list item on focus using keyboard navigation */\n.saltListItemNext-highlighted:not([aria-disabled=\"true\"]) {\n --listNext-item-background: var(--salt-selectable-background-hover);\n cursor: var(--salt-selectable-cursor-hover);\n}\n\n.saltListItemNext[aria-selected=\"true\"] {\n outline: var(--salt-size-border) var(--salt-container-borderStyle) var(--salt-selectable-borderColor-selected);\n --listNext-item-background: var(--salt-selectable-background-selected);\n --saltIcon-color: var(--salt-selectable-foreground-selected);\n}\n\n/* Style applied to disabled items */\n.saltListItemNext[aria-disabled=\"true\"] {\n --listNext-item-text-color: var(--salt-text-primary-foreground-disabled);\n cursor: var(--salt-selectable-cursor-disabled);\n}\n.saltListItemNext[aria-disabled=\"true\"] .saltText {\n color: var(--listNext-item-text-color);\n}\n\n/* disabled list item when selected */\n.saltListItemNext[aria-disabled=\"true\"][aria-selected=\"true\"] {\n outline: var(--salt-size-border) var(--salt-container-borderStyle) var(--salt-selectable-borderColor-selectedDisabled);\n --listNext-item-background: var(--salt-selectable-background-selectedDisabled);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=ListItemNext.css.js.map
|
|
@@ -17,7 +17,6 @@ const ListItemNext = React.forwardRef(
|
|
|
17
17
|
children,
|
|
18
18
|
className,
|
|
19
19
|
disabled: disabledProp,
|
|
20
|
-
selected: selectedProp,
|
|
21
20
|
id: idProp,
|
|
22
21
|
value,
|
|
23
22
|
onClick,
|
|
@@ -38,15 +37,25 @@ const ListItemNext = React.forwardRef(
|
|
|
38
37
|
disabled: contextDisabled,
|
|
39
38
|
select,
|
|
40
39
|
isSelected,
|
|
41
|
-
isFocused
|
|
40
|
+
isFocused,
|
|
41
|
+
highlight,
|
|
42
|
+
isHighlighted
|
|
42
43
|
} = listContext;
|
|
43
44
|
const itemId = `${contextId || "listNext"}--${id}`;
|
|
44
45
|
const disabled = disabledProp || contextDisabled;
|
|
45
|
-
const selected =
|
|
46
|
-
const focused = isFocused(
|
|
46
|
+
const selected = isSelected(value);
|
|
47
|
+
const focused = isFocused(value);
|
|
48
|
+
const highlighted = isHighlighted(value);
|
|
47
49
|
const handleClick = (event) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
if (!disabled) {
|
|
51
|
+
select(event);
|
|
52
|
+
onClick == null ? void 0 : onClick(event);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const handleMouseMove = (event) => {
|
|
56
|
+
if (!highlighted) {
|
|
57
|
+
highlight(event);
|
|
58
|
+
}
|
|
50
59
|
};
|
|
51
60
|
return /* @__PURE__ */ jsxRuntime.jsx("li", {
|
|
52
61
|
ref,
|
|
@@ -54,6 +63,7 @@ const ListItemNext = React.forwardRef(
|
|
|
54
63
|
withBaseName(),
|
|
55
64
|
{
|
|
56
65
|
[withBaseName("disabled")]: disabled,
|
|
66
|
+
[withBaseName("highlighted")]: highlighted,
|
|
57
67
|
[withBaseName("focused")]: focused
|
|
58
68
|
},
|
|
59
69
|
className
|
|
@@ -64,6 +74,7 @@ const ListItemNext = React.forwardRef(
|
|
|
64
74
|
id: itemId,
|
|
65
75
|
"data-value": value,
|
|
66
76
|
onClick: handleClick,
|
|
77
|
+
onMouseMove: handleMouseMove,
|
|
67
78
|
...props,
|
|
68
79
|
children
|
|
69
80
|
});
|