@redsift/design-system 11.9.4-muiv5 → 12.0.0-muiv5
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/CONTRIBUTING.md +1 -5
- package/_internal/Alert2.js +9 -4
- package/_internal/Alert2.js.map +1 -1
- package/_internal/AppContent.js +9 -4
- package/_internal/AppContent.js.map +1 -1
- package/_internal/Badge2.js +9 -4
- package/_internal/Badge2.js.map +1 -1
- package/_internal/Breadcrumbs2.js +9 -4
- package/_internal/Breadcrumbs2.js.map +1 -1
- package/_internal/Button2.js +9 -4
- package/_internal/Button2.js.map +1 -1
- package/_internal/ButtonGroup.js +15 -6
- package/_internal/ButtonGroup.js.map +1 -1
- package/_internal/ButtonLink.js +1 -1
- package/_internal/Card2.js +9 -4
- package/_internal/Card2.js.map +1 -1
- package/_internal/CardActions.js +16 -12
- package/_internal/CardActions.js.map +1 -1
- package/_internal/CardBody.js +9 -4
- package/_internal/CardBody.js.map +1 -1
- package/_internal/CardHeader.js +13 -4
- package/_internal/CardHeader.js.map +1 -1
- package/_internal/Checkbox2.js +9 -4
- package/_internal/Checkbox2.js.map +1 -1
- package/_internal/CheckboxGroup.js +9 -4
- package/_internal/CheckboxGroup.js.map +1 -1
- package/_internal/DetailedCard.js +24 -12
- package/_internal/DetailedCard.js.map +1 -1
- package/_internal/Flexbox2.js +21 -16
- package/_internal/Flexbox2.js.map +1 -1
- package/_internal/Grid2.js +21 -16
- package/_internal/Grid2.js.map +1 -1
- package/_internal/GridItem.js +9 -4
- package/_internal/GridItem.js.map +1 -1
- package/_internal/Heading2.js +9 -4
- package/_internal/Heading2.js.map +1 -1
- package/_internal/Icon2.js +10 -5
- package/_internal/Icon2.js.map +1 -1
- package/_internal/IconButton.js +9 -4
- package/_internal/IconButton.js.map +1 -1
- package/_internal/IconButtonLink.js +1 -1
- package/_internal/Item2.js +16 -7
- package/_internal/Item2.js.map +1 -1
- package/_internal/Link2.js +9 -4
- package/_internal/Link2.js.map +1 -1
- package/_internal/LinkButton.js +2 -1
- package/_internal/LinkButton.js.map +1 -1
- package/_internal/Listbox2.js +14 -8
- package/_internal/Listbox2.js.map +1 -1
- package/_internal/Number2.js +10 -5
- package/_internal/Number2.js.map +1 -1
- package/_internal/NumberField.js +11 -6
- package/_internal/NumberField.js.map +1 -1
- package/_internal/Pill2.js +9 -4
- package/_internal/Pill2.js.map +1 -1
- package/_internal/ProgressBar.js +20 -11
- package/_internal/ProgressBar.js.map +1 -1
- package/_internal/Radio2.js +9 -4
- package/_internal/Radio2.js.map +1 -1
- package/_internal/RadioGroup.js +9 -4
- package/_internal/RadioGroup.js.map +1 -1
- package/_internal/Shield2.js +12 -7
- package/_internal/Shield2.js.map +1 -1
- package/_internal/SideNavigationMenu.js +1 -1
- package/_internal/Skeleton2.js +9 -4
- package/_internal/Skeleton2.js.map +1 -1
- package/_internal/SkeletonCircle.js +1 -1
- package/_internal/SkeletonText.js +1 -1
- package/_internal/Spinner2.js +9 -4
- package/_internal/Spinner2.js.map +1 -1
- package/_internal/Switch2.js +9 -4
- package/_internal/Switch2.js.map +1 -1
- package/_internal/SwitchGroup.js +9 -4
- package/_internal/SwitchGroup.js.map +1 -1
- package/_internal/Text2.js +13 -6
- package/_internal/Text2.js.map +1 -1
- package/_internal/TextArea.js +18 -12
- package/_internal/TextArea.js.map +1 -1
- package/_internal/TextField.js +12 -6
- package/_internal/TextField.js.map +1 -1
- package/_internal/_rollupPluginBabelHelpers.js +1 -1
- package/_internal/button.js +1 -1
- package/_internal/colors.js +1 -1
- package/_internal/icon-button.js +1 -1
- package/_internal/link.js +1 -1
- package/_internal/shared.js +1 -1
- package/_internal/styles.js +309 -217
- package/_internal/styles.js.map +1 -1
- package/_internal/styles2.js +202 -14
- package/_internal/styles2.js.map +1 -1
- package/_internal/styles3.js +30 -128
- package/_internal/styles3.js.map +1 -1
- package/_internal/styles4.js +129 -234
- package/_internal/styles4.js.map +1 -1
- package/_internal/styles5.js +227 -118
- package/_internal/styles5.js.map +1 -1
- package/_internal/styles6.js +128 -69
- package/_internal/styles6.js.map +1 -1
- package/_internal/styles7.js +84 -0
- package/_internal/styles7.js.map +1 -0
- package/_internal/text.js +1 -1
- package/_internal/types2.js.map +1 -1
- package/_internal/useFocusOnList.js +1 -1
- package/_internal/useFocusRing.js +1 -1
- package/_internal/useListboxItem.js.map +1 -1
- package/_internal/useLocalizedStringFormatter.js +1 -1
- package/_internal/useMessageFormatter.js +1 -1
- package/_internal/useNumberFormatter.js +1 -1
- package/index.d.ts +227 -136
- package/index.js +8 -164
- package/index.js.map +1 -1
- package/package.json +5 -6
package/_internal/Flexbox2.js
CHANGED
|
@@ -2,7 +2,8 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
|
|
|
2
2
|
import React__default, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import {
|
|
5
|
+
import { j as baseContainer } from './styles5.js';
|
|
6
|
+
import { i as getContainerStylingTransientProps } from './styles.js';
|
|
6
7
|
import { u as useTheme, a as ThemeProvider } from './useTheme.js';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -11,15 +12,11 @@ import { u as useTheme, a as ThemeProvider } from './useTheme.js';
|
|
|
11
12
|
const StyledFlexbox = styled.div`
|
|
12
13
|
display: ${_ref => {
|
|
13
14
|
let {
|
|
14
|
-
inline
|
|
15
|
+
$inline
|
|
15
16
|
} = _ref;
|
|
16
|
-
return inline ? 'inline-flex' : 'flex';
|
|
17
|
+
return $inline ? 'inline-flex' : 'flex';
|
|
17
18
|
}};
|
|
18
|
-
|
|
19
|
-
${baseStyling}
|
|
20
|
-
${baseInternalSpacing}
|
|
21
|
-
${baseBorder}
|
|
22
|
-
${baseFlexbox}
|
|
19
|
+
${baseContainer}
|
|
23
20
|
|
|
24
21
|
${_ref2 => {
|
|
25
22
|
let {
|
|
@@ -30,7 +27,7 @@ const StyledFlexbox = styled.div`
|
|
|
30
27
|
> *:not(:empty) {
|
|
31
28
|
position: relative;
|
|
32
29
|
|
|
33
|
-
|
|
30
|
+
&::before {
|
|
34
31
|
content: '';
|
|
35
32
|
position: absolute;
|
|
36
33
|
background-color: var(--redsift-color-neutral-light-grey);
|
|
@@ -39,7 +36,7 @@ const StyledFlexbox = styled.div`
|
|
|
39
36
|
inset-inline-start: calc(${Math.max(1, $divider.colGap / 2)}px * -1);
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
|
|
39
|
+
&::after {
|
|
43
40
|
content: '';
|
|
44
41
|
position: absolute;
|
|
45
42
|
background-color: var(--redsift-color-neutral-light-grey);
|
|
@@ -54,7 +51,8 @@ const StyledFlexbox = styled.div`
|
|
|
54
51
|
}}
|
|
55
52
|
`;
|
|
56
53
|
|
|
57
|
-
const _excluded = ["
|
|
54
|
+
const _excluded = ["$gap"],
|
|
55
|
+
_excluded2 = ["as", "children", "className", "divider", "theme"];
|
|
58
56
|
const COMPONENT_NAME = 'Flexbox';
|
|
59
57
|
const CLASSNAME = 'redsift-flex-box';
|
|
60
58
|
|
|
@@ -62,15 +60,22 @@ const CLASSNAME = 'redsift-flex-box';
|
|
|
62
60
|
* The Flexbox component.
|
|
63
61
|
*/
|
|
64
62
|
const Flexbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
63
|
+
const {
|
|
64
|
+
transientProps,
|
|
65
|
+
otherProps
|
|
66
|
+
} = getContainerStylingTransientProps(props);
|
|
67
|
+
const {
|
|
68
|
+
$gap = '16px'
|
|
69
|
+
} = transientProps,
|
|
70
|
+
otherTransientProps = _objectWithoutProperties(transientProps, _excluded);
|
|
65
71
|
const {
|
|
66
72
|
as,
|
|
67
73
|
children,
|
|
68
74
|
className,
|
|
69
75
|
divider,
|
|
70
|
-
gap = '16px',
|
|
71
76
|
theme: propsTheme
|
|
72
|
-
} =
|
|
73
|
-
forwardedProps = _objectWithoutProperties(
|
|
77
|
+
} = otherProps,
|
|
78
|
+
forwardedProps = _objectWithoutProperties(otherProps, _excluded2);
|
|
74
79
|
const theme = useTheme(propsTheme);
|
|
75
80
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
76
81
|
value: {
|
|
@@ -78,8 +83,8 @@ const Flexbox = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
78
83
|
}
|
|
79
84
|
}, /*#__PURE__*/React__default.createElement(StyledFlexbox, _extends({
|
|
80
85
|
as: as
|
|
81
|
-
}, forwardedProps, {
|
|
82
|
-
gap: divider ? `${divider.rowGap}px ${divider.colGap}px` : gap,
|
|
86
|
+
}, forwardedProps, otherTransientProps, {
|
|
87
|
+
$gap: divider ? `${divider.rowGap}px ${divider.colGap}px` : $gap,
|
|
83
88
|
className: classNames(Flexbox.className, className),
|
|
84
89
|
ref: ref,
|
|
85
90
|
$divider: divider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flexbox2.js","sources":["../../src/components/flexbox/styles.ts","../../src/components/flexbox/Flexbox.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport {
|
|
1
|
+
{"version":3,"file":"Flexbox2.js","sources":["../../src/components/flexbox/styles.ts","../../src/components/flexbox/Flexbox.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { baseContainer } from '../shared';\nimport { StyledFlexboxProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledFlexbox = styled.div<StyledFlexboxProps>`\n display: ${({ $inline }) => ($inline ? 'inline-flex' : 'flex')};\n ${baseContainer}\n\n ${({ $divider }) =>\n $divider\n ? css`\n overflow: hidden;\n > *:not(:empty) {\n position: relative;\n\n &::before {\n content: '';\n position: absolute;\n background-color: var(--redsift-color-neutral-light-grey);\n inline-size: 1px;\n block-size: 100%;\n inset-inline-start: calc(${Math.max(1, $divider.colGap / 2)}px * -1);\n }\n\n &::after {\n content: '';\n position: absolute;\n background-color: var(--redsift-color-neutral-light-grey);\n inline-size: 200vw;\n block-size: 1px;\n inset-inline-start: -100vw;\n inset-block-start: calc(${Math.max(1, $divider.rowGap / 2)}px * -1);\n z-index: 0;\n }\n }\n `\n : ''}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, getContainerStylingTransientProps } from '../../types';\nimport { StyledFlexbox } from './styles';\nimport { FlexboxProps } from './types';\nimport { ThemeProvider, useTheme } from '../theme';\n\nconst COMPONENT_NAME = 'Flexbox';\nconst CLASSNAME = 'redsift-flex-box';\n\n/**\n * The Flexbox component.\n */\nexport const Flexbox: Comp<FlexboxProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getContainerStylingTransientProps(props);\n const { $gap = '16px', ...otherTransientProps } = transientProps;\n\n const { as, children, className, divider, theme: propsTheme, ...forwardedProps } = otherProps;\n\n const theme = useTheme(propsTheme);\n\n return (\n <ThemeProvider value={{ theme }}>\n <StyledFlexbox\n as={as}\n {...forwardedProps}\n {...otherTransientProps}\n $gap={divider ? `${divider.rowGap}px ${divider.colGap}px` : $gap}\n className={classNames(Flexbox.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n $divider={divider}\n $theme={theme}\n >\n {children}\n </StyledFlexbox>\n </ThemeProvider>\n );\n});\nFlexbox.className = CLASSNAME;\nFlexbox.displayName = COMPONENT_NAME;\n"],"names":["StyledFlexbox","styled","div","_ref","$inline","baseContainer","_ref2","$divider","css","Math","max","colGap","rowGap","COMPONENT_NAME","CLASSNAME","Flexbox","forwardRef","props","ref","transientProps","otherProps","getContainerStylingTransientProps","$gap","otherTransientProps","_objectWithoutProperties","_excluded","as","children","className","divider","theme","propsTheme","forwardedProps","_excluded2","useTheme","React","createElement","ThemeProvider","value","_extends","classNames","$theme","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,aAAa,GAAGC,MAAM,CAACC,GAAwB,CAAA;AAC5D,WAAA,EAAaC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,OAAAA;AAAQ,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,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;AAE7F,EAAA,MAAMH,KAAK,GAAGI,QAAQ,CAACH,UAAU,CAAC,CAAA;AAElC,EAAA,oBACEI,cAAA,CAAAC,aAAA,CAACC,aAAa,EAAA;AAACC,IAAAA,KAAK,EAAE;AAAER,MAAAA,KAAAA;AAAM,KAAA;AAAE,GAAA,eAC9BK,cAAA,CAAAC,aAAA,CAACpC,aAAa,EAAAuC,QAAA,CAAA;AACZb,IAAAA,EAAE,EAAEA,EAAAA;GACAM,EAAAA,cAAc,EACdT,mBAAmB,EAAA;AACvBD,IAAAA,IAAI,EAAEO,OAAO,GAAI,CAAA,EAAEA,OAAO,CAACjB,MAAO,CAAA,GAAA,EAAKiB,OAAO,CAAClB,MAAO,CAAA,EAAA,CAAG,GAAGW,IAAK;IACjEM,SAAS,EAAEY,UAAU,CAACzB,OAAO,CAACa,SAAS,EAAEA,SAAS,CAAE;AACpDV,IAAAA,GAAG,EAAEA,GAAiC;AACtCX,IAAAA,QAAQ,EAAEsB,OAAQ;AAClBY,IAAAA,MAAM,EAAEX,KAAAA;GAEPH,CAAAA,EAAAA,QACY,CACF,CAAC,CAAA;AAEpB,CAAC,EAAC;AACFZ,OAAO,CAACa,SAAS,GAAGd,SAAS,CAAA;AAC7BC,OAAO,CAAC2B,WAAW,GAAG7B,cAAc;;;;"}
|
package/_internal/Grid2.js
CHANGED
|
@@ -2,8 +2,9 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
|
|
|
2
2
|
import React__default, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import {
|
|
5
|
+
import { j as baseContainer } from './styles5.js';
|
|
6
6
|
import { G as GridItem } from './GridItem.js';
|
|
7
|
+
import { i as getContainerStylingTransientProps } from './styles.js';
|
|
7
8
|
import { u as useTheme, a as ThemeProvider } from './useTheme.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -12,16 +13,12 @@ import { u as useTheme, a as ThemeProvider } from './useTheme.js';
|
|
|
12
13
|
const StyledGrid = styled.div`
|
|
13
14
|
display: ${_ref => {
|
|
14
15
|
let {
|
|
15
|
-
inline
|
|
16
|
+
$inline
|
|
16
17
|
} = _ref;
|
|
17
|
-
return inline ? 'inline-grid' : 'grid';
|
|
18
|
+
return $inline ? 'inline-grid' : 'grid';
|
|
18
19
|
}};
|
|
19
|
-
flex: 1;
|
|
20
20
|
|
|
21
|
-
${
|
|
22
|
-
${baseInternalSpacing}
|
|
23
|
-
${baseGrid}
|
|
24
|
-
${baseBorder}
|
|
21
|
+
${baseContainer}
|
|
25
22
|
|
|
26
23
|
${_ref2 => {
|
|
27
24
|
let {
|
|
@@ -32,7 +29,7 @@ const StyledGrid = styled.div`
|
|
|
32
29
|
> .redsift-grid-item:not(:empty) {
|
|
33
30
|
position: relative;
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
&::before {
|
|
36
33
|
content: '';
|
|
37
34
|
position: absolute;
|
|
38
35
|
background-color: var(--redsift-color-neutral-light-grey);
|
|
@@ -41,7 +38,7 @@ const StyledGrid = styled.div`
|
|
|
41
38
|
inset-inline-start: calc(${Math.max(1, $divider.colGap / 2)}px * -1);
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
|
|
41
|
+
&::after {
|
|
45
42
|
content: '';
|
|
46
43
|
position: absolute;
|
|
47
44
|
background-color: var(--redsift-color-neutral-light-grey);
|
|
@@ -56,7 +53,8 @@ const StyledGrid = styled.div`
|
|
|
56
53
|
}}
|
|
57
54
|
`;
|
|
58
55
|
|
|
59
|
-
const _excluded = ["
|
|
56
|
+
const _excluded = ["$gap"],
|
|
57
|
+
_excluded2 = ["children", "className", "divider", "theme"];
|
|
60
58
|
const COMPONENT_NAME = 'Grid';
|
|
61
59
|
const CLASSNAME = 'redsift-grid';
|
|
62
60
|
|
|
@@ -64,21 +62,28 @@ const CLASSNAME = 'redsift-grid';
|
|
|
64
62
|
* The Grid component.
|
|
65
63
|
*/
|
|
66
64
|
const BaseGrid = /*#__PURE__*/forwardRef((props, ref) => {
|
|
65
|
+
const {
|
|
66
|
+
transientProps,
|
|
67
|
+
otherProps
|
|
68
|
+
} = getContainerStylingTransientProps(props);
|
|
69
|
+
const {
|
|
70
|
+
$gap
|
|
71
|
+
} = transientProps,
|
|
72
|
+
otherTransientProps = _objectWithoutProperties(transientProps, _excluded);
|
|
67
73
|
const {
|
|
68
74
|
children,
|
|
69
75
|
className,
|
|
70
76
|
divider,
|
|
71
|
-
gap,
|
|
72
77
|
theme: propsTheme
|
|
73
|
-
} =
|
|
74
|
-
forwardedProps = _objectWithoutProperties(
|
|
78
|
+
} = otherProps,
|
|
79
|
+
forwardedProps = _objectWithoutProperties(otherProps, _excluded2);
|
|
75
80
|
const theme = useTheme(propsTheme);
|
|
76
81
|
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
77
82
|
value: {
|
|
78
83
|
theme
|
|
79
84
|
}
|
|
80
|
-
}, /*#__PURE__*/React__default.createElement(StyledGrid, _extends({}, forwardedProps, {
|
|
81
|
-
gap: divider ? `${divider.rowGap}px ${divider.colGap}px` : gap,
|
|
85
|
+
}, /*#__PURE__*/React__default.createElement(StyledGrid, _extends({}, forwardedProps, otherTransientProps, {
|
|
86
|
+
$gap: divider ? `${divider.rowGap}px ${divider.colGap}px` : $gap,
|
|
82
87
|
className: classNames(BaseGrid.className, className),
|
|
83
88
|
ref: ref,
|
|
84
89
|
$divider: divider,
|
package/_internal/Grid2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid2.js","sources":["../../src/components/grid/styles.ts","../../src/components/grid/Grid.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport {
|
|
1
|
+
{"version":3,"file":"Grid2.js","sources":["../../src/components/grid/styles.ts","../../src/components/grid/Grid.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { baseContainer } from '../shared';\nimport { StyledGridProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledGrid = styled.div<StyledGridProps>`\n display: ${({ $inline }) => ($inline ? 'inline-grid' : 'grid')};\n\n ${baseContainer}\n\n ${({ $divider }) =>\n $divider\n ? css`\n overflow: hidden;\n > .redsift-grid-item:not(:empty) {\n position: relative;\n\n &::before {\n content: '';\n position: absolute;\n background-color: var(--redsift-color-neutral-light-grey);\n inline-size: 1px;\n block-size: 100%;\n inset-inline-start: calc(${Math.max(1, $divider.colGap / 2)}px * -1);\n }\n\n &::after {\n content: '';\n position: absolute;\n background-color: var(--redsift-color-neutral-light-grey);\n inline-size: 200vw;\n block-size: 1px;\n inset-inline-start: -100vw;\n inset-block-start: calc(${Math.max(1, $divider.rowGap / 2)}px * -1);\n z-index: 0;\n }\n }\n `\n : ''}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, getContainerStylingTransientProps } from '../../types';\nimport { StyledGrid } from './styles';\nimport { GridProps } from './types';\nimport { GridItem } from '../grid-item';\nimport { ThemeProvider, useTheme } from '../theme';\n\nconst COMPONENT_NAME = 'Grid';\nconst CLASSNAME = 'redsift-grid';\n\n/**\n * The Grid component.\n */\nexport const BaseGrid: Comp<GridProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getContainerStylingTransientProps(props);\n const { $gap, ...otherTransientProps } = transientProps;\n\n const { children, className, divider, theme: propsTheme, ...forwardedProps } = otherProps;\n const theme = useTheme(propsTheme);\n\n return (\n <ThemeProvider value={{ theme }}>\n <StyledGrid\n {...forwardedProps}\n {...otherTransientProps}\n $gap={divider ? `${divider.rowGap}px ${divider.colGap}px` : $gap}\n className={classNames(BaseGrid.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n $divider={divider}\n $theme={theme}\n >\n {children}\n </StyledGrid>\n </ThemeProvider>\n );\n});\nBaseGrid.className = CLASSNAME;\nBaseGrid.displayName = COMPONENT_NAME;\n\nexport const Grid = Object.assign(BaseGrid, {\n Item: GridItem,\n});\n"],"names":["StyledGrid","styled","div","_ref","$inline","baseContainer","_ref2","$divider","css","Math","max","colGap","rowGap","COMPONENT_NAME","CLASSNAME","BaseGrid","forwardRef","props","ref","transientProps","otherProps","getContainerStylingTransientProps","$gap","otherTransientProps","_objectWithoutProperties","_excluded","children","className","divider","theme","propsTheme","forwardedProps","_excluded2","useTheme","React","createElement","ThemeProvider","value","_extends","classNames","$theme","displayName","Grid","Object","assign","Item","GridItem"],"mappings":";;;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,UAAU,GAAGC,MAAM,CAACC,GAAqB,CAAA;AACtD,WAAA,EAAaC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,OAAAA;AAAQ,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,OAAMC,OAAO,GAAG,aAAa,GAAG,MAAM,CAAA;AAAA,CAAE,CAAA;AACjE;AACA,EAAA,EAAIC,aAAc,CAAA;AAClB;AACA,EAAA,EAAIC,KAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,QAAAA;AAAS,GAAC,GAAAD,KAAA,CAAA;EAAA,OACbC,QAAQ,GACJC,GAAI,CAAA;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAyCC,EAAAA,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACI,MAAM,GAAG,CAAC,CAAE,CAAA;AAC1E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sCAAwCF,EAAAA,IAAI,CAACC,GAAG,CAAC,CAAC,EAAEH,QAAQ,CAACK,MAAM,GAAG,CAAC,CAAE,CAAA;AACzE;AACA;AACA;AACA,QAAA,CAAS,GACD,EAAE,CAAA;AAAA,CAAC,CAAA;AACX,CAAC;;;;ACjCD,MAAMC,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAMC,SAAS,GAAG,cAAc,CAAA;;AAEhC;AACA;AACA;AACO,MAAMC,QAAyC,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;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ACC,MAAM,CAAC7B,QAAQ,EAAE;AAC1C8B,EAAAA,IAAI,EAAEC,QAAAA;AACR,CAAC;;;;"}
|
package/_internal/GridItem.js
CHANGED
|
@@ -2,7 +2,8 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
|
|
|
2
2
|
import React__default, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import styled from 'styled-components';
|
|
5
|
-
import { i as baseStyling, c as baseInternalSpacing, f as baseBorder } from './
|
|
5
|
+
import { i as baseStyling, c as baseInternalSpacing, f as baseBorder } from './styles5.js';
|
|
6
|
+
import { i as getContainerStylingTransientProps } from './styles.js';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Component style.
|
|
@@ -23,12 +24,16 @@ const CLASSNAME = 'redsift-grid-item';
|
|
|
23
24
|
* The GridItem component.
|
|
24
25
|
*/
|
|
25
26
|
const GridItem = /*#__PURE__*/forwardRef((props, ref) => {
|
|
27
|
+
const {
|
|
28
|
+
transientProps,
|
|
29
|
+
otherProps
|
|
30
|
+
} = getContainerStylingTransientProps(props);
|
|
26
31
|
const {
|
|
27
32
|
children,
|
|
28
33
|
className
|
|
29
|
-
} =
|
|
30
|
-
forwardedProps = _objectWithoutProperties(
|
|
31
|
-
return /*#__PURE__*/React__default.createElement(StyledGridItem, _extends({}, forwardedProps, {
|
|
34
|
+
} = otherProps,
|
|
35
|
+
forwardedProps = _objectWithoutProperties(otherProps, _excluded);
|
|
36
|
+
return /*#__PURE__*/React__default.createElement(StyledGridItem, _extends({}, forwardedProps, transientProps, {
|
|
32
37
|
className: classNames(GridItem.className, className),
|
|
33
38
|
ref: ref
|
|
34
39
|
}), children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GridItem.js","sources":["../../src/components/grid-item/styles.ts","../../src/components/grid-item/GridItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { baseBorder, baseInternalSpacing, baseStyling } from '../shared';\nimport { StyledGridItemProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledGridItem = styled.div<StyledGridItemProps>`\n display: inherit;\n\n ${baseStyling}\n ${baseInternalSpacing}\n ${baseBorder}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp } from '../../types';\nimport { StyledGridItem } from './styles';\nimport { GridItemProps } from './types';\n\nconst COMPONENT_NAME = 'GridItem';\nconst CLASSNAME = 'redsift-grid-item';\n\n/**\n * The GridItem component.\n */\nexport const GridItem: Comp<GridItemProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { children, className, ...forwardedProps } =
|
|
1
|
+
{"version":3,"file":"GridItem.js","sources":["../../src/components/grid-item/styles.ts","../../src/components/grid-item/GridItem.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { baseBorder, baseInternalSpacing, baseStyling } from '../shared';\nimport { StyledGridItemProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledGridItem = styled.div<StyledGridItemProps>`\n display: inherit;\n\n ${baseStyling}\n ${baseInternalSpacing}\n ${baseBorder}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, getContainerStylingTransientProps } from '../../types';\nimport { StyledGridItem } from './styles';\nimport { GridItemProps } from './types';\n\nconst COMPONENT_NAME = 'GridItem';\nconst CLASSNAME = 'redsift-grid-item';\n\n/**\n * The GridItem component.\n */\nexport const GridItem: Comp<GridItemProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getContainerStylingTransientProps(props);\n\n const { children, className, ...forwardedProps } = otherProps;\n\n return (\n <StyledGridItem\n {...forwardedProps}\n {...transientProps}\n className={classNames(GridItem.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n >\n {children}\n </StyledGridItem>\n );\n});\nGridItem.className = CLASSNAME;\nGridItem.displayName = COMPONENT_NAME;\n"],"names":["StyledGridItem","styled","div","baseStyling","baseInternalSpacing","baseBorder","COMPONENT_NAME","CLASSNAME","GridItem","forwardRef","props","ref","transientProps","otherProps","getContainerStylingTransientProps","children","className","forwardedProps","_objectWithoutProperties","_excluded","React","createElement","_extends","classNames","displayName"],"mappings":";;;;;;;AAIA;AACA;AACA;AACO,MAAMA,cAAc,GAAGC,MAAM,CAACC,GAAyB,CAAA;AAC9D;AACA;AACA,EAAA,EAAIC,WAAY,CAAA;AAChB,EAAA,EAAIC,mBAAoB,CAAA;AACxB,EAAA,EAAIC,UAAW,CAAA;AACf,CAAC;;;ACPD,MAAMC,cAAc,GAAG,UAAU,CAAA;AACjC,MAAMC,SAAS,GAAG,mBAAmB,CAAA;;AAErC;AACA;AACA;AACO,MAAMC,QAA6C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACtF,MAAM;IAAEC,cAAc;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAGC,iCAAiC,CAACJ,KAAK,CAAC,CAAA;EAE/E,MAAM;MAAEK,QAAQ;AAAEC,MAAAA,SAAAA;AAA6B,KAAC,GAAGH,UAAU;AAA7BI,IAAAA,cAAc,GAAAC,wBAAA,CAAKL,UAAU,EAAAM,SAAA,CAAA,CAAA;EAE7D,oBACEC,cAAA,CAAAC,aAAA,CAACrB,cAAc,EAAAsB,QAAA,CAAA,EAAA,EACTL,cAAc,EACdL,cAAc,EAAA;IAClBI,SAAS,EAAEO,UAAU,CAACf,QAAQ,CAACQ,SAAS,EAAEA,SAAS,CAAE;AACrDL,IAAAA,GAAG,EAAEA,GAAAA;AAAiC,GAAA,CAAA,EAErCI,QACa,CAAC,CAAA;AAErB,CAAC,EAAC;AACFP,QAAQ,CAACQ,SAAS,GAAGT,SAAS,CAAA;AAC9BC,QAAQ,CAACgB,WAAW,GAAGlB,cAAc;;;;"}
|
package/_internal/Heading2.js
CHANGED
|
@@ -2,8 +2,9 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
|
|
|
2
2
|
import React__default, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import { i as baseStyling } from './
|
|
5
|
+
import { i as baseStyling } from './styles5.js';
|
|
6
6
|
import { N as NotificationsColorPalette, g as NeutralColorPalette, e as ProductColorPalette } from './colors.js';
|
|
7
|
+
import { f as getStylingTransientProps } from './styles.js';
|
|
7
8
|
import { F as FontFamily } from './fonts.js';
|
|
8
9
|
import { u as useTheme } from './useTheme.js';
|
|
9
10
|
|
|
@@ -76,6 +77,10 @@ const CLASSNAME = 'redsift-heading';
|
|
|
76
77
|
* The Heading component.
|
|
77
78
|
*/
|
|
78
79
|
const Heading = /*#__PURE__*/forwardRef((props, ref) => {
|
|
80
|
+
const {
|
|
81
|
+
transientProps,
|
|
82
|
+
otherProps
|
|
83
|
+
} = getStylingTransientProps(props);
|
|
79
84
|
const {
|
|
80
85
|
as,
|
|
81
86
|
children,
|
|
@@ -88,12 +93,12 @@ const Heading = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
88
93
|
noWrap,
|
|
89
94
|
theme: propsTheme,
|
|
90
95
|
variant
|
|
91
|
-
} =
|
|
92
|
-
forwardedProps = _objectWithoutProperties(
|
|
96
|
+
} = otherProps,
|
|
97
|
+
forwardedProps = _objectWithoutProperties(otherProps, _excluded);
|
|
93
98
|
const theme = useTheme(propsTheme);
|
|
94
99
|
return /*#__PURE__*/React__default.createElement(StyledHeading, _extends({
|
|
95
100
|
as: as
|
|
96
|
-
}, forwardedProps, {
|
|
101
|
+
}, forwardedProps, transientProps, {
|
|
97
102
|
className: classNames(Heading.className, className),
|
|
98
103
|
ref: ref,
|
|
99
104
|
$noWrap: noWrap,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Heading2.js","sources":["../../src/components/heading/styles.ts","../../src/components/heading/Heading.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { baseStyling } from '../shared';\nimport { StyledHeadingProps } from './types';\nimport { NotificationsColorPalette, NeutralColorPalette, ProductColorPalette } from '../../types';\n\n/**\n * Component style.\n */\nexport const StyledHeading = styled.span<StyledHeadingProps>`\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n\n ${baseStyling}\n\n ${({ $color, $theme }) =>\n $color && $color === 'radar'\n ? css`\n background: linear-gradient(90deg, #51b78e 0%, #0081c3 100%);\n background-clip: text;\n color: transparent;\n `\n : Object.keys(NotificationsColorPalette).indexOf($color!) !== -1\n ? css`\n color: var(--redsift-color-notifications-${$color}-primary);\n `\n : Object.keys(NeutralColorPalette).indexOf($color!) !== -1\n ? css`\n color: var(--redsift-color-neutral-${$color});\n `\n : Object.keys(ProductColorPalette).indexOf($color!) !== -1\n ? css`\n color: var(--redsift-color-product-${$color});\n `\n : css`\n color: ${$color || css`var(--redsift-color-${$theme}-components-text-primary)`};\n `}\n\n ${({ $variant, $fontFamily, $fontSize, $fontWeight, $lineHeight }) => css`\n font-family: ${$fontFamily\n ? css`var(--redsift-typography-font-family-${$fontFamily})`\n : css`var(--redsift-typography-${$variant ?? 'body'}-font-family)`};\n font-size: ${$fontSize ? $fontSize : css`var(--redsift-typography-${$variant ?? 'body'}-font-size)`};\n font-weight: ${$fontWeight ? $fontWeight : css`var(--redsift-typography-${$variant ?? 'body'}-font-weight)`};\n line-height: ${$lineHeight ? $lineHeight : css`var(--redsift-typography-${$variant ?? 'body'}-line-height)`};\n `}\n\n ${({ $noWrap }) =>\n $noWrap\n ? css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `\n : ''}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, FontFamily } from '../../types';\nimport { StyledHeading } from './styles';\nimport { HeadingProps } from './types';\nimport { useTheme } from '../theme';\n\nconst COMPONENT_NAME = 'Heading';\nconst CLASSNAME = 'redsift-heading';\n\n/**\n * The Heading component.\n */\nexport const Heading: Comp<HeadingProps, HTMLDivElement> = forwardRef((props, ref) => {\n const {\n as,\n children,\n className,\n color,\n fontFamily = FontFamily.poppins,\n fontSize,\n fontWeight,\n lineHeight,\n noWrap,\n theme: propsTheme,\n variant,\n ...forwardedProps\n } =
|
|
1
|
+
{"version":3,"file":"Heading2.js","sources":["../../src/components/heading/styles.ts","../../src/components/heading/Heading.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { baseStyling } from '../shared';\nimport { StyledHeadingProps } from './types';\nimport { NotificationsColorPalette, NeutralColorPalette, ProductColorPalette } from '../../types';\n\n/**\n * Component style.\n */\nexport const StyledHeading = styled.span<StyledHeadingProps>`\n margin: 0;\n padding: 0;\n border: 0;\n font-size: 100%;\n font: inherit;\n vertical-align: baseline;\n\n ${baseStyling}\n\n ${({ $color, $theme }) =>\n $color && $color === 'radar'\n ? css`\n background: linear-gradient(90deg, #51b78e 0%, #0081c3 100%);\n background-clip: text;\n color: transparent;\n `\n : Object.keys(NotificationsColorPalette).indexOf($color!) !== -1\n ? css`\n color: var(--redsift-color-notifications-${$color}-primary);\n `\n : Object.keys(NeutralColorPalette).indexOf($color!) !== -1\n ? css`\n color: var(--redsift-color-neutral-${$color});\n `\n : Object.keys(ProductColorPalette).indexOf($color!) !== -1\n ? css`\n color: var(--redsift-color-product-${$color});\n `\n : css`\n color: ${$color || css`var(--redsift-color-${$theme}-components-text-primary)`};\n `}\n\n ${({ $variant, $fontFamily, $fontSize, $fontWeight, $lineHeight }) => css`\n font-family: ${$fontFamily\n ? css`var(--redsift-typography-font-family-${$fontFamily})`\n : css`var(--redsift-typography-${$variant ?? 'body'}-font-family)`};\n font-size: ${$fontSize ? $fontSize : css`var(--redsift-typography-${$variant ?? 'body'}-font-size)`};\n font-weight: ${$fontWeight ? $fontWeight : css`var(--redsift-typography-${$variant ?? 'body'}-font-weight)`};\n line-height: ${$lineHeight ? $lineHeight : css`var(--redsift-typography-${$variant ?? 'body'}-line-height)`};\n `}\n\n ${({ $noWrap }) =>\n $noWrap\n ? css`\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `\n : ''}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, FontFamily, getStylingTransientProps } from '../../types';\nimport { StyledHeading } from './styles';\nimport { HeadingProps } from './types';\nimport { useTheme } from '../theme';\n\nconst COMPONENT_NAME = 'Heading';\nconst CLASSNAME = 'redsift-heading';\n\n/**\n * The Heading component.\n */\nexport const Heading: Comp<HeadingProps, HTMLDivElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getStylingTransientProps(props);\n\n const {\n as,\n children,\n className,\n color,\n fontFamily = FontFamily.poppins,\n fontSize,\n fontWeight,\n lineHeight,\n noWrap,\n theme: propsTheme,\n variant,\n ...forwardedProps\n } = otherProps;\n\n const theme = useTheme(propsTheme);\n\n return (\n <StyledHeading\n as={as}\n {...forwardedProps}\n {...transientProps}\n className={classNames(Heading.className, className)}\n ref={ref as RefObject<HTMLDivElement>}\n $noWrap={noWrap}\n $theme={theme}\n $color={color}\n $fontFamily={fontFamily}\n $fontSize={fontSize}\n $fontWeight={fontWeight}\n $lineHeight={lineHeight}\n $variant={variant ? variant : as === 'span' ? 'body' : as}\n >\n {children}\n </StyledHeading>\n );\n});\nHeading.className = CLASSNAME;\nHeading.displayName = COMPONENT_NAME;\n"],"names":["StyledHeading","styled","span","baseStyling","_ref","$color","$theme","css","Object","keys","NotificationsColorPalette","indexOf","NeutralColorPalette","ProductColorPalette","_ref2","$variant","$fontFamily","$fontSize","$fontWeight","$lineHeight","_ref3","$noWrap","COMPONENT_NAME","CLASSNAME","Heading","forwardRef","props","ref","transientProps","otherProps","getStylingTransientProps","as","children","className","color","fontFamily","FontFamily","poppins","fontSize","fontWeight","lineHeight","noWrap","theme","propsTheme","variant","forwardedProps","_objectWithoutProperties","_excluded","useTheme","React","createElement","_extends","classNames","displayName"],"mappings":";;;;;;;;;;AAKA;AACA;AACA;AACO,MAAMA,aAAa,GAAGC,MAAM,CAACC,IAAyB,CAAA;AAC7D;AACA;AACA;AACA;AACA;AACA;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;MACRC,UAAU;MACVC,UAAU;MACVC,MAAM;AACNC,MAAAA,KAAK,EAAEC,UAAU;AACjBC,MAAAA,OAAAA;AAEF,KAAC,GAAGf,UAAU;AADTgB,IAAAA,cAAc,GAAAC,wBAAA,CACfjB,UAAU,EAAAkB,SAAA,CAAA,CAAA;AAEd,EAAA,MAAML,KAAK,GAAGM,QAAQ,CAACL,UAAU,CAAC,CAAA;AAElC,EAAA,oBACEM,cAAA,CAAAC,aAAA,CAAClD,aAAa,EAAAmD,QAAA,CAAA;AACZpB,IAAAA,EAAE,EAAEA,EAAAA;GACAc,EAAAA,cAAc,EACdjB,cAAc,EAAA;IAClBK,SAAS,EAAEmB,UAAU,CAAC5B,OAAO,CAACS,SAAS,EAAEA,SAAS,CAAE;AACpDN,IAAAA,GAAG,EAAEA,GAAiC;AACtCN,IAAAA,OAAO,EAAEoB,MAAO;AAChBnC,IAAAA,MAAM,EAAEoC,KAAM;AACdrC,IAAAA,MAAM,EAAE6B,KAAM;AACdlB,IAAAA,WAAW,EAAEmB,UAAW;AACxBlB,IAAAA,SAAS,EAAEqB,QAAS;AACpBpB,IAAAA,WAAW,EAAEqB,UAAW;AACxBpB,IAAAA,WAAW,EAAEqB,UAAW;IACxBzB,QAAQ,EAAE6B,OAAO,GAAGA,OAAO,GAAGb,EAAE,KAAK,MAAM,GAAG,MAAM,GAAGA,EAAAA;AAAG,GAAA,CAAA,EAEzDC,QACY,CAAC,CAAA;AAEpB,CAAC,EAAC;AACFR,OAAO,CAACS,SAAS,GAAGV,SAAS,CAAA;AAC7BC,OAAO,CAAC6B,WAAW,GAAG/B,cAAc;;;;"}
|
package/_internal/Icon2.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { b as _objectWithoutProperties, c as _extends,
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends, a as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
2
2
|
import React__default, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import styled, { css } from 'styled-components';
|
|
5
|
-
import { i as baseStyling } from './
|
|
5
|
+
import { i as baseStyling } from './styles5.js';
|
|
6
6
|
import { N as NotificationsColorPalette, e as ProductColorPalette, T as Theme } from './colors.js';
|
|
7
|
+
import { f as getStylingTransientProps } from './styles.js';
|
|
7
8
|
import { u as useTheme } from './useTheme.js';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -158,6 +159,10 @@ const sizeToDimension = size => {
|
|
|
158
159
|
* The Icon component.
|
|
159
160
|
*/
|
|
160
161
|
const Icon = /*#__PURE__*/forwardRef((props, ref) => {
|
|
162
|
+
const {
|
|
163
|
+
transientProps,
|
|
164
|
+
otherProps
|
|
165
|
+
} = getStylingTransientProps(props);
|
|
161
166
|
const {
|
|
162
167
|
'aria-hidden': ariaHidden,
|
|
163
168
|
'aria-label': ariaLabel,
|
|
@@ -168,8 +173,8 @@ const Icon = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
168
173
|
size = IconSize.medium,
|
|
169
174
|
svgProps,
|
|
170
175
|
theme: propsTheme
|
|
171
|
-
} =
|
|
172
|
-
forwardedProps = _objectWithoutProperties(
|
|
176
|
+
} = otherProps,
|
|
177
|
+
forwardedProps = _objectWithoutProperties(otherProps, _excluded);
|
|
173
178
|
const theme = useTheme(propsTheme);
|
|
174
179
|
const {
|
|
175
180
|
width,
|
|
@@ -177,7 +182,7 @@ const Icon = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
177
182
|
fontSize,
|
|
178
183
|
lineHeight
|
|
179
184
|
} = sizeToDimension(size);
|
|
180
|
-
return /*#__PURE__*/React__default.createElement(StyledIcon, _extends({}, forwardedProps, {
|
|
185
|
+
return /*#__PURE__*/React__default.createElement(StyledIcon, _extends({}, forwardedProps, transientProps, {
|
|
181
186
|
$color: color,
|
|
182
187
|
$width: width,
|
|
183
188
|
$height: height,
|
package/_internal/Icon2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon2.js","sources":["../../src/components/icon/types.ts","../../src/components/icon/styles.ts","../../src/components/icon/Icon.tsx"],"sourcesContent":["import { ComponentProps, ReactElement } from 'react';\nimport {\n NotificationsColorPalette,\n LayoutProps,\n PositioningProps,\n SpacingProps,\n ValueOf,\n ProductColorPalette,\n Theme,\n} from '../../types';\n\n/**\n * Component size.\n */\nexport const IconSize = {\n xsmall: 'xsmall',\n small: 'small',\n medium: 'medium',\n large: 'large',\n xlarge: 'xlarge',\n xxlarge: 'xxlarge',\n} as const;\nexport type IconSize = ValueOf<typeof IconSize>;\n\nexport type IconDimensions = { width?: number; height?: number; fontSize?: number; lineHeight?: number };\n\n/**\n * Component props.\n */\nexport interface IconProps extends ComponentProps<'span'>, LayoutProps, SpacingProps, PositioningProps {\n /** Indicates whether the element is exposed to an accessibility API. */\n 'aria-hidden'?: boolean | 'false' | 'true';\n /** A screen reader only label for the Icon. */\n 'aria-label'?: string;\n /** Color variant. Either from color palette or hex or rgb strings. */\n color?: NotificationsColorPalette | ProductColorPalette | (string & {});\n /** Whether the icon has a badge attached to it. */\n badge?: ReactElement;\n /**\n * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />\n * Can also be a ReactElement.\n */\n icon: string | string[] | ReactElement;\n /** Icon size. */\n size?: IconSize | IconDimensions;\n /** Additional properties to forward to the SVG tag. */\n svgProps?: ComponentProps<'svg'>;\n /** Theme. */\n theme?: Theme;\n}\n\nexport type StyledIconProps = Omit<IconProps, 'color' | 'size' | 'icon' | 'svgProps'> & {\n $color: IconProps['color'];\n $width: IconDimensions['width'];\n $height: IconDimensions['height'];\n $fontSize: IconDimensions['fontSize'];\n $lineHeight: IconDimensions['lineHeight'];\n $theme: IconProps['theme'];\n};\n","import styled, { css } from 'styled-components';\nimport { NotificationsColorPalette, ProductColorPalette, Theme } from '../../types';\nimport { baseStyling } from '../shared';\nimport { StyledIconProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledIcon = styled.span<StyledIconProps>`\n position: relative;\n display: inline-grid;\n ${baseStyling}\n\n font-style: normal;\n\n svg {\n vertical-align: -0.125em;\n grid-column: 1;\n grid-row: 1;\n }\n\n ${({ $color, $theme }) =>\n $color && Object.keys(NotificationsColorPalette).indexOf($color) !== -1\n ? css`\n color: var(--redsift-color-notifications-${$color}-primary);\n `\n : $color && Object.keys(ProductColorPalette).indexOf($color) !== -1\n ? css`\n color: var(--redsift-color-product-${$color});\n `\n : css`\n color: ${$color || css`var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'})`};\n `}\n\n ${({ $width, $height, $fontSize, $lineHeight }) => css`\n ${$width\n ? css`\n width: ${$width}px;\n `\n : ''}\n ${$height\n ? css`\n height: ${$height}px;\n `\n : ''}\n ${$fontSize\n ? css`\n font-size: ${$fontSize}px;\n `\n : ''}\n ${$lineHeight\n ? css`\n line-height: ${$lineHeight}px;\n `\n : ''}\n\n & .redsift-badge-standard {\n grid-column: 1;\n grid-row: 1;\n margin-right: unset;\n ${$width\n ? css`\n margin-left: ${$width * 0.75}px;\n `\n : ''}\n ${$height\n ? css`\n margin-top: ${$height * 0.1 - 4}px;\n `\n : ''}\n }\n\n & .redsift-badge-dot {\n grid-column: 1;\n grid-row: 1;\n margin-right: unset;\n ${$width\n ? css`\n margin-left: ${$width * 0.8}px;\n `\n : ''}\n ${$height\n ? css`\n margin-top: ${$height * 0.2 - 3}px;\n `\n : ''}\n }\n `}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp } from '../../types';\nimport { StyledIcon } from './styles';\nimport { IconDimensions, IconProps, IconSize } from './types';\nimport { useTheme } from '../theme';\n\nconst COMPONENT_NAME = 'Icon';\nconst CLASSNAME = 'redsift-icon';\n\nexport const sizeToDimension = (size: IconSize | IconDimensions): IconDimensions => {\n if (typeof size !== 'string') {\n return size;\n }\n\n switch (size) {\n case IconSize.xsmall:\n return { width: 16, height: 16, fontSize: 16, lineHeight: 16 };\n case IconSize.small:\n return { width: 20, height: 20, fontSize: 20, lineHeight: 20 };\n case IconSize.medium:\n default:\n return { width: 24, height: 24, fontSize: 24, lineHeight: 24 };\n case IconSize.large:\n return { width: 30, height: 30, fontSize: 30, lineHeight: 30 };\n case IconSize.xlarge:\n return { width: 40, height: 40, fontSize: 40, lineHeight: 40 };\n case IconSize.xxlarge:\n return { width: 55, height: 55, fontSize: 55, lineHeight: 55 };\n }\n};\n\n/**\n * The Icon component.\n */\nexport const Icon: Comp<IconProps, HTMLSpanElement> = forwardRef((props, ref) => {\n const {\n 'aria-hidden': ariaHidden,\n 'aria-label': ariaLabel,\n badge,\n className,\n color,\n icon,\n size = IconSize.medium,\n svgProps,\n theme: propsTheme,\n ...forwardedProps\n } = props;\n\n const theme = useTheme(propsTheme);\n\n const { width, height, fontSize, lineHeight } = sizeToDimension(size!);\n\n return (\n <StyledIcon\n {...forwardedProps}\n $color={color}\n $width={width}\n $height={height}\n $fontSize={fontSize}\n $lineHeight={lineHeight}\n $theme={theme}\n aria-hidden={ariaLabel ? (ariaHidden ? ariaHidden : undefined) : true}\n aria-label={ariaLabel}\n className={classNames(Icon.className, className, color ? 'colored' : undefined)}\n ref={ref as RefObject<HTMLSpanElement>}\n >\n {React.cloneElement(\n typeof icon === 'string' || (Array.isArray(icon) && icon.every((it) => typeof it === 'string')) ? (\n <svg viewBox=\"0 0 24 24\">\n {(Array.isArray(icon) ? icon : [icon]).map((path) => (\n <path key={path} d={path} fill=\"currentColor\" />\n ))}\n </svg>\n ) : React.isValidElement(icon) ? (\n icon\n ) : (\n <></>\n ),\n {\n 'aria-hidden': ariaLabel ? (ariaHidden ? ariaHidden : undefined) : true,\n 'aria-label': ariaLabel,\n focusable: 'false',\n height,\n preserveAspectRatio: 'xMidYMid meet',\n role: 'img',\n width,\n ...svgProps,\n }\n )}\n {badge ? badge : null}\n </StyledIcon>\n );\n});\nIcon.className = CLASSNAME;\nIcon.displayName = COMPONENT_NAME;\n"],"names":["IconSize","xsmall","small","medium","large","xlarge","xxlarge","StyledIcon","styled","span","baseStyling","_ref","$color","$theme","Object","keys","NotificationsColorPalette","indexOf","css","ProductColorPalette","Theme","dark","_ref2","$width","$height","$fontSize","$lineHeight","COMPONENT_NAME","CLASSNAME","sizeToDimension","size","width","height","fontSize","lineHeight","Icon","forwardRef","props","ref","ariaHidden","ariaLabel","badge","className","color","icon","svgProps","theme","propsTheme","forwardedProps","_objectWithoutProperties","_excluded","useTheme","React","createElement","_extends","undefined","classNames","cloneElement","Array","isArray","every","it","viewBox","map","path","key","d","fill","isValidElement","Fragment","_objectSpread","focusable","preserveAspectRatio","role","displayName"],"mappings":";;;;;;;;AAWA;AACA;AACA;AACO,MAAMA,QAAQ,GAAG;AACtBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,OAAO,EAAE,SAAA;AACX,EAAU;;AAKV;AACA;AACA;;ACvBA;AACA;AACA;AACO,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAsB,CAAA;AACvD;AACA;AACA,EAAA,EAAIC,WAAY,CAAA;AAChB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,EAAIC,IAAA,IAAA;EAAA,IAAC;IAAEC,MAAM;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAF,IAAA,CAAA;AAAA,EAAA,OACnBC,MAAM,IAAIE,MAAM,CAACC,IAAI,CAACC,yBAAyB,CAAC,CAACC,OAAO,CAACL,MAAM,CAAC,KAAK,CAAC,CAAC,GACnEM,GAAI,CAAA;AACZ,mDAAA,EAAqDN,MAAO,CAAA;AAC5D,QAAA,CAAS,GACDA,MAAM,IAAIE,MAAM,CAACC,IAAI,CAACI,mBAAmB,CAAC,CAACF,OAAO,CAACL,MAAM,CAAC,KAAK,CAAC,CAAC,GACjEM,GAAI,CAAA;A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OAAO;IAClBvC,MAAM;AACNwC,IAAAA,mBAAmB,EAAE,eAAe;AACpCC,IAAAA,IAAI,EAAE,KAAK;AACX1C,IAAAA,KAAAA;GACGc,EAAAA,QAAQ,CAEf,CAAC,EACAJ,KAAK,GAAGA,KAAK,GAAG,IACP,CAAC,CAAA;AAEjB,CAAC,EAAC;AACFN,IAAI,CAACO,SAAS,GAAGd,SAAS,CAAA;AAC1BO,IAAI,CAACuC,WAAW,GAAG/C,cAAc;;;;"}
|
|
1
|
+
{"version":3,"file":"Icon2.js","sources":["../../src/components/icon/types.ts","../../src/components/icon/styles.ts","../../src/components/icon/Icon.tsx"],"sourcesContent":["import { ComponentProps, ReactElement } from 'react';\nimport {\n NotificationsColorPalette,\n LayoutProps,\n LayoutTransientProps,\n PositioningProps,\n PositioningTransientProps,\n SpacingProps,\n SpacingTransientProps,\n ValueOf,\n ProductColorPalette,\n Theme,\n} from '../../types';\n\n/**\n * Component size.\n */\nexport const IconSize = {\n xsmall: 'xsmall',\n small: 'small',\n medium: 'medium',\n large: 'large',\n xlarge: 'xlarge',\n xxlarge: 'xxlarge',\n} as const;\nexport type IconSize = ValueOf<typeof IconSize>;\n\nexport type IconDimensions = { width?: number; height?: number; fontSize?: number; lineHeight?: number };\n\n/**\n * Component props.\n */\nexport interface IconProps extends ComponentProps<'span'>, LayoutProps, SpacingProps, PositioningProps {\n /** Indicates whether the element is exposed to an accessibility API. */\n 'aria-hidden'?: boolean | 'false' | 'true';\n /** A screen reader only label for the Icon. */\n 'aria-label'?: string;\n /** Color variant. Either from color palette or hex or rgb strings. */\n color?: NotificationsColorPalette | ProductColorPalette | (string & {});\n /** Whether the icon has a badge attached to it. */\n badge?: ReactElement;\n /**\n * Can be a string or an array of strings containing `d` property of the `path` SVG element.<br />\n * Can also be a ReactElement.\n */\n icon: string | string[] | ReactElement;\n /** Icon size. */\n size?: IconSize | IconDimensions;\n /** Additional properties to forward to the SVG tag. */\n svgProps?: ComponentProps<'svg'>;\n /** Theme. */\n theme?: Theme;\n}\n\nexport interface StyledIconProps\n extends ComponentProps<'span'>,\n LayoutTransientProps,\n SpacingTransientProps,\n PositioningTransientProps {\n $color: IconProps['color'];\n $width: IconDimensions['width'];\n $height: IconDimensions['height'];\n $fontSize: IconDimensions['fontSize'];\n $lineHeight: IconDimensions['lineHeight'];\n $theme: IconProps['theme'];\n}\n","import styled, { css } from 'styled-components';\nimport { NotificationsColorPalette, ProductColorPalette, Theme } from '../../types';\nimport { baseStyling } from '../shared';\nimport { StyledIconProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledIcon = styled.span<StyledIconProps>`\n position: relative;\n display: inline-grid;\n ${baseStyling}\n\n font-style: normal;\n\n svg {\n vertical-align: -0.125em;\n grid-column: 1;\n grid-row: 1;\n }\n\n ${({ $color, $theme }) =>\n $color && Object.keys(NotificationsColorPalette).indexOf($color) !== -1\n ? css`\n color: var(--redsift-color-notifications-${$color}-primary);\n `\n : $color && Object.keys(ProductColorPalette).indexOf($color) !== -1\n ? css`\n color: var(--redsift-color-product-${$color});\n `\n : css`\n color: ${$color || css`var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'})`};\n `}\n\n ${({ $width, $height, $fontSize, $lineHeight }) => css`\n ${$width\n ? css`\n width: ${$width}px;\n `\n : ''}\n ${$height\n ? css`\n height: ${$height}px;\n `\n : ''}\n ${$fontSize\n ? css`\n font-size: ${$fontSize}px;\n `\n : ''}\n ${$lineHeight\n ? css`\n line-height: ${$lineHeight}px;\n `\n : ''}\n\n & .redsift-badge-standard {\n grid-column: 1;\n grid-row: 1;\n margin-right: unset;\n ${$width\n ? css`\n margin-left: ${$width * 0.75}px;\n `\n : ''}\n ${$height\n ? css`\n margin-top: ${$height * 0.1 - 4}px;\n `\n : ''}\n }\n\n & .redsift-badge-dot {\n grid-column: 1;\n grid-row: 1;\n margin-right: unset;\n ${$width\n ? css`\n margin-left: ${$width * 0.8}px;\n `\n : ''}\n ${$height\n ? css`\n margin-top: ${$height * 0.2 - 3}px;\n `\n : ''}\n }\n `}\n`;\n","import React, { forwardRef, RefObject } from 'react';\nimport classNames from 'classnames';\nimport { Comp, getStylingTransientProps } from '../../types';\nimport { StyledIcon } from './styles';\nimport { IconDimensions, IconProps, IconSize } from './types';\nimport { useTheme } from '../theme';\n\nconst COMPONENT_NAME = 'Icon';\nconst CLASSNAME = 'redsift-icon';\n\nexport const sizeToDimension = (size: IconSize | IconDimensions): IconDimensions => {\n if (typeof size !== 'string') {\n return size;\n }\n\n switch (size) {\n case IconSize.xsmall:\n return { width: 16, height: 16, fontSize: 16, lineHeight: 16 };\n case IconSize.small:\n return { width: 20, height: 20, fontSize: 20, lineHeight: 20 };\n case IconSize.medium:\n default:\n return { width: 24, height: 24, fontSize: 24, lineHeight: 24 };\n case IconSize.large:\n return { width: 30, height: 30, fontSize: 30, lineHeight: 30 };\n case IconSize.xlarge:\n return { width: 40, height: 40, fontSize: 40, lineHeight: 40 };\n case IconSize.xxlarge:\n return { width: 55, height: 55, fontSize: 55, lineHeight: 55 };\n }\n};\n\n/**\n * The Icon component.\n */\nexport const Icon: Comp<IconProps, HTMLSpanElement> = forwardRef((props, ref) => {\n const { transientProps, otherProps } = getStylingTransientProps(props);\n\n const {\n 'aria-hidden': ariaHidden,\n 'aria-label': ariaLabel,\n badge,\n className,\n color,\n icon,\n size = IconSize.medium,\n svgProps,\n theme: propsTheme,\n ...forwardedProps\n } = otherProps;\n\n const theme = useTheme(propsTheme);\n\n const { width, height, fontSize, lineHeight } = sizeToDimension(size!);\n\n return (\n <StyledIcon\n {...forwardedProps}\n {...transientProps}\n $color={color}\n $width={width}\n $height={height}\n $fontSize={fontSize}\n $lineHeight={lineHeight}\n $theme={theme}\n aria-hidden={ariaLabel ? (ariaHidden ? ariaHidden : undefined) : true}\n aria-label={ariaLabel}\n className={classNames(Icon.className, className, color ? 'colored' : undefined)}\n ref={ref as RefObject<HTMLSpanElement>}\n >\n {React.cloneElement(\n typeof icon === 'string' || (Array.isArray(icon) && icon.every((it) => typeof it === 'string')) ? (\n <svg viewBox=\"0 0 24 24\">\n {(Array.isArray(icon) ? icon : [icon]).map((path) => (\n <path key={path} d={path} fill=\"currentColor\" />\n ))}\n </svg>\n ) : React.isValidElement(icon) ? (\n icon\n ) : (\n <></>\n ),\n {\n 'aria-hidden': ariaLabel ? (ariaHidden ? ariaHidden : undefined) : true,\n 'aria-label': ariaLabel,\n focusable: 'false',\n height,\n preserveAspectRatio: 'xMidYMid meet',\n role: 'img',\n width,\n ...svgProps,\n }\n )}\n {badge ? badge : null}\n </StyledIcon>\n );\n});\nIcon.className = CLASSNAME;\nIcon.displayName = COMPONENT_NAME;\n"],"names":["IconSize","xsmall","small","medium","large","xlarge","xxlarge","StyledIcon","styled","span","baseStyling","_ref","$color","$theme","Object","keys","NotificationsColorPalette","indexOf","css","ProductColorPalette","Theme","dark","_ref2","$width","$height","$fontSize","$lineHeight","COMPONENT_NAME","CLASSNAME","sizeToDimension","size","width","height","fontSize","lineHeight","Icon","forwardRef","props","ref","transientProps","otherProps","getStylingTransientProps","ariaHidden","ariaLabel","badge","className","color","icon","svgProps","theme","propsTheme","forwardedProps","_objectWithoutProperties","_excluded","useTheme","React","createElement","_extends","undefined","classNames","cloneElement","Array","isArray","every","it","viewBox","map","path","key","d","fill","isValidElement","Fragment","_objectSpread","focusable","preserveAspectRatio","role","displayName"],"mappings":";;;;;;;;;AAcA;AACA;AACA;AACO,MAAMA,QAAQ,GAAG;AACtBC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,OAAO,EAAE,SAAA;AACX,EAAU;;AAKV;AACA;AACA;;AC1BA;AACA;AACA;AACO,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAsB,CAAA;AACvD;AACA;AACA,EAAA,EAAIC,WAAY,C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,IAAAA,OAAO,EAAC,WAAA;GACV,EAAA,CAACJ,KAAK,CAACC,OAAO,CAACf,IAAI,CAAC,GAAGA,IAAI,GAAG,CAACA,IAAI,CAAC,EAAEmB,GAAG,CAAEC,IAAI,iBAC9CZ,cAAA,CAAAC,aAAA,CAAA,MAAA,EAAA;AAAMY,IAAAA,GAAG,EAAED,IAAK;AAACE,IAAAA,CAAC,EAAEF,IAAK;AAACG,IAAAA,IAAI,EAAC,cAAA;GAAgB,CAChD,CACE,CAAC,gBACJf,cAAK,CAACgB,cAAc,CAACxB,IAAI,CAAC,GAC5BA,IAAI,gBAEJQ,cAAA,CAAAC,aAAA,CAAAD,cAAA,CAAAiB,QAAA,EAAA,IAAI,CACL,EAAAC,cAAA,CAAA;IAEC,aAAa,EAAE9B,SAAS,GAAID,UAAU,GAAGA,UAAU,GAAGgB,SAAS,GAAI,IAAI;AACvE,IAAA,YAAY,EAAEf,SAAS;AACvB+B,IAAAA,SAAS,EAAE,OAAO;IAClB1C,MAAM;AACN2C,IAAAA,mBAAmB,EAAE,eAAe;AACpCC,IAAAA,IAAI,EAAE,KAAK;AACX7C,IAAAA,KAAAA;GACGiB,EAAAA,QAAQ,CAEf,CAAC,EACAJ,KAAK,GAAGA,KAAK,GAAG,IACP,CAAC,CAAA;AAEjB,CAAC,EAAC;AACFT,IAAI,CAACU,SAAS,GAAGjB,SAAS,CAAA;AAC1BO,IAAI,CAAC0C,WAAW,GAAGlD,cAAc;;;;"}
|
package/_internal/IconButton.js
CHANGED
|
@@ -2,8 +2,9 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
|
|
|
2
2
|
import React__default, { forwardRef, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { w as warnIfNoAccessibleLabelFound } from './warnIfNoAccessibleLabelFound.js';
|
|
5
|
-
import { I as IconButtonVariant, S as StyledIconButton } from './
|
|
5
|
+
import { I as IconButtonVariant, S as StyledIconButton } from './styles3.js';
|
|
6
6
|
import { StyledGradientBorder } from './gradient-border.js';
|
|
7
|
+
import { f as getStylingTransientProps } from './styles.js';
|
|
7
8
|
import { u as useTheme } from './useTheme.js';
|
|
8
9
|
import { B as ButtonsColorPalette } from './colors.js';
|
|
9
10
|
import { C as ConditionalWrapper } from './ConditionalWrapper.js';
|
|
@@ -22,6 +23,10 @@ const CLASSNAME = 'redsift-icon-button';
|
|
|
22
23
|
*/
|
|
23
24
|
const IconButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24
25
|
const buttonRef = ref || useRef();
|
|
26
|
+
const {
|
|
27
|
+
transientProps,
|
|
28
|
+
otherProps
|
|
29
|
+
} = getStylingTransientProps(props);
|
|
25
30
|
const {
|
|
26
31
|
className,
|
|
27
32
|
color: propsColor,
|
|
@@ -34,8 +39,8 @@ const IconButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
34
39
|
isLoading,
|
|
35
40
|
theme: propsTheme,
|
|
36
41
|
variant: propsVariant
|
|
37
|
-
} =
|
|
38
|
-
forwardedProps = _objectWithoutProperties(
|
|
42
|
+
} = otherProps,
|
|
43
|
+
forwardedProps = _objectWithoutProperties(otherProps, _excluded);
|
|
39
44
|
const isDisabled = props.isLoading || propsIsDisabled || disabled;
|
|
40
45
|
const theme = useTheme(propsTheme);
|
|
41
46
|
const color = Object.values(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
@@ -53,7 +58,7 @@ const IconButton = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
53
58
|
}, children)
|
|
54
59
|
}, /*#__PURE__*/React__default.createElement(StyledIconButton, _extends({
|
|
55
60
|
type: "button"
|
|
56
|
-
}, forwardedProps, {
|
|
61
|
+
}, forwardedProps, transientProps, {
|
|
57
62
|
$color: color,
|
|
58
63
|
$isActive: isActive,
|
|
59
64
|
$isDisabled: isDisabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.js","sources":["../../src/components/icon-button/IconButton.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useRef } from 'react';\nimport classNames from 'classnames';\nimport { ButtonsColorPalette, Comp } from '../../types';\nimport { Icon } from '../icon';\nimport { warnIfNoAccessibleLabelFound } from '../../utils/warnIfNoAccessibleLabelFound';\nimport { StyledIconButton } from './styles';\nimport { IconButtonProps, IconButtonVariant } from './types';\nimport { Spinner } from '../../components/spinner';\nimport { useTheme } from '../theme';\nimport { ConditionalWrapper } from '../conditional-wrapper';\nimport { StyledGradientBorder } from '../gradient-border';\n\nconst COMPONENT_NAME = 'IconButton';\nconst CLASSNAME = 'redsift-icon-button';\n\n/**\n * The Icon Button is a component that contains only one icon as a child, without text.\n *\n * This component should use aria-label, aria-labelledby or aria-describedby to make this\n * component usable with a screen reader.\n */\nexport const IconButton: Comp<IconButtonProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const buttonRef = ref || useRef<HTMLButtonElement>();\n\n const {\n className,\n color: propsColor,\n disabled,\n icon,\n iconProps,\n isActive,\n isDisabled: propsIsDisabled,\n isHovered,\n isLoading,\n theme: propsTheme,\n variant: propsVariant,\n ...forwardedProps\n } =
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../src/components/icon-button/IconButton.tsx"],"sourcesContent":["import React, { forwardRef, RefObject, useRef } from 'react';\nimport classNames from 'classnames';\nimport { ButtonsColorPalette, Comp, getStylingTransientProps } from '../../types';\nimport { Icon } from '../icon';\nimport { warnIfNoAccessibleLabelFound } from '../../utils/warnIfNoAccessibleLabelFound';\nimport { StyledIconButton } from './styles';\nimport { IconButtonProps, IconButtonVariant } from './types';\nimport { Spinner } from '../../components/spinner';\nimport { useTheme } from '../theme';\nimport { ConditionalWrapper } from '../conditional-wrapper';\nimport { StyledGradientBorder } from '../gradient-border';\n\nconst COMPONENT_NAME = 'IconButton';\nconst CLASSNAME = 'redsift-icon-button';\n\n/**\n * The Icon Button is a component that contains only one icon as a child, without text.\n *\n * This component should use aria-label, aria-labelledby or aria-describedby to make this\n * component usable with a screen reader.\n */\nexport const IconButton: Comp<IconButtonProps, HTMLButtonElement> = forwardRef((props, ref) => {\n const buttonRef = ref || useRef<HTMLButtonElement>();\n\n const { transientProps, otherProps } = getStylingTransientProps(props);\n\n const {\n className,\n color: propsColor,\n disabled,\n icon,\n iconProps,\n isActive,\n isDisabled: propsIsDisabled,\n isHovered,\n isLoading,\n theme: propsTheme,\n variant: propsVariant,\n ...forwardedProps\n } = otherProps;\n const isDisabled = props.isLoading || propsIsDisabled || disabled;\n\n const theme = useTheme(propsTheme);\n const color = Object.values(ButtonsColorPalette).includes(propsColor!) ? propsColor : 'primary';\n const variant = Object.values(IconButtonVariant).includes(propsVariant!) ? propsVariant : 'unstyled';\n\n warnIfNoAccessibleLabelFound(props, undefined, 'IconButton');\n const isGradient = color === ButtonsColorPalette.radar;\n\n return (\n <ConditionalWrapper\n condition={isGradient && variant === IconButtonVariant.secondary}\n wrapper={(children) => (\n <StyledGradientBorder\n $color={color}\n $isActive={isActive}\n $isDisabled={isDisabled}\n $isHovered={isHovered}\n $theme={theme}\n >\n {children}\n </StyledGradientBorder>\n )}\n >\n <StyledIconButton\n type=\"button\"\n {...forwardedProps}\n {...transientProps}\n $color={color}\n $isActive={isActive}\n $isDisabled={isDisabled}\n $isGradient={isGradient}\n $isHovered={isHovered}\n $isLoading={isLoading}\n $theme={theme}\n $variant={variant}\n aria-disabled={isDisabled}\n className={classNames(IconButton.className, className)}\n disabled={isDisabled}\n ref={buttonRef as RefObject<HTMLButtonElement>}\n >\n {isLoading ? (\n <Spinner size=\"small\" color={variant === IconButtonVariant.primary ? 'grey-l1' : 'grey-l2'} />\n ) : (\n <Icon {...iconProps} icon={icon} />\n )}\n </StyledIconButton>\n </ConditionalWrapper>\n );\n});\nIconButton.className = CLASSNAME;\nIconButton.displayName = COMPONENT_NAME;\n"],"names":["COMPONENT_NAME","CLASSNAME","IconButton","forwardRef","props","ref","buttonRef","useRef","transientProps","otherProps","getStylingTransientProps","className","color","propsColor","disabled","icon","iconProps","isActive","isDisabled","propsIsDisabled","isHovered","isLoading","theme","propsTheme","variant","propsVariant","forwardedProps","_objectWithoutProperties","_excluded","useTheme","Object","values","ButtonsColorPalette","includes","IconButtonVariant","warnIfNoAccessibleLabelFound","undefined","isGradient","radar","React","createElement","ConditionalWrapper","condition","secondary","wrapper","children","StyledGradientBorder","$color","$isActive","$isDisabled","$isHovered","$theme","StyledIconButton","_extends","type","$isGradient","$isLoading","$variant","classNames","Spinner","size","primary","Icon","displayName"],"mappings":";;;;;;;;;;;;;;AAYA,MAAMA,cAAc,GAAG,YAAY,CAAA;AACnC,MAAMC,SAAS,GAAG,qBAAqB,CAAA;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,UAAoD,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAC7F,EAAA,MAAMC,SAAS,GAAGD,GAAG,IAAIE,MAAM,EAAqB,CAAA;EAEpD,MAAM;IAAEC,cAAc;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAGC,wBAAwB,CAACN,KAAK,CAAC,CAAA;EAEtE,MAAM;MACJO,SAAS;AACTC,MAAAA,KAAK,EAAEC,UAAU;MACjBC,QAAQ;MACRC,IAAI;MACJC,SAAS;MACTC,QAAQ;AACRC,MAAAA,UAAU,EAAEC,eAAe;MAC3BC,SAAS;MACTC,SAAS;AACTC,MAAAA,KAAK,EAAEC,UAAU;AACjBC,MAAAA,OAAO,EAAEC,YAAAA;AAEX,KAAC,GAAGhB,UAAU;AADTiB,IAAAA,cAAc,GAAAC,wBAAA,CACflB,UAAU,EAAAmB,SAAA,CAAA,CAAA;EACd,MAAMV,UAAU,GAAGd,KAAK,CAACiB,SAAS,IAAIF,eAAe,IAAIL,QAAQ,CAAA;AAEjE,EAAA,MAAMQ,KAAK,GAAGO,QAAQ,CAACN,UAAU,CAAC,CAAA;AAClC,EAAA,MAAMX,KAAK,GAAGkB,MAAM,CAACC,MAAM,CAACC,mBAAmB,CAAC,CAACC,QAAQ,CAACpB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AAS,EAAE+C,UAAU,CAACxD,UAAU,CAACS,SAAS,EAAEA,SAAS,CAAE;AACvDG,IAAAA,QAAQ,EAAEI,UAAW;AACrBb,IAAAA,GAAG,EAAEC,SAAAA;AAA0C,GAAA,CAAA,EAE9Ce,SAAS,gBACRkB,cAAA,CAAAC,aAAA,CAACmB,OAAO,EAAA;AAACC,IAAAA,IAAI,EAAC,OAAO;IAAChD,KAAK,EAAEY,OAAO,KAAKU,iBAAiB,CAAC2B,OAAO,GAAG,SAAS,GAAG,SAAA;GAAY,CAAC,gBAE9FtB,cAAA,CAAAC,aAAA,CAACsB,IAAI,EAAAT,QAAA,CAAA,EAAA,EAAKrC,SAAS,EAAA;AAAED,IAAAA,IAAI,EAAEA,IAAAA;GAAO,CAAA,CAEpB,CACA,CAAC,CAAA;AAEzB,CAAC,EAAC;AACFb,UAAU,CAACS,SAAS,GAAGV,SAAS,CAAA;AAChCC,UAAU,CAAC6D,WAAW,GAAG/D,cAAc;;;;"}
|
|
@@ -2,7 +2,7 @@ import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBab
|
|
|
2
2
|
import React__default, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { StyledGradientBorder } from './gradient-border.js';
|
|
5
|
-
import { I as IconButtonVariant, S as StyledIconButton } from './
|
|
5
|
+
import { I as IconButtonVariant, S as StyledIconButton } from './styles3.js';
|
|
6
6
|
import { u as useTheme } from './useTheme.js';
|
|
7
7
|
import { B as ButtonsColorPalette } from './colors.js';
|
|
8
8
|
import { C as ConditionalWrapper } from './ConditionalWrapper.js';
|