@gympass/yoga 7.72.1 → 7.72.3
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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports["default"] = void 0;
|
|
5
5
|
|
|
6
|
-
var _react =
|
|
6
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
7
7
|
|
|
8
8
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
9
9
|
|
|
@@ -22,12 +22,12 @@ var _excluded = ["isOpen", "selected"],
|
|
|
22
22
|
|
|
23
23
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12;
|
|
24
24
|
|
|
25
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
26
|
+
|
|
25
27
|
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); }
|
|
26
28
|
|
|
27
29
|
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; }
|
|
28
30
|
|
|
29
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
30
|
-
|
|
31
31
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
32
32
|
|
|
33
33
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -103,15 +103,8 @@ var ArrowIcon = (0, _styledComponents["default"])(function (_ref8) {
|
|
|
103
103
|
dropdown = _ref9.theme.yoga.components.dropdown;
|
|
104
104
|
return "\n fill: " + dropdown.arrow.fill + ";\n " + (disabled ? "fill: " + dropdown.disabled.arrow.fill + ";" : '') + ";\n " + (selected && !disabled ? "fill: " + dropdown.selected.arrow.fill + ";" : '') + ";\n transform: rotate(" + (isOpen ? '180deg' : '0') + ");\n ";
|
|
105
105
|
});
|
|
106
|
-
|
|
107
|
-
var getSelectedOption = function getSelectedOption(options) {
|
|
108
|
-
return options.find(function (item) {
|
|
109
|
-
return item.selected === true;
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
106
|
/** Gympass Dropdown is a multiple choice type of menu. */
|
|
113
107
|
|
|
114
|
-
|
|
115
108
|
var Dropdown = /*#__PURE__*/_react["default"].forwardRef(function (_ref10, ref) {
|
|
116
109
|
var error = _ref10.error,
|
|
117
110
|
label = _ref10.label,
|
|
@@ -123,15 +116,31 @@ var Dropdown = /*#__PURE__*/_react["default"].forwardRef(function (_ref10, ref)
|
|
|
123
116
|
|
|
124
117
|
var inputRef = ref || _react["default"].useRef(null);
|
|
125
118
|
|
|
119
|
+
var selectedOption = options.find(function (item) {
|
|
120
|
+
return item.selected === true;
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
var _useState = (0, _react.useState)(selectedOption),
|
|
124
|
+
localSelectedItem = _useState[0],
|
|
125
|
+
setLocalSelectedItem = _useState[1];
|
|
126
|
+
|
|
127
|
+
(0, _react.useEffect)(function () {
|
|
128
|
+
setLocalSelectedItem(selectedOption);
|
|
129
|
+
}, [options]);
|
|
130
|
+
var onLocalChange = (0, _react.useCallback)(function (opt) {
|
|
131
|
+
setLocalSelectedItem(opt);
|
|
132
|
+
onChange(opt);
|
|
133
|
+
}, [onChange]);
|
|
126
134
|
return /*#__PURE__*/_react["default"].createElement(_downshift["default"], {
|
|
127
|
-
initialSelectedItem:
|
|
135
|
+
initialSelectedItem: selectedOption,
|
|
128
136
|
selectedItemChanged: function selectedItemChanged(prevItem, item) {
|
|
129
137
|
return prevItem !== item;
|
|
130
138
|
},
|
|
131
139
|
itemToString: function itemToString(item) {
|
|
132
140
|
return item ? item.label : '';
|
|
133
141
|
},
|
|
134
|
-
onChange:
|
|
142
|
+
onChange: onLocalChange,
|
|
143
|
+
selectedItem: localSelectedItem
|
|
135
144
|
}, function (_ref11) {
|
|
136
145
|
var getInputProps = _ref11.getInputProps,
|
|
137
146
|
getItemProps = _ref11.getItemProps,
|
|
@@ -9,7 +9,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
9
9
|
|
|
10
10
|
function _taggedTemplateLiteralLoose(strings, raw) { if (!raw) { raw = strings.slice(0); } strings.raw = raw; return strings; }
|
|
11
11
|
|
|
12
|
-
import React from 'react';
|
|
12
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
13
13
|
import styled, { css } from 'styled-components';
|
|
14
14
|
import Downshift from 'downshift';
|
|
15
15
|
import { arrayOf, func, shape, string, number, bool, oneOfType } from 'prop-types';
|
|
@@ -78,15 +78,8 @@ var ArrowIcon = styled(function (_ref8) {
|
|
|
78
78
|
dropdown = _ref9.theme.yoga.components.dropdown;
|
|
79
79
|
return "\n fill: " + dropdown.arrow.fill + ";\n " + (disabled ? "fill: " + dropdown.disabled.arrow.fill + ";" : '') + ";\n " + (selected && !disabled ? "fill: " + dropdown.selected.arrow.fill + ";" : '') + ";\n transform: rotate(" + (isOpen ? '180deg' : '0') + ");\n ";
|
|
80
80
|
});
|
|
81
|
-
|
|
82
|
-
var getSelectedOption = function getSelectedOption(options) {
|
|
83
|
-
return options.find(function (item) {
|
|
84
|
-
return item.selected === true;
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
81
|
/** Gympass Dropdown is a multiple choice type of menu. */
|
|
88
82
|
|
|
89
|
-
|
|
90
83
|
var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref10, ref) {
|
|
91
84
|
var error = _ref10.error,
|
|
92
85
|
label = _ref10.label,
|
|
@@ -97,15 +90,31 @@ var Dropdown = /*#__PURE__*/React.forwardRef(function (_ref10, ref) {
|
|
|
97
90
|
rest = _objectWithoutPropertiesLoose(_ref10, _excluded2);
|
|
98
91
|
|
|
99
92
|
var inputRef = ref || React.useRef(null);
|
|
93
|
+
var selectedOption = options.find(function (item) {
|
|
94
|
+
return item.selected === true;
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
var _useState = useState(selectedOption),
|
|
98
|
+
localSelectedItem = _useState[0],
|
|
99
|
+
setLocalSelectedItem = _useState[1];
|
|
100
|
+
|
|
101
|
+
useEffect(function () {
|
|
102
|
+
setLocalSelectedItem(selectedOption);
|
|
103
|
+
}, [options]);
|
|
104
|
+
var onLocalChange = useCallback(function (opt) {
|
|
105
|
+
setLocalSelectedItem(opt);
|
|
106
|
+
onChange(opt);
|
|
107
|
+
}, [onChange]);
|
|
100
108
|
return /*#__PURE__*/React.createElement(Downshift, {
|
|
101
|
-
initialSelectedItem:
|
|
109
|
+
initialSelectedItem: selectedOption,
|
|
102
110
|
selectedItemChanged: function selectedItemChanged(prevItem, item) {
|
|
103
111
|
return prevItem !== item;
|
|
104
112
|
},
|
|
105
113
|
itemToString: function itemToString(item) {
|
|
106
114
|
return item ? item.label : '';
|
|
107
115
|
},
|
|
108
|
-
onChange:
|
|
116
|
+
onChange: onLocalChange,
|
|
117
|
+
selectedItem: localSelectedItem
|
|
109
118
|
}, function (_ref11) {
|
|
110
119
|
var getInputProps = _ref11.getInputProps,
|
|
111
120
|
getItemProps = _ref11.getItemProps,
|
|
@@ -6,7 +6,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
6
6
|
|
|
7
7
|
import { arrayOf, node, oneOf, oneOfType, string, bool } from 'prop-types';
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import { CheckedFull,
|
|
9
|
+
import { CheckedFull, Info, AlertTriangle } from '@gympass/yoga-icons';
|
|
10
10
|
import Icon from '../../Icon';
|
|
11
11
|
import Box from '../../Box';
|
|
12
12
|
import Text from '../../Text';
|
|
@@ -18,7 +18,7 @@ var VARIANT_ICONS = {
|
|
|
18
18
|
fill: 'hope'
|
|
19
19
|
},
|
|
20
20
|
informative: {
|
|
21
|
-
as:
|
|
21
|
+
as: Info,
|
|
22
22
|
fill: 'relax'
|
|
23
23
|
},
|
|
24
24
|
attention: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gympass/yoga",
|
|
3
|
-
"version": "7.72.
|
|
3
|
+
"version": "7.72.3",
|
|
4
4
|
"description": "Gympass component library",
|
|
5
5
|
"main": "./cjs",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"react": ">=16",
|
|
54
54
|
"styled-components": "^4.4.0"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "1211293dbf850a8ea44e75417967ebf6111e1351",
|
|
57
57
|
"module": "./esm",
|
|
58
58
|
"private": false,
|
|
59
59
|
"react-native": "./cjs/index.native.js"
|