@scaleflex/ui-tw 0.0.6 → 0.0.8
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/button/button.component.js +3 -7
- package/button/button.constants.d.ts +63 -0
- package/button/button.constants.js +26 -0
- package/button/button.types.d.ts +10 -21
- package/button/button.types.js +1 -19
- package/button/button.utils.js +1 -1
- package/button/components/end-icon.d.ts +3 -6
- package/button/components/end-icon.js +3 -6
- package/button/components/start-icon.d.ts +3 -8
- package/button/components/start-icon.js +3 -7
- package/button/index.d.ts +1 -1
- package/button/index.js +1 -1
- package/form/components/form-field-group.component.d.ts +3 -19
- package/form/components/form-field-group.component.js +1 -3
- package/form/components/form-input-field.component.d.ts +5 -0
- package/form/components/form-input-field.component.js +16 -0
- package/form/components/form-switch-field.component.d.ts +5 -0
- package/form/components/form-switch-field.component.js +64 -0
- package/form/form.component.js +1 -2
- package/form/form.constants.d.ts +24 -0
- package/form/form.constants.js +14 -0
- package/form/form.types.d.ts +40 -6
- package/form/form.types.js +1 -5
- package/form/index.d.ts +2 -0
- package/form/index.js +3 -1
- package/input/index.d.ts +1 -1
- package/input/index.js +1 -1
- package/input/input.component.d.ts +1 -1
- package/input/input.component.js +3 -5
- package/input/input.constants.d.ts +10 -0
- package/input/input.constants.js +8 -0
- package/input/input.types.d.ts +2 -13
- package/input/input.types.js +1 -10
- package/label/components/info-outline-icon.d.ts +2 -2
- package/label/components/info-outline-icon.js +2 -2
- package/label/components/label-icon.d.ts +2 -5
- package/label/components/label-icon.js +2 -4
- package/label/label.component.js +4 -7
- package/label/label.constants.d.ts +10 -0
- package/label/label.constants.js +4 -0
- package/label/label.types.d.ts +5 -8
- package/label/label.types.js +1 -5
- package/label/label.utils.d.ts +2 -2
- package/label/label.utils.js +4 -4
- package/package.json +3 -2
- package/switch/index.d.ts +1 -0
- package/switch/index.js +1 -0
- package/switch/switch.component.d.ts +4 -0
- package/switch/switch.component.js +43 -0
- package/switch/switch.constants.d.ts +10 -0
- package/switch/switch.constants.js +4 -0
- package/switch/switch.types.d.ts +6 -0
- package/switch/switch.types.js +1 -0
- package/types/form-size.d.ts +7 -0
- package/types/form-size.js +5 -0
- package/types/values.d.ts +1 -1
- package/types/values.js +1 -0
- package/button/button.const.d.ts +0 -13
- package/button/button.const.js +0 -4
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
var _excluded = ["className", "children", "size", "startIcon", "endIcon", "variant", "loading", "asChild", "disabled"];
|
|
5
|
-
var _buttonVariantOptions;
|
|
6
4
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
5
|
import SpinnerIcon from '@scaleflex/icons-tw/spinner';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import { ButtonSize, ButtonVariant, buttonSizeOptions, buttonVariantOptions } from '@scaleflex/ui-tw/button/button.constants';
|
|
7
|
+
import { EndIcon } from '@scaleflex/ui-tw/button/components/end-icon';
|
|
8
|
+
import { StartIcon, startIconVariants } from '@scaleflex/ui-tw/button/components/start-icon';
|
|
10
9
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
11
10
|
import { cva } from 'class-variance-authority';
|
|
12
11
|
import React from 'react';
|
|
13
|
-
import { ButtonSize, ButtonVariant } from './button.types';
|
|
14
12
|
import { getIconSizeInRem } from './button.utils';
|
|
15
|
-
var buttonVariantOptions = (_buttonVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_buttonVariantOptions, ButtonVariant.Primary, 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/80'), ButtonVariant.Secondary, 'border bg-background shadow-xs text-primary border-primary hover:bg-accent hover:border-primary/80'), ButtonVariant.Outline, 'border bg-background text-secondary-foreground shadow-xs border-input hover:bg-secondary hover:border-input/80'), ButtonVariant.LinkPrimary, 'text-primary hover:text-primary/80'), ButtonVariant.LinkSecondary, 'text-secondary-foreground hover:text-secondary-foreground/80'), ButtonVariant.LinkBasicPrimary, 'text-primary font-normal hover:text-primary/80'), ButtonVariant.LinkBasicSecondary, 'text-secondary-foreground font-normal hover:text-secondary-foreground/80'), ButtonVariant.LinkError, 'text-destructive hover:text-destructive/80'), ButtonVariant.LinkWarning, 'text-warning hover:text-warning/80'), ButtonVariant.Error, 'bg-destructive text-primary-foreground shadow-xs hover:bg-destructive/80'), _defineProperty(_buttonVariantOptions, ButtonVariant.Warning, 'bg-warning text-primary-foreground shadow-xs hover:bg-warning/80'));
|
|
16
|
-
var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-xs'), ButtonSize.Sm, 'h-8 px-3 py-2 text-sm'), ButtonSize.Md, 'h-10 px-4 py-2.5 text-base'), ButtonSize.Lg, 'h-12 px-6 py-3.5 text-lg');
|
|
17
13
|
var buttonVariants = cva('', {
|
|
18
14
|
variants: {
|
|
19
15
|
variant: buttonVariantOptions,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export declare const ButtonSize: {
|
|
2
|
+
readonly Xs: "xs";
|
|
3
|
+
readonly Sm: "sm";
|
|
4
|
+
readonly Md: "md";
|
|
5
|
+
readonly Lg: "lg";
|
|
6
|
+
};
|
|
7
|
+
export declare const buttonSizeOptions: {
|
|
8
|
+
readonly xs: "h-6 px-2.5 py-1.5 text-xs";
|
|
9
|
+
readonly sm: "h-8 px-3 py-2 text-sm";
|
|
10
|
+
readonly md: "h-10 px-4 py-2.5 text-base";
|
|
11
|
+
readonly lg: "h-12 px-6 py-3.5 text-lg";
|
|
12
|
+
};
|
|
13
|
+
export declare const buttonEndIconSizes: {
|
|
14
|
+
readonly xs: "ml-1.5";
|
|
15
|
+
readonly sm: "ml-1.5";
|
|
16
|
+
readonly md: "ml-2";
|
|
17
|
+
readonly lg: "ml-2";
|
|
18
|
+
};
|
|
19
|
+
export declare const buttonStartIconSizes: {
|
|
20
|
+
readonly xs: "mr-1.5";
|
|
21
|
+
readonly sm: "mr-1.5";
|
|
22
|
+
readonly md: "mr-2";
|
|
23
|
+
readonly lg: "mr-2";
|
|
24
|
+
};
|
|
25
|
+
export declare const ButtonVariant: {
|
|
26
|
+
readonly Primary: "primary";
|
|
27
|
+
readonly Secondary: "secondary";
|
|
28
|
+
readonly Outline: "outline";
|
|
29
|
+
readonly LinkPrimary: "link-primary";
|
|
30
|
+
readonly LinkSecondary: "link-secondary";
|
|
31
|
+
readonly LinkBasicPrimary: "link-basic-primary";
|
|
32
|
+
readonly LinkBasicSecondary: "link-basic-secondary";
|
|
33
|
+
readonly LinkError: "link-error";
|
|
34
|
+
readonly LinkWarning: "link-warning";
|
|
35
|
+
readonly Error: "error-primary";
|
|
36
|
+
readonly Warning: "warning-primary";
|
|
37
|
+
};
|
|
38
|
+
export declare const iconVariantOptions: {
|
|
39
|
+
readonly primary: "";
|
|
40
|
+
readonly secondary: "";
|
|
41
|
+
readonly outline: "text-muted-foreground group-hover/button:text-muted-foreground/80";
|
|
42
|
+
readonly "link-primary": "";
|
|
43
|
+
readonly "link-secondary": "text-muted-foreground group-hover/button:text-muted-foreground/80";
|
|
44
|
+
readonly "link-basic-primary": "";
|
|
45
|
+
readonly "link-basic-secondary": "text-muted-foreground group-hover/button:text-muted-foreground/80";
|
|
46
|
+
readonly "link-error": "";
|
|
47
|
+
readonly "link-warning": "";
|
|
48
|
+
readonly "error-primary": "";
|
|
49
|
+
readonly "warning-primary": "";
|
|
50
|
+
};
|
|
51
|
+
export declare const buttonVariantOptions: {
|
|
52
|
+
readonly primary: "bg-primary text-primary-foreground shadow-xs hover:bg-primary/80";
|
|
53
|
+
readonly secondary: "border bg-background shadow-xs text-primary border-primary hover:bg-accent hover:border-primary/80";
|
|
54
|
+
readonly outline: "border bg-background text-secondary-foreground shadow-xs border-input hover:bg-secondary hover:border-input/80";
|
|
55
|
+
readonly "link-primary": "text-primary hover:text-primary/80";
|
|
56
|
+
readonly "link-secondary": "text-secondary-foreground hover:text-secondary-foreground/80";
|
|
57
|
+
readonly "link-basic-primary": "text-primary font-normal hover:text-primary/80";
|
|
58
|
+
readonly "link-basic-secondary": "text-secondary-foreground font-normal hover:text-secondary-foreground/80";
|
|
59
|
+
readonly "link-error": "text-destructive hover:text-destructive/80";
|
|
60
|
+
readonly "link-warning": "text-warning hover:text-warning/80";
|
|
61
|
+
readonly "error-primary": "bg-destructive text-primary-foreground shadow-xs hover:bg-destructive/80";
|
|
62
|
+
readonly "warning-primary": "bg-warning text-primary-foreground shadow-xs hover:bg-warning/80";
|
|
63
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
var _iconVariantOptions, _buttonVariantOptions;
|
|
3
|
+
export var ButtonSize = {
|
|
4
|
+
Xs: 'xs',
|
|
5
|
+
Sm: 'sm',
|
|
6
|
+
Md: 'md',
|
|
7
|
+
Lg: 'lg'
|
|
8
|
+
};
|
|
9
|
+
export var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-xs'), ButtonSize.Sm, 'h-8 px-3 py-2 text-sm'), ButtonSize.Md, 'h-10 px-4 py-2.5 text-base'), ButtonSize.Lg, 'h-12 px-6 py-3.5 text-lg');
|
|
10
|
+
export var buttonEndIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'ml-1.5'), ButtonSize.Sm, 'ml-1.5'), ButtonSize.Md, 'ml-2'), ButtonSize.Lg, 'ml-2');
|
|
11
|
+
export var buttonStartIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'mr-1.5'), ButtonSize.Sm, 'mr-1.5'), ButtonSize.Md, 'mr-2'), ButtonSize.Lg, 'mr-2');
|
|
12
|
+
export var ButtonVariant = {
|
|
13
|
+
Primary: 'primary',
|
|
14
|
+
Secondary: 'secondary',
|
|
15
|
+
Outline: 'outline',
|
|
16
|
+
LinkPrimary: 'link-primary',
|
|
17
|
+
LinkSecondary: 'link-secondary',
|
|
18
|
+
LinkBasicPrimary: 'link-basic-primary',
|
|
19
|
+
LinkBasicSecondary: 'link-basic-secondary',
|
|
20
|
+
LinkError: 'link-error',
|
|
21
|
+
LinkWarning: 'link-warning',
|
|
22
|
+
Error: 'error-primary',
|
|
23
|
+
Warning: 'warning-primary'
|
|
24
|
+
};
|
|
25
|
+
export var iconVariantOptions = (_iconVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_iconVariantOptions, ButtonVariant.Primary, ''), ButtonVariant.Secondary, ''), ButtonVariant.Outline, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkPrimary, ''), ButtonVariant.LinkSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkBasicPrimary, ''), ButtonVariant.LinkBasicSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkError, ''), ButtonVariant.LinkWarning, ''), ButtonVariant.Error, ''), _defineProperty(_iconVariantOptions, ButtonVariant.Warning, ''));
|
|
26
|
+
export var buttonVariantOptions = (_buttonVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_buttonVariantOptions, ButtonVariant.Primary, 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/80'), ButtonVariant.Secondary, 'border bg-background shadow-xs text-primary border-primary hover:bg-accent hover:border-primary/80'), ButtonVariant.Outline, 'border bg-background text-secondary-foreground shadow-xs border-input hover:bg-secondary hover:border-input/80'), ButtonVariant.LinkPrimary, 'text-primary hover:text-primary/80'), ButtonVariant.LinkSecondary, 'text-secondary-foreground hover:text-secondary-foreground/80'), ButtonVariant.LinkBasicPrimary, 'text-primary font-normal hover:text-primary/80'), ButtonVariant.LinkBasicSecondary, 'text-secondary-foreground font-normal hover:text-secondary-foreground/80'), ButtonVariant.LinkError, 'text-destructive hover:text-destructive/80'), ButtonVariant.LinkWarning, 'text-warning hover:text-warning/80'), ButtonVariant.Error, 'bg-destructive text-primary-foreground shadow-xs hover:bg-destructive/80'), _defineProperty(_buttonVariantOptions, ButtonVariant.Warning, 'bg-warning text-primary-foreground shadow-xs hover:bg-warning/80'));
|
package/button/button.types.d.ts
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import { buttonVariants } from '@scaleflex/ui-tw/button/button.component';
|
|
2
|
+
import { ButtonSize, ButtonVariant } from '@scaleflex/ui-tw/button/button.constants';
|
|
2
3
|
import type { VariantProps } from 'class-variance-authority';
|
|
3
4
|
import { ComponentProps, ReactElement } from 'react';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
readonly Secondary: "secondary";
|
|
7
|
-
readonly Outline: "outline";
|
|
8
|
-
readonly LinkPrimary: "link-primary";
|
|
9
|
-
readonly LinkSecondary: "link-secondary";
|
|
10
|
-
readonly LinkBasicPrimary: "link-basic-primary";
|
|
11
|
-
readonly LinkBasicSecondary: "link-basic-secondary";
|
|
12
|
-
readonly LinkError: "link-error";
|
|
13
|
-
readonly LinkWarning: "link-warning";
|
|
14
|
-
readonly Error: "error-primary";
|
|
15
|
-
readonly Warning: "warning-primary";
|
|
16
|
-
};
|
|
5
|
+
export type ButtonSizeType = (typeof ButtonSize)[keyof typeof ButtonSize];
|
|
6
|
+
export type ButtonVariantType = (typeof ButtonVariant)[keyof typeof ButtonVariant];
|
|
17
7
|
export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
18
8
|
asChild?: boolean;
|
|
19
9
|
startIcon?: ReactElement;
|
|
@@ -21,11 +11,10 @@ export interface ButtonProps extends ComponentProps<'button'>, VariantProps<type
|
|
|
21
11
|
loading?: boolean;
|
|
22
12
|
disabled?: boolean;
|
|
23
13
|
}
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export type ButtonVariantType = (typeof ButtonVariant)[keyof typeof ButtonVariant];
|
|
14
|
+
export interface EndIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
15
|
+
icon?: ReactElement;
|
|
16
|
+
}
|
|
17
|
+
export interface StartIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
18
|
+
icon?: ReactElement;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
}
|
package/button/button.types.js
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
Primary: 'primary',
|
|
3
|
-
Secondary: 'secondary',
|
|
4
|
-
Outline: 'outline',
|
|
5
|
-
LinkPrimary: 'link-primary',
|
|
6
|
-
LinkSecondary: 'link-secondary',
|
|
7
|
-
LinkBasicPrimary: 'link-basic-primary',
|
|
8
|
-
LinkBasicSecondary: 'link-basic-secondary',
|
|
9
|
-
LinkError: 'link-error',
|
|
10
|
-
LinkWarning: 'link-warning',
|
|
11
|
-
Error: 'error-primary',
|
|
12
|
-
Warning: 'warning-primary'
|
|
13
|
-
};
|
|
14
|
-
export var ButtonSize = {
|
|
15
|
-
Xs: 'xs',
|
|
16
|
-
Sm: 'sm',
|
|
17
|
-
Md: 'md',
|
|
18
|
-
Lg: 'lg'
|
|
19
|
-
};
|
|
1
|
+
export {};
|
package/button/button.utils.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React
|
|
3
|
-
interface EndIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
4
|
-
icon?: ReactElement;
|
|
5
|
-
}
|
|
1
|
+
import { EndIconProps } from '@scaleflex/ui-tw/button/button.types';
|
|
2
|
+
import React from 'react';
|
|
6
3
|
declare const EndIcon: (props: EndIconProps) => React.JSX.Element | null;
|
|
7
|
-
export
|
|
4
|
+
export { EndIcon };
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
var _excluded = ["size", "icon", "variant"];
|
|
5
|
-
import {
|
|
6
|
-
import { iconVariantOptions } from '@scaleflex/ui-tw/button/button.const';
|
|
4
|
+
import { buttonEndIconSizes, iconVariantOptions } from '@scaleflex/ui-tw/button/button.constants';
|
|
7
5
|
import { getIconSizeInRem } from '@scaleflex/ui-tw/button/button.utils';
|
|
8
6
|
import { cva } from 'class-variance-authority';
|
|
9
7
|
import React, { cloneElement, useMemo } from 'react';
|
|
10
|
-
var endIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'ml-1.5'), ButtonSize.Sm, 'ml-1.5'), ButtonSize.Md, 'ml-2'), ButtonSize.Lg, 'ml-2');
|
|
11
8
|
var endIconVariants = cva('', {
|
|
12
9
|
variants: {
|
|
13
10
|
variant: iconVariantOptions,
|
|
14
|
-
size:
|
|
11
|
+
size: buttonEndIconSizes
|
|
15
12
|
}
|
|
16
13
|
});
|
|
17
14
|
var EndIcon = function EndIcon(props) {
|
|
@@ -36,4 +33,4 @@ var EndIcon = function EndIcon(props) {
|
|
|
36
33
|
}
|
|
37
34
|
}));
|
|
38
35
|
};
|
|
39
|
-
export
|
|
36
|
+
export { EndIcon };
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React
|
|
1
|
+
import { StartIconProps } from '@scaleflex/ui-tw/button/button.types';
|
|
2
|
+
import React from 'react';
|
|
3
3
|
declare const startIconVariants: (props?: ({
|
|
4
4
|
variant?: "primary" | "secondary" | "outline" | "link-primary" | "link-secondary" | "link-basic-primary" | "link-basic-secondary" | "link-error" | "link-warning" | "error-primary" | "warning-primary" | null | undefined;
|
|
5
5
|
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
|
-
interface StartIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
8
|
-
icon?: ReactElement;
|
|
9
|
-
loading?: boolean;
|
|
10
|
-
}
|
|
11
7
|
declare const StartIcon: (props: StartIconProps) => React.JSX.Element | null;
|
|
12
|
-
export { startIconVariants };
|
|
13
|
-
export default StartIcon;
|
|
8
|
+
export { StartIcon, startIconVariants };
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
var _excluded = ["size", "variant", "icon", "loading"];
|
|
5
4
|
import SpinnerIcon from '@scaleflex/icons-tw/spinner';
|
|
6
|
-
import {
|
|
7
|
-
import { iconVariantOptions } from '@scaleflex/ui-tw/button/button.const';
|
|
5
|
+
import { buttonStartIconSizes, iconVariantOptions } from '@scaleflex/ui-tw/button/button.constants';
|
|
8
6
|
import { getIconSizeInRem } from '@scaleflex/ui-tw/button/button.utils';
|
|
9
7
|
import { cva } from 'class-variance-authority';
|
|
10
8
|
import React, { cloneElement, useMemo } from 'react';
|
|
11
|
-
var startIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'mr-1.5'), ButtonSize.Sm, 'mr-1.5'), ButtonSize.Md, 'mr-2'), ButtonSize.Lg, 'mr-2');
|
|
12
9
|
var startIconVariants = cva('', {
|
|
13
10
|
variants: {
|
|
14
11
|
variant: iconVariantOptions,
|
|
15
|
-
size:
|
|
12
|
+
size: buttonStartIconSizes
|
|
16
13
|
}
|
|
17
14
|
});
|
|
18
15
|
var StartIcon = function StartIcon(props) {
|
|
@@ -49,5 +46,4 @@ var StartIcon = function StartIcon(props) {
|
|
|
49
46
|
})
|
|
50
47
|
})));
|
|
51
48
|
};
|
|
52
|
-
export { startIconVariants };
|
|
53
|
-
export default StartIcon;
|
|
49
|
+
export { StartIcon, startIconVariants };
|
package/button/index.d.ts
CHANGED
package/button/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Button, buttonVariants } from './button.component';
|
|
2
|
-
export { ButtonVariant, ButtonSize } from './button.
|
|
2
|
+
export { ButtonVariant, ButtonSize } from './button.constants';
|
|
@@ -1,21 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React
|
|
3
|
-
import {
|
|
4
|
-
export interface FormFieldArgs {
|
|
5
|
-
size?: InputSizeType;
|
|
6
|
-
readOnly?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
}
|
|
9
|
-
export interface FormFieldGroupProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> extends UseControllerProps<TFieldValues, TName> {
|
|
10
|
-
label?: string;
|
|
11
|
-
description?: string;
|
|
12
|
-
tooltip?: string;
|
|
13
|
-
size?: InputSizeType;
|
|
14
|
-
readOnly?: boolean;
|
|
15
|
-
highlight?: boolean;
|
|
16
|
-
horizontal?: boolean;
|
|
17
|
-
horizontalLabelWidth?: string;
|
|
18
|
-
children: (field: ControllerRenderProps<TFieldValues, TName>, args?: FormFieldArgs) => ReactNode;
|
|
19
|
-
}
|
|
1
|
+
import { FormFieldGroupProps } from '@scaleflex/ui-tw/form/form.types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FieldValues, Path } from 'react-hook-form';
|
|
20
4
|
declare function FormFieldGroup<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>({ control, name, label, description, size, readOnly, disabled, tooltip, highlight, horizontal, horizontalLabelWidth, children, }: FormFieldGroupProps<TFieldValues, TName>): React.JSX.Element;
|
|
21
5
|
export { FormFieldGroup };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
1
|
import { FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from '@scaleflex/ui-tw/form';
|
|
3
|
-
import {
|
|
2
|
+
import { labelHeightVariants } from '@scaleflex/ui-tw/form/form.constants';
|
|
4
3
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
5
4
|
import React from 'react';
|
|
6
|
-
var labelHeightVariants = _defineProperty(_defineProperty(_defineProperty({}, InputSize.Sm, 'h-8'), InputSize.Md, 'h-10'), InputSize.Lg, 'h-12');
|
|
7
5
|
function FormFieldGroup(_ref) {
|
|
8
6
|
var control = _ref.control,
|
|
9
7
|
name = _ref.name,
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FormInputFieldProps } from '@scaleflex/ui-tw/form/form.types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FieldValues, Path } from 'react-hook-form';
|
|
4
|
+
declare function FormInputField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>({ inputProps, ...rest }: FormInputFieldProps<TFieldValues, TName>): React.JSX.Element;
|
|
5
|
+
export { FormInputField };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["inputProps"];
|
|
4
|
+
import { FormFieldGroup } from '@scaleflex/ui-tw/form';
|
|
5
|
+
import { Input } from '@scaleflex/ui-tw/input';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
function FormInputField(_ref) {
|
|
8
|
+
var inputProps = _ref.inputProps,
|
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
10
|
+
return /*#__PURE__*/React.createElement(FormFieldGroup, rest, function (field, args) {
|
|
11
|
+
return /*#__PURE__*/React.createElement(Input, _extends({
|
|
12
|
+
placeholder: inputProps === null || inputProps === void 0 ? void 0 : inputProps.placeholder
|
|
13
|
+
}, args, inputProps, field));
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { FormInputField };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FormSwitchFieldProps } from '@scaleflex/ui-tw/form/form.types';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { FieldValues, Path } from 'react-hook-form';
|
|
4
|
+
declare function FormSwitchField<TFieldValues extends FieldValues, TName extends Path<TFieldValues>>({ control, name, label, description, disabled, tooltip, size, layout, }: FormSwitchFieldProps<TFieldValues, TName>): React.JSX.Element;
|
|
5
|
+
export { FormSwitchField };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FormControl, FormDescription, FormField, FormItem, FormMessage } from '@scaleflex/ui-tw/form';
|
|
2
|
+
import { SwitchLayout, formSwitchFieldSizeOptions } from '@scaleflex/ui-tw/form/form.constants';
|
|
3
|
+
import { Label } from '@scaleflex/ui-tw/label';
|
|
4
|
+
import { Switch } from '@scaleflex/ui-tw/switch';
|
|
5
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
6
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
var formSwitchFieldVariants = cva('', {
|
|
10
|
+
variants: {
|
|
11
|
+
size: formSwitchFieldSizeOptions
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
size: FormSize.Md
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
function FormSwitchField(_ref) {
|
|
18
|
+
var control = _ref.control,
|
|
19
|
+
name = _ref.name,
|
|
20
|
+
label = _ref.label,
|
|
21
|
+
description = _ref.description,
|
|
22
|
+
disabled = _ref.disabled,
|
|
23
|
+
tooltip = _ref.tooltip,
|
|
24
|
+
_ref$size = _ref.size,
|
|
25
|
+
size = _ref$size === void 0 ? FormSize.Md : _ref$size,
|
|
26
|
+
_ref$layout = _ref.layout,
|
|
27
|
+
layout = _ref$layout === void 0 ? SwitchLayout.Inline : _ref$layout;
|
|
28
|
+
var isInlineLayout = layout === SwitchLayout.Inline;
|
|
29
|
+
return /*#__PURE__*/React.createElement(FormField, {
|
|
30
|
+
control: control,
|
|
31
|
+
name: name,
|
|
32
|
+
render: function render(_ref2) {
|
|
33
|
+
var field = _ref2.field;
|
|
34
|
+
return /*#__PURE__*/React.createElement(FormItem, null, /*#__PURE__*/React.createElement("div", {
|
|
35
|
+
className: cn('flex items-center', isInlineLayout ? formSwitchFieldVariants({
|
|
36
|
+
size: size
|
|
37
|
+
}) : 'w-full justify-between gap-2')
|
|
38
|
+
}, isInlineLayout ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FormControl, null, /*#__PURE__*/React.createElement(Switch, {
|
|
39
|
+
id: field.name,
|
|
40
|
+
checked: field.value,
|
|
41
|
+
onCheckedChange: field.onChange,
|
|
42
|
+
disabled: disabled,
|
|
43
|
+
size: size
|
|
44
|
+
})), /*#__PURE__*/React.createElement(Label, {
|
|
45
|
+
htmlFor: field.name,
|
|
46
|
+
tooltip: tooltip,
|
|
47
|
+
size: size
|
|
48
|
+
}, label)) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Label, {
|
|
49
|
+
htmlFor: field.name,
|
|
50
|
+
tooltip: tooltip,
|
|
51
|
+
size: size
|
|
52
|
+
}, label), /*#__PURE__*/React.createElement(FormControl, null, /*#__PURE__*/React.createElement(Switch, {
|
|
53
|
+
id: field.name,
|
|
54
|
+
checked: field.value,
|
|
55
|
+
onCheckedChange: field.onChange,
|
|
56
|
+
disabled: disabled,
|
|
57
|
+
size: size
|
|
58
|
+
})))), description && /*#__PURE__*/React.createElement(FormDescription, {
|
|
59
|
+
size: size
|
|
60
|
+
}, description), /*#__PURE__*/React.createElement(FormMessage, null));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
export { FormSwitchField };
|
package/form/form.component.js
CHANGED
|
@@ -9,7 +9,7 @@ var _excluded = ["className", "horizontal", "firstColumnWidth"],
|
|
|
9
9
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
10
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
11
|
import { Slot } from '@radix-ui/react-slot';
|
|
12
|
-
import { FormMessageSize } from '@scaleflex/ui-tw/form/form.
|
|
12
|
+
import { FormMessageSize, formMessageSizeOptions } from '@scaleflex/ui-tw/form/form.constants';
|
|
13
13
|
import { Label } from '@scaleflex/ui-tw/label';
|
|
14
14
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
15
15
|
import * as React from 'react';
|
|
@@ -93,7 +93,6 @@ function FormControl(_ref4) {
|
|
|
93
93
|
"aria-invalid": !!error
|
|
94
94
|
}, props));
|
|
95
95
|
}
|
|
96
|
-
var formMessageSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormMessageSize.Sm, 'text-xs'), FormMessageSize.Md, 'text-xs'), FormMessageSize.Lg, 'text-sm');
|
|
97
96
|
function FormDescription(_ref5) {
|
|
98
97
|
var className = _ref5.className,
|
|
99
98
|
_ref5$size = _ref5.size,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const FormMessageSize: {
|
|
2
|
+
readonly Sm: "sm";
|
|
3
|
+
readonly Md: "md";
|
|
4
|
+
readonly Lg: "lg";
|
|
5
|
+
};
|
|
6
|
+
export declare const labelHeightVariants: {
|
|
7
|
+
readonly sm: "h-8";
|
|
8
|
+
readonly md: "h-10";
|
|
9
|
+
readonly lg: "h-12";
|
|
10
|
+
};
|
|
11
|
+
export declare const SwitchLayout: {
|
|
12
|
+
readonly Inline: "inline";
|
|
13
|
+
readonly Justified: "justified";
|
|
14
|
+
};
|
|
15
|
+
export declare const formMessageSizeOptions: {
|
|
16
|
+
readonly sm: "text-xs";
|
|
17
|
+
readonly md: "text-xs";
|
|
18
|
+
readonly lg: "text-sm";
|
|
19
|
+
};
|
|
20
|
+
export declare const formSwitchFieldSizeOptions: {
|
|
21
|
+
readonly sm: "space-x-2";
|
|
22
|
+
readonly md: "space-x-2.5";
|
|
23
|
+
readonly lg: "space-x-3";
|
|
24
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
3
|
+
export var FormMessageSize = {
|
|
4
|
+
Sm: 'sm',
|
|
5
|
+
Md: 'md',
|
|
6
|
+
Lg: 'lg'
|
|
7
|
+
};
|
|
8
|
+
export var labelHeightVariants = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'h-8'), FormSize.Md, 'h-10'), FormSize.Lg, 'h-12');
|
|
9
|
+
export var SwitchLayout = {
|
|
10
|
+
Inline: 'inline',
|
|
11
|
+
Justified: 'justified'
|
|
12
|
+
};
|
|
13
|
+
export var formMessageSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormMessageSize.Sm, 'text-xs'), FormMessageSize.Md, 'text-xs'), FormMessageSize.Lg, 'text-sm');
|
|
14
|
+
export var formSwitchFieldSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormMessageSize.Sm, 'space-x-2'), FormMessageSize.Md, 'space-x-2.5'), FormMessageSize.Lg, 'space-x-3');
|
package/form/form.types.d.ts
CHANGED
|
@@ -1,7 +1,41 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
1
|
+
import { FormMessageSize, SwitchLayout } from '@scaleflex/ui-tw/form/form.constants';
|
|
2
|
+
import { InputProps } from '@scaleflex/ui-tw/input';
|
|
3
|
+
import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
|
|
4
|
+
import type { Values } from '@scaleflex/ui-tw/types/values';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
import { ControllerRenderProps, type FieldPath, FieldValues, Path, UseControllerProps } from 'react-hook-form';
|
|
7
7
|
export type FormMessageSizeType = Values<typeof FormMessageSize>;
|
|
8
|
+
export type SwitchLayoutType = Values<typeof SwitchLayout>;
|
|
9
|
+
export type FormItemContextValue = {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
export type FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
13
|
+
name: TName;
|
|
14
|
+
};
|
|
15
|
+
export interface FormFieldArgs {
|
|
16
|
+
size?: FormSizeType;
|
|
17
|
+
readOnly?: boolean;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface FormFieldGroupProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> extends UseControllerProps<TFieldValues, TName> {
|
|
21
|
+
label?: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
tooltip?: string;
|
|
24
|
+
size?: FormSizeType;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
highlight?: boolean;
|
|
27
|
+
horizontal?: boolean;
|
|
28
|
+
horizontalLabelWidth?: string;
|
|
29
|
+
children: (field: ControllerRenderProps<TFieldValues, TName>, args?: FormFieldArgs) => ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export interface FormSwitchFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> extends UseControllerProps<TFieldValues, TName> {
|
|
32
|
+
label: string;
|
|
33
|
+
size?: FormSizeType;
|
|
34
|
+
description?: string;
|
|
35
|
+
disabled?: boolean;
|
|
36
|
+
layout?: SwitchLayoutType;
|
|
37
|
+
tooltip?: string;
|
|
38
|
+
}
|
|
39
|
+
export type FormInputFieldProps<TFieldValues extends FieldValues, TName extends Path<TFieldValues>> = Omit<FormFieldGroupProps<TFieldValues, TName>, 'children'> & {
|
|
40
|
+
inputProps?: InputProps;
|
|
41
|
+
};
|
package/form/form.types.js
CHANGED
package/form/index.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, useFormField, } from './form.component';
|
|
2
2
|
export { FormFieldGroup } from './components/form-field-group.component';
|
|
3
|
+
export { FormSwitchField } from './components/form-switch-field.component';
|
|
4
|
+
export { FormInputField } from './components/form-input-field.component';
|
package/form/index.js
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField, useFormField } from './form.component';
|
|
2
|
-
export { FormFieldGroup } from './components/form-field-group.component';
|
|
2
|
+
export { FormFieldGroup } from './components/form-field-group.component';
|
|
3
|
+
export { FormSwitchField } from './components/form-switch-field.component';
|
|
4
|
+
export { FormInputField } from './components/form-input-field.component';
|
package/input/index.d.ts
CHANGED
package/input/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Input, inputVariants } from './input.component';
|
|
2
|
-
export { InputType
|
|
2
|
+
export { InputType } from './input.constants';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { InputProps } from '@scaleflex/ui-tw/input/input.types';
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { InputProps } from './input.types';
|
|
3
3
|
declare const inputVariants: (props?: ({
|
|
4
4
|
size?: "sm" | "md" | "lg" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
package/input/input.component.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
var _excluded = ["className", "type", "size", "disabled", "readOnly"];
|
|
5
4
|
import { ButtonSize } from '@scaleflex/ui-tw/button';
|
|
5
|
+
import { InputType, inputSizeOptions } from '@scaleflex/ui-tw/input/input.constants';
|
|
6
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
6
7
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
7
8
|
import { cva } from 'class-variance-authority';
|
|
8
9
|
import React from 'react';
|
|
9
|
-
import { InputType } from './input.types';
|
|
10
|
-
import { InputSize } from './input.types';
|
|
11
|
-
var inputSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, InputSize.Sm, 'py-2 px-3 text-sm h-8'), InputSize.Md, 'py-3 px-4 h-10 text-base '), InputSize.Lg, 'py-3 px-4 h-12 text-lg ');
|
|
12
10
|
var inputVariants = cva('', {
|
|
13
11
|
variants: {
|
|
14
12
|
size: inputSizeOptions
|
|
@@ -22,7 +20,7 @@ function Input(_ref) {
|
|
|
22
20
|
_ref$type = _ref.type,
|
|
23
21
|
type = _ref$type === void 0 ? InputType.Text : _ref$type,
|
|
24
22
|
_ref$size = _ref.size,
|
|
25
|
-
size = _ref$size === void 0 ?
|
|
23
|
+
size = _ref$size === void 0 ? FormSize.Md : _ref$size,
|
|
26
24
|
_ref$disabled = _ref.disabled,
|
|
27
25
|
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
28
26
|
_ref$readOnly = _ref.readOnly,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const inputSizeOptions: {
|
|
2
|
+
readonly sm: "py-2 px-3 text-sm h-8";
|
|
3
|
+
readonly md: "py-3 px-4 h-10 text-base ";
|
|
4
|
+
readonly lg: "py-3 px-4 h-12 text-lg ";
|
|
5
|
+
};
|
|
6
|
+
export declare const InputType: {
|
|
7
|
+
readonly Text: "text";
|
|
8
|
+
readonly Email: "email";
|
|
9
|
+
readonly Number: "number";
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
3
|
+
export var inputSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'py-2 px-3 text-sm h-8'), FormSize.Md, 'py-3 px-4 h-10 text-base '), FormSize.Lg, 'py-3 px-4 h-12 text-lg ');
|
|
4
|
+
export var InputType = {
|
|
5
|
+
Text: 'text',
|
|
6
|
+
Email: 'email',
|
|
7
|
+
Number: 'number'
|
|
8
|
+
};
|
package/input/input.types.d.ts
CHANGED
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
|
|
2
2
|
import { ComponentProps } from 'react';
|
|
3
3
|
export interface InputProps extends Omit<ComponentProps<'input'>, 'size'> {
|
|
4
|
-
size?:
|
|
4
|
+
size?: FormSizeType;
|
|
5
5
|
'aria-invalid'?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare const InputType: {
|
|
8
|
-
readonly Text: "text";
|
|
9
|
-
readonly Email: "email";
|
|
10
|
-
readonly Number: "number";
|
|
11
|
-
};
|
|
12
|
-
export declare const InputSize: {
|
|
13
|
-
readonly Sm: "sm";
|
|
14
|
-
readonly Md: "md";
|
|
15
|
-
readonly Lg: "lg";
|
|
16
|
-
};
|
|
17
|
-
export type InputSizeType = Values<typeof InputSize>;
|
package/input/input.types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
declare const InfoOutlineIcon: ({ color, size, ref, ...rest }: IconProps) => JSX.Element;
|
|
3
|
+
export { InfoOutlineIcon };
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["color", "size", "ref"];
|
|
4
4
|
import React from 'react';
|
|
5
|
-
|
|
5
|
+
var InfoOutlineIcon = function InfoOutlineIcon(_ref) {
|
|
6
6
|
var _ref$color = _ref.color,
|
|
7
7
|
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
8
8
|
_ref$size = _ref.size,
|
|
@@ -27,4 +27,4 @@ export var InfoOutlineIcon = function InfoOutlineIcon(_ref) {
|
|
|
27
27
|
fill: color
|
|
28
28
|
}));
|
|
29
29
|
};
|
|
30
|
-
export
|
|
30
|
+
export { InfoOutlineIcon };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React
|
|
3
|
-
interface LabelIconProps extends ComponentProps<'span'>, Pick<LabelProps, 'size' | 'tooltip'> {
|
|
4
|
-
icon?: ReactElement;
|
|
5
|
-
}
|
|
1
|
+
import { LabelIconProps } from '@scaleflex/ui-tw/label/label.types';
|
|
2
|
+
import React from 'react';
|
|
6
3
|
declare const LabelIcon: (props: LabelIconProps) => React.JSX.Element | null;
|
|
7
4
|
export { LabelIcon };
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
var _excluded = ["size", "icon", "tooltip"];
|
|
5
|
-
import InfoOutlineIcon from '@scaleflex/ui-tw/label/components/info-outline-icon';
|
|
6
|
-
import {
|
|
4
|
+
import { InfoOutlineIcon } from '@scaleflex/ui-tw/label/components/info-outline-icon';
|
|
5
|
+
import { labelIconSizes } from '@scaleflex/ui-tw/label/label.constants';
|
|
7
6
|
import { getLabelIconSizeInRem } from '@scaleflex/ui-tw/label/label.utils';
|
|
8
7
|
import { Tooltip, TooltipContent, TooltipTrigger } from '@scaleflex/ui-tw/tooltip';
|
|
9
8
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
10
9
|
import { cva } from 'class-variance-authority';
|
|
11
10
|
import React, { cloneElement, useMemo } from 'react';
|
|
12
|
-
var labelIconSizes = _defineProperty(_defineProperty(_defineProperty({}, LabelSize.Sm, 'ml-1'), LabelSize.Md, 'ml-1.5'), LabelSize.Lg, 'ml-1.5');
|
|
13
11
|
var labelIconVariants = cva('', {
|
|
14
12
|
variants: {
|
|
15
13
|
size: labelIconSizes
|
package/label/label.component.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
var _excluded = ["className", "size", "children", "icon", "tooltip"];
|
|
5
4
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
6
|
-
import { ButtonSize } from '@scaleflex/ui-tw/button';
|
|
7
|
-
import { InputSize } from '@scaleflex/ui-tw/input';
|
|
8
5
|
import { LabelIcon } from '@scaleflex/ui-tw/label/components/label-icon';
|
|
9
|
-
import {
|
|
6
|
+
import { labelSizeOptions } from '@scaleflex/ui-tw/label/label.constants';
|
|
7
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
10
8
|
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
11
9
|
import { cva } from 'class-variance-authority';
|
|
12
10
|
import * as React from 'react';
|
|
13
|
-
var labelSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, InputSize.Sm, 'text-xs'), InputSize.Md, 'text-sm'), InputSize.Lg, 'text-base');
|
|
14
11
|
var labelVariants = cva('', {
|
|
15
12
|
variants: {
|
|
16
13
|
size: labelSizeOptions
|
|
17
14
|
},
|
|
18
15
|
defaultVariants: {
|
|
19
|
-
size:
|
|
16
|
+
size: FormSize.Md
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
19
|
function Label(_ref) {
|
|
23
20
|
var className = _ref.className,
|
|
24
21
|
_ref$size = _ref.size,
|
|
25
|
-
size = _ref$size === void 0 ?
|
|
22
|
+
size = _ref$size === void 0 ? FormSize.Md : _ref$size,
|
|
26
23
|
children = _ref.children,
|
|
27
24
|
icon = _ref.icon,
|
|
28
25
|
tooltip = _ref.tooltip,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
3
|
+
export var labelSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'text-xs'), FormSize.Md, 'text-sm'), FormSize.Lg, 'text-base');
|
|
4
|
+
export var labelIconSizes = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'ml-1'), FormSize.Md, 'ml-1.5'), FormSize.Lg, 'ml-1.5');
|
package/label/label.types.d.ts
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
-
import
|
|
2
|
+
import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
|
|
3
3
|
import { ComponentProps, ReactElement } from 'react';
|
|
4
|
-
export declare const LabelSize: {
|
|
5
|
-
readonly Sm: "sm";
|
|
6
|
-
readonly Md: "md";
|
|
7
|
-
readonly Lg: "lg";
|
|
8
|
-
};
|
|
9
|
-
export type LabelSizeType = Values<typeof LabelSize>;
|
|
10
4
|
export interface LabelProps extends Omit<ComponentProps<typeof LabelPrimitive.Root>, 'size'> {
|
|
11
|
-
size?:
|
|
5
|
+
size?: FormSizeType;
|
|
12
6
|
icon?: ReactElement;
|
|
13
7
|
tooltip?: string;
|
|
14
8
|
}
|
|
9
|
+
export interface LabelIconProps extends ComponentProps<'span'>, Pick<LabelProps, 'size' | 'tooltip'> {
|
|
10
|
+
icon?: ReactElement;
|
|
11
|
+
}
|
package/label/label.types.js
CHANGED
package/label/label.utils.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const getLabelIconSizeInRem: (sizeName?:
|
|
1
|
+
import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
|
|
2
|
+
export declare const getLabelIconSizeInRem: (sizeName?: FormSizeType | null) => string;
|
package/label/label.utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
2
2
|
export var getLabelIconSizeInRem = function getLabelIconSizeInRem(sizeName) {
|
|
3
3
|
switch (sizeName) {
|
|
4
|
-
case
|
|
4
|
+
case FormSize.Lg:
|
|
5
5
|
return '1rem';
|
|
6
6
|
// 16px
|
|
7
|
-
case
|
|
7
|
+
case FormSize.Md:
|
|
8
8
|
return '0.875rem';
|
|
9
9
|
// 14px
|
|
10
|
-
case
|
|
10
|
+
case FormSize.Sm:
|
|
11
11
|
return '0.75rem';
|
|
12
12
|
// 14px
|
|
13
13
|
default:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleflex/ui-tw",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"author": "scaleflex",
|
|
5
5
|
"repository": "github:scaleflex/ui",
|
|
6
6
|
"homepage": "https://github.com/scaleflex/ui/blob/master/README.md",
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
"@popperjs/core": "^2.6.0",
|
|
16
16
|
"@radix-ui/react-label": "^2.1.6",
|
|
17
17
|
"@radix-ui/react-slot": "^1.1.2",
|
|
18
|
+
"@radix-ui/react-switch": "^1.0.1",
|
|
18
19
|
"@radix-ui/react-tooltip": "^1.2.6",
|
|
19
|
-
"@scaleflex/icons-tw": "^0.0.
|
|
20
|
+
"@scaleflex/icons-tw": "^0.0.8",
|
|
20
21
|
"@types/lodash.merge": "^4.6.9",
|
|
21
22
|
"class-variance-authority": "^0.7.1",
|
|
22
23
|
"lodash.merge": "^4.6.2",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch } from './switch.component';
|
package/switch/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Switch } from './switch.component';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["className", "size"];
|
|
4
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
5
|
+
import { switchSizeOptions, switchThumbSizeOptions } from '@scaleflex/ui-tw/switch/switch.constants';
|
|
6
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
7
|
+
import { cn } from '@scaleflex/ui-tw/utils/cn';
|
|
8
|
+
import { cva } from 'class-variance-authority';
|
|
9
|
+
import * as React from 'react';
|
|
10
|
+
var switchVariants = cva('', {
|
|
11
|
+
variants: {
|
|
12
|
+
size: switchSizeOptions
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: {
|
|
15
|
+
size: FormSize.Md
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var switchThumbVariants = cva('', {
|
|
19
|
+
variants: {
|
|
20
|
+
size: switchThumbSizeOptions
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
size: FormSize.Md
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
function Switch(_ref) {
|
|
27
|
+
var className = _ref.className,
|
|
28
|
+
_ref$size = _ref.size,
|
|
29
|
+
size = _ref$size === void 0 ? FormSize.Md : _ref$size,
|
|
30
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
+
return /*#__PURE__*/React.createElement(SwitchPrimitive.Root, _extends({
|
|
32
|
+
"data-slot": "switch",
|
|
33
|
+
className: cn('peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-xs transition-all outline-none', 'disabled:cursor-not-allowed disabled:opacity-50', 'data-[state=checked]:bg-primary data-[state=unchecked]:bg-input', 'ring-offset-background focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none', switchVariants({
|
|
34
|
+
size: size
|
|
35
|
+
}), className)
|
|
36
|
+
}, props), /*#__PURE__*/React.createElement(SwitchPrimitive.Thumb, {
|
|
37
|
+
"data-slot": "switch-thumb",
|
|
38
|
+
className: cn('bg-background pointer-events-none block rounded-full ring-0 transition-transform', 'data-[state=checked]:translate-x-full data-[state=unchecked]:translate-x-0', switchThumbVariants({
|
|
39
|
+
size: size
|
|
40
|
+
}))
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
export { Switch };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { FormSize } from '@scaleflex/ui-tw/types/form-size';
|
|
3
|
+
export var switchSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'h-4 w-7'), FormSize.Md, 'h-5 w-9'), FormSize.Lg, 'h-7 w-13');
|
|
4
|
+
export var switchThumbSizeOptions = _defineProperty(_defineProperty(_defineProperty({}, FormSize.Sm, 'size-3'), FormSize.Md, 'size-4'), FormSize.Lg, 'size-6');
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as SwitchPrimitive from '@radix-ui/react-switch';
|
|
2
|
+
import { FormSizeType } from '@scaleflex/ui-tw/types/form-size';
|
|
3
|
+
import { ComponentProps } from 'react';
|
|
4
|
+
export interface SwitchProps extends ComponentProps<typeof SwitchPrimitive.Root> {
|
|
5
|
+
size?: FormSizeType;
|
|
6
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types/values.d.ts
CHANGED
package/types/values.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/button/button.const.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export declare const iconVariantOptions: {
|
|
2
|
-
primary: string;
|
|
3
|
-
secondary: string;
|
|
4
|
-
outline: string;
|
|
5
|
-
"link-primary": string;
|
|
6
|
-
"link-secondary": string;
|
|
7
|
-
"link-basic-primary": string;
|
|
8
|
-
"link-basic-secondary": string;
|
|
9
|
-
"link-error": string;
|
|
10
|
-
"link-warning": string;
|
|
11
|
-
"error-primary": string;
|
|
12
|
-
"warning-primary": string;
|
|
13
|
-
};
|
package/button/button.const.js
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
var _iconVariantOptions;
|
|
3
|
-
import { ButtonVariant } from '@scaleflex/ui-tw/button/button.types';
|
|
4
|
-
export var iconVariantOptions = (_iconVariantOptions = {}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_iconVariantOptions, ButtonVariant.Primary, ''), ButtonVariant.Secondary, ''), ButtonVariant.Outline, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkPrimary, ''), ButtonVariant.LinkSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkBasicPrimary, ''), ButtonVariant.LinkBasicSecondary, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.LinkError, ''), ButtonVariant.LinkWarning, ''), ButtonVariant.Error, ''), _defineProperty(_iconVariantOptions, ButtonVariant.Warning, ''));
|