@traefik-labs/faency 13.1.1 → 13.3.0
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/components/Accordion/Accordion.cjs +24 -18
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.js +24 -18
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/AriaTable/AriaTable.cjs +47 -9
- package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
- package/dist/components/AriaTable/AriaTable.js +48 -10
- package/dist/components/AriaTable/AriaTable.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.cjs +15 -2
- package/dist/components/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +15 -2
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.themes.cjs +4 -2
- package/dist/components/Checkbox/Checkbox.themes.cjs.map +1 -1
- package/dist/components/Checkbox/Checkbox.themes.js +4 -2
- package/dist/components/Checkbox/Checkbox.themes.js.map +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.cjs.map +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.js +1 -1
- package/dist/components/DateTimePickerInput/DateTimePickerInput.js.map +1 -1
- package/dist/components/Dialog/Dialog.cjs +4 -3
- package/dist/components/Dialog/Dialog.cjs.map +1 -1
- package/dist/components/Dialog/Dialog.js +4 -3
- package/dist/components/Dialog/Dialog.js.map +1 -1
- package/dist/components/Field/Field.cjs +91 -0
- package/dist/components/Field/Field.cjs.map +1 -0
- package/dist/components/Field/Field.js +89 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/Field/Field.vanilla.cjs +95 -0
- package/dist/components/Field/Field.vanilla.cjs.map +1 -0
- package/dist/components/Field/Field.vanilla.css.cjs +6 -0
- package/dist/components/Field/Field.vanilla.css.cjs.map +1 -0
- package/dist/components/Field/Field.vanilla.css.js +6 -0
- package/dist/components/Field/Field.vanilla.css.js.map +1 -0
- package/dist/components/Field/Field.vanilla.js +93 -0
- package/dist/components/Field/Field.vanilla.js.map +1 -0
- package/dist/components/Field/FieldContext.cjs +136 -0
- package/dist/components/Field/FieldContext.cjs.map +1 -0
- package/dist/components/Field/FieldContext.js +130 -0
- package/dist/components/Field/FieldContext.js.map +1 -0
- package/dist/components/Input/Input.cjs +31 -6
- package/dist/components/Input/Input.cjs.map +1 -1
- package/dist/components/Input/Input.js +31 -6
- package/dist/components/Input/Input.js.map +1 -1
- package/dist/components/Input/Input.vanilla.cjs +17 -4
- package/dist/components/Input/Input.vanilla.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.css.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.css.js.map +1 -1
- package/dist/components/Input/Input.vanilla.js +17 -4
- package/dist/components/Input/Input.vanilla.js.map +1 -1
- package/dist/components/Navigation/Navigation.cjs +4 -1
- package/dist/components/Navigation/Navigation.cjs.map +1 -1
- package/dist/components/Navigation/Navigation.js +4 -1
- package/dist/components/Navigation/Navigation.js.map +1 -1
- package/dist/components/Radio/Radio.cjs +21 -1
- package/dist/components/Radio/Radio.cjs.map +1 -1
- package/dist/components/Radio/Radio.js +21 -1
- package/dist/components/Radio/Radio.js.map +1 -1
- package/dist/components/Radio/Radio.themes.cjs +4 -2
- package/dist/components/Radio/Radio.themes.cjs.map +1 -1
- package/dist/components/Radio/Radio.themes.js +4 -2
- package/dist/components/Radio/Radio.themes.js.map +1 -1
- package/dist/components/RadioAccordion/RadioAccordion.cjs +10 -6
- package/dist/components/RadioAccordion/RadioAccordion.cjs.map +1 -1
- package/dist/components/RadioAccordion/RadioAccordion.js +10 -6
- package/dist/components/RadioAccordion/RadioAccordion.js.map +1 -1
- package/dist/components/RowLink/RowLink.cjs +95 -0
- package/dist/components/RowLink/RowLink.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.js +90 -0
- package/dist/components/RowLink/RowLink.js.map +1 -0
- package/dist/components/Select/Select.cjs +33 -4
- package/dist/components/Select/Select.cjs.map +1 -1
- package/dist/components/Select/Select.js +33 -4
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SidePanel/SidePanel.cjs +3 -3
- package/dist/components/SidePanel/SidePanel.cjs.map +1 -1
- package/dist/components/SidePanel/SidePanel.js +3 -3
- package/dist/components/SidePanel/SidePanel.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.cjs +4 -0
- package/dist/components/Skeleton/Skeleton.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.js +4 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.css.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.css.js.map +1 -1
- package/dist/components/Switch/Switch.cjs +19 -5
- package/dist/components/Switch/Switch.cjs.map +1 -1
- package/dist/components/Switch/Switch.js +19 -5
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Switch/Switch.themes.cjs +4 -2
- package/dist/components/Switch/Switch.themes.cjs.map +1 -1
- package/dist/components/Switch/Switch.themes.js +4 -2
- package/dist/components/Switch/Switch.themes.js.map +1 -1
- package/dist/components/Table/ExpandButton.cjs +18 -0
- package/dist/components/Table/ExpandButton.cjs.map +1 -0
- package/dist/components/Table/ExpandButton.js +19 -0
- package/dist/components/Table/ExpandButton.js.map +1 -0
- package/dist/components/Table/Table.cjs +39 -13
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.js +40 -14
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Text/Text.themes.cjs +2 -2
- package/dist/components/Text/Text.themes.cjs.map +1 -1
- package/dist/components/Text/Text.themes.js +2 -2
- package/dist/components/Text/Text.themes.js.map +1 -1
- package/dist/components/Text/Text.vanilla.cjs +36 -0
- package/dist/components/Text/Text.vanilla.cjs.map +1 -0
- package/dist/components/Text/Text.vanilla.css.cjs +55 -0
- package/dist/components/Text/Text.vanilla.css.cjs.map +1 -0
- package/dist/components/Text/Text.vanilla.css.js +56 -0
- package/dist/components/Text/Text.vanilla.css.js.map +1 -0
- package/dist/components/Text/Text.vanilla.js +36 -0
- package/dist/components/Text/Text.vanilla.js.map +1 -0
- package/dist/components/TextField/TextField.cjs +73 -77
- package/dist/components/TextField/TextField.cjs.map +1 -1
- package/dist/components/TextField/TextField.js +73 -77
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.vanilla.cjs +70 -86
- package/dist/components/TextField/TextField.vanilla.cjs.map +1 -1
- package/dist/components/TextField/TextField.vanilla.css.cjs +10 -0
- package/dist/components/TextField/TextField.vanilla.css.cjs.map +1 -0
- package/dist/components/TextField/TextField.vanilla.css.js +8 -0
- package/dist/components/TextField/TextField.vanilla.css.js.map +1 -0
- package/dist/components/TextField/TextField.vanilla.js +71 -87
- package/dist/components/TextField/TextField.vanilla.js.map +1 -1
- package/dist/components/Textarea/Textarea.cjs +51 -41
- package/dist/components/Textarea/Textarea.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.js +51 -41
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.cjs +49 -49
- package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.css.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.css.js.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.js +49 -49
- package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
- package/dist/faency.css +176 -14
- package/dist/index.cjs +11 -1
- package/dist/index.d.ts +777 -3
- package/dist/index.js +6 -2
- package/dist/styles/themes.css.cjs.map +1 -1
- package/dist/styles/themes.css.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,13 +8,15 @@ var Theme;
|
|
|
8
8
|
switchBackground: (0, tinycolor2.default)("black").setAlpha(.2).toHslString(),
|
|
9
9
|
switchActiveBackground: "$primary",
|
|
10
10
|
switchFocusBorder: primaryColor.helpers.pickScale(8),
|
|
11
|
-
switchThumb: (0, tinycolor2.default)("white").setAlpha(.87).toHslString()
|
|
11
|
+
switchThumb: (0, tinycolor2.default)("white").setAlpha(.87).toHslString(),
|
|
12
|
+
switchInvalidBorder: "$red9"
|
|
12
13
|
});
|
|
13
14
|
_Theme.getDark = (primaryColor) => ({
|
|
14
15
|
switchBackground: (0, tinycolor2.default)("white").setAlpha(.2).toHslString(),
|
|
15
16
|
switchActiveBackground: "$primary",
|
|
16
17
|
switchFocusBorder: primaryColor.helpers.pickScale(11),
|
|
17
|
-
switchThumb: (0, tinycolor2.default)("black").setAlpha(.87).toHslString()
|
|
18
|
+
switchThumb: (0, tinycolor2.default)("black").setAlpha(.87).toHslString(),
|
|
19
|
+
switchInvalidBorder: "$red9"
|
|
18
20
|
});
|
|
19
21
|
})(Theme || (Theme = {}));
|
|
20
22
|
Object.defineProperty(exports, "Theme", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.themes.cjs","names":["tinycolor"],"sources":["../../../components/Switch/Switch.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n switchBackground: Property.Color;\n switchActiveBackground: Property.Color;\n switchFocusBorder: Property.Color;\n switchThumb: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n switchBackground: tinycolor('black').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(8),\n switchThumb: tinycolor('white').setAlpha(0.87).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n switchBackground: tinycolor('white').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(11),\n switchThumb: tinycolor('black').setAlpha(0.87).toHslString(),\n });\n}\n"],"mappings":";;;;AAKO,IAAU;CAAV,SAAA,QAAA;
|
|
1
|
+
{"version":3,"file":"Switch.themes.cjs","names":["tinycolor"],"sources":["../../../components/Switch/Switch.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n switchBackground: Property.Color;\n switchActiveBackground: Property.Color;\n switchFocusBorder: Property.Color;\n switchThumb: Property.Color;\n switchInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n switchBackground: tinycolor('black').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(8),\n switchThumb: tinycolor('white').setAlpha(0.87).toHslString(),\n switchInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n switchBackground: tinycolor('white').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(11),\n switchThumb: tinycolor('black').setAlpha(0.87).toHslString(),\n switchInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;;;AAKO,IAAU;CAAV,SAAA,QAAA;CAWQ,OAAA,YAAqB,kBAAkB;EAClD,mBAAA,GAAkBA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC/D,wBAAwB;EACxB,mBAAmB,aAAa,QAAQ,UAAU,CAAC;EACnD,cAAA,GAAaA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,qBAAqB;CACvB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,mBAAA,GAAkBA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC/D,wBAAwB;EACxB,mBAAmB,aAAa,QAAQ,UAAU,EAAE;EACpD,cAAA,GAAaA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,qBAAqB;CACvB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
|
|
@@ -6,13 +6,15 @@ var Theme;
|
|
|
6
6
|
switchBackground: tinycolor("black").setAlpha(.2).toHslString(),
|
|
7
7
|
switchActiveBackground: "$primary",
|
|
8
8
|
switchFocusBorder: primaryColor.helpers.pickScale(8),
|
|
9
|
-
switchThumb: tinycolor("white").setAlpha(.87).toHslString()
|
|
9
|
+
switchThumb: tinycolor("white").setAlpha(.87).toHslString(),
|
|
10
|
+
switchInvalidBorder: "$red9"
|
|
10
11
|
});
|
|
11
12
|
_Theme.getDark = (primaryColor) => ({
|
|
12
13
|
switchBackground: tinycolor("white").setAlpha(.2).toHslString(),
|
|
13
14
|
switchActiveBackground: "$primary",
|
|
14
15
|
switchFocusBorder: primaryColor.helpers.pickScale(11),
|
|
15
|
-
switchThumb: tinycolor("black").setAlpha(.87).toHslString()
|
|
16
|
+
switchThumb: tinycolor("black").setAlpha(.87).toHslString(),
|
|
17
|
+
switchInvalidBorder: "$red9"
|
|
16
18
|
});
|
|
17
19
|
})(Theme || (Theme = {}));
|
|
18
20
|
export { Theme };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.themes.js","names":[],"sources":["../../../components/Switch/Switch.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n switchBackground: Property.Color;\n switchActiveBackground: Property.Color;\n switchFocusBorder: Property.Color;\n switchThumb: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n switchBackground: tinycolor('black').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(8),\n switchThumb: tinycolor('white').setAlpha(0.87).toHslString(),\n });\n\n export const getDark: Factory = (primaryColor) => ({\n switchBackground: tinycolor('white').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(11),\n switchThumb: tinycolor('black').setAlpha(0.87).toHslString(),\n });\n}\n"],"mappings":";;AAKO,IAAU;CAAV,SAAA,QAAA;
|
|
1
|
+
{"version":3,"file":"Switch.themes.js","names":[],"sources":["../../../components/Switch/Switch.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n switchBackground: Property.Color;\n switchActiveBackground: Property.Color;\n switchFocusBorder: Property.Color;\n switchThumb: Property.Color;\n switchInvalidBorder: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = (primaryColor) => ({\n switchBackground: tinycolor('black').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(8),\n switchThumb: tinycolor('white').setAlpha(0.87).toHslString(),\n switchInvalidBorder: '$red9',\n });\n\n export const getDark: Factory = (primaryColor) => ({\n switchBackground: tinycolor('white').setAlpha(0.2).toHslString(),\n switchActiveBackground: '$primary',\n switchFocusBorder: primaryColor.helpers.pickScale(11),\n switchThumb: tinycolor('black').setAlpha(0.87).toHslString(),\n switchInvalidBorder: '$red9',\n });\n}\n"],"mappings":";;AAKO,IAAU;CAAV,SAAA,QAAA;CAWQ,OAAA,YAAqB,kBAAkB;EAClD,kBAAkB,UAAU,OAAO,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC/D,wBAAwB;EACxB,mBAAmB,aAAa,QAAQ,UAAU,CAAC;EACnD,aAAa,UAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,qBAAqB;CACvB;CAEa,OAAA,WAAoB,kBAAkB;EACjD,kBAAkB,UAAU,OAAO,CAAC,CAAC,SAAS,EAAG,CAAC,CAAC,YAAY;EAC/D,wBAAwB;EACxB,mBAAmB,aAAa,QAAQ,UAAU,EAAE;EACpD,aAAa,UAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,qBAAqB;CACvB;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// components/Table/ExpandButton.tsx
|
|
2
|
+
var ExpandButton = require("../../stitches.config.cjs").styled("button", {
|
|
3
|
+
all: "unset",
|
|
4
|
+
display: "inline-flex",
|
|
5
|
+
alignItems: "center",
|
|
6
|
+
justifyContent: "center",
|
|
7
|
+
borderRadius: "$1",
|
|
8
|
+
cursor: "pointer",
|
|
9
|
+
"&:focus-visible": {
|
|
10
|
+
outlineWidth: "2px",
|
|
11
|
+
outlineStyle: "solid",
|
|
12
|
+
outlineColor: "$focusOutline",
|
|
13
|
+
outlineOffset: "2px"
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
exports.ExpandButton = ExpandButton;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=ExpandButton.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandButton.cjs","names":["styled"],"sources":["../../../components/Table/ExpandButton.tsx"],"sourcesContent":["import { styled } from '../../stitches.config';\n\nexport const ExpandButton = styled('button', {\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '$1',\n cursor: 'pointer',\n '&:focus-visible': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: '$focusOutline',\n outlineOffset: '2px',\n },\n});\n"],"mappings":";AAEA,IAAa,e,mCAAeA,CAAAA,CAAAA,OAAO,UAAU;CAC3C,KAAK;CACL,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,cAAc;CACd,QAAQ;CACR,mBAAmB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,eAAe;CACjB;AACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { styled } from "../../stitches.config.js";
|
|
2
|
+
// components/Table/ExpandButton.tsx
|
|
3
|
+
var ExpandButton = styled("button", {
|
|
4
|
+
all: "unset",
|
|
5
|
+
display: "inline-flex",
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
justifyContent: "center",
|
|
8
|
+
borderRadius: "$1",
|
|
9
|
+
cursor: "pointer",
|
|
10
|
+
"&:focus-visible": {
|
|
11
|
+
outlineWidth: "2px",
|
|
12
|
+
outlineStyle: "solid",
|
|
13
|
+
outlineColor: "$focusOutline",
|
|
14
|
+
outlineOffset: "2px"
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
export { ExpandButton };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=ExpandButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExpandButton.js","names":[],"sources":["../../../components/Table/ExpandButton.tsx"],"sourcesContent":["import { styled } from '../../stitches.config';\n\nexport const ExpandButton = styled('button', {\n all: 'unset',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '$1',\n cursor: 'pointer',\n '&:focus-visible': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: '$focusOutline',\n outlineOffset: '2px',\n },\n});\n"],"mappings":";;AAEA,IAAa,eAAe,OAAO,UAAU;CAC3C,KAAK;CACL,SAAS;CACT,YAAY;CACZ,gBAAgB;CAChB,cAAc;CACd,QAAQ;CACR,mBAAmB;EACjB,cAAc;EACd,cAAc;EACd,cAAc;EACd,eAAe;CACjB;AACF,CAAC"}
|
|
@@ -2,9 +2,11 @@ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
|
2
2
|
const require_stitches_config = require("../../stitches.config.cjs");
|
|
3
3
|
const require_Box = require("../Box/Box.cjs");
|
|
4
4
|
const require_Elevation = require("../Elevation/Elevation.cjs");
|
|
5
|
+
const require_RowLink = require("../RowLink/RowLink.cjs");
|
|
5
6
|
const require_Flex = require("../Flex/Flex.cjs");
|
|
6
7
|
const require_Text = require("../Text/Text.cjs");
|
|
7
8
|
const require_Label = require("../Label/Label.cjs");
|
|
9
|
+
const require_ExpandButton = require("./ExpandButton.cjs");
|
|
8
10
|
let _radix_ui_react_icons = require("@radix-ui/react-icons");
|
|
9
11
|
let react = require("react");
|
|
10
12
|
react = require_runtime.__toESM(react, 1);
|
|
@@ -59,7 +61,7 @@ var Td = require_stitches_config.styled("td", {
|
|
|
59
61
|
},
|
|
60
62
|
defaultVariants: { align: "start" }
|
|
61
63
|
});
|
|
62
|
-
var StyledTr = require_stitches_config.styled("tr", {
|
|
64
|
+
var StyledTr = require_stitches_config.styled("tr", require_RowLink.rowLinkRowStyles, {
|
|
63
65
|
verticalAlign: "inherit",
|
|
64
66
|
"&:hover": { color: "$tableHoverText" },
|
|
65
67
|
[`&:last-child > ${Td}`]: { borderBottom: "none" },
|
|
@@ -80,9 +82,10 @@ var StyledTr = require_stitches_config.styled("tr", {
|
|
|
80
82
|
css: { "&:hover": { color: "$tableActiveHoverText" } }
|
|
81
83
|
}]
|
|
82
84
|
});
|
|
83
|
-
var AnimatedTr = ({ collapsedContentColSpan, isOpen, children }) => {
|
|
84
|
-
const appliedStyle = (0, react.useMemo)(() => isOpen ? { transition: "padding 0.2s ease-out" } : {
|
|
85
|
-
transition: "padding 0.2s ease-out",
|
|
85
|
+
var AnimatedTr = ({ id, collapsedContentColSpan, isOpen, children }) => {
|
|
86
|
+
const appliedStyle = (0, react.useMemo)(() => isOpen ? { transition: "padding 0.2s ease-out, visibility 0s" } : {
|
|
87
|
+
transition: "padding 0.2s ease-out, visibility 0s 0.2s",
|
|
88
|
+
visibility: "hidden",
|
|
86
89
|
lineHeight: 0,
|
|
87
90
|
fontSize: 0,
|
|
88
91
|
padding: "0px 16px",
|
|
@@ -94,6 +97,7 @@ var AnimatedTr = ({ collapsedContentColSpan, isOpen, children }) => {
|
|
|
94
97
|
overflow: "hidden"
|
|
95
98
|
}, [isOpen]);
|
|
96
99
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tr, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Td, {
|
|
100
|
+
id,
|
|
97
101
|
colSpan: collapsedContentColSpan,
|
|
98
102
|
css: appliedStyle,
|
|
99
103
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Box.Box, {
|
|
@@ -102,14 +106,16 @@ var AnimatedTr = ({ collapsedContentColSpan, isOpen, children }) => {
|
|
|
102
106
|
})
|
|
103
107
|
}) });
|
|
104
108
|
};
|
|
105
|
-
var Tr = (0, react.forwardRef)(({ children, collapsedContent, emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, ...props }, ref) => {
|
|
109
|
+
var Tr = (0, react.forwardRef)(({ children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
|
|
106
110
|
const [isCollapsed, setIsCollapsed] = (0, react.useState)(false);
|
|
111
|
+
const contentId = (0, react.useId)();
|
|
107
112
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(StyledTr, {
|
|
108
113
|
ref,
|
|
109
114
|
css: !!collapsedContent && !isCollapsed ? {
|
|
110
115
|
...css,
|
|
111
116
|
[`&:nth-last-child(2) > ${Td}`]: { borderBottom: "none" }
|
|
112
117
|
} : { ...css },
|
|
118
|
+
interactive: interactive ?? (href !== void 0 || void 0),
|
|
113
119
|
...props,
|
|
114
120
|
children: [
|
|
115
121
|
emptyFirstColumn ? tableHead ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Th, { css: { width: 24 } }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Td, {}) : null,
|
|
@@ -123,20 +129,40 @@ var Tr = (0, react.forwardRef)(({ children, collapsedContent, emptyFirstColumn =
|
|
|
123
129
|
align: "center",
|
|
124
130
|
justify: "center",
|
|
125
131
|
css: {
|
|
132
|
+
position: "relative",
|
|
133
|
+
zIndex: 2,
|
|
126
134
|
height: "40px",
|
|
127
135
|
"&:hover": { color: "$tableActiveText" }
|
|
128
136
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
137
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ExpandButton.ExpandButton, {
|
|
138
|
+
type: "button",
|
|
139
|
+
css: {
|
|
140
|
+
width: "100%",
|
|
141
|
+
height: "100%"
|
|
142
|
+
},
|
|
143
|
+
"aria-label": expandLabel,
|
|
144
|
+
"aria-expanded": isCollapsed,
|
|
145
|
+
"aria-controls": contentId,
|
|
146
|
+
onClick: () => setIsCollapsed(!isCollapsed),
|
|
147
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_icons.ChevronRightIcon, {
|
|
148
|
+
"aria-hidden": true,
|
|
149
|
+
style: {
|
|
150
|
+
transition: "transform 0.2s ease-out",
|
|
151
|
+
transform: isCollapsed ? "rotate(90deg)" : "initial"
|
|
152
|
+
}
|
|
153
|
+
})
|
|
154
|
+
})
|
|
135
155
|
})
|
|
136
156
|
}),
|
|
137
|
-
children
|
|
157
|
+
require_RowLink.withRowLink(children, {
|
|
158
|
+
href,
|
|
159
|
+
linkAs,
|
|
160
|
+
linkCell,
|
|
161
|
+
linkProps
|
|
162
|
+
}, Td)
|
|
138
163
|
]
|
|
139
164
|
}), !!collapsedContent && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedTr, {
|
|
165
|
+
id: contentId,
|
|
140
166
|
isOpen: isCollapsed,
|
|
141
167
|
collapsedContentColSpan,
|
|
142
168
|
children: collapsedContent
|
|
@@ -181,7 +207,7 @@ var Thead = require_stitches_config.styled("thead", {
|
|
|
181
207
|
fontWeight: "$light"
|
|
182
208
|
}
|
|
183
209
|
});
|
|
184
|
-
var Table = require_stitches_config.styled("table", {
|
|
210
|
+
var Table = require_stitches_config.styled("table", require_RowLink.rowLinkTableStyles, {
|
|
185
211
|
width: "100%",
|
|
186
212
|
tableLayout: "fixed",
|
|
187
213
|
boxSizing: "border-box",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.cjs","names":["styled","Text","Label","useMemo","Box","forwardRef","useState","_Fragment","Flex","ChevronRightIcon","elevationVariants"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, { ComponentProps, ElementRef, forwardRef, ReactNode, useMemo, useState } from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport { Text } from '../Text';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out' }\n : {\n transition: 'padding 0.2s ease-out',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n };\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n style={{\n cursor: 'pointer',\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </Flex>\n </Td>\n )}\n {children}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr isOpen={isCollapsed} collapsedContentColSpan={collapsedContentColSpan}>\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;;;;;;;AAUA,IAAa,UAAUA,wBAAAA,OAAO,WAAWC,aAAAA,MAAM;CAC7C,SAAS;CACT,WAAW;CACX,oBAAoB;CACpB,YAAY;CACZ,YAAY;AACd,CAAC;AAED,IAAa,QAAQD,wBAAAA,OAAO,SAAS;CACnC,OAAO;CACP,eAAe;AACjB,CAAC;AAED,IAAa,KAAKA,wBAAAA,OAAO,MAAME,cAAAA,OAAO;CAEpC,SAAS;CACT,eAAe;CAEf,qBAAqB;CACrB,sBAAsB;CAEtB,WAAW;CACX,GAAG;CACH,cAAc;CAEd,UAAU;EACR,OAAO;GACL,OAAO,EACL,WAAW,QACb;GACA,QAAQ,EACN,WAAW,SACb;GACA,KAAK,EACH,WAAW,MACb;EACF;EACA,WAAW,EACT,YAAY,EACV,SAAS,aACX,EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,K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AQ;EAAsC;EACvD,UAAA;CACS,CAAA,CAEd,EAAA,CAAA;AAEN,CACF;AAEA,IAAa,QAAQT,wBAAAA,OAAO,SAAS;CACnC,eAAe;CACf,UAAU;CACV,cAAc;CAEd,YAAY;EACV,eAAe;EACf,SAAS;EACT,UAAU;EACV,OAAO;EACP,iBAAiB;EACjB,cAAc;CAChB;EAEC,KAAK,OAAO;EACX,UAAU;EACV,OAAO;EACP,YAAY;EACZ,GAAG;CACL;AACF,CAAC;AAED,IAAa,QAAQA,wBAAAA,OAAO,SAAS;CACnC,UAAU;CACV,qBAAqB;CACrB,sBAAsB;CACtB,eAAe;CAEf,YAAY;EACV,eAAe;EACf,SAAS;EACT,UAAU;EACV,OAAO;EACP,iBAAiB;EACjB,qBAAqB;EACrB,sBAAsB;CACxB;EAEC,KAAK,OAAO;EACX,UAAU;EACV,OAAO;EACP,YAAY;CACd;AACF,CAAC;AAED,IAAa,QAAQA,wBAAAA,OAAO,SAAS;CACnC,OAAO;CACP,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;EACT,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;GACrB,KAAK,OAAO,EACX,WAAW,4BACb;CACF;EACC,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,UAAU,EACR,WAAWU,kBAAAA,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Table.cjs","names":["styled","Text","Label","rowLinkRowStyles","useMemo","Box","forwardRef","useState","useId","_Fragment","Flex","ExpandButton","ChevronRightIcon","withRowLink","rowLinkTableStyles","elevationVariants"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, {\n ComponentProps,\n ElementRef,\n forwardRef,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport {\n ROW_LINK_CONTROL_Z_INDEX,\n rowLinkRowStyles,\n RowLinkShortcutProps,\n rowLinkTableStyles,\n withRowLink,\n} from '../RowLink';\nimport { Text } from '../Text';\nimport { ExpandButton } from './ExpandButton';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', rowLinkRowStyles, {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n id,\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n id: string;\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out, visibility 0s' }\n : {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td id={id} colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n interactive,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n >\n <ExpandButton\n type=\"button\"\n css={{ width: '100%', height: '100%' }}\n aria-label={expandLabel}\n aria-expanded={isCollapsed}\n aria-controls={contentId}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n aria-hidden\n style={{\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </ExpandButton>\n </Flex>\n </Td>\n )}\n {withRowLink(children, { href, linkAs, linkCell, linkProps }, Td)}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr\n id={contentId}\n isOpen={isCollapsed}\n collapsedContentColSpan={collapsedContentColSpan}\n >\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', rowLinkTableStyles, {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;;;;;;;;;AA0BA,IAAa,UAAUA,wBAAAA,OAAO,WAAWC,aAAAA,MAAM;CAC7C,SAAS;CACT,WAAW;CACX,oBAAoB;CACpB,YAAY;CACZ,YAAY;AACd,CAAC;AAED,IAAa,QAAQD,wBAAAA,OAAO,SAAS;CACnC,OAAO;CACP,eAAe;AACjB,CAAC;AAED,IAAa,KAAKA,wBAAAA,OAAO,MAAME,cAAAA,OAAO;CAEpC,SAAS;CACT,eAAe;CAEf,qBAAqB;CACrB,sBAAsB;CAEtB,WAAW;CACX,GAAG;CACH,cAAc;CAEd,UAAU;EACR,OAAO;GACL,OAAO,EACL,WAAW,QACb;GACA,QAAQ,EACN,WAAW,SACb;GACA,KAAK,EACH,WAAW,MACb;EACF;EACA,WAAW,EACT,YAAY,EACV,SAAS,aACX,EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,I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WAAW,4BACb;CACF;EACC,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,UAAU,EACR,WAAWC,kBAAAA,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { styled } from "../../stitches.config.js";
|
|
2
2
|
import { Box } from "../Box/Box.js";
|
|
3
3
|
import { elevationVariants } from "../Elevation/Elevation.js";
|
|
4
|
+
import { rowLinkRowStyles, rowLinkTableStyles, withRowLink } from "../RowLink/RowLink.js";
|
|
4
5
|
import { Flex } from "../Flex/Flex.js";
|
|
5
6
|
import { Text } from "../Text/Text.js";
|
|
6
7
|
import { Label } from "../Label/Label.js";
|
|
8
|
+
import { ExpandButton } from "./ExpandButton.js";
|
|
7
9
|
import { ChevronRightIcon } from "@radix-ui/react-icons";
|
|
8
|
-
import { forwardRef, useMemo, useState } from "react";
|
|
10
|
+
import { forwardRef, useId, useMemo, useState } from "react";
|
|
9
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
12
|
// components/Table/Table.tsx
|
|
11
13
|
var Caption = styled("caption", Text, {
|
|
@@ -57,7 +59,7 @@ var Td = styled("td", {
|
|
|
57
59
|
},
|
|
58
60
|
defaultVariants: { align: "start" }
|
|
59
61
|
});
|
|
60
|
-
var StyledTr = styled("tr", {
|
|
62
|
+
var StyledTr = styled("tr", rowLinkRowStyles, {
|
|
61
63
|
verticalAlign: "inherit",
|
|
62
64
|
"&:hover": { color: "$tableHoverText" },
|
|
63
65
|
[`&:last-child > ${Td}`]: { borderBottom: "none" },
|
|
@@ -78,9 +80,10 @@ var StyledTr = styled("tr", {
|
|
|
78
80
|
css: { "&:hover": { color: "$tableActiveHoverText" } }
|
|
79
81
|
}]
|
|
80
82
|
});
|
|
81
|
-
var AnimatedTr = ({ collapsedContentColSpan, isOpen, children }) => {
|
|
82
|
-
const appliedStyle = useMemo(() => isOpen ? { transition: "padding 0.2s ease-out" } : {
|
|
83
|
-
transition: "padding 0.2s ease-out",
|
|
83
|
+
var AnimatedTr = ({ id, collapsedContentColSpan, isOpen, children }) => {
|
|
84
|
+
const appliedStyle = useMemo(() => isOpen ? { transition: "padding 0.2s ease-out, visibility 0s" } : {
|
|
85
|
+
transition: "padding 0.2s ease-out, visibility 0s 0.2s",
|
|
86
|
+
visibility: "hidden",
|
|
84
87
|
lineHeight: 0,
|
|
85
88
|
fontSize: 0,
|
|
86
89
|
padding: "0px 16px",
|
|
@@ -92,6 +95,7 @@ var AnimatedTr = ({ collapsedContentColSpan, isOpen, children }) => {
|
|
|
92
95
|
overflow: "hidden"
|
|
93
96
|
}, [isOpen]);
|
|
94
97
|
return /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, {
|
|
98
|
+
id,
|
|
95
99
|
colSpan: collapsedContentColSpan,
|
|
96
100
|
css: appliedStyle,
|
|
97
101
|
children: /* @__PURE__ */ jsx(Box, {
|
|
@@ -100,14 +104,16 @@ var AnimatedTr = ({ collapsedContentColSpan, isOpen, children }) => {
|
|
|
100
104
|
})
|
|
101
105
|
}) });
|
|
102
106
|
};
|
|
103
|
-
var Tr = forwardRef(({ children, collapsedContent, emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, ...props }, ref) => {
|
|
107
|
+
var Tr = forwardRef(({ children, collapsedContent, expandLabel = "Expand row", emptyFirstColumn = false, tableHead = false, collapsedContentColSpan = 1, css, href, linkAs, linkCell, linkProps, interactive, ...props }, ref) => {
|
|
104
108
|
const [isCollapsed, setIsCollapsed] = useState(false);
|
|
109
|
+
const contentId = useId();
|
|
105
110
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(StyledTr, {
|
|
106
111
|
ref,
|
|
107
112
|
css: !!collapsedContent && !isCollapsed ? {
|
|
108
113
|
...css,
|
|
109
114
|
[`&:nth-last-child(2) > ${Td}`]: { borderBottom: "none" }
|
|
110
115
|
} : { ...css },
|
|
116
|
+
interactive: interactive ?? (href !== void 0 || void 0),
|
|
111
117
|
...props,
|
|
112
118
|
children: [
|
|
113
119
|
emptyFirstColumn ? tableHead ? /* @__PURE__ */ jsx(Th, { css: { width: 24 } }) : /* @__PURE__ */ jsx(Td, {}) : null,
|
|
@@ -121,20 +127,40 @@ var Tr = forwardRef(({ children, collapsedContent, emptyFirstColumn = false, tab
|
|
|
121
127
|
align: "center",
|
|
122
128
|
justify: "center",
|
|
123
129
|
css: {
|
|
130
|
+
position: "relative",
|
|
131
|
+
zIndex: 2,
|
|
124
132
|
height: "40px",
|
|
125
133
|
"&:hover": { color: "$tableActiveText" }
|
|
126
134
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
135
|
+
children: /* @__PURE__ */ jsx(ExpandButton, {
|
|
136
|
+
type: "button",
|
|
137
|
+
css: {
|
|
138
|
+
width: "100%",
|
|
139
|
+
height: "100%"
|
|
140
|
+
},
|
|
141
|
+
"aria-label": expandLabel,
|
|
142
|
+
"aria-expanded": isCollapsed,
|
|
143
|
+
"aria-controls": contentId,
|
|
144
|
+
onClick: () => setIsCollapsed(!isCollapsed),
|
|
145
|
+
children: /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
146
|
+
"aria-hidden": true,
|
|
147
|
+
style: {
|
|
148
|
+
transition: "transform 0.2s ease-out",
|
|
149
|
+
transform: isCollapsed ? "rotate(90deg)" : "initial"
|
|
150
|
+
}
|
|
151
|
+
})
|
|
152
|
+
})
|
|
133
153
|
})
|
|
134
154
|
}),
|
|
135
|
-
children
|
|
155
|
+
withRowLink(children, {
|
|
156
|
+
href,
|
|
157
|
+
linkAs,
|
|
158
|
+
linkCell,
|
|
159
|
+
linkProps
|
|
160
|
+
}, Td)
|
|
136
161
|
]
|
|
137
162
|
}), !!collapsedContent && /* @__PURE__ */ jsx(AnimatedTr, {
|
|
163
|
+
id: contentId,
|
|
138
164
|
isOpen: isCollapsed,
|
|
139
165
|
collapsedContentColSpan,
|
|
140
166
|
children: collapsedContent
|
|
@@ -179,7 +205,7 @@ var Thead = styled("thead", {
|
|
|
179
205
|
fontWeight: "$light"
|
|
180
206
|
}
|
|
181
207
|
});
|
|
182
|
-
var Table = styled("table", {
|
|
208
|
+
var Table = styled("table", rowLinkTableStyles, {
|
|
183
209
|
width: "100%",
|
|
184
210
|
tableLayout: "fixed",
|
|
185
211
|
boxSizing: "border-box",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.js","names":["_Fragment"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, { ComponentProps, ElementRef, forwardRef, ReactNode, useMemo, useState } from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport { Text } from '../Text';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out' }\n : {\n transition: 'padding 0.2s ease-out',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n };\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n style={{\n cursor: 'pointer',\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </Flex>\n </Td>\n )}\n {children}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr isOpen={isCollapsed} collapsedContentColSpan={collapsedContentColSpan}>\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;;;;;;;;;AAUA,IAAa,UAAU,OAAO,WAAW,MAAM;CAC7C,SAAS;CACT,WAAW;CACX,oBAAoB;CACpB,YAAY;CACZ,YAAY;AACd,CAAC;AAED,IAAa,QAAQ,OAAO,SAAS;CACnC,OAAO;CACP,eAAe;AACjB,CAAC;AAED,IAAa,KAAK,OAAO,MAAM,OAAO;CAEpC,SAAS;CACT,eAAe;CAEf,qBAAqB;CACrB,sBAAsB;CAEtB,WAAW;CACX,GAAG;CACH,cAAc;CAEd,UAAU;EACR,OAAO;GACL,OAAO,EACL,WAAW,QACb;GACA,QAAQ,EACN,WAAW,SACb;GACA,KAAK,EACH,WAAW,MACb;EACF;EACA,WAAW,EACT,YAAY,EACV,SAAS,aACX,EACF;CACF;CACA,iBAAiB,EACf,OAAO,QACT;AACF,CAAC;AAED,IAAa,KAAK,OAAO,MAAM;CAC7B,WAAW;CACX,GAAG;CACH,cAAc;CACd,UAAU;CACV,YAAY;CACZ,eAAe;CACf,UAAU;EACR,QAAQ,EACN,MAAM;G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F,CAAC;AAED,IAAa,QAAQ,OAAO,SAAS;CACnC,OAAO;CACP,aAAa;CACb,WAAW;CACX,gBAAgB;CAChB,eAAe;CACf,YAAY;CACZ,OAAO;CACP,cAAc;CACd,UAAU;EACT,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;GACrB,KAAK,OAAO,EACX,WAAW,4BACb;CACF;EACC,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,UAAU,EACR,WAAW,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"Table.js","names":["_Fragment"],"sources":["../../../components/Table/Table.tsx"],"sourcesContent":["import { ChevronRightIcon } from '@radix-ui/react-icons';\nimport React, {\n ComponentProps,\n ElementRef,\n forwardRef,\n ReactNode,\n useId,\n useMemo,\n useState,\n} from 'react';\n\nimport { styled, VariantProps } from '../../stitches.config';\nimport { Box } from '../Box';\nimport { elevationVariants } from '../Elevation';\nimport { Flex } from '../Flex';\nimport { Label } from '../Label';\nimport {\n ROW_LINK_CONTROL_Z_INDEX,\n rowLinkRowStyles,\n RowLinkShortcutProps,\n rowLinkTableStyles,\n withRowLink,\n} from '../RowLink';\nimport { Text } from '../Text';\nimport { ExpandButton } from './ExpandButton';\n\nexport const Caption = styled('caption', Text, {\n display: 'table-caption',\n textAlign: 'start',\n fontVariantNumeric: 'proportional-nums',\n fontWeight: '$medium',\n lineHeight: '1.25',\n});\n\nexport const Tbody = styled('tbody', {\n width: '100%',\n verticalAlign: 'middle',\n});\n\nexport const Th = styled('th', Label, {\n // override Label\n display: 'table-cell',\n verticalAlign: 'inherit',\n\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n\n textAlign: 'start',\n p: '$2 $3',\n borderBottom: '1px solid $tableRowBorder',\n\n variants: {\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n transform: {\n capitalize: {\n display: 'table-cell', // revert Label enforced value\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const Td = styled('td', {\n boxSizing: 'border-box',\n p: '$5 $3',\n borderBottom: '1px solid $tableRowBorder',\n fontSize: '$3',\n lineHeight: '16px',\n verticalAlign: 'inherit',\n variants: {\n subtle: {\n true: {\n fontWeight: '$regular',\n color: '$tableSubtleText',\n },\n },\n align: {\n start: {\n textAlign: 'start',\n },\n center: {\n textAlign: 'center',\n },\n end: {\n textAlign: 'end',\n },\n },\n },\n defaultVariants: {\n align: 'start',\n },\n});\n\nexport const StyledTr = styled('tr', rowLinkRowStyles, {\n verticalAlign: 'inherit',\n '&:hover': {\n color: '$tableHoverText',\n },\n [`&:last-child > ${Td}`]: {\n borderBottom: 'none',\n },\n\n variants: {\n interactive: {\n true: {\n '&:hover': {\n backgroundColor: '$tableHoverBackground',\n cursor: 'pointer',\n },\n },\n },\n active: {\n true: {\n backgroundColor: '$tableHoverBackground',\n color: '$tableActiveText',\n fontWeight: '$semiBold',\n },\n },\n },\n compoundVariants: [\n {\n interactive: true,\n active: true,\n css: {\n '&:hover': {\n color: '$tableActiveHoverText',\n },\n },\n },\n ],\n});\n\nconst AnimatedTr = ({\n id,\n collapsedContentColSpan,\n isOpen,\n children,\n}: {\n id: string;\n collapsedContentColSpan: number;\n isOpen: boolean;\n children: ReactNode;\n}) => {\n const appliedStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'padding 0.2s ease-out, visibility 0s' }\n : {\n transition: 'padding 0.2s ease-out, visibility 0s 0.2s',\n visibility: 'hidden',\n lineHeight: 0,\n fontSize: 0,\n padding: '0px 16px',\n border: 'none',\n },\n [isOpen],\n );\n\n const containerStyle = useMemo(\n () =>\n isOpen\n ? { transition: 'all 0.2s ease-out' }\n : {\n transition: 'all 0.2s ease-out',\n height: 0,\n overflow: 'hidden',\n },\n [isOpen],\n );\n\n return (\n <Tr>\n <Td id={id} colSpan={collapsedContentColSpan} css={appliedStyle}>\n <Box css={containerStyle}>{children}</Box>\n </Td>\n </Tr>\n );\n};\nexport type TrProps = ComponentProps<typeof StyledTr> &\n VariantProps<typeof StyledTr> & {\n children: React.ReactNode;\n collapsedContent?: React.ReactNode;\n expandLabel?: string;\n emptyFirstColumn?: boolean;\n tableHead?: boolean;\n collapsedContentColSpan?: number;\n } & RowLinkShortcutProps;\n\nexport const Tr = forwardRef<ElementRef<typeof StyledTr>, TrProps>(\n (\n {\n children,\n collapsedContent,\n expandLabel = 'Expand row',\n emptyFirstColumn = false,\n tableHead = false,\n collapsedContentColSpan = 1,\n css,\n href,\n linkAs,\n linkCell,\n linkProps,\n interactive,\n ...props\n },\n ref,\n ) => {\n const [isCollapsed, setIsCollapsed] = useState(false);\n const contentId = useId();\n\n return (\n <>\n <StyledTr\n ref={ref}\n css={\n !!collapsedContent && !isCollapsed\n ? {\n ...css,\n [`&:nth-last-child(2) > ${Td}`]: {\n borderBottom: 'none',\n },\n }\n : { ...css }\n }\n interactive={interactive ?? (href !== undefined || undefined)}\n {...props}\n >\n {emptyFirstColumn ? tableHead ? <Th css={{ width: 24 }} /> : <Td /> : null}\n {!!collapsedContent && (\n <Td\n css={{ padding: '0 0 0 $3' }}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n >\n <Flex\n align=\"center\"\n justify=\"center\"\n css={{\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n height: '40px',\n '&:hover': {\n color: '$tableActiveText',\n },\n }}\n >\n <ExpandButton\n type=\"button\"\n css={{ width: '100%', height: '100%' }}\n aria-label={expandLabel}\n aria-expanded={isCollapsed}\n aria-controls={contentId}\n onClick={() => setIsCollapsed(!isCollapsed)}\n >\n <ChevronRightIcon\n aria-hidden\n style={{\n transition: 'transform 0.2s ease-out',\n transform: isCollapsed ? 'rotate(90deg)' : 'initial',\n }}\n />\n </ExpandButton>\n </Flex>\n </Td>\n )}\n {withRowLink(children, { href, linkAs, linkCell, linkProps }, Td)}\n </StyledTr>\n {!!collapsedContent && (\n <AnimatedTr\n id={contentId}\n isOpen={isCollapsed}\n collapsedContentColSpan={collapsedContentColSpan}\n >\n {collapsedContent}\n </AnimatedTr>\n )}\n </>\n );\n },\n);\n\nexport const Tfoot = styled('tfoot', {\n verticalAlign: 'middle',\n position: 'relative',\n borderRadius: 'inherit',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableFooterLayerBackground',\n borderRadius: 'inherit',\n },\n\n [`& ${Td}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n p: '$2 $3',\n },\n});\n\nexport const Thead = styled('thead', {\n position: 'relative',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n verticalAlign: 'middle',\n\n '&::after': {\n pointerEvents: 'none',\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n backgroundColor: '$tableHeaderLayerBackground',\n borderTopLeftRadius: 'inherit',\n borderTopRightRadius: 'inherit',\n },\n\n [`& ${Th}`]: {\n fontSize: '$1',\n color: '$tableHeaderText',\n fontWeight: '$light',\n },\n});\n\nexport const Table = styled('table', rowLinkTableStyles, {\n width: '100%',\n tableLayout: 'fixed',\n boxSizing: 'border-box',\n borderCollapse: 'separate',\n borderSpacing: 0,\n fontFamily: '$rubik',\n color: '$tableText',\n borderRadius: '$3',\n overflow: 'hidden',\n [`& ${Tbody}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n [`& ${Td}`]: {\n borderTop: '1px solid $tableRowBorder',\n },\n },\n [`& ${Thead}:not(:empty) ~ ${Tfoot}`]: {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n },\n\n variants: {\n elevation: elevationVariants,\n },\n defaultVariants: {\n elevation: 1,\n },\n});\n\nexport type TableVariants = VariantProps<typeof Table>;\nexport type TableProps = TableVariants & NonNullable<unknown>;\n"],"mappings":";;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ACF;EACC,KAAK,MAAM,iBAAiB,UAAU;EACrC,qBAAqB;EACrB,sBAAsB;CACxB;CAEA,UAAU,EACR,WAAW,kBACb;CACA,iBAAiB,EACf,WAAW,EACb;AACF,CAAC"}
|
|
@@ -8,14 +8,14 @@ var Theme;
|
|
|
8
8
|
textSubtle: (0, tinycolor2.default)("black").setAlpha(.51).toHslString(),
|
|
9
9
|
textDefault: (0, tinycolor2.default)("black").setAlpha(.74).toHslString(),
|
|
10
10
|
textContrast: "black",
|
|
11
|
-
textInvalid: "$
|
|
11
|
+
textInvalid: "$red11",
|
|
12
12
|
textRed: "$red10"
|
|
13
13
|
});
|
|
14
14
|
_Theme.getDark = () => ({
|
|
15
15
|
textSubtle: (0, tinycolor2.default)("white").setAlpha(.51).toHslString(),
|
|
16
16
|
textDefault: (0, tinycolor2.default)("white").setAlpha(.74).toHslString(),
|
|
17
17
|
textContrast: "white",
|
|
18
|
-
textInvalid: "$
|
|
18
|
+
textInvalid: "$red11",
|
|
19
19
|
textRed: "$red10"
|
|
20
20
|
});
|
|
21
21
|
})(Theme || (Theme = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.themes.cjs","names":["tinycolor"],"sources":["../../../components/Text/Text.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n textSubtle: Property.Color;\n textDefault: Property.Color;\n textContrast: Property.Color;\n textInvalid: Property.Color;\n textRed: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = () => ({\n textSubtle: tinycolor('black').setAlpha(0.51).toHslString(),\n textDefault: tinycolor('black').setAlpha(0.74).toHslString(),\n textContrast: 'black',\n textInvalid: '$
|
|
1
|
+
{"version":3,"file":"Text.themes.cjs","names":["tinycolor"],"sources":["../../../components/Text/Text.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n textSubtle: Property.Color;\n textDefault: Property.Color;\n textContrast: Property.Color;\n textInvalid: Property.Color;\n textRed: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = () => ({\n textSubtle: tinycolor('black').setAlpha(0.51).toHslString(),\n textDefault: tinycolor('black').setAlpha(0.74).toHslString(),\n textContrast: 'black',\n textInvalid: '$red11',\n textRed: '$red10',\n });\n\n export const getDark: Factory = () => ({\n textSubtle: tinycolor('white').setAlpha(0.51).toHslString(),\n textDefault: tinycolor('white').setAlpha(0.74).toHslString(),\n textContrast: 'white',\n textInvalid: '$red11',\n textRed: '$red10',\n });\n}\n"],"mappings":";;;;AAKO,IAAU;CAAV,SAAA,QAAA;CAWQ,OAAA,kBAA2B;EACtC,aAAA,GAAYA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC1D,cAAA,GAAaA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,cAAc;EACd,aAAa;EACb,SAAS;CACX;CAEa,OAAA,iBAA0B;EACrC,aAAA,GAAYA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC1D,cAAA,GAAaA,WAAAA,QAAAA,CAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,cAAc;EACd,aAAa;EACb,SAAS;CACX;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
|
|
@@ -6,14 +6,14 @@ var Theme;
|
|
|
6
6
|
textSubtle: tinycolor("black").setAlpha(.51).toHslString(),
|
|
7
7
|
textDefault: tinycolor("black").setAlpha(.74).toHslString(),
|
|
8
8
|
textContrast: "black",
|
|
9
|
-
textInvalid: "$
|
|
9
|
+
textInvalid: "$red11",
|
|
10
10
|
textRed: "$red10"
|
|
11
11
|
});
|
|
12
12
|
_Theme.getDark = () => ({
|
|
13
13
|
textSubtle: tinycolor("white").setAlpha(.51).toHslString(),
|
|
14
14
|
textDefault: tinycolor("white").setAlpha(.74).toHslString(),
|
|
15
15
|
textContrast: "white",
|
|
16
|
-
textInvalid: "$
|
|
16
|
+
textInvalid: "$red11",
|
|
17
17
|
textRed: "$red10"
|
|
18
18
|
});
|
|
19
19
|
})(Theme || (Theme = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Text.themes.js","names":[],"sources":["../../../components/Text/Text.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n textSubtle: Property.Color;\n textDefault: Property.Color;\n textContrast: Property.Color;\n textInvalid: Property.Color;\n textRed: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = () => ({\n textSubtle: tinycolor('black').setAlpha(0.51).toHslString(),\n textDefault: tinycolor('black').setAlpha(0.74).toHslString(),\n textContrast: 'black',\n textInvalid: '$
|
|
1
|
+
{"version":3,"file":"Text.themes.js","names":[],"sources":["../../../components/Text/Text.themes.ts"],"sourcesContent":["import { Property } from '@stitches/react/types/css';\nimport tinycolor from 'tinycolor2';\n\nimport { ColorInfo } from '../../utils/getPrimaryColorInfo';\n\nexport namespace Theme {\n type Colors = {\n textSubtle: Property.Color;\n textDefault: Property.Color;\n textContrast: Property.Color;\n textInvalid: Property.Color;\n textRed: Property.Color;\n };\n\n type Factory = (primaryColor: ColorInfo) => Colors;\n\n export const getLight: Factory = () => ({\n textSubtle: tinycolor('black').setAlpha(0.51).toHslString(),\n textDefault: tinycolor('black').setAlpha(0.74).toHslString(),\n textContrast: 'black',\n textInvalid: '$red11',\n textRed: '$red10',\n });\n\n export const getDark: Factory = () => ({\n textSubtle: tinycolor('white').setAlpha(0.51).toHslString(),\n textDefault: tinycolor('white').setAlpha(0.74).toHslString(),\n textContrast: 'white',\n textInvalid: '$red11',\n textRed: '$red10',\n });\n}\n"],"mappings":";;AAKO,IAAU;CAAV,SAAA,QAAA;CAWQ,OAAA,kBAA2B;EACtC,YAAY,UAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC1D,aAAa,UAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,cAAc;EACd,aAAa;EACb,SAAS;CACX;CAEa,OAAA,iBAA0B;EACrC,YAAY,UAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC1D,aAAa,UAAU,OAAO,CAAC,CAAC,SAAS,GAAI,CAAC,CAAC,YAAY;EAC3D,cAAc;EACd,aAAa;EACb,SAAS;CACX;AACD,EAAA,CAAA,UAAA,QAAA,CAAA,EAAD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const require_cssProps = require("../../styles/cssProps.cjs");
|
|
2
|
+
const require_themeContext = require("../../styles/themeContext.cjs");
|
|
3
|
+
const require_Text_vanilla_css = require("./Text.vanilla.css.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let _vanilla_extract_dynamic = require("@vanilla-extract/dynamic");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
// components/Text/Text.vanilla.tsx
|
|
8
|
+
var TextVanillaComponentImpl = (0, react.forwardRef)(({ as, className, css, style, size, weight, variant, gradient, transform, noWrap, ...props }, ref) => {
|
|
9
|
+
const Component = as || "span";
|
|
10
|
+
const { colors } = require_themeContext.useVanillaExtractTheme();
|
|
11
|
+
const { style: cssStyles, vars } = require_cssProps.processCSSProp(css, colors);
|
|
12
|
+
const mergedStyles = {
|
|
13
|
+
...cssStyles,
|
|
14
|
+
...style,
|
|
15
|
+
...(0, _vanilla_extract_dynamic.assignInlineVars)(vars)
|
|
16
|
+
};
|
|
17
|
+
const recipeClass = require_Text_vanilla_css.textRecipe({
|
|
18
|
+
size,
|
|
19
|
+
weight,
|
|
20
|
+
variant,
|
|
21
|
+
gradient,
|
|
22
|
+
transform,
|
|
23
|
+
noWrap
|
|
24
|
+
});
|
|
25
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
26
|
+
ref,
|
|
27
|
+
className: `${recipeClass} ${className || ""}`.trim(),
|
|
28
|
+
style: mergedStyles,
|
|
29
|
+
...props
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
TextVanillaComponentImpl.displayName = "TextVanilla";
|
|
33
|
+
var TextVanilla = TextVanillaComponentImpl;
|
|
34
|
+
exports.TextVanilla = TextVanilla;
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=Text.vanilla.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","assignInlineVars","textRecipe"],"sources":["../../../components/Text/Text.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { textRecipe } from './Text.vanilla.css';\n\ntype TextRecipeVariants = RecipeVariants<typeof textRecipe>;\n\ninterface TextOwnProps extends Omit<TextRecipeVariants, never>, CSSProps {}\n\nexport type TextVanillaProps<C extends ElementType = 'span'> = PolymorphicComponentProps<\n C,\n TextOwnProps\n>;\n\ntype TextComponent = PolymorphicComponent<'span', TextVanillaProps<ElementType>>;\n\nconst TextVanillaComponentImpl = forwardRef(\n <C extends ElementType = 'span'>(\n {\n as,\n className,\n css,\n style,\n size,\n weight,\n variant,\n gradient,\n transform,\n noWrap,\n ...props\n }: TextVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'span';\n\n const { colors } = useVanillaExtractTheme();\n\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = textRecipe({ size, weight, variant, gradient, transform, noWrap });\n\n return (\n <Component\n ref={ref}\n className={`${recipeClass} ${className || ''}`.trim()}\n style={mergedStyles}\n {...props}\n />\n );\n },\n);\n\nTextVanillaComponentImpl.displayName = 'TextVanilla';\n\nexport const TextVanilla = TextVanillaComponentImpl as TextComponent;\n"],"mappings":";;;;;;;AAwBA,IAAM,4BAAA,GAA2BA,MAAAA,WAAAA,EAE7B,EACE,IACA,WACA,KACA,OACA,MACA,QACA,SACA,UACA,WACA,QACA,GAAG,SAEL,QACG;CACH,MAAM,YAAY,MAAM;CAExB,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAE1C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAE7D,MAAM,eAAe;EACnB,GAAG;EACH,GAAG;EACH,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;CAC1B;CAEA,MAAM,cAAcC,yBAAAA,WAAW;EAAE;EAAM;EAAQ;EAAS;EAAU;EAAW;CAAO,CAAC;CAErF,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EACO;EACL,WAAW,GAAG,YAAY,GAAG,aAAa,KAAK,KAAK;EACpD,OAAO;EACP,GAAI;CACL,CAAA;AAEL,CACF;AAEA,yBAAyB,cAAc;AAEvC,IAAa,cAAc"}
|