pne-ui 5.0.0-rc.39 → 5.0.0-rc.40

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/README.md CHANGED
@@ -229,10 +229,11 @@ import {Button} from '@mui/material'
229
229
  | `activated` | `aria-disabled` и `tabIndex={-1}` на кнопке `text` + `success` |
230
230
  | `data-pne-variant`, `data-pne-size`, `data-pne-loading` | классы MUI: `MuiButton-contained`, `MuiButton-colorError`, `MuiButton-sizeSmall`, `MuiButton-loading` |
231
231
 
232
- ## Подсказка, радиокнопка и чип: вид рисует тема
232
+ ## Подсказка, радиокнопка, чип и группа переключателей: вид рисует тема
233
233
 
234
- Своих компонентов подсказки, радиокнопки и чипа в `pne-ui` нет. Берите `Tooltip`, `Radio` и `Chip` из
235
- `@mui/material`: под темой `createPneTheme` они выглядят по UI Kit, без дополнительных свойств.
234
+ Своих компонентов подсказки, радиокнопки, чипа и группы переключателей в `pne-ui` нет. Берите `Tooltip`,
235
+ `Radio`, `Chip` и `ToggleButtonGroup` из `@mui/material`: под темой `createPneTheme` они выглядят по UI Kit, без
236
+ дополнительных свойств.
236
237
 
