@redocly/theme 0.41.0-rc.4 → 0.42.0
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/lib/components/CodeBlock/CodeBlockControls.js +2 -1
- package/lib/components/Dropdown/DropdownMenu.d.ts +0 -2
- package/lib/components/Dropdown/DropdownMenu.js +1 -3
- package/lib/components/Dropdown/DropdownMenuItem.js +3 -3
- package/lib/components/Search/Search.js +1 -1
- package/lib/components/Search/SearchDialog.js +26 -103
- package/lib/components/Search/SearchHighlight.d.ts +1 -1
- package/lib/components/Search/SearchHighlight.js +5 -28
- package/lib/components/Search/SearchInput.d.ts +2 -3
- package/lib/components/Search/SearchInput.js +3 -11
- package/lib/components/Search/SearchItem.d.ts +2 -2
- package/lib/components/Search/SearchItem.js +15 -23
- package/lib/components/Search/variables.js +2 -48
- package/lib/components/Segmented/Segmented.d.ts +5 -2
- package/lib/components/Select/Select.d.ts +36 -2
- package/lib/components/Select/Select.js +98 -134
- package/lib/components/Select/variables.js +1 -11
- package/lib/components/Tag/Tag.d.ts +2 -4
- package/lib/components/Tag/Tag.js +4 -40
- package/lib/components/Tag/variables.dark.js +5 -20
- package/lib/components/Tag/variables.js +17 -49
- package/lib/components/VersionPicker/VersionPicker.d.ts +3 -2
- package/lib/components/VersionPicker/VersionPicker.js +30 -13
- package/lib/core/hooks/__mocks__/index.d.ts +1 -1
- package/lib/core/hooks/__mocks__/index.js +1 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.d.ts +1 -1
- package/lib/core/hooks/__mocks__/use-theme-hooks.js +1 -1
- package/lib/core/hooks/index.d.ts +1 -2
- package/lib/core/hooks/index.js +1 -2
- package/lib/core/hooks/search/use-recent-searches.js +0 -2
- package/lib/core/hooks/{search/use-search-dialog.d.ts → use-search.d.ts} +1 -1
- package/lib/core/hooks/{search/use-search-dialog.js → use-search.js} +5 -5
- package/lib/core/styles/dark.js +2 -1
- package/lib/core/styles/global.js +2 -0
- package/lib/core/types/hooks.d.ts +4 -16
- package/lib/core/types/index.d.ts +1 -1
- package/lib/core/types/index.js +1 -1
- package/lib/core/types/l10n.d.ts +2 -1
- package/lib/core/types/search.d.ts +2 -43
- package/lib/core/types/select-option.d.ts +4 -0
- package/lib/core/types/{select.js → select-option.js} +1 -1
- package/lib/index.d.ts +1 -7
- package/lib/index.js +1 -7
- package/lib/markdoc/components/Cards/Card.d.ts +15 -0
- package/lib/markdoc/components/Cards/Card.js +166 -0
- package/lib/markdoc/components/Cards/CardIcon.d.ts +7 -0
- package/lib/markdoc/components/Cards/CardIcon.js +46 -0
- package/lib/markdoc/components/Cards/CardImage.d.ts +7 -0
- package/lib/markdoc/components/Cards/CardImage.js +21 -0
- package/lib/markdoc/components/Cards/Cards.d.ts +8 -0
- package/lib/markdoc/components/Cards/Cards.js +44 -0
- package/lib/markdoc/components/Cards/variables.d.ts +1 -0
- package/lib/markdoc/components/Cards/variables.dark.d.ts +1 -0
- package/lib/markdoc/components/Cards/variables.dark.js +27 -0
- package/lib/markdoc/components/Cards/variables.js +71 -0
- package/lib/markdoc/components/default.d.ts +4 -0
- package/lib/markdoc/components/default.js +4 -0
- package/lib/markdoc/default.d.ts +5 -1
- package/lib/markdoc/default.js +4 -0
- package/lib/markdoc/tags/card.d.ts +2 -0
- package/lib/markdoc/tags/card.js +56 -0
- package/lib/markdoc/tags/cards.d.ts +2 -0
- package/lib/markdoc/tags/cards.js +20 -0
- package/lib/markdoc/tags/types.d.ts +6 -2
- package/package.json +2 -2
- package/src/components/CodeBlock/CodeBlockControls.tsx +1 -1
- package/src/components/Dropdown/DropdownMenu.tsx +1 -2
- package/src/components/Dropdown/DropdownMenuItem.tsx +5 -5
- package/src/components/Filter/FilterSelect.tsx +3 -3
- package/src/components/Search/Search.tsx +2 -2
- package/src/components/Search/SearchDialog.tsx +42 -168
- package/src/components/Search/SearchHighlight.tsx +2 -29
- package/src/components/Search/SearchInput.tsx +3 -17
- package/src/components/Search/SearchItem.tsx +24 -38
- package/src/components/Search/variables.ts +2 -48
- package/src/components/Segmented/Segmented.tsx +2 -2
- package/src/components/Select/Select.tsx +157 -200
- package/src/components/Select/variables.ts +1 -11
- package/src/components/Tag/Tag.tsx +6 -57
- package/src/components/Tag/variables.dark.ts +5 -20
- package/src/components/Tag/variables.ts +17 -49
- package/src/components/VersionPicker/VersionPicker.tsx +39 -15
- package/src/core/hooks/__mocks__/index.ts +1 -1
- package/src/core/hooks/__mocks__/use-theme-hooks.ts +1 -1
- package/src/core/hooks/index.ts +1 -2
- package/src/core/hooks/search/use-recent-searches.ts +0 -3
- package/src/core/hooks/{search/use-search-dialog.ts → use-search.ts} +1 -1
- package/src/core/styles/dark.ts +2 -1
- package/src/core/styles/global.ts +2 -1
- package/src/core/types/hooks.ts +4 -24
- package/src/core/types/index.ts +1 -1
- package/src/core/types/l10n.ts +37 -7
- package/src/core/types/search.ts +2 -54
- package/src/core/types/select-option.ts +4 -0
- package/src/index.ts +1 -7
- package/src/markdoc/components/Cards/Card.tsx +232 -0
- package/src/markdoc/components/Cards/CardIcon.tsx +55 -0
- package/src/markdoc/components/Cards/CardImage.tsx +21 -0
- package/src/markdoc/components/Cards/Cards.tsx +35 -0
- package/src/markdoc/components/Cards/variables.dark.ts +24 -0
- package/src/markdoc/components/Cards/variables.ts +68 -0
- package/src/markdoc/components/default.ts +4 -0
- package/src/markdoc/default.ts +4 -0
- package/src/markdoc/tags/card.ts +55 -0
- package/src/markdoc/tags/cards.ts +18 -0
- package/src/markdoc/tags/types.ts +4 -2
- package/lib/components/Loaders/SpinnerLoader.d.ts +0 -5
- package/lib/components/Loaders/SpinnerLoader.js +0 -32
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.d.ts +0 -12
- package/lib/components/Search/FilterFields/SearchFilterFieldSelect.js +0 -113
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.d.ts +0 -10
- package/lib/components/Search/FilterFields/SearchFilterFieldTags.js +0 -37
- package/lib/components/Search/SearchFilter.d.ts +0 -11
- package/lib/components/Search/SearchFilter.js +0 -71
- package/lib/components/Search/SearchFilterField.d.ts +0 -11
- package/lib/components/Search/SearchFilterField.js +0 -43
- package/lib/components/Search/SearchGroups.d.ts +0 -9
- package/lib/components/Search/SearchGroups.js +0 -69
- package/lib/components/Select/SelectInput.d.ts +0 -23
- package/lib/components/Select/SelectInput.js +0 -129
- package/lib/core/hooks/search/use-search-filter.d.ts +0 -9
- package/lib/core/hooks/search/use-search-filter.js +0 -50
- package/lib/core/types/select.d.ts +0 -30
- package/lib/icons/ResetIcon/ResetIcon.d.ts +0 -9
- package/lib/icons/ResetIcon/ResetIcon.js +0 -22
- package/lib/icons/SettingsIcon/SettingsIcon.d.ts +0 -9
- package/lib/icons/SettingsIcon/SettingsIcon.js +0 -23
- package/src/components/Loaders/SpinnerLoader.tsx +0 -31
- package/src/components/Search/FilterFields/SearchFilterFieldSelect.tsx +0 -134
- package/src/components/Search/FilterFields/SearchFilterFieldTags.tsx +0 -61
- package/src/components/Search/SearchFilter.tsx +0 -90
- package/src/components/Search/SearchFilterField.tsx +0 -84
- package/src/components/Search/SearchGroups.tsx +0 -80
- package/src/components/Select/SelectInput.tsx +0 -201
- package/src/core/hooks/search/use-search-filter.ts +0 -57
- package/src/core/types/select.ts +0 -32
- package/src/icons/ResetIcon/ResetIcon.tsx +0 -26
- package/src/icons/SettingsIcon/SettingsIcon.tsx +0 -30
- /package/lib/components/{Loaders → Loading}/Loading.d.ts +0 -0
- /package/lib/components/{Loaders → Loading}/Loading.js +0 -0
- /package/src/components/{Loaders → Loading}/Loading.tsx +0 -0
|
@@ -26,148 +26,60 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.SelectListItem = exports.SelectList = exports.SelectInputValue = exports.SelectInput = exports.SelectContainer = exports.Select = void 0;
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
32
|
-
const CheckmarkIcon_1 = require("../../icons/CheckmarkIcon/CheckmarkIcon");
|
|
33
|
-
const SelectInput_1 = require("../../components/Select/SelectInput");
|
|
34
|
-
const Dropdown_1 = require("../../components/Dropdown/Dropdown");
|
|
35
|
-
const DropdownMenu_1 = require("../../components/Dropdown/DropdownMenu");
|
|
36
|
-
const DropdownMenuItem_1 = require("../../components/Dropdown/DropdownMenuItem");
|
|
37
32
|
const hooks_1 = require("../../core/hooks");
|
|
33
|
+
const ChevronDownIcon_1 = require("../../icons/ChevronDownIcon/ChevronDownIcon");
|
|
34
|
+
const ChevronUpIcon_1 = require("../../icons/ChevronUpIcon/ChevronUpIcon");
|
|
35
|
+
const CheckmarkIcon_1 = require("../../icons/CheckmarkIcon/CheckmarkIcon");
|
|
38
36
|
function Select(props) {
|
|
39
|
-
const { className, value, options, dataAttributes, withArrow = true, triggerEvent = 'click', placement, alignment, icon, onlyIcon, disabled, placeholder, hideCheckmarkIcon, dataTestId = 'select',
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return selectedOption || typeof value === 'string'
|
|
46
|
-
? { value }
|
|
47
|
-
: value;
|
|
48
|
-
})
|
|
49
|
-
.filter((option) => !!option);
|
|
50
|
-
};
|
|
51
|
-
const [selectedOptions, setSelectedOptions] = (0, react_1.useState)(getSelectedOptionsFromPropsValue());
|
|
52
|
-
const selectRef = (0, react_1.useRef)(null);
|
|
53
|
-
const [searchValue, setSearchValue] = (0, react_1.useState)(null);
|
|
54
|
-
const [dropdownActive, setDropdownActive] = (0, react_1.useState)(false);
|
|
55
|
-
const [filteredOptions, setFilteredOptions] = (0, react_1.useState)(options);
|
|
56
|
-
const [stickyInputValue, setStickyInputValue] = (0, react_1.useState)(placeholder || '');
|
|
57
|
-
const inputId = (0, react_1.useId)();
|
|
58
|
-
(0, hooks_1.useOutsideClick)(selectRef, () => {
|
|
59
|
-
setDropdownActive(false);
|
|
60
|
-
});
|
|
61
|
-
(0, react_1.useEffect)(() => {
|
|
62
|
-
setFilteredOptions(options);
|
|
63
|
-
}, [options]);
|
|
64
|
-
(0, react_1.useEffect)(() => {
|
|
65
|
-
setSelectedOptions(getSelectedOptionsFromPropsValue());
|
|
66
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
67
|
-
}, [multiple, value]);
|
|
68
|
-
(0, react_1.useEffect)(() => {
|
|
69
|
-
if (onSearch) {
|
|
70
|
-
onSearch === null || onSearch === void 0 ? void 0 : onSearch(searchValue);
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
if (typeof searchValue === 'string') {
|
|
74
|
-
const filteredOptions = options.filter((option) => {
|
|
75
|
-
var _a, _b;
|
|
76
|
-
const valueForSearch = String((_b = (_a = option.label) !== null && _a !== void 0 ? _a : option.value) !== null && _b !== void 0 ? _b : '');
|
|
77
|
-
return (!valueForSearch || valueForSearch.toLowerCase().indexOf(searchValue.toLowerCase()) > -1);
|
|
78
|
-
});
|
|
79
|
-
setFilteredOptions(filteredOptions);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
setFilteredOptions(options);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
-
}, [searchValue]);
|
|
87
|
-
const selectHandler = (selectedOption) => {
|
|
88
|
-
const newSelectedOptions = multiple
|
|
89
|
-
? isSelected(selectedOption)
|
|
90
|
-
? selectedOptions.filter((option) => option.value !== selectedOption.value)
|
|
91
|
-
: [...selectedOptions, selectedOption]
|
|
92
|
-
: [selectedOption];
|
|
93
|
-
const newSelectedValues = newSelectedOptions.length
|
|
94
|
-
? multiple
|
|
95
|
-
? newSelectedOptions.map((o) => o.value)
|
|
96
|
-
: newSelectedOptions[0].value
|
|
97
|
-
: multiple
|
|
98
|
-
? []
|
|
99
|
-
: '';
|
|
100
|
-
setSelectedOptions(newSelectedOptions);
|
|
101
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newSelectedValues);
|
|
102
|
-
setSearchValue(null);
|
|
103
|
-
setDropdownActive(false);
|
|
104
|
-
if (!multiple) {
|
|
105
|
-
setStickyInputValue('');
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const searchHandler = (e) => {
|
|
109
|
-
const targetValue = e.target.value;
|
|
110
|
-
setSearchValue(targetValue);
|
|
111
|
-
setDropdownActive(true);
|
|
112
|
-
};
|
|
113
|
-
const clearHandler = (option) => {
|
|
114
|
-
if (option) {
|
|
115
|
-
selectHandler(option);
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
if (!multiple) {
|
|
119
|
-
setStickyInputValue('');
|
|
120
|
-
}
|
|
121
|
-
setSelectedOptions([]);
|
|
122
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(multiple ? [] : '');
|
|
123
|
-
}
|
|
37
|
+
const { className, value, options, dataAttributes, withArrow = true, triggerEvent = 'click', onChange, placement, alignment, icon, onlyIcon, disabled, placeholder, hideCheckmarkIcon, renderInput, renderDivider, dataTestId = 'select', } = props;
|
|
38
|
+
const containerRef = (0, react_1.useRef)(null);
|
|
39
|
+
const [isOpen, setIsOpen] = (0, react_1.useState)(false);
|
|
40
|
+
// const [selectedIdx, setSelectedIdx] = useState<React.ReactNode | string>(selected);
|
|
41
|
+
const handleOpen = () => {
|
|
42
|
+
setIsOpen(true);
|
|
124
43
|
};
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const relatedTarget = e.relatedTarget;
|
|
128
|
-
const isDropdownItem = ((_a = relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.attributes.getNamedItem('data-component-name')) === null || _a === void 0 ? void 0 : _a.value) ===
|
|
129
|
-
'Dropdown/DropdownMenuItem';
|
|
130
|
-
if (!isDropdownItem) {
|
|
131
|
-
if (!e.relatedTarget || ((_b = e.relatedTarget) === null || _b === void 0 ? void 0 : _b.id) !== inputId) {
|
|
132
|
-
setDropdownActive(false);
|
|
133
|
-
}
|
|
134
|
-
setSearchValue(null);
|
|
135
|
-
setStickyInputValue('');
|
|
136
|
-
}
|
|
44
|
+
const handleClose = () => {
|
|
45
|
+
setIsOpen(false);
|
|
137
46
|
};
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
setStickyInputValue(selectedOptions[0].label || selectedOptions[0].value);
|
|
141
|
-
}
|
|
47
|
+
const handleToggle = () => {
|
|
48
|
+
setIsOpen(!isOpen);
|
|
142
49
|
};
|
|
143
|
-
const
|
|
144
|
-
|
|
50
|
+
const handleSelect = (value) => {
|
|
51
|
+
// setSelectedIdx(options.findIndex(o => o.value === value));
|
|
52
|
+
setIsOpen(false);
|
|
53
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(value);
|
|
145
54
|
};
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
react_1.default.createElement(
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
55
|
+
(0, hooks_1.useOutsideClick)(containerRef, handleClose);
|
|
56
|
+
// useEffect(() => {
|
|
57
|
+
// handleSelect(selected);
|
|
58
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
59
|
+
// }, [selected]);
|
|
60
|
+
const selectedOption = options.find((option) => option.value === value);
|
|
61
|
+
const renderDefaultInput = () => (react_1.default.createElement(exports.SelectInput, null,
|
|
62
|
+
!onlyIcon && (react_1.default.createElement(exports.SelectInputValue, null, (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) || (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.element) || placeholder)),
|
|
63
|
+
icon,
|
|
64
|
+
withArrow ? isOpen ? react_1.default.createElement(ChevronUpIcon_1.ChevronUpIcon, { size: "14px" }) : react_1.default.createElement(ChevronDownIcon_1.ChevronDownIcon, { size: "14px" }) : null));
|
|
65
|
+
return (react_1.default.createElement(exports.SelectContainer, Object.assign({ "data-component-name": "Select/Select" }, dataAttributes, { disabled: disabled, "data-testid": dataTestId, className: className, ref: containerRef, onPointerEnter: triggerEvent === 'hover' ? handleOpen : undefined, onPointerLeave: triggerEvent === 'hover' ? handleClose : undefined, onClick: triggerEvent === 'click' ? handleToggle : undefined }),
|
|
66
|
+
renderInput ? renderInput({ isOpen }) : renderDefaultInput(),
|
|
67
|
+
isOpen && (react_1.default.createElement(exports.SelectList, { placement: placement, alignment: alignment }, options.map((option, index) => {
|
|
68
|
+
const selected = option.value === value;
|
|
69
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
70
|
+
react_1.default.createElement(exports.SelectListItem, { key: index, onClick: () => handleSelect(option.value), selected: selected },
|
|
71
|
+
typeof option.element === 'string' ? (react_1.default.createElement("div", null, option.element)) : (option.element),
|
|
72
|
+
!hideCheckmarkIcon && selected && react_1.default.createElement(CheckmarkIcon_1.CheckmarkIcon, null)),
|
|
73
|
+
renderDivider && index !== options.length - 1 ? renderDivider() : null));
|
|
74
|
+
})))));
|
|
159
75
|
}
|
|
160
76
|
exports.Select = Select;
|
|
161
|
-
exports.
|
|
162
|
-
display: flex;
|
|
163
|
-
width: 100%;
|
|
77
|
+
exports.SelectContainer = styled_components_1.default.div `
|
|
164
78
|
position: relative;
|
|
165
79
|
font-size: var(--select-font-size);
|
|
166
80
|
font-weight: var(--select-font-weight);
|
|
167
81
|
line-height: var(--select-line-height);
|
|
168
82
|
border-radius: var(--select-border-radius);
|
|
169
|
-
border: var(--search-trigger-border-width) var(--search-trigger-border-style)
|
|
170
|
-
var(--search-trigger-border-color);
|
|
171
83
|
color: var(--select-text-color);
|
|
172
84
|
min-width: 0;
|
|
173
85
|
|
|
@@ -176,15 +88,67 @@ exports.SelectWrapper = styled_components_1.default.div `
|
|
|
176
88
|
opacity: 0.59;
|
|
177
89
|
pointer-events: none;
|
|
178
90
|
`}
|
|
91
|
+
a {
|
|
92
|
+
display: block;
|
|
93
|
+
text-decoration: none;
|
|
94
|
+
color: var(--select-text-color);
|
|
95
|
+
}
|
|
179
96
|
`;
|
|
180
|
-
|
|
181
|
-
|
|
97
|
+
exports.SelectInput = styled_components_1.default.div `
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
border-radius: var(--select-input-border-radius);
|
|
102
|
+
padding: var(--select-input-padding);
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
gap: 8px;
|
|
105
|
+
`;
|
|
106
|
+
exports.SelectInputValue = styled_components_1.default.div `
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
text-overflow: ellipsis;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
`;
|
|
112
|
+
exports.SelectList = styled_components_1.default.ul `
|
|
113
|
+
position: absolute;
|
|
114
|
+
top: ${({ placement }) => (placement === 'top' ? 'auto' : '100%')};
|
|
115
|
+
bottom: ${({ placement }) => (placement === 'top' ? '100%' : 'auto')};
|
|
116
|
+
left: ${({ alignment }) => (alignment === 'start' ? '0' : 'auto')};
|
|
117
|
+
right: ${({ alignment }) => (alignment === 'end' ? '0' : 'auto')};
|
|
118
|
+
margin: 0;
|
|
119
|
+
min-width: var(--select-list-min-width);
|
|
120
|
+
max-width: var(--select-list-max-width);
|
|
121
|
+
padding: var(--select-list-padding);
|
|
122
|
+
background-color: var(--select-list-bg-color);
|
|
123
|
+
border-radius: var(--select-list-border-radius);
|
|
124
|
+
box-shadow: var(--select-list-box-shadow);
|
|
125
|
+
list-style-type: none;
|
|
126
|
+
cursor: pointer;
|
|
127
|
+
white-space: nowrap;
|
|
128
|
+
overflow: hidden;
|
|
129
|
+
z-index: 1;
|
|
130
|
+
`;
|
|
131
|
+
exports.SelectListItem = styled_components_1.default.li `
|
|
132
|
+
display: flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
justify-content: space-between;
|
|
135
|
+
border-radius: var(--select-list-item-border-radius);
|
|
136
|
+
gap: var(--select-list-item-gap);
|
|
137
|
+
padding: var(--select-list-item-padding);
|
|
138
|
+
${({ selected }) => selected &&
|
|
139
|
+
`
|
|
140
|
+
font-weight: var(--select-list-item-font-weight-active);
|
|
141
|
+
background-color: var(--select-list-item-bg-color-active);
|
|
142
|
+
&:hover { background-color: var(--select-list-item-bg-color-active)};
|
|
143
|
+
`}
|
|
182
144
|
|
|
183
|
-
> * {
|
|
184
|
-
|
|
145
|
+
& > * {
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
text-overflow: ellipsis;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
&:hover {
|
|
151
|
+
background-color: var(--select-list-item-bg-color-hover);
|
|
185
152
|
}
|
|
186
|
-
`;
|
|
187
|
-
const SelectDropdownMenu = (0, styled_components_1.default)(DropdownMenu_1.DropdownMenu) `
|
|
188
|
-
width: 100%;
|
|
189
153
|
`;
|
|
190
154
|
//# sourceMappingURL=Select.js.map
|
|
@@ -11,18 +11,10 @@ exports.select = (0, styled_components_1.css) `
|
|
|
11
11
|
--select-line-height: var(--line-height-base); // @presenter LineHeight
|
|
12
12
|
--select-text-color: var(--text-color-secondary); // @presenter Color
|
|
13
13
|
--select-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
14
|
-
|
|
15
14
|
--select-input-padding-vertical: 6px; // @presenter Spacing
|
|
16
|
-
--select-input-padding-horizontal:
|
|
15
|
+
--select-input-padding-horizontal: 16px; // @presenter Spacing
|
|
17
16
|
--select-input-padding: var(--select-input-padding-vertical) var(--select-input-padding-horizontal);
|
|
18
|
-
--select-input-gap: var(--spacing-xs); // @presenter Spacing
|
|
19
|
-
--select-input-value-gap: var(--spacing-unit); // @presenter Spacing
|
|
20
17
|
--select-input-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
21
|
-
--select-input-font-size: var(--font-size-base); // @presenter FontSize
|
|
22
|
-
--select-input-font-weight: var(--font-weight-regular); // @presenter FontWeight
|
|
23
|
-
--select-input-line-height: var(--line-height-base); // @presenter LineHeight
|
|
24
|
-
--select-input-bg-color: var(--bg-color); // @presenter Color
|
|
25
|
-
--select-input-placeholder-color: var(--input-content-placeholder-color); // @presenter Color
|
|
26
18
|
|
|
27
19
|
--select-list-min-width: 100px;
|
|
28
20
|
--select-list-max-width: 300px;
|
|
@@ -40,8 +32,6 @@ exports.select = (0, styled_components_1.css) `
|
|
|
40
32
|
--select-list-item-bg-color-active: transparent; // @presenter Color
|
|
41
33
|
--select-list-item-bg-color-hover: var(--menu-item-bg-color-hover); // @presenter Color
|
|
42
34
|
--select-list-item-font-weight-active: var(--font-weight-medium); // @presenter Color
|
|
43
|
-
|
|
44
|
-
--select-placeholder-color: var(--color-warm-grey-6); // @presenter Color
|
|
45
35
|
// @tokens End
|
|
46
36
|
`;
|
|
47
37
|
//# sourceMappingURL=variables.js.map
|
|
@@ -16,9 +16,7 @@ export type TagProps = {
|
|
|
16
16
|
statusDotColor?: string;
|
|
17
17
|
size?: string;
|
|
18
18
|
icon?: React.ReactNode;
|
|
19
|
-
|
|
20
|
-
onClick?: (event: React.MouseEvent) => void;
|
|
21
|
-
onClose?: (event: React.MouseEvent) => void;
|
|
19
|
+
onClick?: () => void;
|
|
22
20
|
};
|
|
23
|
-
export declare function Tag({ children, color, icon,
|
|
21
|
+
export declare function Tag({ children, color, icon, onClick, size, borderless, withStatusDot, statusDotColor, ...otherProps }: TagProps): JSX.Element;
|
|
24
22
|
export {};
|
|
@@ -17,41 +17,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
exports.Tag = void 0;
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
|
19
19
|
const styled_components_1 = __importDefault(require("styled-components"));
|
|
20
|
-
const CloseIcon_1 = require("../../icons/CloseIcon/CloseIcon");
|
|
21
|
-
const CheckmarkFilledIcon_1 = require("../../icons/CheckmarkFilledIcon/CheckmarkFilledIcon");
|
|
22
20
|
function Tag(_a) {
|
|
23
|
-
var { children, color, icon,
|
|
24
|
-
return (react_1.default.createElement(
|
|
21
|
+
var { children, color, icon, onClick, size, borderless, withStatusDot, statusDotColor = 'var(--tag-status-dot-color-default)' } = _a, otherProps = __rest(_a, ["children", "color", "icon", "onClick", "size", "borderless", "withStatusDot", "statusDotColor"]);
|
|
22
|
+
return (react_1.default.createElement(TagContainer, Object.assign({ "data-component-name": "Tag/Tag", borderless: borderless, color: color, size: size, onClick: onClick }, otherProps),
|
|
25
23
|
withStatusDot ? react_1.default.createElement(StatusDot, { color: statusDotColor }) : icon ? icon : null,
|
|
26
|
-
|
|
27
|
-
closable && (react_1.default.createElement(CloseButton, { onClick: (event) => {
|
|
28
|
-
onClose === null || onClose === void 0 ? void 0 : onClose(event);
|
|
29
|
-
} },
|
|
30
|
-
react_1.default.createElement(CloseIcon_1.CloseIcon, null))),
|
|
31
|
-
active && react_1.default.createElement(ActiveIcon, null)));
|
|
24
|
+
children));
|
|
32
25
|
}
|
|
33
26
|
exports.Tag = Tag;
|
|
34
|
-
const
|
|
35
|
-
display: inline-flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
text-wrap: nowrap;
|
|
39
|
-
|
|
40
|
-
padding: var(--tag-content-padding);
|
|
41
|
-
gap: var(--tag-content-gap);
|
|
42
|
-
`;
|
|
43
|
-
const CloseButton = styled_components_1.default.div `
|
|
44
|
-
display: flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
align-self: stretch;
|
|
48
|
-
border-radius: 0 var(--tag-border-radius) var(--tag-border-radius) 0;
|
|
49
|
-
|
|
50
|
-
&:hover {
|
|
51
|
-
background: var(--tag-close-button-bg-color-hover);
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
const TagWrapper = styled_components_1.default.div.attrs(({ className, color, size }) => ({
|
|
27
|
+
const TagContainer = styled_components_1.default.div.attrs(({ className, color, size }) => ({
|
|
55
28
|
className: (className || '') +
|
|
56
29
|
` tag-default ${color ? `tag-${color}` : ''} ${size ? `tag-size-${size}` : ''}`,
|
|
57
30
|
})) `
|
|
@@ -59,10 +32,8 @@ const TagWrapper = styled_components_1.default.div.attrs(({ className, color, si
|
|
|
59
32
|
align-items: center;
|
|
60
33
|
justify-content: center;
|
|
61
34
|
text-wrap: nowrap;
|
|
62
|
-
position: relative;
|
|
63
35
|
|
|
64
36
|
padding: var(--tag-padding);
|
|
65
|
-
${({ hasCloseButton }) => (hasCloseButton ? 'padding-right: 0;' : '')};
|
|
66
37
|
margin: var(--tag-margin);
|
|
67
38
|
|
|
68
39
|
&:last-child {
|
|
@@ -93,11 +64,4 @@ const StatusDot = styled_components_1.default.div `
|
|
|
93
64
|
border-radius: 50%;
|
|
94
65
|
background-color: ${({ color }) => color};
|
|
95
66
|
`;
|
|
96
|
-
const ActiveIcon = (0, styled_components_1.default)(CheckmarkFilledIcon_1.CheckmarkFilledIcon) `
|
|
97
|
-
width: 12px;
|
|
98
|
-
height: 12px;
|
|
99
|
-
position: absolute;
|
|
100
|
-
right: -4px;
|
|
101
|
-
top: -4px;
|
|
102
|
-
`;
|
|
103
67
|
//# sourceMappingURL=Tag.js.map
|
|
@@ -3,26 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.tagDarkMode = void 0;
|
|
4
4
|
const styled_components_1 = require("styled-components");
|
|
5
5
|
exports.tagDarkMode = (0, styled_components_1.css) `
|
|
6
|
-
--tag-operation-color-delete: #fa82a2;
|
|
7
|
-
--tag-operation-
|
|
8
|
-
|
|
9
|
-
--tag-operation-color-
|
|
10
|
-
--tag-operation-
|
|
11
|
-
|
|
12
|
-
--tag-operation-color-post: #90b0f0; // @presenter Color
|
|
13
|
-
--tag-operation-bg-color-post: #233061; // @presenter Color
|
|
14
|
-
|
|
15
|
-
--tag-operation-color-put: #e0a663; // @presenter Color
|
|
16
|
-
--tag-operation-bg-color-put: #612729; // @presenter Color
|
|
17
|
-
|
|
18
|
-
--tag-operation-color-patch: #e0c363; // @presenter Color
|
|
19
|
-
--tag-operation-bg-color-patch: #5C3721; // @presenter Color
|
|
20
|
-
|
|
21
|
-
--tag-operation-color-head: #e6e1fe; // @presenter Color
|
|
22
|
-
--tag-operation-bg-color-head: #5b4ccc; // @presenter Color
|
|
23
|
-
|
|
24
|
-
--tag-operation-color-options: #1a1c21; // @presenter Color
|
|
25
|
-
--tag-operation-bg-color-options: #2a2b33; // @presenter Color
|
|
6
|
+
--tag-operation-color-delete: #fa82a2;
|
|
7
|
+
--tag-operation-color-get: #68cc97;
|
|
8
|
+
--tag-operation-color-post: #90b0f0;
|
|
9
|
+
--tag-operation-color-put: #e0a663;
|
|
10
|
+
--tag-operation-color-patch: #e0c363;
|
|
26
11
|
|
|
27
12
|
.tag-grey,
|
|
28
13
|
.tag-draft,
|
|
@@ -9,7 +9,7 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
9
9
|
|
|
10
10
|
--tag-border-width: 1px; //@presenter Border
|
|
11
11
|
--tag-border-style: solid; //@presenter Border
|
|
12
|
-
--tag-border-radius: var(--border-radius); // @presenter BorderRadius
|
|
12
|
+
--tag-border-radius: var(--border-radius-xl); // @presenter BorderRadius
|
|
13
13
|
--tag-box-shadow: none; // @presenter Shadow
|
|
14
14
|
|
|
15
15
|
--tag-status-dot-color-default: var(--color-persian-green-7);
|
|
@@ -22,17 +22,8 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
22
22
|
* @tokens Tag spacing
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
--tag-padding
|
|
26
|
-
--tag-padding
|
|
27
|
-
--tag-padding: 0 var(--tag-padding-horizontal); //@presenter Spacing
|
|
28
|
-
--tag-content-padding: var(--tag-padding-vertical) 0; //@presenter Spacing
|
|
29
|
-
--tag-content-gap: 4px; //@presenter Spacing
|
|
30
|
-
|
|
31
|
-
--tag-large-padding-vertical: 4px; //@presenter Spacing
|
|
32
|
-
--tag-large-padding-horizontal: 16px; //@presenter Spacing
|
|
33
|
-
--tag-large-padding: 0 var(--tag-large-padding-horizontal); //@presenter Spacing
|
|
34
|
-
--tag-large-content-padding: var(--tag-large-padding-vertical); //@presenter Spacing
|
|
35
|
-
|
|
25
|
+
--tag-padding: 1px 8px; //@presenter Spacing
|
|
26
|
+
--tag-large-padding: 4px 16px; //@presenter Spacing
|
|
36
27
|
--tag-margin: 0 5px 0 0; //@presenter Spacing
|
|
37
28
|
--tag-gap: 5px; //@presenter Spacing
|
|
38
29
|
|
|
@@ -42,7 +33,6 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
42
33
|
|
|
43
34
|
.tag-size-large {
|
|
44
35
|
--tag-padding: var(--tag-large-padding);
|
|
45
|
-
--tag-content-padding: var(--tag-large-content-padding);
|
|
46
36
|
--tag-font-size: var(--font-size-base);
|
|
47
37
|
}
|
|
48
38
|
|
|
@@ -77,7 +67,6 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
77
67
|
--tag-color: var(--text-color-primary); // @presenter Color
|
|
78
68
|
--tag-bg-color: var(--color-warm-grey-2); // @presenter Color
|
|
79
69
|
--tag-border-color: var(--border-color-primary); // @presenter Color
|
|
80
|
-
--tag-close-button-bg-color-hover: var(--color-warm-grey-3); // @presenter Color
|
|
81
70
|
}
|
|
82
71
|
|
|
83
72
|
.tag-green,
|
|
@@ -86,7 +75,6 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
86
75
|
--tag-color: var(--color-success-active); // @presenter Color
|
|
87
76
|
--tag-bg-color: var(--color-success-bg); // @presenter Color
|
|
88
77
|
--tag-border-color: var(--color-success-active); // @presenter Color
|
|
89
|
-
--tag-close-button-bg-color-hover: var(--color-success-bg-hover); // @presenter Color
|
|
90
78
|
}
|
|
91
79
|
|
|
92
80
|
.tag-red,
|
|
@@ -95,7 +83,6 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
95
83
|
--tag-color: var(--color-error-active); // @presenter Color
|
|
96
84
|
--tag-bg-color: var(--color-error-bg); // @presenter Color
|
|
97
85
|
--tag-border-color: var(--color-error-active); // @presenter Color
|
|
98
|
-
--tag-close-button-bg-color-hover: var(--color-error-hover); // @presenter Color
|
|
99
86
|
}
|
|
100
87
|
|
|
101
88
|
.tag-gold,
|
|
@@ -104,7 +91,6 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
104
91
|
--tag-color: var(--color-warning-active); // @presenter Color
|
|
105
92
|
--tag-bg-color: var(--color-warning-bg); // @presenter Color
|
|
106
93
|
--tag-border-color: var(--color-warning-active); // @presenter Color
|
|
107
|
-
--tag-close-button-bg-color-hover: var(--color-warning-hover); // @presenter Color
|
|
108
94
|
}
|
|
109
95
|
|
|
110
96
|
.tag-blue,
|
|
@@ -112,7 +98,6 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
112
98
|
--tag-color: var(--color-info-active); // @presenter Color
|
|
113
99
|
--tag-bg-color: var(--color-info-bg); // @presenter Color
|
|
114
100
|
--tag-border-color: var(--color-info-active); // @presenter Color
|
|
115
|
-
--tag-close-button-bg-color-hover: var(--color-info-hover); // @presenter Color
|
|
116
101
|
}
|
|
117
102
|
|
|
118
103
|
.tag-purple,
|
|
@@ -120,24 +105,26 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
120
105
|
--tag-color: var(--color-purple-7); // @presenter Color
|
|
121
106
|
--tag-bg-color: var(--color-purple-1); // @presenter Color
|
|
122
107
|
--tag-border-color: var(--color-purple-7); // @presenter Color
|
|
123
|
-
--tag-close-button-bg-color-hover: var(--color-purple-3); // @presenter Color
|
|
124
108
|
}
|
|
125
109
|
|
|
126
110
|
.tag-cyan,
|
|
127
|
-
.tag-option
|
|
128
|
-
.tag-geekblue,
|
|
129
|
-
.tag-link {
|
|
111
|
+
.tag-option {
|
|
130
112
|
--tag-color: var(--color-turquoise-7); // @presenter Color
|
|
131
113
|
--tag-bg-color: var(--color-turquoise-1); // @presenter Color
|
|
132
114
|
--tag-border-color: var(--color-turquoise-7); // @presenter Color
|
|
133
|
-
--tag-close-button-bg-color-hover: var(--color-turquoise-3); // @presenter Color
|
|
134
115
|
}
|
|
135
116
|
|
|
136
117
|
.tag-yellow {
|
|
137
118
|
--tag-color: var(--color-carrot-7); // @presenter Color
|
|
138
119
|
--tag-bg-color: var(--color-carrot-1); // @presenter Color
|
|
139
120
|
--tag-border-color: var(--color-carrot-7); // @presenter Color
|
|
140
|
-
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.tag-geekblue,
|
|
124
|
+
.tag-link {
|
|
125
|
+
--tag-color: var(--color-turquoise-7); // @presenter Color
|
|
126
|
+
--tag-bg-color: var(--color-turquoise-1); // @presenter Color
|
|
127
|
+
--tag-border-color: var(--color-turquoise-7); // @presenter Color
|
|
141
128
|
}
|
|
142
129
|
|
|
143
130
|
.tag-magenta,
|
|
@@ -145,21 +132,18 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
145
132
|
--tag-color: var(--color-magenta-7); // @presenter Color
|
|
146
133
|
--tag-bg-color: var(--color-magenta-1); // @presenter Color
|
|
147
134
|
--tag-border-color: var(--color-magenta-7); // @presenter Color
|
|
148
|
-
--tag-close-button-bg-color-hover: var(--color-magenta-3); // @presenter Color
|
|
149
135
|
}
|
|
150
136
|
|
|
151
137
|
.tag-lime {
|
|
152
138
|
--tag-color: var(--color-green-7); // @presenter Color
|
|
153
139
|
--tag-bg-color: none; // @presenter Color
|
|
154
140
|
--tag-border-color: var(--color-green-7); // @presenter Color
|
|
155
|
-
--tag-close-button-bg-color-hover: var(--color-green-3); // @presenter Color
|
|
156
141
|
}
|
|
157
142
|
|
|
158
143
|
.tag-product {
|
|
159
144
|
--tag-color: var(--color-warm-grey-7); // @presenter Color
|
|
160
145
|
--tag-bg-color: transparent; // @presenter Color
|
|
161
146
|
--tag-border-color: var(--color-warm-grey-4); // @presenter Color
|
|
162
|
-
--tag-close-button-bg-color-hover: var(--color-warm-grey-3); // @presenter Color
|
|
163
147
|
}
|
|
164
148
|
|
|
165
149
|
/**
|
|
@@ -174,28 +158,12 @@ exports.tag = (0, styled_components_1.css) `
|
|
|
174
158
|
* @tokens Operation tag colors
|
|
175
159
|
*/
|
|
176
160
|
|
|
177
|
-
--tag-operation-color-delete: #
|
|
178
|
-
--tag-operation-
|
|
179
|
-
|
|
180
|
-
--tag-operation-color-
|
|
181
|
-
--tag-operation-
|
|
182
|
-
|
|
183
|
-
--tag-operation-color-post: #1e65f5; // @presenter Color
|
|
184
|
-
--tag-operation-bg-color-post: #e2ebfe; // @presenter Color
|
|
185
|
-
|
|
186
|
-
--tag-operation-color-put: #f5901d; // @presenter Color
|
|
187
|
-
--tag-operation-bg-color-put: #fef1e2; // @presenter Color
|
|
188
|
-
|
|
189
|
-
--tag-operation-color-patch: #f5c31d; // @presenter Color
|
|
190
|
-
--tag-operation-bg-color-patch: #fdf6dd; // @presenter Color
|
|
191
|
-
|
|
192
|
-
--tag-operation-color-head: #5b4ccc; // @presenter Color
|
|
193
|
-
--tag-operation-bg-color-head: #e6e1fe; // @presenter Color
|
|
194
|
-
|
|
195
|
-
--tag-operation-color-options: #1a1c21; // @presenter Color
|
|
196
|
-
--tag-operation-bg-color-options: #ededf2; // @presenter Color
|
|
197
|
-
|
|
198
|
-
--tag-operation-color-deprecated: var(--text-color-disabled); // @presenter Color
|
|
161
|
+
--tag-operation-color-delete: #E70B46;
|
|
162
|
+
--tag-operation-color-get: #25B869;
|
|
163
|
+
--tag-operation-color-post: #1E65F5;
|
|
164
|
+
--tag-operation-color-put: #F5901D;
|
|
165
|
+
--tag-operation-color-patch: #F5C31D;
|
|
166
|
+
--tag-operation-color-deprecated: var(--text-color-disabled);
|
|
199
167
|
|
|
200
168
|
.tag-delete {
|
|
201
169
|
--tag-color: var(--tag-operation-color-delete); // @presenter Color
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import type { Version } from '@redocly/config';
|
|
3
|
-
import type
|
|
4
|
-
|
|
3
|
+
import { Select, type SelectProps } from '../../components/Select/Select';
|
|
4
|
+
export interface VersionPickerProps extends SelectProps {
|
|
5
|
+
}
|
|
5
6
|
export declare function VersionPicker(props: {
|
|
6
7
|
versions?: Version[];
|
|
7
8
|
onChange: (v: Version) => void;
|