@salt-ds/core 1.63.0 → 1.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/css/salt-core.css +11 -5
- package/dist-cjs/banner/Banner.js +8 -1
- package/dist-cjs/banner/Banner.js.map +1 -1
- package/dist-cjs/drawer/Drawer.js +3 -1
- package/dist-cjs/drawer/Drawer.js.map +1 -1
- package/dist-cjs/file-drop-zone/FileDropZoneTrigger.js.map +1 -1
- package/dist-cjs/link/Link.css.js +1 -1
- package/dist-cjs/pagination/PageButton.css.js +1 -1
- package/dist-cjs/salt-provider/ThemeApplicator.js +1 -1
- package/dist-cjs/salt-provider/ThemeApplicator.js.map +1 -1
- package/dist-es/banner/Banner.js +8 -1
- package/dist-es/banner/Banner.js.map +1 -1
- package/dist-es/drawer/Drawer.js +3 -1
- package/dist-es/drawer/Drawer.js.map +1 -1
- package/dist-es/file-drop-zone/FileDropZoneTrigger.js.map +1 -1
- package/dist-es/link/Link.css.js +1 -1
- package/dist-es/pagination/PageButton.css.js +1 -1
- package/dist-es/salt-provider/ThemeApplicator.js +1 -1
- package/dist-es/salt-provider/ThemeApplicator.js.map +1 -1
- package/dist-types/drawer/Drawer.d.ts +6 -0
- package/dist-types/file-drop-zone/FileDropZoneTrigger.d.ts +14 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @salt-ds/core
|
|
2
2
|
|
|
3
|
+
## 1.64.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1a48c1a: Fixed Pagination page button focus outline being covered by a sibling button's hover state.
|
|
8
|
+
|
|
9
|
+
## 1.64.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 52daa64: Added an `initialFocus` prop to `Drawer` to allow customizing which element receives focus when the drawer opens.
|
|
14
|
+
- ed2779c: Added `appearance` and `sentiment` props to `FileDropZoneTrigger`. `sentiment` accepts `'accented' | 'neutral'` (defaults to `'neutral'`) and `appearance` accepts `'solid' | 'bordered' | 'transparent'` (defaults to `'solid'`).
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
<FileDropZoneTrigger appearance="bordered" sentiment="accented" />
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Also widened the props type so all native `<button>` attributes (e.g. `type`, `name`, `form`, `value`) are now accepted.
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 9729a10: Fixed the status indicator in Banner being visible to screen readers.
|
|
25
|
+
- 07e4d5d: Fixed an issue where the visually hidden "Opens in a new tab" text on `Link` (when `target="_blank"`) was included when users selected and copied the link's contents.
|
|
26
|
+
|
|
3
27
|
## 1.63.0
|
|
4
28
|
|
|
5
29
|
### Minor Changes
|
package/css/salt-core.css
CHANGED
|
@@ -2104,14 +2104,18 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
2104
2104
|
text-decoration: var(--link-textDecoration-focus);
|
|
2105
2105
|
}
|
|
2106
2106
|
.saltLink-externalLinkADA {
|
|
2107
|
-
display: block;
|
|
2108
2107
|
position: absolute;
|
|
2109
2108
|
width: 1px;
|
|
2110
2109
|
height: 1px;
|
|
2110
|
+
padding: 0;
|
|
2111
|
+
margin: -1px;
|
|
2111
2112
|
overflow: hidden;
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2113
|
+
clip: rect(0, 0, 0, 0);
|
|
2114
|
+
clip-path: inset(50%);
|
|
2115
|
+
white-space: nowrap;
|
|
2116
|
+
border: 0;
|
|
2117
|
+
user-select: none;
|
|
2118
|
+
-webkit-user-select: none;
|
|
2115
2119
|
}
|
|
2116
2120
|
|
|
2117
2121
|
/* src/link-card/LinkCard.css */
|
|
@@ -3105,6 +3109,8 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
3105
3109
|
}
|
|
3106
3110
|
.saltPageButton:focus-visible {
|
|
3107
3111
|
outline: var(--salt-focused-outline);
|
|
3112
|
+
position: relative;
|
|
3113
|
+
z-index: var(--salt-zIndex-default);
|
|
3108
3114
|
}
|
|
3109
3115
|
.saltPageButton:disabled {
|
|
3110
3116
|
color: var(--salt-content-secondary-foreground);
|
|
@@ -6488,4 +6494,4 @@ label.saltText small,
|
|
|
6488
6494
|
box-shadow: 0 calc(var(--salt-size-fixed-100) * -1) 0 0 var(--salt-selectable-borderColor-selected), 0 var(--salt-size-fixed-100) 0 0 var(--salt-selectable-borderColor-selected);
|
|
6489
6495
|
}
|
|
6490
6496
|
|
|
6491
|
-
/* src/
|
|
6497
|
+
/* src/8da7d430-1995-4d8c-8a61-22f6edca92c1.css */
|
|
@@ -33,7 +33,14 @@ const Banner = React.forwardRef(function Banner2({ children, className, variant
|
|
|
33
33
|
ref,
|
|
34
34
|
...rest,
|
|
35
35
|
children: [
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
+
StatusIndicator.StatusIndicator,
|
|
38
|
+
{
|
|
39
|
+
"aria-hidden": true,
|
|
40
|
+
status,
|
|
41
|
+
className: withBaseName("icon")
|
|
42
|
+
}
|
|
43
|
+
),
|
|
37
44
|
children
|
|
38
45
|
]
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sources":["../src/banner/Banner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { StatusIndicator, type ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer } from \"../utils\";\n\nimport bannerCss from \"./Banner.css\";\n\nexport interface BannerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Emphasize the styling by applying a background color: defaults to false\n */\n variant?: \"primary\" | \"secondary\";\n /**\n * A string to determine the current state of the Banner\n */\n status?: ValidationStatus;\n}\n\nconst withBaseName = makePrefixer(\"saltBanner\");\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { children, className, variant = \"primary\", status = \"info\", ...rest },\n ref,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-banner\",\n css: bannerCss,\n window: targetWindow,\n });\n\n return (\n <div\n className={clsx(\n withBaseName(),\n withBaseName(status),\n withBaseName(variant),\n className,\n )}\n ref={ref}\n {...rest}\n >\n <StatusIndicator
|
|
1
|
+
{"version":3,"file":"Banner.js","sources":["../src/banner/Banner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { StatusIndicator, type ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer } from \"../utils\";\n\nimport bannerCss from \"./Banner.css\";\n\nexport interface BannerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Emphasize the styling by applying a background color: defaults to false\n */\n variant?: \"primary\" | \"secondary\";\n /**\n * A string to determine the current state of the Banner\n */\n status?: ValidationStatus;\n}\n\nconst withBaseName = makePrefixer(\"saltBanner\");\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { children, className, variant = \"primary\", status = \"info\", ...rest },\n ref,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-banner\",\n css: bannerCss,\n window: targetWindow,\n });\n\n return (\n <div\n className={clsx(\n withBaseName(),\n withBaseName(status),\n withBaseName(variant),\n className,\n )}\n ref={ref}\n {...rest}\n >\n <StatusIndicator\n aria-hidden\n status={status}\n className={withBaseName(\"icon\")}\n />\n {children}\n </div>\n );\n});\n"],"names":["makePrefixer","forwardRef","Banner","useWindow","useComponentCssInjection","bannerCss","jsxs","clsx","jsx","StatusIndicator"],"mappings":";;;;;;;;;;;;;;;AAoBA,MAAM,YAAA,GAAeA,0BAAa,YAAY,CAAA;AAEvC,MAAM,MAAA,GAASC,gBAAA,CAAwC,SAASC,OAAAA,CACrE,EAAE,QAAA,EAAU,SAAA,EAAW,OAAA,GAAU,SAAA,EAAW,MAAA,GAAS,MAAA,EAAQ,GAAG,IAAA,IAChE,GAAA,EACA;AACA,EAAA,MAAM,eAAeC,gBAAA,EAAU;AAC/B,EAAAC,+BAAA,CAAyB;AAAA,IACvB,MAAA,EAAQ,aAAA;AAAA,IACR,GAAA,EAAKC,QAAA;AAAA,IACL,MAAA,EAAQ;AAAA,GACT,CAAA;AAED,EAAA,uBACEC,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAWC,SAAA;AAAA,QACT,YAAA,EAAa;AAAA,QACb,aAAa,MAAM,CAAA;AAAA,QACnB,aAAa,OAAO,CAAA;AAAA,QACpB;AAAA,OACF;AAAA,MACA,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAAC,cAAA;AAAA,UAACC,+BAAA;AAAA,UAAA;AAAA,YACC,aAAA,EAAW,IAAA;AAAA,YACX,MAAA;AAAA,YACA,SAAA,EAAW,aAAa,MAAM;AAAA;AAAA,SAChC;AAAA,QACC;AAAA;AAAA;AAAA,GACH;AAEJ,CAAC;;;;"}
|
|
@@ -41,6 +41,7 @@ const Drawer = React.forwardRef(
|
|
|
41
41
|
variant = "primary",
|
|
42
42
|
disableDismiss,
|
|
43
43
|
disableScrim,
|
|
44
|
+
initialFocus,
|
|
44
45
|
...rest
|
|
45
46
|
} = props;
|
|
46
47
|
const targetWindow = window.useWindow();
|
|
@@ -81,7 +82,8 @@ const Drawer = React.forwardRef(
|
|
|
81
82
|
height: (_b = elements.floating) == null ? void 0 : _b.offsetHeight,
|
|
82
83
|
"aria-modal": "true",
|
|
83
84
|
focusManagerProps: {
|
|
84
|
-
context
|
|
85
|
+
context,
|
|
86
|
+
initialFocus
|
|
85
87
|
},
|
|
86
88
|
className: clsx.clsx(
|
|
87
89
|
withBaseName(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import { useClick
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import {\n type FloatingFocusManager,\n useClick,\n useDismiss,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type PropsWithChildren,\n useEffect,\n useState,\n} from \"react\";\nimport { Scrim } from \"../scrim\";\nimport {\n makePrefixer,\n useFloatingComponent,\n useFloatingUI,\n useForkRef,\n} from \"../utils\";\nimport drawerCss from \"./Drawer.css\";\n\ninterface ConditionalScrimWrapperProps extends PropsWithChildren {\n condition: boolean;\n}\n\nconst ConditionalScrimWrapper = ({\n condition,\n children,\n}: ConditionalScrimWrapperProps) => {\n return condition ? <Scrim fixed> {children} </Scrim> : <>{children} </>;\n};\n\nexport interface DrawerProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Defines the drawer position within the screen. Defaults to `left`.\n */\n position?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (newOpen: boolean) => void;\n /**\n * Change background color palette\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\";\n /**\n * Prevent the dialog closing on click away\n * */\n disableDismiss?: boolean;\n /**\n * Prevent Scrim from rendering\n * */\n disableScrim?: boolean;\n /**\n * Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.\n * Default value is 0 (first tabbable element).\n * */\n initialFocus?: ComponentPropsWithoutRef<\n typeof FloatingFocusManager\n >[\"initialFocus\"];\n}\n\nconst withBaseName = makePrefixer(\"saltDrawer\");\n\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(\n function Drawer(props, ref) {\n const {\n children,\n className,\n position = \"left\",\n open = false,\n onOpenChange,\n variant = \"primary\",\n disableDismiss,\n disableScrim,\n initialFocus,\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 const { Component: FloatingComponent } = useFloatingComponent();\n\n const { context, floating, elements } = useFloatingUI({\n open: showComponent,\n onOpenChange,\n });\n\n const { getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context, { enabled: !disableDismiss }),\n ]);\n\n const handleRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n\n if (!open && showComponent) {\n const animate = setTimeout(() => {\n setShowComponent(false);\n }, 300); // var(--salt-duration-perceptible)\n return () => clearTimeout(animate);\n }\n }, [open, showComponent]);\n\n return (\n <ConditionalScrimWrapper condition={showComponent && !disableScrim}>\n <FloatingComponent\n open={showComponent}\n ref={handleRef}\n role={\"dialog\"}\n width={elements.floating?.offsetWidth}\n height={elements.floating?.offsetHeight}\n aria-modal=\"true\"\n focusManagerProps={{\n context: context,\n initialFocus,\n }}\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 {...getFloatingProps()}\n {...rest}\n >\n {children}\n </FloatingComponent>\n </ConditionalScrimWrapper>\n );\n },\n);\n"],"names":["jsxs","Scrim","Fragment","makePrefixer","forwardRef","Drawer","useWindow","useComponentCssInjection","drawerCss","useState","useFloatingComponent","useFloatingUI","useInteractions","useClick","useDismiss","useForkRef","useEffect","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;;;AA6BA,MAAM,0BAA0B,CAAC;AAAA,EAC/B,SAAA;AAAA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rB;AAAA,YACE,CAAC,YAAA,CAAa,gBAAgB,CAAC,GAAG,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,eAAe,CAAC,GAAG,CAAC,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,OAAO,CAAC,GAAG;AAAA,WAC3B;AAAA,UACA;AAAA,SACF;AAAA,QACC,GAAG,gBAAA,EAAiB;AAAA,QACpB,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH,EACF,CAAA;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDropZoneTrigger.js","sources":["../src/file-drop-zone/FileDropZoneTrigger.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type
|
|
1
|
+
{"version":3,"file":"FileDropZoneTrigger.js","sources":["../src/file-drop-zone/FileDropZoneTrigger.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type ComponentPropsWithoutRef,\n type FocusEvent,\n forwardRef,\n type SyntheticEvent,\n useRef,\n} from \"react\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { useForkRef } from \"../utils\";\n\nexport interface FileDropZoneTriggerProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"onChange\"> {\n /**\n * `accept` attribute for HTML <input>.\n *\n * A comma separated list of file types the user can pick from the file input dialog box.\n */\n accept?: string;\n /**\n * Disable all trigger elements.\n */\n disabled?: boolean;\n /**\n * Allows multiple files to be uploaded.\n */\n multiple?: boolean;\n /**\n * Callback for input change event\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>, files: File[]) => void;\n /**\n * The appearance of the button. Options are 'solid', 'bordered', and 'transparent'.\n * 'solid' is the default value.\n */\n appearance?: ButtonProps[\"appearance\"];\n /**\n * The sentiment of the button. Options are 'accented' and 'neutral'.\n * 'neutral' is the default value.\n *\n */\n sentiment?: Extract<ButtonProps[\"sentiment\"], \"accented\" | \"neutral\">;\n}\n\nexport const FileDropZoneTrigger = forwardRef<\n HTMLButtonElement,\n FileDropZoneTriggerProps\n>(function FileDropZoneTrigger(\n { accept, children, disabled, multiple = false, onChange, ...rest },\n ref,\n) {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useForkRef(ref, buttonRef);\n\n // As an ADA requirement when dialog is closed and the focus is returned to the input, we need to\n // move focus back on the button element so that all labels can be announced correctly\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n event.stopPropagation();\n buttonRef.current?.focus();\n };\n\n const handleClick = (event: SyntheticEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n fileInputRef.current?.click();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from((event.target as HTMLInputElement).files ?? []);\n // Allow selecting the same file multiple times - #3591\n // User would still be able to put back the value in onChange, if necessary\n event.target.value = \"\";\n onChange?.(event, files);\n };\n return (\n <>\n <Button\n onClick={handleClick}\n disabled={disabled}\n ref={triggerRef}\n {...rest}\n >\n {children ?? \"Browse files\"}\n </Button>\n <input\n accept={accept}\n style={{ display: \"none\" }}\n disabled={disabled}\n multiple={multiple}\n onChange={handleChange}\n onFocus={handleFocus}\n ref={fileInputRef}\n type=\"file\"\n />\n </>\n );\n});\n"],"names":["forwardRef","FileDropZoneTrigger","useRef","useForkRef","jsxs","Fragment","jsx","Button"],"mappings":";;;;;;;;;;;;AA4CO,MAAM,mBAAA,GAAsBA,gBAAA,CAGjC,SAASC,oBAAAA,CACT,EAAE,MAAA,EAAQ,QAAA,EAAU,QAAA,EAAU,QAAA,GAAW,KAAA,EAAO,QAAA,EAAU,GAAG,IAAA,IAC7D,GAAA,EACA;AACA,EAAA,MAAM,SAAA,GAAYC,aAA0B,IAAI,CAAA;AAChD,EAAA,MAAM,YAAA,GAAeA,aAAyB,IAAI,CAAA;AAClD,EAAA,MAAM,UAAA,GAAaC,qBAAA,CAAW,GAAA,EAAK,SAAS,CAAA;AAI5C,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KA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EAAK;AAAA;AAAA;AACP,GAAA,EACF,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".saltLink {\n --link-color: \"inherit\";\n --link-color-hover: \"inherit\";\n --link-color-active: \"inherit\";\n --link-color-visited: var(--salt-content-foreground-visited);\n --link-color-focus: \"inherit\";\n --link-focus-outlineColor: currentColor;\n\n --link-fontFamily: var(--salt-text-fontFamily);\n}\n\n.saltLink-underlineDefault {\n --link-textDecoration: var(--salt-typography-textDecoration-underline);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n /* Active takes default */\n --link-textDecoration-active: var(--link-textDecoration);\n /* Focus takes hover */\n --link-textDecoration-focus: var(--link-textDecoration-hover);\n /* Visited takes default */\n --link-textDecoration-visited: var(--link-textDecoration);\n}\n\n.saltLink-underlineNever {\n --link-textDecoration: var(--salt-typography-textDecoration-none);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n}\n\n/* Main css class */\n.saltLink.saltText {\n color: var(--link-color);\n letter-spacing: var(--salt-text-letterSpacing);\n text-decoration: var(--link-textDecoration);\n font-family: var(--link-fontFamily);\n}\n\n/* Primary variant */\n.saltLink-primary {\n --link-color: var(--salt-content-primary-foreground);\n --link-color-hover: var(--salt-content-primary-foreground);\n --link-color-active: var(--salt-content-primary-foreground);\n --link-color-focus: var(--salt-content-primary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* Secondary variant */\n.saltLink-secondary {\n --link-color: var(--salt-content-secondary-foreground);\n --link-color-hover: var(--salt-content-secondary-foreground);\n --link-color-active: var(--salt-content-secondary-foreground);\n --link-color-focus: var(--salt-content-secondary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n.saltLink-accent {\n --link-color: var(--salt-content-accent-foreground);\n --link-color-hover: var(--salt-content-accent-foreground);\n --link-color-active: var(--salt-content-accent-foreground);\n --link-color-focus: var(--salt-content-accent-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* External link's icon */\n.saltLink .saltLink-icon {\n margin-left: var(--salt-spacing-75);\n margin-bottom: -2px;\n}\n\n/* Set color for visited link */\n.saltLink:visited {\n color: var(--saltLink-color-visited, var(--link-color-visited));\n text-decoration: var(--link-textDecoration-visited);\n}\n\n/* Set color for hovered link */\n.saltLink:hover {\n color: var(--saltLink-color-hover, var(--link-color-hover));\n text-decoration: var(--link-textDecoration-hover);\n}\n\n/* Set color for active link */\n.saltLink:active {\n color: var(--saltLink-color-active, var(--link-color-active));\n text-decoration: var(--link-textDecoration-active);\n}\n\n/* Set color for focused link */\n.saltLink:focus {\n color: var(--saltLink-color-focus, var(--link-color-focus));\n outline: var(--salt-focused-outline);\n outline-color: var(--link-focus-outlineColor);\n text-decoration: var(--link-textDecoration-focus);\n}\n\n/* Class for ADA content */\n.saltLink-externalLinkADA {\n
|
|
3
|
+
var css_248z = ".saltLink {\n --link-color: \"inherit\";\n --link-color-hover: \"inherit\";\n --link-color-active: \"inherit\";\n --link-color-visited: var(--salt-content-foreground-visited);\n --link-color-focus: \"inherit\";\n --link-focus-outlineColor: currentColor;\n\n --link-fontFamily: var(--salt-text-fontFamily);\n}\n\n.saltLink-underlineDefault {\n --link-textDecoration: var(--salt-typography-textDecoration-underline);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n /* Active takes default */\n --link-textDecoration-active: var(--link-textDecoration);\n /* Focus takes hover */\n --link-textDecoration-focus: var(--link-textDecoration-hover);\n /* Visited takes default */\n --link-textDecoration-visited: var(--link-textDecoration);\n}\n\n.saltLink-underlineNever {\n --link-textDecoration: var(--salt-typography-textDecoration-none);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n}\n\n/* Main css class */\n.saltLink.saltText {\n color: var(--link-color);\n letter-spacing: var(--salt-text-letterSpacing);\n text-decoration: var(--link-textDecoration);\n font-family: var(--link-fontFamily);\n}\n\n/* Primary variant */\n.saltLink-primary {\n --link-color: var(--salt-content-primary-foreground);\n --link-color-hover: var(--salt-content-primary-foreground);\n --link-color-active: var(--salt-content-primary-foreground);\n --link-color-focus: var(--salt-content-primary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* Secondary variant */\n.saltLink-secondary {\n --link-color: var(--salt-content-secondary-foreground);\n --link-color-hover: var(--salt-content-secondary-foreground);\n --link-color-active: var(--salt-content-secondary-foreground);\n --link-color-focus: var(--salt-content-secondary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n.saltLink-accent {\n --link-color: var(--salt-content-accent-foreground);\n --link-color-hover: var(--salt-content-accent-foreground);\n --link-color-active: var(--salt-content-accent-foreground);\n --link-color-focus: var(--salt-content-accent-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* External link's icon */\n.saltLink .saltLink-icon {\n margin-left: var(--salt-spacing-75);\n margin-bottom: -2px;\n}\n\n/* Set color for visited link */\n.saltLink:visited {\n color: var(--saltLink-color-visited, var(--link-color-visited));\n text-decoration: var(--link-textDecoration-visited);\n}\n\n/* Set color for hovered link */\n.saltLink:hover {\n color: var(--saltLink-color-hover, var(--link-color-hover));\n text-decoration: var(--link-textDecoration-hover);\n}\n\n/* Set color for active link */\n.saltLink:active {\n color: var(--saltLink-color-active, var(--link-color-active));\n text-decoration: var(--link-textDecoration-active);\n}\n\n/* Set color for focused link */\n.saltLink:focus {\n color: var(--saltLink-color-focus, var(--link-color-focus));\n outline: var(--salt-focused-outline);\n outline-color: var(--link-focus-outlineColor);\n text-decoration: var(--link-textDecoration-focus);\n}\n\n/* Class for ADA content - visually hidden but accessible to screen readers.\n Uses clip-path and prevents user selection so the text isn't included\n when users copy the link's visible content. */\n.saltLink-externalLinkADA {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n user-select: none;\n -webkit-user-select: none;\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=Link.css.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-fontFamily);\n line-height: var(--salt-text-lineHeight);\n letter-spacing: var(--salt-text-letterSpacing);\n cursor: var(--salt-cursor-hover);\n border-radius: var(--salt-palette-corner-weak);\n}\n\n.saltPageButton:hover,\n.saltPageButton:focus-visible {\n background: var(--salt-selectable-background-hover);\n}\n\n.saltPageButton:active {\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton:focus-visible {\n outline: var(--salt-focused-outline);\n}\n\n.saltPageButton:disabled {\n color: var(--salt-content-secondary-foreground);\n background: var(--salt-selectable-background);\n cursor: var(--salt-cursor-readonly);\n}\n\n.saltPageButton[aria-current=\"page\"] {\n border: var(--salt-size-fixed-100) var(--salt-borderStyle-solid) var(--salt-selectable-borderColor-selected);\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton-fixed {\n padding: 0;\n}\n";
|
|
3
|
+
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-fontFamily);\n line-height: var(--salt-text-lineHeight);\n letter-spacing: var(--salt-text-letterSpacing);\n cursor: var(--salt-cursor-hover);\n border-radius: var(--salt-palette-corner-weak);\n}\n\n.saltPageButton:hover,\n.saltPageButton:focus-visible {\n background: var(--salt-selectable-background-hover);\n}\n\n.saltPageButton:active {\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton:focus-visible {\n outline: var(--salt-focused-outline);\n position: relative;\n z-index: var(--salt-zIndex-default);\n}\n\n.saltPageButton:disabled {\n color: var(--salt-content-secondary-foreground);\n background: var(--salt-selectable-background);\n cursor: var(--salt-cursor-readonly);\n}\n\n.saltPageButton[aria-current=\"page\"] {\n border: var(--salt-size-fixed-100) var(--salt-borderStyle-solid) var(--salt-selectable-borderColor-selected);\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton-fixed {\n padding: 0;\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=PageButton.css.js.map
|
|
@@ -7,7 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var useId = require('../utils/useId.js');
|
|
8
8
|
var useIsomorphicLayoutEffect = require('../utils/useIsomorphicLayoutEffect.js');
|
|
9
9
|
|
|
10
|
-
const providerSymbol = Symbol.for("salt-provider");
|
|
10
|
+
const providerSymbol = /* @__PURE__ */ Symbol.for("salt-provider");
|
|
11
11
|
function ThemeApplicator({
|
|
12
12
|
applyClassesTo,
|
|
13
13
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeApplicator.js","sources":["../src/salt-provider/ThemeApplicator.tsx"],"sourcesContent":["import { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type ReactNode,\n} from \"react\";\nimport type {\n Accent,\n ActionFont,\n Corner,\n Density,\n HeadingFont,\n Mode,\n ThemeName,\n} from \"../theme/index\";\nimport { useId } from \"../utils/useId\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\n\nexport interface ThemeApplicatorProps {\n /**\n * Either \"root\", \"scope\" or \"child\".\n * Specifies the location of salt theme class and attributes should be applied to.\n *\n * Defaults to \"root\" for a root provider, otherwise \"scope\".\n */\n applyClassesTo: \"root\" | \"scope\" | \"child\";\n /**\n * Either \"high\", \"medium\", \"low\", \"touch\" or \"mobile\".\n * Determines the amount of content that can fit on a screen based on the size and spacing of components.\n * Refer to [density](https://www.saltdesignsystem.com/salt/foundations/density) doc for more detail.\n *\n * @default \"medium\"\n */\n density: Density;\n /**\n * A string. Specifies custom theme name(s) you want to apply, similar to `className`.\n */\n theme: ThemeName;\n /**\n * Either \"light\" or \"dark\". Enable the color palette to change from light to dark.\n * Refer to [modes](https://www.saltdesignsystem.com/salt/foundations/modes) doc for more detail.\n *\n * @default \"light\"\n */\n mode: Mode;\n /**\n * Either \"sharp\" or \"rounded\".\n * Determines selected components corner radius.\n * @default \"sharp\"\n */\n corner?: Corner;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of display and heading text.\n * @default \"Open Sans\"\n */\n headingFont?: HeadingFont;\n /**\n * Either \"blue\" or \"teal\".\n * Determines accent color used across components, e.g. Accent Button, List, Calendar.\n * @default \"blue\"\n */\n accent?: Accent;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of action components, mostly Buttons.\n * @default \"Open Sans\"\n */\n actionFont?: ActionFont;\n children?: ReactNode;\n}\n\nconst providerSymbol = Symbol.for(\"salt-provider\");\n\nexport function ThemeApplicator({\n applyClassesTo,\n children,\n density,\n mode,\n theme,\n corner,\n headingFont,\n accent,\n actionFont,\n}: ThemeApplicatorProps) {\n const targetWindow = useWindow();\n\n const providerId = useId();\n\n useIsomorphicLayoutEffect(() => {\n if (applyClassesTo !== \"root\" || !targetWindow || !providerId) return;\n\n const targetDocument: Document & { [providerSymbol]?: string } =\n targetWindow.document;\n\n // Claim the document if no other provider has already. The symbol is used so the lock isn't enumerable and guarantees it won't clash with anything else.\n if (!targetDocument[providerSymbol]) {\n targetDocument[providerSymbol] = providerId;\n }\n\n if (providerId !== targetDocument[providerSymbol]) {\n console.warn(\n \"Multiple providers targeting the same window. There can be only one level root level SaltProvider per window.\",\n );\n return;\n }\n\n const themeNames = theme.split(\" \");\n\n // add the styles we want to apply\n targetDocument.documentElement.classList.add(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = mode;\n\n // Theme Next\n if (corner) targetDocument.documentElement.dataset.corner = corner;\n if (headingFont)\n targetDocument.documentElement.dataset.headingFont = headingFont;\n if (accent) targetDocument.documentElement.dataset.accent = accent;\n if (actionFont)\n targetDocument.documentElement.dataset.actionFont = actionFont;\n\n return () => {\n // Delete lock\n delete targetDocument[providerSymbol];\n\n // When unmounting/remounting, remove the applied styles from the root\n targetDocument.documentElement.classList.remove(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = undefined;\n\n // Theme Next\n delete targetDocument.documentElement.dataset.corner;\n delete targetDocument.documentElement.dataset.headingFont;\n delete targetDocument.documentElement.dataset.accent;\n delete targetDocument.documentElement.dataset.actionFont;\n };\n }, [\n providerId,\n applyClassesTo,\n density,\n mode,\n theme,\n targetWindow,\n corner,\n headingFont,\n accent,\n actionFont,\n ]);\n\n const themeNextProps = {\n \"data-corner\": corner,\n \"data-heading-font\": headingFont,\n \"data-accent\": accent,\n \"data-action-font\": actionFont,\n };\n\n if (applyClassesTo === \"child\") {\n if (isValidElement<HTMLAttributes<HTMLElement>>(children)) {\n return cloneElement(children, {\n className: clsx(\n children.props?.className,\n theme,\n `salt-density-${density}`,\n ),\n // @ts-expect-error\n \"data-mode\": mode,\n ...themeNextProps,\n });\n }\n console.warn(\n `\\nSaltProvider can only apply CSS classes for theming to a single nested child element of the SaltProvider.\n Either wrap elements with a single container or consider removing the applyClassesToChild prop, in which case a\n div element will wrap your child elements`,\n );\n return children;\n }\n\n if (applyClassesTo === \"scope\") {\n return (\n <div\n className={clsx(\"salt-provider\", theme, `salt-density-${density}`)}\n data-mode={mode}\n {...themeNextProps}\n >\n {children}\n </div>\n );\n }\n\n return children;\n}\n"],"names":["useWindow","useId","useIsomorphicLayoutEffect","isValidElement","cloneElement","clsx","jsx"],"mappings":";;;;;;;;;AA0EA,MAAM,cAAA,
|
|
1
|
+
{"version":3,"file":"ThemeApplicator.js","sources":["../src/salt-provider/ThemeApplicator.tsx"],"sourcesContent":["import { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type ReactNode,\n} from \"react\";\nimport type {\n Accent,\n ActionFont,\n Corner,\n Density,\n HeadingFont,\n Mode,\n ThemeName,\n} from \"../theme/index\";\nimport { useId } from \"../utils/useId\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\n\nexport interface ThemeApplicatorProps {\n /**\n * Either \"root\", \"scope\" or \"child\".\n * Specifies the location of salt theme class and attributes should be applied to.\n *\n * Defaults to \"root\" for a root provider, otherwise \"scope\".\n */\n applyClassesTo: \"root\" | \"scope\" | \"child\";\n /**\n * Either \"high\", \"medium\", \"low\", \"touch\" or \"mobile\".\n * Determines the amount of content that can fit on a screen based on the size and spacing of components.\n * Refer to [density](https://www.saltdesignsystem.com/salt/foundations/density) doc for more detail.\n *\n * @default \"medium\"\n */\n density: Density;\n /**\n * A string. Specifies custom theme name(s) you want to apply, similar to `className`.\n */\n theme: ThemeName;\n /**\n * Either \"light\" or \"dark\". Enable the color palette to change from light to dark.\n * Refer to [modes](https://www.saltdesignsystem.com/salt/foundations/modes) doc for more detail.\n *\n * @default \"light\"\n */\n mode: Mode;\n /**\n * Either \"sharp\" or \"rounded\".\n * Determines selected components corner radius.\n * @default \"sharp\"\n */\n corner?: Corner;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of display and heading text.\n * @default \"Open Sans\"\n */\n headingFont?: HeadingFont;\n /**\n * Either \"blue\" or \"teal\".\n * Determines accent color used across components, e.g. Accent Button, List, Calendar.\n * @default \"blue\"\n */\n accent?: Accent;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of action components, mostly Buttons.\n * @default \"Open Sans\"\n */\n actionFont?: ActionFont;\n children?: ReactNode;\n}\n\nconst providerSymbol = Symbol.for(\"salt-provider\");\n\nexport function ThemeApplicator({\n applyClassesTo,\n children,\n density,\n mode,\n theme,\n corner,\n headingFont,\n accent,\n actionFont,\n}: ThemeApplicatorProps) {\n const targetWindow = useWindow();\n\n const providerId = useId();\n\n useIsomorphicLayoutEffect(() => {\n if (applyClassesTo !== \"root\" || !targetWindow || !providerId) return;\n\n const targetDocument: Document & { [providerSymbol]?: string } =\n targetWindow.document;\n\n // Claim the document if no other provider has already. The symbol is used so the lock isn't enumerable and guarantees it won't clash with anything else.\n if (!targetDocument[providerSymbol]) {\n targetDocument[providerSymbol] = providerId;\n }\n\n if (providerId !== targetDocument[providerSymbol]) {\n console.warn(\n \"Multiple providers targeting the same window. There can be only one level root level SaltProvider per window.\",\n );\n return;\n }\n\n const themeNames = theme.split(\" \");\n\n // add the styles we want to apply\n targetDocument.documentElement.classList.add(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = mode;\n\n // Theme Next\n if (corner) targetDocument.documentElement.dataset.corner = corner;\n if (headingFont)\n targetDocument.documentElement.dataset.headingFont = headingFont;\n if (accent) targetDocument.documentElement.dataset.accent = accent;\n if (actionFont)\n targetDocument.documentElement.dataset.actionFont = actionFont;\n\n return () => {\n // Delete lock\n delete targetDocument[providerSymbol];\n\n // When unmounting/remounting, remove the applied styles from the root\n targetDocument.documentElement.classList.remove(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = undefined;\n\n // Theme Next\n delete targetDocument.documentElement.dataset.corner;\n delete targetDocument.documentElement.dataset.headingFont;\n delete targetDocument.documentElement.dataset.accent;\n delete targetDocument.documentElement.dataset.actionFont;\n };\n }, [\n providerId,\n applyClassesTo,\n density,\n mode,\n theme,\n targetWindow,\n corner,\n headingFont,\n accent,\n actionFont,\n ]);\n\n const themeNextProps = {\n \"data-corner\": corner,\n \"data-heading-font\": headingFont,\n \"data-accent\": accent,\n \"data-action-font\": actionFont,\n };\n\n if (applyClassesTo === \"child\") {\n if (isValidElement<HTMLAttributes<HTMLElement>>(children)) {\n return cloneElement(children, {\n className: clsx(\n children.props?.className,\n theme,\n `salt-density-${density}`,\n ),\n // @ts-expect-error\n \"data-mode\": mode,\n ...themeNextProps,\n });\n }\n console.warn(\n `\\nSaltProvider can only apply CSS classes for theming to a single nested child element of the SaltProvider.\n Either wrap elements with a single container or consider removing the applyClassesToChild prop, in which case a\n div element will wrap your child elements`,\n );\n return children;\n }\n\n if (applyClassesTo === \"scope\") {\n return (\n <div\n className={clsx(\"salt-provider\", theme, `salt-density-${density}`)}\n data-mode={mode}\n {...themeNextProps}\n >\n {children}\n </div>\n );\n }\n\n return children;\n}\n"],"names":["useWindow","useId","useIsomorphicLayoutEffect","isValidElement","cloneElement","clsx","jsx"],"mappings":";;;;;;;;;AA0EA,MAAM,cAAA,mBAAiB,MAAA,CAAO,GAAA,CAAI,eAAe,CAAA;AAE1C,SAAS,eAAA,CAAgB;AAAA,EAC9B,cAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,MAAA;AAAA,EACA,WAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAyB;AAtFzB,EAAA,IAAA,EAAA;AAuFE,EAAA,MAAM,eAAeA,gBAAA,EAAU;AAE/B,EAAA,MAAM,aAAaC,WAAA,EAAM;AAEzB,EAAAC,mDAAA,CAA0B,MAAM;AAC9B,IAAA,IAAI,cAAA,KAAmB,MAAA,IAAU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OAAO,CAAA,CAAE,CAAA;AAAA,QACjE,WAAA,EAAW,IAAA;AAAA,QACV,GAAG,cAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AAEA,EAAA,OAAO,QAAA;AACT;;;;"}
|
package/dist-es/banner/Banner.js
CHANGED
|
@@ -31,7 +31,14 @@ const Banner = forwardRef(function Banner2({ children, className, variant = "pri
|
|
|
31
31
|
ref,
|
|
32
32
|
...rest,
|
|
33
33
|
children: [
|
|
34
|
-
/* @__PURE__ */ jsx(
|
|
34
|
+
/* @__PURE__ */ jsx(
|
|
35
|
+
StatusIndicator,
|
|
36
|
+
{
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
status,
|
|
39
|
+
className: withBaseName("icon")
|
|
40
|
+
}
|
|
41
|
+
),
|
|
35
42
|
children
|
|
36
43
|
]
|
|
37
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sources":["../src/banner/Banner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { StatusIndicator, type ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer } from \"../utils\";\n\nimport bannerCss from \"./Banner.css\";\n\nexport interface BannerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Emphasize the styling by applying a background color: defaults to false\n */\n variant?: \"primary\" | \"secondary\";\n /**\n * A string to determine the current state of the Banner\n */\n status?: ValidationStatus;\n}\n\nconst withBaseName = makePrefixer(\"saltBanner\");\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { children, className, variant = \"primary\", status = \"info\", ...rest },\n ref,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-banner\",\n css: bannerCss,\n window: targetWindow,\n });\n\n return (\n <div\n className={clsx(\n withBaseName(),\n withBaseName(status),\n withBaseName(variant),\n className,\n )}\n ref={ref}\n {...rest}\n >\n <StatusIndicator
|
|
1
|
+
{"version":3,"file":"Banner.js","sources":["../src/banner/Banner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { StatusIndicator, type ValidationStatus } from \"../status-indicator\";\nimport { makePrefixer } from \"../utils\";\n\nimport bannerCss from \"./Banner.css\";\n\nexport interface BannerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Emphasize the styling by applying a background color: defaults to false\n */\n variant?: \"primary\" | \"secondary\";\n /**\n * A string to determine the current state of the Banner\n */\n status?: ValidationStatus;\n}\n\nconst withBaseName = makePrefixer(\"saltBanner\");\n\nexport const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(\n { children, className, variant = \"primary\", status = \"info\", ...rest },\n ref,\n) {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-banner\",\n css: bannerCss,\n window: targetWindow,\n });\n\n return (\n <div\n className={clsx(\n withBaseName(),\n withBaseName(status),\n withBaseName(variant),\n className,\n )}\n ref={ref}\n {...rest}\n >\n <StatusIndicator\n aria-hidden\n status={status}\n className={withBaseName(\"icon\")}\n />\n {children}\n </div>\n );\n});\n"],"names":["Banner","bannerCss"],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,YAAA,GAAe,aAAa,YAAY,CAAA;AAEvC,MAAM,MAAA,GAAS,UAAA,CAAwC,SAASA,OAAAA,CACrE,EAAE,QAAA,EAAU,SAAA,EAAW,OAAA,GAAU,SAAA,EAAW,MAAA,GAAS,MAAA,EAAQ,GAAG,IAAA,IAChE,GAAA,EACA;AACA,EAAA,MAAM,eAAe,SAAA,EAAU;AAC/B,EAAA,wBAAA,CAAyB;AAAA,IACvB,MAAA,EAAQ,aAAA;AAAA,IACR,GAAA,EAAKC,QAAA;AAAA,IACL,MAAA,EAAQ;AAAA,GACT,CAAA;AAED,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,IAAA;AAAA,QACT,YAAA,EAAa;AAAA,QACb,aAAa,MAAM,CAAA;AAAA,QACnB,aAAa,OAAO,CAAA;AAAA,QACpB;AAAA,OACF;AAAA,MACA,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,aAAA,EAAW,IAAA;AAAA,YACX,MAAA;AAAA,YACA,SAAA,EAAW,aAAa,MAAM;AAAA;AAAA,SAChC;AAAA,QACC;AAAA;AAAA;AAAA,GACH;AAEJ,CAAC;;;;"}
|
package/dist-es/drawer/Drawer.js
CHANGED
|
@@ -39,6 +39,7 @@ const Drawer = forwardRef(
|
|
|
39
39
|
variant = "primary",
|
|
40
40
|
disableDismiss,
|
|
41
41
|
disableScrim,
|
|
42
|
+
initialFocus,
|
|
42
43
|
...rest
|
|
43
44
|
} = props;
|
|
44
45
|
const targetWindow = useWindow();
|
|
@@ -79,7 +80,8 @@ const Drawer = forwardRef(
|
|
|
79
80
|
height: (_b = elements.floating) == null ? void 0 : _b.offsetHeight,
|
|
80
81
|
"aria-modal": "true",
|
|
81
82
|
focusManagerProps: {
|
|
82
|
-
context
|
|
83
|
+
context,
|
|
84
|
+
initialFocus
|
|
83
85
|
},
|
|
84
86
|
className: clsx(
|
|
85
87
|
withBaseName(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import { useClick
|
|
1
|
+
{"version":3,"file":"Drawer.js","sources":["../src/drawer/Drawer.tsx"],"sourcesContent":["import {\n type FloatingFocusManager,\n useClick,\n useDismiss,\n useInteractions,\n} from \"@floating-ui/react\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n type ComponentPropsWithoutRef,\n forwardRef,\n type PropsWithChildren,\n useEffect,\n useState,\n} from \"react\";\nimport { Scrim } from \"../scrim\";\nimport {\n makePrefixer,\n useFloatingComponent,\n useFloatingUI,\n useForkRef,\n} from \"../utils\";\nimport drawerCss from \"./Drawer.css\";\n\ninterface ConditionalScrimWrapperProps extends PropsWithChildren {\n condition: boolean;\n}\n\nconst ConditionalScrimWrapper = ({\n condition,\n children,\n}: ConditionalScrimWrapperProps) => {\n return condition ? <Scrim fixed> {children} </Scrim> : <>{children} </>;\n};\n\nexport interface DrawerProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * Defines the drawer position within the screen. Defaults to `left`.\n */\n position?: \"left\" | \"top\" | \"right\" | \"bottom\";\n /**\n * Display or hide the component.\n */\n open?: boolean;\n /**\n * Callback function triggered when open state changes.\n */\n onOpenChange?: (newOpen: boolean) => void;\n /**\n * Change background color palette\n */\n variant?: \"primary\" | \"secondary\" | \"tertiary\";\n /**\n * Prevent the dialog closing on click away\n * */\n disableDismiss?: boolean;\n /**\n * Prevent Scrim from rendering\n * */\n disableScrim?: boolean;\n /**\n * Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.\n * Default value is 0 (first tabbable element).\n * */\n initialFocus?: ComponentPropsWithoutRef<\n typeof FloatingFocusManager\n >[\"initialFocus\"];\n}\n\nconst withBaseName = makePrefixer(\"saltDrawer\");\n\nexport const Drawer = forwardRef<HTMLDivElement, DrawerProps>(\n function Drawer(props, ref) {\n const {\n children,\n className,\n position = \"left\",\n open = false,\n onOpenChange,\n variant = \"primary\",\n disableDismiss,\n disableScrim,\n initialFocus,\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 const { Component: FloatingComponent } = useFloatingComponent();\n\n const { context, floating, elements } = useFloatingUI({\n open: showComponent,\n onOpenChange,\n });\n\n const { getFloatingProps } = useInteractions([\n useClick(context),\n useDismiss(context, { enabled: !disableDismiss }),\n ]);\n\n const handleRef = useForkRef<HTMLDivElement>(floating, ref);\n\n useEffect(() => {\n if (open && !showComponent) {\n setShowComponent(true);\n }\n\n if (!open && showComponent) {\n const animate = setTimeout(() => {\n setShowComponent(false);\n }, 300); // var(--salt-duration-perceptible)\n return () => clearTimeout(animate);\n }\n }, [open, showComponent]);\n\n return (\n <ConditionalScrimWrapper condition={showComponent && !disableScrim}>\n <FloatingComponent\n open={showComponent}\n ref={handleRef}\n role={\"dialog\"}\n width={elements.floating?.offsetWidth}\n height={elements.floating?.offsetHeight}\n aria-modal=\"true\"\n focusManagerProps={{\n context: context,\n initialFocus,\n }}\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 {...getFloatingProps()}\n {...rest}\n >\n {children}\n </FloatingComponent>\n </ConditionalScrimWrapper>\n );\n },\n);\n"],"names":["Drawer","drawerCss"],"mappings":";;;;;;;;;;;;;;;AA6BA,MAAM,0BAA0B,CAAC;AAAA,EAC/B,SAAA;AAAA,EACA;AACF,CAAA,KAAoC;AAClC,EAAA,OAAO,SAAA,mBAAY,IAAA,CAAC,KAAA,EAAA,EAAM,KAAA,EAAK,IAAA,EAAC,QAAA,EAAA;AAAA,IAAA,GAAA;AAAA,IAAE,QAAA;AAAA,IAAS;AAAA,GAAA,EAAC,oBAAW,IAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA;AAAA,IAAA,QAAA;AAAA,IAAS;AAAA,GAAA,EAAC,CAAA;AACtE,CAAA;AAoCA,MAAM,YAAA,GAAe,aAAa,YAAY,CAAA;AAEvC,MAAM,MAAA,GAAS,UAAA;AAAA,EACpB,SAASA,OAAAA,CAAO,KAAA,EAAO,GAAA,EAAK;AAzE9B,IAAA,IAAA,EAAA,EAAA,EAAA;AA0EI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Aa,OAAO,CAAA;AAAA,MACnC;AAAA,IACF,CAAA,EAAG,CAAC,IAAA,EAAM,aAAa,CAAC,CAAA;AAExB,IAAA,uBACE,GAAA,CAAC,uBAAA,EAAA,EAAwB,SAAA,EAAW,aAAA,IAAiB,CAAC,YAAA,EACpD,QAAA,kBAAA,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAM,aAAA;AAAA,QACN,GAAA,EAAK,SAAA;AAAA,QACL,IAAA,EAAM,QAAA;AAAA,QACN,KAAA,EAAA,CAAO,EAAA,GAAA,QAAA,CAAS,QAAA,KAAT,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,WAAA;AAAA,QAC1B,MAAA,EAAA,CAAQ,EAAA,GAAA,QAAA,CAAS,QAAA,KAAT,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,YAAA;AAAA,QAC3B,YAAA,EAAW,MAAA;AAAA,QACX,iBAAA,EAAmB;AAAA,UACjB,OAAA;AAAA,UACA;AAAA,SACF;AAAA,QACA,SAAA,EAAW,IAAA;AAAA,UACT,YAAA,EAAa;AAAA,UACb,aAAa,QAAQ,CAAA;AAAA,UACrB;AAAA,YACE,CAAC,YAAA,CAAa,gBAAgB,CAAC,GAAG,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,eAAe,CAAC,GAAG,CAAC,IAAA;AAAA,YAClC,CAAC,YAAA,CAAa,OAAO,CAAC,GAAG;AAAA,WAC3B;AAAA,UACA;AAAA,SACF;AAAA,QACC,GAAG,gBAAA,EAAiB;AAAA,QACpB,GAAG,IAAA;AAAA,QAEH;AAAA;AAAA,KACH,EACF,CAAA;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileDropZoneTrigger.js","sources":["../src/file-drop-zone/FileDropZoneTrigger.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type
|
|
1
|
+
{"version":3,"file":"FileDropZoneTrigger.js","sources":["../src/file-drop-zone/FileDropZoneTrigger.tsx"],"sourcesContent":["import {\n type ChangeEvent,\n type ComponentPropsWithoutRef,\n type FocusEvent,\n forwardRef,\n type SyntheticEvent,\n useRef,\n} from \"react\";\nimport { Button, type ButtonProps } from \"../button\";\nimport { useForkRef } from \"../utils\";\n\nexport interface FileDropZoneTriggerProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"onChange\"> {\n /**\n * `accept` attribute for HTML <input>.\n *\n * A comma separated list of file types the user can pick from the file input dialog box.\n */\n accept?: string;\n /**\n * Disable all trigger elements.\n */\n disabled?: boolean;\n /**\n * Allows multiple files to be uploaded.\n */\n multiple?: boolean;\n /**\n * Callback for input change event\n */\n onChange?: (event: ChangeEvent<HTMLInputElement>, files: File[]) => void;\n /**\n * The appearance of the button. Options are 'solid', 'bordered', and 'transparent'.\n * 'solid' is the default value.\n */\n appearance?: ButtonProps[\"appearance\"];\n /**\n * The sentiment of the button. Options are 'accented' and 'neutral'.\n * 'neutral' is the default value.\n *\n */\n sentiment?: Extract<ButtonProps[\"sentiment\"], \"accented\" | \"neutral\">;\n}\n\nexport const FileDropZoneTrigger = forwardRef<\n HTMLButtonElement,\n FileDropZoneTriggerProps\n>(function FileDropZoneTrigger(\n { accept, children, disabled, multiple = false, onChange, ...rest },\n ref,\n) {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const fileInputRef = useRef<HTMLInputElement>(null);\n const triggerRef = useForkRef(ref, buttonRef);\n\n // As an ADA requirement when dialog is closed and the focus is returned to the input, we need to\n // move focus back on the button element so that all labels can be announced correctly\n const handleFocus = (event: FocusEvent<HTMLInputElement>) => {\n event.stopPropagation();\n buttonRef.current?.focus();\n };\n\n const handleClick = (event: SyntheticEvent<HTMLButtonElement>) => {\n event.stopPropagation();\n fileInputRef.current?.click();\n };\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n const files = Array.from((event.target as HTMLInputElement).files ?? []);\n // Allow selecting the same file multiple times - #3591\n // User would still be able to put back the value in onChange, if necessary\n event.target.value = \"\";\n onChange?.(event, files);\n };\n return (\n <>\n <Button\n onClick={handleClick}\n disabled={disabled}\n ref={triggerRef}\n {...rest}\n >\n {children ?? \"Browse files\"}\n </Button>\n <input\n accept={accept}\n style={{ display: \"none\" }}\n disabled={disabled}\n multiple={multiple}\n onChange={handleChange}\n onFocus={handleFocus}\n ref={fileInputRef}\n type=\"file\"\n />\n </>\n );\n});\n"],"names":["FileDropZoneTrigger"],"mappings":";;;;;;;;;;AA4CO,MAAM,mBAAA,GAAsB,UAAA,CAGjC,SAASA,oBAAAA,CACT,EAAE,MAAA,EAAQ,QAAA,EAAU,QAAA,EAAU,QAAA,GAAW,KAAA,EAAO,QAAA,EAAU,GAAG,IAAA,IAC7D,GAAA,EACA;AACA,EAAA,MAAM,SAAA,GAAY,OAA0B,IAAI,CAAA;AAChD,EAAA,MAAM,YAAA,GAAe,OAAyB,IAAI,CAAA;AAClD,EAAA,MAAM,UAAA,GAAa,UAAA,CAAW,GAAA,EAAK,SAAS,CAAA;AAI5C,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAAwC;AAzD/D,IAAA,IAAA,EAAA;AA0DI,IAAA,KAAA,CAAM,eAAA,EAAgB;AACtB,IAAA,CAAA,EAAA,GAAA,SAAA,CAAU,YAAV,IAAA,GAAA,MAAA,GAAA,EAAA,CAAmB,KAAA,EAAA;AAAA,EACrB,CAAA;AAEA,EAAA,MAAM,WAAA,GAAc,CAAC,KAAA,KAA6C;AA9DpE,IAAA,IAAA,EAAA;AA+DI,IAAA,KAAA,CAAM,eAAA,EAAgB;AACtB,IAAA,CAAA,EAAA,GAAA,YAAA,CAAa,YAAb,IAAA,GAAA,MAAA,GAAA,EAAA,CAAsB,KAAA,EAAA;AAAA,EACxB,CAAA;AAEA,EAAA,MAAM,YAAA,GAAe,CAAC,KAAA,KAAyC;AAC7D,IAAA,MAAM,QAAQ,KAAA,CAAM,IAAA,CAAM,MAAM,MAAA,CAA4B,KAAA,IAAS,EAAE,CAAA;AAGvE,IAAA,KAAA,CAAM,OAAO,KAAA,GAAQ,EAAA;AACrB,IAAA,QAAA,IAAA,IAAA,GAAA,MAAA,GAAA,QAAA,CAAW,KAAA,EAAO,KAAA,CAAA;AAAA,EACpB,CAAA;AACA,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAA,EAAS,WAAA;AAAA,QACT,QAAA;AAAA,QACA,GAAA,EAAK,UAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QAEH,QAAA,EAAA,QAAA,IAAY;AAAA;AAAA,KACf;AAAA,oBACA,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,MAAA;AAAA,QACA,KAAA,EAAO,EAAE,OAAA,EAAS,MAAA,EAAO;AAAA,QACzB,QAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA,EAAU,YAAA;AAAA,QACV,OAAA,EAAS,WAAA;AAAA,QACT,GAAA,EAAK,YAAA;AAAA,QACL,IAAA,EAAK;AAAA;AAAA;AACP,GAAA,EACF,CAAA;AAEJ,CAAC;;;;"}
|
package/dist-es/link/Link.css.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var css_248z = ".saltLink {\n --link-color: \"inherit\";\n --link-color-hover: \"inherit\";\n --link-color-active: \"inherit\";\n --link-color-visited: var(--salt-content-foreground-visited);\n --link-color-focus: \"inherit\";\n --link-focus-outlineColor: currentColor;\n\n --link-fontFamily: var(--salt-text-fontFamily);\n}\n\n.saltLink-underlineDefault {\n --link-textDecoration: var(--salt-typography-textDecoration-underline);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n /* Active takes default */\n --link-textDecoration-active: var(--link-textDecoration);\n /* Focus takes hover */\n --link-textDecoration-focus: var(--link-textDecoration-hover);\n /* Visited takes default */\n --link-textDecoration-visited: var(--link-textDecoration);\n}\n\n.saltLink-underlineNever {\n --link-textDecoration: var(--salt-typography-textDecoration-none);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n}\n\n/* Main css class */\n.saltLink.saltText {\n color: var(--link-color);\n letter-spacing: var(--salt-text-letterSpacing);\n text-decoration: var(--link-textDecoration);\n font-family: var(--link-fontFamily);\n}\n\n/* Primary variant */\n.saltLink-primary {\n --link-color: var(--salt-content-primary-foreground);\n --link-color-hover: var(--salt-content-primary-foreground);\n --link-color-active: var(--salt-content-primary-foreground);\n --link-color-focus: var(--salt-content-primary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* Secondary variant */\n.saltLink-secondary {\n --link-color: var(--salt-content-secondary-foreground);\n --link-color-hover: var(--salt-content-secondary-foreground);\n --link-color-active: var(--salt-content-secondary-foreground);\n --link-color-focus: var(--salt-content-secondary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n.saltLink-accent {\n --link-color: var(--salt-content-accent-foreground);\n --link-color-hover: var(--salt-content-accent-foreground);\n --link-color-active: var(--salt-content-accent-foreground);\n --link-color-focus: var(--salt-content-accent-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* External link's icon */\n.saltLink .saltLink-icon {\n margin-left: var(--salt-spacing-75);\n margin-bottom: -2px;\n}\n\n/* Set color for visited link */\n.saltLink:visited {\n color: var(--saltLink-color-visited, var(--link-color-visited));\n text-decoration: var(--link-textDecoration-visited);\n}\n\n/* Set color for hovered link */\n.saltLink:hover {\n color: var(--saltLink-color-hover, var(--link-color-hover));\n text-decoration: var(--link-textDecoration-hover);\n}\n\n/* Set color for active link */\n.saltLink:active {\n color: var(--saltLink-color-active, var(--link-color-active));\n text-decoration: var(--link-textDecoration-active);\n}\n\n/* Set color for focused link */\n.saltLink:focus {\n color: var(--saltLink-color-focus, var(--link-color-focus));\n outline: var(--salt-focused-outline);\n outline-color: var(--link-focus-outlineColor);\n text-decoration: var(--link-textDecoration-focus);\n}\n\n/* Class for ADA content */\n.saltLink-externalLinkADA {\n
|
|
1
|
+
var css_248z = ".saltLink {\n --link-color: \"inherit\";\n --link-color-hover: \"inherit\";\n --link-color-active: \"inherit\";\n --link-color-visited: var(--salt-content-foreground-visited);\n --link-color-focus: \"inherit\";\n --link-focus-outlineColor: currentColor;\n\n --link-fontFamily: var(--salt-text-fontFamily);\n}\n\n.saltLink-underlineDefault {\n --link-textDecoration: var(--salt-typography-textDecoration-underline);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n /* Active takes default */\n --link-textDecoration-active: var(--link-textDecoration);\n /* Focus takes hover */\n --link-textDecoration-focus: var(--link-textDecoration-hover);\n /* Visited takes default */\n --link-textDecoration-visited: var(--link-textDecoration);\n}\n\n.saltLink-underlineNever {\n --link-textDecoration: var(--salt-typography-textDecoration-none);\n --link-textDecoration-hover: var(--salt-typography-textDecoration-none);\n}\n\n/* Main css class */\n.saltLink.saltText {\n color: var(--link-color);\n letter-spacing: var(--salt-text-letterSpacing);\n text-decoration: var(--link-textDecoration);\n font-family: var(--link-fontFamily);\n}\n\n/* Primary variant */\n.saltLink-primary {\n --link-color: var(--salt-content-primary-foreground);\n --link-color-hover: var(--salt-content-primary-foreground);\n --link-color-active: var(--salt-content-primary-foreground);\n --link-color-focus: var(--salt-content-primary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* Secondary variant */\n.saltLink-secondary {\n --link-color: var(--salt-content-secondary-foreground);\n --link-color-hover: var(--salt-content-secondary-foreground);\n --link-color-active: var(--salt-content-secondary-foreground);\n --link-color-focus: var(--salt-content-secondary-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n.saltLink-accent {\n --link-color: var(--salt-content-accent-foreground);\n --link-color-hover: var(--salt-content-accent-foreground);\n --link-color-active: var(--salt-content-accent-foreground);\n --link-color-focus: var(--salt-content-accent-foreground);\n --link-focus-outlineColor: var(--salt-focused-outlineColor);\n --link-color-visited: var(--salt-content-foreground-visited);\n}\n\n/* External link's icon */\n.saltLink .saltLink-icon {\n margin-left: var(--salt-spacing-75);\n margin-bottom: -2px;\n}\n\n/* Set color for visited link */\n.saltLink:visited {\n color: var(--saltLink-color-visited, var(--link-color-visited));\n text-decoration: var(--link-textDecoration-visited);\n}\n\n/* Set color for hovered link */\n.saltLink:hover {\n color: var(--saltLink-color-hover, var(--link-color-hover));\n text-decoration: var(--link-textDecoration-hover);\n}\n\n/* Set color for active link */\n.saltLink:active {\n color: var(--saltLink-color-active, var(--link-color-active));\n text-decoration: var(--link-textDecoration-active);\n}\n\n/* Set color for focused link */\n.saltLink:focus {\n color: var(--saltLink-color-focus, var(--link-color-focus));\n outline: var(--salt-focused-outline);\n outline-color: var(--link-focus-outlineColor);\n text-decoration: var(--link-textDecoration-focus);\n}\n\n/* Class for ADA content - visually hidden but accessible to screen readers.\n Uses clip-path and prevents user selection so the text isn't included\n when users copy the link's visible content. */\n.saltLink-externalLinkADA {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n clip-path: inset(50%);\n white-space: nowrap;\n border: 0;\n user-select: none;\n -webkit-user-select: none;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=Link.css.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-fontFamily);\n line-height: var(--salt-text-lineHeight);\n letter-spacing: var(--salt-text-letterSpacing);\n cursor: var(--salt-cursor-hover);\n border-radius: var(--salt-palette-corner-weak);\n}\n\n.saltPageButton:hover,\n.saltPageButton:focus-visible {\n background: var(--salt-selectable-background-hover);\n}\n\n.saltPageButton:active {\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton:focus-visible {\n outline: var(--salt-focused-outline);\n}\n\n.saltPageButton:disabled {\n color: var(--salt-content-secondary-foreground);\n background: var(--salt-selectable-background);\n cursor: var(--salt-cursor-readonly);\n}\n\n.saltPageButton[aria-current=\"page\"] {\n border: var(--salt-size-fixed-100) var(--salt-borderStyle-solid) var(--salt-selectable-borderColor-selected);\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton-fixed {\n padding: 0;\n}\n";
|
|
1
|
+
var css_248z = ".saltPageButton {\n min-width: var(--salt-size-base);\n font-weight: var(--salt-text-fontWeight);\n height: var(--salt-size-base);\n color: var(--salt-content-primary-foreground);\n background: var(--salt-selectable-background);\n appearance: none;\n box-sizing: border-box;\n padding: 0 var(--salt-spacing-100);\n border: none;\n font-size: var(--salt-text-fontSize);\n font-family: var(--salt-text-fontFamily);\n line-height: var(--salt-text-lineHeight);\n letter-spacing: var(--salt-text-letterSpacing);\n cursor: var(--salt-cursor-hover);\n border-radius: var(--salt-palette-corner-weak);\n}\n\n.saltPageButton:hover,\n.saltPageButton:focus-visible {\n background: var(--salt-selectable-background-hover);\n}\n\n.saltPageButton:active {\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton:focus-visible {\n outline: var(--salt-focused-outline);\n position: relative;\n z-index: var(--salt-zIndex-default);\n}\n\n.saltPageButton:disabled {\n color: var(--salt-content-secondary-foreground);\n background: var(--salt-selectable-background);\n cursor: var(--salt-cursor-readonly);\n}\n\n.saltPageButton[aria-current=\"page\"] {\n border: var(--salt-size-fixed-100) var(--salt-borderStyle-solid) var(--salt-selectable-borderColor-selected);\n background: var(--salt-selectable-background-selected);\n}\n\n.saltPageButton-fixed {\n padding: 0;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=PageButton.css.js.map
|
|
@@ -5,7 +5,7 @@ import { isValidElement, cloneElement } from 'react';
|
|
|
5
5
|
import { useId } from '../utils/useId.js';
|
|
6
6
|
import { useIsomorphicLayoutEffect } from '../utils/useIsomorphicLayoutEffect.js';
|
|
7
7
|
|
|
8
|
-
const providerSymbol = Symbol.for("salt-provider");
|
|
8
|
+
const providerSymbol = /* @__PURE__ */ Symbol.for("salt-provider");
|
|
9
9
|
function ThemeApplicator({
|
|
10
10
|
applyClassesTo,
|
|
11
11
|
children,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeApplicator.js","sources":["../src/salt-provider/ThemeApplicator.tsx"],"sourcesContent":["import { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type ReactNode,\n} from \"react\";\nimport type {\n Accent,\n ActionFont,\n Corner,\n Density,\n HeadingFont,\n Mode,\n ThemeName,\n} from \"../theme/index\";\nimport { useId } from \"../utils/useId\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\n\nexport interface ThemeApplicatorProps {\n /**\n * Either \"root\", \"scope\" or \"child\".\n * Specifies the location of salt theme class and attributes should be applied to.\n *\n * Defaults to \"root\" for a root provider, otherwise \"scope\".\n */\n applyClassesTo: \"root\" | \"scope\" | \"child\";\n /**\n * Either \"high\", \"medium\", \"low\", \"touch\" or \"mobile\".\n * Determines the amount of content that can fit on a screen based on the size and spacing of components.\n * Refer to [density](https://www.saltdesignsystem.com/salt/foundations/density) doc for more detail.\n *\n * @default \"medium\"\n */\n density: Density;\n /**\n * A string. Specifies custom theme name(s) you want to apply, similar to `className`.\n */\n theme: ThemeName;\n /**\n * Either \"light\" or \"dark\". Enable the color palette to change from light to dark.\n * Refer to [modes](https://www.saltdesignsystem.com/salt/foundations/modes) doc for more detail.\n *\n * @default \"light\"\n */\n mode: Mode;\n /**\n * Either \"sharp\" or \"rounded\".\n * Determines selected components corner radius.\n * @default \"sharp\"\n */\n corner?: Corner;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of display and heading text.\n * @default \"Open Sans\"\n */\n headingFont?: HeadingFont;\n /**\n * Either \"blue\" or \"teal\".\n * Determines accent color used across components, e.g. Accent Button, List, Calendar.\n * @default \"blue\"\n */\n accent?: Accent;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of action components, mostly Buttons.\n * @default \"Open Sans\"\n */\n actionFont?: ActionFont;\n children?: ReactNode;\n}\n\nconst providerSymbol = Symbol.for(\"salt-provider\");\n\nexport function ThemeApplicator({\n applyClassesTo,\n children,\n density,\n mode,\n theme,\n corner,\n headingFont,\n accent,\n actionFont,\n}: ThemeApplicatorProps) {\n const targetWindow = useWindow();\n\n const providerId = useId();\n\n useIsomorphicLayoutEffect(() => {\n if (applyClassesTo !== \"root\" || !targetWindow || !providerId) return;\n\n const targetDocument: Document & { [providerSymbol]?: string } =\n targetWindow.document;\n\n // Claim the document if no other provider has already. The symbol is used so the lock isn't enumerable and guarantees it won't clash with anything else.\n if (!targetDocument[providerSymbol]) {\n targetDocument[providerSymbol] = providerId;\n }\n\n if (providerId !== targetDocument[providerSymbol]) {\n console.warn(\n \"Multiple providers targeting the same window. There can be only one level root level SaltProvider per window.\",\n );\n return;\n }\n\n const themeNames = theme.split(\" \");\n\n // add the styles we want to apply\n targetDocument.documentElement.classList.add(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = mode;\n\n // Theme Next\n if (corner) targetDocument.documentElement.dataset.corner = corner;\n if (headingFont)\n targetDocument.documentElement.dataset.headingFont = headingFont;\n if (accent) targetDocument.documentElement.dataset.accent = accent;\n if (actionFont)\n targetDocument.documentElement.dataset.actionFont = actionFont;\n\n return () => {\n // Delete lock\n delete targetDocument[providerSymbol];\n\n // When unmounting/remounting, remove the applied styles from the root\n targetDocument.documentElement.classList.remove(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = undefined;\n\n // Theme Next\n delete targetDocument.documentElement.dataset.corner;\n delete targetDocument.documentElement.dataset.headingFont;\n delete targetDocument.documentElement.dataset.accent;\n delete targetDocument.documentElement.dataset.actionFont;\n };\n }, [\n providerId,\n applyClassesTo,\n density,\n mode,\n theme,\n targetWindow,\n corner,\n headingFont,\n accent,\n actionFont,\n ]);\n\n const themeNextProps = {\n \"data-corner\": corner,\n \"data-heading-font\": headingFont,\n \"data-accent\": accent,\n \"data-action-font\": actionFont,\n };\n\n if (applyClassesTo === \"child\") {\n if (isValidElement<HTMLAttributes<HTMLElement>>(children)) {\n return cloneElement(children, {\n className: clsx(\n children.props?.className,\n theme,\n `salt-density-${density}`,\n ),\n // @ts-expect-error\n \"data-mode\": mode,\n ...themeNextProps,\n });\n }\n console.warn(\n `\\nSaltProvider can only apply CSS classes for theming to a single nested child element of the SaltProvider.\n Either wrap elements with a single container or consider removing the applyClassesToChild prop, in which case a\n div element will wrap your child elements`,\n );\n return children;\n }\n\n if (applyClassesTo === \"scope\") {\n return (\n <div\n className={clsx(\"salt-provider\", theme, `salt-density-${density}`)}\n data-mode={mode}\n {...themeNextProps}\n >\n {children}\n </div>\n );\n }\n\n return children;\n}\n"],"names":[],"mappings":";;;;;;;AA0EA,MAAM,cAAA,
|
|
1
|
+
{"version":3,"file":"ThemeApplicator.js","sources":["../src/salt-provider/ThemeApplicator.tsx"],"sourcesContent":["import { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport {\n cloneElement,\n type HTMLAttributes,\n isValidElement,\n type ReactNode,\n} from \"react\";\nimport type {\n Accent,\n ActionFont,\n Corner,\n Density,\n HeadingFont,\n Mode,\n ThemeName,\n} from \"../theme/index\";\nimport { useId } from \"../utils/useId\";\nimport { useIsomorphicLayoutEffect } from \"../utils/useIsomorphicLayoutEffect\";\n\nexport interface ThemeApplicatorProps {\n /**\n * Either \"root\", \"scope\" or \"child\".\n * Specifies the location of salt theme class and attributes should be applied to.\n *\n * Defaults to \"root\" for a root provider, otherwise \"scope\".\n */\n applyClassesTo: \"root\" | \"scope\" | \"child\";\n /**\n * Either \"high\", \"medium\", \"low\", \"touch\" or \"mobile\".\n * Determines the amount of content that can fit on a screen based on the size and spacing of components.\n * Refer to [density](https://www.saltdesignsystem.com/salt/foundations/density) doc for more detail.\n *\n * @default \"medium\"\n */\n density: Density;\n /**\n * A string. Specifies custom theme name(s) you want to apply, similar to `className`.\n */\n theme: ThemeName;\n /**\n * Either \"light\" or \"dark\". Enable the color palette to change from light to dark.\n * Refer to [modes](https://www.saltdesignsystem.com/salt/foundations/modes) doc for more detail.\n *\n * @default \"light\"\n */\n mode: Mode;\n /**\n * Either \"sharp\" or \"rounded\".\n * Determines selected components corner radius.\n * @default \"sharp\"\n */\n corner?: Corner;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of display and heading text.\n * @default \"Open Sans\"\n */\n headingFont?: HeadingFont;\n /**\n * Either \"blue\" or \"teal\".\n * Determines accent color used across components, e.g. Accent Button, List, Calendar.\n * @default \"blue\"\n */\n accent?: Accent;\n /**\n * Either \"Open Sans\" or \"Amplitude\".\n * Determines font family of action components, mostly Buttons.\n * @default \"Open Sans\"\n */\n actionFont?: ActionFont;\n children?: ReactNode;\n}\n\nconst providerSymbol = Symbol.for(\"salt-provider\");\n\nexport function ThemeApplicator({\n applyClassesTo,\n children,\n density,\n mode,\n theme,\n corner,\n headingFont,\n accent,\n actionFont,\n}: ThemeApplicatorProps) {\n const targetWindow = useWindow();\n\n const providerId = useId();\n\n useIsomorphicLayoutEffect(() => {\n if (applyClassesTo !== \"root\" || !targetWindow || !providerId) return;\n\n const targetDocument: Document & { [providerSymbol]?: string } =\n targetWindow.document;\n\n // Claim the document if no other provider has already. The symbol is used so the lock isn't enumerable and guarantees it won't clash with anything else.\n if (!targetDocument[providerSymbol]) {\n targetDocument[providerSymbol] = providerId;\n }\n\n if (providerId !== targetDocument[providerSymbol]) {\n console.warn(\n \"Multiple providers targeting the same window. There can be only one level root level SaltProvider per window.\",\n );\n return;\n }\n\n const themeNames = theme.split(\" \");\n\n // add the styles we want to apply\n targetDocument.documentElement.classList.add(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = mode;\n\n // Theme Next\n if (corner) targetDocument.documentElement.dataset.corner = corner;\n if (headingFont)\n targetDocument.documentElement.dataset.headingFont = headingFont;\n if (accent) targetDocument.documentElement.dataset.accent = accent;\n if (actionFont)\n targetDocument.documentElement.dataset.actionFont = actionFont;\n\n return () => {\n // Delete lock\n delete targetDocument[providerSymbol];\n\n // When unmounting/remounting, remove the applied styles from the root\n targetDocument.documentElement.classList.remove(\n ...themeNames,\n `salt-density-${density}`,\n );\n targetDocument.documentElement.dataset.mode = undefined;\n\n // Theme Next\n delete targetDocument.documentElement.dataset.corner;\n delete targetDocument.documentElement.dataset.headingFont;\n delete targetDocument.documentElement.dataset.accent;\n delete targetDocument.documentElement.dataset.actionFont;\n };\n }, [\n providerId,\n applyClassesTo,\n density,\n mode,\n theme,\n targetWindow,\n corner,\n headingFont,\n accent,\n actionFont,\n ]);\n\n const themeNextProps = {\n \"data-corner\": corner,\n \"data-heading-font\": headingFont,\n \"data-accent\": accent,\n \"data-action-font\": actionFont,\n };\n\n if (applyClassesTo === \"child\") {\n if (isValidElement<HTMLAttributes<HTMLElement>>(children)) {\n return cloneElement(children, {\n className: clsx(\n children.props?.className,\n theme,\n `salt-density-${density}`,\n ),\n // @ts-expect-error\n \"data-mode\": mode,\n ...themeNextProps,\n });\n }\n console.warn(\n `\\nSaltProvider can only apply CSS classes for theming to a single nested child element of the SaltProvider.\n Either wrap elements with a single container or consider removing the applyClassesToChild prop, in which case a\n div element will wrap your child elements`,\n );\n return children;\n }\n\n if (applyClassesTo === \"scope\") {\n return (\n <div\n className={clsx(\"salt-provider\", theme,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,EAAW,IAAA;AAAA,UAAA,CACT,EAAA,GAAA,QAAA,CAAS,UAAT,IAAA,GAAA,MAAA,GAAA,EAAA,CAAgB,SAAA;AAAA,UAChB,KAAA;AAAA,UACA,gBAAgB,OAAO,CAAA;AAAA,SACzB;AAAA;AAAA,QAEA,WAAA,EAAa,IAAA;AAAA,QACb,GAAG;AAAA,OACJ,CAAA;AAAA,IACH;AACA,IAAA,OAAA,CAAQ,IAAA;AAAA,MACN;AAAA;AAAA;AAAA,iDAAA;AAAA,KAGF;AACA,IAAA,OAAO,QAAA;AAAA,EACT;AAEA,EAAA,IAAI,mBAAmB,OAAA,EAAS;AAC9B,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,WAAW,IAAA,CAAK,eAAA,EAAiB,KAAA,EAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAE,CAAA;AAAA,QACjE,WAAA,EAAW,IAAA;AAAA,QACV,GAAG,cAAA;AAAA,QAEH;AAAA;AAAA,KACH;AAAA,EAEJ;AAEA,EAAA,OAAO,QAAA;AACT;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type FloatingFocusManager } from "@floating-ui/react";
|
|
1
2
|
import { type ComponentPropsWithoutRef } from "react";
|
|
2
3
|
export interface DrawerProps extends ComponentPropsWithoutRef<"div"> {
|
|
3
4
|
/**
|
|
@@ -24,5 +25,10 @@ export interface DrawerProps extends ComponentPropsWithoutRef<"div"> {
|
|
|
24
25
|
* Prevent Scrim from rendering
|
|
25
26
|
* */
|
|
26
27
|
disableScrim?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Which element to initially focus. Can be either a number (tabbable index as specified by the order) or a ref.
|
|
30
|
+
* Default value is 0 (first tabbable element).
|
|
31
|
+
* */
|
|
32
|
+
initialFocus?: ComponentPropsWithoutRef<typeof FloatingFocusManager>["initialFocus"];
|
|
27
33
|
}
|
|
28
34
|
export declare const Drawer: import("react").ForwardRefExoticComponent<DrawerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type ChangeEvent, type
|
|
2
|
-
|
|
1
|
+
import { type ChangeEvent, type ComponentPropsWithoutRef } from "react";
|
|
2
|
+
import { type ButtonProps } from "../button";
|
|
3
|
+
export interface FileDropZoneTriggerProps extends Omit<ComponentPropsWithoutRef<"button">, "onChange"> {
|
|
3
4
|
/**
|
|
4
5
|
* `accept` attribute for HTML <input>.
|
|
5
6
|
*
|
|
@@ -18,5 +19,16 @@ export interface FileDropZoneTriggerProps extends Omit<HTMLAttributes<HTMLButton
|
|
|
18
19
|
* Callback for input change event
|
|
19
20
|
*/
|
|
20
21
|
onChange?: (event: ChangeEvent<HTMLInputElement>, files: File[]) => void;
|
|
22
|
+
/**
|
|
23
|
+
* The appearance of the button. Options are 'solid', 'bordered', and 'transparent'.
|
|
24
|
+
* 'solid' is the default value.
|
|
25
|
+
*/
|
|
26
|
+
appearance?: ButtonProps["appearance"];
|
|
27
|
+
/**
|
|
28
|
+
* The sentiment of the button. Options are 'accented' and 'neutral'.
|
|
29
|
+
* 'neutral' is the default value.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
sentiment?: Extract<ButtonProps["sentiment"], "accented" | "neutral">;
|
|
21
33
|
}
|
|
22
34
|
export declare const FileDropZoneTrigger: import("react").ForwardRefExoticComponent<FileDropZoneTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
|