glints-aries 4.0.244 → 4.0.246
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/@next/Select/Select.stories.d.ts +1 -0
- package/es/@next/Select/components/Activator/ActivatorTextInput.js +1 -0
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInput.d.ts +2 -0
- package/es/@next/Select/components/SearchableSelectInput/SearchableSelectInput.js +5 -1
- package/es/@next/Select/selectStoryHelper/SearchableSingleSelect.d.ts +1 -0
- package/es/@next/Select/selectStoryHelper/SearchableSingleSelect.js +32 -1
- package/es/@next/Switch/Switch.d.ts +3 -0
- package/es/@next/Switch/Switch.js +24 -5
- package/es/@next/Switch/Switch.stories.d.ts +2 -0
- package/es/@next/Switch/SwitchStyle.d.ts +5 -1
- package/es/@next/Switch/SwitchStyle.js +13 -6
- package/es/@next/Tabs/Tabs.js +6 -2
- package/lib/@next/Select/Select.stories.d.ts +1 -0
- package/lib/@next/Select/components/Activator/ActivatorTextInput.js +1 -0
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInput.d.ts +2 -0
- package/lib/@next/Select/components/SearchableSelectInput/SearchableSelectInput.js +5 -1
- package/lib/@next/Select/selectStoryHelper/SearchableSingleSelect.d.ts +1 -0
- package/lib/@next/Select/selectStoryHelper/SearchableSingleSelect.js +35 -3
- package/lib/@next/Switch/Switch.d.ts +3 -0
- package/lib/@next/Switch/Switch.js +23 -4
- package/lib/@next/Switch/Switch.stories.d.ts +2 -0
- package/lib/@next/Switch/SwitchStyle.d.ts +5 -1
- package/lib/@next/Switch/SwitchStyle.js +14 -6
- package/lib/@next/Tabs/Tabs.js +6 -2
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export declare const WithErrorNonSearchable: any;
|
|
|
7
7
|
export declare const NonSearchableDisabled: any;
|
|
8
8
|
export declare const SearchableMultiSelect: any;
|
|
9
9
|
export declare const SearchableSingleSelect: any;
|
|
10
|
+
export declare const SearchableSingleWithInputState: any;
|
|
10
11
|
export declare const MultiSelectScrollable: any;
|
|
11
12
|
export declare const WithInlineError: any;
|
|
12
13
|
export declare const SearchableDisabled: any;
|
|
@@ -9,6 +9,7 @@ export interface SearchableSelectState {
|
|
|
9
9
|
export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onChange' | 'onSelect'> & {
|
|
10
10
|
canClear?: boolean;
|
|
11
11
|
filterOptions?: (str: string) => Option[];
|
|
12
|
+
onInputChange?(value: string): void;
|
|
12
13
|
onSelect?({ value }: {
|
|
13
14
|
value: string;
|
|
14
15
|
}): void;
|
|
@@ -23,6 +24,7 @@ export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onCh
|
|
|
23
24
|
export declare const SearchableSelectInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange" | "onSelect"> & {
|
|
24
25
|
canClear?: boolean;
|
|
25
26
|
filterOptions?: (str: string) => Option[];
|
|
27
|
+
onInputChange?(value: string): void;
|
|
26
28
|
onSelect?({ value }: {
|
|
27
29
|
value: string;
|
|
28
30
|
}): void;
|
|
@@ -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 = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
|
|
3
|
+
var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onInputChange", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
|
|
4
4
|
import React, { forwardRef, useEffect, useRef, useState } from 'react';
|
|
5
5
|
import { StyledInput, StyledPrefixContainer } from '../../../Input/InputStyle';
|
|
6
6
|
import { ClearSelected } from './ClearSelected';
|
|
@@ -17,6 +17,7 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
|
|
|
17
17
|
width = _ref.width,
|
|
18
18
|
inputValue = _ref.inputValue,
|
|
19
19
|
updateInputValue = _ref.updateInputValue,
|
|
20
|
+
onInputChange = _ref.onInputChange,
|
|
20
21
|
onFocus = _ref.onFocus,
|
|
21
22
|
_ref$searchableSelect = _ref.searchableSelectState,
|
|
22
23
|
showInput = _ref$searchableSelect.showInput,
|
|
@@ -49,6 +50,9 @@ export var SearchableSelectInput = /*#__PURE__*/forwardRef(function SearchableSe
|
|
|
49
50
|
};
|
|
50
51
|
var handleInputChange = function handleInputChange(e) {
|
|
51
52
|
var str = e.currentTarget.value;
|
|
53
|
+
if (onInputChange) {
|
|
54
|
+
onInputChange(str);
|
|
55
|
+
}
|
|
52
56
|
updateInputValue(str);
|
|
53
57
|
var filteredOptions = filterOptions(str);
|
|
54
58
|
updateMenuOptions(filteredOptions);
|
|
@@ -4,4 +4,5 @@ interface SearchableSingleSelectProps {
|
|
|
4
4
|
data?: Option[];
|
|
5
5
|
}
|
|
6
6
|
export declare const SearchableSingle: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
|
|
7
|
+
export declare const SearchableSingleWithInputState: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
|
-
var _excluded = ["data"]
|
|
3
|
+
var _excluded = ["data"],
|
|
4
|
+
_excluded2 = ["data"];
|
|
4
5
|
import React, { useState } from 'react';
|
|
5
6
|
import { Select } from '../Select';
|
|
6
7
|
export var SearchableSingle = function SearchableSingle(_ref) {
|
|
@@ -21,4 +22,34 @@ export var SearchableSingle = function SearchableSingle(_ref) {
|
|
|
21
22
|
searchable: true,
|
|
22
23
|
label: "Label"
|
|
23
24
|
}));
|
|
25
|
+
};
|
|
26
|
+
export var SearchableSingleWithInputState = function SearchableSingleWithInputState(_ref3) {
|
|
27
|
+
var data = _ref3.data,
|
|
28
|
+
args = _objectWithoutPropertiesLoose(_ref3, _excluded2);
|
|
29
|
+
var _useState2 = useState(''),
|
|
30
|
+
inputValue = _useState2[0],
|
|
31
|
+
setInputValue = _useState2[1];
|
|
32
|
+
var _useState3 = useState(''),
|
|
33
|
+
selected = _useState3[0],
|
|
34
|
+
setSelected = _useState3[1];
|
|
35
|
+
var handleInputChange = function handleInputChange(value) {
|
|
36
|
+
setInputValue(value);
|
|
37
|
+
};
|
|
38
|
+
var handleSelect = function handleSelect(_ref4) {
|
|
39
|
+
var value = _ref4.value;
|
|
40
|
+
setSelected(value);
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/React.createElement(Select, _extends({}, args, {
|
|
43
|
+
onSelect: handleSelect,
|
|
44
|
+
options: data,
|
|
45
|
+
selectedValues: [selected],
|
|
46
|
+
searchableProps: {
|
|
47
|
+
inputValue: inputValue,
|
|
48
|
+
onInputChange: function onInputChange(value) {
|
|
49
|
+
return handleInputChange(value);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
width: "600px",
|
|
53
|
+
label: "Label"
|
|
54
|
+
}));
|
|
24
55
|
};
|
|
@@ -5,5 +5,8 @@ export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
5
5
|
onChange: () => void;
|
|
6
6
|
value: string;
|
|
7
7
|
withIcon?: boolean;
|
|
8
|
+
checkedText?: string;
|
|
9
|
+
uncheckedText?: string;
|
|
10
|
+
checkedBackgroundColor?: string;
|
|
8
11
|
}
|
|
9
12
|
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,17 +1,24 @@
|
|
|
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"];
|
|
3
|
+
var _excluded = ["checked", "disabled", "onChange", "value", "withIcon", "checkedText", "uncheckedText", "checkedBackgroundColor"];
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Icon } from '../Icon';
|
|
6
6
|
import { Neutral } from '../utilities/colors';
|
|
7
|
-
import { InputStyle, LabelStyle, SwitchStyle } from './SwitchStyle';
|
|
7
|
+
import { InputStyle, LabelStyle, SwitchStyle, SwitchTextStyle } from './SwitchStyle';
|
|
8
8
|
export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
|
|
9
9
|
var checked = _ref.checked,
|
|
10
10
|
disabled = _ref.disabled,
|
|
11
11
|
onChange = _ref.onChange,
|
|
12
12
|
value = _ref.value,
|
|
13
13
|
withIcon = _ref.withIcon,
|
|
14
|
+
checkedText = _ref.checkedText,
|
|
15
|
+
uncheckedText = _ref.uncheckedText,
|
|
16
|
+
checkedBackgroundColor = _ref.checkedBackgroundColor,
|
|
14
17
|
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
18
|
+
var withText = Boolean(checkedText) && Boolean(uncheckedText);
|
|
19
|
+
if (withText && withIcon) {
|
|
20
|
+
console.warn('Switch component cannot have both text and icon');
|
|
21
|
+
}
|
|
15
22
|
var IconRender = function IconRender() {
|
|
16
23
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
|
|
17
24
|
name: "ri-check",
|
|
@@ -21,6 +28,15 @@ export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
|
|
|
21
28
|
fill: disabled ? Neutral.B85 : Neutral.B100
|
|
22
29
|
}));
|
|
23
30
|
};
|
|
31
|
+
var RenderSwitchText = function RenderSwitchText() {
|
|
32
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SwitchTextStyle, {
|
|
33
|
+
variant: "overline",
|
|
34
|
+
color: disabled ? Neutral.B85 : Neutral.B100
|
|
35
|
+
}, checkedText), /*#__PURE__*/React.createElement(SwitchTextStyle, {
|
|
36
|
+
variant: "overline",
|
|
37
|
+
color: disabled ? Neutral.B85 : Neutral.B100
|
|
38
|
+
}, uncheckedText));
|
|
39
|
+
};
|
|
24
40
|
return /*#__PURE__*/React.createElement(LabelStyle, null, /*#__PURE__*/React.createElement(InputStyle, _extends({
|
|
25
41
|
value: value
|
|
26
42
|
}, otherProps, {
|
|
@@ -29,9 +45,12 @@ export var Switch = /*#__PURE__*/React.forwardRef(function Switch(_ref, ref) {
|
|
|
29
45
|
type: "checkbox",
|
|
30
46
|
onChange: onChange,
|
|
31
47
|
ref: ref,
|
|
32
|
-
"data-with-icon": withIcon
|
|
48
|
+
"data-with-icon": !withText && withIcon,
|
|
49
|
+
"data-with-text": withText,
|
|
50
|
+
backgroundColor: checkedBackgroundColor
|
|
33
51
|
})), /*#__PURE__*/React.createElement(SwitchStyle, {
|
|
34
52
|
"data-disabled": disabled,
|
|
35
|
-
"data-with-icon": withIcon
|
|
36
|
-
|
|
53
|
+
"data-with-icon": !withText && withIcon,
|
|
54
|
+
"data-with-text": withText
|
|
55
|
+
}, !withText && withIcon && /*#__PURE__*/React.createElement(IconRender, null), withText && /*#__PURE__*/React.createElement(RenderSwitchText, null)));
|
|
37
56
|
});
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SwitchTextStyle: import("styled-components").StyledComponent<({ as, children, variant, style, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
|
|
1
3
|
export declare const SwitchStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const InputStyle: import("styled-components").StyledComponent<"input", any, {
|
|
4
|
+
export declare const InputStyle: import("styled-components").StyledComponent<"input", any, {
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
}, never>;
|
|
3
7
|
export declare const LabelStyle: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import styled from 'styled-components';
|
|
2
|
-
import { Breakpoints, Spacing } from '..';
|
|
2
|
+
import { Breakpoints, Spacing, Typography } from '..';
|
|
3
3
|
import { Blue, Neutral } from '../utilities/colors';
|
|
4
|
+
export var SwitchTextStyle = styled(Typography).withConfig({
|
|
5
|
+
displayName: "SwitchStyle__SwitchTextStyle",
|
|
6
|
+
componentId: "sc-7dlucf-0"
|
|
7
|
+
})([""]);
|
|
4
8
|
export var SwitchStyle = styled.div.withConfig({
|
|
5
9
|
displayName: "SwitchStyle",
|
|
6
|
-
componentId: "sc-7dlucf-
|
|
7
|
-
})(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;position:relative;width:", ";&[data-with-icon]{width:48px;}&[data-with-icon] 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]{width:44px;}&[data-with-icon] svg{height:14px;}height:22px;}&:before{transition:100ms all;content:'';position:absolute;width:16px;height:16px;border-radius:16px;
|
|
10
|
+
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);
|
|
8
12
|
export var InputStyle = styled.input.withConfig({
|
|
9
13
|
displayName: "SwitchStyle__InputStyle",
|
|
10
|
-
componentId: "sc-7dlucf-
|
|
11
|
-
})(["opacity:0;position:absolute
|
|
14
|
+
componentId: "sc-7dlucf-2"
|
|
15
|
+
})(["opacity:0;position:absolute;& + ", "{", "{padding-inline-start:18px;}}&:checked + ", "{", "{padding-inline-start:unset;padding-inline-end:18px;}background-color:", ";&[data-disabled='true']{background-color:", ";}&:before{right:4px;left:unset;}}& + ", " svg:nth-child(1){visibility:hidden;}& + ", " svg:nth-child(2){visibility:visible;}& + ", " ", ":nth-child(1){visibility:hidden;display:none;}& + ", " ", ":nth-child(2){visibility:visible;display:block;}&:checked + ", " svg:nth-child(1){visibility:visible;}&:checked + ", " svg:nth-child(2){visibility:hidden;}&:checked + ", " ", ":nth-child(1){visibility:visible;display:block;}&:checked + ", " ", ":nth-child(2){visibility:hidden;display:none;}"], SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchTextStyle, function (_ref) {
|
|
16
|
+
var backgroundColor = _ref.backgroundColor;
|
|
17
|
+
return backgroundColor || Blue.S99;
|
|
18
|
+
}, Neutral.B95, SwitchStyle, SwitchStyle, SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchStyle, SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchTextStyle);
|
|
12
19
|
export var LabelStyle = styled.label.withConfig({
|
|
13
20
|
displayName: "SwitchStyle__LabelStyle",
|
|
14
|
-
componentId: "sc-7dlucf-
|
|
21
|
+
componentId: "sc-7dlucf-3"
|
|
15
22
|
})(["display:flex;align-items:center;gap:10px;cursor:pointer;"]);
|
package/es/@next/Tabs/Tabs.js
CHANGED
|
@@ -78,7 +78,8 @@ export var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(_ref, ref) {
|
|
|
78
78
|
var renderTabs = tabs.map(function (tab, index) {
|
|
79
79
|
var tabId = tab.id || nextId();
|
|
80
80
|
return /*#__PURE__*/React.createElement(StyledLi, {
|
|
81
|
-
key: tabId + "-" + index
|
|
81
|
+
key: tabId + "-" + index,
|
|
82
|
+
className: "tab-item"
|
|
82
83
|
}, /*#__PURE__*/React.createElement(Tab, {
|
|
83
84
|
id: tabId,
|
|
84
85
|
key: "tab-" + tabId + "-" + index,
|
|
@@ -92,6 +93,7 @@ export var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(_ref, ref) {
|
|
|
92
93
|
return /*#__PURE__*/React.createElement(StyledTabsContainer, {
|
|
93
94
|
ref: ref
|
|
94
95
|
}, /*#__PURE__*/React.createElement(StyledTabHeaderContainer, {
|
|
96
|
+
className: "tabs-header-container",
|
|
95
97
|
ref: tabsHeaderRef,
|
|
96
98
|
onScroll: handleScroll,
|
|
97
99
|
onWheel: handleWheel,
|
|
@@ -104,5 +106,7 @@ export var Tabs = /*#__PURE__*/React.forwardRef(function Tabs(_ref, ref) {
|
|
|
104
106
|
"data-grabbing": isDragging
|
|
105
107
|
}, /*#__PURE__*/React.createElement(StyledUl, {
|
|
106
108
|
"data-fitted": fitted
|
|
107
|
-
}, renderTabs, " ")), /*#__PURE__*/React.createElement("div",
|
|
109
|
+
}, renderTabs, " ")), /*#__PURE__*/React.createElement("div", {
|
|
110
|
+
className: "tab-item-content"
|
|
111
|
+
}, children));
|
|
108
112
|
});
|
|
@@ -7,6 +7,7 @@ export declare const WithErrorNonSearchable: any;
|
|
|
7
7
|
export declare const NonSearchableDisabled: any;
|
|
8
8
|
export declare const SearchableMultiSelect: any;
|
|
9
9
|
export declare const SearchableSingleSelect: any;
|
|
10
|
+
export declare const SearchableSingleWithInputState: any;
|
|
10
11
|
export declare const MultiSelectScrollable: any;
|
|
11
12
|
export declare const WithInlineError: any;
|
|
12
13
|
export declare const SearchableDisabled: any;
|
|
@@ -9,6 +9,7 @@ export interface SearchableSelectState {
|
|
|
9
9
|
export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onChange' | 'onSelect'> & {
|
|
10
10
|
canClear?: boolean;
|
|
11
11
|
filterOptions?: (str: string) => Option[];
|
|
12
|
+
onInputChange?(value: string): void;
|
|
12
13
|
onSelect?({ value }: {
|
|
13
14
|
value: string;
|
|
14
15
|
}): void;
|
|
@@ -23,6 +24,7 @@ export declare type SearchableSelectInputProps = Omit<InputProps, 'type' | 'onCh
|
|
|
23
24
|
export declare const SearchableSelectInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange" | "onSelect"> & {
|
|
24
25
|
canClear?: boolean;
|
|
25
26
|
filterOptions?: (str: string) => Option[];
|
|
27
|
+
onInputChange?(value: string): void;
|
|
26
28
|
onSelect?({ value }: {
|
|
27
29
|
value: string;
|
|
28
30
|
}): void;
|
|
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _InputStyle = require("../../../Input/InputStyle");
|
|
10
10
|
var _ClearSelected = require("./ClearSelected");
|
|
11
11
|
var _SearchableSelectInputStyle = require("./SearchableSelectInputStyle");
|
|
12
|
-
var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
|
|
12
|
+
var _excluded = ["disabled", "error", "filterOptions", "onSelect", "placeholder", "prefix", "selectedValue", "width", "inputValue", "updateInputValue", "onInputChange", "onFocus", "searchableSelectState", "updateSearchableSelectState", "options", "updateMenuOptions"];
|
|
13
13
|
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); }
|
|
14
14
|
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; }
|
|
15
15
|
var SearchableSelectInput = /*#__PURE__*/(0, _react.forwardRef)(function SearchableSelectInput(_ref, ref) {
|
|
@@ -24,6 +24,7 @@ var SearchableSelectInput = /*#__PURE__*/(0, _react.forwardRef)(function Searcha
|
|
|
24
24
|
width = _ref.width,
|
|
25
25
|
inputValue = _ref.inputValue,
|
|
26
26
|
updateInputValue = _ref.updateInputValue,
|
|
27
|
+
onInputChange = _ref.onInputChange,
|
|
27
28
|
onFocus = _ref.onFocus,
|
|
28
29
|
_ref$searchableSelect = _ref.searchableSelectState,
|
|
29
30
|
showInput = _ref$searchableSelect.showInput,
|
|
@@ -56,6 +57,9 @@ var SearchableSelectInput = /*#__PURE__*/(0, _react.forwardRef)(function Searcha
|
|
|
56
57
|
};
|
|
57
58
|
var handleInputChange = function handleInputChange(e) {
|
|
58
59
|
var str = e.currentTarget.value;
|
|
60
|
+
if (onInputChange) {
|
|
61
|
+
onInputChange(str);
|
|
62
|
+
}
|
|
59
63
|
updateInputValue(str);
|
|
60
64
|
var filteredOptions = filterOptions(str);
|
|
61
65
|
updateMenuOptions(filteredOptions);
|
|
@@ -4,4 +4,5 @@ interface SearchableSingleSelectProps {
|
|
|
4
4
|
data?: Option[];
|
|
5
5
|
}
|
|
6
6
|
export declare const SearchableSingle: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
|
|
7
|
+
export declare const SearchableSingleWithInputState: ({ data, ...args }: SearchableSingleSelectProps) => JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.SearchableSingle = void 0;
|
|
5
|
+
exports.SearchableSingleWithInputState = exports.SearchableSingle = void 0;
|
|
6
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
7
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _Select = require("../Select");
|
|
10
|
-
var _excluded = ["data"]
|
|
10
|
+
var _excluded = ["data"],
|
|
11
|
+
_excluded2 = ["data"];
|
|
11
12
|
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); }
|
|
12
13
|
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; }
|
|
13
14
|
var SearchableSingle = function SearchableSingle(_ref) {
|
|
@@ -29,4 +30,35 @@ var SearchableSingle = function SearchableSingle(_ref) {
|
|
|
29
30
|
label: "Label"
|
|
30
31
|
}));
|
|
31
32
|
};
|
|
32
|
-
exports.SearchableSingle = SearchableSingle;
|
|
33
|
+
exports.SearchableSingle = SearchableSingle;
|
|
34
|
+
var SearchableSingleWithInputState = function SearchableSingleWithInputState(_ref3) {
|
|
35
|
+
var data = _ref3.data,
|
|
36
|
+
args = (0, _objectWithoutPropertiesLoose2["default"])(_ref3, _excluded2);
|
|
37
|
+
var _useState2 = (0, _react.useState)(''),
|
|
38
|
+
inputValue = _useState2[0],
|
|
39
|
+
setInputValue = _useState2[1];
|
|
40
|
+
var _useState3 = (0, _react.useState)(''),
|
|
41
|
+
selected = _useState3[0],
|
|
42
|
+
setSelected = _useState3[1];
|
|
43
|
+
var handleInputChange = function handleInputChange(value) {
|
|
44
|
+
setInputValue(value);
|
|
45
|
+
};
|
|
46
|
+
var handleSelect = function handleSelect(_ref4) {
|
|
47
|
+
var value = _ref4.value;
|
|
48
|
+
setSelected(value);
|
|
49
|
+
};
|
|
50
|
+
return /*#__PURE__*/_react["default"].createElement(_Select.Select, (0, _extends2["default"])({}, args, {
|
|
51
|
+
onSelect: handleSelect,
|
|
52
|
+
options: data,
|
|
53
|
+
selectedValues: [selected],
|
|
54
|
+
searchableProps: {
|
|
55
|
+
inputValue: inputValue,
|
|
56
|
+
onInputChange: function onInputChange(value) {
|
|
57
|
+
return handleInputChange(value);
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
width: "600px",
|
|
61
|
+
label: "Label"
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
exports.SearchableSingleWithInputState = SearchableSingleWithInputState;
|
|
@@ -5,5 +5,8 @@ export interface SwitchProps extends Omit<React.InputHTMLAttributes<HTMLInputEle
|
|
|
5
5
|
onChange: () => void;
|
|
6
6
|
value: string;
|
|
7
7
|
withIcon?: boolean;
|
|
8
|
+
checkedText?: string;
|
|
9
|
+
uncheckedText?: string;
|
|
10
|
+
checkedBackgroundColor?: string;
|
|
8
11
|
}
|
|
9
12
|
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -9,14 +9,21 @@ 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"];
|
|
12
|
+
var _excluded = ["checked", "disabled", "onChange", "value", "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
18
|
withIcon = _ref.withIcon,
|
|
19
|
+
checkedText = _ref.checkedText,
|
|
20
|
+
uncheckedText = _ref.uncheckedText,
|
|
21
|
+
checkedBackgroundColor = _ref.checkedBackgroundColor,
|
|
19
22
|
otherProps = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
23
|
+
var withText = Boolean(checkedText) && Boolean(uncheckedText);
|
|
24
|
+
if (withText && withIcon) {
|
|
25
|
+
console.warn('Switch component cannot have both text and icon');
|
|
26
|
+
}
|
|
20
27
|
var IconRender = function IconRender() {
|
|
21
28
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_Icon.Icon, {
|
|
22
29
|
name: "ri-check",
|
|
@@ -26,6 +33,15 @@ var Switch = /*#__PURE__*/_react["default"].forwardRef(function Switch(_ref, ref
|
|
|
26
33
|
fill: disabled ? _colors.Neutral.B85 : _colors.Neutral.B100
|
|
27
34
|
}));
|
|
28
35
|
};
|
|
36
|
+
var RenderSwitchText = function RenderSwitchText() {
|
|
37
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_SwitchStyle.SwitchTextStyle, {
|
|
38
|
+
variant: "overline",
|
|
39
|
+
color: disabled ? _colors.Neutral.B85 : _colors.Neutral.B100
|
|
40
|
+
}, checkedText), /*#__PURE__*/_react["default"].createElement(_SwitchStyle.SwitchTextStyle, {
|
|
41
|
+
variant: "overline",
|
|
42
|
+
color: disabled ? _colors.Neutral.B85 : _colors.Neutral.B100
|
|
43
|
+
}, uncheckedText));
|
|
44
|
+
};
|
|
29
45
|
return /*#__PURE__*/_react["default"].createElement(_SwitchStyle.LabelStyle, null, /*#__PURE__*/_react["default"].createElement(_SwitchStyle.InputStyle, (0, _extends2["default"])({
|
|
30
46
|
value: value
|
|
31
47
|
}, otherProps, {
|
|
@@ -34,10 +50,13 @@ var Switch = /*#__PURE__*/_react["default"].forwardRef(function Switch(_ref, ref
|
|
|
34
50
|
type: "checkbox",
|
|
35
51
|
onChange: onChange,
|
|
36
52
|
ref: ref,
|
|
37
|
-
"data-with-icon": withIcon
|
|
53
|
+
"data-with-icon": !withText && withIcon,
|
|
54
|
+
"data-with-text": withText,
|
|
55
|
+
backgroundColor: checkedBackgroundColor
|
|
38
56
|
})), /*#__PURE__*/_react["default"].createElement(_SwitchStyle.SwitchStyle, {
|
|
39
57
|
"data-disabled": disabled,
|
|
40
|
-
"data-with-icon": withIcon
|
|
41
|
-
|
|
58
|
+
"data-with-icon": !withText && withIcon,
|
|
59
|
+
"data-with-text": withText
|
|
60
|
+
}, !withText && withIcon && /*#__PURE__*/_react["default"].createElement(IconRender, null), withText && /*#__PURE__*/_react["default"].createElement(RenderSwitchText, null)));
|
|
42
61
|
});
|
|
43
62
|
exports.Switch = Switch;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const SwitchTextStyle: import("styled-components").StyledComponent<({ as, children, variant, style, ...props }: import("..").TypographyProps) => JSX.Element, any, {}, never>;
|
|
1
3
|
export declare const SwitchStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
|
-
export declare const InputStyle: import("styled-components").StyledComponent<"input", any, {
|
|
4
|
+
export declare const InputStyle: import("styled-components").StyledComponent<"input", any, {
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
}, never>;
|
|
3
7
|
export declare const LabelStyle: import("styled-components").StyledComponent<"label", any, {}, never>;
|
|
@@ -2,22 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
|
-
exports.SwitchStyle = exports.LabelStyle = exports.InputStyle = void 0;
|
|
5
|
+
exports.SwitchTextStyle = exports.SwitchStyle = exports.LabelStyle = exports.InputStyle = void 0;
|
|
6
6
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
7
7
|
var _ = require("..");
|
|
8
8
|
var _colors = require("../utilities/colors");
|
|
9
|
+
var SwitchTextStyle = (0, _styledComponents["default"])(_.Typography).withConfig({
|
|
10
|
+
displayName: "SwitchStyle__SwitchTextStyle",
|
|
11
|
+
componentId: "sc-7dlucf-0"
|
|
12
|
+
})([""]);
|
|
13
|
+
exports.SwitchTextStyle = SwitchTextStyle;
|
|
9
14
|
var SwitchStyle = _styledComponents["default"].div.withConfig({
|
|
10
15
|
displayName: "SwitchStyle",
|
|
11
|
-
componentId: "sc-7dlucf-
|
|
12
|
-
})(["display:flex;flex-direction:row;justify-content:space-between;align-items:center;position:relative;width:", ";&[data-with-icon]{width:48px;}&[data-with-icon] 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]{width:44px;}&[data-with-icon] svg{height:14px;}height:22px;}&:before{transition:100ms all;content:'';position:absolute;width:16px;height:16px;border-radius:16px;
|
|
16
|
+
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);
|
|
13
18
|
exports.SwitchStyle = SwitchStyle;
|
|
14
19
|
var InputStyle = _styledComponents["default"].input.withConfig({
|
|
15
20
|
displayName: "SwitchStyle__InputStyle",
|
|
16
|
-
componentId: "sc-7dlucf-
|
|
17
|
-
})(["opacity:0;position:absolute
|
|
21
|
+
componentId: "sc-7dlucf-2"
|
|
22
|
+
})(["opacity:0;position:absolute;& + ", "{", "{padding-inline-start:18px;}}&:checked + ", "{", "{padding-inline-start:unset;padding-inline-end:18px;}background-color:", ";&[data-disabled='true']{background-color:", ";}&:before{right:4px;left:unset;}}& + ", " svg:nth-child(1){visibility:hidden;}& + ", " svg:nth-child(2){visibility:visible;}& + ", " ", ":nth-child(1){visibility:hidden;display:none;}& + ", " ", ":nth-child(2){visibility:visible;display:block;}&:checked + ", " svg:nth-child(1){visibility:visible;}&:checked + ", " svg:nth-child(2){visibility:hidden;}&:checked + ", " ", ":nth-child(1){visibility:visible;display:block;}&:checked + ", " ", ":nth-child(2){visibility:hidden;display:none;}"], SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchTextStyle, function (_ref) {
|
|
23
|
+
var backgroundColor = _ref.backgroundColor;
|
|
24
|
+
return backgroundColor || _colors.Blue.S99;
|
|
25
|
+
}, _colors.Neutral.B95, SwitchStyle, SwitchStyle, SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchStyle, SwitchStyle, SwitchTextStyle, SwitchStyle, SwitchTextStyle);
|
|
18
26
|
exports.InputStyle = InputStyle;
|
|
19
27
|
var LabelStyle = _styledComponents["default"].label.withConfig({
|
|
20
28
|
displayName: "SwitchStyle__LabelStyle",
|
|
21
|
-
componentId: "sc-7dlucf-
|
|
29
|
+
componentId: "sc-7dlucf-3"
|
|
22
30
|
})(["display:flex;align-items:center;gap:10px;cursor:pointer;"]);
|
|
23
31
|
exports.LabelStyle = LabelStyle;
|
package/lib/@next/Tabs/Tabs.js
CHANGED
|
@@ -85,7 +85,8 @@ var Tabs = /*#__PURE__*/_react["default"].forwardRef(function Tabs(_ref, ref) {
|
|
|
85
85
|
var renderTabs = tabs.map(function (tab, index) {
|
|
86
86
|
var tabId = tab.id || (0, _reactIdGenerator["default"])();
|
|
87
87
|
return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledLi, {
|
|
88
|
-
key: tabId + "-" + index
|
|
88
|
+
key: tabId + "-" + index,
|
|
89
|
+
className: "tab-item"
|
|
89
90
|
}, /*#__PURE__*/_react["default"].createElement(_Tab.Tab, {
|
|
90
91
|
id: tabId,
|
|
91
92
|
key: "tab-" + tabId + "-" + index,
|
|
@@ -99,6 +100,7 @@ var Tabs = /*#__PURE__*/_react["default"].forwardRef(function Tabs(_ref, ref) {
|
|
|
99
100
|
return /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledTabsContainer, {
|
|
100
101
|
ref: ref
|
|
101
102
|
}, /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledTabHeaderContainer, {
|
|
103
|
+
className: "tabs-header-container",
|
|
102
104
|
ref: tabsHeaderRef,
|
|
103
105
|
onScroll: handleScroll,
|
|
104
106
|
onWheel: handleWheel,
|
|
@@ -111,6 +113,8 @@ var Tabs = /*#__PURE__*/_react["default"].forwardRef(function Tabs(_ref, ref) {
|
|
|
111
113
|
"data-grabbing": isDragging
|
|
112
114
|
}, /*#__PURE__*/_react["default"].createElement(_TabStyle.StyledUl, {
|
|
113
115
|
"data-fitted": fitted
|
|
114
|
-
}, renderTabs, " ")), /*#__PURE__*/_react["default"].createElement("div",
|
|
116
|
+
}, renderTabs, " ")), /*#__PURE__*/_react["default"].createElement("div", {
|
|
117
|
+
className: "tab-item-content"
|
|
118
|
+
}, children));
|
|
115
119
|
});
|
|
116
120
|
exports.Tabs = Tabs;
|