@sipesistemas/polaris 1.2.3 → 1.3.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/build/cjs/components/ActionList/ActionList.js +1 -1
- package/build/cjs/components/Filters/components/FiltersBar/FiltersBar.js +11 -5
- package/build/cjs/components/Pagination/Pagination.js +6 -3
- package/build/cjs/components/SearchableSelect/SearchableSelect.css.js +9 -0
- package/build/cjs/components/SearchableSelect/SearchableSelect.js +243 -0
- package/build/cjs/components/TopBar/TopBar.css.js +2 -2
- package/build/cjs/components/TopBar/TopBar.js +7 -12
- package/build/cjs/components/TopBar/components/ActionButton/ActionButton.js +27 -0
- package/build/cjs/index.js +2 -0
- package/build/esm/components/ActionList/ActionList.js +1 -1
- package/build/esm/components/Filters/components/FiltersBar/FiltersBar.js +11 -5
- package/build/esm/components/Pagination/Pagination.js +7 -4
- package/build/esm/components/SearchableSelect/SearchableSelect.css.js +5 -0
- package/build/esm/components/SearchableSelect/SearchableSelect.js +241 -0
- package/build/esm/components/TopBar/TopBar.css.js +2 -2
- package/build/esm/components/TopBar/TopBar.js +8 -13
- package/build/esm/components/TopBar/components/ActionButton/ActionButton.js +25 -0
- package/build/esm/index.js +1 -0
- package/build/esm/styles.css +31 -18
- package/build/esnext/components/ActionList/ActionList.esnext +1 -1
- package/build/esnext/components/AppProvider/global.out.css +1 -1
- package/build/esnext/components/Filters/components/FiltersBar/FiltersBar.esnext +11 -5
- package/build/esnext/components/Pagination/Pagination.esnext +7 -4
- package/build/esnext/components/SearchableSelect/SearchableSelect.css.esnext +7 -0
- package/build/esnext/components/SearchableSelect/SearchableSelect.esnext +241 -0
- package/build/esnext/components/SearchableSelect/SearchableSelect.out.css +11 -0
- package/build/esnext/components/TopBar/TopBar.css.esnext +2 -2
- package/build/esnext/components/TopBar/TopBar.esnext +8 -13
- package/build/esnext/components/TopBar/TopBar.out.css +17 -17
- package/build/esnext/components/TopBar/components/ActionButton/ActionButton.esnext +25 -0
- package/build/esnext/index.esnext +1 -0
- package/build/ts/.storybook/main.d.ts.map +1 -1
- package/build/ts/src/components/Filters/components/FiltersBar/FiltersBar.d.ts.map +1 -1
- package/build/ts/src/components/Page/components/Header/Header.d.ts +1 -4
- package/build/ts/src/components/Page/components/Header/Header.d.ts.map +1 -1
- package/build/ts/src/components/Page/components/Header/components/Title/Title.d.ts +1 -4
- package/build/ts/src/components/Page/components/Header/components/Title/Title.d.ts.map +1 -1
- package/build/ts/src/components/Pagination/Pagination.d.ts +3 -1
- package/build/ts/src/components/Pagination/Pagination.d.ts.map +1 -1
- package/build/ts/src/components/SearchableSelect/SearchableSelect.d.ts +60 -0
- package/build/ts/src/components/SearchableSelect/SearchableSelect.d.ts.map +1 -0
- package/build/ts/src/components/SearchableSelect/index.d.ts +2 -0
- package/build/ts/src/components/SearchableSelect/index.d.ts.map +1 -0
- package/build/ts/src/components/TopBar/TopBar.d.ts +7 -5
- package/build/ts/src/components/TopBar/TopBar.d.ts.map +1 -1
- package/build/ts/src/components/TopBar/components/ActionButton/ActionButton.d.ts +11 -0
- package/build/ts/src/components/TopBar/components/ActionButton/ActionButton.d.ts.map +1 -0
- package/build/ts/src/components/TopBar/components/ActionButton/index.d.ts +3 -0
- package/build/ts/src/components/TopBar/components/ActionButton/index.d.ts.map +1 -0
- package/build/ts/src/components/TopBar/components/index.d.ts +1 -0
- package/build/ts/src/components/TopBar/components/index.d.ts.map +1 -1
- package/build/ts/src/index.d.ts +2 -0
- package/build/ts/src/index.d.ts.map +1 -1
- package/locales/en.json +7 -0
- package/locales/pt-BR.json +7 -0
- package/package.json +8 -5
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { CaretDownIcon, SearchIcon } from '@shopify/polaris-icons';
|
|
2
|
+
import { useState, useRef, useId, useCallback, useEffect, useMemo } from 'react';
|
|
3
|
+
import styles from './SearchableSelect.css.js';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
import { useI18n } from '../../utilities/i18n/hooks.js';
|
|
6
|
+
import { TextField } from '../TextField/TextField.js';
|
|
7
|
+
import { Icon } from '../Icon/Icon.js';
|
|
8
|
+
import { Listbox, AutoSelection } from '../Listbox/Listbox.js';
|
|
9
|
+
import { EmptySearchResult } from '../EmptySearchResult/EmptySearchResult.js';
|
|
10
|
+
import { Popover } from '../Popover/Popover.js';
|
|
11
|
+
import { Box } from '../Box/Box.js';
|
|
12
|
+
import { Scrollable } from '../Scrollable/Scrollable.js';
|
|
13
|
+
|
|
14
|
+
function getValueByPath(obj, path) {
|
|
15
|
+
return path.split('.').reduce((acc, part) => acc?.[part], obj);
|
|
16
|
+
}
|
|
17
|
+
const SCROLLABLE_HEIGHT = 292;
|
|
18
|
+
function SearchableSelect({
|
|
19
|
+
loading,
|
|
20
|
+
loadingMore,
|
|
21
|
+
options,
|
|
22
|
+
selected,
|
|
23
|
+
onSelect,
|
|
24
|
+
emptyStateTitle = '',
|
|
25
|
+
emptyStateDescription,
|
|
26
|
+
onQueryChange,
|
|
27
|
+
selectedLabelKey,
|
|
28
|
+
label,
|
|
29
|
+
placeholder,
|
|
30
|
+
disabled,
|
|
31
|
+
requiredIndicator,
|
|
32
|
+
helpText,
|
|
33
|
+
error,
|
|
34
|
+
pinSelected = true,
|
|
35
|
+
allowClear,
|
|
36
|
+
onScrolledToBottom
|
|
37
|
+
}) {
|
|
38
|
+
const i18n = useI18n();
|
|
39
|
+
const [query, setQuery] = useState('');
|
|
40
|
+
const [popoverActive, setPopoverActive] = useState(false);
|
|
41
|
+
const [activeOptionId, setActiveOptionId] = useState();
|
|
42
|
+
// pagination/search can drop the selected option from `options`; the cache keeps its label visible
|
|
43
|
+
const [cachedSelection, setCachedSelection] = useState(null);
|
|
44
|
+
// clicking the clear button bubbles to TextField's container, which focuses the input
|
|
45
|
+
const skipNextFocusOpen = useRef(false);
|
|
46
|
+
const listboxId = useId();
|
|
47
|
+
const togglePopoverActive = useCallback(() => {
|
|
48
|
+
setPopoverActive(active => !active);
|
|
49
|
+
setQuery('');
|
|
50
|
+
onQueryChange('');
|
|
51
|
+
}, [onQueryChange]);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
function handleEsc(event) {
|
|
54
|
+
if (event.key === 'Escape') setPopoverActive(false);
|
|
55
|
+
}
|
|
56
|
+
document.addEventListener('keydown', handleEsc);
|
|
57
|
+
return () => document.removeEventListener('keydown', handleEsc);
|
|
58
|
+
}, []);
|
|
59
|
+
|
|
60
|
+
// keep the cache in sync while the selected option is loaded, so its label survives (and stays
|
|
61
|
+
// fresh) if pagination later drops the option from `options`
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (selected.length < 1) return;
|
|
64
|
+
const loadedOption = options.find(option => option.value === selected[0]);
|
|
65
|
+
const label = getValueByPath(loadedOption?.object, selectedLabelKey);
|
|
66
|
+
if (typeof label === 'string' && (cachedSelection?.value !== selected[0] || cachedSelection.label !== label)) {
|
|
67
|
+
setCachedSelection({
|
|
68
|
+
value: selected[0],
|
|
69
|
+
label
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}, [selected, options, selectedLabelKey, cachedSelection]);
|
|
73
|
+
const textSelectedItem = useMemo(() => {
|
|
74
|
+
if (selected.length < 1) return '';
|
|
75
|
+
const selectedItem = options.find(option => option.value === selected[0]);
|
|
76
|
+
const value = getValueByPath(selectedItem?.object, selectedLabelKey);
|
|
77
|
+
if (typeof value === 'string') return value;
|
|
78
|
+
return cachedSelection?.value === selected[0] ? cachedSelection.label : '';
|
|
79
|
+
}, [selected, options, selectedLabelKey, cachedSelection]);
|
|
80
|
+
const handleSelectionClear = useCallback(() => {
|
|
81
|
+
setCachedSelection(null);
|
|
82
|
+
onSelect([]);
|
|
83
|
+
if (requiredIndicator) {
|
|
84
|
+
setPopoverActive(true);
|
|
85
|
+
} else {
|
|
86
|
+
skipNextFocusOpen.current = true;
|
|
87
|
+
}
|
|
88
|
+
}, [onSelect, requiredIndicator]);
|
|
89
|
+
const handleActivatorFocus = useCallback(() => {
|
|
90
|
+
if (disabled) return;
|
|
91
|
+
if (skipNextFocusOpen.current) {
|
|
92
|
+
skipNextFocusOpen.current = false;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
setPopoverActive(true);
|
|
96
|
+
}, [disabled]);
|
|
97
|
+
const activator = /*#__PURE__*/jsx("div", {
|
|
98
|
+
className: styles.Activator,
|
|
99
|
+
children: /*#__PURE__*/jsx(TextField, {
|
|
100
|
+
label: label,
|
|
101
|
+
placeholder: placeholder,
|
|
102
|
+
autoComplete: "off",
|
|
103
|
+
value: textSelectedItem,
|
|
104
|
+
disabled: disabled,
|
|
105
|
+
requiredIndicator: requiredIndicator,
|
|
106
|
+
helpText: helpText,
|
|
107
|
+
error: error,
|
|
108
|
+
clearButton: allowClear && textSelectedItem !== '',
|
|
109
|
+
onClearButtonClick: handleSelectionClear,
|
|
110
|
+
onFocus: handleActivatorFocus,
|
|
111
|
+
suffix: /*#__PURE__*/jsx(Icon, {
|
|
112
|
+
source: CaretDownIcon
|
|
113
|
+
})
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
const pinnedSelectedOption = useMemo(() => {
|
|
117
|
+
if (query || selected.length < 1) return null;
|
|
118
|
+
const loadedOption = options.find(option => option.value === selected[0]);
|
|
119
|
+
if (loadedOption) {
|
|
120
|
+
return pinSelected ? {
|
|
121
|
+
value: loadedOption.value,
|
|
122
|
+
label: loadedOption.label
|
|
123
|
+
} : null;
|
|
124
|
+
}
|
|
125
|
+
return cachedSelection?.value === selected[0] ? cachedSelection : null;
|
|
126
|
+
}, [query, selected, options, cachedSelection, pinSelected]);
|
|
127
|
+
const optionsMarkup = useMemo(() => {
|
|
128
|
+
if (loading) return null;
|
|
129
|
+
const listOptions = pinnedSelectedOption ? options.filter(option => option.value !== pinnedSelectedOption.value) : options;
|
|
130
|
+
if (listOptions.length === 0 && !pinnedSelectedOption) return null;
|
|
131
|
+
const pinnedMarkup = pinnedSelectedOption ? /*#__PURE__*/jsx(Listbox.Option, {
|
|
132
|
+
value: pinnedSelectedOption.value,
|
|
133
|
+
selected: true,
|
|
134
|
+
children: /*#__PURE__*/jsx(Listbox.TextOption, {
|
|
135
|
+
selected: true,
|
|
136
|
+
children: pinnedSelectedOption.label
|
|
137
|
+
})
|
|
138
|
+
}, pinnedSelectedOption.value) : null;
|
|
139
|
+
return [pinnedMarkup, ...listOptions.map(option => {
|
|
140
|
+
const isSelected = selected.includes(option.value);
|
|
141
|
+
return /*#__PURE__*/jsx(Listbox.Option, {
|
|
142
|
+
value: option.value,
|
|
143
|
+
selected: isSelected,
|
|
144
|
+
children: /*#__PURE__*/jsx(Listbox.TextOption, {
|
|
145
|
+
selected: isSelected,
|
|
146
|
+
children: option.label
|
|
147
|
+
})
|
|
148
|
+
}, option.value);
|
|
149
|
+
})];
|
|
150
|
+
}, [loading, options, selected, pinnedSelectedOption]);
|
|
151
|
+
const loadingMarkup = loading ? /*#__PURE__*/jsx(Listbox.Loading, {
|
|
152
|
+
accessibilityLabel: i18n.translate('Polaris.SearchableSelect.loadingAccessibilityLabel')
|
|
153
|
+
}) : null;
|
|
154
|
+
const loadingMoreMarkup = loadingMore ? /*#__PURE__*/jsx(Listbox.Loading, {
|
|
155
|
+
accessibilityLabel: i18n.translate('Polaris.SearchableSelect.loadingMoreAccessibilityLabel')
|
|
156
|
+
}) : null;
|
|
157
|
+
const noResultsMarkup = !loading && options.length === 0 && !pinnedSelectedOption ? /*#__PURE__*/jsx(EmptySearchResult, {
|
|
158
|
+
title: emptyStateTitle,
|
|
159
|
+
description: emptyStateDescription ?? (query ? i18n.translate('Polaris.SearchableSelect.noResultsFoundFor', {
|
|
160
|
+
query
|
|
161
|
+
}) : i18n.translate('Polaris.SearchableSelect.noResultsFound'))
|
|
162
|
+
}) : null;
|
|
163
|
+
const updateSelection = useCallback(newSelection => {
|
|
164
|
+
const option = options.find(({
|
|
165
|
+
value
|
|
166
|
+
}) => value === newSelection);
|
|
167
|
+
const label = getValueByPath(option?.object, selectedLabelKey);
|
|
168
|
+
if (typeof label === 'string') {
|
|
169
|
+
setCachedSelection({
|
|
170
|
+
value: newSelection,
|
|
171
|
+
label
|
|
172
|
+
});
|
|
173
|
+
} else if (cachedSelection?.value !== newSelection) {
|
|
174
|
+
// re-selecting the pinned option (absent from `options`) must keep its cached label
|
|
175
|
+
setCachedSelection(null);
|
|
176
|
+
}
|
|
177
|
+
onSelect([newSelection]);
|
|
178
|
+
setQuery('');
|
|
179
|
+
onQueryChange('');
|
|
180
|
+
setPopoverActive(false);
|
|
181
|
+
}, [options, selectedLabelKey, cachedSelection, onSelect, onQueryChange]);
|
|
182
|
+
const handleActiveOptionChange = useCallback((_value, domId) => {
|
|
183
|
+
setActiveOptionId(domId);
|
|
184
|
+
}, []);
|
|
185
|
+
const handleQueryClear = useCallback(() => {
|
|
186
|
+
setQuery('');
|
|
187
|
+
onQueryChange('');
|
|
188
|
+
}, [onQueryChange]);
|
|
189
|
+
return /*#__PURE__*/jsx(Popover, {
|
|
190
|
+
activator: activator,
|
|
191
|
+
active: popoverActive,
|
|
192
|
+
onClose: togglePopoverActive,
|
|
193
|
+
fullWidth: true,
|
|
194
|
+
autofocusTarget: "first-node",
|
|
195
|
+
preferInputActivator: false,
|
|
196
|
+
children: /*#__PURE__*/jsxs(Popover.Pane, {
|
|
197
|
+
fixed: true,
|
|
198
|
+
children: [/*#__PURE__*/jsx(Box, {
|
|
199
|
+
padding: "300",
|
|
200
|
+
children: /*#__PURE__*/jsx(TextField, {
|
|
201
|
+
prefix: /*#__PURE__*/jsx(Icon, {
|
|
202
|
+
source: SearchIcon
|
|
203
|
+
}),
|
|
204
|
+
label: "",
|
|
205
|
+
labelHidden: true,
|
|
206
|
+
autoComplete: "off",
|
|
207
|
+
placeholder: i18n.translate('Polaris.SearchableSelect.searchPlaceholder'),
|
|
208
|
+
clearButton: true,
|
|
209
|
+
ariaActiveDescendant: activeOptionId,
|
|
210
|
+
ariaControls: listboxId,
|
|
211
|
+
value: query,
|
|
212
|
+
onChange: value => {
|
|
213
|
+
onQueryChange(value);
|
|
214
|
+
setQuery(value);
|
|
215
|
+
},
|
|
216
|
+
onClearButtonClick: handleQueryClear
|
|
217
|
+
})
|
|
218
|
+
}), /*#__PURE__*/jsx(Scrollable, {
|
|
219
|
+
style: {
|
|
220
|
+
position: 'relative',
|
|
221
|
+
maxHeight: SCROLLABLE_HEIGHT,
|
|
222
|
+
padding: '0 0 var(--p-space-200)',
|
|
223
|
+
borderBottomLeftRadius: 'var(--p-border-radius-200)',
|
|
224
|
+
borderBottomRightRadius: 'var(--p-border-radius-200)'
|
|
225
|
+
},
|
|
226
|
+
horizontal: false,
|
|
227
|
+
onScrolledToBottom: onScrolledToBottom,
|
|
228
|
+
children: /*#__PURE__*/jsxs(Listbox, {
|
|
229
|
+
enableKeyboardControl: true,
|
|
230
|
+
autoSelection: selected.length > 0 ? AutoSelection.FirstSelected : AutoSelection.None,
|
|
231
|
+
customListId: listboxId,
|
|
232
|
+
onSelect: updateSelection,
|
|
233
|
+
onActiveOptionChange: handleActiveOptionChange,
|
|
234
|
+
children: [optionsMarkup, loadingMarkup, loadingMoreMarkup, noResultsMarkup]
|
|
235
|
+
})
|
|
236
|
+
})]
|
|
237
|
+
})
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export { SearchableSelect };
|
|
@@ -14,8 +14,8 @@ var styles = {
|
|
|
14
14
|
"LeftContent": "Polaris-TopBar__LeftContent",
|
|
15
15
|
"Search": "Polaris-TopBar__Search",
|
|
16
16
|
"RightContent": "Polaris-TopBar__RightContent",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"ActionWrapper": "Polaris-TopBar__ActionWrapper",
|
|
18
|
+
"ActionButton": "Polaris-TopBar__ActionButton",
|
|
19
19
|
"SecondaryMenu": "Polaris-TopBar__SecondaryMenu"
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuIcon
|
|
1
|
+
import { MenuIcon } from '@shopify/polaris-icons';
|
|
2
2
|
import { classNames } from '../../utilities/css.js';
|
|
3
3
|
import { getWidth } from '../../utilities/get-width.js';
|
|
4
4
|
import { useToggle } from '../../utilities/use-toggle.js';
|
|
@@ -6,6 +6,7 @@ import styles from './TopBar.css.js';
|
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
import { SearchField } from './components/SearchField/SearchField.js';
|
|
8
8
|
import { UserMenu } from './components/UserMenu/UserMenu.js';
|
|
9
|
+
import { ActionButton } from './components/ActionButton/ActionButton.js';
|
|
9
10
|
import { Search } from './components/Search/Search.js';
|
|
10
11
|
import { useI18n } from '../../utilities/i18n/hooks.js';
|
|
11
12
|
import { useFrame } from '../../utilities/frame/hooks.js';
|
|
@@ -28,7 +29,7 @@ const TopBar = function TopBar({
|
|
|
28
29
|
searchResultsVisible,
|
|
29
30
|
searchResultsOverlayVisible = false,
|
|
30
31
|
onNavigationToggle,
|
|
31
|
-
|
|
32
|
+
actions,
|
|
32
33
|
onSearchResultsDismiss,
|
|
33
34
|
contextControl,
|
|
34
35
|
logoSuffix
|
|
@@ -105,17 +106,10 @@ const TopBar = function TopBar({
|
|
|
105
106
|
children: searchMarkup
|
|
106
107
|
}), /*#__PURE__*/jsxs("div", {
|
|
107
108
|
className: styles.RightContent,
|
|
108
|
-
children: [
|
|
109
|
-
className: styles.
|
|
110
|
-
children:
|
|
111
|
-
|
|
112
|
-
className: classNames(styles.HelpActivator, userMenu && styles['Activator-userMenu']),
|
|
113
|
-
onClick: onHelpToggle,
|
|
114
|
-
children: /*#__PURE__*/jsx(Icon, {
|
|
115
|
-
source: QuestionCircleIcon
|
|
116
|
-
})
|
|
117
|
-
})
|
|
118
|
-
}), /*#__PURE__*/jsx("div", {
|
|
109
|
+
children: [actions?.map((action, index) => /*#__PURE__*/jsx("div", {
|
|
110
|
+
className: styles.ActionWrapper,
|
|
111
|
+
children: action
|
|
112
|
+
}, index)), /*#__PURE__*/jsx("div", {
|
|
119
113
|
className: styles.SecondaryMenu,
|
|
120
114
|
children: secondaryMenu
|
|
121
115
|
}), userMenu]
|
|
@@ -126,5 +120,6 @@ const TopBar = function TopBar({
|
|
|
126
120
|
TopBar.Menu = Menu;
|
|
127
121
|
TopBar.SearchField = SearchField;
|
|
128
122
|
TopBar.UserMenu = UserMenu;
|
|
123
|
+
TopBar.ActionButton = ActionButton;
|
|
129
124
|
|
|
130
125
|
export { TopBar };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import styles from '../../TopBar.css.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Icon } from '../../../Icon/Icon.js';
|
|
4
|
+
import { Text } from '../../../Text/Text.js';
|
|
5
|
+
|
|
6
|
+
function ActionButton({
|
|
7
|
+
icon,
|
|
8
|
+
accessibilityLabel,
|
|
9
|
+
onClick
|
|
10
|
+
}) {
|
|
11
|
+
return /*#__PURE__*/jsxs("button", {
|
|
12
|
+
type: "button",
|
|
13
|
+
className: styles.ActionButton,
|
|
14
|
+
onClick: onClick,
|
|
15
|
+
children: [/*#__PURE__*/jsx(Icon, {
|
|
16
|
+
source: icon
|
|
17
|
+
}), /*#__PURE__*/jsx(Text, {
|
|
18
|
+
as: "span",
|
|
19
|
+
visuallyHidden: true,
|
|
20
|
+
children: accessibilityLabel
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { ActionButton };
|
package/build/esm/index.js
CHANGED
|
@@ -103,6 +103,7 @@ export { ResourceItem } from './components/ResourceItem/ResourceItem.js';
|
|
|
103
103
|
export { ResourceList } from './components/ResourceList/ResourceList.js';
|
|
104
104
|
export { Scrollable } from './components/Scrollable/Scrollable.js';
|
|
105
105
|
export { ScrollLock } from './components/ScrollLock/ScrollLock.js';
|
|
106
|
+
export { SearchableSelect } from './components/SearchableSelect/SearchableSelect.js';
|
|
106
107
|
export { Select } from './components/Select/Select.js';
|
|
107
108
|
export { SelectAllActions } from './components/SelectAllActions/SelectAllActions.js';
|
|
108
109
|
export { SettingToggle } from './components/SettingToggle/SettingToggle.js';
|
package/build/esm/styles.css
CHANGED
|
@@ -3456,7 +3456,7 @@
|
|
|
3456
3456
|
@keyframes p-motion-keyframes-appear-below{ from{ transform:translateY(calc(var(--p-space-100)*-1)); opacity:0; } to{ transform:none; opacity:1; } }
|
|
3457
3457
|
|
|
3458
3458
|
:root{
|
|
3459
|
-
--polaris-version-number:'1.
|
|
3459
|
+
--polaris-version-number:'1.3.0';
|
|
3460
3460
|
|
|
3461
3461
|
--pg-navigation-width:15rem;
|
|
3462
3462
|
--pg-dangerous-magic-space-4:1rem;
|
|
@@ -15157,6 +15157,19 @@ body{
|
|
|
15157
15157
|
}
|
|
15158
15158
|
|
|
15159
15159
|
|
|
15160
|
+
.Polaris-SearchableSelect__Activator .Polaris-TextField__Input,
|
|
15161
|
+
.Polaris-SearchableSelect__Activator .Polaris-TextField__Suffix{
|
|
15162
|
+
cursor:pointer;
|
|
15163
|
+
caret-color:transparent;
|
|
15164
|
+
}
|
|
15165
|
+
|
|
15166
|
+
.Polaris-SearchableSelect__Activator .Polaris-TextField:not(:focus-within) .Polaris-TextField__ClearButton{
|
|
15167
|
+
visibility:visible;
|
|
15168
|
+
opacity:1;
|
|
15169
|
+
position:static;
|
|
15170
|
+
}
|
|
15171
|
+
|
|
15172
|
+
|
|
15160
15173
|
.Polaris-SelectAllActions{
|
|
15161
15174
|
display:flex;
|
|
15162
15175
|
gap:var(--p-space-200);
|
|
@@ -15704,13 +15717,13 @@ body{
|
|
|
15704
15717
|
justify-content:flex-end;
|
|
15705
15718
|
}
|
|
15706
15719
|
|
|
15707
|
-
.Polaris-
|
|
15720
|
+
.Polaris-TopBar__ActionWrapper{
|
|
15708
15721
|
height:var(--pg-top-bar-height);
|
|
15709
15722
|
display:flex;
|
|
15710
15723
|
align-items:center;
|
|
15711
15724
|
}
|
|
15712
15725
|
|
|
15713
|
-
.Polaris-
|
|
15726
|
+
.Polaris-TopBar__ActionButton{
|
|
15714
15727
|
-webkit-appearance:none;
|
|
15715
15728
|
appearance:none;
|
|
15716
15729
|
margin:0;
|
|
@@ -15738,11 +15751,11 @@ body{
|
|
|
15738
15751
|
background-color:var(--p-color-bg-fill-inverse);
|
|
15739
15752
|
}
|
|
15740
15753
|
|
|
15741
|
-
.Polaris-
|
|
15754
|
+
.Polaris-TopBar__ActionButton:focus{
|
|
15742
15755
|
outline:none;
|
|
15743
15756
|
}
|
|
15744
15757
|
|
|
15745
|
-
.Polaris-
|
|
15758
|
+
.Polaris-TopBar__ActionButton::after {
|
|
15746
15759
|
content: '';
|
|
15747
15760
|
position: absolute;
|
|
15748
15761
|
z-index: 1;
|
|
@@ -15756,50 +15769,50 @@ body{
|
|
|
15756
15769
|
border-radius: var(--p-border-radius-100);
|
|
15757
15770
|
}
|
|
15758
15771
|
|
|
15759
|
-
.Polaris-
|
|
15772
|
+
.Polaris-TopBar__ActionButton:focus{
|
|
15760
15773
|
background-color:var(--p-color-bg-fill-inverse-hover);
|
|
15761
15774
|
outline:none;
|
|
15762
15775
|
}
|
|
15763
15776
|
|
|
15764
|
-
.Polaris-
|
|
15777
|
+
.Polaris-TopBar__ActionButton:focus-visible{
|
|
15765
15778
|
outline:var(--p-border-width-050) solid var(--p-color-border-focus);
|
|
15766
15779
|
outline-offset:var(--p-space-050);
|
|
15767
15780
|
}
|
|
15768
15781
|
|
|
15769
|
-
.Polaris-
|
|
15782
|
+
.Polaris-TopBar__ActionButton:focus-visible::after{
|
|
15770
15783
|
content:none;
|
|
15771
15784
|
}
|
|
15772
15785
|
|
|
15773
|
-
.Polaris-
|
|
15786
|
+
.Polaris-TopBar__ActionButton:hover{
|
|
15774
15787
|
background-color:var(--p-color-bg-fill-inverse-hover);
|
|
15775
15788
|
}
|
|
15776
15789
|
|
|
15777
|
-
.Polaris-
|
|
15778
|
-
.Polaris-
|
|
15790
|
+
.Polaris-TopBar__ActionButton:active,
|
|
15791
|
+
.Polaris-TopBar__ActionButton[aria-expanded='true']{
|
|
15779
15792
|
background-color:var(--p-color-bg-fill-inverse-active);
|
|
15780
15793
|
outline:none;
|
|
15781
15794
|
transition:none;
|
|
15782
15795
|
}
|
|
15783
15796
|
|
|
15784
|
-
.Polaris-
|
|
15797
|
+
.Polaris-TopBar__ActionButton:active::after, .Polaris-TopBar__ActionButton[aria-expanded='true']::after{
|
|
15785
15798
|
border:none;
|
|
15786
15799
|
}
|
|
15787
15800
|
|
|
15788
|
-
.Polaris-
|
|
15801
|
+
.Polaris-TopBar__ActionButton:active p, .Polaris-TopBar__ActionButton[aria-expanded='true'] p{
|
|
15789
15802
|
color:var(--p-color-text-inverse);
|
|
15790
15803
|
}
|
|
15791
15804
|
|
|
15792
15805
|
@media (max-width: 47.9975em){
|
|
15793
15806
|
|
|
15794
|
-
.Polaris-
|
|
15807
|
+
.Polaris-TopBar__ActionButton{
|
|
15795
15808
|
margin-right:var(--p-space-200);
|
|
15796
15809
|
background-color:var(--p-color-bg-inverse);
|
|
15797
15810
|
}
|
|
15798
15811
|
|
|
15799
|
-
.Polaris-
|
|
15800
|
-
.Polaris-
|
|
15801
|
-
.Polaris-
|
|
15802
|
-
.Polaris-
|
|
15812
|
+
.Polaris-TopBar__ActionButton:focus,
|
|
15813
|
+
.Polaris-TopBar__ActionButton:hover,
|
|
15814
|
+
.Polaris-TopBar__ActionButton:active,
|
|
15815
|
+
.Polaris-TopBar__ActionButton[aria-expanded='true']{
|
|
15803
15816
|
opacity:0.85;
|
|
15804
15817
|
}
|
|
15805
15818
|
}
|
|
@@ -50,7 +50,7 @@ function ActionList({
|
|
|
50
50
|
actionRole: actionRole,
|
|
51
51
|
onActionAnyItem: onActionAnyItem,
|
|
52
52
|
isFirst: index === 0
|
|
53
|
-
}, typeof section.title === 'string' ? section.title : index) : null;
|
|
53
|
+
}, typeof section.title === 'string' && section.title ? section.title : index) : null;
|
|
54
54
|
});
|
|
55
55
|
const handleFocusPreviousItem = evt => {
|
|
56
56
|
evt.preventDefault();
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
@keyframes p-motion-keyframes-appear-below{ from{ transform:translateY(calc(var(--p-space-100)*-1)); opacity:0; } to{ transform:none; opacity:1; } }
|
|
22
22
|
|
|
23
23
|
:root{
|
|
24
|
-
--polaris-version-number:'1.
|
|
24
|
+
--polaris-version-number:'1.3.0';
|
|
25
25
|
|
|
26
26
|
--pg-navigation-width:15rem;
|
|
27
27
|
--pg-dangerous-magic-space-4:1rem;
|
|
@@ -73,11 +73,17 @@ function FiltersBar({
|
|
|
73
73
|
togglePopoverActive();
|
|
74
74
|
}, 0);
|
|
75
75
|
};
|
|
76
|
-
const filterToActionItem = filter =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
const filterToActionItem = filter => {
|
|
77
|
+
const {
|
|
78
|
+
key: _filterKey,
|
|
79
|
+
...rest
|
|
80
|
+
} = filter;
|
|
81
|
+
return {
|
|
82
|
+
...rest,
|
|
83
|
+
content: filter.label,
|
|
84
|
+
onAction: onFilterClick(filter)
|
|
85
|
+
};
|
|
86
|
+
};
|
|
81
87
|
const unpinnedFilters = filters.filter(filter => !pinnedFilters.some(({
|
|
82
88
|
key
|
|
83
89
|
}) => key === filter.key));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChevronLeftIcon, ChevronRightIcon } from '@shopify/polaris-icons';
|
|
1
|
+
import { ChevronUpIcon, ChevronLeftIcon, ChevronDownIcon, ChevronRightIcon } from '@shopify/polaris-icons';
|
|
2
2
|
import { createRef } from 'react';
|
|
3
3
|
import { classNames } from '../../utilities/css.esnext';
|
|
4
4
|
import { isInputFocused } from '../../utilities/is-input-focused.esnext';
|
|
@@ -27,15 +27,18 @@ function Pagination({
|
|
|
27
27
|
accessibilityLabel,
|
|
28
28
|
accessibilityLabels,
|
|
29
29
|
label,
|
|
30
|
-
type = 'page'
|
|
30
|
+
type = 'page',
|
|
31
|
+
direction = 'horizontal'
|
|
31
32
|
}) {
|
|
32
33
|
const i18n = useI18n();
|
|
33
34
|
const node = /*#__PURE__*/createRef();
|
|
34
35
|
const navLabel = accessibilityLabel || i18n.translate('Polaris.Pagination.pagination');
|
|
35
36
|
const previousLabel = accessibilityLabels?.previous || i18n.translate('Polaris.Pagination.previous');
|
|
36
37
|
const nextLabel = accessibilityLabels?.next || i18n.translate('Polaris.Pagination.next');
|
|
38
|
+
const previousIcon = direction === 'vertical' ? ChevronUpIcon : ChevronLeftIcon;
|
|
39
|
+
const nextIcon = direction === 'vertical' ? ChevronDownIcon : ChevronRightIcon;
|
|
37
40
|
const prev = /*#__PURE__*/jsx(Button, {
|
|
38
|
-
icon:
|
|
41
|
+
icon: previousIcon,
|
|
39
42
|
accessibilityLabel: previousLabel,
|
|
40
43
|
url: previousURL,
|
|
41
44
|
onClick: onPrevious,
|
|
@@ -49,7 +52,7 @@ function Pagination({
|
|
|
49
52
|
children: prev
|
|
50
53
|
}) : prev;
|
|
51
54
|
const next = /*#__PURE__*/jsx(Button, {
|
|
52
|
-
icon:
|
|
55
|
+
icon: nextIcon,
|
|
53
56
|
accessibilityLabel: nextLabel,
|
|
54
57
|
url: nextURL,
|
|
55
58
|
onClick: onNext,
|