@scaleflex/ui-tw 0.0.1 → 0.0.2
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/core/accordion-header/accordion-header.component.js +1 -1
- package/core/arrow/arrow.component.js +3 -4
- package/core/arrow-tick/arrow-tick.component.js +3 -10
- package/core/button/button.component.d.ts +2 -2
- package/core/button/button.component.js +7 -5
- package/core/button/button.const.d.ts +15 -0
- package/core/button/button.const.js +4 -0
- package/core/button/button.types.d.ts +3 -4
- package/core/button/button.utils.d.ts +2 -3
- package/core/button/button.utils.js +11 -10
- package/core/button/components/end-icon.d.ts +5 -10
- package/core/button/components/end-icon.js +20 -14
- package/core/button/components/start-icon.d.ts +7 -8
- package/core/button/components/start-icon.js +29 -16
- package/core/check-box/check-box.component.d.ts +0 -3
- package/core/check-box/check-box.component.js +77 -62
- package/core/check-box/index.d.ts +0 -2
- package/core/check-box/index.js +2 -1
- package/core/check-box-group/check-box-group.component.d.ts +0 -3
- package/core/check-box-group/check-box-group.component.js +75 -74
- package/core/check-box-group/check-box-group.props.d.ts +0 -19
- package/core/check-box-group/check-box-group.props.js +23 -1
- package/core/check-box-group/index.d.ts +0 -2
- package/core/check-box-group/index.js +2 -1
- package/core/cross-button/cross-button.component.js +16 -14
- package/core/dot/dot.component.js +1 -3
- package/core/input/components/clear-icon.d.ts +6 -0
- package/core/input/components/clear-icon.js +12 -0
- package/core/input/components/copy-icon.d.ts +6 -0
- package/core/input/components/copy-icon.js +13 -0
- package/core/input/components/password-icon.d.ts +7 -0
- package/core/input/components/password-icon.js +24 -0
- package/core/input/components/render-icon.d.ts +7 -0
- package/core/input/components/render-icon.js +26 -0
- package/core/input/index.d.ts +1 -1
- package/core/input/input.component.d.ts +1 -1
- package/core/input/input.component.js +147 -207
- package/core/input/input.const.d.ts +6 -0
- package/core/input/input.const.js +6 -0
- package/core/input/{input.props.d.ts → input.types.d.ts} +22 -6
- package/core/input/input.types.js +16 -0
- package/core/input/input.utils.d.ts +2 -4
- package/core/input/input.utils.js +11 -28
- package/core/pagination/pagination.component.js +2 -2
- package/core/popper/popper.component.js +5 -42
- package/package.json +2 -2
- package/theme/README.md +1 -38
- package/theme/theme.css +5 -5
- package/utils/functions/index.d.ts +0 -3
- package/utils/functions/index.js +0 -3
- package/utils/types/color/index.d.ts +0 -2
- package/utils/types/color/index.js +2 -2
- package/utils/types/index.d.ts +0 -2
- package/utils/types/index.js +2 -2
- package/core/accordion/accordion.styles.d.ts +0 -6
- package/core/accordion/accordion.styles.js +0 -12
- package/core/accordion-details/accordion-details.styles.d.ts +0 -6
- package/core/accordion-details/accordion-details.styles.js +0 -12
- package/core/accordion-header/accordion-header.styles.d.ts +0 -19
- package/core/accordion-header/accordion-header.styles.js +0 -44
- package/core/arrow/arrow.mixin.d.ts +0 -6
- package/core/arrow/arrow.mixin.js +0 -4
- package/core/arrow/arrow.styles.d.ts +0 -9
- package/core/arrow/arrow.styles.js +0 -18
- package/core/arrow-tick/arrow-tick.mixin.d.ts +0 -6
- package/core/arrow-tick/arrow-tick.mixin.js +0 -4
- package/core/arrow-tick/arrow-tick.styles.d.ts +0 -7
- package/core/arrow-tick/arrow-tick.styles.js +0 -18
- package/core/check-box/check-box.mixin.d.ts +0 -4
- package/core/check-box/check-box.mixin.js +0 -8
- package/core/check-box/check-box.styles.d.ts +0 -19
- package/core/check-box/check-box.styles.js +0 -42
- package/core/check-box-group/check-box-group.mixin.d.ts +0 -5
- package/core/check-box-group/check-box-group.mixin.js +0 -10
- package/core/check-box-group/check-box-group.styles.d.ts +0 -19
- package/core/check-box-group/check-box-group.styles.js +0 -33
- package/core/cross-button/cross-button.styles.d.ts +0 -9
- package/core/cross-button/cross-button.styles.js +0 -21
- package/core/dot/dot.styles.d.ts +0 -18
- package/core/dot/dot.styles.js +0 -32
- package/core/dots-navigation/dots-navigation.styles.d.ts +0 -6
- package/core/dots-navigation/dots-navigation.styles.js +0 -15
- package/core/input/input.mixin.d.ts +0 -18
- package/core/input/input.mixin.js +0 -25
- package/core/input/input.props.js +0 -1
- package/core/input/input.styles.d.ts +0 -78
- package/core/input/input.styles.js +0 -148
- package/core/input/types/index.d.ts +0 -1
- package/core/input/types/index.js +0 -1
- package/core/input/types/type.d.ts +0 -4
- package/core/input/types/type.js +0 -4
- package/core/modal/modal.mixin.d.ts +0 -7
- package/core/modal/modal.mixin.js +0 -4
- package/core/modal/modal.styles.d.ts +0 -22
- package/core/modal/modal.styles.js +0 -51
- package/core/modal-actions/modal-actions.styles.d.ts +0 -7
- package/core/modal-actions/modal-actions.styles.js +0 -17
- package/core/modal-content/modal-content.styles.d.ts +0 -6
- package/core/modal-content/modal-content.styles.js +0 -12
- package/core/modal-title/modal-title.styles.d.ts +0 -31
- package/core/modal-title/modal-title.styles.js +0 -64
- package/core/pagination/pagination.styles.d.ts +0 -19
- package/core/pagination/pagination.styles.js +0 -36
- package/core/popper/popper.mixin.d.ts +0 -17
- package/core/popper/popper.mixin.js +0 -5
- package/core/popper/popper.styles.d.ts +0 -25
- package/core/popper/popper.styles.js +0 -48
- package/core/radio/radio.mixin.d.ts +0 -13
- package/core/radio/radio.mixin.js +0 -13
- package/core/radio/radio.styles.d.ts +0 -19
- package/core/radio/radio.styles.js +0 -44
- package/core/radio-group/radio-group.styles.d.ts +0 -14
- package/core/radio-group/radio-group.styles.js +0 -30
- package/core/switcher/switcher.mixin.d.ts +0 -21
- package/core/switcher/switcher.mixin.js +0 -17
- package/core/switcher/switcher.styles.d.ts +0 -27
- package/core/switcher/switcher.styles.js +0 -54
- package/core/switcher-group/switcher-group.styles.d.ts +0 -10
- package/core/switcher-group/switcher-group.styles.js +0 -30
- package/core/tab/tab.mixin.d.ts +0 -11
- package/core/tab/tab.mixin.js +0 -15
- package/core/tab/tab.styles.d.ts +0 -26
- package/core/tab/tab.styles.js +0 -61
- package/core/tab-panel/tab-panel.styles.d.ts +0 -6
- package/core/tab-panel/tab-panel.styles.js +0 -12
- package/core/upload-input/upload-input.styles.d.ts +0 -11
- package/core/upload-input/upload-input.styles.js +0 -53
- package/theme/entity/index.d.ts +0 -1
- package/theme/entity/index.js +0 -1
- package/theme/entity/theme.d.ts +0 -34
- package/theme/hooks/index.d.ts +0 -2
- package/theme/hooks/index.js +0 -2
- package/theme/hooks/use-media-query.d.ts +0 -1
- package/theme/hooks/use-media-query.js +0 -27
- package/theme/hooks/use-theme.d.ts +0 -2
- package/theme/hooks/use-theme.js +0 -4
- package/theme/index.d.ts +0 -3
- package/theme/index.js +0 -1
- package/theme/roots/breakpoints/entity/breakpoints-map.d.ts +0 -8
- package/theme/roots/breakpoints/entity/breakpoints.d.ts +0 -73
- package/theme/roots/breakpoints/entity/create-breakpoints.d.ts +0 -3
- package/theme/roots/breakpoints/entity/create-breakpoints.js +0 -65
- package/theme/roots/breakpoints/entity/default-breakpoints.d.ts +0 -26
- package/theme/roots/breakpoints/entity/default-breakpoints.js +0 -22
- package/theme/roots/breakpoints/entity/index.d.ts +0 -3
- package/theme/roots/breakpoints/entity/index.js +0 -2
- package/theme/roots/breakpoints/index.d.ts +0 -3
- package/theme/roots/breakpoints/index.js +0 -1
- package/theme/roots/common-styles.d.ts +0 -2
- package/theme/roots/common-styles.js +0 -6
- package/theme/roots/index.d.ts +0 -2
- package/theme/roots/index.js +0 -2
- package/theme/roots/palette/entity/colors-map.d.ts +0 -4
- package/theme/roots/palette/entity/default-palette.d.ts +0 -282
- package/theme/roots/palette/entity/default-palette.js +0 -22
- package/theme/roots/palette/entity/index.d.ts +0 -2
- package/theme/roots/palette/entity/index.js +0 -2
- package/theme/roots/palette/index.d.ts +0 -2
- package/theme/roots/palette/index.js +0 -1
- package/theme/roots/shadows/entity/default-shadows.d.ts +0 -16
- package/theme/roots/shadows/entity/default-shadows.js +0 -5
- package/theme/roots/shadows/entity/index.d.ts +0 -2
- package/theme/roots/shadows/entity/index.js +0 -2
- package/theme/roots/shadows/entity/shadows-map.d.ts +0 -4
- package/theme/roots/shadows/index.d.ts +0 -2
- package/theme/roots/shadows/index.js +0 -1
- package/theme/roots/shape/index.d.ts +0 -1
- package/theme/roots/shape/index.js +0 -1
- package/theme/roots/shape/shape.props.d.ts +0 -5
- package/theme/roots/shape/shape.props.js +0 -1
- package/theme/roots/typography/entity/default-typography.d.ts +0 -398
- package/theme/roots/typography/entity/default-typography.js +0 -237
- package/theme/roots/typography/entity/index.d.ts +0 -1
- package/theme/roots/typography/entity/index.js +0 -1
- package/theme/roots/typography/index.d.ts +0 -3
- package/theme/roots/typography/index.js +0 -2
- package/theme/roots/typography/typography.component.d.ts +0 -2
- package/theme/roots/typography/typography.component.js +0 -7
- package/theme/roots/typography/typography.props.d.ts +0 -15
- package/theme/roots/typography/typography.props.js +0 -1
- package/theme/theme-provider/index.d.ts +0 -2
- package/theme/theme-provider/index.js +0 -1
- package/theme/theme-provider/theme-provider.context.d.ts +0 -4
- package/theme/theme-provider/theme-provider.context.js +0 -48
- package/theme/theme-provider/theme-provider.props.d.ts +0 -6
- package/theme/theme-provider/theme-provider.props.js +0 -1
- package/utils/functions/color-picker/map-number.d.ts +0 -1
- package/utils/functions/color-picker/map-number.js +0 -3
- package/utils/functions/color-picker/restrict-number.d.ts +0 -1
- package/utils/functions/color-picker/restrict-number.js +0 -8
- package/utils/functions/scrollbar.d.ts +0 -2
- package/utils/functions/scrollbar.js +0 -6
- package/utils/types/size/index.d.ts +0 -1
- package/utils/types/size/index.js +0 -1
- package/utils/types/size/input-size.d.ts +0 -4
- package/utils/types/size/input-size.js +0 -4
|
@@ -41,7 +41,7 @@ var AccordionHeader = function AccordionHeader(_ref) {
|
|
|
41
41
|
}, /*#__PURE__*/React.createElement(ArrowTick, {
|
|
42
42
|
type: expanded ? ArrowTickType.Top : ArrowTickType.Bottom,
|
|
43
43
|
IconProps: _objectSpread({
|
|
44
|
-
size:
|
|
44
|
+
size: '0.6875rem'
|
|
45
45
|
}, iconPropsData)
|
|
46
46
|
})));
|
|
47
47
|
};
|
|
@@ -1,21 +1,20 @@
|
|
|
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";
|
|
3
4
|
var _excluded = ["type", "IconProps", "ref"];
|
|
4
5
|
import ArrowIcon from '@scaleflex/icons-tw/arrow';
|
|
5
6
|
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
import { Position } from '../../utils/types';
|
|
9
|
+
var arrowDirection = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, Position.Bottom, 'rotate-90'), Position.Left, 'rotate-180'), Position.Right, ''), Position.Top, '-rotate-90');
|
|
8
10
|
var Arrow = function Arrow(_ref) {
|
|
9
11
|
var _ref$type = _ref.type,
|
|
10
12
|
type = _ref$type === void 0 ? Position.Right : _ref$type,
|
|
11
13
|
IconPropsData = _ref.IconProps,
|
|
12
14
|
ref = _ref.ref,
|
|
13
15
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
-
var arrowDirectionClasses = cn("".concat(type === Position.Bottom ? 'rotate-90' : ''), "".concat(type === Position.Left ? 'rotate-180' : ''), "".concat(type === Position.Right ? '' : ''), // don't need to rotate
|
|
15
|
-
"".concat(type === Position.Top ? '-rotate-90' : ''));
|
|
16
|
-
var ArrowClasses = cn('inline-flex transition-transform duration-150', arrowDirectionClasses);
|
|
17
16
|
return /*#__PURE__*/React.createElement("span", _extends({
|
|
18
|
-
className:
|
|
17
|
+
className: cn('inline-flex transition-transform duration-150', arrowDirection[type])
|
|
19
18
|
}, rest, {
|
|
20
19
|
ref: ref
|
|
21
20
|
}), /*#__PURE__*/React.createElement(ArrowIcon, IconPropsData));
|
|
@@ -1,28 +1,21 @@
|
|
|
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";
|
|
3
4
|
var _excluded = ["type", "IconProps", "ref"];
|
|
4
5
|
import ArrowBottom from '@scaleflex/icons-tw/arrow-bottom';
|
|
5
|
-
import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
import { Position } from '../../utils/types';
|
|
8
|
+
var arrowTickDirection = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, Position.Bottom, ''), Position.Left, 'rotate-90'), Position.Right, '-rotate-90'), Position.Top, 'rotate-180');
|
|
8
9
|
var ArrowTick = function ArrowTick(_ref) {
|
|
9
10
|
var _ref$type = _ref.type,
|
|
10
11
|
type = _ref$type === void 0 ? Position.Bottom : _ref$type,
|
|
11
12
|
IconPropsData = _ref.IconProps,
|
|
12
13
|
ref = _ref.ref,
|
|
13
14
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
14
|
-
var arrowDirectionClasses = cn("".concat(type === Position.Bottom ? '' : ''), // don't need to rotate
|
|
15
|
-
"".concat(type === Position.Left ? 'rotate-90' : ''), "".concat(type === Position.Right ? '-rotate-90' : ''), "".concat(type === Position.Top ? 'rotate-180' : ''));
|
|
16
|
-
var arrowClasses = cn(arrowDirectionClasses);
|
|
17
|
-
|
|
18
|
-
// TODO: structure this arrow using only CSS. create rules for IconPropsData?.size as TailwindCSS classes
|
|
19
|
-
// const arrowClasses = cn('inline-block w-2 h-2 border-solid border-secondary border-r-1 border-b-1 transition-transform duration-150 ease-out ', arrowDirectionClasses,)
|
|
20
|
-
// return <span className={arrowClasses} {...rest} ref={ref}></span>
|
|
21
|
-
|
|
22
15
|
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
|
23
16
|
ref: ref
|
|
24
17
|
}), /*#__PURE__*/React.createElement(ArrowBottom, _extends({
|
|
25
|
-
className:
|
|
18
|
+
className: arrowTickDirection[type]
|
|
26
19
|
}, IconPropsData)));
|
|
27
20
|
};
|
|
28
21
|
export default ArrowTick;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ButtonProps } from './button.types';
|
|
3
3
|
declare const buttonVariants: (props?: ({
|
|
4
|
-
variant?: "primary" | "secondary" | "
|
|
5
|
-
size?: "
|
|
4
|
+
variant?: "primary" | "secondary" | "outline" | "link-primary" | "link-secondary" | "link-basic-primary" | "link-basic-secondary" | "link-error" | "link-warning" | "error-primary" | "error-outline" | "warning-primary" | "warning-outline" | null | undefined;
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
7
|
declare function Button({ className, children, size, startIcon, endIcon, variant, loading, asChild, disabled, ...rest }: ButtonProps): React.JSX.Element;
|
|
8
8
|
export { buttonVariants };
|
|
@@ -11,10 +11,10 @@ import { cn } from '@scaleflex/ui-tw/utils/functions/shadcn-utils';
|
|
|
11
11
|
import { cva } from 'class-variance-authority';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { ButtonSize, ButtonVariant } from './button.types';
|
|
14
|
-
import {
|
|
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/
|
|
14
|
+
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-primary/80 hover:text-primary-foreground'), ButtonVariant.Outline, 'border bg-background text-secondary-foreground shadow-xs border-input hover:text-secondary-foreground/80 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 hover:text-primary/80 font-normal'), 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.ErrorPrimary, 'bg-destructive text-primary-foreground shadow-xs hover:bg-destructive/90'), _defineProperty(_defineProperty(_defineProperty(_buttonVariantOptions, ButtonVariant.ErrorOutline, 'border bg-background text-secondary-foreground shadow-xs border-input hover:bg-destructive hover:text-primary-foreground hover:border-transparent hover:border-destructive'), ButtonVariant.WarningPrimary, 'bg-warning text-primary-foreground shadow-xs hover:bg-warning/90'), ButtonVariant.WarningOutline, 'border bg-background text-secondary-foreground shadow-xs border-input hover:bg-warning hover:text-primary-foreground hover:border-transparent hover:border-warning'));
|
|
16
16
|
var buttonSizeOptions = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'h-6 px-2.5 py-1.5 text-sm'), 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
|
-
var buttonVariants = cva("cursor-pointer inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-
|
|
17
|
+
var buttonVariants = cva("group/button cursor-pointer inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-30 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
|
|
18
18
|
variants: {
|
|
19
19
|
variant: buttonVariantOptions,
|
|
20
20
|
size: buttonSizeOptions
|
|
@@ -47,11 +47,12 @@ function Button(_ref) {
|
|
|
47
47
|
variant: variant,
|
|
48
48
|
size: size,
|
|
49
49
|
className: className
|
|
50
|
-
}), loading && 'pointer-events-none opacity-
|
|
50
|
+
}), loading && 'pointer-events-none opacity-30'),
|
|
51
51
|
disabled: disabled
|
|
52
52
|
}, rest), startIcon || endIcon || loading ? /*#__PURE__*/React.createElement("span", {
|
|
53
53
|
className: "flex items-center"
|
|
54
54
|
}, startIcon && /*#__PURE__*/React.createElement(StartIcon, {
|
|
55
|
+
variant: variant,
|
|
55
56
|
size: size,
|
|
56
57
|
loading: loading,
|
|
57
58
|
icon: startIcon
|
|
@@ -60,9 +61,10 @@ function Button(_ref) {
|
|
|
60
61
|
size: size
|
|
61
62
|
})
|
|
62
63
|
}, /*#__PURE__*/React.createElement(SpinnerIcon, {
|
|
63
|
-
size:
|
|
64
|
+
size: getIconSizeInRem(size),
|
|
64
65
|
className: "animate-spin"
|
|
65
66
|
})), children, endIcon && /*#__PURE__*/React.createElement(EndIcon, {
|
|
67
|
+
variant: variant,
|
|
66
68
|
size: size,
|
|
67
69
|
icon: endIcon
|
|
68
70
|
})) : children);
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
"error-outline": string;
|
|
13
|
+
"warning-primary": string;
|
|
14
|
+
"warning-outline": string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
var _iconVariantOptions;
|
|
3
|
+
import { ButtonVariant } from '@scaleflex/ui-tw/core/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.ErrorPrimary, ''), _defineProperty(_defineProperty(_defineProperty(_iconVariantOptions, ButtonVariant.ErrorOutline, 'text-muted-foreground group-hover/button:text-muted-foreground/80'), ButtonVariant.WarningPrimary, ''), ButtonVariant.WarningOutline, 'text-muted-foreground group-hover/button:text-muted-foreground/80'));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { IconProps } from '@scaleflex/icons-tw/icon.props';
|
|
2
1
|
import { buttonVariants } from '@scaleflex/ui-tw/core/button/button.component';
|
|
3
2
|
import type { VariantProps } from 'class-variance-authority';
|
|
4
|
-
import { ComponentProps,
|
|
3
|
+
import { ComponentProps, ReactElement } from 'react';
|
|
5
4
|
export declare const ButtonVariant: {
|
|
6
5
|
readonly Primary: "primary";
|
|
7
6
|
readonly Secondary: "secondary";
|
|
@@ -19,8 +18,8 @@ export declare const ButtonVariant: {
|
|
|
19
18
|
};
|
|
20
19
|
export interface ButtonProps extends ComponentProps<'button'>, VariantProps<typeof buttonVariants> {
|
|
21
20
|
asChild?: boolean;
|
|
22
|
-
startIcon?:
|
|
23
|
-
endIcon?:
|
|
21
|
+
startIcon?: ReactElement;
|
|
22
|
+
endIcon?: ReactElement;
|
|
24
23
|
loading?: boolean;
|
|
25
24
|
disabled?: boolean;
|
|
26
25
|
}
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { ButtonSizeType
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const isLinkBasicVariant: (variant: ButtonVariantType | null) => boolean;
|
|
1
|
+
import { ButtonSizeType } from '@scaleflex/ui-tw/core/button/button.types';
|
|
2
|
+
export declare const getIconSizeInRem: (sizeName?: ButtonSizeType | null) => string;
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { ButtonSize
|
|
2
|
-
export var
|
|
1
|
+
import { ButtonSize } from '@scaleflex/ui-tw/core/button/button.types';
|
|
2
|
+
export var getIconSizeInRem = function getIconSizeInRem(sizeName) {
|
|
3
3
|
switch (sizeName) {
|
|
4
4
|
case ButtonSize.Lg:
|
|
5
|
-
return
|
|
5
|
+
return '1.125rem';
|
|
6
|
+
// 18px
|
|
6
7
|
case ButtonSize.Md:
|
|
7
|
-
return
|
|
8
|
+
return '1rem';
|
|
9
|
+
// 16px
|
|
8
10
|
case ButtonSize.Sm:
|
|
9
|
-
return
|
|
11
|
+
return '0.875rem';
|
|
12
|
+
// 14px
|
|
10
13
|
case ButtonSize.Xs:
|
|
11
|
-
return
|
|
14
|
+
return '0.75rem';
|
|
15
|
+
// 12px
|
|
12
16
|
default:
|
|
13
|
-
return
|
|
17
|
+
return '1rem';
|
|
14
18
|
}
|
|
15
|
-
};
|
|
16
|
-
export var isLinkBasicVariant = function isLinkBasicVariant(variant) {
|
|
17
|
-
return variant === ButtonVariant.LinkBasicPrimary || variant === ButtonVariant.LinkBasicSecondary;
|
|
18
19
|
};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import React, { ComponentProps,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
-
interface EndIconProps extends ComponentProps<'span'>, VariantProps<typeof endIconVariants> {
|
|
7
|
-
icon?: ReactNode | ((props: {
|
|
8
|
-
size: number;
|
|
9
|
-
}) => ReactNode);
|
|
1
|
+
import { type ButtonProps } from '@scaleflex/ui-tw/core/button';
|
|
2
|
+
import React, { ComponentProps, ReactElement } from 'react';
|
|
3
|
+
interface EndIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
4
|
+
icon?: ReactElement;
|
|
10
5
|
}
|
|
11
|
-
declare const EndIcon: (props: EndIconProps) => React.JSX.Element;
|
|
6
|
+
declare const EndIcon: (props: EndIconProps) => React.JSX.Element | null;
|
|
12
7
|
export default EndIcon;
|
|
@@ -1,33 +1,39 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["size", "icon"];
|
|
4
|
+
var _excluded = ["size", "icon", "variant"];
|
|
5
5
|
import { ButtonSize } from '@scaleflex/ui-tw/core/button';
|
|
6
|
-
import {
|
|
6
|
+
import { iconVariantOptions } from '@scaleflex/ui-tw/core/button/button.const';
|
|
7
|
+
import { getIconSizeInRem } from '@scaleflex/ui-tw/core/button/button.utils';
|
|
7
8
|
import { cva } from 'class-variance-authority';
|
|
8
|
-
import React, { useMemo } from 'react';
|
|
9
|
-
var endIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'ml-
|
|
10
|
-
var endIconVariants = cva('
|
|
9
|
+
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
|
+
var endIconVariants = cva('', {
|
|
11
12
|
variants: {
|
|
13
|
+
variant: iconVariantOptions,
|
|
12
14
|
size: endIconSizes
|
|
13
|
-
},
|
|
14
|
-
defaultVariants: {
|
|
15
|
-
size: ButtonSize.Md
|
|
16
15
|
}
|
|
17
16
|
});
|
|
18
17
|
var EndIcon = function EndIcon(props) {
|
|
19
18
|
var size = props.size,
|
|
20
19
|
icon = props.icon,
|
|
20
|
+
variant = props.variant,
|
|
21
21
|
rest = _objectWithoutProperties(props, _excluded);
|
|
22
|
-
var
|
|
23
|
-
return
|
|
22
|
+
var sizeInRem = useMemo(function () {
|
|
23
|
+
return getIconSizeInRem(size);
|
|
24
24
|
}, [size]);
|
|
25
|
+
if (!icon) return null;
|
|
25
26
|
return /*#__PURE__*/React.createElement("span", _extends({
|
|
26
27
|
className: endIconVariants({
|
|
27
|
-
size: size
|
|
28
|
+
size: size,
|
|
29
|
+
variant: variant
|
|
28
30
|
})
|
|
29
|
-
}, rest),
|
|
30
|
-
size:
|
|
31
|
-
|
|
31
|
+
}, rest), /*#__PURE__*/cloneElement(icon, {
|
|
32
|
+
size: sizeInRem,
|
|
33
|
+
style: {
|
|
34
|
+
width: sizeInRem,
|
|
35
|
+
height: sizeInRem
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
32
38
|
};
|
|
33
39
|
export default EndIcon;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import React, { ComponentProps,
|
|
1
|
+
import { type ButtonProps } from '@scaleflex/ui-tw/core/button';
|
|
2
|
+
import React, { ComponentProps, ReactElement } 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" | "error-outline" | "warning-primary" | "warning-outline" | null | undefined;
|
|
5
|
+
size?: "xs" | "sm" | "md" | "lg" | null | undefined;
|
|
5
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
-
interface StartIconProps extends ComponentProps<'span'>,
|
|
7
|
-
icon?:
|
|
8
|
-
size: number;
|
|
9
|
-
}) => ReactNode);
|
|
7
|
+
interface StartIconProps extends ComponentProps<'span'>, Pick<ButtonProps, 'size' | 'variant'> {
|
|
8
|
+
icon?: ReactElement;
|
|
10
9
|
loading?: boolean;
|
|
11
10
|
}
|
|
12
|
-
declare const StartIcon: (props: StartIconProps) => React.JSX.Element;
|
|
11
|
+
declare const StartIcon: (props: StartIconProps) => React.JSX.Element | null;
|
|
13
12
|
export { startIconVariants };
|
|
14
13
|
export default StartIcon;
|
|
@@ -1,40 +1,53 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
|
-
var _excluded = ["size", "icon", "loading"];
|
|
4
|
+
var _excluded = ["size", "variant", "icon", "loading"];
|
|
5
5
|
import SpinnerIcon from '@scaleflex/icons-tw/spinner';
|
|
6
6
|
import { ButtonSize } from '@scaleflex/ui-tw/core/button';
|
|
7
|
-
import {
|
|
7
|
+
import { iconVariantOptions } from '@scaleflex/ui-tw/core/button/button.const';
|
|
8
|
+
import { getIconSizeInRem } from '@scaleflex/ui-tw/core/button/button.utils';
|
|
8
9
|
import { cva } from 'class-variance-authority';
|
|
9
|
-
import React, { useMemo } from 'react';
|
|
10
|
-
var startIconSizes = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ButtonSize.Xs, 'mr-
|
|
11
|
-
var startIconVariants = cva('
|
|
10
|
+
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
|
+
var startIconVariants = cva('', {
|
|
12
13
|
variants: {
|
|
14
|
+
variant: iconVariantOptions,
|
|
13
15
|
size: startIconSizes
|
|
14
|
-
},
|
|
15
|
-
defaultVariants: {
|
|
16
|
-
size: ButtonSize.Md
|
|
17
16
|
}
|
|
18
17
|
});
|
|
19
18
|
var StartIcon = function StartIcon(props) {
|
|
20
19
|
var size = props.size,
|
|
20
|
+
variant = props.variant,
|
|
21
21
|
icon = props.icon,
|
|
22
22
|
_props$loading = props.loading,
|
|
23
23
|
loading = _props$loading === void 0 ? false : _props$loading,
|
|
24
24
|
rest = _objectWithoutProperties(props, _excluded);
|
|
25
|
-
var
|
|
26
|
-
return
|
|
25
|
+
var sizeInRem = useMemo(function () {
|
|
26
|
+
return getIconSizeInRem(size);
|
|
27
27
|
}, [size]);
|
|
28
|
+
if (!icon) return null;
|
|
28
29
|
return /*#__PURE__*/React.createElement("span", _extends({
|
|
29
30
|
className: startIconVariants({
|
|
30
|
-
size: size
|
|
31
|
+
size: size,
|
|
32
|
+
className: 'flex'
|
|
31
33
|
})
|
|
32
34
|
}, rest), loading ? /*#__PURE__*/React.createElement(SpinnerIcon, {
|
|
33
|
-
size:
|
|
34
|
-
className: "animate-spin"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
size: sizeInRem,
|
|
36
|
+
className: "animate-spin",
|
|
37
|
+
style: {
|
|
38
|
+
width: sizeInRem,
|
|
39
|
+
height: sizeInRem
|
|
40
|
+
}
|
|
41
|
+
}) : (/*#__PURE__*/cloneElement(icon, {
|
|
42
|
+
size: sizeInRem,
|
|
43
|
+
style: {
|
|
44
|
+
width: sizeInRem,
|
|
45
|
+
height: sizeInRem
|
|
46
|
+
},
|
|
47
|
+
className: startIconVariants({
|
|
48
|
+
variant: variant
|
|
49
|
+
})
|
|
50
|
+
})));
|
|
38
51
|
};
|
|
39
52
|
export { startIconVariants };
|
|
40
53
|
export default StartIcon;
|
|
@@ -1,62 +1,77 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import { getCheckboxIconSize } from './check-box.utils'
|
|
12
|
-
import { Size, Type } from './types'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
62
|
-
|
|
1
|
+
// import Intermediate from '@scaleflex/icons-tw/intermediate'
|
|
2
|
+
// import Tick from '@scaleflex/icons-tw/tick'
|
|
3
|
+
// import React from 'react'
|
|
4
|
+
//
|
|
5
|
+
// import { lightPalette } from '../../theme/roots/palette'
|
|
6
|
+
// import { ignoreEvent } from '../../utils/functions'
|
|
7
|
+
// import { cn } from '../../utils/functions/shadcn-utils'
|
|
8
|
+
// import { Color } from '../../utils/types/palette'
|
|
9
|
+
//
|
|
10
|
+
// import type { CheckBoxProps } from './check-box.props'
|
|
11
|
+
// import { getCheckboxIconSize } from './check-box.utils'
|
|
12
|
+
// import { Size, Type } from './types'
|
|
13
|
+
//
|
|
14
|
+
// const CheckBox = ({
|
|
15
|
+
// size = Size.Md,
|
|
16
|
+
// type = Type.Checkbox,
|
|
17
|
+
// checked = false,
|
|
18
|
+
// onChange,
|
|
19
|
+
// checkBoxProps,
|
|
20
|
+
// readOnly = false,
|
|
21
|
+
// disabled = false,
|
|
22
|
+
// ref,
|
|
23
|
+
// ...rest
|
|
24
|
+
// }: CheckBoxProps): JSX.Element => {
|
|
25
|
+
// const getIcon = (props: any) => {
|
|
26
|
+
// switch (type) {
|
|
27
|
+
// case Type.Checkbox:
|
|
28
|
+
// return <Tick {...props} />
|
|
29
|
+
// case Type.Intermediate:
|
|
30
|
+
// return <Intermediate {...props} />
|
|
31
|
+
// default:
|
|
32
|
+
// return <Tick {...props} />
|
|
33
|
+
// }
|
|
34
|
+
// }
|
|
35
|
+
//
|
|
36
|
+
// const cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer'
|
|
37
|
+
//
|
|
38
|
+
// const ownTransitionClasses = 'transition-all duration-100 ease-out'
|
|
39
|
+
//
|
|
40
|
+
// const checkBoxWrapperClasses = cn(
|
|
41
|
+
// 'relative flex items-center justify-center border-1 border-solid border-borders-secondary',
|
|
42
|
+
// `${checked ? 'bg-accent-primary border-accent-primary' : 'bg-background-stateless border-borders-primary-stateless'}`,
|
|
43
|
+
// `${size === Size.Sm ? 'min-h-4 max-h-4 min-w-4 max-w-4' : ''}`,
|
|
44
|
+
// `${size === Size.Md ? 'min-h-5 max-h-5 min-w-5 max-w-5' : ''}`,
|
|
45
|
+
// `${disabled ? 'border-1 border-solid' : ''}`,
|
|
46
|
+
// `${disabled ? (checked ? 'bg-accent-2-8-Opacity border-transparent' : 'bg-background-active border-borders-secondary') : ''}`,
|
|
47
|
+
// cursorStyleClasses,
|
|
48
|
+
// ownTransitionClasses,
|
|
49
|
+
// )
|
|
50
|
+
//
|
|
51
|
+
// const inputClasses = cn('peer absolute top-0 left-0 z-1 m-0 h-full w-full p-0 opacity-0', cursorStyleClasses)
|
|
52
|
+
//
|
|
53
|
+
// const unCheckedIconClasses = cn('flex opacity-0', `${disabled ? '' : 'peer-hover:opacity-100'}`, ownTransitionClasses)
|
|
54
|
+
//
|
|
55
|
+
// return (
|
|
56
|
+
// <span className={checkBoxWrapperClasses} ref={ref} {...rest}>
|
|
57
|
+
// <input
|
|
58
|
+
// type='checkbox'
|
|
59
|
+
// className={inputClasses}
|
|
60
|
+
// checked={checked}
|
|
61
|
+
// disabled={disabled}
|
|
62
|
+
// onChange={readOnly || disabled ? ignoreEvent : onChange}
|
|
63
|
+
// {...checkBoxProps}
|
|
64
|
+
// />
|
|
65
|
+
//
|
|
66
|
+
// {checked ? (
|
|
67
|
+
// getIcon({ size: getCheckboxIconSize(size), color: lightPalette[Color.ButtonPrimaryText] })
|
|
68
|
+
// ) : (
|
|
69
|
+
// <span className={unCheckedIconClasses}>
|
|
70
|
+
// {getIcon({ size: getCheckboxIconSize(size), color: lightPalette[Color.Accent_4_0_Opacity] })}
|
|
71
|
+
// </span>
|
|
72
|
+
// )}
|
|
73
|
+
// </span>
|
|
74
|
+
// )
|
|
75
|
+
// }
|
|
76
|
+
//
|
|
77
|
+
// export default CheckBox
|
package/core/check-box/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default } from './check-box.component'
|
|
1
|
+
// export { default } from './check-box.component'
|
|
2
|
+
// export type { CheckBoxProps } from './check-box.props'
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { CheckBoxGroupProps } from './check-box-group.props';
|
|
2
|
-
declare const CheckBoxGroup: ({ size, label, checkBoxProps, checkBoxGroupProps, readOnly, disabled, labelPosition, icon, checked, ref, ...rest }: CheckBoxGroupProps) => JSX.Element;
|
|
3
|
-
export default CheckBoxGroup;
|