@salt-ds/core 0.0.0-snapshot-20230426154040 → 0.0.0-snapshot-20230504082840
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/packages/core/src/avatar/Avatar.js +9 -1
- package/dist-cjs/packages/core/src/avatar/Avatar.js.map +1 -1
- package/dist-cjs/packages/core/src/border-item/BorderItem.js +9 -1
- package/dist-cjs/packages/core/src/border-item/BorderItem.js.map +1 -1
- package/dist-cjs/packages/core/src/button/Button.js +9 -1
- package/dist-cjs/packages/core/src/button/Button.js.map +1 -1
- package/dist-cjs/packages/core/src/card/Card.js +10 -2
- package/dist-cjs/packages/core/src/card/Card.js.map +1 -1
- package/dist-cjs/packages/core/src/card/InteractableCard.css.js +1 -1
- package/dist-cjs/packages/core/src/flex-item/FlexItem.js +9 -1
- package/dist-cjs/packages/core/src/flex-item/FlexItem.js.map +1 -1
- package/dist-cjs/packages/core/src/flex-layout/FlexLayout.js +9 -1
- package/dist-cjs/packages/core/src/flex-layout/FlexLayout.js.map +1 -1
- package/dist-cjs/packages/core/src/grid-item/GridItem.js +9 -1
- package/dist-cjs/packages/core/src/grid-item/GridItem.js.map +1 -1
- package/dist-cjs/packages/core/src/grid-layout/GridLayout.js +9 -1
- package/dist-cjs/packages/core/src/grid-layout/GridLayout.js.map +1 -1
- package/dist-cjs/packages/core/src/link/Link.js +9 -1
- package/dist-cjs/packages/core/src/link/Link.js.map +1 -1
- package/dist-cjs/packages/core/src/panel/Panel.js +9 -1
- package/dist-cjs/packages/core/src/panel/Panel.js.map +1 -1
- package/dist-cjs/packages/core/src/salt-provider/SaltProvider.js +13 -5
- package/dist-cjs/packages/core/src/salt-provider/SaltProvider.js.map +1 -1
- package/dist-cjs/packages/core/src/spinner/Spinner.js +9 -1
- package/dist-cjs/packages/core/src/spinner/Spinner.js.map +1 -1
- package/dist-cjs/packages/core/src/stack-layout/StackLayout.js +9 -1
- package/dist-cjs/packages/core/src/stack-layout/StackLayout.js.map +1 -1
- package/dist-cjs/packages/core/src/status-indicator/StatusIndicator.js +9 -1
- package/dist-cjs/packages/core/src/status-indicator/StatusIndicator.js.map +1 -1
- package/dist-cjs/packages/core/src/text/Text.js +9 -1
- package/dist-cjs/packages/core/src/text/Text.js.map +1 -1
- package/dist-cjs/packages/core/src/tooltip/Tooltip.css.js +1 -1
- package/dist-cjs/packages/core/src/tooltip/Tooltip.js +9 -1
- package/dist-cjs/packages/core/src/tooltip/Tooltip.js.map +1 -1
- package/dist-es/packages/core/src/avatar/Avatar.js +9 -1
- package/dist-es/packages/core/src/avatar/Avatar.js.map +1 -1
- package/dist-es/packages/core/src/border-item/BorderItem.js +9 -1
- package/dist-es/packages/core/src/border-item/BorderItem.js.map +1 -1
- package/dist-es/packages/core/src/button/Button.js +9 -1
- package/dist-es/packages/core/src/button/Button.js.map +1 -1
- package/dist-es/packages/core/src/card/Card.js +10 -2
- package/dist-es/packages/core/src/card/Card.js.map +1 -1
- package/dist-es/packages/core/src/card/InteractableCard.css.js +1 -1
- package/dist-es/packages/core/src/flex-item/FlexItem.js +9 -1
- package/dist-es/packages/core/src/flex-item/FlexItem.js.map +1 -1
- package/dist-es/packages/core/src/flex-layout/FlexLayout.js +9 -1
- package/dist-es/packages/core/src/flex-layout/FlexLayout.js.map +1 -1
- package/dist-es/packages/core/src/grid-item/GridItem.js +9 -1
- package/dist-es/packages/core/src/grid-item/GridItem.js.map +1 -1
- package/dist-es/packages/core/src/grid-layout/GridLayout.js +9 -1
- package/dist-es/packages/core/src/grid-layout/GridLayout.js.map +1 -1
- package/dist-es/packages/core/src/link/Link.js +9 -1
- package/dist-es/packages/core/src/link/Link.js.map +1 -1
- package/dist-es/packages/core/src/panel/Panel.js +9 -1
- package/dist-es/packages/core/src/panel/Panel.js.map +1 -1
- package/dist-es/packages/core/src/salt-provider/SaltProvider.js +13 -5
- package/dist-es/packages/core/src/salt-provider/SaltProvider.js.map +1 -1
- package/dist-es/packages/core/src/spinner/Spinner.js +9 -1
- package/dist-es/packages/core/src/spinner/Spinner.js.map +1 -1
- package/dist-es/packages/core/src/stack-layout/StackLayout.js +9 -1
- package/dist-es/packages/core/src/stack-layout/StackLayout.js.map +1 -1
- package/dist-es/packages/core/src/status-indicator/StatusIndicator.js +9 -1
- package/dist-es/packages/core/src/status-indicator/StatusIndicator.js.map +1 -1
- package/dist-es/packages/core/src/text/Text.js +9 -1
- package/dist-es/packages/core/src/text/Text.js.map +1 -1
- package/dist-es/packages/core/src/tooltip/Tooltip.css.js +1 -1
- package/dist-es/packages/core/src/tooltip/Tooltip.js +9 -1
- package/dist-es/packages/core/src/tooltip/Tooltip.js.map +1 -1
- package/dist-types/avatar/Avatar.d.ts +0 -1
- package/dist-types/border-item/BorderItem.d.ts +0 -1
- package/dist-types/button/Button.d.ts +0 -1
- package/dist-types/card/Card.d.ts +0 -1
- package/dist-types/flex-item/FlexItem.d.ts +0 -1
- package/dist-types/flex-layout/FlexLayout.d.ts +0 -1
- package/dist-types/grid-item/GridItem.d.ts +0 -1
- package/dist-types/grid-layout/GridLayout.d.ts +0 -1
- package/dist-types/link/Link.d.ts +0 -1
- package/dist-types/panel/Panel.d.ts +0 -1
- package/dist-types/salt-provider/SaltProvider.d.ts +0 -1
- package/dist-types/spinner/Spinner.d.ts +0 -1
- package/dist-types/stack-layout/StackLayout.d.ts +0 -1
- package/dist-types/status-indicator/StatusIndicator.d.ts +0 -1
- package/dist-types/text/Text.d.ts +0 -1
- package/dist-types/tooltip/Tooltip.d.ts +1 -2
- package/package.json +4 -2
|
@@ -4,6 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var icons = require('@salt-ds/icons');
|
|
7
|
+
var window = require('@salt-ds/window');
|
|
8
|
+
var styles = require('@salt-ds/styles');
|
|
7
9
|
var clsx = require('clsx');
|
|
8
10
|
var React = require('react');
|
|
9
11
|
var useAvatarImage = require('./useAvatarImage.js');
|
|
@@ -12,7 +14,7 @@ require('../utils/useFloatingUI.js');
|
|
|
12
14
|
require('../utils/useId.js');
|
|
13
15
|
require('../salt-provider/SaltProvider.js');
|
|
14
16
|
require('../viewport/ViewportProvider.js');
|
|
15
|
-
require('./Avatar.css.js');
|
|
17
|
+
var Avatar$1 = require('./Avatar.css.js');
|
|
16
18
|
|
|
17
19
|
const withBaseName = makePrefixer.makePrefixer("saltAvatar");
|
|
18
20
|
const DEFAULT_AVATAR_SIZE = 2;
|
|
@@ -30,6 +32,12 @@ const Avatar = React.forwardRef(function Avatar2({
|
|
|
30
32
|
}),
|
|
31
33
|
...rest
|
|
32
34
|
}, ref) {
|
|
35
|
+
const { window: targetWindow } = window.useWindow();
|
|
36
|
+
styles.useComponentCssInjection({
|
|
37
|
+
id: "salt-avatar",
|
|
38
|
+
css: Avatar$1,
|
|
39
|
+
window: targetWindow
|
|
40
|
+
});
|
|
33
41
|
let children;
|
|
34
42
|
const style = {
|
|
35
43
|
...styleProp,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.js","sources":["../src/avatar/Avatar.tsx"],"sourcesContent":["import { UserSolidIcon } from \"@salt-ds/icons\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, ReactNode } from \"react\";\nimport { useAvatarImage } from \"./useAvatarImage\";\nimport { makePrefixer } from \"../utils\";\
|
|
1
|
+
{"version":3,"file":"Avatar.js","sources":["../src/avatar/Avatar.tsx"],"sourcesContent":["import { UserSolidIcon } from \"@salt-ds/icons\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, ReactNode } from \"react\";\nimport { useAvatarImage } from \"./useAvatarImage\";\n\nimport { makePrefixer } from \"../utils\";\nimport avatarCss from \"./Avatar.css\";\n\nexport type NameToInitials = (name?: string) => string;\n\nexport interface AvatarProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * The name that Avatar represents.\n */\n name?: string;\n /**\n * Defines the function that gets initials. Default is capital first letter of each separate word in name.\n * If a function is not passed or returns undefined, Avatar will default to Icon.\n */\n nameToInitials?: NameToInitials;\n /**\n * Image src of Avatar.\n */\n src?: string;\n /**\n * Multiplier for the base avatar.\n */\n size?: number;\n /**\n * Icon to be used as a default item. Defaults to `UserIcon`\n */\n fallbackIcon?: ReactNode;\n}\n\nconst withBaseName = makePrefixer(\"saltAvatar\");\nconst DEFAULT_AVATAR_SIZE = 2; // medium\n\nconst defaultNameToInitials = (name?: string) =>\n name\n ?.split(\" \")\n .slice(0, 2)\n .map((n) => n[0])\n .join(\"\")\n .toUpperCase();\n\nexport const Avatar = forwardRef<HTMLDivElement, AvatarProps>(function Avatar(\n {\n className,\n children: childrenProp,\n name,\n nameToInitials = defaultNameToInitials,\n src,\n size = DEFAULT_AVATAR_SIZE,\n style: styleProp,\n fallbackIcon = <UserSolidIcon aria-label=\"User Avatar\" />,\n ...rest\n },\n ref\n) {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-avatar\",\n css: avatarCss,\n window: targetWindow,\n });\n\n let children;\n\n const style = {\n ...styleProp,\n \"--saltAvatar-size-multiplier\": `${size}`,\n };\n\n const status = useAvatarImage({ src });\n const hasImgNotFailing = status === \"loaded\";\n if (hasImgNotFailing) {\n children = <img alt={name} src={src} />;\n } else if (childrenProp != null) {\n children = childrenProp;\n }\n\n const avatarInitials = nameToInitials(name);\n\n const initialsProps = avatarInitials\n ? {\n role: \"img\",\n \"aria-label\": name,\n }\n : {};\n\n return (\n <div\n ref={ref}\n style={style}\n className={clsx(\n withBaseName(),\n { [withBaseName(\"withImage\")]: hasImgNotFailing },\n className\n )}\n {...initialsProps}\n {...rest}\n >\n {children || avatarInitials || fallbackIcon}\n </div>\n );\n});\n"],"names":["makePrefixer","forwardRef","Avatar","jsx","UserSolidIcon","useWindow","useComponentCssInjection","avatarCss","useAvatarImage","clsx"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,MAAM,YAAA,GAAeA,0BAAa,YAAY,CAAA,CAAA;AAC9C,MAAM,mBAAsB,GAAA,CAAA,CAAA;AAE5B,MAAM,qBAAwB,GAAA,CAAC,IAC7B,KAAA,IAAA,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,IAAA,CACI,MAAM,GACP,CAAA,CAAA,KAAA,CAAM,CAAG,EAAA,CAAA,CAAA,CACT,IAAI,CAAC,CAAA,KAAM,CAAE,CAAA,CAAA,CAAA,CAAA,CACb,KAAK,EACL,CAAA,CAAA,WAAA,EAAA,CAAA;AAEQ,MAAA,MAAA,GAASC,gBAAwC,CAAA,SAASC,OACrE,CAAA;AAAA,EACE,SAAA;AAAA,EACA,QAAU,EAAA,YAAA;AAAA,EACV,IAAA;AAAA,EACA,cAAiB,GAAA,qBAAA;AAAA,EACjB,GAAA;AAAA,EACA,IAAO,GAAA,mBAAA;AAAA,EACP,KAAO,EAAA,SAAA;AAAA,EACP,+BAAgBC,cAAA,CAAAC,mBAAA,EAAA;AAAA,IAAc,YAAW,EAAA,aAAA;AAAA,GAAc,CAAA;AAAA,EACpD,GAAA,IAAA;AACL,CAAA,EACA,GACA,EAAA;AACA,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,EAAyBC,+BAAA,CAAA;AAAA,IACvB,EAAI,EAAA,aAAA;AAAA,IACJ,GAAK,EAAAC,QAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAI,IAAA,QAAA,CAAA;AAEJ,EAAA,MAAM,KAAQ,GAAA;AAAA,IACZ,GAAG,SAAA;AAAA,IACH,gCAAgC,CAAG,EAAA,IAAA,CAAA,CAAA;AAAA,GACrC,CAAA;AAEA,EAAA,MAAM,MAAS,GAAAC,6BAAA,CAAe,EAAE,GAAA,EAAK,CAAA,CAAA;AACrC,EAAA,MAAM,mBAAmB,MAAW,KAAA,QAAA,CAAA;AACpC,EAAA,IAAI,gBAAkB,EAAA;AACpB,IAAA,QAAA,mBAAYL,cAAA,CAAA,KAAA,EAAA;AAAA,MAAI,GAAK,EAAA,IAAA;AAAA,MAAM,GAAA;AAAA,KAAU,CAAA,CAAA;AAAA,GACvC,MAAA,IAAW,gBAAgB,IAAM,EAAA;AAC/B,IAAW,QAAA,GAAA,YAAA,CAAA;AAAA,GACb;AAEA,EAAM,MAAA,cAAA,GAAiB,eAAe,IAAI,CAAA,CAAA;AAE1C,EAAA,MAAM,gBAAgB,cAClB,GAAA;AAAA,IACE,IAAM,EAAA,KAAA;AAAA,IACN,YAAc,EAAA,IAAA;AAAA,MAEhB,EAAC,CAAA;AAEL,EAAA,uBACGA,cAAA,CAAA,KAAA,EAAA;AAAA,IACC,GAAA;AAAA,IACA,KAAA;AAAA,IACA,SAAW,EAAAM,SAAA;AAAA,MACT,YAAa,EAAA;AAAA,MACb,EAAE,CAAC,YAAa,CAAA,WAAW,IAAI,gBAAiB,EAAA;AAAA,MAChD,SAAA;AAAA,KACF;AAAA,IACC,GAAG,aAAA;AAAA,IACH,GAAG,IAAA;AAAA,IAEH,sBAAY,cAAkB,IAAA,YAAA;AAAA,GACjC,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -6,12 +6,14 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var clsx = require('clsx');
|
|
8
8
|
var GridItem = require('../grid-item/GridItem.js');
|
|
9
|
-
require('./BorderItem.css.js');
|
|
9
|
+
var BorderItem$1 = require('./BorderItem.css.js');
|
|
10
10
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
11
11
|
require('../utils/useFloatingUI.js');
|
|
12
12
|
require('../utils/useId.js');
|
|
13
13
|
require('../salt-provider/SaltProvider.js');
|
|
14
14
|
require('../viewport/ViewportProvider.js');
|
|
15
|
+
var window = require('@salt-ds/window');
|
|
16
|
+
var styles = require('@salt-ds/styles');
|
|
15
17
|
|
|
16
18
|
const BORDER_POSITION = [
|
|
17
19
|
"north",
|
|
@@ -30,6 +32,12 @@ const BorderItem = React.forwardRef(
|
|
|
30
32
|
style,
|
|
31
33
|
...rest
|
|
32
34
|
}, ref) => {
|
|
35
|
+
const { window: targetWindow } = window.useWindow();
|
|
36
|
+
styles.useComponentCssInjection({
|
|
37
|
+
id: "salt-border-item",
|
|
38
|
+
css: BorderItem$1,
|
|
39
|
+
window: targetWindow
|
|
40
|
+
});
|
|
33
41
|
const gridItemStyles = {
|
|
34
42
|
...style,
|
|
35
43
|
"--gridItem-gridArea": position
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BorderItem.js","sources":["../src/border-item/BorderItem.tsx"],"sourcesContent":["import { forwardRef, ElementType, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\nimport { GridItem, GridItemProps } from \"../grid-item\";\nimport \"./BorderItem.css\";\nimport {\n makePrefixer,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\n\nexport const BORDER_POSITION = [\n \"north\",\n \"west\",\n \"center\",\n \"east\",\n \"south\",\n] as const;\n\nexport type BorderPosition = typeof BORDER_POSITION[number];\n\nexport type BorderItemProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Aligns a grid item inside a cell along the inline (row) axis. Defaults to \"stretch\"\n */\n horizontalAlignment?: GridItemProps<T>[\"horizontalAlignment\"];\n /**\n * Aligns a grid item inside a cell along the block (column) axis. Defaults to \"stretch\"\n */\n verticalAlignment?: GridItemProps<T>[\"verticalAlignment\"];\n /**\n * Position in the Border Layout\n */\n position: BorderPosition;\n /**\n * Defines if the item should stick to the edges of its container. Defaults to \"false\"\n */\n sticky?: boolean;\n }\n >;\n\nconst withBaseName = makePrefixer(\"saltBorderItem\");\n\ntype BorderItemComponent = <T extends ElementType = \"div\">(\n props: BorderItemProps<T>\n) => ReactElement | null;\n\nexport const BorderItem: BorderItemComponent = forwardRef(\n <T extends ElementType>(\n {\n children,\n className,\n position,\n sticky = false,\n style,\n ...rest\n }: BorderItemProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const gridItemStyles = {\n ...style,\n \"--gridItem-gridArea\": position,\n };\n\n return (\n <GridItem\n ref={ref}\n className={clsx(\n withBaseName(),\n \"saltGridItem-area\",\n {\n [withBaseName(\"sticky\")]: sticky,\n },\n className\n )}\n style={gridItemStyles}\n {...rest}\n >\n {children}\n </GridItem>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","jsx","GridItem","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"BorderItem.js","sources":["../src/border-item/BorderItem.tsx"],"sourcesContent":["import { forwardRef, ElementType, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\nimport { GridItem, GridItemProps } from \"../grid-item\";\nimport borderItemCss from \"./BorderItem.css\";\nimport {\n makePrefixer,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nexport const BORDER_POSITION = [\n \"north\",\n \"west\",\n \"center\",\n \"east\",\n \"south\",\n] as const;\n\nexport type BorderPosition = typeof BORDER_POSITION[number];\n\nexport type BorderItemProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Aligns a grid item inside a cell along the inline (row) axis. Defaults to \"stretch\"\n */\n horizontalAlignment?: GridItemProps<T>[\"horizontalAlignment\"];\n /**\n * Aligns a grid item inside a cell along the block (column) axis. Defaults to \"stretch\"\n */\n verticalAlignment?: GridItemProps<T>[\"verticalAlignment\"];\n /**\n * Position in the Border Layout\n */\n position: BorderPosition;\n /**\n * Defines if the item should stick to the edges of its container. Defaults to \"false\"\n */\n sticky?: boolean;\n }\n >;\n\nconst withBaseName = makePrefixer(\"saltBorderItem\");\n\ntype BorderItemComponent = <T extends ElementType = \"div\">(\n props: BorderItemProps<T>\n) => ReactElement | null;\n\nexport const BorderItem: BorderItemComponent = forwardRef(\n <T extends ElementType>(\n {\n children,\n className,\n position,\n sticky = false,\n style,\n ...rest\n }: BorderItemProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-border-item\",\n css: borderItemCss,\n window: targetWindow,\n });\n\n const gridItemStyles = {\n ...style,\n \"--gridItem-gridArea\": position,\n };\n\n return (\n <GridItem\n ref={ref}\n className={clsx(\n withBaseName(),\n \"saltGridItem-area\",\n {\n [withBaseName(\"sticky\")]: sticky,\n },\n className\n )}\n style={gridItemStyles}\n {...rest}\n >\n {children}\n </GridItem>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","borderItemCss","jsx","GridItem","clsx"],"mappings":";;;;;;;;;;;;;;;;;AAYO,MAAM,eAAkB,GAAA;AAAA,EAC7B,OAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AACF,EAAA;AA2BA,MAAM,YAAA,GAAeA,0BAAa,gBAAgB,CAAA,CAAA;AAM3C,MAAM,UAAkC,GAAAC,gBAAA;AAAA,EAC7C,CACE;AAAA,IACE,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAS,GAAA,KAAA;AAAA,IACT,KAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,IAAyBC,+BAAA,CAAA;AAAA,MACvB,EAAI,EAAA,kBAAA;AAAA,MACJ,GAAK,EAAAC,YAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,MAAM,cAAiB,GAAA;AAAA,MACrB,GAAG,KAAA;AAAA,MACH,qBAAuB,EAAA,QAAA;AAAA,KACzB,CAAA;AAEA,IAAA,uBACGC,cAAA,CAAAC,iBAAA,EAAA;AAAA,MACC,GAAA;AAAA,MACA,SAAW,EAAAC,SAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb,mBAAA;AAAA,QACA;AAAA,UACE,CAAC,YAAa,CAAA,QAAQ,CAAI,GAAA,MAAA;AAAA,SAC5B;AAAA,QACA,SAAA;AAAA,OACF;AAAA,MACA,KAAO,EAAA,cAAA;AAAA,MACN,GAAG,IAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;;"}
|
|
@@ -5,12 +5,14 @@ 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 styles = require('@salt-ds/styles');
|
|
9
|
+
var window = require('@salt-ds/window');
|
|
8
10
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
9
11
|
require('../utils/useFloatingUI.js');
|
|
10
12
|
require('../utils/useId.js');
|
|
11
13
|
require('../salt-provider/SaltProvider.js');
|
|
12
14
|
require('../viewport/ViewportProvider.js');
|
|
13
|
-
require('./Button.css.js');
|
|
15
|
+
var Button$1 = require('./Button.css.js');
|
|
14
16
|
var useButton = require('./useButton.js');
|
|
15
17
|
|
|
16
18
|
const withBaseName = makePrefixer.makePrefixer("saltButton");
|
|
@@ -37,6 +39,12 @@ const Button = React.forwardRef(
|
|
|
37
39
|
onBlur,
|
|
38
40
|
onClick
|
|
39
41
|
});
|
|
42
|
+
const { window: targetWindow } = window.useWindow();
|
|
43
|
+
styles.useComponentCssInjection({
|
|
44
|
+
id: "salt-button",
|
|
45
|
+
css: Button$1,
|
|
46
|
+
window: targetWindow
|
|
47
|
+
});
|
|
40
48
|
const { tabIndex, ...restButtonProps } = buttonProps;
|
|
41
49
|
return /* @__PURE__ */ jsxRuntime.jsx("button", {
|
|
42
50
|
...restButtonProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../src/button/Button.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\nimport { makePrefixer } from \"../utils\";\n\nimport \"./Button.css\";\nimport { useButton } from \"./useButton\";\n\nconst withBaseName = makePrefixer(\"saltButton\");\n\nexport const ButtonVariantValues = [\"primary\", \"secondary\", \"cta\"] as const;\nexport type ButtonVariant = typeof ButtonVariantValues[number];\n\nexport interface ButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n /**\n * If `true`, the button will be disabled.\n */\n disabled?: boolean;\n /**\n * If `true`, the button will be focusable when disabled.\n */\n focusableWhenDisabled?: boolean;\n /**\n * The variant to use. Options are 'primary', 'secondary' and 'cta'.\n * 'primary' is the default value.\n */\n variant?: ButtonVariant;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n {\n children,\n className,\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n type = \"button\",\n variant = \"primary\",\n ...restProps\n },\n ref?\n ): ReactElement<ButtonProps> {\n const { active, buttonProps } = useButton({\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n });\n // we do not want to spread tab index in this case because the button element\n // does not require tabindex=\"0\" attribute\n const { tabIndex, ...restButtonProps } = buttonProps;\n return (\n <button\n {...restButtonProps}\n className={clsx(\n withBaseName(),\n withBaseName(variant),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"active\")]: active,\n },\n className\n )}\n {...restProps}\n ref={ref}\n type={type}\n >\n {children}\n </button>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","Button","useButton","jsx","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../src/button/Button.tsx"],"sourcesContent":["import { ComponentPropsWithoutRef, forwardRef, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { makePrefixer } from \"../utils\";\n\nimport buttonCss from \"./Button.css\";\nimport { useButton } from \"./useButton\";\n\nconst withBaseName = makePrefixer(\"saltButton\");\n\nexport const ButtonVariantValues = [\"primary\", \"secondary\", \"cta\"] as const;\nexport type ButtonVariant = typeof ButtonVariantValues[number];\n\nexport interface ButtonProps extends ComponentPropsWithoutRef<\"button\"> {\n /**\n * If `true`, the button will be disabled.\n */\n disabled?: boolean;\n /**\n * If `true`, the button will be focusable when disabled.\n */\n focusableWhenDisabled?: boolean;\n /**\n * The variant to use. Options are 'primary', 'secondary' and 'cta'.\n * 'primary' is the default value.\n */\n variant?: ButtonVariant;\n}\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(\n function Button(\n {\n children,\n className,\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n type = \"button\",\n variant = \"primary\",\n ...restProps\n },\n ref?\n ): ReactElement<ButtonProps> {\n const { active, buttonProps } = useButton({\n disabled,\n focusableWhenDisabled,\n onKeyUp,\n onKeyDown,\n onBlur,\n onClick,\n });\n\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-button\",\n css: buttonCss,\n window: targetWindow,\n });\n\n // we do not want to spread tab index in this case because the button element\n // does not require tabindex=\"0\" attribute\n const { tabIndex, ...restButtonProps } = buttonProps;\n return (\n <button\n {...restButtonProps}\n className={clsx(\n withBaseName(),\n withBaseName(variant),\n {\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"active\")]: active,\n },\n className\n )}\n {...restProps}\n ref={ref}\n type={type}\n >\n {children}\n </button>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","Button","useButton","useWindow","useComponentCssInjection","buttonCss","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;;;AASA,MAAM,YAAA,GAAeA,0BAAa,YAAY,CAAA,CAAA;AAEvC,MAAM,mBAAsB,GAAA,CAAC,SAAW,EAAA,WAAA,EAAa,KAAK,EAAA;AAmB1D,MAAM,MAAS,GAAAC,gBAAA;AAAA,EACpB,SAASC,OACP,CAAA;AAAA,IACE,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,qBAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,IAAO,GAAA,QAAA;AAAA,IACP,OAAU,GAAA,SAAA;AAAA,IACP,GAAA,SAAA;AAAA,KAEL,GAC2B,EAAA;AAC3B,IAAA,MAAM,EAAE,MAAA,EAAQ,WAAY,EAAA,GAAIC,mBAAU,CAAA;AAAA,MACxC,QAAA;AAAA,MACA,qBAAA;AAAA,MACA,OAAA;AAAA,MACA,SAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA;AAAA,KACD,CAAA,CAAA;AAED,IAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,IAAyBC,+BAAA,CAAA;AAAA,MACvB,EAAI,EAAA,aAAA;AAAA,MACJ,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAID,IAAM,MAAA,EAAE,QAAa,EAAA,GAAA,eAAA,EAAoB,GAAA,WAAA,CAAA;AACzC,IAAA,uBACGC,cAAA,CAAA,QAAA,EAAA;AAAA,MACE,GAAG,eAAA;AAAA,MACJ,SAAW,EAAAC,SAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb,aAAa,OAAO,CAAA;AAAA,QACpB;AAAA,UACE,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,UAC5B,CAAC,YAAa,CAAA,QAAQ,CAAI,GAAA,MAAA;AAAA,SAC5B;AAAA,QACA,SAAA;AAAA,OACF;AAAA,MACC,GAAG,SAAA;AAAA,MACJ,GAAA;AAAA,MACA,IAAA;AAAA,MAEC,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;;"}
|
|
@@ -5,16 +5,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var clsx = require('clsx');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var window = require('@salt-ds/window');
|
|
9
|
+
var styles = require('@salt-ds/styles');
|
|
8
10
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
9
11
|
require('../utils/useFloatingUI.js');
|
|
10
12
|
require('../utils/useId.js');
|
|
11
13
|
require('../salt-provider/SaltProvider.js');
|
|
12
14
|
require('../viewport/ViewportProvider.js');
|
|
13
|
-
require('./Card.css.js');
|
|
15
|
+
var Card$1 = require('./Card.css.js');
|
|
14
16
|
|
|
15
17
|
const withBaseName = makePrefixer.makePrefixer("saltCard");
|
|
16
18
|
const Card = React.forwardRef(function Card2(props, ref) {
|
|
17
|
-
const { className,
|
|
19
|
+
const { className, disabled, interactable, children, ...rest } = props;
|
|
20
|
+
const { window: targetWindow } = window.useWindow();
|
|
21
|
+
styles.useComponentCssInjection({
|
|
22
|
+
id: "salt-card",
|
|
23
|
+
css: Card$1,
|
|
24
|
+
window: targetWindow
|
|
25
|
+
});
|
|
18
26
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
19
27
|
className: clsx.clsx(
|
|
20
28
|
withBaseName(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.js","sources":["../src/card/Card.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { makePrefixer } from \"../utils\";\nimport \"./Card.css\";\n\nconst withBaseName = makePrefixer(\"saltCard\");\nexport interface CardProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * **Deprecated:** Use the InteractableCard component instead\n *\n * If `true`, the card will be disabled.\n */\n disabled?: boolean;\n /**\n * **Deprecated:** Use the InteractableCard component instead\n *\n * If `true`, interactive styles will be applied to `Card`. These styles give prominence to certain content\n * on the page.\n */\n interactable?: boolean;\n}\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n props,\n ref\n) {\n const { className,
|
|
1
|
+
{"version":3,"file":"Card.js","sources":["../src/card/Card.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { ComponentPropsWithoutRef, forwardRef } from \"react\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport { makePrefixer } from \"../utils\";\n\nimport cardCss from \"./Card.css\";\n\nconst withBaseName = makePrefixer(\"saltCard\");\nexport interface CardProps extends ComponentPropsWithoutRef<\"div\"> {\n /**\n * **Deprecated:** Use the InteractableCard component instead\n *\n * If `true`, the card will be disabled.\n */\n disabled?: boolean;\n /**\n * **Deprecated:** Use the InteractableCard component instead\n *\n * If `true`, interactive styles will be applied to `Card`. These styles give prominence to certain content\n * on the page.\n */\n interactable?: boolean;\n}\n\nexport const Card = forwardRef<HTMLDivElement, CardProps>(function Card(\n props,\n ref\n) {\n const { className, disabled, interactable, children, ...rest } = props;\n\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-card\",\n css: cardCss,\n window: targetWindow,\n });\n\n return (\n <div\n className={clsx(\n withBaseName(),\n {\n /* **Deprecated:** InteractableCard should be used instead for these features */\n [withBaseName(\"disabled\")]: disabled,\n [withBaseName(\"interactable\")]: interactable,\n },\n className\n )}\n ref={ref}\n {...rest}\n >\n <div className={withBaseName(\"content\")}>{children}</div>\n </div>\n );\n});\n"],"names":["makePrefixer","forwardRef","Card","useWindow","useComponentCssInjection","cardCss","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;;AASA,MAAM,YAAA,GAAeA,0BAAa,UAAU,CAAA,CAAA;AAiBrC,MAAM,IAAO,GAAAC,gBAAA,CAAsC,SAASC,KAAAA,CACjE,OACA,GACA,EAAA;AACA,EAAA,MAAM,EAAE,SAAW,EAAA,QAAA,EAAU,YAAc,EAAA,QAAA,EAAA,GAAa,MAAS,GAAA,KAAA,CAAA;AAEjE,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,EAAyBC,+BAAA,CAAA;AAAA,IACvB,EAAI,EAAA,WAAA;AAAA,IACJ,GAAK,EAAAC,MAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAA,uBACGC,cAAA,CAAA,KAAA,EAAA;AAAA,IACC,SAAW,EAAAC,SAAA;AAAA,MACT,YAAa,EAAA;AAAA,MACb;AAAA,QAEE,CAAC,YAAa,CAAA,UAAU,CAAI,GAAA,QAAA;AAAA,QAC5B,CAAC,YAAa,CAAA,cAAc,CAAI,GAAA,YAAA;AAAA,OAClC;AAAA,MACA,SAAA;AAAA,KACF;AAAA,IACA,GAAA;AAAA,IACC,GAAG,IAAA;AAAA,IAEJ,QAAC,kBAAAD,cAAA,CAAA,KAAA,EAAA;AAAA,MAAI,SAAA,EAAW,aAAa,SAAS,CAAA;AAAA,MAAI,QAAA;AAAA,KAAS,CAAA;AAAA,GACrD,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var styleInject_es = require('../../../../node_modules/style-inject/dist/style-inject.es.js');
|
|
4
4
|
|
|
5
|
-
var css_248z = "/* Styles applied to InteractableCard */\n.saltInteractableCard {\n border-width: var(--saltCard-borderWidth, var(--card-borderWidth));\n border-style: var(--saltCard-borderStyle, var(--salt-container-borderStyle));\n border-color: var(--saltCard-borderColor, var(--salt-accent-borderColor));\n border-radius: var(--saltCard-borderRadius, 0);\n display: block;\n transition: box-shadow var(--salt-duration-instant) cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"bottom\"` (default) */\n.saltInteractableCard-accentBottom {\n --card-borderWidth: 0 0 var(--salt-size-accent) 0;\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"left\"` */\n.saltInteractableCard-accentLeft {\n --card-borderWidth: 0 0 0 var(--salt-size-accent);\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"top\"` */\n.saltInteractableCard-accentTop {\n --card-borderWidth: var(--salt-size-accent) 0 0 0;\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"right\"` */\n.saltInteractableCard-accentRight {\n --card-borderWidth: 0 var(--salt-size-accent) 0 0;\n}\n\n/* Styles applied to InteractableCard on focus */\na:focus-visible .saltInteractableCard,\n.saltInteractableCard:focus-visible {\n cursor: var(--saltCard-interactable-cursor-focus, var(--salt-selectable-cursor-hover));\n box-shadow: var(--saltCard-interactable-shadow-focus, var(--salt-overlayable-shadow-hover));\n color: var(--saltCard-color-focus, var(--salt-text-primary-foreground));\n outline-color: var(--salt-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n outline-offset: var(--salt-focused-outlineOffset);\n}\n\
|
|
5
|
+
var css_248z = "/* Styles applied to InteractableCard */\n.saltInteractableCard {\n border-width: var(--saltCard-borderWidth, var(--card-borderWidth));\n border-style: var(--saltCard-borderStyle, var(--salt-container-borderStyle));\n border-color: var(--saltCard-borderColor, var(--salt-accent-borderColor));\n border-radius: var(--saltCard-borderRadius, 0);\n display: block;\n transition: box-shadow var(--salt-duration-instant) cubic-bezier(0.4, 0, 0.2, 1);\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"bottom\"` (default) */\n.saltInteractableCard-accentBottom {\n --card-borderWidth: 0 0 var(--salt-size-accent) 0;\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"left\"` */\n.saltInteractableCard-accentLeft {\n --card-borderWidth: 0 0 0 var(--salt-size-accent);\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"top\"` */\n.saltInteractableCard-accentTop {\n --card-borderWidth: var(--salt-size-accent) 0 0 0;\n}\n\n/* Styles applied to InteractableCard if `accentPlacement=\"right\"` */\n.saltInteractableCard-accentRight {\n --card-borderWidth: 0 var(--salt-size-accent) 0 0;\n}\n\n/* Styles applied to InteractableCard on focus */\na:focus-visible .saltInteractableCard,\n.saltInteractableCard:focus-visible {\n cursor: var(--saltCard-interactable-cursor-focus, var(--salt-selectable-cursor-hover));\n box-shadow: var(--saltCard-interactable-shadow-focus, var(--salt-overlayable-shadow-hover));\n color: var(--saltCard-color-focus, var(--salt-text-primary-foreground));\n outline-color: var(--salt-focused-outlineColor);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n outline-offset: var(--salt-focused-outlineOffset);\n}\n\n/* Styles applied on active state to InteractableCard */\n.saltInteractableCard:active {\n cursor: var(--saltCard-interactable-cursor-active, var(--salt-selectable-cursor-active));\n box-shadow: var(--saltCard-interactable-shadow-active, var(--salt-overlayable-shadow-hover));\n}\n\n/* Styles applied on hover state to InteractableCard */\n.saltInteractableCard:hover {\n cursor: var(--saltCard-interactable-cursor-hover, var(--salt-selectable-cursor-hover));\n box-shadow: var(--saltCard-interactable-shadow-hover, var(--salt-overlayable-shadow-hover));\n}\n\n/* Styles applied to InteractableCard if `disabled={true}` */\n.saltInteractableCard-disabled,\n.saltInteractableCard-disabled:focus,\n.saltInteractableCard-disabled:hover,\n.saltInteractableCard-disabled:active {\n border-color: var(--saltCard-borderColor-disabled, var(--salt-accent-borderColor-disabled));\n box-shadow: var(--saltCard-interactable-shadow, var(--salt-overlayable-shadow));\n background: var(--saltCard-background-disabled, var(--salt-container-primary-background-disabled));\n color: var(--saltCard-color-disabled, var(--salt-text-primary-foreground-disabled));\n cursor: var(--saltCard-interactable-cursor-disabled, var(--salt-selectable-cursor-disabled));\n outline: none;\n}\n\n/* Styles applied to nested divs in InteractableCard if `disabled={true}` */\n.saltInteractableCard-disabled div {\n pointer-events: none;\n}\n\n/* Class that can be used for anchor tags wrapping InteractableCard */\n.saltInteractableCard-link {\n color: var(--saltCard-link-color, var(--salt-text-primary-foreground));\n inset: var(--salt-focused-outlineInset);\n outline-color: var(--salt-focused-outlineColor);\n outline-offset: var(--salt-focused-outlineOffset);\n outline-style: var(--salt-focused-outlineStyle);\n outline-width: var(--salt-focused-outlineWidth);\n}\n";
|
|
6
6
|
styleInject_es(css_248z);
|
|
7
7
|
|
|
8
8
|
module.exports = css_248z;
|
|
@@ -9,7 +9,9 @@ require('../utils/useFloatingUI.js');
|
|
|
9
9
|
require('../utils/useId.js');
|
|
10
10
|
var useResponsiveProp = require('../utils/useResponsiveProp.js');
|
|
11
11
|
var clsx = require('clsx');
|
|
12
|
-
require('./FlexItem.css.js');
|
|
12
|
+
var FlexItem$1 = require('./FlexItem.css.js');
|
|
13
|
+
var window = require('@salt-ds/window');
|
|
14
|
+
var styles = require('@salt-ds/styles');
|
|
13
15
|
|
|
14
16
|
const withBaseName = makePrefixer.makePrefixer("saltFlexItem");
|
|
15
17
|
const FLEX_ITEM_ALIGNMENTS = [
|
|
@@ -30,6 +32,12 @@ const FlexItem = React.forwardRef(
|
|
|
30
32
|
style,
|
|
31
33
|
...rest
|
|
32
34
|
}, ref) => {
|
|
35
|
+
const { window: targetWindow } = window.useWindow();
|
|
36
|
+
styles.useComponentCssInjection({
|
|
37
|
+
id: "salt-flex-item",
|
|
38
|
+
css: FlexItem$1,
|
|
39
|
+
window: targetWindow
|
|
40
|
+
});
|
|
33
41
|
const Component = as || "div";
|
|
34
42
|
const flexItemShrink = useResponsiveProp.useResponsiveProp(shrink, 1);
|
|
35
43
|
const flexItemGrow = useResponsiveProp.useResponsiveProp(grow, 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlexItem.js","sources":["../src/flex-item/FlexItem.tsx"],"sourcesContent":["import { forwardRef, ElementType, ReactElement, CSSProperties } from \"react\";\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\nimport \"./FlexItem.css\";\nimport { clsx } from \"clsx\";\n\nconst withBaseName = makePrefixer(\"saltFlexItem\");\nexport const FLEX_ITEM_ALIGNMENTS = [\n \"start\",\n \"end\",\n \"center\",\n \"stretch\",\n] as const;\n\nexport type flexItemAlignment = typeof FLEX_ITEM_ALIGNMENTS[number];\n\nexport type FlexItemProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Allows the alignment specified by parent to be overridden for individual items, default is \"start\".\n */\n align?: flexItemAlignment;\n /**\n * Defines the ability for an item to shrink x times more compared to it's siblings, default is 1.\n */\n shrink?: ResponsiveProp<number>;\n /**\n * Defines the ability for an item to grow x times more compared to it's siblings, default is 0.\n */\n grow?: ResponsiveProp<number>;\n /**\n * Sets the initial main size of a flex item, default is \"auto\".\n */\n basis?: ResponsiveProp<CSSProperties[\"flexBasis\"]>;\n }\n >;\n\ntype FlexItemComponent = <T extends ElementType = \"div\">(\n props: FlexItemProps<T>\n) => ReactElement | null;\n\nexport const FlexItem: FlexItemComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n align,\n children,\n className,\n shrink,\n grow,\n basis,\n style,\n ...rest\n }: FlexItemProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const Component = as || \"div\";\n const flexItemShrink = useResponsiveProp(shrink, 1);\n const flexItemGrow = useResponsiveProp(grow, 0);\n const flexItemBasis = useResponsiveProp(basis, \"auto\");\n\n const itemStyle = {\n \"--saltFlexItem-alignment\": align,\n \"--saltFlexItem-shrink\": flexItemShrink,\n \"--saltFlexItem-grow\": flexItemGrow,\n \"--saltFlexItem-basis\": flexItemBasis,\n ...style,\n };\n return (\n <Component\n className={clsx(withBaseName(), className)}\n ref={ref}\n style={itemStyle}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useResponsiveProp","jsx","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlexItem.js","sources":["../src/flex-item/FlexItem.tsx"],"sourcesContent":["import { forwardRef, ElementType, ReactElement, CSSProperties } from \"react\";\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\nimport flexItemCss from \"./FlexItem.css\";\nimport { clsx } from \"clsx\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nconst withBaseName = makePrefixer(\"saltFlexItem\");\nexport const FLEX_ITEM_ALIGNMENTS = [\n \"start\",\n \"end\",\n \"center\",\n \"stretch\",\n] as const;\n\nexport type flexItemAlignment = typeof FLEX_ITEM_ALIGNMENTS[number];\n\nexport type FlexItemProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Allows the alignment specified by parent to be overridden for individual items, default is \"start\".\n */\n align?: flexItemAlignment;\n /**\n * Defines the ability for an item to shrink x times more compared to it's siblings, default is 1.\n */\n shrink?: ResponsiveProp<number>;\n /**\n * Defines the ability for an item to grow x times more compared to it's siblings, default is 0.\n */\n grow?: ResponsiveProp<number>;\n /**\n * Sets the initial main size of a flex item, default is \"auto\".\n */\n basis?: ResponsiveProp<CSSProperties[\"flexBasis\"]>;\n }\n >;\n\ntype FlexItemComponent = <T extends ElementType = \"div\">(\n props: FlexItemProps<T>\n) => ReactElement | null;\n\nexport const FlexItem: FlexItemComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n align,\n children,\n className,\n shrink,\n grow,\n basis,\n style,\n ...rest\n }: FlexItemProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-flex-item\",\n css: flexItemCss,\n window: targetWindow,\n });\n\n const Component = as || \"div\";\n const flexItemShrink = useResponsiveProp(shrink, 1);\n const flexItemGrow = useResponsiveProp(grow, 0);\n const flexItemBasis = useResponsiveProp(basis, \"auto\");\n\n const itemStyle = {\n \"--saltFlexItem-alignment\": align,\n \"--saltFlexItem-shrink\": flexItemShrink,\n \"--saltFlexItem-grow\": flexItemGrow,\n \"--saltFlexItem-basis\": flexItemBasis,\n ...style,\n };\n return (\n <Component\n className={clsx(withBaseName(), className)}\n ref={ref}\n style={itemStyle}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","flexItemCss","useResponsiveProp","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAM,YAAA,GAAeA,0BAAa,cAAc,CAAA,CAAA;AACzC,MAAM,oBAAuB,GAAA;AAAA,EAClC,OAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AACF,EAAA;AA+BO,MAAM,QAA8B,GAAAC,gBAAA;AAAA,EACzC,CACE;AAAA,IACE,EAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,IAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,IAAyBC,+BAAA,CAAA;AAAA,MACvB,EAAI,EAAA,gBAAA;AAAA,MACJ,GAAK,EAAAC,UAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,MAAM,YAAY,EAAM,IAAA,KAAA,CAAA;AACxB,IAAM,MAAA,cAAA,GAAiBC,mCAAkB,CAAA,MAAA,EAAQ,CAAC,CAAA,CAAA;AAClD,IAAM,MAAA,YAAA,GAAeA,mCAAkB,CAAA,IAAA,EAAM,CAAC,CAAA,CAAA;AAC9C,IAAM,MAAA,aAAA,GAAgBA,mCAAkB,CAAA,KAAA,EAAO,MAAM,CAAA,CAAA;AAErD,IAAA,MAAM,SAAY,GAAA;AAAA,MAChB,0BAA4B,EAAA,KAAA;AAAA,MAC5B,uBAAyB,EAAA,cAAA;AAAA,MACzB,qBAAuB,EAAA,YAAA;AAAA,MACvB,sBAAwB,EAAA,aAAA;AAAA,MACxB,GAAG,KAAA;AAAA,KACL,CAAA;AACA,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MACC,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MACzC,GAAA;AAAA,MACA,KAAO,EAAA,SAAA;AAAA,MACN,GAAG,IAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;;"}
|
|
@@ -9,7 +9,9 @@ var makePrefixer = require('../utils/makePrefixer.js');
|
|
|
9
9
|
require('../utils/useFloatingUI.js');
|
|
10
10
|
require('../utils/useId.js');
|
|
11
11
|
var useResponsiveProp = require('../utils/useResponsiveProp.js');
|
|
12
|
-
require('./FlexLayout.css.js');
|
|
12
|
+
var FlexLayout$1 = require('./FlexLayout.css.js');
|
|
13
|
+
var window = require('@salt-ds/window');
|
|
14
|
+
var styles = require('@salt-ds/styles');
|
|
13
15
|
|
|
14
16
|
const withBaseName = makePrefixer.makePrefixer("saltFlexLayout");
|
|
15
17
|
const FLEX_ALIGNMENT_BASE = ["start", "end", "center"];
|
|
@@ -33,6 +35,12 @@ const FlexLayout = React.forwardRef(
|
|
|
33
35
|
wrap,
|
|
34
36
|
...rest
|
|
35
37
|
}, ref) => {
|
|
38
|
+
const { window: targetWindow } = window.useWindow();
|
|
39
|
+
styles.useComponentCssInjection({
|
|
40
|
+
id: "salt-flex-layout",
|
|
41
|
+
css: FlexLayout$1,
|
|
42
|
+
window: targetWindow
|
|
43
|
+
});
|
|
36
44
|
const Component = as || "div";
|
|
37
45
|
const separatorAlignment = separators === true ? "center" : separators;
|
|
38
46
|
const addPrefix = (style2) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlexLayout.js","sources":["../src/flex-layout/FlexLayout.tsx"],"sourcesContent":["import { ElementType, forwardRef, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\n\nimport \"./FlexLayout.css\";\n\nconst withBaseName = makePrefixer(\"saltFlexLayout\");\n\nexport type LayoutSeparator = \"start\" | \"center\" | \"end\";\nexport type LayoutDirection = \"row\" | \"column\";\n\nexport const FLEX_ALIGNMENT_BASE = [\"start\", \"end\", \"center\"] as const;\nexport const FLEX_CONTENT_ALIGNMENT_BASE = [\n ...FLEX_ALIGNMENT_BASE,\n \"space-between\",\n \"space-around\",\n \"space-evenly\",\n] as const;\n\nexport type FlexAlignment = typeof FLEX_ALIGNMENT_BASE[number];\nexport type FlexContentAlignment = typeof FLEX_CONTENT_ALIGNMENT_BASE[number];\n\nexport type FlexLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Defines the default behavior for how flex items are laid out along the cross axis on the current line, default is \"stretch\".\n */\n align?: FlexAlignment | \"stretch\" | \"baseline\";\n /**\n * Establishes the main-axis, defining the direction children are placed. Default is \"row\".\n */\n direction?: ResponsiveProp<LayoutDirection>;\n /**\n * Controls the space between items, default is 3.\n */\n gap?: ResponsiveProp<number>;\n /**\n * Defines the alignment along the main axis, default is \"start\".\n */\n justify?: FlexContentAlignment;\n /**\n * **Deprecated:** For separators see `StackLayout` component instead.\n *\n * Adds a separator between elements if wrap is not active, default is false.\n */\n separators?: LayoutSeparator | true;\n /**\n * Allow the items to wrap as needed, default is false.\n */\n wrap?: ResponsiveProp<boolean>;\n }\n >;\n\ntype FlexLayoutComponent = <T extends ElementType = \"div\">(\n props: FlexLayoutProps<T>\n) => ReactElement | null;\n\nexport const FlexLayout: FlexLayoutComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n align,\n children,\n className,\n direction,\n gap,\n justify,\n separators,\n style,\n wrap,\n ...rest\n }: FlexLayoutProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const Component = as || \"div\";\n const separatorAlignment = separators === true ? \"center\" : separators;\n const addPrefix = (style: string) => {\n return style === \"start\" || style === \"end\" ? `flex-${style}` : style;\n };\n\n const flexGap = useResponsiveProp(gap, 3);\n const flexDirection = useResponsiveProp(direction, \"row\");\n const flexWrap = useResponsiveProp(wrap, false);\n const flexLayoutStyles = {\n ...style,\n \"--flexLayout-align\": align && addPrefix(align),\n \"--flexLayout-direction\": flexDirection,\n \"--flexLayout-gap-multiplier\": flexGap,\n \"--flexLayout-justify\": justify && addPrefix(justify),\n \"--flexLayout-wrap\": flexWrap ? \"wrap\" : \"nowrap\",\n };\n\n return (\n <Component\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"separator\")]: separatorAlignment && !wrap,\n [withBaseName(\n `separator-${flexDirection || \"row\"}-${\n separatorAlignment || \"center\"\n }`\n )]: separatorAlignment && !wrap,\n [withBaseName(`separator-${flexDirection || \"row\"}`)]:\n separatorAlignment && !wrap,\n },\n className\n )}\n ref={ref}\n style={flexLayoutStyles}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","style","useResponsiveProp","jsx","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlexLayout.js","sources":["../src/flex-layout/FlexLayout.tsx"],"sourcesContent":["import { ElementType, forwardRef, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\n\nimport flexLayoutCss from \"./FlexLayout.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nconst withBaseName = makePrefixer(\"saltFlexLayout\");\n\nexport type LayoutSeparator = \"start\" | \"center\" | \"end\";\nexport type LayoutDirection = \"row\" | \"column\";\n\nexport const FLEX_ALIGNMENT_BASE = [\"start\", \"end\", \"center\"] as const;\nexport const FLEX_CONTENT_ALIGNMENT_BASE = [\n ...FLEX_ALIGNMENT_BASE,\n \"space-between\",\n \"space-around\",\n \"space-evenly\",\n] as const;\n\nexport type FlexAlignment = typeof FLEX_ALIGNMENT_BASE[number];\nexport type FlexContentAlignment = typeof FLEX_CONTENT_ALIGNMENT_BASE[number];\n\nexport type FlexLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Defines the default behavior for how flex items are laid out along the cross axis on the current line, default is \"stretch\".\n */\n align?: FlexAlignment | \"stretch\" | \"baseline\";\n /**\n * Establishes the main-axis, defining the direction children are placed. Default is \"row\".\n */\n direction?: ResponsiveProp<LayoutDirection>;\n /**\n * Controls the space between items, default is 3.\n */\n gap?: ResponsiveProp<number>;\n /**\n * Defines the alignment along the main axis, default is \"start\".\n */\n justify?: FlexContentAlignment;\n /**\n * **Deprecated:** For separators see `StackLayout` component instead.\n *\n * Adds a separator between elements if wrap is not active, default is false.\n */\n separators?: LayoutSeparator | true;\n /**\n * Allow the items to wrap as needed, default is false.\n */\n wrap?: ResponsiveProp<boolean>;\n }\n >;\n\ntype FlexLayoutComponent = <T extends ElementType = \"div\">(\n props: FlexLayoutProps<T>\n) => ReactElement | null;\n\nexport const FlexLayout: FlexLayoutComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n align,\n children,\n className,\n direction,\n gap,\n justify,\n separators,\n style,\n wrap,\n ...rest\n }: FlexLayoutProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-flex-layout\",\n css: flexLayoutCss,\n window: targetWindow,\n });\n\n const Component = as || \"div\";\n const separatorAlignment = separators === true ? \"center\" : separators;\n const addPrefix = (style: string) => {\n return style === \"start\" || style === \"end\" ? `flex-${style}` : style;\n };\n\n const flexGap = useResponsiveProp(gap, 3);\n const flexDirection = useResponsiveProp(direction, \"row\");\n const flexWrap = useResponsiveProp(wrap, false);\n const flexLayoutStyles = {\n ...style,\n \"--flexLayout-align\": align && addPrefix(align),\n \"--flexLayout-direction\": flexDirection,\n \"--flexLayout-gap-multiplier\": flexGap,\n \"--flexLayout-justify\": justify && addPrefix(justify),\n \"--flexLayout-wrap\": flexWrap ? \"wrap\" : \"nowrap\",\n };\n\n return (\n <Component\n className={clsx(\n withBaseName(),\n {\n [withBaseName(\"separator\")]: separatorAlignment && !wrap,\n [withBaseName(\n `separator-${flexDirection || \"row\"}-${\n separatorAlignment || \"center\"\n }`\n )]: separatorAlignment && !wrap,\n [withBaseName(`separator-${flexDirection || \"row\"}`)]:\n separatorAlignment && !wrap,\n },\n className\n )}\n ref={ref}\n style={flexLayoutStyles}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","flexLayoutCss","style","useResponsiveProp","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;AAeA,MAAM,YAAA,GAAeA,0BAAa,gBAAgB,CAAA,CAAA;AAK3C,MAAM,mBAAsB,GAAA,CAAC,OAAS,EAAA,KAAA,EAAO,QAAQ,EAAA;AACrD,MAAM,2BAA8B,GAAA;AAAA,EACzC,GAAG,mBAAA;AAAA,EACH,eAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AACF,EAAA;AA0CO,MAAM,UAAkC,GAAAC,gBAAA;AAAA,EAC7C,CACE;AAAA,IACE,EAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,SAAA;AAAA,IACA,GAAA;AAAA,IACA,OAAA;AAAA,IACA,UAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,IAAyBC,+BAAA,CAAA;AAAA,MACvB,EAAI,EAAA,kBAAA;AAAA,MACJ,GAAK,EAAAC,YAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,MAAM,YAAY,EAAM,IAAA,KAAA,CAAA;AACxB,IAAM,MAAA,kBAAA,GAAqB,UAAe,KAAA,IAAA,GAAO,QAAW,GAAA,UAAA,CAAA;AAC5D,IAAM,MAAA,SAAA,GAAY,CAACC,MAAkB,KAAA;AACnC,MAAA,OAAOA,MAAU,KAAA,OAAA,IAAWA,MAAU,KAAA,KAAA,GAAQ,QAAQA,MAAUA,CAAAA,CAAAA,GAAAA,MAAAA,CAAAA;AAAA,KAClE,CAAA;AAEA,IAAM,MAAA,OAAA,GAAUC,mCAAkB,CAAA,GAAA,EAAK,CAAC,CAAA,CAAA;AACxC,IAAM,MAAA,aAAA,GAAgBA,mCAAkB,CAAA,SAAA,EAAW,KAAK,CAAA,CAAA;AACxD,IAAM,MAAA,QAAA,GAAWA,mCAAkB,CAAA,IAAA,EAAM,KAAK,CAAA,CAAA;AAC9C,IAAA,MAAM,gBAAmB,GAAA;AAAA,MACvB,GAAG,KAAA;AAAA,MACH,oBAAA,EAAsB,KAAS,IAAA,SAAA,CAAU,KAAK,CAAA;AAAA,MAC9C,wBAA0B,EAAA,aAAA;AAAA,MAC1B,6BAA+B,EAAA,OAAA;AAAA,MAC/B,sBAAA,EAAwB,OAAW,IAAA,SAAA,CAAU,OAAO,CAAA;AAAA,MACpD,mBAAA,EAAqB,WAAW,MAAS,GAAA,QAAA;AAAA,KAC3C,CAAA;AAEA,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MACC,SAAW,EAAAC,SAAA;AAAA,QACT,YAAa,EAAA;AAAA,QACb;AAAA,UACE,CAAC,YAAA,CAAa,WAAW,CAAA,GAAI,sBAAsB,CAAC,IAAA;AAAA,UACpD,CAAC,YAAA;AAAA,YACC,CAAA,UAAA,EAAa,aAAiB,IAAA,KAAA,CAAA,CAAA,EAC5B,kBAAsB,IAAA,QAAA,CAAA,CAAA;AAAA,WAE1B,GAAI,sBAAsB,CAAC,IAAA;AAAA,UAC3B,CAAC,YAAa,CAAA,CAAA,UAAA,EAAa,iBAAiB,KAAO,CAAA,CAAA,CAAA,GACjD,sBAAsB,CAAC,IAAA;AAAA,SAC3B;AAAA,QACA,SAAA;AAAA,OACF;AAAA,MACA,GAAA;AAAA,MACA,KAAO,EAAA,gBAAA;AAAA,MACN,GAAG,IAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;;;"}
|
|
@@ -9,7 +9,9 @@ var makePrefixer = require('../utils/makePrefixer.js');
|
|
|
9
9
|
require('../utils/useFloatingUI.js');
|
|
10
10
|
require('../utils/useId.js');
|
|
11
11
|
var useResponsiveProp = require('../utils/useResponsiveProp.js');
|
|
12
|
-
require('./GridItem.css.js');
|
|
12
|
+
var GridItem$1 = require('./GridItem.css.js');
|
|
13
|
+
var window = require('@salt-ds/window');
|
|
14
|
+
var styles = require('@salt-ds/styles');
|
|
13
15
|
|
|
14
16
|
const GRID_ALIGNMENT_BASE = [
|
|
15
17
|
"start",
|
|
@@ -34,6 +36,12 @@ const GridItem = React.forwardRef(
|
|
|
34
36
|
style,
|
|
35
37
|
...rest
|
|
36
38
|
}, ref) => {
|
|
39
|
+
const { window: targetWindow } = window.useWindow();
|
|
40
|
+
styles.useComponentCssInjection({
|
|
41
|
+
id: "salt-grid-item",
|
|
42
|
+
css: GridItem$1,
|
|
43
|
+
window: targetWindow
|
|
44
|
+
});
|
|
37
45
|
const Component = as || "div";
|
|
38
46
|
const gridItemColSpan = useResponsiveProp.useResponsiveProp(colSpan, "auto");
|
|
39
47
|
const gridItemRowSpan = useResponsiveProp.useResponsiveProp(rowSpan, "auto");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridItem.js","sources":["../src/grid-item/GridItem.tsx"],"sourcesContent":["import { forwardRef, ElementType, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicRef,\n PolymorphicComponentPropWithRef,\n} from \"../utils\";\nimport \"./GridItem.css\";\n\nexport const GRID_ALIGNMENT_BASE = [\n \"start\",\n \"end\",\n \"center\",\n \"stretch\",\n] as const;\n\ntype GridAlignment = typeof GRID_ALIGNMENT_BASE[number];\n\ntype GridProperty = number | \"auto\";\nexport type GridItemProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * The item will span across the provided number of grid columns. Defaults to \"auto\"\n */\n colSpan?: ResponsiveProp<GridProperty>;\n /**\n * The item will span across the provided number of grid rows. Defaults to \"auto\"\n */\n rowSpan?: ResponsiveProp<GridProperty>;\n /**\n * Aligns a grid item inside a cell along the inline (row) axis. Defaults to \"stretch\"\n */\n horizontalAlignment?: GridAlignment;\n /**\n * Aligns a grid item inside a cell along the block (column) axis. Defaults to \"stretch\"\n */\n verticalAlignment?: GridAlignment;\n }\n >;\n\nconst withBaseName = makePrefixer(\"saltGridItem\");\n\nconst colStart = \"auto\";\nconst colEnd = \"auto\";\nconst rowStart = \"auto\";\nconst rowEnd = \"auto\";\n\ntype GridItemComponent = <T extends ElementType = \"div\">(\n props: GridItemProps<T>\n) => ReactElement | null;\n\nexport const GridItem: GridItemComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n children,\n className,\n colSpan,\n rowSpan,\n horizontalAlignment = \"stretch\",\n verticalAlignment = \"stretch\",\n style,\n ...rest\n }: GridItemProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const Component = as || \"div\";\n const gridItemColSpan = useResponsiveProp(colSpan, \"auto\");\n\n const gridItemRowSpan = useResponsiveProp(rowSpan, \"auto\");\n\n const gridColumnStart = gridItemColSpan\n ? `span ${gridItemColSpan}`\n : colStart;\n\n const gridColumnEnd = gridItemColSpan ? `span ${gridItemColSpan}` : colEnd;\n\n const gridRowStart = gridItemRowSpan ? `span ${gridItemRowSpan}` : rowStart;\n\n const gridRowEnd = gridItemRowSpan ? `span ${gridItemRowSpan}` : rowEnd;\n\n const gridStyles = {\n ...style,\n \"--gridItem-justifySelf\": horizontalAlignment,\n \"--gridItem-alignSelf\": verticalAlignment,\n \"--gridItem-gridRowStart\": gridRowStart,\n \"--gridItem-gridColumnStart\": gridColumnStart,\n \"--gridItem-gridRowEnd\": gridRowEnd,\n \"--gridItem-gridColumnEnd\": gridColumnEnd,\n };\n\n return (\n <Component\n className={clsx(withBaseName(), className)}\n style={gridStyles}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useResponsiveProp","jsx","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"GridItem.js","sources":["../src/grid-item/GridItem.tsx"],"sourcesContent":["import { forwardRef, ElementType, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicRef,\n PolymorphicComponentPropWithRef,\n} from \"../utils\";\nimport gridItemCss from \"./GridItem.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nexport const GRID_ALIGNMENT_BASE = [\n \"start\",\n \"end\",\n \"center\",\n \"stretch\",\n] as const;\n\ntype GridAlignment = typeof GRID_ALIGNMENT_BASE[number];\n\ntype GridProperty = number | \"auto\";\nexport type GridItemProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * The item will span across the provided number of grid columns. Defaults to \"auto\"\n */\n colSpan?: ResponsiveProp<GridProperty>;\n /**\n * The item will span across the provided number of grid rows. Defaults to \"auto\"\n */\n rowSpan?: ResponsiveProp<GridProperty>;\n /**\n * Aligns a grid item inside a cell along the inline (row) axis. Defaults to \"stretch\"\n */\n horizontalAlignment?: GridAlignment;\n /**\n * Aligns a grid item inside a cell along the block (column) axis. Defaults to \"stretch\"\n */\n verticalAlignment?: GridAlignment;\n }\n >;\n\nconst withBaseName = makePrefixer(\"saltGridItem\");\n\nconst colStart = \"auto\";\nconst colEnd = \"auto\";\nconst rowStart = \"auto\";\nconst rowEnd = \"auto\";\n\ntype GridItemComponent = <T extends ElementType = \"div\">(\n props: GridItemProps<T>\n) => ReactElement | null;\n\nexport const GridItem: GridItemComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n children,\n className,\n colSpan,\n rowSpan,\n horizontalAlignment = \"stretch\",\n verticalAlignment = \"stretch\",\n style,\n ...rest\n }: GridItemProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-grid-item\",\n css: gridItemCss,\n window: targetWindow,\n });\n\n const Component = as || \"div\";\n const gridItemColSpan = useResponsiveProp(colSpan, \"auto\");\n\n const gridItemRowSpan = useResponsiveProp(rowSpan, \"auto\");\n\n const gridColumnStart = gridItemColSpan\n ? `span ${gridItemColSpan}`\n : colStart;\n\n const gridColumnEnd = gridItemColSpan ? `span ${gridItemColSpan}` : colEnd;\n\n const gridRowStart = gridItemRowSpan ? `span ${gridItemRowSpan}` : rowStart;\n\n const gridRowEnd = gridItemRowSpan ? `span ${gridItemRowSpan}` : rowEnd;\n\n const gridStyles = {\n ...style,\n \"--gridItem-justifySelf\": horizontalAlignment,\n \"--gridItem-alignSelf\": verticalAlignment,\n \"--gridItem-gridRowStart\": gridRowStart,\n \"--gridItem-gridColumnStart\": gridColumnStart,\n \"--gridItem-gridRowEnd\": gridRowEnd,\n \"--gridItem-gridColumnEnd\": gridColumnEnd,\n };\n\n return (\n <Component\n className={clsx(withBaseName(), className)}\n style={gridStyles}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","gridItemCss","useResponsiveProp","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;AAcO,MAAM,mBAAsB,GAAA;AAAA,EACjC,OAAA;AAAA,EACA,KAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AACF,EAAA;AA4BA,MAAM,YAAA,GAAeA,0BAAa,cAAc,CAAA,CAAA;AAEhD,MAAM,QAAW,GAAA,MAAA,CAAA;AACjB,MAAM,MAAS,GAAA,MAAA,CAAA;AACf,MAAM,QAAW,GAAA,MAAA,CAAA;AACjB,MAAM,MAAS,GAAA,MAAA,CAAA;AAMR,MAAM,QAA8B,GAAAC,gBAAA;AAAA,EACzC,CACE;AAAA,IACE,EAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,mBAAsB,GAAA,SAAA;AAAA,IACtB,iBAAoB,GAAA,SAAA;AAAA,IACpB,KAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,IAAyBC,+BAAA,CAAA;AAAA,MACvB,EAAI,EAAA,gBAAA;AAAA,MACJ,GAAK,EAAAC,UAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,MAAM,YAAY,EAAM,IAAA,KAAA,CAAA;AACxB,IAAM,MAAA,eAAA,GAAkBC,mCAAkB,CAAA,OAAA,EAAS,MAAM,CAAA,CAAA;AAEzD,IAAM,MAAA,eAAA,GAAkBA,mCAAkB,CAAA,OAAA,EAAS,MAAM,CAAA,CAAA;AAEzD,IAAM,MAAA,eAAA,GAAkB,eACpB,GAAA,CAAA,KAAA,EAAQ,eACR,CAAA,CAAA,GAAA,QAAA,CAAA;AAEJ,IAAM,MAAA,aAAA,GAAgB,eAAkB,GAAA,CAAA,KAAA,EAAQ,eAAoB,CAAA,CAAA,GAAA,MAAA,CAAA;AAEpE,IAAM,MAAA,YAAA,GAAe,eAAkB,GAAA,CAAA,KAAA,EAAQ,eAAoB,CAAA,CAAA,GAAA,QAAA,CAAA;AAEnE,IAAM,MAAA,UAAA,GAAa,eAAkB,GAAA,CAAA,KAAA,EAAQ,eAAoB,CAAA,CAAA,GAAA,MAAA,CAAA;AAEjE,IAAA,MAAM,UAAa,GAAA;AAAA,MACjB,GAAG,KAAA;AAAA,MACH,wBAA0B,EAAA,mBAAA;AAAA,MAC1B,sBAAwB,EAAA,iBAAA;AAAA,MACxB,yBAA2B,EAAA,YAAA;AAAA,MAC3B,4BAA8B,EAAA,eAAA;AAAA,MAC9B,uBAAyB,EAAA,UAAA;AAAA,MACzB,0BAA4B,EAAA,aAAA;AAAA,KAC9B,CAAA;AAEA,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MACC,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MACzC,KAAO,EAAA,UAAA;AAAA,MACP,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;;"}
|
|
@@ -9,7 +9,9 @@ var makePrefixer = require('../utils/makePrefixer.js');
|
|
|
9
9
|
require('../utils/useFloatingUI.js');
|
|
10
10
|
require('../utils/useId.js');
|
|
11
11
|
var useResponsiveProp = require('../utils/useResponsiveProp.js');
|
|
12
|
-
require('./GridLayout.css.js');
|
|
12
|
+
var GridLayout$1 = require('./GridLayout.css.js');
|
|
13
|
+
var window = require('@salt-ds/window');
|
|
14
|
+
var styles = require('@salt-ds/styles');
|
|
13
15
|
|
|
14
16
|
const withBaseName = makePrefixer.makePrefixer("saltGridLayout");
|
|
15
17
|
const GridLayout = React.forwardRef(
|
|
@@ -25,6 +27,12 @@ const GridLayout = React.forwardRef(
|
|
|
25
27
|
style,
|
|
26
28
|
...rest
|
|
27
29
|
}, ref) => {
|
|
30
|
+
const { window: targetWindow } = window.useWindow();
|
|
31
|
+
styles.useComponentCssInjection({
|
|
32
|
+
id: "salt-grid-layout",
|
|
33
|
+
css: GridLayout$1,
|
|
34
|
+
window: targetWindow
|
|
35
|
+
});
|
|
28
36
|
const Component = as || "div";
|
|
29
37
|
const gridColumns = useResponsiveProp.useResponsiveProp(columns, 12);
|
|
30
38
|
const gridRows = useResponsiveProp.useResponsiveProp(rows, 1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridLayout.js","sources":["../src/grid-layout/GridLayout.tsx"],"sourcesContent":["import { forwardRef, ReactElement, ElementType } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\n\nimport \"./GridLayout.css\";\n\nexport type GridLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Number of columns to be displayed. Defaults to 12\n */\n columns?: ResponsiveProp<number>;\n /**\n * Number of rows to be displayed. Defaults to 1\n */\n rows?: ResponsiveProp<number>;\n /**\n * Defines the size of the gutter between the columns and the rows by setting a density multiplier. Defaults to 3\n */\n gap?: ResponsiveProp<number>;\n /**\n * Defines the size of the gutter between the columns by setting a density multiplier. Defaults to 1\n */\n columnGap?: ResponsiveProp<number>;\n /**\n * Defines the size of the gutter between the rows by setting a density multiplier. Defaults to 1\n */\n rowGap?: ResponsiveProp<number>;\n }\n >;\n\ntype GridLayoutComponent = <T extends ElementType = \"div\">(\n props: GridLayoutProps<T>\n) => ReactElement | null;\n\nconst withBaseName = makePrefixer(\"saltGridLayout\");\n\nexport const GridLayout: GridLayoutComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n children,\n className,\n columns = 12,\n rows = 1,\n gap,\n columnGap,\n rowGap,\n style,\n ...rest\n }: GridLayoutProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const Component = as || \"div\";\n\n const gridColumns = useResponsiveProp(columns, 12);\n\n const gridRows = useResponsiveProp(rows, 1);\n\n const gridGap = useResponsiveProp(gap, 3);\n\n const gridColumnGap = useResponsiveProp(columnGap, 3);\n\n const gridRowGap = useResponsiveProp(rowGap, 3);\n\n const gridLayoutStyles = {\n ...style,\n \"--gridLayout-columns\": gridColumns,\n \"--gridLayout-rows\": gridRows,\n \"--gridLayout-columnGap\": gridColumnGap || gridGap,\n \"--gridLayout-rowGap\": gridRowGap || gridGap,\n };\n\n return (\n <Component\n className={clsx(withBaseName(), className)}\n style={gridLayoutStyles}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useResponsiveProp","jsx","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"GridLayout.js","sources":["../src/grid-layout/GridLayout.tsx"],"sourcesContent":["import { forwardRef, ReactElement, ElementType } from \"react\";\nimport { clsx } from \"clsx\";\n\nimport {\n makePrefixer,\n ResponsiveProp,\n useResponsiveProp,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\n\nimport gridLayoutCss from \"./GridLayout.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nexport type GridLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Number of columns to be displayed. Defaults to 12\n */\n columns?: ResponsiveProp<number>;\n /**\n * Number of rows to be displayed. Defaults to 1\n */\n rows?: ResponsiveProp<number>;\n /**\n * Defines the size of the gutter between the columns and the rows by setting a density multiplier. Defaults to 3\n */\n gap?: ResponsiveProp<number>;\n /**\n * Defines the size of the gutter between the columns by setting a density multiplier. Defaults to 1\n */\n columnGap?: ResponsiveProp<number>;\n /**\n * Defines the size of the gutter between the rows by setting a density multiplier. Defaults to 1\n */\n rowGap?: ResponsiveProp<number>;\n }\n >;\n\ntype GridLayoutComponent = <T extends ElementType = \"div\">(\n props: GridLayoutProps<T>\n) => ReactElement | null;\n\nconst withBaseName = makePrefixer(\"saltGridLayout\");\n\nexport const GridLayout: GridLayoutComponent = forwardRef(\n <T extends ElementType = \"div\">(\n {\n as,\n children,\n className,\n columns = 12,\n rows = 1,\n gap,\n columnGap,\n rowGap,\n style,\n ...rest\n }: GridLayoutProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-grid-layout\",\n css: gridLayoutCss,\n window: targetWindow,\n });\n const Component = as || \"div\";\n\n const gridColumns = useResponsiveProp(columns, 12);\n\n const gridRows = useResponsiveProp(rows, 1);\n\n const gridGap = useResponsiveProp(gap, 3);\n\n const gridColumnGap = useResponsiveProp(columnGap, 3);\n\n const gridRowGap = useResponsiveProp(rowGap, 3);\n\n const gridLayoutStyles = {\n ...style,\n \"--gridLayout-columns\": gridColumns,\n \"--gridLayout-rows\": gridRows,\n \"--gridLayout-columnGap\": gridColumnGap || gridGap,\n \"--gridLayout-rowGap\": gridRowGap || gridGap,\n };\n\n return (\n <Component\n className={clsx(withBaseName(), className)}\n style={gridLayoutStyles}\n ref={ref}\n {...rest}\n >\n {children}\n </Component>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","gridLayoutCss","useResponsiveProp","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;AA8CA,MAAM,YAAA,GAAeA,0BAAa,gBAAgB,CAAA,CAAA;AAE3C,MAAM,UAAkC,GAAAC,gBAAA;AAAA,EAC7C,CACE;AAAA,IACE,EAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAU,GAAA,EAAA;AAAA,IACV,IAAO,GAAA,CAAA;AAAA,IACP,GAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACG,GAAA,IAAA;AAAA,KAEL,GACG,KAAA;AACH,IAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,IAAyBC,+BAAA,CAAA;AAAA,MACvB,EAAI,EAAA,kBAAA;AAAA,MACJ,GAAK,EAAAC,YAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AACD,IAAA,MAAM,YAAY,EAAM,IAAA,KAAA,CAAA;AAExB,IAAM,MAAA,WAAA,GAAcC,mCAAkB,CAAA,OAAA,EAAS,EAAE,CAAA,CAAA;AAEjD,IAAM,MAAA,QAAA,GAAWA,mCAAkB,CAAA,IAAA,EAAM,CAAC,CAAA,CAAA;AAE1C,IAAM,MAAA,OAAA,GAAUA,mCAAkB,CAAA,GAAA,EAAK,CAAC,CAAA,CAAA;AAExC,IAAM,MAAA,aAAA,GAAgBA,mCAAkB,CAAA,SAAA,EAAW,CAAC,CAAA,CAAA;AAEpD,IAAM,MAAA,UAAA,GAAaA,mCAAkB,CAAA,MAAA,EAAQ,CAAC,CAAA,CAAA;AAE9C,IAAA,MAAM,gBAAmB,GAAA;AAAA,MACvB,GAAG,KAAA;AAAA,MACH,sBAAwB,EAAA,WAAA;AAAA,MACxB,mBAAqB,EAAA,QAAA;AAAA,MACrB,0BAA0B,aAAiB,IAAA,OAAA;AAAA,MAC3C,uBAAuB,UAAc,IAAA,OAAA;AAAA,KACvC,CAAA;AAEA,IAAA,uBACGC,cAAA,CAAA,SAAA,EAAA;AAAA,MACC,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MACzC,KAAO,EAAA,gBAAA;AAAA,MACP,GAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH,QAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -15,7 +15,9 @@ var Text = require('../text/Text.js');
|
|
|
15
15
|
require('../text/Display.js');
|
|
16
16
|
require('../text/Headings.js');
|
|
17
17
|
require('../text/Label.js');
|
|
18
|
-
require('./Link.css.js');
|
|
18
|
+
var Link$1 = require('./Link.css.js');
|
|
19
|
+
var window = require('@salt-ds/window');
|
|
20
|
+
var styles = require('@salt-ds/styles');
|
|
19
21
|
|
|
20
22
|
const withBaseName = makePrefixer.makePrefixer("saltLink");
|
|
21
23
|
const Link = React.forwardRef(function Link2({
|
|
@@ -27,6 +29,12 @@ const Link = React.forwardRef(function Link2({
|
|
|
27
29
|
target = "_self",
|
|
28
30
|
...rest
|
|
29
31
|
}, ref) {
|
|
32
|
+
const { window: targetWindow } = window.useWindow();
|
|
33
|
+
styles.useComponentCssInjection({
|
|
34
|
+
id: "salt-link",
|
|
35
|
+
css: Link$1,
|
|
36
|
+
window: targetWindow
|
|
37
|
+
});
|
|
30
38
|
return /* @__PURE__ */ jsxRuntime.jsxs(Text.Text, {
|
|
31
39
|
as: "a",
|
|
32
40
|
className: clsx.clsx(withBaseName(), className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","sources":["../src/link/Link.tsx"],"sourcesContent":["import { ComponentType, forwardRef, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\nimport { IconProps, TearOutIcon } from \"@salt-ds/icons\";\nimport { makePrefixer } from \"../utils\";\nimport { Text, TextProps } from \"../text\";\n\nimport \"./Link.css\";\n\nconst withBaseName = makePrefixer(\"saltLink\");\n\n/**\n * Links are a fundamental navigation element. When clicked, they take the user to an entirely different page.\n *\n * @example\n * <LinkExample to=\"#link\">Action</LinkExample>\n */\nexport interface LinkProps extends Omit<TextProps<\"a\">, \"as\" | \"disabled\"> {\n IconComponent?: ComponentType<IconProps> | null;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n {\n IconComponent = TearOutIcon,\n href,\n className,\n children,\n variant = \"primary\",\n target = \"_self\",\n ...rest\n },\n ref\n): ReactElement<LinkProps> {\n return (\n <Text\n as=\"a\"\n className={clsx(withBaseName(), className)}\n href={href}\n ref={ref}\n target={target}\n variant={variant}\n {...rest}\n >\n {children}\n {target === \"_blank\" && (\n <>\n {IconComponent && (\n <IconComponent className={withBaseName(\"icon\")} aria-hidden />\n )}\n <span className={withBaseName(\"externalLinkADA\")}>External Link</span>\n </>\n )}\n </Text>\n );\n});\n"],"names":["makePrefixer","forwardRef","Link","TearOutIcon","jsxs","Text","clsx","Fragment","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Link.js","sources":["../src/link/Link.tsx"],"sourcesContent":["import { ComponentType, forwardRef, ReactElement } from \"react\";\nimport { clsx } from \"clsx\";\nimport { IconProps, TearOutIcon } from \"@salt-ds/icons\";\nimport { makePrefixer } from \"../utils\";\nimport { Text, TextProps } from \"../text\";\n\nimport linkCss from \"./Link.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nconst withBaseName = makePrefixer(\"saltLink\");\n\n/**\n * Links are a fundamental navigation element. When clicked, they take the user to an entirely different page.\n *\n * @example\n * <LinkExample to=\"#link\">Action</LinkExample>\n */\nexport interface LinkProps extends Omit<TextProps<\"a\">, \"as\" | \"disabled\"> {\n IconComponent?: ComponentType<IconProps> | null;\n}\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(function Link(\n {\n IconComponent = TearOutIcon,\n href,\n className,\n children,\n variant = \"primary\",\n target = \"_self\",\n ...rest\n },\n ref\n): ReactElement<LinkProps> {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-link\",\n css: linkCss,\n window: targetWindow,\n });\n\n return (\n <Text\n as=\"a\"\n className={clsx(withBaseName(), className)}\n href={href}\n ref={ref}\n target={target}\n variant={variant}\n {...rest}\n >\n {children}\n {target === \"_blank\" && (\n <>\n {IconComponent && (\n <IconComponent className={withBaseName(\"icon\")} aria-hidden />\n )}\n <span className={withBaseName(\"externalLinkADA\")}>External Link</span>\n </>\n )}\n </Text>\n );\n});\n"],"names":["makePrefixer","forwardRef","Link","TearOutIcon","useWindow","useComponentCssInjection","linkCss","jsxs","Text","clsx","Fragment","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAUA,MAAM,YAAA,GAAeA,0BAAa,UAAU,CAAA,CAAA;AAY/B,MAAA,IAAA,GAAOC,gBAAyC,CAAA,SAASC,KACpE,CAAA;AAAA,EACE,aAAgB,GAAAC,iBAAA;AAAA,EAChB,IAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAU,GAAA,SAAA;AAAA,EACV,MAAS,GAAA,OAAA;AAAA,EACN,GAAA,IAAA;AACL,CAAA,EACA,GACyB,EAAA;AACzB,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,EAAyBC,+BAAA,CAAA;AAAA,IACvB,EAAI,EAAA,WAAA;AAAA,IACJ,GAAK,EAAAC,MAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAA,uBACGC,eAAA,CAAAC,SAAA,EAAA;AAAA,IACC,EAAG,EAAA,GAAA;AAAA,IACH,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,IACzC,IAAA;AAAA,IACA,GAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACC,GAAG,IAAA;AAAA,IAEH,QAAA,EAAA;AAAA,MAAA,QAAA;AAAA,MACA,WAAW,QACV,oBAAAF,eAAA,CAAAG,mBAAA,EAAA;AAAA,QACG,QAAA,EAAA;AAAA,UAAA,aAAA,oBACEC,cAAA,CAAA,aAAA,EAAA;AAAA,YAAc,SAAA,EAAW,aAAa,MAAM,CAAA;AAAA,YAAG,aAAW,EAAA,IAAA;AAAA,WAAC,CAAA;AAAA,0BAE7DA,cAAA,CAAA,MAAA,EAAA;AAAA,YAAK,SAAA,EAAW,aAAa,iBAAiB,CAAA;AAAA,YAAG,QAAA,EAAA,eAAA;AAAA,WAAa,CAAA;AAAA,SAAA;AAAA,OACjE,CAAA;AAAA,KAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -10,10 +10,18 @@ require('../utils/useFloatingUI.js');
|
|
|
10
10
|
require('../utils/useId.js');
|
|
11
11
|
require('../salt-provider/SaltProvider.js');
|
|
12
12
|
require('../viewport/ViewportProvider.js');
|
|
13
|
-
require('./Panel.css.js');
|
|
13
|
+
var Panel$1 = require('./Panel.css.js');
|
|
14
|
+
var window = require('@salt-ds/window');
|
|
15
|
+
var styles = require('@salt-ds/styles');
|
|
14
16
|
|
|
15
17
|
const withBaseName = makePrefixer.makePrefixer("saltPanel");
|
|
16
18
|
const Panel = React.forwardRef(function Panel2({ className, children, variant = "primary", ...restProps }, ref) {
|
|
19
|
+
const { window: targetWindow } = window.useWindow();
|
|
20
|
+
styles.useComponentCssInjection({
|
|
21
|
+
id: "salt-panel",
|
|
22
|
+
css: Panel$1,
|
|
23
|
+
window: targetWindow
|
|
24
|
+
});
|
|
17
25
|
return /* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
18
26
|
className: clsx.clsx(withBaseName(), withBaseName(variant), className),
|
|
19
27
|
ref,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Panel.js","sources":["../src/panel/Panel.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes } from \"react\";\nimport { makePrefixer } from \"../utils\";\n\nimport \"./Panel.css\";\n\n/**\n * Panel component that acts as wrapper around a node\n *\n * @example\n * const PanelExample = () => (\n * <Panel>\n * <p>This is a panel around some text.</p>\n * </Panel>\n * );\n *\n */\n\nexport interface PanelProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Styling variant; defaults to \"primary\".\n */\n variant?: \"primary\" | \"secondary\";\n}\n\nconst withBaseName = makePrefixer(\"saltPanel\");\n\nexport const Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n { className, children, variant = \"primary\", ...restProps },\n ref\n) {\n return (\n <div\n className={clsx(withBaseName(), withBaseName(variant), className)}\n ref={ref}\n {...restProps}\n >\n {children}\n </div>\n );\n});\n"],"names":["makePrefixer","forwardRef","Panel","jsx","clsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Panel.js","sources":["../src/panel/Panel.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes } from \"react\";\nimport { makePrefixer } from \"../utils\";\n\nimport panelCss from \"./Panel.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\n/**\n * Panel component that acts as wrapper around a node\n *\n * @example\n * const PanelExample = () => (\n * <Panel>\n * <p>This is a panel around some text.</p>\n * </Panel>\n * );\n *\n */\n\nexport interface PanelProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Styling variant; defaults to \"primary\".\n */\n variant?: \"primary\" | \"secondary\";\n}\n\nconst withBaseName = makePrefixer(\"saltPanel\");\n\nexport const Panel = forwardRef<HTMLDivElement, PanelProps>(function Panel(\n { className, children, variant = \"primary\", ...restProps },\n ref\n) {\n const { window: targetWindow } = useWindow();\n useComponentCssInjection({\n id: \"salt-panel\",\n css: panelCss,\n window: targetWindow,\n });\n\n return (\n <div\n className={clsx(withBaseName(), withBaseName(variant), className)}\n ref={ref}\n {...restProps}\n >\n {children}\n </div>\n );\n});\n"],"names":["makePrefixer","forwardRef","Panel","useWindow","useComponentCssInjection","panelCss","jsx","clsx"],"mappings":";;;;;;;;;;;;;;;;AA2BA,MAAM,YAAA,GAAeA,0BAAa,WAAW,CAAA,CAAA;AAEhC,MAAA,KAAA,GAAQC,gBAAuC,CAAA,SAASC,MACnE,CAAA,EAAE,SAAW,EAAA,QAAA,EAAU,OAAU,GAAA,SAAA,EAAA,GAAc,SAAU,EAAA,EACzD,GACA,EAAA;AACA,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAa,EAAA,GAAIC,gBAAU,EAAA,CAAA;AAC3C,EAAyBC,+BAAA,CAAA;AAAA,IACvB,EAAI,EAAA,YAAA;AAAA,IACJ,GAAK,EAAAC,OAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAA,uBACGC,cAAA,CAAA,KAAA,EAAA;AAAA,IACC,WAAWC,SAAK,CAAA,YAAA,IAAgB,YAAa,CAAA,OAAO,GAAG,SAAS,CAAA;AAAA,IAChE,GAAA;AAAA,IACC,GAAG,SAAA;AAAA,IAEH,QAAA;AAAA,GACH,CAAA,CAAA;AAEJ,CAAC;;;;"}
|
|
@@ -12,7 +12,9 @@ var useIsomorphicLayoutEffect = require('../utils/useIsomorphicLayoutEffect.js')
|
|
|
12
12
|
var ViewportProvider = require('../viewport/ViewportProvider.js');
|
|
13
13
|
var AriaAnnouncerProvider = require('../aria-announcer/AriaAnnouncerProvider.js');
|
|
14
14
|
var Breakpoints = require('../breakpoints/Breakpoints.js');
|
|
15
|
-
require('./SaltProvider.css.js');
|
|
15
|
+
var SaltProvider$1 = require('./SaltProvider.css.js');
|
|
16
|
+
var window = require('@salt-ds/window');
|
|
17
|
+
var styles = require('@salt-ds/styles');
|
|
16
18
|
|
|
17
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
18
20
|
|
|
@@ -91,15 +93,21 @@ function SaltProvider({
|
|
|
91
93
|
mode,
|
|
92
94
|
applyClassesTo
|
|
93
95
|
);
|
|
96
|
+
const { window: targetWindow } = window.useWindow();
|
|
97
|
+
styles.useComponentCssInjection({
|
|
98
|
+
id: "salt-provider",
|
|
99
|
+
css: SaltProvider$1,
|
|
100
|
+
window: targetWindow
|
|
101
|
+
});
|
|
94
102
|
useIsomorphicLayoutEffect.useIsomorphicLayoutEffect(() => {
|
|
95
103
|
const themeNames = themeName === DEFAULT_THEME_NAME ? [DEFAULT_THEME_NAME] : [DEFAULT_THEME_NAME, themeName];
|
|
96
104
|
if (applyClassesTo === "root") {
|
|
97
105
|
if (isRoot) {
|
|
98
|
-
document.documentElement.classList.add(
|
|
106
|
+
targetWindow.document.documentElement.classList.add(
|
|
99
107
|
...themeNames,
|
|
100
108
|
`salt-density-${density}`
|
|
101
109
|
);
|
|
102
|
-
document.documentElement.dataset.mode = mode;
|
|
110
|
+
targetWindow.document.documentElement.dataset.mode = mode;
|
|
103
111
|
} else {
|
|
104
112
|
console.warn(
|
|
105
113
|
"\nSaltProvider can only apply CSS classes to the root if it is the root level SaltProvider."
|
|
@@ -108,11 +116,11 @@ function SaltProvider({
|
|
|
108
116
|
}
|
|
109
117
|
return () => {
|
|
110
118
|
if (applyClassesTo === "root") {
|
|
111
|
-
document.documentElement.classList.remove(
|
|
119
|
+
targetWindow.document.documentElement.classList.remove(
|
|
112
120
|
...themeNames,
|
|
113
121
|
`salt-density-${density}`
|
|
114
122
|
);
|
|
115
|
-
document.documentElement.dataset.mode = void 0;
|
|
123
|
+
targetWindow.document.documentElement.dataset.mode = void 0;
|
|
116
124
|
}
|
|
117
125
|
};
|
|
118
126
|
}, [applyClassesTo, density, isRoot, mode, themeName]);
|