@cloud-ru/ds-uikit-product-page-layout 2.1.2-preview-fd7dd437.0 → 2.1.2-preview-445f2191.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 (28) hide show
  1. package/README.md +11 -85
  2. package/dist/cjs/components/Actions/ActionView.d.ts +1 -1
  3. package/dist/cjs/components/Actions/ActionView.js +2 -6
  4. package/dist/cjs/components/Actions/MobileActions.js +1 -20
  5. package/dist/cjs/components/Actions/styles.module.css +0 -5
  6. package/dist/cjs/components/Actions/types.d.ts +7 -18
  7. package/dist/cjs/components/PageForm/styles.module.css +3 -4
  8. package/dist/cjs/components/PageServices/MobilePageServices.d.ts +2 -2
  9. package/dist/cjs/components/PageServices/MobilePageServices.js +2 -2
  10. package/dist/cjs/style.css +3 -9
  11. package/dist/esm/components/Actions/ActionView.d.ts +1 -1
  12. package/dist/esm/components/Actions/ActionView.js +2 -6
  13. package/dist/esm/components/Actions/MobileActions.js +2 -21
  14. package/dist/esm/components/Actions/styles.module.css +0 -5
  15. package/dist/esm/components/Actions/types.d.ts +7 -18
  16. package/dist/esm/components/PageForm/styles.module.css +3 -4
  17. package/dist/esm/components/PageServices/MobilePageServices.d.ts +2 -2
  18. package/dist/esm/components/PageServices/MobilePageServices.js +2 -2
  19. package/dist/esm/style.css +3 -9
  20. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  21. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  22. package/package.json +20 -20
  23. package/src/components/Actions/ActionView.tsx +9 -8
  24. package/src/components/Actions/MobileActions.tsx +2 -19
  25. package/src/components/Actions/styles.module.scss +0 -4
  26. package/src/components/Actions/types.ts +7 -16
  27. package/src/components/PageForm/styles.module.scss +2 -4
  28. package/src/components/PageServices/MobilePageServices.tsx +1 -3
