@veracity/vui 0.2.0 → 0.2.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 (134) hide show
  1. package/avatar/avatar.js +5 -5
  2. package/avatar/theme.d.ts +5 -9
  3. package/avatar/theme.js +5 -18
  4. package/box/box.js +6 -6
  5. package/button/button.js +19 -23
  6. package/button/button.types.d.ts +33 -3
  7. package/button/buttonIcon.js +3 -3
  8. package/button/buttonText.js +3 -3
  9. package/button/buttons.js +8 -8
  10. package/button/context.js +1 -1
  11. package/button/theme.js +1 -6
  12. package/buttonGroup/buttonGroup.js +5 -10
  13. package/buttonGroup/context.js +1 -1
  14. package/card/card.js +4 -4
  15. package/checkbox/checkbox.js +13 -12
  16. package/checkbox/checkbox.types.d.ts +1 -1
  17. package/checkbox/checkboxGroup.js +7 -7
  18. package/checkbox/checkboxGroup.types.d.ts +2 -2
  19. package/checkbox/context.js +1 -1
  20. package/checkbox/theme.js +5 -2
  21. package/core/globalStyle.js +6 -8
  22. package/core/index.d.ts +1 -2
  23. package/core/index.js +2 -5
  24. package/core/resetCSS.js +2 -2
  25. package/core/styled.d.ts +192 -4
  26. package/core/styled.js +55 -13
  27. package/core/types/component.d.ts +2 -7
  28. package/core/types/index.d.ts +0 -2
  29. package/core/types/index.js +0 -2
  30. package/core/utils.d.ts +2 -2
  31. package/core/utils.js +13 -12
  32. package/divider/divider.js +6 -6
  33. package/heading/heading.js +6 -6
  34. package/heading/headings.js +6 -6
  35. package/icon/icon.js +6 -6
  36. package/icon/icon.types.d.ts +1 -2
  37. package/icons/library.js +9 -5
  38. package/icons/types.d.ts +1 -1
  39. package/image/image.js +4 -4
  40. package/input/context.js +1 -1
  41. package/input/input.js +11 -16
  42. package/input/input.types.d.ts +1 -2
  43. package/input/inputIcon.js +3 -3
  44. package/input/inputInput.js +4 -4
  45. package/link/context.d.ts +4 -0
  46. package/link/context.js +23 -0
  47. package/link/index.d.ts +2 -0
  48. package/link/index.js +2 -0
  49. package/link/link.d.ts +7 -1
  50. package/link/link.js +35 -7
  51. package/link/link.types.d.ts +5 -0
  52. package/link/linkIcon.d.ts +3 -0
  53. package/link/linkIcon.js +30 -0
  54. package/link/linkText.d.ts +3 -0
  55. package/link/linkText.js +30 -0
  56. package/link/theme.d.ts +27 -10
  57. package/link/theme.js +26 -12
  58. package/list/context.js +1 -1
  59. package/list/index.d.ts +1 -0
  60. package/list/index.js +1 -0
  61. package/list/list.d.ts +2 -0
  62. package/list/list.js +8 -11
  63. package/list/listDivider.d.ts +3 -0
  64. package/list/listDivider.js +30 -0
  65. package/list/listHeading.js +4 -4
  66. package/list/listIcon.js +3 -3
  67. package/list/listItem.js +8 -8
  68. package/list/listText.js +3 -3
  69. package/list/theme.d.ts +0 -16
  70. package/list/theme.js +6 -22
  71. package/notification/context.js +1 -1
  72. package/notification/notification.js +6 -11
  73. package/notification/notificationButton.js +3 -3
  74. package/notification/notificationIcon.js +3 -3
  75. package/notification/notificationText.js +3 -3
  76. package/notification/notificationTitle.js +3 -3
  77. package/p/p.js +6 -6
  78. package/package.json +1 -1
  79. package/panel/panel.js +4 -4
  80. package/radio/context.js +1 -1
  81. package/radio/radio.js +58 -13
  82. package/radio/radio.types.d.ts +1 -1
  83. package/radio/radioGroup.js +24 -17
  84. package/radio/radioGroup.types.d.ts +2 -2
  85. package/radio/theme.js +5 -2
  86. package/skeleton/skeleton.js +6 -6
  87. package/spinner/spinner.js +5 -5
  88. package/svg/svg.js +12 -12
  89. package/switch/context.js +1 -1
  90. package/switch/switch.js +12 -50
  91. package/switch/switch.types.d.ts +3 -3
  92. package/switch/switchButton.js +19 -21
  93. package/switch/switchLabel.js +3 -3
  94. package/switch/theme.d.ts +0 -5
  95. package/switch/theme.js +4 -9
  96. package/system/custom.d.ts +7 -20
  97. package/system/custom.js +19 -25
  98. package/system/system.d.ts +4 -3
  99. package/system/system.js +2 -2
  100. package/system/tables.d.ts +14 -0
  101. package/t/t.js +6 -6
  102. package/tag/context.js +1 -1
  103. package/tag/index.d.ts +1 -0
  104. package/tag/index.js +1 -0
  105. package/tag/tag.d.ts +2 -0
  106. package/tag/tag.js +16 -13
  107. package/tag/tag.types.d.ts +2 -0
  108. package/tag/tagButton.d.ts +3 -0
  109. package/tag/tagButton.js +41 -0
  110. package/tag/tagIcon.js +3 -3
  111. package/tag/tagText.js +3 -3
  112. package/tag/theme.d.ts +26 -0
  113. package/tag/theme.js +32 -3
  114. package/textarea/textarea.js +9 -9
  115. package/textarea/textarea.types.d.ts +1 -1
  116. package/theme/components.d.ts +58 -39
  117. package/theme/defaultTheme.d.ts +59 -39
  118. package/theme/foundations/index.d.ts +1 -0
  119. package/theme/foundations/shadows.js +2 -2
  120. package/theme/foundations/transformers.d.ts +1 -0
  121. package/theme/foundations/transformers.js +26 -0
  122. package/theme/index.d.ts +16 -0
  123. package/theme/index.js +33 -1
  124. package/utils/assertion.js +1 -2
  125. package/utils/function.js +9 -5
  126. package/utils/object.d.ts +4 -1
  127. package/utils/object.js +27 -28
  128. package/utils/types.d.ts +23 -1
  129. package/core/types/events.d.ts +0 -17
  130. package/core/types/styled.d.ts +0 -11
  131. package/core/types/styled.js +0 -2
  132. package/core/v.d.ts +0 -182
  133. package/core/v.js +0 -6
  134. /package/{core/types/events.js → system/tables.js} +0 -0
