@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.
Files changed (196) hide show
  1. package/core/accordion-header/accordion-header.component.js +1 -1
  2. package/core/arrow/arrow.component.js +3 -4
  3. package/core/arrow-tick/arrow-tick.component.js +3 -10
  4. package/core/button/button.component.d.ts +2 -2
  5. package/core/button/button.component.js +7 -5
  6. package/core/button/button.const.d.ts +15 -0
  7. package/core/button/button.const.js +4 -0
  8. package/core/button/button.types.d.ts +3 -4
  9. package/core/button/button.utils.d.ts +2 -3
  10. package/core/button/button.utils.js +11 -10
  11. package/core/button/components/end-icon.d.ts +5 -10
  12. package/core/button/components/end-icon.js +20 -14
  13. package/core/button/components/start-icon.d.ts +7 -8
  14. package/core/button/components/start-icon.js +29 -16
  15. package/core/check-box/check-box.component.d.ts +0 -3
  16. package/core/check-box/check-box.component.js +77 -62
  17. package/core/check-box/index.d.ts +0 -2
  18. package/core/check-box/index.js +2 -1
  19. package/core/check-box-group/check-box-group.component.d.ts +0 -3
  20. package/core/check-box-group/check-box-group.component.js +75 -74
  21. package/core/check-box-group/check-box-group.props.d.ts +0 -19
  22. package/core/check-box-group/check-box-group.props.js +23 -1
  23. package/core/check-box-group/index.d.ts +0 -2
  24. package/core/check-box-group/index.js +2 -1
  25. package/core/cross-button/cross-button.component.js +16 -14
  26. package/core/dot/dot.component.js +1 -3
  27. package/core/input/components/clear-icon.d.ts +6 -0
  28. package/core/input/components/clear-icon.js +12 -0
  29. package/core/input/components/copy-icon.d.ts +6 -0
  30. package/core/input/components/copy-icon.js +13 -0
  31. package/core/input/components/password-icon.d.ts +7 -0
  32. package/core/input/components/password-icon.js +24 -0
  33. package/core/input/components/render-icon.d.ts +7 -0
  34. package/core/input/components/render-icon.js +26 -0
  35. package/core/input/index.d.ts +1 -1
  36. package/core/input/input.component.d.ts +1 -1
  37. package/core/input/input.component.js +147 -207
  38. package/core/input/input.const.d.ts +6 -0
  39. package/core/input/input.const.js +6 -0
  40. package/core/input/{input.props.d.ts → input.types.d.ts} +22 -6
  41. package/core/input/input.types.js +16 -0
  42. package/core/input/input.utils.d.ts +2 -4
  43. package/core/input/input.utils.js +11 -28
  44. package/core/pagination/pagination.component.js +2 -2
  45. package/core/popper/popper.component.js +5 -42
  46. package/package.json +2 -2
  47. package/theme/README.md +1 -38
  48. package/theme/theme.css +5 -5
  49. package/utils/functions/index.d.ts +0 -3
  50. package/utils/functions/index.js +0 -3
  51. package/utils/types/color/index.d.ts +0 -2
  52. package/utils/types/color/index.js +2 -2
  53. package/utils/types/index.d.ts +0 -2
  54. package/utils/types/index.js +2 -2
  55. package/core/accordion/accordion.styles.d.ts +0 -6
  56. package/core/accordion/accordion.styles.js +0 -12
  57. package/core/accordion-details/accordion-details.styles.d.ts +0 -6
  58. package/core/accordion-details/accordion-details.styles.js +0 -12
  59. package/core/accordion-header/accordion-header.styles.d.ts +0 -19
  60. package/core/accordion-header/accordion-header.styles.js +0 -44
  61. package/core/arrow/arrow.mixin.d.ts +0 -6
  62. package/core/arrow/arrow.mixin.js +0 -4
  63. package/core/arrow/arrow.styles.d.ts +0 -9
  64. package/core/arrow/arrow.styles.js +0 -18
  65. package/core/arrow-tick/arrow-tick.mixin.d.ts +0 -6
  66. package/core/arrow-tick/arrow-tick.mixin.js +0 -4
  67. package/core/arrow-tick/arrow-tick.styles.d.ts +0 -7
  68. package/core/arrow-tick/arrow-tick.styles.js +0 -18
  69. package/core/check-box/check-box.mixin.d.ts +0 -4
  70. package/core/check-box/check-box.mixin.js +0 -8
  71. package/core/check-box/check-box.styles.d.ts +0 -19
  72. package/core/check-box/check-box.styles.js +0 -42
  73. package/core/check-box-group/check-box-group.mixin.d.ts +0 -5
  74. package/core/check-box-group/check-box-group.mixin.js +0 -10
  75. package/core/check-box-group/check-box-group.styles.d.ts +0 -19
  76. package/core/check-box-group/check-box-group.styles.js +0 -33
  77. package/core/cross-button/cross-button.styles.d.ts +0 -9
  78. package/core/cross-button/cross-button.styles.js +0 -21
  79. package/core/dot/dot.styles.d.ts +0 -18
  80. package/core/dot/dot.styles.js +0 -32
  81. package/core/dots-navigation/dots-navigation.styles.d.ts +0 -6
  82. package/core/dots-navigation/dots-navigation.styles.js +0 -15
  83. package/core/input/input.mixin.d.ts +0 -18
  84. package/core/input/input.mixin.js +0 -25
  85. package/core/input/input.props.js +0 -1
  86. package/core/input/input.styles.d.ts +0 -78
  87. package/core/input/input.styles.js +0 -148
  88. package/core/input/types/index.d.ts +0 -1
  89. package/core/input/types/index.js +0 -1
  90. package/core/input/types/type.d.ts +0 -4
  91. package/core/input/types/type.js +0 -4
  92. package/core/modal/modal.mixin.d.ts +0 -7
  93. package/core/modal/modal.mixin.js +0 -4
  94. package/core/modal/modal.styles.d.ts +0 -22
  95. package/core/modal/modal.styles.js +0 -51
  96. package/core/modal-actions/modal-actions.styles.d.ts +0 -7
  97. package/core/modal-actions/modal-actions.styles.js +0 -17
  98. package/core/modal-content/modal-content.styles.d.ts +0 -6
  99. package/core/modal-content/modal-content.styles.js +0 -12
  100. package/core/modal-title/modal-title.styles.d.ts +0 -31
  101. package/core/modal-title/modal-title.styles.js +0 -64
  102. package/core/pagination/pagination.styles.d.ts +0 -19
  103. package/core/pagination/pagination.styles.js +0 -36
  104. package/core/popper/popper.mixin.d.ts +0 -17
  105. package/core/popper/popper.mixin.js +0 -5
  106. package/core/popper/popper.styles.d.ts +0 -25
  107. package/core/popper/popper.styles.js +0 -48
  108. package/core/radio/radio.mixin.d.ts +0 -13
  109. package/core/radio/radio.mixin.js +0 -13
  110. package/core/radio/radio.styles.d.ts +0 -19
  111. package/core/radio/radio.styles.js +0 -44
  112. package/core/radio-group/radio-group.styles.d.ts +0 -14
  113. package/core/radio-group/radio-group.styles.js +0 -30
  114. package/core/switcher/switcher.mixin.d.ts +0 -21
  115. package/core/switcher/switcher.mixin.js +0 -17
  116. package/core/switcher/switcher.styles.d.ts +0 -27
  117. package/core/switcher/switcher.styles.js +0 -54
  118. package/core/switcher-group/switcher-group.styles.d.ts +0 -10
  119. package/core/switcher-group/switcher-group.styles.js +0 -30
  120. package/core/tab/tab.mixin.d.ts +0 -11
  121. package/core/tab/tab.mixin.js +0 -15
  122. package/core/tab/tab.styles.d.ts +0 -26
  123. package/core/tab/tab.styles.js +0 -61
  124. package/core/tab-panel/tab-panel.styles.d.ts +0 -6
  125. package/core/tab-panel/tab-panel.styles.js +0 -12
  126. package/core/upload-input/upload-input.styles.d.ts +0 -11
  127. package/core/upload-input/upload-input.styles.js +0 -53
  128. package/theme/entity/index.d.ts +0 -1
  129. package/theme/entity/index.js +0 -1
  130. package/theme/entity/theme.d.ts +0 -34
  131. package/theme/hooks/index.d.ts +0 -2
  132. package/theme/hooks/index.js +0 -2
  133. package/theme/hooks/use-media-query.d.ts +0 -1
  134. package/theme/hooks/use-media-query.js +0 -27
  135. package/theme/hooks/use-theme.d.ts +0 -2
  136. package/theme/hooks/use-theme.js +0 -4
  137. package/theme/index.d.ts +0 -3
  138. package/theme/index.js +0 -1
  139. package/theme/roots/breakpoints/entity/breakpoints-map.d.ts +0 -8
  140. package/theme/roots/breakpoints/entity/breakpoints.d.ts +0 -73
  141. package/theme/roots/breakpoints/entity/create-breakpoints.d.ts +0 -3
  142. package/theme/roots/breakpoints/entity/create-breakpoints.js +0 -65
  143. package/theme/roots/breakpoints/entity/default-breakpoints.d.ts +0 -26
  144. package/theme/roots/breakpoints/entity/default-breakpoints.js +0 -22
  145. package/theme/roots/breakpoints/entity/index.d.ts +0 -3
  146. package/theme/roots/breakpoints/entity/index.js +0 -2
  147. package/theme/roots/breakpoints/index.d.ts +0 -3
  148. package/theme/roots/breakpoints/index.js +0 -1
  149. package/theme/roots/common-styles.d.ts +0 -2
  150. package/theme/roots/common-styles.js +0 -6
  151. package/theme/roots/index.d.ts +0 -2
  152. package/theme/roots/index.js +0 -2
  153. package/theme/roots/palette/entity/colors-map.d.ts +0 -4
  154. package/theme/roots/palette/entity/default-palette.d.ts +0 -282
  155. package/theme/roots/palette/entity/default-palette.js +0 -22
  156. package/theme/roots/palette/entity/index.d.ts +0 -2
  157. package/theme/roots/palette/entity/index.js +0 -2
  158. package/theme/roots/palette/index.d.ts +0 -2
  159. package/theme/roots/palette/index.js +0 -1
  160. package/theme/roots/shadows/entity/default-shadows.d.ts +0 -16
  161. package/theme/roots/shadows/entity/default-shadows.js +0 -5
  162. package/theme/roots/shadows/entity/index.d.ts +0 -2
  163. package/theme/roots/shadows/entity/index.js +0 -2
  164. package/theme/roots/shadows/entity/shadows-map.d.ts +0 -4
  165. package/theme/roots/shadows/index.d.ts +0 -2
  166. package/theme/roots/shadows/index.js +0 -1
  167. package/theme/roots/shape/index.d.ts +0 -1
  168. package/theme/roots/shape/index.js +0 -1
  169. package/theme/roots/shape/shape.props.d.ts +0 -5
  170. package/theme/roots/shape/shape.props.js +0 -1
  171. package/theme/roots/typography/entity/default-typography.d.ts +0 -398
  172. package/theme/roots/typography/entity/default-typography.js +0 -237
  173. package/theme/roots/typography/entity/index.d.ts +0 -1
  174. package/theme/roots/typography/entity/index.js +0 -1
  175. package/theme/roots/typography/index.d.ts +0 -3
  176. package/theme/roots/typography/index.js +0 -2
  177. package/theme/roots/typography/typography.component.d.ts +0 -2
  178. package/theme/roots/typography/typography.component.js +0 -7
  179. package/theme/roots/typography/typography.props.d.ts +0 -15
  180. package/theme/roots/typography/typography.props.js +0 -1
  181. package/theme/theme-provider/index.d.ts +0 -2
  182. package/theme/theme-provider/index.js +0 -1
  183. package/theme/theme-provider/theme-provider.context.d.ts +0 -4
  184. package/theme/theme-provider/theme-provider.context.js +0 -48
  185. package/theme/theme-provider/theme-provider.props.d.ts +0 -6
  186. package/theme/theme-provider/theme-provider.props.js +0 -1
  187. package/utils/functions/color-picker/map-number.d.ts +0 -1
  188. package/utils/functions/color-picker/map-number.js +0 -3
  189. package/utils/functions/color-picker/restrict-number.d.ts +0 -1
  190. package/utils/functions/color-picker/restrict-number.js +0 -8
  191. package/utils/functions/scrollbar.d.ts +0 -2
  192. package/utils/functions/scrollbar.js +0 -6
  193. package/utils/types/size/index.d.ts +0 -1
  194. package/utils/types/size/index.js +0 -1
  195. package/utils/types/size/input-size.d.ts +0 -4
  196. 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: 11
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: ArrowClasses
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: arrowClasses
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" | "link-primary" | "outline" | "link-secondary" | "link-basic-primary" | "link-basic-secondary" | "link-error" | "link-warning" | "error-primary" | "error-outline" | "warning-primary" | "warning-outline" | null | undefined;
5
- size?: "sm" | "md" | "xs" | "lg" | null | undefined;
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 { getIconSize, isLinkBasicVariant } 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/90'), ButtonVariant.Secondary, 'border bg-background shadow-xs text-primary border-primary hover:bg-primary/90 hover:text-primary-foreground'), ButtonVariant.Outline, 'border bg-background text-secondary-foreground shadow-xs border-secondary-foreground hover:text-secondary-foreground/80 hover:border-secondary-foreground/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-secondary-foreground 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-secondary-foreground hover:bg-warning hover:text-primary-foreground hover:border-transparent hover:border-warning'));
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-50 [&_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", {
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', isLinkBasicVariant(variant) && 'font-normal'),
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: getIconSize(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, ReactNode } from 'react';
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?: ReactNode | ((props: IconProps) => ReactNode);
23
- endIcon?: ReactNode | ((props: IconProps) => ReactNode);
21
+ startIcon?: ReactElement;
22
+ endIcon?: ReactElement;
24
23
  loading?: boolean;
25
24
  disabled?: boolean;
26
25
  }
