@cloud-ru/ds-uikit-product-page-layout 2.2.1 → 2.3.1-preview-93c4db1d.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +80 -12
  3. package/dist/cjs/components/Actions/ActionView.d.ts +1 -1
  4. package/dist/cjs/components/Actions/ActionView.js +6 -2
  5. package/dist/cjs/components/Actions/MobileActions.js +37 -16
  6. package/dist/cjs/components/Actions/styles.module.css +5 -0
  7. package/dist/cjs/components/Actions/types.d.ts +16 -7
  8. package/dist/cjs/components/PageForm/styles.module.css +4 -3
  9. package/dist/cjs/components/PageServices/MobilePageServices.d.ts +2 -2
  10. package/dist/cjs/components/PageServices/MobilePageServices.js +2 -2
  11. package/dist/cjs/style.css +9 -3
  12. package/dist/esm/components/Actions/ActionView.d.ts +1 -1
  13. package/dist/esm/components/Actions/ActionView.js +6 -2
  14. package/dist/esm/components/Actions/MobileActions.js +39 -18
  15. package/dist/esm/components/Actions/styles.module.css +5 -0
  16. package/dist/esm/components/Actions/types.d.ts +16 -7
  17. package/dist/esm/components/PageForm/styles.module.css +4 -3
  18. package/dist/esm/components/PageServices/MobilePageServices.d.ts +2 -2
  19. package/dist/esm/components/PageServices/MobilePageServices.js +2 -2
  20. package/dist/esm/style.css +9 -3
  21. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  22. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  23. package/package.json +22 -22
  24. package/src/components/Actions/ActionView.tsx +8 -9
  25. package/src/components/Actions/MobileActions.tsx +68 -21
  26. package/src/components/Actions/styles.module.scss +4 -0
  27. package/src/components/Actions/types.ts +14 -7
  28. package/src/components/PageForm/styles.module.scss +4 -2
  29. package/src/components/PageServices/MobilePageServices.tsx +3 -1
@@ -26,4 +26,9 @@
26
26
  }
27
27
  .button[data-variant=icon-only]{
28
28
  flex:0 0 auto;
29
+ }
30
+
31
+ .mobileActionsWrapper .button[data-full-width]:not([data-variant=icon-only]){
32
+ min-width:-moz-max-content;
33
+ min-width:max-content;
29
34
  }
@@ -1,6 +1,8 @@
1
1
  import { ButtonProps } from '@cloud-ru/ds-button';
2
+ import { Item } from '@cloud-ru/ds-list';
2
3
  import { TooltipProps } from '@cloud-ru/ds-tooltip';
3
4
  import { ButtonDropdownProps } from '@cloud-ru/ds-uikit-product-button-predefined';
5
+ import { ReactNode } from 'react';
4
6
  import { ButtonDroplistProps } from './buttons/ButtonDroplist.js';
5
7
  import { ButtonKebabProps } from './buttons/ButtonKebab.js';
6
8
  import { ButtonQuotaProps } from './buttons/ButtonQuota.js';
@@ -15,13 +17,19 @@ export type ActionButtonProps = (ButtonProps & {
15
17
  }) | (Omit<ButtonProps<'a'>, 'as'> & {
16
18
  as: 'a';
17
19
  });