package/README.md CHANGED
@@ -104,7 +104,7 @@ import {
104
104
 
105
105
  | Prop | Type | Default | Description |
106
106
  |------|------|---------|-------------|
107
- | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `CustomAction` \| `QuotaWidgetPropsBase` | — | |
107
+ | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `QuotaWidgetPropsBase` | — | |
108
108
  | `children` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | |
109
109
  | `className` | `string` | — | CSS-класс |
110
110
  | `data-test-id` | `string` | — | |
@@ -113,7 +113,7 @@ import {
113
113
 
114
114
  ##### Related types
115
115
 
116
- - `Action` = `CustomAction | StandardAction`
116
+ - `Action` = `{ tooltip?: TooltipProps; hidden?: boolean; } & (({ variant?: typeof BUTTON_TYPE.Filled; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Outline; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Tonal; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Function; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Simple; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Dropdown; } & { 'data-test-id'?: string; } & AriaAttributes & Omit<ButtonProps, "view" | "icon" | "size" | "iconPosition"> & { size?: "xs" | NonNullable<Size | undefined>; className?: string; open?: boolean; onOpenChange?: (open: boolean) => void; } & { items: Item[]; closeOnPopstate?: boolean | undefined; triggerClassName?: string | undefined; placement?: Placement | undefined; closeDroplistOnItemClick?: boolean | undefined; }) | ({ variant: typeof BUTTON_TYPE.Kebab; } & ButtonKebabProps) | ({ variant: typeof BUTTON_TYPE.Droplist; } & ButtonDroplistProps) | ({ variant: typeof BUTTON_TYPE.Quota; } & { 'data-test-id'?: string; } & AriaAttributes & QuotaWidgetPropsBase & { quotasUrl: string; onQuotasUrlClick?: () => void; buttonProps?: Pick<ButtonProps, "size" | "className" | "fullWidth" | "label" | "appearance" | "disabled" | "view">; }))`
117
117
 
118
118
  **ButtonDroplistProps**
119
119
 
@@ -129,16 +129,6 @@ import {
129
129
  | `button` | `ButtonProps` | — | |
130
130
  | `list` | `DroplistListProps` \| `DroplistMobileSlots` \| `DroplistProps` \| `EmptyState` \| `PublicListContextType` \| `ScrollProps` \| `SelectionState` | — | |
131
131
 
132
- **CustomAction**
133
-
134
- | Prop | Type | Default | Description |
135
- |------|------|---------|-------------|
136
- | `hidden` | `boolean \| undefined` | — | |
137
- | `render` | `() => { default: ReactNode; asListItem: Item; }` | — | Вызывается при рендеринге; React hooks следует использовать внутри компонента default. |
138
- | `tooltip` | `TooltipProps` | — | |
139
- | `type` | `"custom"` | — | |
140
- | `variant` | `undefined` | — | |
141
-
142
132
  ## PageServices
143
133
 
144
134
  Детальная страница инстанса — селект раздела, заголовок со статусом, действия и контент. Адаптивная — на mobile селект выносится наверх full-bleed-строкой.
@@ -172,7 +162,7 @@ import {
172
162
 
173
163
  | Prop | Type | Default | Description |
174
164
  |------|------|---------|-------------|
175
- | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `CustomAction` \| `QuotaWidgetPropsBase` | — | |
165
+ | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `QuotaWidgetPropsBase` | — | |
176
166
  | `autoHeight` | `boolean` | — | |
177
167
  | `children` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | |
178
168
  | `className` | `string` | — | |
@@ -188,7 +178,7 @@ import {
188
178
 
189
179
  ##### Related types
190
180
 
191
- - `Action` = `CustomAction | StandardAction`
181
+ - `Action` = `{ tooltip?: TooltipProps; hidden?: boolean; } & (({ variant?: typeof BUTTON_TYPE.Filled; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Outline; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Tonal; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Function; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Simple; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Dropdown; } & { 'data-test-id'?: string; } & AriaAttributes & Omit<ButtonProps, "view" | "icon" | "size" | "iconPosition"> & { size?: "xs" | NonNullable<Size | undefined>; className?: string; open?: boolean; onOpenChange?: (open: boolean) => void; } & { items: Item[]; closeOnPopstate?: boolean | undefined; triggerClassName?: string | undefined; placement?: Placement | undefined; closeDroplistOnItemClick?: boolean | undefined; }) | ({ variant: typeof BUTTON_TYPE.Kebab; } & ButtonKebabProps) | ({ variant: typeof BUTTON_TYPE.Droplist; } & ButtonDroplistProps) | ({ variant: typeof BUTTON_TYPE.Quota; } & { 'data-test-id'?: string; } & AriaAttributes & QuotaWidgetPropsBase & { quotasUrl: string; onQuotasUrlClick?: () => void; buttonProps?: Pick<ButtonProps, "size" | "className" | "fullWidth" | "label" | "appearance" | "disabled" | "view">; }))`
192
182
 
193
183
  **ButtonDroplistProps**
194
184
 
@@ -204,16 +194,6 @@ import {
204
194
  | `button` | `ButtonProps` | — | |
205
195
  | `list` | `DroplistListProps` \| `DroplistMobileSlots` \| `DroplistProps` \| `EmptyState` \| `PublicListContextType` \| `ScrollProps` \| `SelectionState` | — | |
206
196
 
207
- **CustomAction**
208
-
209
- | Prop | Type | Default | Description |
210
- |------|------|---------|-------------|
211
- | `hidden` | `boolean \| undefined` | — | |
212
- | `render` | `() => { default: ReactNode; asListItem: Item; }` | — | Вызывается при рендеринге; React hooks следует использовать внутри компонента default. |
213
- | `tooltip` | `TooltipProps` | — | |
214
- | `type` | `"custom"` | — | |
215
- | `variant` | `undefined` | — | |
216
-
217
197
  **Documentation**
218
198
 
219
199
  | Prop | Type | Default | Description |
@@ -258,27 +238,6 @@ import {
258
238
  | `label` | `string` | — | |
259
239
  | `onClick` | `((e: MouseEvent<HTMLElement>) => void) \| undefined` | — | |
260
240
 
261
- ### Кастомные действия
262
-
263
- Элемент `type: 'custom'` возвращает два представления: `default` для панели действий и `asListItem` (тип `Item` из `@cloud-ru/ds-list`) для меню при нехватке места на мобильном экране. `hidden` скрывает действие. Функция `render` должна быть чистой; React hooks используются внутри компонента, возвращаемого в `default`.
264
-
265
- ```tsx
266
- const actions: Action[] = [
267
- {
268
- type: 'custom',
269
- render: () => ({
270
- default: <Button label='Создать снимок диска' onClick={createSnapshot} />,
271
- asListItem: {
272
- content: { label: 'Создать снимок диска' },
273
- onClick: createSnapshot,
274
- },
275
- }),
276
- },
277
- ];
278
- ```
279
-
280
- Свойство `hidden` поддерживается и для кастомных действий: скрытое действие не занимает место в панели, не попадает в меню, его `render` не вызывается.
281
-
282
241
  ## PageForm
283
242
 
284
243
  Раскладка формы создания/настройки — степпер, контент, сайд-блок и sticky-футер с оценкой бюджета. Адаптивная.
@@ -585,7 +544,7 @@ const actions: Action[] = [
585
544
  | `disabled` | `boolean` | — | Отключена |
586
545
  | `error` | `boolean` | — | Флаг ошибки при загрузке квот |
587
546
  | `fullWidth` | `boolean` | — | На всю ширину |
588
- | `hidden` | `boolean` | — | |
547
+ | `hidden` | `boolean` | `false` | |
589
548
  | `href` | `string` | — | |
590
549
  | `icon` | `ReactNode` | — | Иконка |
591
550
  | `iconPosition` | `"after"` \| `"before"` | — | Позиция иконки относительно текста |
@@ -605,13 +564,11 @@ const actions: Action[] = [
605
564
  | `projectName` | `string` | — | Название проекта, по которому отображаются квоты |
606
565
  | `quotas` | `QuotaItem[]` | — | Список квот для отображения |
607
566
  | `quotasUrl` | `string` | — | Ссылка на страницу квот по проекту |
608
- | `render` | `() => { default: ReactNode; asListItem: Item; }` | — | Вызывается при рендеринге; React hooks следует использовать внутри компонента default. |
609
567
  | `size` | `"l"` \| `"m"` \| `"s"` \| `"xs"` | — | Размер <br/> Размер триггера; для `xs` применяется кнопка `s`. |
610
568
  | `skeletonRowCount` | `number` | `4` | Количество строк-заглушек, пока идёт загрузка. <br/> Строка — это ряд сетки: в две колонки (desktop-дропдаун) она даёт две карточки, <br/> в одну (mobile, аккордеон `QuotaWidgetMini`) — одну. |
611
569
  | `target` | `HTMLAttributeAnchorTarget` | — | |
612
570
  | `tooltip` | `TooltipProps` | — | |
613
571
  | `triggerClassName` | `string` | — | CSS-класс триггера |
614
- | `type` | `"custom"` | — | |
615
572
  | `variant` | `"dropdown"` \| `"droplist"` \| `"filled"` \| `"function"` \| `"kebab"` \| `"outline"` \| `"quota"` \| `"simple"` \| `"tonal"` | — | |
616
573
  | `view` | `"elevated"` \| `"filled"` \| `"function"` \| `"outline"` \| `"simple"` \| `"tonal"` | — | Вариант кнопки (Figma: filled, outline, function, simple, elevated) |
617
574
 
@@ -792,12 +749,12 @@ const actions: Action[] = [
792
749
 
793
750
  | Prop | Type | Default | Description |
794
751
  |------|------|---------|-------------|
795
- | `items` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `CustomAction` \| `QuotaWidgetPropsBase` | — | |
752
+ | `items` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `QuotaWidgetPropsBase` | — | |
796
753
  | `maxVisibleItems` | `number` | — | |
797
754
 
798
755
  #### Related types
799
756
 
800
- - `Action` = `CustomAction | StandardAction`
757
+ - `Action` = `{ tooltip?: TooltipProps; hidden?: boolean; } & (({ variant?: typeof BUTTON_TYPE.Filled; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Outline; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Tonal; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Function; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Simple; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Dropdown; } & { 'data-test-id'?: string; } & AriaAttributes & Omit<ButtonProps, "view" | "icon" | "size" | "iconPosition"> & { size?: "xs" | NonNullable<Size | undefined>; className?: string; open?: boolean; onOpenChange?: (open: boolean) => void; } & { items: Item[]; closeOnPopstate?: boolean | undefined; triggerClassName?: string | undefined; placement?: Placement | undefined; closeDroplistOnItemClick?: boolean | undefined; }) | ({ variant: typeof BUTTON_TYPE.Kebab; } & ButtonKebabProps) | ({ variant: typeof BUTTON_TYPE.Droplist; } & ButtonDroplistProps) | ({ variant: typeof BUTTON_TYPE.Quota; } & { 'data-test-id'?: string; } & AriaAttributes & QuotaWidgetPropsBase & { quotasUrl: string; onQuotasUrlClick?: () => void; buttonProps?: Pick<ButtonProps, "size" | "className" | "fullWidth" | "label" | "appearance" | "disabled" | "view">; }))`
801
758
 
802
759
  **ButtonDroplistProps**
803
760
 
@@ -813,23 +770,13 @@ const actions: Action[] = [
813
770
  | `button` | `ButtonProps` | — | |
814
771
  | `list` | `DroplistListProps` \| `DroplistMobileSlots` \| `DroplistProps` \| `EmptyState` \| `PublicListContextType` \| `ScrollProps` \| `SelectionState` | — | |
815
772
 
816
- **CustomAction**
817
-
818
- | Prop | Type | Default | Description |
819
- |------|------|---------|-------------|
820
- | `hidden` | `boolean \| undefined` | — | |
821
- | `render` | `() => { default: ReactNode; asListItem: Item; }` | — | Вызывается при рендеринге; React hooks следует использовать внутри компонента default. |
822
- | `tooltip` | `TooltipProps` | — | |
823
- | `type` | `"custom"` | — | |
824
- | `variant` | `undefined` | — | |
825
-
826
773
  ## MobilePageCatalog
827
774
 
828
775
  ### Props `MobilePageCatalogProps`
829
776
 
830
777
  | Prop | Type | Default | Description |
831
778
  |------|------|---------|-------------|
832
- | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `CustomAction` \| `QuotaWidgetPropsBase` | `[]` | |
779
+ | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `QuotaWidgetPropsBase` | `[]` | |
833
780
  | `children` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | |
834
781
  | `className` | `string` | — | |
835
782
  | `data-test-id` | `string` | — | |
@@ -838,7 +785,7 @@ const actions: Action[] = [
838
785
 
839
786
  #### Related types
840
787
 
841
- - `Action` = `CustomAction | StandardAction`
788
+ - `Action` = `{ tooltip?: TooltipProps; hidden?: boolean; } & (({ variant?: typeof BUTTON_TYPE.Filled; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Outline; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Tonal; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Function; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Simple; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Dropdown; } & { 'data-test-id'?: string; } & AriaAttributes & Omit<ButtonProps, "view" | "icon" | "size" | "iconPosition"> & { size?: "xs" | NonNullable<Size | undefined>; className?: string; open?: boolean; onOpenChange?: (open: boolean) => void; } & { items: Item[]; closeOnPopstate?: boolean | undefined; triggerClassName?: string | undefined; placement?: Placement | undefined; closeDroplistOnItemClick?: boolean | undefined; }) | ({ variant: typeof BUTTON_TYPE.Kebab; } & ButtonKebabProps) | ({ variant: typeof BUTTON_TYPE.Droplist; } & ButtonDroplistProps) | ({ variant: typeof BUTTON_TYPE.Quota; } & { 'data-test-id'?: string; } & AriaAttributes & QuotaWidgetPropsBase & { quotasUrl: string; onQuotasUrlClick?: () => void; buttonProps?: Pick<ButtonProps, "size" | "className" | "fullWidth" | "label" | "appearance" | "disabled" | "view">; }))`
842
789
 
843
790
  **ButtonDroplistProps**
844
791
 
@@ -854,16 +801,6 @@ const actions: Action[] = [
854
801
  | `button` | `ButtonProps` | — | |
855
802
  | `list` | `DroplistListProps` \| `DroplistMobileSlots` \| `DroplistProps` \| `EmptyState` \| `PublicListContextType` \| `ScrollProps` \| `SelectionState` | — | |
856
803
 
857
- **CustomAction**
858
-
859
- | Prop | Type | Default | Description |
860
- |------|------|---------|-------------|
861
- | `hidden` | `boolean \| undefined` | — | |
862
- | `render` | `() => { default: ReactNode; asListItem: Item; }` | — | Вызывается при рендеринге; React hooks следует использовать внутри компонента default. |
863
- | `tooltip` | `TooltipProps` | — | |
864
- | `type` | `"custom"` | — | |
865
- | `variant` | `undefined` | — | |
866
-
867
804
  ## MobilePageForm
868
805
 
869
806
  ### Props `DesktopPageFormProps`
@@ -893,7 +830,7 @@ const actions: Action[] = [
893
830
 
894
831
  | Prop | Type | Default | Description |
895
832
  |------|------|---------|-------------|
896
- | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `CustomAction` \| `QuotaWidgetPropsBase` | `[]` | |
833
+ | `actions` | `Action` \| `ButtonDropdownDroplistConfig` \| `ButtonDroplistProps` \| `ButtonKebabProps` \| `QuotaWidgetPropsBase` | `[]` | |
897
834
  | `children` | `string \| number \| boolean \| ReactElement<any, string \| JSXElementConstructor<any>> \| Iterable<ReactNode> \| ReactPortal \| null \| undefined` | — | |
898
835
  | `className` | `string` | — | |
899
836
  | `data-test-id` | `string` | — | |
@@ -903,11 +840,10 @@ const actions: Action[] = [
903
840
  | `slotBeforeTitle` | `ReactNode` | — | Слот перед заголовком (например, кнопка «назад») |
904
841
  | `subtitle` | `ReactNode` | — | Подзаголовок под заголовком |
905
842
  | `title` | `string` | — | Заголовок страницы |
906
- | `truncateTitle` | `boolean` | — | Обрезать заголовок в одну строку с многоточием |
907
843
 
908
844
  #### Related types
909
845
 
910
- - `Action` = `CustomAction | StandardAction`
846
+ - `Action` = `{ tooltip?: TooltipProps; hidden?: boolean; } & (({ variant?: typeof BUTTON_TYPE.Filled; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Outline; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Tonal; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Function; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Simple; } & ActionButtonProps) | ({ variant: typeof BUTTON_TYPE.Dropdown; } & { 'data-test-id'?: string; } & AriaAttributes & Omit<ButtonProps, "view" | "icon" | "size" | "iconPosition"> & { size?: "xs" | NonNullable<Size | undefined>; className?: string; open?: boolean; onOpenChange?: (open: boolean) => void; } & { items: Item[]; closeOnPopstate?: boolean | undefined; triggerClassName?: string | undefined; placement?: Placement | undefined; closeDroplistOnItemClick?: boolean | undefined; }) | ({ variant: typeof BUTTON_TYPE.Kebab; } & ButtonKebabProps) | ({ variant: typeof BUTTON_TYPE.Droplist; } & ButtonDroplistProps) | ({ variant: typeof BUTTON_TYPE.Quota; } & { 'data-test-id'?: string; } & AriaAttributes & QuotaWidgetPropsBase & { quotasUrl: string; onQuotasUrlClick?: () => void; buttonProps?: Pick<ButtonProps, "size" | "className" | "fullWidth" | "label" | "appearance" | "disabled" | "view">; }))`
911
847
 
912
848
  **ButtonDroplistProps**
913
849
 
@@ -923,16 +859,6 @@ const actions: Action[] = [
923
859
  | `button` | `ButtonProps` | — | |
924
860
  | `list` | `DroplistListProps` \| `DroplistMobileSlots` \| `DroplistProps` \| `EmptyState` \| `PublicListContextType` \| `ScrollProps` \| `SelectionState` | — | |
925
861
 
926
- **CustomAction**
927
-
928
- | Prop | Type | Default | Description |
929
- |------|------|---------|-------------|
930
- | `hidden` | `boolean \| undefined` | — | |
931
- | `render` | `() => { default: ReactNode; asListItem: Item; }` | — | Вызывается при рендеринге; React hooks следует использовать внутри компонента default. |
932
- | `tooltip` | `TooltipProps` | — | |
933
- | `type` | `"custom"` | — | |
934
- | `variant` | `undefined` | — | |
935
-
936
862
  - `SidebarItem` = `SidebarItemWithHref | SidebarItemWithItems`
937
863
 
938
864
  **SidebarItemBase**
@@ -11,7 +11,7 @@ type CommonProps = {
11
11
  * `@ds`-примитивы, которые берут раскладку из `AdaptiveProvider`. Раскладку фиксируют обёртки
12
12
  * `DesktopActions` / `MobileActions` (`withLayoutType`), поэтому отдельный проп `layoutType` не нужен.
13
13
  */
14
- export declare function ActionView({ hidden, type, tooltip, commonProps, ...action }: Action & {
14
+ export declare function ActionView({ variant, tooltip, hidden, commonProps, ...buttonProps }: Action & {
15
15
  commonProps: CommonProps;
16
16
  }): string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
17
17
  export {};
@@ -14,14 +14,10 @@ const constants_1 = require("./constants");
14
14
  * `@ds`-примитивы, которые берут раскладку из `AdaptiveProvider`. Раскладку фиксируют обёртки
15
15
  * `DesktopActions` / `MobileActions` (`withLayoutType`), поэтому отдельный проп `layoutType` не нужен.
16
16
  */
17
- function ActionView({ hidden, type, tooltip, commonProps, ...action }) {
18
- if (hidden)
17
+ function ActionView({ variant, tooltip, hidden = false, commonProps, ...buttonProps }) {
18
+ if (hidden) {
19
19
  return null;
20
- if (type === 'custom' && 'render' in action) {
21
- const content = (0, jsx_runtime_1.jsx)("div", { className: commonProps.className, children: action.render().default });
22
- return tooltip ? (0, jsx_runtime_1.jsx)(tooltip_1.Tooltip, { ...tooltip, children: content }) : content;
23
20
  }
24
- const { variant, ...buttonProps } = action;
25
21
  // disableSpanWrapper — кнопка остаётся ПРЯМЫМ flex-потомком контейнера действий: без него Tooltip
26
22
  // добавляет span-обёртку (`flex:0 1 auto`), и `fullWidth`-кнопка (`flex:1 1 0`) не растягивается на
27
23
  // всю ширину (mobile: 2 действия должны делить строку). Как в MobilePageForm ButtonGroup.
@@ -22,12 +22,7 @@ const utils_2 = require("./utils");
22
22
  function MobileActionsBase({ items, maxVisibleItems }) {
23
23
  const containerRef = (0, react_2.useRef)(null);
24
24
  const [isOpen, setIsOpen] = (0, react_2.useState)(false);
25
- const availableItems = (0, react_2.useMemo)(() => items.filter(item => !item.hidden), [items]);
26
- const { visibleItems, hiddenItems } = (0, utils_1.useDynamicList)({
27
- parentContainerRef: containerRef,
28
- items: availableItems,
29
- maxVisibleItems,
30
- });
25
+ const { visibleItems, hiddenItems } = (0, utils_1.useDynamicList)({ parentContainerRef: containerRef, items, maxVisibleItems });
31
26
  const { t: tQuota } = uikit_product_quota_1.quotaLocale.useTranslations();
32
27
  if (!(0, utils_2.hasVisibleActions)(items)) {
33
28
  return null;
@@ -35,20 +30,6 @@ function MobileActionsBase({ items, maxVisibleItems }) {
35
30
  const hiddenItemsWithKebab = hiddenItems.concat(visibleItems.filter(item => item.variant === constants_2.BUTTON_TYPE.Kebab));
36
31
  const visibleItemsWithoutKebab = visibleItems.filter(item => item.variant !== constants_2.BUTTON_TYPE.Kebab);
37
32
  const droplistItems = hiddenItemsWithKebab.reduce((acc, action) => {
38
- if (action.hidden)
39
- return acc;
40
- if (action.type === 'custom') {
41
- const { asListItem } = action.render();
42
- acc.push({
43
- ...asListItem,
44
- onClick: (event) => {
45
- setIsOpen(false);
46
- if ('onClick' in asListItem)
47
- asListItem.onClick?.(event);
48
- },
49
- });
50
- return acc;
51
- }
52
33
  switch (action.variant) {
53
34
  case constants_2.BUTTON_TYPE.Tonal:
54
35
  case constants_2.BUTTON_TYPE.Simple:
@@ -26,9 +26,4 @@
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;
34
29
  }
@@ -1,8 +1,6 @@
1
1
  import { ButtonProps } from '@cloud-ru/ds-button';
2
- import { Item } from '@cloud-ru/ds-list';
3
2
  import { TooltipProps } from '@cloud-ru/ds-tooltip';
4
3
  import { ButtonDropdownProps } from '@cloud-ru/ds-uikit-product-button-predefined';
5
- import { ReactNode } from 'react';
6
4
  import { ButtonDroplistProps } from './buttons/ButtonDroplist';
7
5
  import { ButtonKebabProps } from './buttons/ButtonKebab';
8
6
  import { ButtonQuotaProps } from './buttons/ButtonQuota';
@@ -17,21 +15,13 @@ export type ActionButtonProps = (ButtonProps & {
17
15
  }) | (Omit<ButtonProps<'a'>, 'as'> & {
18
16
  as: 'a';
19
17
  });
20
- /** Кастомное действие с представлениями для панели и выпадающего меню. */
21
- export type CustomAction = {
22
- type: 'custom';
23
- variant?: never;
24
- hidden?: boolean;
25
- tooltip?: TooltipProps;
26
- /** Вызывается при рендеринге; React hooks следует использовать внутри компонента default. */
27
- render(): {
28
- default: ReactNode;
29
- asListItem: Item;
30
- };
31
- };
32
- export type Action = CustomAction | StandardAction;
33
- type StandardAction = {
34
- type?: never;
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 = {
35
25
  tooltip?: TooltipProps;
36
26
  hidden?: boolean;
37
27
  } & (({
@@ -57,4 +47,3 @@ export type ActionsProps = {
57
47
  items: Action[];
58
48
  maxVisibleItems?: number;
59
49
  };
60
- export {};
@@ -1,10 +1,10 @@
1
1
  .container{
2
2
  display:flex;
3
3
  gap:var(--sn-primitive-dimension-24, 24px);
4
- justify-content:safe center;
4
+ justify-content:center;
5
5
  box-sizing:border-box;
6
- width:100%;
7
- min-width:0;
6
+ min-width:-moz-fit-content;
7
+ min-width:fit-content;
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,7 +92,6 @@
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;
96
95
  gap:var(--sn-primitive-dimension-4, 4px);
97
96
  align-self:flex-start;
98
97
  width:304px;
@@ -3,10 +3,10 @@ import { PropsWithChildren } from 'react';
3
3
  import { ActionsProps } from '../Actions';
4
4
  import { HeadlineProps } from '../Headline';
5
5
  import { SidebarSelectProps } from '../PageSidebar';
6
- export type MobilePageServicesProps = WithSupportProps<PropsWithChildren<Pick<HeadlineProps, 'title' | 'slotBeforeTitle' | 'subtitle' | 'slotAfterTitle' | 'truncateTitle'> & {
6
+ export type MobilePageServicesProps = WithSupportProps<PropsWithChildren<Pick<HeadlineProps, 'title' | 'slotBeforeTitle' | 'subtitle' | 'slotAfterTitle'> & {
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, truncateTitle, ...rest }: MobilePageServicesProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function MobilePageServices({ children, title, actions, className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, ...rest }: MobilePageServicesProps): import("react/jsx-runtime").JSX.Element;
@@ -11,6 +11,6 @@ const Actions_1 = require("../Actions");
11
11
  const Headline_1 = require("../Headline");
12
12
  const PageSidebar_1 = require("../PageSidebar");
13
13
  const mobileStyles_module_scss_1 = __importDefault(require('./mobileStyles.module.css'));
14
- function MobilePageServices({ children, title, actions = [], className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, truncateTitle, ...rest }) {
15
- return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(mobileStyles_module_scss_1.default.wrapper, className), ...(0, utils_1.extractSupportProps)(rest), children: (0, jsx_runtime_1.jsxs)("div", { className: mobileStyles_module_scss_1.default.body, children: [(0, jsx_runtime_1.jsxs)("div", { className: mobileStyles_module_scss_1.default.headlineWrapper, children: [(0, jsx_runtime_1.jsx)(Headline_1.Headline, { title: title, truncateTitle: truncateTitle, slotBeforeTitle: slotBeforeTitle, slotAfterTitle: slotAfterTitle, subtitle: subtitle }), sidebar && (0, jsx_runtime_1.jsx)(PageSidebar_1.SidebarSelect, { ...sidebar }), actions.length > 0 && (0, jsx_runtime_1.jsx)(Actions_1.MobileActions, { items: actions, maxVisibleItems: maxVisibleActionsItems })] }), (0, jsx_runtime_1.jsx)("div", { className: mobileStyles_module_scss_1.default.childWrapper, children: children })] }) }));
14
+ function MobilePageServices({ children, title, actions = [], className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, ...rest }) {
15
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(mobileStyles_module_scss_1.default.wrapper, className), ...(0, utils_1.extractSupportProps)(rest), children: (0, jsx_runtime_1.jsxs)("div", { className: mobileStyles_module_scss_1.default.body, children: [(0, jsx_runtime_1.jsxs)("div", { className: mobileStyles_module_scss_1.default.headlineWrapper, children: [(0, jsx_runtime_1.jsx)(Headline_1.Headline, { title: title, slotBeforeTitle: slotBeforeTitle, slotAfterTitle: slotAfterTitle, subtitle: subtitle }), sidebar && (0, jsx_runtime_1.jsx)(PageSidebar_1.SidebarSelect, { ...sidebar }), actions.length > 0 && (0, jsx_runtime_1.jsx)(Actions_1.MobileActions, { items: actions, maxVisibleItems: maxVisibleActionsItems })] }), (0, jsx_runtime_1.jsx)("div", { className: mobileStyles_module_scss_1.default.childWrapper, children: children })] }) }));
16
16
  }
@@ -27,11 +27,6 @@
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
- }
35
30
  .subtitle{
36
31
  display:flex;
37
32
  flex-direction:row;
@@ -221,10 +216,10 @@
221
216
  .container{
222
217
  display:flex;
223
218
  gap:var(--sn-primitive-dimension-24, 24px);
224
- justify-content:safe center;
219
+ justify-content:center;
225
220
  box-sizing:border-box;
226
- width:100%;
227
- min-width:0;
221
+ min-width:-moz-fit-content;
222
+ min-width:fit-content;
228
223
  min-height:100%;
229
224
  padding:var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
230
225
  }
@@ -312,7 +307,6 @@
312
307
  top:var(--sn-density-spacing-interval-l, var(--sn-platform-comfort-spacing-interval-l, var(--sn-primitive-dimension-32, 32px)));
313
308
  display:flex;
314
309
  flex-direction:column;
315
- flex-shrink:0;
316
310
  gap:var(--sn-primitive-dimension-4, 4px);
317
311
  align-self:flex-start;
318
312
  width:304px;
@@ -11,7 +11,7 @@ type CommonProps = {
11
11
  * `@ds`-примитивы, которые берут раскладку из `AdaptiveProvider`. Раскладку фиксируют обёртки
12
12
  * `DesktopActions` / `MobileActions` (`withLayoutType`), поэтому отдельный проп `layoutType` не нужен.
13
13
  */
14
- export declare function ActionView({ hidden, type, tooltip, commonProps, ...action }: Action & {
14
+ export declare function ActionView({ variant, tooltip, hidden, commonProps, ...buttonProps }: Action & {
15
15
  commonProps: CommonProps;
16
16
  }): string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
17
17
  export {};
@@ -11,14 +11,10 @@ import { BUTTON_TYPE } from './constants.js';
11
11
  * `@ds`-примитивы, которые берут раскладку из `AdaptiveProvider`. Раскладку фиксируют обёртки
12
12
  * `DesktopActions` / `MobileActions` (`withLayoutType`), поэтому отдельный проп `layoutType` не нужен.
13
13
  */
14
- export function ActionView({ hidden, type, tooltip, commonProps, ...action }) {
15
- if (hidden)
14
+ export function ActionView({ variant, tooltip, hidden = false, commonProps, ...buttonProps }) {
15
+ if (hidden) {
16
16
  return null;
17
- if (type === 'custom' && 'render' in action) {
18
- const content = _jsx("div", { className: commonProps.className, children: action.render().default });
19
- return tooltip ? _jsx(Tooltip, { ...tooltip, children: content }) : content;
20
17
  }
21
- const { variant, ...buttonProps } = action;
22
18
  // disableSpanWrapper — кнопка остаётся ПРЯМЫМ flex-потомком контейнера действий: без него Tooltip
23
19
  // добавляет span-обёртку (`flex:0 1 auto`), и `fullWidth`-кнопка (`flex:1 1 0`) не растягивается на
24
20
  // всю ширину (mobile: 2 действия должны делить строку). Как в MobilePageForm ButtonGroup.
@@ -7,7 +7,7 @@ import { Droplist } from '@cloud-ru/ds-list';
7
7
  import { Tooltip } from '@cloud-ru/ds-tooltip';
8
8
  import { quotaLocale, QuotaWidget } from '@cloud-ru/ds-uikit-product-quota';
9
9
  import { useDynamicList } from '@cloud-ru/ds-utils';
10
- import { useMemo, useRef, useState } from 'react';
10
+ import { useRef, useState } from 'react';
11
11
  import { TEST_IDS } from '../../constants.js';
12
12
  import { ActionView } from './ActionView.js';
13
13
  import { BUTTON_TYPE } from './constants.js';
@@ -16,12 +16,7 @@ import { hasVisibleActions } from './utils.js';
16
16
  function MobileActionsBase({ items, maxVisibleItems }) {
17
17
  const containerRef = useRef(null);
18
18
  const [isOpen, setIsOpen] = useState(false);
19
- const availableItems = useMemo(() => items.filter(item => !item.hidden), [items]);
20
- const { visibleItems, hiddenItems } = useDynamicList({
21
- parentContainerRef: containerRef,
22
- items: availableItems,
23
- maxVisibleItems,
24
- });
19
+ const { visibleItems, hiddenItems } = useDynamicList({ parentContainerRef: containerRef, items, maxVisibleItems });
25
20
  const { t: tQuota } = quotaLocale.useTranslations();
26
21
  if (!hasVisibleActions(items)) {
27
22
  return null;
@@ -29,20 +24,6 @@ function MobileActionsBase({ items, maxVisibleItems }) {
29
24
  const hiddenItemsWithKebab = hiddenItems.concat(visibleItems.filter(item => item.variant === BUTTON_TYPE.Kebab));
30
25
  const visibleItemsWithoutKebab = visibleItems.filter(item => item.variant !== BUTTON_TYPE.Kebab);
31
26
  const droplistItems = hiddenItemsWithKebab.reduce((acc, action) => {
32
- if (action.hidden)
33
- return acc;
34
- if (action.type === 'custom') {
35
- const { asListItem } = action.render();
36
- acc.push({
37
- ...asListItem,
38
- onClick: (event) => {
39
- setIsOpen(false);
40
- if ('onClick' in asListItem)
41
- asListItem.onClick?.(event);
42
- },
43
- });
44
- return acc;
45
- }
46
27
  switch (action.variant) {
47
28
  case BUTTON_TYPE.Tonal:
48
29
  case BUTTON_TYPE.Simple:
@@ -26,9 +26,4 @@
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;
34
29
  }
@@ -1,8 +1,6 @@
1
1
  import { ButtonProps } from '@cloud-ru/ds-button';
2
- import { Item } from '@cloud-ru/ds-list';
3
2
  import { TooltipProps } from '@cloud-ru/ds-tooltip';
4
3
  import { ButtonDropdownProps } from '@cloud-ru/ds-uikit-product-button-predefined';
5
- import { ReactNode } from 'react';
6
4
  import { ButtonDroplistProps } from './buttons/ButtonDroplist.js';
7
5
  import { ButtonKebabProps } from './buttons/ButtonKebab.js';
8
6
  import { ButtonQuotaProps } from './buttons/ButtonQuota.js';
@@ -17,21 +15,13 @@ export type ActionButtonProps = (ButtonProps & {
17
15
  }) | (Omit<ButtonProps<'a'>, 'as'> & {
18
16
  as: 'a';
19
17
  });
20
- /** Кастомное действие с представлениями для панели и выпадающего меню. */
21
- export type CustomAction = {
22
- type: 'custom';
23
- variant?: never;
24
- hidden?: boolean;
25
- tooltip?: TooltipProps;
26
- /** Вызывается при рендеринге; React hooks следует использовать внутри компонента default. */
27
- render(): {
28
- default: ReactNode;
29
- asListItem: Item;
30
- };
31
- };
32
- export type Action = CustomAction | StandardAction;
33
- type StandardAction = {
34
- type?: never;
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 = {
35
25
  tooltip?: TooltipProps;
36
26
  hidden?: boolean;
37
27
  } & (({
@@ -57,4 +47,3 @@ export type ActionsProps = {
57
47
  items: Action[];
58
48
  maxVisibleItems?: number;
59
49
  };
60
- export {};
@@ -1,10 +1,10 @@
1
1
  .container{
2
2
  display:flex;
3
3
  gap:var(--sn-primitive-dimension-24, 24px);
4
- justify-content:safe center;
4
+ justify-content:center;
5
5
  box-sizing:border-box;
6
- width:100%;
7
- min-width:0;
6
+ min-width:-moz-fit-content;
7
+ min-width:fit-content;
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,7 +92,6 @@
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;
96
95
  gap:var(--sn-primitive-dimension-4, 4px);
97
96
  align-self:flex-start;
98
97
  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' | 'truncateTitle'> & {
6
+ export type MobilePageServicesProps = WithSupportProps<PropsWithChildren<Pick<HeadlineProps, 'title' | 'slotBeforeTitle' | 'subtitle' | 'slotAfterTitle'> & {
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, truncateTitle, ...rest }: MobilePageServicesProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function MobilePageServices({ children, title, actions, className, sidebar, slotAfterTitle, subtitle, slotBeforeTitle, maxVisibleActionsItems, ...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, 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 })] }) }));
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 })] }) }));
10
10
  }