237
238
  ```tsx
238
239
  import {FormControlLabel, Radio, RadioGroup, Tooltip} from '@mui/material'
@@ -288,7 +289,28 @@ import {Chip} from '@mui/material'
288
289
  - свой `deleteIcon` страницы сохраняет собственные размеры;
289
290
  - чипы внутри `PneAutocomplete` и в фильтрах SearchUI рисуют сами эти компоненты, тема их не меняет.
290
291
 
291
- Сторис: `pne-ui/Tooltip`, `pne-ui/Radio` и `pne-ui/Chip`.
292
+ `ToggleButtonGroup` (UI Kit Tabs: выбор одного из нескольких):
293
+
294
+ ```tsx
295
+ import {ToggleButton, ToggleButtonGroup} from '@mui/material'
296
+
297
+ <ToggleButtonGroup exclusive value={status} onChange={(_event, next) => next && setStatus(next)}>
298
+ <ToggleButton value="disabled">Disabled</ToggleButton>
299
+ <ToggleButton value="enabled">Enabled</ToggleButton>
300
+ </ToggleButtonGroup>
301
+ ```
302
+
303
+ - серая подложка в кольце, отступ 4 px вокруг пунктов и между ними; пункты — текстовые кнопки без капса;
304
+ выбранный — белая плитка с тенью;
305
+ - `size="medium"` (по умолчанию) — группа 40 px, встаёт в ряд с полями и кнопками форм; `size="small"` —
306
+ 32 px, как в полосах таблицы;
307
+ - вид один: `color` группы ничего не меняет;
308
+ - `fullWidth` делит ширину между пунктами поровну, `orientation="vertical"` ставит их столбцом;
309
+ - `ToggleButton` без группы — не вкладка, тема его не рисует.
310
+
311
+ Так же библиотека рисует выбор вида таблицы и переключатели окна Multiget.
312
+
313
+ Сторис: `pne-ui/Tooltip`, `pne-ui/Radio`, `pne-ui/Chip` и `pne-ui/ToggleButton`.
292
314
 
293
315
  ## PneField
294
316
 
@@ -58,7 +58,9 @@ const PneTableViewSelectorInner = (props, ref) => {
58
58
  rootSx,
59
59
  ...(Array.isArray(sx) ? sx : [sx]),
60
60
  ] },
61
- react_1.default.createElement(material_1.ToggleButtonGroup, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disabled: disabled, exclusive: true, sx: groupSx, value: value }, views.map(view => {
61
+ react_1.default.createElement(material_1.ToggleButtonGroup, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disabled: disabled, exclusive: true,
62
+ // The size the theme draws as these 24px views, so the theme and the styles here agree.
63
+ size: 'small', sx: groupSx, value: value }, views.map(view => {
62
64
  const handleClick = (event) => {
63
65
  // This selector always renders its options as native button-backed ToggleButtons.
64
66
  const buttonEvent = event;
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createTableControlShellStyle = exports.createTableControlActiveStyle = exports.createTableControlCurrentStyle = exports.createTableControlTextButtonStyle = void 0;
4
- const buttonLook_1 = require("../../buttonLook");
5
4
  const createTheme_1 = require("../../createTheme");
6
- const tableControlMetrics_1 = require("./tableControlMetrics");
7
- // The small step of the button sizes; the theme draws the MUI `Button` from the same table.
8
- const SIZE = buttonLook_1.PNE_BUTTON_SIZE.small;
5
+ const tableControlLook_1 = require("./tableControlLook");
9
6
  /**
10
7
  * A button of the table bands by the UI Kit (Button Tertiary sm): 24px, a 12/16 Medium label on the
11
8
  * sunken grey fill. The pointer and a press change the colour of the label, a press darkens the fill
@@ -15,39 +12,7 @@ const SIZE = buttonLook_1.PNE_BUTTON_SIZE.small;
15
12
  * These controls are toggle buttons, page items and arrows of a calendar, which the `MuiButton` entry
16
13
  * of the theme does not reach; the sizes and the colours are the ones of the theme's small text button.
17
14
  */
18
- const createTableControlTextButtonStyle = (theme) => {
19
- const pne = (0, createTheme_1.resolvePneSemanticPalette)(theme);
20
- const colors = pne.button.text;
21
- return {
22
- ...theme.typography.button,
23
- backgroundColor: colors.default.fill,
24
- borderRadius: '4px',
25
- color: colors.default.text,
26
- fontSize: `${SIZE.fontSize}px`,
27
- fontWeight: 500,
28
- height: `${tableControlMetrics_1.TABLE_CONTROL_SIZE}px`,
29
- letterSpacing: 'normal',
30
- lineHeight: `${SIZE.lineHeight}px`,
31
- padding: `${SIZE.paddingBlock}px ${SIZE.paddingInline}px`,
32
- textTransform: 'none',
33
- '&:hover': {
34
- backgroundColor: colors.hover.fill,
35
- color: colors.hover.text,
36
- },
37
- '&:active': {
38
- backgroundColor: colors.pressed.fill,
39
- color: colors.pressed.text,
40
- },
41
- '&.Mui-disabled': {
42
- backgroundColor: colors.disabled.fill,
43
- color: colors.disabled.text,
44
- },
45
- '&.Mui-focusVisible': {
46
- outline: `2px solid ${pne.focusRing}`,
47
- outlineOffset: '-2px',
48
- },
49
- };
50
- };
15
+ const createTableControlTextButtonStyle = (theme) => (0, tableControlLook_1.tableControlTextButtonLook)(theme, (0, createTheme_1.resolvePneSemanticPalette)(theme));
51
16
  exports.createTableControlTextButtonStyle = createTableControlTextButtonStyle;
52
17
  /**
53
18
  * The current value of a set of band buttons that is an action on the rows - the page size in force:
@@ -75,20 +40,7 @@ exports.createTableControlCurrentStyle = createTableControlCurrentStyle;
75
40
  * The picked item of a set of band buttons that switches a view (UI Kit Tertiary, State=Active): the
76
41
  * surface fill with the tab shadow; the label keeps its colour, under the pointer too.
77
42
  */
78
- const createTableControlActiveStyle = (theme) => {
79
- const colors = (0, createTheme_1.resolvePneSemanticPalette)(theme).button.text;
80
- const active = colors.active ?? colors.default;
81
- const look = {
82
- backgroundColor: active.fill,
83
- boxShadow: active.shadow ?? 'none',
84
- color: active.text,
85
- };
86
- return {
87
- ...look,
88
- '&:hover': look,
89
- '&:active': look,
90
- };
91
- };
43
+ const createTableControlActiveStyle = (theme) => (0, tableControlLook_1.tableControlActiveLook)((0, createTheme_1.resolvePneSemanticPalette)(theme));
92
44
  exports.createTableControlActiveStyle = createTableControlActiveStyle;
93
45
  /**
94
46
  * The shell of a group of band controls: 32px high with 4px around its 24px controls and 4px between
@@ -96,18 +48,5 @@ exports.createTableControlActiveStyle = createTableControlActiveStyle;
96
48
  * pagination, the page sizes: actions on the rows); `tabs` is the grey one of the UI Kit Tabs (the
97
49
  * views: one of them is picked).
98
50
  */
99
- const createTableControlShellStyle = (theme, kind) => {
100
- const band = (0, createTheme_1.resolvePneSemanticPalette)(theme).table.band;
101
- const colors = kind === 'tabs' ? band.tabs : band.shell;
102
- return {
103
- alignItems: 'center',
104
- backgroundColor: colors.fill,
105
- borderRadius: '8px',
106
- boxShadow: `inset 0 0 0 1px ${colors.ring}`,
107
- boxSizing: 'border-box',
108
- gap: `${tableControlMetrics_1.TABLE_CONTROL_GAP}px`,
109
- minHeight: `${tableControlMetrics_1.TABLE_CONTROL_BAND_SIZE}px`,
110
- padding: `${tableControlMetrics_1.TABLE_CONTROL_SHELL_PADDING}px`,
111
- };
112
- };
51
+ const createTableControlShellStyle = (theme, kind) => (0, tableControlLook_1.tableControlShellLook)((0, createTheme_1.resolvePneSemanticPalette)(theme), kind);
113
52
  exports.createTableControlShellStyle = createTableControlShellStyle;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tableControlShellLook = exports.tableControlActiveLook = exports.tableControlTextButtonLook = void 0;
4
+ const buttonLook_1 = require("../../buttonLook");
5
+ const tableControlMetrics_1 = require("./tableControlMetrics");
6
+ /** UI Kit Button Tertiary of a size: a Medium label on the sunken fill, the focus ring inside. */
7
+ const tableControlTextButtonLook = (theme, pne, size = 'small') => {
8
+ const config = buttonLook_1.PNE_BUTTON_SIZE[size];
9
+ const colors = pne.button.text;
10
+ return {
11
+ ...theme.typography.button,
12
+ backgroundColor: colors.default.fill,
13
+ borderRadius: '4px',
14
+ color: colors.default.text,
15
+ fontSize: `${config.fontSize}px`,
16
+ fontWeight: 500,
17
+ height: `${config.height}px`,
18
+ letterSpacing: 'normal',
19
+ lineHeight: `${config.lineHeight}px`,
20
+ padding: `${config.paddingBlock}px ${config.paddingInline}px`,
21
+ textTransform: 'none',
22
+ '&:hover': {
23
+ backgroundColor: colors.hover.fill,
24
+ color: colors.hover.text,
25
+ },
26
+ '&:active': {
27
+ backgroundColor: colors.pressed.fill,
28
+ color: colors.pressed.text,
29
+ },
30
+ '&.Mui-disabled': {
31
+ backgroundColor: colors.disabled.fill,
32
+ color: colors.disabled.text,
33
+ },
34
+ '&.Mui-focusVisible': {
35
+ outline: `2px solid ${pne.focusRing}`,
36
+ outlineOffset: '-2px',
37
+ },
38
+ };
39
+ };
40
+ exports.tableControlTextButtonLook = tableControlTextButtonLook;
41
+ /** UI Kit Tertiary, State=Active: the surface fill with the tab shadow; the label keeps its colour. */
42
+ const tableControlActiveLook = (pne) => {
43
+ const colors = pne.button.text;
44
+ const active = colors.active ?? colors.default;
45
+ const look = {
46
+ backgroundColor: active.fill,
47
+ boxShadow: active.shadow ?? 'none',
48
+ color: active.text,
49
+ };
50
+ return {
51
+ ...look,
52
+ '&:hover': look,
53
+ '&:active': look,
54
+ };
55
+ };
56
+ exports.tableControlActiveLook = tableControlActiveLook;
57
+ /** The shell of a group: 4px around its controls and 4px between them, radius 8, a 1px inner ring. */
58
+ const tableControlShellLook = (pne, kind, height = tableControlMetrics_1.TABLE_CONTROL_BAND_SIZE) => {
59
+ const band = pne.table.band;
60
+ const colors = kind === 'tabs' ? band.tabs : band.shell;
61
+ return {
62
+ alignItems: 'center',
63
+ backgroundColor: colors.fill,
64
+ borderRadius: '8px',
65
+ boxShadow: `inset 0 0 0 1px ${colors.ring}`,
66
+ boxSizing: 'border-box',
67
+ gap: `${tableControlMetrics_1.TABLE_CONTROL_GAP}px`,
68
+ minHeight: `${height}px`,
69
+ padding: `${tableControlMetrics_1.TABLE_CONTROL_SHELL_PADDING}px`,
70
+ };
71
+ };
72
+ exports.tableControlShellLook = tableControlShellLook;
@@ -9,6 +9,7 @@ const buttonPalette_1 = require("./buttonPalette");
9
9
  const checkboxPalette_1 = require("./checkboxPalette");
10
10
  const chipLook_1 = require("./chipLook");
11
11
  const radioLook_1 = require("./radioLook");
12
+ const toggleLook_1 = require("./toggleLook");
12
13
  const tooltipLook_1 = require("./tooltipLook");
13
14
  const dropdownPalette_1 = require("./dropdownPalette");
14
15
  const modalPalette_1 = require("./modalPalette");
@@ -250,13 +251,7 @@ const createPneComponentOverrides = (mode) => ({
250
251
  MuiChip: (0, chipLook_1.createPneChipOverrides)(exports.resolvePneSemanticPalette),
251
252
  MuiRadio: (0, radioLook_1.createPneRadioOverrides)(exports.resolvePneSemanticPalette),
252
253
  MuiTooltip: (0, tooltipLook_1.createPneTooltipOverrides)(),
253
- MuiToggleButtonGroup: {
254
- styleOverrides: {
255
- root: ({ ownerState, theme }) => ownerState.color === 'pneAccentuated'
256
- ? { backgroundColor: mode === 'light' ? '#ffffff' : theme.palette.pne.surface.raised }
257
- : {},
258
- },
259
- },
254
+ MuiToggleButtonGroup: (0, toggleLook_1.createPneToggleGroupOverrides)(exports.resolvePneSemanticPalette),
260
255
  });
261
256
  const createBaseThemeOptions = (skin, mode) => {
262
257
  const seed = (0, color_1.normalizeHexColor)(skin.experimentalColor);
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPneToggleGroupOverrides = void 0;
4
+ const buttonLook_1 = require("./buttonLook");
5
+ const tableControlLook_1 = require("./component/table/tableControlLook");
6
+ const tableControlMetrics_1 = require("./component/table/tableControlMetrics");
7
+ const GROUPED = '&& .MuiToggleButtonGroup-grouped';
8
+ const createPneToggleGroupOverrides = (resolvePalette) => ({
9
+ styleOverrides: {
10
+ root: ({ ownerState, theme }) => {
11
+ const pne = resolvePalette(theme);
12
+ const size = ownerState.size === 'small' ? 'small' : 'medium';
13
+ return {
14
+ ...(0, tableControlLook_1.tableControlShellLook)(pne, 'tabs', buttonLook_1.PNE_BUTTON_SIZE[size].height + 2 * tableControlMetrics_1.TABLE_CONTROL_SHELL_PADDING),
15
+ // A stacked group stretches its buttons to the widest one.
16
+ ...(ownerState.orientation === 'vertical' ? { alignItems: 'stretch' } : undefined),
17
+ // The text button of the table bands, as the views of a table are drawn.
18
+ [GROUPED]: {
19
+ ...(0, tableControlLook_1.tableControlTextButtonLook)(theme, pne, size),
20
+ border: 0,
21
+ borderRadius: '4px',
22
+ margin: 0,
23
+ },
24
+ [`${GROUPED}.Mui-selected`]: (0, tableControlLook_1.tableControlActiveLook)(pne),
25
+ };
26
+ },
27
+ },
28
+ });
29
+ exports.createPneToggleGroupOverrides = createPneToggleGroupOverrides;
@@ -54,7 +54,9 @@ const PneTableViewSelectorInner = (props, ref) => {
54
54
  rootSx,
55
55
  ...(Array.isArray(sx) ? sx : [sx]),
56
56
  ] },
57
- React.createElement(ToggleButtonGroup, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disabled: disabled, exclusive: true, sx: groupSx, value: value }, views.map(view => {
57
+ React.createElement(ToggleButtonGroup, { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, disabled: disabled, exclusive: true,
58
+ // The size the theme draws as these 24px views, so the theme and the styles here agree.
59
+ size: 'small', sx: groupSx, value: value }, views.map(view => {
58
60
  const handleClick = (event) => {
59
61
  // This selector always renders its options as native button-backed ToggleButtons.
60
62
  const buttonEvent = event;
@@ -1,8 +1,5 @@
1
- import { PNE_BUTTON_SIZE } from '../../buttonLook';
2
1
  import { resolvePneSemanticPalette } from '../../createTheme';
3
- import { TABLE_CONTROL_BAND_SIZE, TABLE_CONTROL_GAP, TABLE_CONTROL_SHELL_PADDING, TABLE_CONTROL_SIZE, } from './tableControlMetrics';
4
- // The small step of the button sizes; the theme draws the MUI `Button` from the same table.
5
- const SIZE = PNE_BUTTON_SIZE.small;
2
+ import { tableControlActiveLook, tableControlShellLook, tableControlTextButtonLook } from './tableControlLook';
6
3
  /**
7
4
  * A button of the table bands by the UI Kit (Button Tertiary sm): 24px, a 12/16 Medium label on the
8
5
  * sunken grey fill. The pointer and a press change the colour of the label, a press darkens the fill
@@ -12,39 +9,7 @@ const SIZE = PNE_BUTTON_SIZE.small;
12
9
  * These controls are toggle buttons, page items and arrows of a calendar, which the `MuiButton` entry
13
10
  * of the theme does not reach; the sizes and the colours are the ones of the theme's small text button.
14
11
  */
15
- export const createTableControlTextButtonStyle = (theme) => {
16
- const pne = resolvePneSemanticPalette(theme);
17
- const colors = pne.button.text;
18
- return {
19
- ...theme.typography.button,
20
- backgroundColor: colors.default.fill,
21
- borderRadius: '4px',
22
- color: colors.default.text,
23
- fontSize: `${SIZE.fontSize}px`,
24
- fontWeight: 500,
25
- height: `${TABLE_CONTROL_SIZE}px`,
26
- letterSpacing: 'normal',
27
- lineHeight: `${SIZE.lineHeight}px`,
28
- padding: `${SIZE.paddingBlock}px ${SIZE.paddingInline}px`,
29
- textTransform: 'none',
30
- '&:hover': {
31
- backgroundColor: colors.hover.fill,
32
- color: colors.hover.text,
33
- },
34
- '&:active': {
35
- backgroundColor: colors.pressed.fill,
36
- color: colors.pressed.text,
37
- },
38
- '&.Mui-disabled': {
39
- backgroundColor: colors.disabled.fill,
40
- color: colors.disabled.text,
41
- },
42
- '&.Mui-focusVisible': {
43
- outline: `2px solid ${pne.focusRing}`,
44
- outlineOffset: '-2px',
45
- },
46
- };
47
- };
12
+ export const createTableControlTextButtonStyle = (theme) => tableControlTextButtonLook(theme, resolvePneSemanticPalette(theme));
48
13
  /**
49
14
  * The current value of a set of band buttons that is an action on the rows - the page size in force:
50
15
  * UI Kit Button Primary sm, the brand fill under its label.
@@ -70,37 +35,11 @@ export const createTableControlCurrentStyle = (theme) => {
70
35
  * The picked item of a set of band buttons that switches a view (UI Kit Tertiary, State=Active): the
71
36
  * surface fill with the tab shadow; the label keeps its colour, under the pointer too.
72
37
  */
73
- export const createTableControlActiveStyle = (theme) => {
74
- const colors = resolvePneSemanticPalette(theme).button.text;
75
- const active = colors.active ?? colors.default;
76
- const look = {
77
- backgroundColor: active.fill,
78
- boxShadow: active.shadow ?? 'none',
79
- color: active.text,
80
- };
81
- return {
82
- ...look,
83
- '&:hover': look,
84
- '&:active': look,
85
- };
86
- };
38
+ export const createTableControlActiveStyle = (theme) => tableControlActiveLook(resolvePneSemanticPalette(theme));
87
39
  /**
88
40
  * The shell of a group of band controls: 32px high with 4px around its 24px controls and 4px between
89
41
  * them, radius 8, a 1px inner ring. `actions` is the white shell of the UI Kit Button group (the
90
42
  * pagination, the page sizes: actions on the rows); `tabs` is the grey one of the UI Kit Tabs (the
91
43
  * views: one of them is picked).
92
44
  */
93
- export const createTableControlShellStyle = (theme, kind) => {
94
- const band = resolvePneSemanticPalette(theme).table.band;
95
- const colors = kind === 'tabs' ? band.tabs : band.shell;
96
- return {
97
- alignItems: 'center',
98
- backgroundColor: colors.fill,
99
- borderRadius: '8px',
100
- boxShadow: `inset 0 0 0 1px ${colors.ring}`,
101
- boxSizing: 'border-box',
102
- gap: `${TABLE_CONTROL_GAP}px`,
103
- minHeight: `${TABLE_CONTROL_BAND_SIZE}px`,
104
- padding: `${TABLE_CONTROL_SHELL_PADDING}px`,
105
- };
106
- };
45
+ export const createTableControlShellStyle = (theme, kind) => tableControlShellLook(resolvePneSemanticPalette(theme), kind);
@@ -0,0 +1,11 @@
1
+ import type { CSSObject, Theme } from '@mui/material/styles';
2
+ import { type PneButtonLookSize } from '../../buttonLook';
3
+ import type { PneSemanticPalette } from '../../createTheme';
4
+ type TextButtonPalette = Pick<PneSemanticPalette, 'button' | 'focusRing'>;
5
+ /** UI Kit Button Tertiary of a size: a Medium label on the sunken fill, the focus ring inside. */
6
+ export declare const tableControlTextButtonLook: (theme: Theme, pne: TextButtonPalette, size?: PneButtonLookSize) => CSSObject;
7
+ /** UI Kit Tertiary, State=Active: the surface fill with the tab shadow; the label keeps its colour. */
8
+ export declare const tableControlActiveLook: (pne: Pick<PneSemanticPalette, "button">) => CSSObject;
9
+ /** The shell of a group: 4px around its controls and 4px between them, radius 8, a 1px inner ring. */
10
+ export declare const tableControlShellLook: (pne: Pick<PneSemanticPalette, "table">, kind: "actions" | "tabs", height?: number) => CSSObject;
11
+ export {};
@@ -0,0 +1,66 @@
1
+ import { PNE_BUTTON_SIZE } from '../../buttonLook';
2
+ import { TABLE_CONTROL_BAND_SIZE, TABLE_CONTROL_GAP, TABLE_CONTROL_SHELL_PADDING } from './tableControlMetrics';
3
+ /** UI Kit Button Tertiary of a size: a Medium label on the sunken fill, the focus ring inside. */
4
+ export const tableControlTextButtonLook = (theme, pne, size = 'small') => {
5
+ const config = PNE_BUTTON_SIZE[size];
6
+ const colors = pne.button.text;
7
+ return {
8
+ ...theme.typography.button,
9
+ backgroundColor: colors.default.fill,
10
+ borderRadius: '4px',
11
+ color: colors.default.text,
12
+ fontSize: `${config.fontSize}px`,
13
+ fontWeight: 500,
14
+ height: `${config.height}px`,
15
+ letterSpacing: 'normal',
16
+ lineHeight: `${config.lineHeight}px`,
17
+ padding: `${config.paddingBlock}px ${config.paddingInline}px`,
18
+ textTransform: 'none',
19
+ '&:hover': {
20
+ backgroundColor: colors.hover.fill,
21
+ color: colors.hover.text,
22
+ },
23
+ '&:active': {
24
+ backgroundColor: colors.pressed.fill,
25
+ color: colors.pressed.text,
26
+ },
27
+ '&.Mui-disabled': {
28
+ backgroundColor: colors.disabled.fill,
29
+ color: colors.disabled.text,
30
+ },
31
+ '&.Mui-focusVisible': {
32
+ outline: `2px solid ${pne.focusRing}`,
33
+ outlineOffset: '-2px',
34
+ },
35
+ };
36
+ };
37
+ /** UI Kit Tertiary, State=Active: the surface fill with the tab shadow; the label keeps its colour. */
38
+ export const tableControlActiveLook = (pne) => {
39
+ const colors = pne.button.text;
40
+ const active = colors.active ?? colors.default;
41
+ const look = {
42
+ backgroundColor: active.fill,
43
+ boxShadow: active.shadow ?? 'none',
44
+ color: active.text,
45
+ };
46
+ return {
47
+ ...look,
48
+ '&:hover': look,
49
+ '&:active': look,
50
+ };
51
+ };
52
+ /** The shell of a group: 4px around its controls and 4px between them, radius 8, a 1px inner ring. */
53
+ export const tableControlShellLook = (pne, kind, height = TABLE_CONTROL_BAND_SIZE) => {
54
+ const band = pne.table.band;
55
+ const colors = kind === 'tabs' ? band.tabs : band.shell;
56
+ return {
57
+ alignItems: 'center',
58
+ backgroundColor: colors.fill,
59
+ borderRadius: '8px',
60
+ boxShadow: `inset 0 0 0 1px ${colors.ring}`,
61
+ boxSizing: 'border-box',
62
+ gap: `${TABLE_CONTROL_GAP}px`,
63
+ minHeight: `${height}px`,
64
+ padding: `${TABLE_CONTROL_SHELL_PADDING}px`,
65
+ };
66
+ };
@@ -6,6 +6,7 @@ import { createPneButtonPalette, createPneFocusRing, createPneLinkColor, } from
6
6
  import { createPneCheckboxPalette } from './checkboxPalette';
7
7
  import { createPneChipOverrides } from './chipLook';
8
8
  import { createPneRadioOverrides } from './radioLook';
9
+ import { createPneToggleGroupOverrides } from './toggleLook';
9
10
  import { createPneTooltipOverrides } from './tooltipLook';
10
11
  import { createPneDropdownPalette } from './dropdownPalette';
11
12
  import { createPneModalPalette } from './modalPalette';
@@ -245,13 +246,7 @@ const createPneComponentOverrides = (mode) => ({
245
246
  MuiChip: createPneChipOverrides(resolvePneSemanticPalette),
246
247
  MuiRadio: createPneRadioOverrides(resolvePneSemanticPalette),
247
248
  MuiTooltip: createPneTooltipOverrides(),
248
- MuiToggleButtonGroup: {
249
- styleOverrides: {
250
- root: ({ ownerState, theme }) => ownerState.color === 'pneAccentuated'
251
- ? { backgroundColor: mode === 'light' ? '#ffffff' : theme.palette.pne.surface.raised }
252
- : {},
253
- },
254
- },
249
+ MuiToggleButtonGroup: createPneToggleGroupOverrides(resolvePneSemanticPalette),
255
250
  });
256
251
  const createBaseThemeOptions = (skin, mode) => {
257
252
  const seed = normalizeHexColor(skin.experimentalColor);
@@ -0,0 +1,3 @@
1
+ import type { Components, Theme } from '@mui/material/styles';
2
+ import type { PneSemanticPalette } from './createTheme';
3
+ export declare const createPneToggleGroupOverrides: (resolvePalette: (theme: Theme) => PneSemanticPalette) => NonNullable<Components<Theme>["MuiToggleButtonGroup"]>;
@@ -0,0 +1,25 @@
1
+ import { PNE_BUTTON_SIZE } from './buttonLook';
2
+ import { tableControlActiveLook, tableControlShellLook, tableControlTextButtonLook, } from './component/table/tableControlLook';
3
+ import { TABLE_CONTROL_SHELL_PADDING } from './component/table/tableControlMetrics';
4
+ const GROUPED = '&& .MuiToggleButtonGroup-grouped';
5
+ export const createPneToggleGroupOverrides = (resolvePalette) => ({
6
+ styleOverrides: {
7
+ root: ({ ownerState, theme }) => {
8
+ const pne = resolvePalette(theme);
9
+ const size = ownerState.size === 'small' ? 'small' : 'medium';
10
+ return {
11
+ ...tableControlShellLook(pne, 'tabs', PNE_BUTTON_SIZE[size].height + 2 * TABLE_CONTROL_SHELL_PADDING),
12
+ // A stacked group stretches its buttons to the widest one.
13
+ ...(ownerState.orientation === 'vertical' ? { alignItems: 'stretch' } : undefined),
14
+ // The text button of the table bands, as the views of a table are drawn.
15
+ [GROUPED]: {
16
+ ...tableControlTextButtonLook(theme, pne, size),
17
+ border: 0,
18
+ borderRadius: '4px',
19
+ margin: 0,
20
+ },
21
+ [`${GROUPED}.Mui-selected`]: tableControlActiveLook(pne),
22
+ };
23
+ },
24
+ },
25
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pne-ui",
3
- "version": "5.0.0-rc.39",
3
+ "version": "5.0.0-rc.40",
4
4
  "description": "React component kit on MUI for Payneteasy applications",
5
5
  "repository": {
6
6
  "type": "git",