@tosui/react 0.1.4 → 0.1.5
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/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Box/Box.d.ts +2 -7
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +1 -1
- package/dist/components/Box/Box.js.map +1 -1
- package/dist/components/Box/borders/borders.d.ts +11 -13
- package/dist/components/Box/borders/borders.d.ts.map +1 -1
- package/dist/components/Box/borders/borders.js +29 -62
- package/dist/components/Box/borders/borders.js.map +1 -1
- package/dist/components/Box/borders/borders.module.css +936 -40
- package/dist/components/Box/borders/borders.module.css.js +600 -40
- package/dist/components/Box/borders/borders.module.css.js.map +1 -1
- package/dist/components/Box/colors/colors.d.ts +6 -8
- package/dist/components/Box/colors/colors.d.ts.map +1 -1
- package/dist/components/Box/colors/colors.js +20 -30
- package/dist/components/Box/colors/colors.js.map +1 -1
- package/dist/components/Box/colors/colors.module.css +2537 -108
- package/dist/components/Box/colors/colors.module.css.js +1620 -108
- package/dist/components/Box/colors/colors.module.css.js.map +1 -1
- package/dist/components/Box/display/display.d.ts +2 -8
- package/dist/components/Box/display/display.d.ts.map +1 -1
- package/dist/components/Box/display/display.js +10 -33
- package/dist/components/Box/display/display.js.map +1 -1
- package/dist/components/Box/flexbox/flexbox.d.ts +12 -14
- package/dist/components/Box/flexbox/flexbox.d.ts.map +1 -1
- package/dist/components/Box/flexbox/flexbox.js +39 -102
- package/dist/components/Box/flexbox/flexbox.js.map +1 -1
- package/dist/components/Box/flexbox/flexbox.module.css +1210 -56
- package/dist/components/Box/flexbox/flexbox.module.css.js +727 -55
- package/dist/components/Box/flexbox/flexbox.module.css.js.map +1 -1
- package/dist/components/Box/grid/grid.d.ts.map +1 -1
- package/dist/components/Box/grid/grid.js +22 -33
- package/dist/components/Box/grid/grid.js.map +1 -1
- package/dist/components/Box/grid/grid.module.css +36 -36
- package/dist/components/Box/grid/grid.module.css.js +14 -34
- package/dist/components/Box/grid/grid.module.css.js.map +1 -1
- package/dist/components/Box/inset/inset.d.ts.map +1 -1
- package/dist/components/Box/inset/inset.js +8 -52
- package/dist/components/Box/inset/inset.js.map +1 -1
- package/dist/components/Box/inset/inset.module.css +120 -120
- package/dist/components/Box/inset/inset.module.css.js +21 -161
- package/dist/components/Box/inset/inset.module.css.js.map +1 -1
- package/dist/components/Box/interactions/interactions.d.ts +6 -8
- package/dist/components/Box/interactions/interactions.d.ts.map +1 -1
- package/dist/components/Box/interactions/interactions.js +20 -30
- package/dist/components/Box/interactions/interactions.js.map +1 -1
- package/dist/components/Box/interactions/interactions.module.css +891 -38
- package/dist/components/Box/interactions/interactions.module.css.js +570 -38
- package/dist/components/Box/interactions/interactions.module.css.js.map +1 -1
- package/dist/components/Box/margin/margin.d.ts.map +1 -1
- package/dist/components/Box/margin/margin.js +8 -52
- package/dist/components/Box/margin/margin.js.map +1 -1
- package/dist/components/Box/margin/margin.module.css +120 -120
- package/dist/components/Box/margin/margin.module.css.js +21 -161
- package/dist/components/Box/margin/margin.module.css.js.map +1 -1
- package/dist/components/Box/opacity/opacity.d.ts +2 -8
- package/dist/components/Box/opacity/opacity.d.ts.map +1 -1
- package/dist/components/Box/opacity/opacity.js +10 -33
- package/dist/components/Box/opacity/opacity.js.map +1 -1
- package/dist/components/Box/overflow/overflow.d.ts +2 -8
- package/dist/components/Box/overflow/overflow.d.ts.map +1 -1
- package/dist/components/Box/overflow/overflow.js +24 -29
- package/dist/components/Box/overflow/overflow.js.map +1 -1
- package/dist/components/Box/padding/padding.d.ts.map +1 -1
- package/dist/components/Box/padding/padding.js +8 -52
- package/dist/components/Box/padding/padding.js.map +1 -1
- package/dist/components/Box/padding/padding.module.css +120 -120
- package/dist/components/Box/padding/padding.module.css.js +21 -161
- package/dist/components/Box/padding/padding.module.css.js.map +1 -1
- package/dist/components/Box/position/position.d.ts +2 -8
- package/dist/components/Box/position/position.d.ts.map +1 -1
- package/dist/components/Box/position/position.js +10 -33
- package/dist/components/Box/position/position.js.map +1 -1
- package/dist/components/Box/roundness/roundness.d.ts +12 -14
- package/dist/components/Box/roundness/roundness.d.ts.map +1 -1
- package/dist/components/Box/roundness/roundness.js +26 -62
- package/dist/components/Box/roundness/roundness.js.map +1 -1
- package/dist/components/Box/roundness/roundness.module.css +937 -40
- package/dist/components/Box/roundness/roundness.module.css.js +600 -40
- package/dist/components/Box/roundness/roundness.module.css.js.map +1 -1
- package/dist/components/Box/shadows/shadows.d.ts +2 -8
- package/dist/components/Box/shadows/shadows.d.ts.map +1 -1
- package/dist/components/Box/shadows/shadows.js +10 -33
- package/dist/components/Box/shadows/shadows.js.map +1 -1
- package/dist/components/Box/shared/index.d.ts +1 -0
- package/dist/components/Box/shared/index.d.ts.map +1 -1
- package/dist/components/Box/shared/responsive.d.ts +36 -0
- package/dist/components/Box/shared/responsive.d.ts.map +1 -0
- package/dist/components/Box/shared/responsive.js +65 -0
- package/dist/components/Box/shared/responsive.js.map +1 -0
- package/dist/components/Box/shared/types.d.ts +6 -0
- package/dist/components/Box/shared/types.d.ts.map +1 -1
- package/dist/components/Box/sizing/sizing.d.ts.map +1 -1
- package/dist/components/Box/sizing/sizing.js +5 -37
- package/dist/components/Box/sizing/sizing.js.map +1 -1
- package/dist/components/Box/sizing/sizing.module.css +175 -183
- package/dist/components/Box/sizing/sizing.module.css.js +31 -241
- package/dist/components/Box/sizing/sizing.module.css.js.map +1 -1
- package/dist/components/Box/text/text.d.ts +6 -8
- package/dist/components/Box/text/text.d.ts.map +1 -1
- package/dist/components/Box/text/text.js +24 -30
- package/dist/components/Box/text/text.js.map +1 -1
- package/dist/components/Box/text/text.module.css +562 -24
- package/dist/components/Box/text/text.module.css.js +360 -24
- package/dist/components/Box/text/text.module.css.js.map +1 -1
- package/dist/components/Box/typography/typography.d.ts +7 -9
- package/dist/components/Box/typography/typography.d.ts.map +1 -1
- package/dist/components/Box/typography/typography.js +33 -19
- package/dist/components/Box/typography/typography.js.map +1 -1
- package/dist/components/Box/typography/typography.module.css +890 -19
- package/dist/components/Box/typography/typography.module.css.js +570 -19
- package/dist/components/Box/typography/typography.module.css.js.map +1 -1
- package/dist/components/Box/zIndex/zIndex.d.ts +2 -8
- package/dist/components/Box/zIndex/zIndex.d.ts.map +1 -1
- package/dist/components/Box/zIndex/zIndex.js +10 -33
- package/dist/components/Box/zIndex/zIndex.js.map +1 -1
- package/dist/components/Flex/Flex.d.ts +5 -6
- package/dist/components/Flex/Flex.d.ts.map +1 -1
- package/dist/components/Flex/Flex.js +0 -1
- package/dist/components/Flex/Flex.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +3 -3
- package/dist/components/Grid/Grid.d.ts.map +1 -1
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts.map +1 -1
- package/dist/components/Menu/Menu.js +5 -5
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +9 -9
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Progress/Progress.d.ts.map +1 -1
- package/dist/components/Progress/Progress.js.map +1 -1
- package/dist/components/Stack/Stack.d.ts +2 -1
- package/dist/components/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +5 -5
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/index.css +9778 -2147
- package/dist/styles/styles.css +7 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.module.css.js","sources":[],"sourcesContent":[],"names":[],"mapp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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,14 +1,8 @@
|
|
|
1
1
|
import { ResponsiveValue } from '../../../utils/breakpoints';
|
|
2
|
-
import { StyleResult } from '../shared';
|
|
2
|
+
import { StateProps, StyleResult } from '../shared';
|
|
3
3
|
export type DisplayValue = "block" | "flex" | "inline-flex" | "grid" | "inline" | "inline-block" | "none" | "contents";
|
|
4
4
|
export type DisplayProps = {
|
|
5
5
|
display?: ResponsiveValue<DisplayValue>;
|
|
6
6
|
};
|
|
7
|
-
export
|
|
8
|
-
_hover?: DisplayProps;
|
|
9
|
-
_focus?: DisplayProps;
|
|
10
|
-
_active?: DisplayProps;
|
|
11
|
-
_disabled?: DisplayProps;
|
|
12
|
-
};
|
|
13
|
-
export declare function getDisplayStyles(props: DisplayProps & DisplayStateProps): StyleResult;
|
|
7
|
+
export declare function getDisplayStyles(props: DisplayProps & StateProps<DisplayProps>): StyleResult;
|
|
14
8
|
//# sourceMappingURL=display.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/display/display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/display/display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EAEjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,MAAM,GACN,aAAa,GACb,MAAM,GACN,QAAQ,GACR,cAAc,GACd,MAAM,GACN,UAAU,CAAC;AAEf,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;CACzC,CAAC;AAWF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,GAC7C,WAAW,CAmBb"}
|
|
@@ -1,40 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getEnumResponsiveStyles } from "../shared/responsive.js";
|
|
2
2
|
import styles from "./display.module.css.js";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return stateClassSuffix ? styles[`${value}${stateClassSuffix}`] : styles[value];
|
|
8
|
-
}
|
|
9
|
-
return stateClassSuffix ? styles[`${value}_${responsiveKey}${stateClassSuffix}`] : styles[`${value}_${responsiveKey}`];
|
|
10
|
-
}
|
|
11
|
-
function getDisplayStylesForValue(value, state) {
|
|
12
|
-
const result = { className: "", style: {} };
|
|
13
|
-
if (value === void 0) return result;
|
|
14
|
-
if (typeof value === "string") {
|
|
15
|
-
const className = getDisplayClass(value, "base", state);
|
|
16
|
-
if (className) {
|
|
17
|
-
result.className = className;
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
for (const responsiveKey of RESPONSIVE_KEYS) {
|
|
22
|
-
const displayValue = value[responsiveKey];
|
|
23
|
-
if (displayValue === void 0) continue;
|
|
24
|
-
const className = getDisplayClass(displayValue, responsiveKey, state);
|
|
25
|
-
if (className) {
|
|
26
|
-
result.className = clsx(result.className, className);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return result;
|
|
4
|
+
function getDisplayStylesForState(props, state) {
|
|
5
|
+
if (!props) return { className: "", style: {} };
|
|
6
|
+
return getEnumResponsiveStyles(styles, "", props.display, state);
|
|
30
7
|
}
|
|
31
8
|
function getDisplayStyles(props) {
|
|
32
|
-
const {
|
|
33
|
-
const baseStyles =
|
|
34
|
-
const hoverStyles =
|
|
35
|
-
const focusStyles =
|
|
36
|
-
const activeStyles =
|
|
37
|
-
const disabledStyles =
|
|
9
|
+
const { _hover, _focus, _active, _disabled, ...baseProps } = props;
|
|
10
|
+
const baseStyles = getDisplayStylesForState(baseProps, "base");
|
|
11
|
+
const hoverStyles = getDisplayStylesForState(_hover, "hover");
|
|
12
|
+
const focusStyles = getDisplayStylesForState(_focus, "focus");
|
|
13
|
+
const activeStyles = getDisplayStylesForState(_active, "active");
|
|
14
|
+
const disabledStyles = getDisplayStylesForState(_disabled, "disabled");
|
|
38
15
|
return {
|
|
39
16
|
className: clsx(
|
|
40
17
|
baseStyles.className,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sources":["../../../../src/components/Box/display/display.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n
|
|
1
|
+
{"version":3,"file":"display.js","sources":["../../../../src/components/Box/display/display.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n type StateKey,\n type StateProps,\n type StyleResult,\n getEnumResponsiveStyles,\n} from \"../shared\";\nimport styles from \"./display.module.css\";\nimport clsx from \"clsx\";\n\nexport type DisplayValue =\n | \"block\"\n | \"flex\"\n | \"inline-flex\"\n | \"grid\"\n | \"inline\"\n | \"inline-block\"\n | \"none\"\n | \"contents\";\n\nexport type DisplayProps = {\n display?: ResponsiveValue<DisplayValue>;\n};\n\nfunction getDisplayStylesForState(\n props: DisplayProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n return getEnumResponsiveStyles(styles, \"\", props.display, state);\n}\n\nexport function getDisplayStyles(\n props: DisplayProps & StateProps<DisplayProps>\n): StyleResult {\n const { _hover, _focus, _active, _disabled, ...baseProps } = props;\n\n const baseStyles = getDisplayStylesForState(baseProps, \"base\");\n const hoverStyles = getDisplayStylesForState(_hover, \"hover\");\n const focusStyles = getDisplayStylesForState(_focus, \"focus\");\n const activeStyles = getDisplayStylesForState(_active, \"active\");\n const disabledStyles = getDisplayStylesForState(_disabled, \"disabled\");\n\n return {\n className: clsx(\n baseStyles.className,\n hoverStyles.className,\n focusStyles.className,\n activeStyles.className,\n disabledStyles.className\n ),\n style: {},\n };\n}\n"],"names":[],"mappings":";;;AAwBA,SAAS,yBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,SAAO,wBAAwB,QAAQ,IAAI,MAAM,SAAS,KAAK;AACjE;AAEO,SAAS,iBACd,OACa;AACb,QAAM,EAAE,QAAQ,QAAQ,SAAS,WAAW,GAAG,cAAc;AAE7D,QAAM,aAAa,yBAAyB,WAAW,MAAM;AAC7D,QAAM,cAAc,yBAAyB,QAAQ,OAAO;AAC5D,QAAM,cAAc,yBAAyB,QAAQ,OAAO;AAC5D,QAAM,eAAe,yBAAyB,SAAS,QAAQ;AAC/D,QAAM,iBAAiB,yBAAyB,WAAW,UAAU;AAErE,SAAO;AAAA,IACL,WAAW;AAAA,MACT,WAAW;AAAA,MACX,YAAY;AAAA,MACZ,YAAY;AAAA,MACZ,aAAa;AAAA,MACb,eAAe;AAAA,IAAA;AAAA,IAEjB,OAAO,CAAA;AAAA,EAAC;AAEZ;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ResponsiveValue } from '../../../utils/breakpoints';
|
|
2
|
+
import { StateProps, StyleResult } from '../shared';
|
|
2
3
|
export type FlexDirectionValue = "row" | "row-reverse" | "column" | "column-reverse";
|
|
3
4
|
export type JustifyContentValue = "start" | "end" | "center" | "space-between" | "space-around" | "space-evenly";
|
|
4
5
|
export type AlignItemsValue = "start" | "end" | "center" | "stretch" | "baseline";
|
|
@@ -6,21 +7,18 @@ export type AlignSelfValue = "auto" | "start" | "end" | "center" | "stretch" | "
|
|
|
6
7
|
export type FlexWrapValue = "nowrap" | "wrap" | "wrap-reverse";
|
|
7
8
|
export type SpacingValue = number | string;
|
|
8
9
|
export type FlexboxProps = {
|
|
9
|
-
flexDirection?: FlexDirectionValue
|
|
10
|
-
justifyContent?: JustifyContentValue
|
|
11
|
-
alignItems?: AlignItemsValue
|
|
12
|
-
alignSelf?: AlignSelfValue
|
|
13
|
-
flexWrap?: FlexWrapValue
|
|
14
|
-
gap?: SpacingValue
|
|
15
|
-
gapRow?: SpacingValue
|
|
16
|
-
gapColumn?: SpacingValue
|
|
17
|
-
flex?: string
|
|
10
|
+
flexDirection?: ResponsiveValue<FlexDirectionValue>;
|
|
11
|
+
justifyContent?: ResponsiveValue<JustifyContentValue>;
|
|
12
|
+
alignItems?: ResponsiveValue<AlignItemsValue>;
|
|
13
|
+
alignSelf?: ResponsiveValue<AlignSelfValue>;
|
|
14
|
+
flexWrap?: ResponsiveValue<FlexWrapValue>;
|
|
15
|
+
gap?: ResponsiveValue<SpacingValue>;
|
|
16
|
+
gapRow?: ResponsiveValue<SpacingValue>;
|
|
17
|
+
gapColumn?: ResponsiveValue<SpacingValue>;
|
|
18
|
+
flex?: ResponsiveValue<string>;
|
|
18
19
|
flexGrow?: number;
|
|
19
20
|
flexShrink?: number;
|
|
20
21
|
flexBasis?: string;
|
|
21
22
|
};
|
|
22
|
-
export
|
|
23
|
-
_hover?: FlexboxProps;
|
|
24
|
-
};
|
|
25
|
-
export declare function getFlexboxStyles(props: FlexboxProps & FlexboxStateProps): StyleResult;
|
|
23
|
+
export declare function getFlexboxStyles(props: FlexboxProps & StateProps<FlexboxProps>): StyleResult;
|
|
26
24
|
//# sourceMappingURL=flexbox.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/flexbox/flexbox.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"flexbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/flexbox/flexbox.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EAIjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,aAAa,GAAG,QAAQ,GAAG,gBAAgB,CAAC;AACrF,MAAM,MAAM,mBAAmB,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,eAAe,GAAG,cAAc,GAAG,cAAc,CAAC;AACjH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAClF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;AAC1F,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,GAAG,cAAc,CAAC;AAC/D,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,CAAC,EAAE,eAAe,CAAC,kBAAkB,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,eAAe,CAAC,mBAAmB,CAAC,CAAC;IACtD,UAAU,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;IAC9C,SAAS,CAAC,EAAE,eAAe,CAAC,cAAc,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,eAAe,CAAC,aAAa,CAAC,CAAC;IAC1C,GAAG,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IACpC,MAAM,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IACvC,SAAS,CAAC,EAAE,eAAe,CAAC,YAAY,CAAC,CAAC;IAC1C,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAoEF,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,GAC7C,WAAW,CAmBb"}
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getRawValue } from "../shared/spacing.js";
|
|
2
|
+
import { getEnumResponsiveStyles, getResponsiveVarStyles } from "../shared/responsive.js";
|
|
2
3
|
import styles from "./flexbox.module.css.js";
|
|
3
4
|
import clsx from "clsx";
|
|
4
|
-
function getFlexDirectionClass(value, state) {
|
|
5
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
6
|
-
return stateClassSuffix ? styles[`flex-${value}${stateClassSuffix}`] : styles[`flex-${value}`];
|
|
7
|
-
}
|
|
8
|
-
function getJustifyContentClass(value, state) {
|
|
9
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
10
|
-
return stateClassSuffix ? styles[`justify-${value}${stateClassSuffix}`] : styles[`justify-${value}`];
|
|
11
|
-
}
|
|
12
|
-
function getAlignItemsClass(value, state) {
|
|
13
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
14
|
-
return stateClassSuffix ? styles[`items-${value}${stateClassSuffix}`] : styles[`items-${value}`];
|
|
15
|
-
}
|
|
16
|
-
function getAlignSelfClass(value, state) {
|
|
17
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
18
|
-
return stateClassSuffix ? styles[`self-${value}${stateClassSuffix}`] : styles[`self-${value}`];
|
|
19
|
-
}
|
|
20
|
-
function getFlexWrapClass(value, state) {
|
|
21
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
22
|
-
return stateClassSuffix ? styles[`flex-${value}${stateClassSuffix}`] : styles[`flex-${value}`];
|
|
23
|
-
}
|
|
24
|
-
function getSpacingValue(value) {
|
|
25
|
-
if (value === void 0) return "normal";
|
|
26
|
-
if (typeof value === "string") return value;
|
|
27
|
-
if (value === 0) return "0";
|
|
28
|
-
return `calc(var(--t-spacing-unit) * ${value})`;
|
|
29
|
-
}
|
|
30
5
|
function getFlexboxStylesForState(props, state) {
|
|
31
6
|
if (!props) return { className: "", style: {} };
|
|
32
7
|
const {
|
|
@@ -45,49 +20,32 @@ function getFlexboxStylesForState(props, state) {
|
|
|
45
20
|
} = props;
|
|
46
21
|
const classes = [];
|
|
47
22
|
const style = {};
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
if (flexWrap) {
|
|
67
|
-
const cls = getFlexWrapClass(flexWrap, state);
|
|
68
|
-
if (cls) classes.push(cls);
|
|
69
|
-
}
|
|
70
|
-
if (gap !== void 0 || gapRow !== void 0 || gapColumn !== void 0) {
|
|
71
|
-
const row = gapRow ?? gap;
|
|
72
|
-
const column = gapColumn ?? gap;
|
|
73
|
-
const rowValue = getSpacingValue(row);
|
|
74
|
-
const columnValue = getSpacingValue(column);
|
|
75
|
-
const gapValue = rowValue === columnValue ? rowValue : `${rowValue} ${columnValue}`;
|
|
76
|
-
const gapClass = stateClassSuffix ? styles[`gap${stateClassSuffix}`] : styles.gap;
|
|
77
|
-
if (gapClass) classes.push(gapClass);
|
|
78
|
-
style[`--t-gap${stateVarSuffix}`] = gapValue;
|
|
79
|
-
}
|
|
23
|
+
const dirResult = getEnumResponsiveStyles(styles, "flex", flexDirection, state);
|
|
24
|
+
if (dirResult.className) classes.push(dirResult.className);
|
|
25
|
+
const justifyResult = getEnumResponsiveStyles(styles, "justify", justifyContent, state);
|
|
26
|
+
if (justifyResult.className) classes.push(justifyResult.className);
|
|
27
|
+
const itemsResult = getEnumResponsiveStyles(styles, "items", alignItems, state);
|
|
28
|
+
if (itemsResult.className) classes.push(itemsResult.className);
|
|
29
|
+
const selfResult = getEnumResponsiveStyles(styles, "self", alignSelf, state);
|
|
30
|
+
if (selfResult.className) classes.push(selfResult.className);
|
|
31
|
+
const wrapResult = getEnumResponsiveStyles(styles, "flex", flexWrap, state);
|
|
32
|
+
if (wrapResult.className) classes.push(wrapResult.className);
|
|
33
|
+
const resolvedGapRow = gapRow ?? gap;
|
|
34
|
+
const resolvedGapCol = gapColumn ?? gap;
|
|
35
|
+
const gapRowResult = getResponsiveVarStyles(styles, "gap-row", "gap-row", resolvedGapRow, state, getRawValue);
|
|
36
|
+
const gapColResult = getResponsiveVarStyles(styles, "gap-col", "gap-col", resolvedGapCol, state, getRawValue);
|
|
37
|
+
if (gapRowResult.className) classes.push(gapRowResult.className);
|
|
38
|
+
if (gapColResult.className) classes.push(gapColResult.className);
|
|
39
|
+
Object.assign(style, gapRowResult.style, gapColResult.style);
|
|
80
40
|
if (flex !== void 0) {
|
|
81
|
-
const
|
|
82
|
-
if (
|
|
83
|
-
style
|
|
41
|
+
const flexResult = getResponsiveVarStyles(styles, "flex", "flex", flex, state);
|
|
42
|
+
if (flexResult.className) classes.push(flexResult.className);
|
|
43
|
+
Object.assign(style, flexResult.style);
|
|
84
44
|
} else if (flexGrow !== void 0 || flexShrink !== void 0 || flexBasis !== void 0) {
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (flexClass) classes.push(flexClass);
|
|
90
|
-
style[`--t-flex${stateVarSuffix}`] = `${grow} ${shrink} ${basis}`;
|
|
45
|
+
const composedFlex = `${flexGrow ?? 0} ${flexShrink ?? 1} ${flexBasis ?? "auto"}`;
|
|
46
|
+
const flexResult = getResponsiveVarStyles(styles, "flex", "flex", composedFlex, state);
|
|
47
|
+
if (flexResult.className) classes.push(flexResult.className);
|
|
48
|
+
Object.assign(style, flexResult.style);
|
|
91
49
|
}
|
|
92
50
|
return {
|
|
93
51
|
className: clsx(...classes),
|
|
@@ -95,42 +53,21 @@ function getFlexboxStylesForState(props, state) {
|
|
|
95
53
|
};
|
|
96
54
|
}
|
|
97
55
|
function getFlexboxStyles(props) {
|
|
98
|
-
const {
|
|
99
|
-
|
|
100
|
-
justifyContent,
|
|
101
|
-
alignItems,
|
|
102
|
-
alignSelf,
|
|
103
|
-
flexWrap,
|
|
104
|
-
gap,
|
|
105
|
-
gapRow,
|
|
106
|
-
gapColumn,
|
|
107
|
-
flex,
|
|
108
|
-
flexGrow,
|
|
109
|
-
flexShrink,
|
|
110
|
-
flexBasis,
|
|
111
|
-
_hover
|
|
112
|
-
} = props;
|
|
113
|
-
const baseStyles = getFlexboxStylesForState(
|
|
114
|
-
{
|
|
115
|
-
flexDirection,
|
|
116
|
-
justifyContent,
|
|
117
|
-
alignItems,
|
|
118
|
-
alignSelf,
|
|
119
|
-
flexWrap,
|
|
120
|
-
gap,
|
|
121
|
-
gapRow,
|
|
122
|
-
gapColumn,
|
|
123
|
-
flex,
|
|
124
|
-
flexGrow,
|
|
125
|
-
flexShrink,
|
|
126
|
-
flexBasis
|
|
127
|
-
},
|
|
128
|
-
"base"
|
|
129
|
-
);
|
|
56
|
+
const { _hover, _focus, _active, _disabled, ...baseProps } = props;
|
|
57
|
+
const baseStyles = getFlexboxStylesForState(baseProps, "base");
|
|
130
58
|
const hoverStyles = getFlexboxStylesForState(_hover, "hover");
|
|
59
|
+
const focusStyles = getFlexboxStylesForState(_focus, "focus");
|
|
60
|
+
const activeStyles = getFlexboxStylesForState(_active, "active");
|
|
61
|
+
const disabledStyles = getFlexboxStylesForState(_disabled, "disabled");
|
|
131
62
|
return {
|
|
132
|
-
className: clsx(
|
|
133
|
-
|
|
63
|
+
className: clsx(
|
|
64
|
+
baseStyles.className,
|
|
65
|
+
hoverStyles.className,
|
|
66
|
+
focusStyles.className,
|
|
67
|
+
activeStyles.className,
|
|
68
|
+
disabledStyles.className
|
|
69
|
+
),
|
|
70
|
+
style: { ...baseStyles.style, ...hoverStyles.style, ...focusStyles.style, ...activeStyles.style, ...disabledStyles.style }
|
|
134
71
|
};
|
|
135
72
|
}
|
|
136
73
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flexbox.js","sources":["../../../../src/components/Box/flexbox/flexbox.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"flexbox.js","sources":["../../../../src/components/Box/flexbox/flexbox.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n type StateKey,\n type StateProps,\n type StyleResult,\n getRawValue,\n getResponsiveVarStyles,\n getEnumResponsiveStyles,\n} from \"../shared\";\nimport styles from \"./flexbox.module.css\";\nimport clsx from \"clsx\";\n\nexport type FlexDirectionValue = \"row\" | \"row-reverse\" | \"column\" | \"column-reverse\";\nexport type JustifyContentValue = \"start\" | \"end\" | \"center\" | \"space-between\" | \"space-around\" | \"space-evenly\";\nexport type AlignItemsValue = \"start\" | \"end\" | \"center\" | \"stretch\" | \"baseline\";\nexport type AlignSelfValue = \"auto\" | \"start\" | \"end\" | \"center\" | \"stretch\" | \"baseline\";\nexport type FlexWrapValue = \"nowrap\" | \"wrap\" | \"wrap-reverse\";\nexport type SpacingValue = number | string;\n\nexport type FlexboxProps = {\n flexDirection?: ResponsiveValue<FlexDirectionValue>;\n justifyContent?: ResponsiveValue<JustifyContentValue>;\n alignItems?: ResponsiveValue<AlignItemsValue>;\n alignSelf?: ResponsiveValue<AlignSelfValue>;\n flexWrap?: ResponsiveValue<FlexWrapValue>;\n gap?: ResponsiveValue<SpacingValue>;\n gapRow?: ResponsiveValue<SpacingValue>;\n gapColumn?: ResponsiveValue<SpacingValue>;\n flex?: ResponsiveValue<string>;\n flexGrow?: number;\n flexShrink?: number;\n flexBasis?: string;\n};\n\nfunction getFlexboxStylesForState(\n props: FlexboxProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n const {\n flexDirection,\n justifyContent,\n alignItems,\n alignSelf,\n flexWrap,\n gap,\n gapRow,\n gapColumn,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n } = props;\n\n const classes: string[] = [];\n const style: Record<string, string> = {};\n\n const dirResult = getEnumResponsiveStyles(styles, \"flex\", flexDirection, state);\n if (dirResult.className) classes.push(dirResult.className);\n\n const justifyResult = getEnumResponsiveStyles(styles, \"justify\", justifyContent, state);\n if (justifyResult.className) classes.push(justifyResult.className);\n\n const itemsResult = getEnumResponsiveStyles(styles, \"items\", alignItems, state);\n if (itemsResult.className) classes.push(itemsResult.className);\n\n const selfResult = getEnumResponsiveStyles(styles, \"self\", alignSelf, state);\n if (selfResult.className) classes.push(selfResult.className);\n\n const wrapResult = getEnumResponsiveStyles(styles, \"flex\", flexWrap, state);\n if (wrapResult.className) classes.push(wrapResult.className);\n\n const resolvedGapRow = gapRow ?? gap;\n const resolvedGapCol = gapColumn ?? gap;\n\n const gapRowResult = getResponsiveVarStyles(styles, \"gap-row\", \"gap-row\", resolvedGapRow, state, getRawValue);\n const gapColResult = getResponsiveVarStyles(styles, \"gap-col\", \"gap-col\", resolvedGapCol, state, getRawValue);\n\n if (gapRowResult.className) classes.push(gapRowResult.className);\n if (gapColResult.className) classes.push(gapColResult.className);\n Object.assign(style, gapRowResult.style, gapColResult.style);\n\n if (flex !== undefined) {\n const flexResult = getResponsiveVarStyles(styles, \"flex\", \"flex\", flex, state);\n if (flexResult.className) classes.push(flexResult.className);\n Object.assign(style, flexResult.style);\n } else if (flexGrow !== undefined || flexShrink !== undefined || flexBasis !== undefined) {\n const composedFlex = `${flexGrow ?? 0} ${flexShrink ?? 1} ${flexBasis ?? \"auto\"}`;\n const flexResult = getResponsiveVarStyles(styles, \"flex\", \"flex\", composedFlex, state);\n if (flexResult.className) classes.push(flexResult.className);\n Object.assign(style, flexResult.style);\n }\n\n return {\n className: clsx(...classes),\n style,\n };\n}\n\nexport function getFlexboxStyles(\n props: FlexboxProps & StateProps<FlexboxProps>\n): StyleResult {\n const { _hover, _focus, _active, _disabled, ...baseProps } = props;\n\n const baseStyles = getFlexboxStylesForState(baseProps, \"base\");\n const hoverStyles = getFlexboxStylesForState(_hover, \"hover\");\n const focusStyles = getFlexboxStylesForState(_focus, \"focus\");\n const activeStyles = getFlexboxStylesForState(_active, \"active\");\n const disabledStyles = getFlexboxStylesForState(_disabled, \"disabled\");\n\n return {\n className: clsx(\n baseStyles.className,\n hoverStyles.className,\n focusStyles.className,\n activeStyles.className,\n disabledStyles.className\n ),\n style: { ...baseStyles.style, ...hoverStyles.style, ...focusStyles.style, ...activeStyles.style, ...disabledStyles.style } as Record<string, string>,\n };\n}\n"],"names":[],"mappings":";;;;AAkCA,SAAS,yBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAA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