@@ -1,3 +1,2 @@
1
- import { ButtonSizeType, ButtonVariantType } from '@scaleflex/ui-tw/core/button/button.types';
2
- export declare const getIconSize: (sizeName?: ButtonSizeType | null) => number;
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, ButtonVariant } from '@scaleflex/ui-tw/core/button/button.types';
2
- export var getIconSize = function getIconSize(sizeName) {
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 18;
5
+ return '1.125rem';
6
+ // 18px
6
7
  case ButtonSize.Md:
7
- return 16;
8
+ return '1rem';
9
+ // 16px
8
10
  case ButtonSize.Sm:
9
- return 14;
11
+ return '0.875rem';
12
+ // 14px
10
13
  case ButtonSize.Xs:
11
- return 12;
14
+ return '0.75rem';
15
+ // 12px
12
16
  default:
13
- return 16;
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 VariantProps } from 'class-variance-authority';
2
- import React, { ComponentProps, ReactNode } from 'react';
3
- declare const endIconVariants: (props?: ({
4
- size?: "sm" | "md" | "xs" | "lg" | null | undefined;
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 { getIconSize } from '@scaleflex/ui-tw/core/button/button.utils';
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-0.5'), ButtonSize.Sm, 'ml-1'), ButtonSize.Md, 'ml-1.5'), ButtonSize.Lg, 'ml-2');
10
- var endIconVariants = cva('flex', {
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 iconSize = useMemo(function () {
23
- return getIconSize(size);
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), typeof icon === 'function' ? icon({
30
- size: iconSize
31
- }) : icon);
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 VariantProps } from 'class-variance-authority';
2
- import React, { ComponentProps, ReactNode } from 'react';
1
+ import { type ButtonProps } from '@scaleflex/ui-tw/core/button';
2
+ import React, { ComponentProps, ReactElement } from 'react';
3
3
  declare const startIconVariants: (props?: ({
4
- size?: "sm" | "md" | "xs" | "lg" | null | undefined;
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'>, VariantProps<typeof startIconVariants> {
7
- icon?: ReactNode | ((props: {
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 { getIconSize } from '@scaleflex/ui-tw/core/button/button.utils';
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-0.5'), ButtonSize.Sm, 'mr-1'), ButtonSize.Md, 'mr-1.5'), ButtonSize.Lg, 'mr-2');
11
- var startIconVariants = cva('flex', {
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 iconSize = useMemo(function () {
26
- return getIconSize(size);
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: iconSize,
34
- className: "animate-spin"
35
- }) : typeof icon === 'function' ? icon({
36
- size: iconSize
37
- }) : icon);
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,3 +0,0 @@
1
- import type { CheckBoxProps } from './check-box.props';
2
- declare const CheckBox: ({ size, type, checked, onChange, checkBoxProps, readOnly, disabled, ref, ...rest }: CheckBoxProps) => JSX.Element;
3
- export default CheckBox;
@@ -1,62 +1,77 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["size", "type", "checked", "onChange", "checkBoxProps", "readOnly", "disabled", "ref"];
4
- import Intermediate from '@scaleflex/icons-tw/intermediate';
5
- import Tick from '@scaleflex/icons-tw/tick';
6
- import React from 'react';
7
- import { lightPalette } from '../../theme/roots/palette';
8
- import { ignoreEvent } from '../../utils/functions';
9
- import { cn } from '../../utils/functions/shadcn-utils';
10
- import { Color } from '../../utils/types/palette';
11
- import { getCheckboxIconSize } from './check-box.utils';
12
- import { Size, Type } from './types';
13
- var CheckBox = function CheckBox(_ref) {
14
- var _ref$size = _ref.size,
15
- size = _ref$size === void 0 ? Size.Md : _ref$size,
16
- _ref$type = _ref.type,
17
- type = _ref$type === void 0 ? Type.Checkbox : _ref$type,
18
- _ref$checked = _ref.checked,
19
- checked = _ref$checked === void 0 ? false : _ref$checked,
20
- onChange = _ref.onChange,
21
- checkBoxProps = _ref.checkBoxProps,
22
- _ref$readOnly = _ref.readOnly,
23
- readOnly = _ref$readOnly === void 0 ? false : _ref$readOnly,
24
- _ref$disabled = _ref.disabled,
25
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
26
- ref = _ref.ref,
27
- rest = _objectWithoutProperties(_ref, _excluded);
28
- var getIcon = function getIcon(props) {
29
- switch (type) {
30
- case Type.Checkbox:
31
- return /*#__PURE__*/React.createElement(Tick, props);
32
- case Type.Intermediate:
33
- return /*#__PURE__*/React.createElement(Intermediate, props);
34
- default:
35
- return /*#__PURE__*/React.createElement(Tick, props);
36
- }
37
- };
38
- var cursorStyleClasses = disabled ? 'cursor-default' : 'cursor-pointer';
39
- var ownTransitionClasses = 'transition-all duration-100 ease-out';
40
- var checkBoxWrapperClasses = cn('relative flex items-center justify-center border-1 border-solid border-borders-secondary', "".concat(checked ? 'bg-accent-primary border-accent-primary' : 'bg-background-stateless border-borders-primary-stateless'), "".concat(size === Size.Sm ? 'min-h-4 max-h-4 min-w-4 max-w-4' : ''), "".concat(size === Size.Md ? 'min-h-5 max-h-5 min-w-5 max-w-5' : ''), "".concat(disabled ? 'border-1 border-solid' : ''), "".concat(disabled ? checked ? 'bg-accent-2-8-Opacity border-transparent' : 'bg-background-active border-borders-secondary' : ''), cursorStyleClasses, ownTransitionClasses);
41
- var inputClasses = cn('peer absolute top-0 left-0 z-1 m-0 h-full w-full p-0 opacity-0', cursorStyleClasses);
42
- var unCheckedIconClasses = cn('flex opacity-0', "".concat(disabled ? '' : 'peer-hover:opacity-100'), ownTransitionClasses);
43
- return /*#__PURE__*/React.createElement("span", _extends({
44
- className: checkBoxWrapperClasses,
45
- ref: ref
46
- }, rest), /*#__PURE__*/React.createElement("input", _extends({
47
- type: "checkbox",
48
- className: inputClasses,
49
- checked: checked,
50
- disabled: disabled,
51
- onChange: readOnly || disabled ? ignoreEvent : onChange
52
- }, checkBoxProps)), checked ? getIcon({
53
- size: getCheckboxIconSize(size),
54
- color: lightPalette[Color.ButtonPrimaryText]
55
- }) : /*#__PURE__*/React.createElement("span", {
56
- className: unCheckedIconClasses
57
- }, getIcon({
58
- size: getCheckboxIconSize(size),
59
- color: lightPalette[Color.Accent_4_0_Opacity]
60
- })));
61
- };
62
- export default CheckBox;
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
@@ -1,2 +0,0 @@
1
- export { default } from './check-box.component';
2
- export type { CheckBoxProps } from './check-box.props';
@@ -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;