glints-aries 4.1.33 → 4.1.34

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.
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
3
3
  checked?: boolean;
4
4
  disabled?: boolean;
5
+ loading?: boolean;
5
6
  onChange: () => void;
6
7
  value: string;
7
8
  withIcon?: boolean;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
- var _excluded = ["checked", "disabled", "onChange", "value", "withIcon", "checkedText", "uncheckedText", "checkedBackgroundColor"];
3
+ var _excluded = ["checked", "disabled", "onChange", "value", "loading", "withIcon", "checkedText", "uncheckedText", "checkedBackgroundColor"];
4
4
  import React from 'react';
5
5
  import { Icon } from '../Icon';
6
6
  import { Neutral } from '../utilities/colors';
@@ -10,6 +10,7 @@ export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
10
10
  disabled = _ref.disabled,
11
11
  onChange = _ref.onChange,
12
12
  value = _ref.value,
13
+ loading = _ref.loading,
13
14
  withIcon = _ref.withIcon,
14
15
  checkedText = _ref.checkedText,
15
16
  uncheckedText = _ref.uncheckedText,
@@ -40,7 +41,7 @@ export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
40
41
  return /*#__PURE__*/React.createElement(LabelStyle, null, /*#__PURE__*/React.createElement(InputStyle, _extends({
41
42
  value: value
42
43
  }, otherProps, {
43
- disabled: disabled,
44
+ disabled: disabled || loading,
44
45
  checked: checked,
45
46
  type: "checkbox",
46
47
  onChange: onChange,
@@ -50,6 +51,7 @@ export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
50
51
  backgroundColor: checkedBackgroundColor
51
52
  })), /*#__PURE__*/React.createElement(SwitchStyle, {
52
53
  "data-disabled": disabled,
54
+ "data-loading": loading,
53
55
  "data-with-icon": !withText && withIcon,
54
56
  "data-with-text": withText
55
57
  }, !withText && withIcon && /*#__PURE__*/React.createElement(IconRender, null), withText && /*#__PURE__*/React.createElement(RenderSwitchText, null)));
@@ -1,6 +1,8 @@
1
1
  import styled from 'styled-components';
2
2
  import { Breakpoints, Spacing, Typography } from '..';
3
3
  import { Blue, Neutral } from '../utilities/colors';
