@cloud-ru/ds-uikit-product-page-layout 2.3.1-preview-93c4db1d.0 → 2.3.1-preview-e89a5d25.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/dist/cjs/components/Actions/MobileActions.js +4 -8
- package/dist/cjs/components/PageForm/mobileStyles.module.css +2 -0
- package/dist/cjs/style.css +2 -0
- package/dist/esm/components/Actions/MobileActions.js +4 -8
- package/dist/esm/components/PageForm/mobileStyles.module.css +2 -0
- package/dist/esm/style.css +2 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +11 -11
- package/src/components/Actions/MobileActions.tsx +5 -13
- package/src/components/PageForm/mobileStyles.module.scss +3 -0
|
@@ -20,9 +20,6 @@ const ActionView_1 = require("./ActionView");
|
|
|
20
20
|
const constants_2 = require("./constants");
|
|
21
21
|
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
22
22
|
const utils_2 = require("./utils");
|
|
23
|
-
function isOverflowOnly(action) {
|
|
24
|
-
return action.variant === constants_2.BUTTON_TYPE.Kebab || action.variant === constants_2.BUTTON_TYPE.Quota;
|
|
25
|
-
}
|
|
26
23
|
function MobileActionsBase({ items, maxVisibleItems }) {
|
|
27
24
|
const containerRef = (0, react_2.useRef)(null);
|
|
28
25
|
const [isOpen, setIsOpen] = (0, react_2.useState)(false);
|
|
@@ -30,18 +27,17 @@ function MobileActionsBase({ items, maxVisibleItems }) {
|
|
|
30
27
|
const activeAction = openQuotaIndex === undefined ? undefined : items[openQuotaIndex];
|
|
31
28
|
const openQuota = activeAction?.variant === constants_2.BUTTON_TYPE.Quota ? activeAction : undefined;
|
|
32
29
|
const availableItems = (0, react_2.useMemo)(() => items.filter(item => !item.hidden), [items]);
|
|
33
|
-
const measurableItems = (0, react_2.useMemo)(() => availableItems.filter(action => action.variant !== constants_2.BUTTON_TYPE.Quota), [availableItems]);
|
|
34
30
|
const { visibleItems, hiddenItems } = (0, utils_1.useDynamicList)({
|
|
35
31
|
parentContainerRef: containerRef,
|
|
36
|
-
items:
|
|
32
|
+
items: availableItems,
|
|
37
33
|
maxVisibleItems,
|
|
38
34
|
});
|
|
39
35
|
const { t: tQuota } = uikit_product_quota_1.quotaLocale.useTranslations();
|
|
40
36
|
if (!(0, utils_2.hasVisibleActions)(items)) {
|
|
41
37
|
return null;
|
|
42
38
|
}
|
|
43
|
-
const overflowItems =
|
|
44
|
-
const visibleActions = visibleItems.filter(action =>
|
|
39
|
+
const overflowItems = hiddenItems.concat(visibleItems.filter(action => action.variant === constants_2.BUTTON_TYPE.Kebab));
|
|
40
|
+
const visibleActions = visibleItems.filter(action => action.variant !== constants_2.BUTTON_TYPE.Kebab);
|
|
45
41
|
const droplistItems = overflowItems.reduce((acc, action) => {
|
|
46
42
|
if (action.variant === 'custom') {
|
|
47
43
|
const { asListItem } = action.render();
|
|
@@ -128,7 +124,7 @@ function MobileActionsBase({ items, maxVisibleItems }) {
|
|
|
128
124
|
}
|
|
129
125
|
return acc;
|
|
130
126
|
}, []);
|
|
131
|
-
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.mobileActionsWrapper, ref: containerRef, "data-test-id": constants_1.TEST_IDS.mobileActions.root, children: [droplistItems.length > 0 && ((0, jsx_runtime_1.jsx)(list_1.Droplist, { size: 'm', open: isOpen, onOpenChange: setIsOpen, items: droplistItems, children: (0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.button, view: button_1.VIEW.Outline, appearance: 'neutral', icon: (0, jsx_runtime_1.jsx)(system_1.KebabSVG, {}), size: 'm', "data-test-id": constants_1.TEST_IDS.mobileActions.trigger }) })), openQuota && ((0, jsx_runtime_1.jsxs)(modal_1.ModalCustom, { open: true, onClose: () => setOpenQuotaIndex(undefined),
|
|
127
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: styles_module_scss_1.default.mobileActionsWrapper, ref: containerRef, "data-test-id": constants_1.TEST_IDS.mobileActions.root, children: [droplistItems.length > 0 && ((0, jsx_runtime_1.jsx)(list_1.Droplist, { size: 'm', open: isOpen, onOpenChange: setIsOpen, items: droplistItems, children: (0, jsx_runtime_1.jsx)(button_1.Button, { className: styles_module_scss_1.default.button, view: button_1.VIEW.Outline, appearance: 'neutral', icon: (0, jsx_runtime_1.jsx)(system_1.KebabSVG, {}), size: 'm', "data-test-id": constants_1.TEST_IDS.mobileActions.trigger }) })), openQuota && ((0, jsx_runtime_1.jsxs)(modal_1.ModalCustom, { open: true, onClose: () => setOpenQuotaIndex(undefined), children: [(0, jsx_runtime_1.jsx)(modal_1.ModalCustom.Header, { title: tQuota('quotas'), subtitle: openQuota.projectName }), (0, jsx_runtime_1.jsx)(modal_1.ModalCustom.Body, { content: (0, jsx_runtime_1.jsx)(uikit_product_quota_1.QuotaWidgetContent, { quotas: openQuota.quotas, quotasUrl: openQuota.quotasUrl, projectName: openQuota.projectName, loading: openQuota.loading, error: openQuota.error, onRefresh: openQuota.onRefresh, canEditQuota: openQuota.canEditQuota, onIncreaseQuotaClick: openQuota.onIncreaseQuotaClick, onQuotasUrlClick: openQuota.onQuotasUrlClick, disableSorting: openQuota.disableSorting, skeletonRowCount: openQuota.skeletonRowCount, hideMobileHeader: true }) })] })), visibleActions.map((action, index) => ((0, react_1.createElement)(ActionView_1.ActionView, { ...action, key: index, commonProps: {
|
|
132
128
|
className: styles_module_scss_1.default.button,
|
|
133
129
|
size: 'm',
|
|
134
130
|
fullWidth: true,
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
bottom:0;
|
|
31
31
|
display:flex;
|
|
32
32
|
flex-direction:column;
|
|
33
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
33
34
|
box-sizing:border-box;
|
|
34
35
|
margin:0 calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)))) calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))));
|
|
35
36
|
padding:var(--sn-primitive-dimension-8, 8px) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
43
44
|
align-items:center;
|
|
44
45
|
justify-content:space-between;
|
|
46
|
+
min-height:var(--sn-primitive-dimension-40, 40px);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
.priceSummaryText{
|
package/dist/cjs/style.css
CHANGED
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
bottom:0;
|
|
176
176
|
display:flex;
|
|
177
177
|
flex-direction:column;
|
|
178
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
178
179
|
box-sizing:border-box;
|
|
179
180
|
margin:0 calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)))) calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))));
|
|
180
181
|
padding:var(--sn-primitive-dimension-8, 8px) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
|
|
@@ -187,6 +188,7 @@
|
|
|
187
188
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
188
189
|
align-items:center;
|
|
189
190
|
justify-content:space-between;
|
|
191
|
+
min-height:var(--sn-primitive-dimension-40, 40px);
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
.priceSummaryText{
|
|
@@ -14,9 +14,6 @@ import { ActionView } from './ActionView.js';
|
|
|
14
14
|
import { BUTTON_TYPE } from './constants.js';
|
|
15
15
|
import styles from './styles.module.css';
|
|
16
16
|
import { hasVisibleActions } from './utils.js';
|
|
17
|
-
function isOverflowOnly(action) {
|
|
18
|
-
return action.variant === BUTTON_TYPE.Kebab || action.variant === BUTTON_TYPE.Quota;
|
|
19
|
-
}
|
|
20
17
|
function MobileActionsBase({ items, maxVisibleItems }) {
|
|
21
18
|
const containerRef = useRef(null);
|
|
22
19
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -24,18 +21,17 @@ function MobileActionsBase({ items, maxVisibleItems }) {
|
|
|
24
21
|
const activeAction = openQuotaIndex === undefined ? undefined : items[openQuotaIndex];
|
|
25
22
|
const openQuota = activeAction?.variant === BUTTON_TYPE.Quota ? activeAction : undefined;
|
|
26
23
|
const availableItems = useMemo(() => items.filter(item => !item.hidden), [items]);
|
|
27
|
-
const measurableItems = useMemo(() => availableItems.filter(action => action.variant !== BUTTON_TYPE.Quota), [availableItems]);
|
|
28
24
|
const { visibleItems, hiddenItems } = useDynamicList({
|
|
29
25
|
parentContainerRef: containerRef,
|
|
30
|
-
items:
|
|
26
|
+
items: availableItems,
|
|
31
27
|
maxVisibleItems,
|
|
32
28
|
});
|
|
33
29
|
const { t: tQuota } = quotaLocale.useTranslations();
|
|
34
30
|
if (!hasVisibleActions(items)) {
|
|
35
31
|
return null;
|
|
36
32
|
}
|
|
37
|
-
const overflowItems =
|
|
38
|
-
const visibleActions = visibleItems.filter(action =>
|
|
33
|
+
const overflowItems = hiddenItems.concat(visibleItems.filter(action => action.variant === BUTTON_TYPE.Kebab));
|
|
34
|
+
const visibleActions = visibleItems.filter(action => action.variant !== BUTTON_TYPE.Kebab);
|
|
39
35
|
const droplistItems = overflowItems.reduce((acc, action) => {
|
|
40
36
|
if (action.variant === 'custom') {
|
|
41
37
|
const { asListItem } = action.render();
|
|
@@ -122,7 +118,7 @@ function MobileActionsBase({ items, maxVisibleItems }) {
|
|
|
122
118
|
}
|
|
123
119
|
return acc;
|
|
124
120
|
}, []);
|
|
125
|
-
return (_jsxs("div", { className: styles.mobileActionsWrapper, ref: containerRef, "data-test-id": TEST_IDS.mobileActions.root, children: [droplistItems.length > 0 && (_jsx(Droplist, { size: 'm', open: isOpen, onOpenChange: setIsOpen, items: droplistItems, children: _jsx(Button, { className: styles.button, view: VIEW.Outline, appearance: 'neutral', icon: _jsx(KebabSVG, {}), size: 'm', "data-test-id": TEST_IDS.mobileActions.trigger }) })), openQuota && (_jsxs(ModalCustom, { open: true, onClose: () => setOpenQuotaIndex(undefined),
|
|
121
|
+
return (_jsxs("div", { className: styles.mobileActionsWrapper, ref: containerRef, "data-test-id": TEST_IDS.mobileActions.root, children: [droplistItems.length > 0 && (_jsx(Droplist, { size: 'm', open: isOpen, onOpenChange: setIsOpen, items: droplistItems, children: _jsx(Button, { className: styles.button, view: VIEW.Outline, appearance: 'neutral', icon: _jsx(KebabSVG, {}), size: 'm', "data-test-id": TEST_IDS.mobileActions.trigger }) })), openQuota && (_jsxs(ModalCustom, { open: true, onClose: () => setOpenQuotaIndex(undefined), children: [_jsx(ModalCustom.Header, { title: tQuota('quotas'), subtitle: openQuota.projectName }), _jsx(ModalCustom.Body, { content: _jsx(QuotaWidgetContent, { quotas: openQuota.quotas, quotasUrl: openQuota.quotasUrl, projectName: openQuota.projectName, loading: openQuota.loading, error: openQuota.error, onRefresh: openQuota.onRefresh, canEditQuota: openQuota.canEditQuota, onIncreaseQuotaClick: openQuota.onIncreaseQuotaClick, onQuotasUrlClick: openQuota.onQuotasUrlClick, disableSorting: openQuota.disableSorting, skeletonRowCount: openQuota.skeletonRowCount, hideMobileHeader: true }) })] })), visibleActions.map((action, index) => (_createElement(ActionView, { ...action, key: index, commonProps: {
|
|
126
122
|
className: styles.button,
|
|
127
123
|
size: 'm',
|
|
128
124
|
fullWidth: true,
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
bottom:0;
|
|
31
31
|
display:flex;
|
|
32
32
|
flex-direction:column;
|
|
33
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
33
34
|
box-sizing:border-box;
|
|
34
35
|
margin:0 calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)))) calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))));
|
|
35
36
|
padding:var(--sn-primitive-dimension-8, 8px) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
43
44
|
align-items:center;
|
|
44
45
|
justify-content:space-between;
|
|
46
|
+
min-height:var(--sn-primitive-dimension-40, 40px);
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
.priceSummaryText{
|
package/dist/esm/style.css
CHANGED
|
@@ -175,6 +175,7 @@
|
|
|
175
175
|
bottom:0;
|
|
176
176
|
display:flex;
|
|
177
177
|
flex-direction:column;
|
|
178
|
+
gap:var(--sn-primitive-dimension-8, 8px);
|
|
178
179
|
box-sizing:border-box;
|
|
179
180
|
margin:0 calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)))) calc(0px - var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))));
|
|
180
181
|
padding:var(--sn-primitive-dimension-8, 8px) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px))) var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
|
|
@@ -187,6 +188,7 @@
|
|
|
187
188
|
gap:var(--sn-primitive-dimension-4, 4px);
|
|
188
189
|
align-items:center;
|
|
189
190
|
justify-content:space-between;
|
|
191
|
+
min-height:var(--sn-primitive-dimension-40, 40px);
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
.priceSummaryText{
|