18
- /**
19
- * Action — один элемент панели действий. Дискриминированный union по `variant` (`BUTTON_TYPE`).
20
- * Простые кнопки (`filled`/`outline`/`tonal`/`function`/`simple`) маппятся на единый `Button` из
21
- * `@cloud-ru/ds-button` с соответствующим `view`; составные (`dropdown`/`kebab`/`droplist`/`quota`) — на
22
- * предопределённые обёртки.
23
- */
24
- export type Action = {
20
+ /** Кастомное действие с представлениями для панели и выпадающего меню. */
21
+ export type CustomAction = {
22
+ variant: 'custom';
23
+ hidden?: boolean;
24
+ tooltip?: TooltipProps;
25
+ /** Вызывается при рендеринге; React hooks следует использовать внутри компонента default. */
26
+ render(): {
27
+ default: ReactNode;
28
+ asListItem: Item;
29
+ };
30
+ };
31
+ export type Action = CustomAction | StandardAction;
32
+ type StandardAction = {
25
33
  tooltip?: TooltipProps;
26
34
  hidden?: boolean;
27
35
  } & (({
@@ -47,3 +55,4 @@ export type ActionsProps = {
47
55
  items: Action[];
48
56
  maxVisibleItems?: number;
49
57
  };
58
+ export {};
@@ -1,10 +1,10 @@
1
1
  .container{
2
2
  display:flex;
3
3
  gap:var(--sn-primitive-dimension-24, 24px);
4
- justify-content:center;
4
+ justify-content:safe center;
5
5
  box-sizing:border-box;
6
- min-width:-moz-fit-content;
7
- min-width:fit-content;
6
+ width:100%;
7
+ min-width:0;
8
8
  min-height:100%;
9
9
  padding:var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
10
10
  }
@@ -92,6 +92,7 @@
92
92
  top:var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
93
93
  display:flex;
94
94
  flex-direction:column;
95
+ flex-shrink:0;
95
96
  gap:var(--sn-primitive-dimension-4, 4px);
96
97
  align-self:flex-start;
97
98
  width:304px;
@@ -3,10 +3,10 @@ import { PropsWithChildren } from 'react';
3
3
  import { ActionsProps } from '../Actions/index.js';
4
4
  import { HeadlineProps } from '../Headline/index.js';
5
5
  import { SidebarSelectProps } from '../PageSidebar/index.js';
6
- export type MobilePageServicesProps = WithSupportProps<PropsWithChildren<Pick<HeadlineProps, 'title' | 'slotBeforeTitle' | 'subtitle' | 'slotAfterTitle'> & {
6
+ export type MobilePageServicesProps = WithSupportProps<PropsWithChildren<Pick<HeadlineProps, 'title' | 'slotBeforeTitle' | 'subtitle' | 'slotAfterTitle' | 'truncateTitle'> & {
7
7
  className?: string;
8
8
  sidebar?: SidebarSelectProps;
9
9
  actions?: ActionsProps['items'];
10
10
  maxVisibleActionsItems?: ActionsProps['maxVisibleItems'];
11
11
  }>>;
12
- export declare function MobilePageServices({ children, title, actions, className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, ...rest }: MobilePageServicesProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function MobilePageServices({ children, title, actions, className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, truncateTitle, ...rest }: MobilePageServicesProps): import("react/jsx-runtime").JSX.Element;
@@ -5,6 +5,6 @@ import { MobileActions } from '../Actions/index.js';
5
5
  import { Headline } from '../Headline/index.js';
6
6
  import { SidebarSelect } from '../PageSidebar/index.js';
7
7
  import styles from './mobileStyles.module.css';
8
- export function MobilePageServices({ children, title, actions = [], className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, ...rest }) {
9
- return (_jsx("div", { className: cn(styles.wrapper, className), ...extractSupportProps(rest), children: _jsxs("div", { className: styles.body, children: [_jsxs("div", { className: styles.headlineWrapper, children: [_jsx(Headline, { title: title, slotBeforeTitle: slotBeforeTitle, slotAfterTitle: slotAfterTitle, subtitle: subtitle }), sidebar && _jsx(SidebarSelect, { ...sidebar }), actions.length > 0 && _jsx(MobileActions, { items: actions, maxVisibleItems: maxVisibleActionsItems })] }), _jsx("div", { className: styles.childWrapper, children: children })] }) }));
8
+ export function MobilePageServices({ children, title, actions = [], className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, truncateTitle, ...rest }) {
9
+ return (_jsx("div", { className: cn(styles.wrapper, className), ...extractSupportProps(rest), children: _jsxs("div", { className: styles.body, children: [_jsxs("div", { className: styles.headlineWrapper, children: [_jsx(Headline, { title: title, truncateTitle: truncateTitle, slotBeforeTitle: slotBeforeTitle, slotAfterTitle: slotAfterTitle, subtitle: subtitle }), sidebar && _jsx(SidebarSelect, { ...sidebar }), actions.length > 0 && _jsx(MobileActions, { items: actions, maxVisibleItems: maxVisibleActionsItems })] }), _jsx("div", { className: styles.childWrapper, children: children })] }) }));
10
10
  }
@@ -27,6 +27,11 @@
27
27
  .button[data-variant=icon-only]{
28
28
  flex:0 0 auto;
29
29
  }
30
+
31
+ .mobileActionsWrapper .button[data-full-width]:not([data-variant=icon-only]){
32
+ min-width:-moz-max-content;
33
+ min-width:max-content;
34
+ }
30
35
  .subtitle{
31
36
  display:flex;
32
37
  flex-direction:row;
@@ -216,10 +221,10 @@
216
221
  .container{
217
222
  display:flex;
218
223
  gap:var(--sn-primitive-dimension-24, 24px);
219
- justify-content:center;
224
+ justify-content:safe center;
220
225
  box-sizing:border-box;
221
- min-width:-moz-fit-content;
222
- min-width:fit-content;
226
+ width:100%;
227
+ min-width:0;
223
228
  min-height:100%;
224
229
  padding:var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
225
230
  }
@@ -307,6 +312,7 @@
307
312
  top:var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
308
313
  display:flex;
309
314
  flex-direction:column;
315
+ flex-shrink:0;
310
316
  gap:var(--sn-primitive-dimension-4, 4px);
311
317
  align-self:flex-start;
312
318
  width:304px;