4
+ import { keyframes } from 'styled-components';
5
+ var spin = keyframes(["to{transform:rotate(360deg);}"]);
4
6
  export var SwitchTextStyle = styled(Typography).withConfig({
5
7
  displayName: "SwitchStyle__SwitchTextStyle",
6
8
  componentId: "sc-7dlucf-0"
@@ -8,7 +10,7 @@ export var SwitchTextStyle = styled(Typography).withConfig({
8
10
  export var SwitchStyle = styled.div.withConfig({
9
11
  displayName: "SwitchStyle",
10
12
  componentId: "sc-7dlucf-1"
11
- })(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;position:relative;width:", ";&[data-with-icon='true']{width:48px;}&[data-with-text='true']{width:max-content;}&[data-with-icon='true'] svg{height:16px;}height:", ";background-color:", ";&[data-disabled='true']{background-color:", ";cursor:not-allowed;}border-radius:", ";padding:0;padding-left:8px;padding-right:8px;transition:300ms all;@media (max-width:", "){width:38px;&[data-with-icon='true']{width:44px;}&[data-with-icon='true'] svg{height:14px;}height:22px;}&:before{transition:100ms all;content:' ';cursor:pointer;position:absolute;width:16px;height:16px;left:4px;right:0;border-radius:16px;background:", ";box-shadow:0px 1px 3px rgba(0,0,0,0.1);transform:scale(1);@media (max-width:", "){width:14px;height:14px;}}"], Spacing.space40, Spacing.space24, Neutral.B40, Neutral.B95, Spacing.space24, Breakpoints.large, Neutral.B100, Breakpoints.large);
13
+ })(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;position:relative;width:", ";&[data-with-icon='true']{width:48px;}&[data-with-text='true']{width:max-content;}&[data-with-icon='true'] svg{height:16px;}height:", ";background-color:", ";&[data-disabled='true']{background-color:", ";cursor:not-allowed;}border-radius:", ";padding:0;padding-left:8px;padding-right:8px;transition:300ms all;@media (max-width:", "){width:38px;&[data-with-icon='true']{width:44px;}&[data-with-icon='true'] svg{height:14px;}height:22px;}&:before{transition:100ms all;content:' ';cursor:pointer;position:absolute;width:16px;height:16px;left:4px;right:0;border-radius:16px;background:", ";box-shadow:0 1px 3px rgba(0,0,0,0.1);transform:scale(1);@media (max-width:", "){width:14px;height:14px;}}&[data-loading='true']::before{border:2px solid ", ";border-top-color:transparent;background:transparent;animation:", " 0.6s linear infinite;transform:rotate(0deg);}&[data-loading='true']{pointer-events:none;}"], Spacing.space40, Spacing.space24, Neutral.B40, Neutral.B95, Spacing.space24, Breakpoints.large, Neutral.B100, Breakpoints.large, Neutral.B100, spin);
12
14
  export var InputStyle = styled.input.withConfig({
13
15
  displayName: "SwitchStyle__InputStyle",
14
16
  componentId: "sc-7dlucf-2"
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
3
3
  checked?: boolean;
4
4
  disabled?: boolean;
5
+ loading?: boolean;
5
6
  onChange: () => void;
6
7
  value: string;
7
8
  withIcon?: boolean;
@@ -9,12 +9,13 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _Icon = require("../Icon");
10
10
  var _colors = require("../utilities/colors");
11
11
  var _SwitchStyle = require("./SwitchStyle");
12
- var _excluded = ["checked", "disabled", "onChange", "value", "withIcon", "checkedText", "uncheckedText", "checkedBackgroundColor"];
12
+ var _excluded = ["checked", "disabled", "onChange", "value", "loading", "withIcon", "checkedText", "uncheckedText", "checkedBackgroundColor"];
13
13
  var Switch = /*#__PURE__*/_react["default"].forwardRef(function Switch(_ref, ref) {
14
14
  var checked = _ref.checked,
15
15
  disabled = _ref.disabled,
16
16
  onChange = _ref.onChange,
17
17
  value = _ref.value,
18
+ loading = _ref.loading,
18
19
  withIcon = _ref.withIcon,
19
20
  checkedText = _ref.checkedText,
20
21
  uncheckedText = _ref.uncheckedText,
@@ -45,7 +46,7 @@ var Switch = /*#__PURE__*/_react["default"].forwardRef(function Switch(_ref, ref
45
46
  return /*#__PURE__*/_react["default"].createElement(_SwitchStyle.LabelStyle, null, /*#__PURE__*/_react["default"].createElement(_SwitchStyle.InputStyle, (0, _extends2["default"])({
46
47
  value: value
47
48
  }, otherProps, {
48
- disabled: disabled,
49
+ disabled: disabled || loading,
49
50
  checked: checked,
50
51
  type: "checkbox",
51
52
  onChange: onChange,
@@ -55,6 +56,7 @@ var Switch = /*#__PURE__*/_react["default"].forwardRef(function Switch(_ref, ref
55
56
  backgroundColor: checkedBackgroundColor
56
57
  })), /*#__PURE__*/_react["default"].createElement(_SwitchStyle.SwitchStyle, {
57
58
  "data-disabled": disabled,
59
+ "data-loading": loading,
58
60
  "data-with-icon": !withText && withIcon,
59
61
  "data-with-text": withText
60
62
  }, !withText && withIcon && /*#__PURE__*/_react["default"].createElement(IconRender, null), withText && /*#__PURE__*/_react["default"].createElement(RenderSwitchText, null)));
@@ -1,11 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  exports.__esModule = true;
5
4
  exports.SwitchTextStyle = exports.SwitchStyle = exports.LabelStyle = exports.InputStyle = void 0;
6
- var _styledComponents = _interopRequireDefault(require("styled-components"));
5
+ var _styledComponents = _interopRequireWildcard(require("styled-components"));
7
6
  var _ = require("..");
8
7
  var _colors = require("../utilities/colors");
8
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10
+ var spin = (0, _styledComponents.keyframes)(["to{transform:rotate(360deg);}"]);
9
11
  var SwitchTextStyle = (0, _styledComponents["default"])(_.Typography).withConfig({
10
12
  displayName: "SwitchStyle__SwitchTextStyle",
11
13
  componentId: "sc-7dlucf-0"
@@ -14,7 +16,7 @@ exports.SwitchTextStyle = SwitchTextStyle;
14
16
  var SwitchStyle = _styledComponents["default"].div.withConfig({
15
17
  displayName: "SwitchStyle",
16
18
  componentId: "sc-7dlucf-1"
17
- })(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;position:relative;width:", ";&[data-with-icon='true']{width:48px;}&[data-with-text='true']{width:max-content;}&[data-with-icon='true'] svg{height:16px;}height:", ";background-color:", ";&[data-disabled='true']{background-color:", ";cursor:not-allowed;}border-radius:", ";padding:0;padding-left:8px;padding-right:8px;transition:300ms all;@media (max-width:", "){width:38px;&[data-with-icon='true']{width:44px;}&[data-with-icon='true'] svg{height:14px;}height:22px;}&:before{transition:100ms all;content:' ';cursor:pointer;position:absolute;width:16px;height:16px;left:4px;right:0;border-radius:16px;background:", ";box-shadow:0px 1px 3px rgba(0,0,0,0.1);transform:scale(1);@media (max-width:", "){width:14px;height:14px;}}"], _.Spacing.space40, _.Spacing.space24, _colors.Neutral.B40, _colors.Neutral.B95, _.Spacing.space24, _.Breakpoints.large, _colors.Neutral.B100, _.Breakpoints.large);
19
+ })(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;position:relative;width:", ";&[data-with-icon='true']{width:48px;}&[data-with-text='true']{width:max-content;}&[data-with-icon='true'] svg{height:16px;}height:", ";background-color:", ";&[data-disabled='true']{background-color:", ";cursor:not-allowed;}border-radius:", ";padding:0;padding-left:8px;padding-right:8px;transition:300ms all;@media (max-width:", "){width:38px;&[data-with-icon='true']{width:44px;}&[data-with-icon='true'] svg{height:14px;}height:22px;}&:before{transition:100ms all;content:' ';cursor:pointer;position:absolute;width:16px;height:16px;left:4px;right:0;border-radius:16px;background:", ";box-shadow:0 1px 3px rgba(0,0,0,0.1);transform:scale(1);@media (max-width:", "){width:14px;height:14px;}}&[data-loading='true']::before{border:2px solid ", ";border-top-color:transparent;background:transparent;animation:", " 0.6s linear infinite;transform:rotate(0deg);}&[data-loading='true']{pointer-events:none;}"], _.Spacing.space40, _.Spacing.space24, _colors.Neutral.B40, _colors.Neutral.B95, _.Spacing.space24, _.Breakpoints.large, _colors.Neutral.B100, _.Breakpoints.large, _colors.Neutral.B100, spin);
18
20
  exports.SwitchStyle = SwitchStyle;
19
21
  var InputStyle = _styledComponents["default"].input.withConfig({
20
22
  displayName: "SwitchStyle__InputStyle",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glints-aries",
3
- "version": "4.1.33",
3
+ "version": "4.1.34",
4
4
  "description": "Glints ui-kit for frontend",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",