@@ -71,27 +71,34 @@ var context_1 = require("./context");
71
71
  var core_1 = require("../core");
72
72
  var system_1 = require("../system");
73
73
  var utils_1 = require("../utils");
74
- exports.RadioGroupBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"])), system_1.system);
75
- exports.RadioGroup = core_1.vui(function (props, ref) {
76
- var className = props.className, colorScheme = props.colorScheme, _a = props.defaultValue, defaultValue = _a === void 0 ? '' : _a, disabled = props.disabled, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, row = props.row, size = props.size, valueProp = props.value, variant = props.variant, rest = __rest(props, ["className", "colorScheme", "defaultValue", "disabled", "name", "onBlur", "onChange", "onFocus", "row", "size", "value", "variant"]);
77
- var isControlled = react_1.useRef(valueProp !== undefined).current;
78
- var _b = __read(react_1.useState(defaultValue), 2), valueState = _b[0], setValueState = _b[1];
79
- var value = isControlled ? valueProp : valueState;
80
- var handleOnChange = react_1.useCallback(function (e) {
81
- setValue(e.target.value);
74
+ exports.RadioGroupBase = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"], ["\n\tdisplay: flex;\n\tflex-direction: column;\n\n\t", "\n"])), system_1.system);
75
+ exports.RadioGroup = (0, core_1.vui)(function (props, ref) {
76
+ var className = props.className, colorScheme = props.colorScheme, defaultValue = props.defaultValue, disabled = props.disabled, isRow = props.isRow, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, size = props.size, value = props.value, variant = props.variant, rest = __rest(props, ["className", "colorScheme", "defaultValue", "disabled", "isRow", "name", "onBlur", "onChange", "onFocus", "size", "value", "variant"]);
77
+ var _a = __read((0, react_1.useState)(value !== null && value !== void 0 ? value : defaultValue), 2), isChecked = _a[0], setIsChecked = _a[1];
78
+ var handleOnChange = (0, react_1.useCallback)(function (e) {
79
+ setIsChecked(e.target.value);
82
80
  onChange === null || onChange === void 0 ? void 0 : onChange(e);
83
81
  }, [onChange]);
84
- var setValue = react_1.useCallback(function (value) {
85
- !isControlled && setValueState(value);
86
- }, []);
87
- var context = react_1.useMemo(function () {
88
- return utils_1.filterUndefined({ colorScheme: colorScheme, disabled: disabled, name: name, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus, size: size, value: value, variant: variant });
89
- }, [colorScheme, disabled, name, handleOnChange, onBlur, onFocus, size, value, variant]);
90
- var aliasedProps = utils_1.filterUndefined({
91
- flexDirection: row ? 'row' : undefined
82
+ var context = (0, react_1.useMemo)(function () {
83
+ return (0, utils_1.filterUndefined)({
84
+ colorScheme: colorScheme,
85
+ defaultValue: defaultValue,
86
+ disabled: disabled,
87
+ isChecked: isChecked,
88
+ name: name,
89
+ onBlur: onBlur,
90
+ onChange: handleOnChange,
91
+ onFocus: onFocus,
92
+ size: size,
93
+ value: value,
94
+ variant: variant
95
+ });
96
+ }, [colorScheme, defaultValue, disabled, handleOnChange, isChecked, name, onBlur, onFocus, size, value, variant]);
97
+ var aliasedProps = (0, utils_1.filterUndefined)({
98
+ flexDirection: isRow ? 'row' : undefined
92
99
  });
93
100
  return (react_1.default.createElement(context_1.RadioGroupProvider, { value: context },
94
- react_1.default.createElement(exports.RadioGroupBase, __assign({ className: utils_1.cs('vui-radioGroup', className), ref: ref }, aliasedProps, rest))));
101
+ react_1.default.createElement(exports.RadioGroupBase, __assign({ className: (0, utils_1.cs)('vui-radioGroup', className), ref: ref }, aliasedProps, rest))));
95
102
  });
96
103
  exports.RadioGroup.displayName = 'RadioGroup';
97
104
  exports.default = exports.RadioGroup;
@@ -1,13 +1,13 @@
1
- import { ChangeEventHandler, FocusEventHandler } from '../core';
2
1
  import { SystemProps } from '../system';
3
2
  import { ThemingProps } from '../theme';
3
+ import { ChangeEventHandler, FocusEventHandler } from '../utils';
4
4
  export interface RadioGroupProps extends SystemProps, ThemingProps<'Radio'> {
5
5
  colorScheme?: 'blue' | 'prussian';
6
6
  disabled?: boolean;
7
+ isRow?: boolean;
7
8
  name?: string;
8
9
  onBlur?: FocusEventHandler;
9
10
  onChange?: ChangeEventHandler;
10
11
  onFocus?: FocusEventHandler;
11
- row?: boolean;
12
12
  value?: number | string;
13
13
  }
package/radio/theme.js CHANGED
@@ -2,12 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function variantDefault(props) {
4
4
  var c = props.colorScheme;
5
- var controlStyles = {
5
+ var control = {
6
6
  color: c + ".80",
7
7
  hoverColor: c + ".90"
8
8
  };
9
+ if (c === 'prussian') {
10
+ control.hoverColor = 'prussian.70';
11
+ }
9
12
  return {
10
- control: controlStyles
13
+ control: control
11
14
  };
12
15
  }
13
16
  var defaultProps = {
@@ -35,15 +35,15 @@ var styled_components_1 = __importDefault(require("styled-components"));
35
35
  var core_1 = require("../core");
36
36
  var system_1 = require("../system");
37
37
  var utils_1 = require("../utils");
38
- exports.SkeletonBase = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tanimation: vui-pulse 1.5s ease-in-out 0.5s infinite;\n\n\t", "\n"], ["\n\tanimation: vui-pulse 1.5s ease-in-out 0.5s infinite;\n\n\t", "\n"])), system_1.system);
39
- exports.Skeleton = core_1.vui(function (props, ref) {
40
- var _a = core_1.omitThemingProps(props), className = _a.className, _b = _a.repeat, repeat = _b === void 0 ? 1 : _b, rest = __rest(_a, ["className", "repeat"]);
41
- var styles = core_1.useStyleConfig('Skeleton', props);
38
+ exports.SkeletonBase = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tanimation: vui-pulse 1.5s ease-in-out 0.5s infinite;\n\n\t", "\n"], ["\n\tanimation: vui-pulse 1.5s ease-in-out 0.5s infinite;\n\n\t", "\n"])), system_1.system);
39
+ exports.Skeleton = (0, core_1.vui)(function (props, ref) {
40
+ var _a = (0, core_1.omitThemingProps)(props), className = _a.className, _b = _a.repeat, repeat = _b === void 0 ? 1 : _b, rest = __rest(_a, ["className", "repeat"]);
41
+ var styles = (0, core_1.useStyleConfig)('Skeleton', props);
42
42
  var arr = Array(repeat).fill(0);
43
- var aliasedProps = utils_1.filterUndefined({
43
+ var aliasedProps = (0, utils_1.filterUndefined)({
44
44
  w: props.variant === 'circle' ? styles.h : undefined
45
45
  });
46
- return (react_1.default.createElement(react_1.default.Fragment, null, arr.map(function (_, i) { return (react_1.default.createElement(exports.SkeletonBase, __assign({ className: utils_1.cs('vui-skeleton', className), key: i, ref: ref }, styles, aliasedProps, rest))); })));
46
+ return (react_1.default.createElement(react_1.default.Fragment, null, arr.map(function (_, i) { return (react_1.default.createElement(exports.SkeletonBase, __assign({ className: (0, utils_1.cs)('vui-skeleton', className), key: i, ref: ref }, styles, aliasedProps, rest))); })));
47
47
  });
48
48
  exports.Skeleton.displayName = 'Skeleton';
49
49
  exports.default = exports.Skeleton;
@@ -38,21 +38,21 @@ var core_1 = require("../core");
38
38
  var system_1 = require("../system");
39
39
  var t_1 = __importDefault(require("../t"));
40
40
  var utils_1 = require("../utils");
41
- exports.SpinnerCircle = styled_components_1.default.div.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-shrink: 0;\n\n\t", "\n\n\tanimation-duration: ", ";\n"], ["\n\tdisplay: flex;\n\tflex-shrink: 0;\n\n\t", "\n\n\tanimation-duration: ", ";\n"])), system_1.system, function (p) { return p.speed; });
42
- exports.Spinner = core_1.vui(function (props, ref) {
41
+ exports.SpinnerCircle = styled_components_1.default.div.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tdisplay: flex;\n\tflex-shrink: 0;\n\n\t", "\n\n\tanimation-duration: ", ";\n"], ["\n\tdisplay: flex;\n\tflex-shrink: 0;\n\n\t", "\n\n\tanimation-duration: ", ";\n"])), system_1.system, function (p) { return p.speed; });
42
+ exports.Spinner = (0, core_1.vui)(function (props, ref) {
43
43
  var _a;
44
44
  var className = props.className, emptyColor = props.emptyColor, size = props.size, _b = props.speed, speedProp = _b === void 0 ? 'normal' : _b, text = props.text, _c = props.textPosition, textPosition = _c === void 0 ? 'bottom' : _c, thickness = props.thickness, rest = __rest(props, ["className", "emptyColor", "size", "speed", "text", "textPosition", "thickness"]);
45
- var styles = core_1.useStyleConfig('Spinner', props);
45
+ var styles = (0, core_1.useStyleConfig)('Spinner', props);
46
46
  var isCustomSize = typeof size === 'number';
47
47
  var positionProps = consts_1.spinnerPositionMapping[textPosition];
48
48
  var speed = (_a = consts_1.spinnerSpeedMapping[speedProp]) !== null && _a !== void 0 ? _a : speedProp;
49
- var circleProps = utils_1.filterUndefined({
49
+ var circleProps = (0, utils_1.filterUndefined)({
50
50
  borderColor: emptyColor,
51
51
  borderWidth: isCustomSize ? thickness !== null && thickness !== void 0 ? thickness : 4 : thickness,
52
52
  h: isCustomSize ? size : undefined,
53
53
  w: isCustomSize ? size : undefined
54
54
  });
55
- return (react_1.default.createElement(box_1.default, __assign({ center: true, className: utils_1.cs('vui-spinner', className), ref: ref, transitionDuration: "fast" }, styles.container, positionProps.container, rest),
55
+ return (react_1.default.createElement(box_1.default, __assign({ center: true, className: (0, utils_1.cs)('vui-spinner', className), ref: ref, transitionDuration: "fast" }, styles.container, positionProps.container, rest),
56
56
  react_1.default.createElement(exports.SpinnerCircle, __assign({ animation: "spin", borderRadius: "round", className: "vui-spinnerCircle", speed: speed }, styles.circle, positionProps.circle, circleProps)),
57
57
  text && (react_1.default.createElement(t_1.default, __assign({ className: "vui-spinnerText" }, styles.text), text))));
58
58
  });
package/svg/svg.js CHANGED
@@ -108,21 +108,21 @@ var helpers_1 = require("./helpers");
108
108
  var core_1 = require("../core");
109
109
  var system_1 = require("../system");
110
110
  var utils_1 = require("../utils");
111
- exports.SvgBase = styled_components_1.default.svg.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n\n\t", "\n"], ["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n\n\t", "\n"])), function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); }, function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); }, system_1.system);
112
- exports.Svg = core_1.vui(function (props, ref) {
111
+ exports.SvgBase = styled_components_1.default.svg.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n\n\t", "\n"], ["\n\t& > path:nth-child(1) {\n\t\tfill: ", ";\n\t}\n\n\t& > path:nth-child(2) {\n\t\tfill: ", ";\n\t}\n\n\t", "\n"])), function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); }, function (p) { var _a, _b, _c; return core_1.th.color((_c = (_b = (_a = p.fill) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : p.fill) !== null && _c !== void 0 ? _c : '')(p); }, system_1.system);
112
+ exports.Svg = (0, core_1.vui)(function (props, ref) {
113
113
  var children = props.children, className = props.className, src = props.src, rest = __rest(props, ["children", "className", "src"]);
114
- var _a = __read(react_1.useState(helpers_1.initState()), 2), state = _a[0], setState = _a[1];
115
- var isMountedRef = react_1.useRef(false);
116
- var srcRef = react_1.useRef(src);
114
+ var _a = __read((0, react_1.useState)((0, helpers_1.initState)()), 2), state = _a[0], setState = _a[1];
115
+ var isMountedRef = (0, react_1.useRef)(false);
116
+ var srcRef = (0, react_1.useRef)(src);
117
117
  var _b = state.content, content = _b === void 0 ? '' : _b, _c = state.svgAttributes, svgAttributes = _c === void 0 ? {} : _c;
118
118
  var innerHTML = !children ? { __html: content } : undefined;
119
- react_1.useEffect(function () {
119
+ (0, react_1.useEffect)(function () {
120
120
  isMountedRef.current = true;
121
121
  return function () {
122
122
  isMountedRef.current = false;
123
123
  };
124
124
  }, []);
125
- react_1.useEffect(function () {
125
+ (0, react_1.useEffect)(function () {
126
126
  srcRef.current = src;
127
127
  function loadSvg(src) {
128
128
  return __awaiter(this, void 0, void 0, function () {
@@ -134,9 +134,9 @@ exports.Svg = core_1.vui(function (props, ref) {
134
134
  return [4 /*yield*/, cache_1.default.get(src)];
135
135
  case 1:
136
136
  response = _a.sent();
137
- content_1 = helpers_1.getSvgContent(response);
138
- svgEl = helpers_1.stringToHTML(response);
139
- svgAttributes_1 = helpers_1.getAttributes(svgEl);
137
+ content_1 = (0, helpers_1.getSvgContent)(response);
138
+ svgEl = (0, helpers_1.stringToHTML)(response);
139
+ svgAttributes_1 = (0, helpers_1.getAttributes)(svgEl);
140
140
  svgAttributes_1['data-src'] = src !== null && src !== void 0 ? src : '';
141
141
  // Update state only when requested 'src' and current 'src' are the same
142
142
  if (srcRef.current === src && isMountedRef.current) {
@@ -147,7 +147,7 @@ exports.Svg = core_1.vui(function (props, ref) {
147
147
  error_1 = _a.sent();
148
148
  console.error(error_1); // eslint-disable-line no-console
149
149
  if (isMountedRef.current) {
150
- setState(helpers_1.initState());
150
+ setState((0, helpers_1.initState)());
151
151
  }
152
152
  return [3 /*break*/, 3];
153
153
  case 3: return [2 /*return*/];
@@ -157,7 +157,7 @@ exports.Svg = core_1.vui(function (props, ref) {
157
157
  }
158
158
  src && loadSvg(src);
159
159
  }, [src]);
160
- return (react_1.default.createElement(exports.SvgBase, __assign({ className: utils_1.cs('vui-svg', className), dangerouslySetInnerHTML: innerHTML, ref: ref, xmlns: "http://www.w3.org/2000/svg" }, svgAttributes, rest), children));
160
+ return (react_1.default.createElement(exports.SvgBase, __assign({ className: (0, utils_1.cs)('vui-svg', className), dangerouslySetInnerHTML: innerHTML, ref: ref, xmlns: "http://www.w3.org/2000/svg" }, svgAttributes, rest), children));
161
161
  });
162
162
  exports.Svg.displayName = 'Svg';
163
163
  exports.default = exports.Svg;
package/switch/context.js CHANGED
@@ -18,6 +18,6 @@ var __read = (this && this.__read) || function (o, n) {
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
19
  exports.useSwitch = exports.SwitchProvider = void 0;
20
20
  var core_1 = require("../core");
21
- var _a = __read(core_1.createContext({ isOptional: true }), 2), SwitchProvider = _a[0], useSwitch = _a[1];
21
+ var _a = __read((0, core_1.createContext)({ isOptional: true }), 2), SwitchProvider = _a[0], useSwitch = _a[1];
22
22
  exports.SwitchProvider = SwitchProvider;
23
23
  exports.useSwitch = useSwitch;
package/switch/switch.js CHANGED
@@ -44,22 +44,6 @@ var __rest = (this && this.__rest) || function (s, e) {
44
44
  }
45
45
  return t;
46
46
  };
47
- var __read = (this && this.__read) || function (o, n) {
48
- var m = typeof Symbol === "function" && o[Symbol.iterator];
49
- if (!m) return o;
50
- var i = m.call(o), r, ar = [], e;
51
- try {
52
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
53
- }
54
- catch (error) { e = { error: error }; }
55
- finally {
56
- try {
57
- if (r && !r.done && (m = i["return"])) m.call(i);
58
- }
59
- finally { if (e) throw e.error; }
60
- }
61
- return ar;
62
- };
63
47
  var __importDefault = (this && this.__importDefault) || function (mod) {
64
48
  return (mod && mod.__esModule) ? mod : { "default": mod };
65
49
  };
@@ -74,56 +58,34 @@ var core_1 = require("../core");
74
58
  var system_1 = require("../system");
75
59
  var t_1 = require("../t");
76
60
  var utils_1 = require("../utils");
77
- exports.SwitchBase = styled_components_1.default.label.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"])), t_1.TBase, system_1.system);
78
- exports.Switch = core_1.vui(function (props, ref) {
61
+ exports.SwitchBase = styled_components_1.default.label.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\talign-items: center;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tline-height: normal;\n\twidth: fit-content;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tcolor: var(--vui-colors-disabled-font);\n\t\t}\n\t}\n\n\t", "\n"])), t_1.TBase, system_1.system);
62
+ exports.Switch = (0, core_1.vui)(function (props, ref) {
79
63
  var _a;
80
64
  var button = props.button, checked = props.checked, children = props.children, className = props.className, colorScheme = props.colorScheme, defaultChecked = props.defaultChecked, disabled = props.disabled, id = props.id, innerLabelOff = props.innerLabelOff, innerLabelOn = props.innerLabelOn, inputRef = props.inputRef, labelLeft = props.labelLeft, labelRight = props.labelRight, name = props.name, onBlur = props.onBlur, onChange = props.onChange, onFocus = props.onFocus, required = props.required, size = props.size, value = props.value, variant = props.variant, rest = __rest(props, ["button", "checked", "children", "className", "colorScheme", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputRef", "labelLeft", "labelRight", "name", "onBlur", "onChange", "onFocus", "required", "size", "value", "variant"]);
81
- var _b = __read(react_1.useState(defaultChecked), 2), isChecked = _b[0], setIsChecked = _b[1];
82
- var styles = core_1.useStyleConfig('Switch', props);
83
- react_1.useEffect(function () {
84
- checked !== undefined && setIsChecked(checked);
85
- }, [checked]);
86
- var handleOnChange = react_1.useCallback(function (e) {
87
- setIsChecked(e.target.checked);
88
- onChange === null || onChange === void 0 ? void 0 : onChange(e);
89
- }, [onChange]);
90
- var context = react_1.useMemo(function () {
91
- return utils_1.filterUndefined({
65
+ var styles = (0, core_1.useStyleConfig)('Switch', props);
66
+ var context = (0, react_1.useMemo)(function () {
67
+ return (0, utils_1.filterUndefined)({
68
+ checked: checked,
92
69
  colorScheme: colorScheme,
93
70
  defaultChecked: defaultChecked,
94
71
  disabled: disabled,
95
- isChecked: isChecked,
96
72
  name: name,
97
73
  onBlur: onBlur,
98
- onChange: handleOnChange,
74
+ onChange: onChange,
99
75
  onFocus: onFocus,
100
76
  required: required,
101
77
  size: size,
102
78
  value: value,
103
79
  variant: variant
104
80
  });
105
- }, [
106
- colorScheme,
107
- defaultChecked,
108
- disabled,
109
- handleOnChange,
110
- isChecked,
111
- name,
112
- onBlur,
113
- onFocus,
114
- required,
115
- size,
116
- value,
117
- variant
118
- ]);
119
- var aliasedProps = utils_1.filterUndefined({
120
- 'data-checked': isChecked ? true : false,
81
+ }, [checked, colorScheme, defaultChecked, disabled, name, onBlur, onChange, onFocus, required, size, value, variant]);
82
+ var aliasedProps = (0, utils_1.filterUndefined)({
121
83
  'data-disabled': disabled ? true : false
122
84
  });
123
85
  return (react_1.default.createElement(context_1.SwitchProvider, { value: context },
124
- react_1.default.createElement(exports.SwitchBase, __assign({ className: utils_1.cs('vui-switch', className), ref: ref }, styles.container, aliasedProps, rest),
125
- utils_1.isReactText(labelLeft) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { mr: 1, text: labelLeft }) : labelLeft, (_a = children !== null && children !== void 0 ? children : button) !== null && _a !== void 0 ? _a : react_1.default.createElement(switchButton_1.SwitchButton, __assign({}, { id: id, innerLabelOff: innerLabelOff, innerLabelOn: innerLabelOn, inputRef: inputRef })),
126
- utils_1.isReactText(labelRight) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { ml: 1, text: labelRight }) : labelRight)));
86
+ react_1.default.createElement(exports.SwitchBase, __assign({ className: (0, utils_1.cs)('vui-switch', className), ref: ref }, styles.container, aliasedProps, rest),
87
+ (0, utils_1.isReactText)(labelLeft) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { mr: 1, text: labelLeft }) : labelLeft, (_a = children !== null && children !== void 0 ? children : button) !== null && _a !== void 0 ? _a : react_1.default.createElement(switchButton_1.SwitchButton, __assign({}, { id: id, innerLabelOff: innerLabelOff, innerLabelOn: innerLabelOn, inputRef: inputRef })),
88
+ (0, utils_1.isReactText)(labelRight) ? react_1.default.createElement(switchLabel_1.SwitchLabel, { ml: 1, text: labelRight }) : labelRight)));
127
89
  });
128
90
  exports.Switch.displayName = 'Switch';
129
91
  exports.Switch.Button = switchButton_1.SwitchButton;
@@ -1,10 +1,10 @@
1
1
  import { ReactNode, ReactText } from 'react';
2
- import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../core';
3
2
  import { SystemProps } from '../system';
4
3
  import { ThemingProps } from '../theme';
4
+ import { ChangeEventHandler, FocusEventHandler, PropsOf } from '../utils';
5
5
  export interface SwitchButtonProps extends SystemProps, ThemingProps<'Switch'> {
6
6
  checked?: boolean;
7
- colorScheme?: 'blue' | 'green' | 'prussian' | 'red';
7
+ colorScheme?: 'blue' | 'green' | 'prussian';
8
8
  disabled?: boolean;
9
9
  innerLabelOff?: ReactNode;
10
10
  innerLabelOn?: ReactNode;
@@ -20,7 +20,7 @@ export interface SwitchButtonProps extends SystemProps, ThemingProps<'Switch'> {
20
20
  export interface SwitchProps extends SystemProps, ThemingProps<'Switch'> {
21
21
  button?: ReactNode;
22
22
  checked?: boolean;
23
- colorScheme?: 'blue' | 'green' | 'prussian' | 'red';
23
+ colorScheme?: 'blue' | 'green' | 'prussian';
24
24
  disabled?: boolean;
25
25
  innerLabelOff?: ReactNode;
26
26
  innerLabelOn?: ReactNode;
@@ -71,25 +71,23 @@ var context_1 = require("./context");
71
71
  var core_1 = require("../core");
72
72
  var system_1 = require("../system");
73
73
  var utils_1 = require("../utils");
74
- exports.SwitchInput = styled_components_1.default.input.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n\n\t", "\n"], ["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n\n\t", "\n"])), system_1.system);
75
- exports.SwitchThumb = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\n\t", "\n"], ["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\n\t", "\n"])), system_1.system);
76
- exports.SwitchTrack = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\n\t", "\n"])), system_1.system);
77
- exports.SwitchButtonBase = styled_components_1.default.span.withConfig(core_1.forwardPropConfig(system_1.system))(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"])), exports.SwitchThumb, exports.SwitchTrack, system_1.system);
78
- exports.SwitchButton = core_1.vui(function (props, ref) {
74
+ exports.SwitchInput = styled_components_1.default.input.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n\n\t", "\n"], ["\n\tcursor: inherit;\n\theight: calc(100% + 10px);\n\tleft: -5px;\n\tmargin: 0;\n\topacity: 0;\n\tpadding: 0;\n\tposition: absolute;\n\ttop: -5px;\n\twidth: calc(100% + 10px);\n\tz-index: 1;\n\n\t", "\n"])), system_1.system);
75
+ exports.SwitchThumb = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\n\t", "\n"], ["\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: absolute;\n\n\t", "\n"])), system_1.system);
76
+ exports.SwitchTrack = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\n\t", "\n"], ["\n\talign-items: center;\n\tdisplay: inline-flex;\n\tflex: 1;\n\tposition: relative;\n\n\t", "\n"])), system_1.system);
77
+ exports.SwitchButtonBase = styled_components_1.default.span.withConfig((0, core_1.forwardPropConfig)(system_1.system))(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"], ["\n\tcolor: white;\n\tcursor: pointer;\n\tdisplay: inline-flex;\n\tflex-shrink: 0;\n\tposition: relative;\n\n\t&[data-disabled='true'] {\n\t\tcursor: not-allowed;\n\n\t\t", " {\n\t\t\tborder-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-font);\n\t\t}\n\n\t\t", " {\n\t\t\t--x-ring-color: var(--vui-colors-disabled-border);\n\t\t\tbackground-color: var(--vui-colors-disabled-bg);\n\t\t}\n\t}\n\n\t", "\n"])), exports.SwitchThumb, exports.SwitchTrack, system_1.system);
78
+ exports.SwitchButton = (0, core_1.vui)(function (props, ref) {
79
79
  var _a;
80
- var _b = (_a = context_1.useSwitch()) !== null && _a !== void 0 ? _a : {}, switchIsChecked = _b.isChecked, switchProps = __rest(_b, ["isChecked"]);
80
+ var switchProps = (_a = (0, context_1.useSwitch)()) !== null && _a !== void 0 ? _a : {};
81
81
  var mergedProps = __assign(__assign({}, switchProps), props);
82
- var _c = core_1.omitThemingProps(mergedProps), checked = _c.checked, className = _c.className, defaultChecked = _c.defaultChecked, disabled = _c.disabled, id = _c.id, innerLabelOff = _c.innerLabelOff, innerLabelOn = _c.innerLabelOn, inputProps = _c.inputProps, inputRef = _c.inputRef, name = _c.name, onBlur = _c.onBlur, onChange = _c.onChange, onFocus = _c.onFocus, required = _c.required, value = _c.value, rest = __rest(_c, ["checked", "className", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "required", "value"]);
83
- var _d = __read(react_1.useState(defaultChecked), 2), isChecked = _d[0], setIsChecked = _d[1];
84
- var _e = __read(react_1.useState(false), 2), isFocused = _e[0], setIsFocused = _e[1];
85
- var styles = core_1.useStyleConfig('Switch', mergedProps);
86
- var _f = styles.button, thumbStyles = _f.thumb, trackStyles = _f.track, buttonStyles = __rest(_f, ["thumb", "track"]);
87
- var isControlled = checked !== undefined || switchIsChecked !== undefined;
88
- react_1.useEffect(function () {
89
- if (isControlled) {
90
- setIsChecked(checked !== null && checked !== void 0 ? checked : switchIsChecked);
91
- }
92
- }, [checked, isControlled, switchIsChecked]);
82
+ var _b = (0, core_1.omitThemingProps)(mergedProps), checked = _b.checked, className = _b.className, defaultChecked = _b.defaultChecked, disabled = _b.disabled, id = _b.id, innerLabelOff = _b.innerLabelOff, innerLabelOn = _b.innerLabelOn, inputProps = _b.inputProps, inputRef = _b.inputRef, name = _b.name, onBlur = _b.onBlur, onChange = _b.onChange, onFocus = _b.onFocus, required = _b.required, value = _b.value, rest = __rest(_b, ["checked", "className", "defaultChecked", "disabled", "id", "innerLabelOff", "innerLabelOn", "inputProps", "inputRef", "name", "onBlur", "onChange", "onFocus", "required", "value"]);
83
+ var isControlled = (0, react_1.useRef)(checked !== undefined).current;
84
+ var _c = __read((0, react_1.useState)(checked !== null && checked !== void 0 ? checked : defaultChecked), 2), isChecked = _c[0], setIsChecked = _c[1];
85
+ var _d = __read((0, react_1.useState)(false), 2), isFocused = _d[0], setIsFocused = _d[1];
86
+ var styles = (0, core_1.useStyleConfig)('Switch', mergedProps);
87
+ var _e = styles.button, thumbStyles = _e.thumb, trackStyles = _e.track, buttonStyles = __rest(_e, ["thumb", "track"]);
88
+ (0, react_1.useEffect)(function () {
89
+ isControlled && setIsChecked(checked);
90
+ }, [checked, isControlled]);
93
91
  function handleOnBlur(e) {
94
92
  setIsFocused(false);
95
93
  onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
@@ -105,22 +103,22 @@ exports.SwitchButton = core_1.vui(function (props, ref) {
105
103
  var hDiff = (thumbStyles.h - trackStyles.h) / 2;
106
104
  var thumbOffset = "calc(100% - " + Math.abs(hDiff - thumbStyles.h) + "px)";
107
105
  var labelOffset = thumbStyles.h - hDiff + 4 + "px";
108
- var buttonAliasedProps = utils_1.filterUndefined({
106
+ var buttonAliasedProps = (0, utils_1.filterUndefined)({
109
107
  'data-checked': isChecked ? true : false,
110
108
  'data-disabled': disabled ? true : false,
111
109
  'data-focused': isFocused ? true : false
112
110
  });
113
- var thumbAliasedProps = utils_1.filterUndefined({
111
+ var thumbAliasedProps = (0, utils_1.filterUndefined)({
114
112
  left: isChecked ? thumbOffset : -hDiff,
115
113
  ring: isFocused ? thumbStyles.ring : 0
116
114
  });
117
- var trackAliasedProps = utils_1.filterUndefined({
115
+ var trackAliasedProps = (0, utils_1.filterUndefined)({
118
116
  bg: isChecked ? trackStyles.bg : 'grey.50',
119
117
  pl: isChecked ? 1 : labelOffset,
120
118
  pr: isChecked ? labelOffset : 1,
121
119
  ring: isFocused ? trackStyles.ring : disabled ? 1 : 0
122
120
  });
123
- return (react_1.default.createElement(exports.SwitchButtonBase, __assign({ className: utils_1.cs('vui-switchButton', className), ref: ref }, buttonStyles, buttonAliasedProps, rest),
121
+ return (react_1.default.createElement(exports.SwitchButtonBase, __assign({ className: (0, utils_1.cs)('vui-switchButton', className), ref: ref }, buttonStyles, buttonAliasedProps, rest),
124
122
  react_1.default.createElement(exports.SwitchInput, __assign({ className: "vui-switchInput", onBlur: handleOnBlur, onChange: handleOnChange, onFocus: handleOnFocus, ref: inputRef, type: "checkbox" }, { checked: checked, defaultChecked: defaultChecked, disabled: disabled, id: id, name: name, required: required, value: value }, inputProps)),
125
123
  react_1.default.createElement(exports.SwitchTrack, __assign({ borderRadius: "round", className: "vui-switchTrack", transitionDuration: "fast" }, trackStyles, trackAliasedProps),
126
124
  !isChecked && innerLabelOff,
@@ -19,11 +19,11 @@ var react_1 = __importDefault(require("react"));
19
19
  var context_1 = require("./context");
20
20
  var core_1 = require("../core");
21
21
  var t_1 = __importDefault(require("../t"));
22
- exports.SwitchLabel = core_1.vui(function (props, ref) {
22
+ exports.SwitchLabel = (0, core_1.vui)(function (props, ref) {
23
23
  var _a;
24
- var switchProps = (_a = context_1.useSwitch()) !== null && _a !== void 0 ? _a : {};
24
+ var switchProps = (_a = (0, context_1.useSwitch)()) !== null && _a !== void 0 ? _a : {};
25
25
  var mergedProps = __assign(__assign({}, switchProps), props);
26
- var styles = core_1.useStyleConfig('Switch', mergedProps);
26
+ var styles = (0, core_1.useStyleConfig)('Switch', mergedProps);
27
27
  return react_1.default.createElement(t_1.default, __assign({ className: "vui-switchLabel", display: "flex", ref: ref }, styles.label, props));
28
28
  });
29
29
  exports.SwitchLabel.displayName = 'SwitchLabel';
package/switch/theme.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { Dict } from '../utils';
2
2
  declare function sizeLg(): {
3
- container: {};
4
3
  button: {
5
4
  fontSize: string;
6
5
  minW: number;
@@ -17,7 +16,6 @@ declare function sizeLg(): {
17
16
  };
18
17
  };
19
18
  declare function sizeMd(): {
20
- container: {};
21
19
  button: {
22
20
  fontSize: string;
23
21
  minW: number;
@@ -34,7 +32,6 @@ declare function sizeMd(): {
34
32
  };
35
33
  };
36
34
  declare function sizeSm(): {
37
- container: {};
38
35
  button: {
39
36
  fontSize: string;
40
37
  minW: number;
@@ -51,7 +48,6 @@ declare function sizeSm(): {
51
48
  };
52
49
  };
53
50
  declare function variantContained(props: Dict): {
54
- container: {};
55
51
  button: {
56
52
  thumb: {
57
53
  bg: string;
@@ -61,7 +57,6 @@ declare function variantContained(props: Dict): {
61
57
  ring: number;
62
58
  };
63
59
  };
64
- label: {};
65
60
  };
66
61
  declare const _default: {
67
62
  defaultProps: {
package/switch/theme.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function sizeLg() {
4
- var container = {};
5
4
  var button = {
6
5
  fontSize: 'md',
7
6
  minW: 50,
@@ -16,10 +15,9 @@ function sizeLg() {
16
15
  var label = {
17
16
  size: 'lg'
18
17
  };
19
- return { container: container, button: button, label: label };
18
+ return { button: button, label: label };
20
19
  }
21
20
  function sizeMd() {
22
- var container = {};
23
21
  var button = {
24
22
  fontSize: 'sm',
25
23
  minW: 42,
@@ -34,10 +32,9 @@ function sizeMd() {
34
32
  var label = {
35
33
  size: 'md'
36
34
  };
37
- return { container: container, button: button, label: label };
35
+ return { button: button, label: label };
38
36
  }
39
37
  function sizeSm() {
40
- var container = {};
41
38
  var button = {
42
39
  fontSize: 'xs',
43
40
  minW: 34,
@@ -52,11 +49,10 @@ function sizeSm() {
52
49
  var label = {
53
50
  size: 'sm'
54
51
  };
55
- return { container: container, button: button, label: label };
52
+ return { button: button, label: label };
56
53
  }
57
54
  function variantContained(props) {
58
55
  var c = props.colorScheme;
59
- var container = {};
60
56
  var button = {
61
57
  thumb: {
62
58
  bg: 'white'
@@ -66,8 +62,7 @@ function variantContained(props) {
66
62
  ring: 3
67
63
  }
68
64
  };
69
- var label = {};
70
- return { container: container, button: button, label: label };
65
+ return { button: button };
71
66
  }
72
67
  var defaultProps = {
73
68
  colorScheme: 'blue',
@@ -1,31 +1,18 @@
1
- import { BorderRadiusProp } from './borders';
2
- export interface BorderRadiusBottomProps {
3
- borderRadiusBottom?: BorderRadiusProp;
4
- }
5
- export declare const borderRadiusBottom: import("@xstyled/system").StyleGenerator;
6
- export interface BorderRadiusLeftProps {
7
- borderRadiusLeft?: BorderRadiusProp;
8
- }
9
- export declare const borderRadiusLeft: import("@xstyled/system").StyleGenerator;
10
- export interface BorderRadiusRightProps {
11
- borderRadiusRight?: BorderRadiusProp;
12
- }
13
- export declare const borderRadiusRight: import("@xstyled/system").StyleGenerator;
14
- export interface BorderRadiusTopProps {
15
- borderRadiusTop?: BorderRadiusProp;
16
- }
17
- export declare const borderRadiusTop: import("@xstyled/system").StyleGenerator;
18
1
  export interface IsTruncatedProps {
19
2
  isTruncated?: boolean;
20
3
  }
21
4
  /** Provides styling to truncate single-line text. */
22
- export declare const isTruncated: import("@xstyled/system").StyleGenerator;
5
+ export declare const isTruncated: import("@xstyled/styled-components").StyleGenerator;
23
6
  export interface MaxLinesProps {
24
7
  maxLines?: number;
25
8
  }
26
9
  /** Provides styling to truncate multi-line text. */
27
- export declare const maxLines: import("@xstyled/system").StyleGenerator;
10
+ export declare const maxLines: import("@xstyled/styled-components").StyleGenerator;
11
+ export declare type SpaceAroundProps = {
12
+ spaceAround?: number | string;
13
+ };
14
+ export declare const spaceAround: import("@xstyled/styled-components").StyleGenerator;
28
15
  export declare type WordBreakProps = {
29
16
  wordBreak?: 'normal' | 'break-all' | 'keep-all' | 'break-word';
30
17
  };
31
- export declare const wordBreak: import("@xstyled/system").StyleGenerator;
18
+ export declare const wordBreak: import("@xstyled/styled-components").StyleGenerator;
package/system/custom.js CHANGED
@@ -1,29 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.wordBreak = exports.maxLines = exports.isTruncated = exports.borderRadiusTop = exports.borderRadiusRight = exports.borderRadiusLeft = exports.borderRadiusBottom = void 0;
4
- var system_1 = require("@xstyled/system");
5
- exports.borderRadiusBottom = system_1.style({
6
- prop: 'borderRadiusBottom',
7
- themeGet: system_1.getRadius,
8
- cssProperty: ['borderBottomLeftRadius', 'borderBottomRightRadius']
9
- });
10
- exports.borderRadiusLeft = system_1.style({
11
- prop: 'borderRadiusLeft',
12
- themeGet: system_1.getRadius,
13
- cssProperty: ['borderBottomLeftRadius', 'borderTopLeftRadius']
14
- });
15
- exports.borderRadiusRight = system_1.style({
16
- prop: 'borderRadiusRight',
17
- themeGet: system_1.getRadius,
18
- cssProperty: ['borderBottomRightRadius', 'borderTopRightRadius']
19
- });
20
- exports.borderRadiusTop = system_1.style({
21
- prop: 'borderRadiusTop',
22
- themeGet: system_1.getRadius,
23
- cssProperty: ['borderTopLeftRadius', 'borderTopRightRadius']
24
- });
3
+ exports.wordBreak = exports.spaceAround = exports.maxLines = exports.isTruncated = void 0;
4
+ var styled_components_1 = require("@xstyled/styled-components");
25
5
  /** Provides styling to truncate single-line text. */
26
- exports.isTruncated = system_1.style({
6
+ exports.isTruncated = (0, styled_components_1.style)({
27
7
  prop: 'isTruncated',
28
8
  cssProperty: function () {
29
9
  return {
@@ -35,7 +15,7 @@ exports.isTruncated = system_1.style({
35
15
  states: {}
36
16
  });
37
17
  /** Provides styling to truncate multi-line text. */
38
- exports.maxLines = system_1.style({
18
+ exports.maxLines = (0, styled_components_1.style)({
39
19
  prop: 'maxLines',
40
20
  cssProperty: function (value) {
41
21
  return {
@@ -47,6 +27,20 @@ exports.maxLines = system_1.style({
47
27
  },
48
28
  states: {}
49
29
  });
50
- exports.wordBreak = system_1.style({
30
+ exports.spaceAround = (0, styled_components_1.style)({
31
+ prop: 'spaceAround',
32
+ themeGet: styled_components_1.getSpace,
33
+ cssProperty: function (value) {
34
+ return {
35
+ '&': {
36
+ margin: '-' + value
37
+ },
38
+ '& > *': {
39
+ margin: value
40
+ }
41
+ };
42
+ }
43
+ });
44
+ exports.wordBreak = (0, styled_components_1.style)({
51
45
  prop: 'wordBreak'
52
46
  });