@pingux/astro 2.35.0 → 2.36.0-alpha.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/lib/cjs/hooks/useColumnStyles/index.d.ts +1 -0
- package/lib/cjs/hooks/useColumnStyles/useColumnStyles.d.ts +11 -0
- package/lib/cjs/hooks/useColumnStyles/useColumnStyles.js +7 -3
- package/lib/cjs/hooks/useField/useField.d.ts +4 -4
- package/lib/cjs/hooks/useSelectField/useSelectField.d.ts +2 -1
- package/lib/hooks/useColumnStyles/useColumnStyles.js +7 -3
- package/package.json +1 -1
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from './useColumnStyles';
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export type LabelMode = 'default' | 'float' | 'left';
|
2
|
+
interface UseColumnStylesProps {
|
3
|
+
labelMode: LabelMode;
|
4
|
+
}
|
5
|
+
interface LabelStyleProps {
|
6
|
+
sx: {
|
7
|
+
gridTemplateColumns: string;
|
8
|
+
};
|
9
|
+
}
|
10
|
+
declare const useColumnStyles: ({ labelMode }: UseColumnStylesProps) => LabelStyleProps;
|
11
|
+
export default useColumnStyles;
|
@@ -10,13 +10,17 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime-corejs3/hel
|
|
10
10
|
var _react = require("react");
|
11
11
|
var useColumnStyles = function useColumnStyles(_ref) {
|
12
12
|
var labelMode = _ref.labelMode;
|
13
|
-
var _useState = (0, _react.useState)(
|
13
|
+
var _useState = (0, _react.useState)({
|
14
|
+
sx: {
|
15
|
+
gridTemplateColumns: ''
|
16
|
+
}
|
17
|
+
}),
|
14
18
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
15
19
|
labelStyleProps = _useState2[0],
|
16
|
-
|
20
|
+
setLabelStyleProps = _useState2[1];
|
17
21
|
(0, _react.useEffect)(function () {
|
18
22
|
if (labelMode === 'left') {
|
19
|
-
|
23
|
+
setLabelStyleProps({
|
20
24
|
sx: {
|
21
25
|
gridTemplateColumns: '40% auto'
|
22
26
|
}
|
@@ -118,6 +118,8 @@ declare const useField: <T>(props: UseFieldProps<T>) => {
|
|
118
118
|
variant?: string | undefined;
|
119
119
|
as?: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | null | undefined;
|
120
120
|
style?: string | import("react").CSSProperties | undefined;
|
121
|
+
float?: import("theme-ui").StylePropertyValue<import("csstype").Property.Float | undefined>;
|
122
|
+
left?: import("theme-ui").StylePropertyValue<import("csstype").Property.Left<string | number> | undefined>;
|
121
123
|
grid?: import("theme-ui").StylePropertyValue<import("csstype").Property.Grid | undefined>;
|
122
124
|
accentColor?: import("theme-ui").StylePropertyValue<import("csstype").Property.AccentColor | undefined>;
|
123
125
|
alignContent?: import("theme-ui").StylePropertyValue<import("csstype").Property.AlignContent | undefined>;
|
@@ -228,7 +230,6 @@ declare const useField: <T>(props: UseFieldProps<T>) => {
|
|
228
230
|
flexGrow?: import("theme-ui").StylePropertyValue<import("csstype").Property.FlexGrow | undefined>;
|
229
231
|
flexShrink?: import("theme-ui").StylePropertyValue<import("csstype").Property.FlexShrink | undefined>;
|
230
232
|
flexWrap?: import("theme-ui").StylePropertyValue<import("csstype").Property.FlexWrap | undefined>;
|
231
|
-
float?: import("theme-ui").StylePropertyValue<import("csstype").Property.Float | undefined>;
|
232
233
|
fontFamily?: import("theme-ui").StylePropertyValue<import("csstype").Property.FontFamily | undefined>;
|
233
234
|
fontFeatureSettings?: import("theme-ui").StylePropertyValue<import("csstype").Property.FontFeatureSettings | undefined>;
|
234
235
|
fontKerning?: import("theme-ui").StylePropertyValue<import("csstype").Property.FontKerning | undefined>;
|
@@ -281,7 +282,6 @@ declare const useField: <T>(props: UseFieldProps<T>) => {
|
|
281
282
|
justifyItems?: import("theme-ui").StylePropertyValue<import("csstype").Property.JustifyItems | undefined>;
|
282
283
|
justifySelf?: import("theme-ui").StylePropertyValue<import("csstype").Property.JustifySelf | undefined>;
|
283
284
|
justifyTracks?: import("theme-ui").StylePropertyValue<import("csstype").Property.JustifyTracks | undefined>;
|
284
|
-
left?: import("theme-ui").StylePropertyValue<import("csstype").Property.Left<string | number> | undefined>;
|
285
285
|
letterSpacing?: import("theme-ui").StylePropertyValue<import("csstype").Property.LetterSpacing<string | number> | undefined>;
|
286
286
|
lineBreak?: import("theme-ui").StylePropertyValue<import("csstype").Property.LineBreak | undefined>;
|
287
287
|
lineHeight?: import("theme-ui").StylePropertyValue<import("csstype").Property.LineHeight<string | number> | undefined>;
|
@@ -1050,7 +1050,7 @@ declare const useField: <T>(props: UseFieldProps<T>) => {
|
|
1050
1050
|
onTransitionEndCapture?: import("react").TransitionEventHandler<import("../../types").FocusableElement> | undefined;
|
1051
1051
|
};
|
1052
1052
|
fieldLabelProps: {
|
1053
|
-
labelMode?: "
|
1053
|
+
labelMode?: "default" | "float" | "left" | undefined;
|
1054
1054
|
statusClasses?: {
|
1055
1055
|
[className: string]: boolean;
|
1056
1056
|
} | undefined;
|
@@ -1365,7 +1365,7 @@ declare const useField: <T>(props: UseFieldProps<T>) => {
|
|
1365
1365
|
isRequired: boolean | undefined;
|
1366
1366
|
mode: string | undefined;
|
1367
1367
|
} | {
|
1368
|
-
labelMode?: "
|
1368
|
+
labelMode?: "default" | "float" | "left" | undefined;
|
1369
1369
|
statusClasses?: {
|
1370
1370
|
[className: string]: boolean;
|
1371
1371
|
} | undefined;
|
@@ -4,6 +4,7 @@ import { SelectState } from 'react-stately';
|
|
4
4
|
import { CollectionChildren } from '@react-types/shared';
|
5
5
|
import { LabelProps as ThemeUILabelProps } from 'theme-ui';
|
6
6
|
import { Axis, BoxProps, FocusableElement, PlacementAxis, ReactRef, StyleProps } from '../../types';
|
7
|
+
import { LabelMode } from '../useColumnStyles/useColumnStyles';
|
7
8
|
import { FieldControlInputProps } from '../useField/useField';
|
8
9
|
interface UseSelectFieldProps<T> {
|
9
10
|
children: CollectionChildren<T>;
|
@@ -34,7 +35,7 @@ interface UseSelectFieldProps<T> {
|
|
34
35
|
listBoxProps?: BoxProps;
|
35
36
|
labelProps?: ThemeUILabelProps;
|
36
37
|
containerProps?: BoxProps;
|
37
|
-
labelMode:
|
38
|
+
labelMode: LabelMode;
|
38
39
|
}
|
39
40
|
interface UseSelectFieldReturnProps {
|
40
41
|
columnStyleProps: StyleProps;
|
@@ -2,13 +2,17 @@ import _slicedToArray from "@babel/runtime-corejs3/helpers/esm/slicedToArray";
|
|
2
2
|
import { useEffect, useState } from 'react';
|
3
3
|
var useColumnStyles = function useColumnStyles(_ref) {
|
4
4
|
var labelMode = _ref.labelMode;
|
5
|
-
var _useState = useState(
|
5
|
+
var _useState = useState({
|
6
|
+
sx: {
|
7
|
+
gridTemplateColumns: ''
|
8
|
+
}
|
9
|
+
}),
|
6
10
|
_useState2 = _slicedToArray(_useState, 2),
|
7
11
|
labelStyleProps = _useState2[0],
|
8
|
-
|
12
|
+
setLabelStyleProps = _useState2[1];
|
9
13
|
useEffect(function () {
|
10
14
|
if (labelMode === 'left') {
|
11
|
-
|
15
|
+
setLabelStyleProps({
|
12
16
|
sx: {
|
13
17
|
gridTemplateColumns: '40% auto'
|
14
18
|
}
|