@12-apps/ui 6.89.0 → 6.89.2
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/_internal/components/data-display/DayRuler/DayRuler.js +3 -3
- package/dist/_internal/components/data-display/DayRuler/DayRuler.parts.js +2 -2
- package/dist/_internal/components/data-display/DayRuler/DayRuler.styles.js +3 -1
- package/dist/_internal/components/data-display/index.js +3 -3
- package/dist/_internal/components/form/ToggleGroup/ToggleGroup.js +1 -1
- package/dist/_internal/components/form/index.js +1 -1
- package/dist/_internal/components/form/total-form/Fields/ToggleField.js +2 -2
- package/dist/_internal/components/form/total-form/Fields/index.js +3 -3
- package/dist/_internal/components/index.js +4 -4
- package/dist/{chunk-S4ITA3FA.js → chunk-ACM3HHZY.js} +2 -2
- package/dist/{chunk-3Y6NO5XL.js → chunk-BR3WBTTQ.js} +2 -2
- package/dist/{chunk-EEK2NK4W.js → chunk-G2PVUPE7.js} +26 -16
- package/dist/chunk-G2PVUPE7.js.map +1 -0
- package/dist/{chunk-FKF34YJV.js → chunk-HMEGQKNQ.js} +3 -3
- package/dist/{chunk-U2QV4TTZ.js → chunk-HWQM5D3V.js} +19 -8
- package/dist/chunk-HWQM5D3V.js.map +1 -0
- package/dist/{chunk-AYJGRQT4.js → chunk-RLTYBV4N.js} +2 -2
- package/dist/data-display/DayRuler.js +3 -3
- package/dist/form/ToggleGroup.js +1 -1
- package/dist/form/total-form.js +3 -3
- package/dist/types/components/data-display/DayRuler/DayRuler.styles.d.ts +6 -1
- package/dist/types/components/data-display/DayRuler/DayRuler.styles.d.ts.map +1 -1
- package/dist/types/components/form/ToggleGroup/ToggleGroup.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/data-display/DayRuler/DayRuler.styles.ts +29 -14
- package/src/components/form/ToggleGroup/ToggleGroup.tsx +29 -8
- package/dist/chunk-EEK2NK4W.js.map +0 -1
- package/dist/chunk-U2QV4TTZ.js.map +0 -1
- /package/dist/{chunk-S4ITA3FA.js.map → chunk-ACM3HHZY.js.map} +0 -0
- /package/dist/{chunk-3Y6NO5XL.js.map → chunk-BR3WBTTQ.js.map} +0 -0
- /package/dist/{chunk-FKF34YJV.js.map → chunk-HMEGQKNQ.js.map} +0 -0
- /package/dist/{chunk-AYJGRQT4.js.map → chunk-RLTYBV4N.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
DayRuler
|
|
4
|
-
} from "../../../../chunk-
|
|
5
|
-
import "../../../../chunk-
|
|
6
|
-
import "../../../../chunk-
|
|
4
|
+
} from "../../../../chunk-HMEGQKNQ.js";
|
|
5
|
+
import "../../../../chunk-ACM3HHZY.js";
|
|
6
|
+
import "../../../../chunk-G2PVUPE7.js";
|
|
7
7
|
import "../../../../chunk-Y3F2F36I.js";
|
|
8
8
|
import "../../../../chunk-K3IB7S7Q.js";
|
|
9
9
|
import "../../../../chunk-YMYJO2CZ.js";
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
Coverage,
|
|
4
4
|
RulerRow,
|
|
5
5
|
spanOf
|
|
6
|
-
} from "../../../../chunk-
|
|
7
|
-
import "../../../../chunk-
|
|
6
|
+
} from "../../../../chunk-ACM3HHZY.js";
|
|
7
|
+
import "../../../../chunk-G2PVUPE7.js";
|
|
8
8
|
import "../../../../chunk-YMYJO2CZ.js";
|
|
9
9
|
import "../../../../chunk-7ZQ3KQ7J.js";
|
|
10
10
|
import "../../../../chunk-LE5JYNR7.js";
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
breakSx,
|
|
8
8
|
coverageCellSx,
|
|
9
9
|
coverageLabelSx,
|
|
10
|
+
coverageStrength,
|
|
10
11
|
coverageSx,
|
|
11
12
|
groupTitleSx,
|
|
12
13
|
handleSx,
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
skeletonTrackSx,
|
|
19
20
|
trackSx,
|
|
20
21
|
whoSx
|
|
21
|
-
} from "../../../../chunk-
|
|
22
|
+
} from "../../../../chunk-G2PVUPE7.js";
|
|
22
23
|
import "../../../../chunk-7ZQ3KQ7J.js";
|
|
23
24
|
import "../../../../chunk-4HK4FVMV.js";
|
|
24
25
|
import "../../../../chunk-TZ23DNKY.js";
|
|
@@ -39,6 +40,7 @@ export {
|
|
|
39
40
|
breakSx,
|
|
40
41
|
coverageCellSx,
|
|
41
42
|
coverageLabelSx,
|
|
43
|
+
coverageStrength,
|
|
42
44
|
coverageSx,
|
|
43
45
|
groupTitleSx,
|
|
44
46
|
handleSx,
|
|
@@ -218,9 +218,9 @@ import {
|
|
|
218
218
|
import "../../../chunk-D3OXTS7Y.js";
|
|
219
219
|
import {
|
|
220
220
|
DayRuler
|
|
221
|
-
} from "../../../chunk-
|
|
222
|
-
import "../../../chunk-
|
|
223
|
-
import "../../../chunk-
|
|
221
|
+
} from "../../../chunk-HMEGQKNQ.js";
|
|
222
|
+
import "../../../chunk-ACM3HHZY.js";
|
|
223
|
+
import "../../../chunk-G2PVUPE7.js";
|
|
224
224
|
import "../../../chunk-Y3F2F36I.js";
|
|
225
225
|
import "../../../chunk-K3IB7S7Q.js";
|
|
226
226
|
import "../../../chunk-YMYJO2CZ.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
ToggleField
|
|
4
|
-
} from "../../../../../chunk-
|
|
4
|
+
} from "../../../../../chunk-RLTYBV4N.js";
|
|
5
5
|
import "../../../../../chunk-4XK6JQ4D.js";
|
|
6
6
|
import "../../../../../chunk-ONMSTW4B.js";
|
|
7
|
-
import "../../../../../chunk-
|
|
7
|
+
import "../../../../../chunk-HWQM5D3V.js";
|
|
8
8
|
import "../../../../../chunk-C3UKR3NT.js";
|
|
9
9
|
import "../../../../../chunk-D6KL74KI.js";
|
|
10
10
|
import "../../../../../chunk-RGVNXES5.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../../../../chunk-
|
|
1
|
+
import "../../../../../chunk-BR3WBTTQ.js";
|
|
2
2
|
import {
|
|
3
3
|
TextField
|
|
4
4
|
} from "../../../../../chunk-3IX2TP4I.js";
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
} from "../../../../../chunk-NQ6P7O7C.js";
|
|
14
14
|
import {
|
|
15
15
|
ToggleField
|
|
16
|
-
} from "../../../../../chunk-
|
|
16
|
+
} from "../../../../../chunk-RLTYBV4N.js";
|
|
17
17
|
import "../../../../../chunk-4XK6JQ4D.js";
|
|
18
18
|
import "../../../../../chunk-II3YNC5S.js";
|
|
19
19
|
import "../../../../../chunk-NZBEE2PR.js";
|
|
20
20
|
import "../../../../../chunk-NKHNUTTY.js";
|
|
21
21
|
import "../../../../../chunk-ONMSTW4B.js";
|
|
22
|
-
import "../../../../../chunk-
|
|
22
|
+
import "../../../../../chunk-HWQM5D3V.js";
|
|
23
23
|
import "../../../../../chunk-OQW4OERS.js";
|
|
24
24
|
import "../../../../../chunk-6VTOGR36.js";
|
|
25
25
|
import "../../../../../chunk-IYC7NPX7.js";
|
|
@@ -324,7 +324,7 @@ import "../../chunk-NKHNUTTY.js";
|
|
|
324
324
|
import "../../chunk-ONMSTW4B.js";
|
|
325
325
|
import {
|
|
326
326
|
ToggleGroup
|
|
327
|
-
} from "../../chunk-
|
|
327
|
+
} from "../../chunk-HWQM5D3V.js";
|
|
328
328
|
import {
|
|
329
329
|
MenuSelect
|
|
330
330
|
} from "../../chunk-OQW4OERS.js";
|
|
@@ -807,9 +807,9 @@ import {
|
|
|
807
807
|
import "../../chunk-D3OXTS7Y.js";
|
|
808
808
|
import {
|
|
809
809
|
DayRuler
|
|
810
|
-
} from "../../chunk-
|
|
811
|
-
import "../../chunk-
|
|
812
|
-
import "../../chunk-
|
|
810
|
+
} from "../../chunk-HMEGQKNQ.js";
|
|
811
|
+
import "../../chunk-ACM3HHZY.js";
|
|
812
|
+
import "../../chunk-G2PVUPE7.js";
|
|
813
813
|
import "../../chunk-Y3F2F36I.js";
|
|
814
814
|
import "../../chunk-K3IB7S7Q.js";
|
|
815
815
|
import "../../chunk-YMYJO2CZ.js";
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
rowSx,
|
|
15
15
|
trackSx,
|
|
16
16
|
whoSx
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-G2PVUPE7.js";
|
|
18
18
|
import {
|
|
19
19
|
useTextFits
|
|
20
20
|
} from "./chunk-YMYJO2CZ.js";
|
|
@@ -205,4 +205,4 @@ export {
|
|
|
205
205
|
Coverage,
|
|
206
206
|
Axis
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-ACM3HHZY.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-NQ6P7O7C.js";
|
|
13
13
|
import {
|
|
14
14
|
ToggleField
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-RLTYBV4N.js";
|
|
16
16
|
import {
|
|
17
17
|
__export
|
|
18
18
|
} from "./chunk-PZ5AY32C.js";
|
|
@@ -30,4 +30,4 @@ __export(Fields_exports, {
|
|
|
30
30
|
export {
|
|
31
31
|
Fields_exports
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-BR3WBTTQ.js.map
|
|
@@ -6,9 +6,6 @@ import {
|
|
|
6
6
|
blockToneStyles,
|
|
7
7
|
breakHatch
|
|
8
8
|
} from "./chunk-4HK4FVMV.js";
|
|
9
|
-
import {
|
|
10
|
-
softSignal
|
|
11
|
-
} from "./chunk-TZ23DNKY.js";
|
|
12
9
|
import {
|
|
13
10
|
FIELD_BORDER_WIDTH
|
|
14
11
|
} from "./chunk-O6MJWHU5.js";
|
|
@@ -18,6 +15,7 @@ import {
|
|
|
18
15
|
} from "./chunk-YKCAJ2TN.js";
|
|
19
16
|
|
|
20
17
|
// src/components/data-display/DayRuler/DayRuler.styles.ts
|
|
18
|
+
import { alpha } from "@mui/material/styles/index.js";
|
|
21
19
|
function rootSx(hasActions) {
|
|
22
20
|
return (theme) => ({
|
|
23
21
|
containerType: "inline-size",
|
|
@@ -55,19 +53,30 @@ function coverageSx(hours) {
|
|
|
55
53
|
height: rem(theme, DAY_RULER_METRICS.coverage.height)
|
|
56
54
|
});
|
|
57
55
|
}
|
|
56
|
+
function coverageStrength(count) {
|
|
57
|
+
if (count <= 0) return 0;
|
|
58
|
+
return Math.min(0.85, 0.18 + count * 0.09);
|
|
59
|
+
}
|
|
58
60
|
function coverageCellSx(count) {
|
|
59
|
-
return (theme) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
return (theme) => {
|
|
62
|
+
const strength = coverageStrength(count);
|
|
63
|
+
return {
|
|
64
|
+
display: "flex",
|
|
65
|
+
alignItems: "center",
|
|
66
|
+
justifyContent: "center",
|
|
67
|
+
fontSize: rem(theme, DAY_RULER_METRICS.coverage.font),
|
|
68
|
+
borderRadius: rem(theme, DAY_RULER_METRICS.coverage.radius),
|
|
69
|
+
color: theme.palette.text.primary,
|
|
70
|
+
// A tonal fill, as the prototype's coverage line draws it — never an outline (FUT-3831). It is
|
|
71
|
+
// the success colour over the page, so a staffed hour is LIGHTER than an empty one in dark mode
|
|
72
|
+
// and plainly green in light, where the soft-signal blend read as the empty grey. The hairline
|
|
73
|
+
// stays transparent so a count never shifts its cell.
|
|
74
|
+
backgroundColor: strength > 0 ? alpha(theme.palette.success.main, strength) : theme.palette.action.hover,
|
|
75
|
+
border: "1px solid transparent",
|
|
76
|
+
minWidth: 0,
|
|
77
|
+
overflow: "hidden"
|
|
78
|
+
};
|
|
79
|
+
};
|
|
71
80
|
}
|
|
72
81
|
var axisSx = (theme) => ({
|
|
73
82
|
position: "relative",
|
|
@@ -262,6 +271,7 @@ export {
|
|
|
262
271
|
lineSx,
|
|
263
272
|
coverageLabelSx,
|
|
264
273
|
coverageSx,
|
|
274
|
+
coverageStrength,
|
|
265
275
|
coverageCellSx,
|
|
266
276
|
axisSx,
|
|
267
277
|
groupTitleSx,
|
|
@@ -278,4 +288,4 @@ export {
|
|
|
278
288
|
skeletonTrackSx,
|
|
279
289
|
skeletonNameSx
|
|
280
290
|
};
|
|
281
|
-
//# sourceMappingURL=chunk-
|
|
291
|
+
//# sourceMappingURL=chunk-G2PVUPE7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/data-display/DayRuler/DayRuler.styles.ts"],"sourcesContent":["import { alpha, type CSSObject, type SxProps, type Theme } from '@mui/material/styles/index.js';\n\nimport { FIELD_BORDER_WIDTH } from '../../../tokens/field-height.core';\nimport { rem, sxRem } from '../../../tokens/relative';\nimport { actualBarColor, blockToneStyles, breakHatch } from '../ScheduleGrid/schedule-tones';\nimport type { ScheduleBlockTone } from '../ScheduleGrid/ScheduleGrid.types';\nimport { DAY_RULER_METRICS as M } from './DayRuler.metrics';\n\n/** The container narrow rows answer to (container queries, never media queries). */\n/**\n * `--dr-actions`: the actions column, 220px when any row has actions and\n * nothing when none does (no empty column at the end of every row).\n */\nexport function rootSx(hasActions: boolean): SxProps<Theme> {\n return (theme: Theme) => ({\n containerType: 'inline-size',\n minWidth: 0,\n width: '100%',\n userSelect: 'none',\n '--dr-actions': hasActions ? rem(theme, M.sideColumn) : '0%',\n });\n}\n\n/** `@container` below which a row stacks (the coverage and axis rows go full width). Bounds are \"from px up\". */\nfunction compact(theme: Theme): string {\n return `@container (width < ${rem(theme, M.compactBelow)})`;\n}\n\n/** `@container` below which the pane is phone-sized: no coverage row, no axis. Bounds are \"from px up\". */\nfunction phone(theme: Theme): string {\n return `@container (width < ${rem(theme, M.phoneBelow)})`;\n}\n\n/** Name · track · actions, the coverage row and the axis row share these columns on a computer. */\nexport const lineSx: SxProps<Theme> = (theme: Theme) => ({\n display: 'grid',\n gridTemplateColumns: `${rem(theme, M.sideColumn)} minmax(0, 1fr) var(--dr-actions)`,\n columnGap: rem(theme, M.gap),\n alignItems: 'center',\n // Stacked: across the full width, like the tracks; the label above the counts.\n [compact(theme)]: {\n gridTemplateColumns: 'minmax(0, 1fr)',\n rowGap: rem(theme, M.coverage.gap),\n '& > span:empty': { display: 'none' },\n },\n [phone(theme)]: { display: 'none' },\n});\n\nexport const coverageLabelSx: SxProps<Theme> = { fontSize: sxRem(M.meta), color: 'text.secondary' };\n\nexport function coverageSx(hours: number): SxProps<Theme> {\n return (theme: Theme) => ({\n display: 'grid',\n gridTemplateColumns: `repeat(${hours}, minmax(0, 1fr))`,\n gap: rem(theme, M.coverage.gap),\n height: rem(theme, M.coverage.height),\n });\n}\n\n/**\n * How strongly a staffed hour is filled: the prototype's tonal success step, deeper with each\n * person on the escala (0.18 + 0.09 per person, at most 0.85). An empty hour has none.\n */\nexport function coverageStrength(count: number): number {\n if (count <= 0) return 0;\n return Math.min(0.85, 0.18 + count * 0.09);\n}\n\nexport function coverageCellSx(count: number): SxProps<Theme> {\n return (theme: Theme) => {\n const strength = coverageStrength(count);\n return {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontSize: rem(theme, M.coverage.font),\n borderRadius: rem(theme, M.coverage.radius),\n color: theme.palette.text.primary,\n // A tonal fill, as the prototype's coverage line draws it — never an outline (FUT-3831). It is\n // the success colour over the page, so a staffed hour is LIGHTER than an empty one in dark mode\n // and plainly green in light, where the soft-signal blend read as the empty grey. The hairline\n // stays transparent so a count never shifts its cell.\n backgroundColor: strength > 0 ? alpha(theme.palette.success.main, strength) : theme.palette.action.hover,\n border: '1px solid transparent',\n minWidth: 0,\n overflow: 'hidden',\n };\n };\n}\n\nexport const axisSx: SxProps<Theme> = (theme: Theme) => ({\n position: 'relative',\n height: rem(theme, M.axis.height),\n fontSize: rem(theme, M.axis.font),\n color: theme.palette.text.secondary,\n mt: 0.5,\n '& > span': { position: 'absolute', transform: 'translateX(-50%)', whiteSpace: 'nowrap' },\n});\n\nexport const groupTitleSx: SxProps<Theme> = {\n fontSize: sxRem(M.groupTitle),\n letterSpacing: '0.05em',\n textTransform: 'uppercase',\n color: 'text.secondary',\n fontWeight: 500,\n pt: 1.5,\n pb: 0.5,\n m: 0,\n};\n\n/**\n * One person's row. A computer: name · track · actions on one line. A narrow\n * ruler (a phone): name and actions on top, the track under them, full width.\n */\nexport const rowSx: SxProps<Theme> = (theme: Theme) => ({\n display: 'grid',\n gridTemplateColumns: `${rem(theme, M.sideColumn)} minmax(0, 1fr) var(--dr-actions)`,\n gridTemplateAreas: '\"who track actions\"',\n columnGap: rem(theme, M.gap),\n alignItems: 'center',\n py: rem(theme, M.rowPaddingY),\n borderBottom: `1px solid ${theme.palette.divider}`,\n [compact(theme)]: {\n gridTemplateColumns: 'minmax(0, 1fr) auto',\n gridTemplateAreas: '\"who actions\" \"track track\"',\n rowGap: theme.spacing(1),\n py: theme.spacing(1.5),\n },\n});\n\nexport const whoSx: SxProps<Theme> = { gridArea: 'who', minWidth: 0 };\n\nexport const actionsSx: SxProps<Theme> = {\n gridArea: 'actions',\n display: 'flex',\n gap: 1,\n alignItems: 'center',\n justifyContent: 'flex-end',\n flexWrap: 'wrap',\n minWidth: 0,\n};\n\n/** A break inside a block: a hatched band across its height, under its text. `span` is in % of the block. */\nexport function breakSx(span: Span): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: `${span.at}%`,\n width: `${span.share}%`,\n background: breakHatch(theme, rem(theme, M.breakStripe.ink), rem(theme, M.breakStripe.ink + M.breakStripe.gap)),\n pointerEvents: 'none',\n // Where the band meets an end of the block it takes the block's rounding:\n // on a phone the block does not clip (its hit area reaches past it).\n ...(span.at <= 0.01 ? { borderTopLeftRadius: 'inherit', borderBottomLeftRadius: 'inherit' } : {}),\n ...(span.at + span.share >= 99.99 ? { borderTopRightRadius: 'inherit', borderBottomRightRadius: 'inherit' } : {}),\n });\n}\n\n/** The hour lines: one every `every` hours of a `hours`-long ruler. */\nfunction hourLines(theme: Theme, hours: number, every: number): string {\n const line = theme.palette.divider;\n const step = `${(100 * every) / hours}%`;\n const hairline = `${FIELD_BORDER_WIDTH}px`;\n return `repeating-linear-gradient(to right, ${line} 0, ${line} ${hairline}, transparent ${hairline}, transparent ${step})`;\n}\n\nexport function trackSx(opts: { hours: number; tickHours: number; interactive: boolean }): SxProps<Theme> {\n return (theme: Theme) => ({\n gridArea: 'track',\n position: 'relative',\n height: rem(theme, M.track.height),\n borderRadius: rem(theme, M.track.radius),\n backgroundColor: theme.palette.action.hover,\n backgroundImage: hourLines(theme, opts.hours, 1),\n cursor: opts.interactive ? 'crosshair' : 'default',\n touchAction: 'auto',\n outline: 'none',\n '&:focus-visible': { boxShadow: `0 0 0 ${rem(theme, M.ring)} ${theme.palette.primary.main}` },\n [compact(theme)]: {\n height: rem(theme, M.track.compactHeight),\n borderRadius: rem(theme, M.track.compactRadius),\n backgroundImage: hourLines(theme, opts.hours, opts.tickHours),\n },\n });\n}\n\n/** Where a bar starts and how long it is, both in % of the track. */\nexport interface Span {\n at: number;\n share: number;\n}\n\nexport function blockSx(tone: ScheduleBlockTone, span: Span, opts: { selected: boolean; movable: boolean }): SxProps<Theme> {\n return (theme: Theme): CSSObject => ({\n ...blockToneStyles(theme, tone, true),\n position: 'absolute',\n left: `${span.at}%`,\n width: `${span.share}%`,\n top: rem(theme, M.block.top),\n height: rem(theme, M.block.height),\n boxSizing: 'border-box',\n borderRadius: rem(theme, M.block.radius),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: `0 ${rem(theme, M.block.paddingX)}`,\n margin: 0,\n font: 'inherit',\n fontSize: rem(theme, M.block.font),\n fontWeight: 500,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n cursor: opts.movable ? 'grab' : 'pointer',\n boxShadow: opts.selected ? `0 0 0 ${rem(theme, M.ring)} ${theme.palette.primary.main}` : 'none',\n '&:focus-visible': { outline: `${rem(theme, M.ring)} solid ${theme.palette.primary.main}`, outlineOffset: rem(theme, M.ringOffset) },\n '& [data-dr-text]': { position: 'relative', overflow: 'hidden', textOverflow: 'ellipsis', minWidth: 0 },\n '& [data-dr-text=\"short\"]': { display: 'none' },\n [compact(theme)]: {\n top: rem(theme, M.block.compactTop),\n height: rem(theme, M.block.compactHeight),\n // A 40px hit area around the 20px bar, the look unchanged: the text cuts\n // itself (its spans ellipsize), so the block need not clip.\n overflow: 'visible',\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n top: '50%',\n height: rem(theme, M.block.hitArea),\n transform: 'translateY(-50%)',\n },\n '&[data-narrow] [data-dr-text=\"full\"]': { display: 'none' },\n '&[data-narrow] [data-dr-text=\"short\"]': { display: 'inline' },\n },\n });\n}\n\nexport function handleSx(side: 'l' | 'r'): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n top: 0,\n bottom: 0,\n [side === 'l' ? 'left' : 'right']: 0,\n width: rem(theme, M.handle),\n cursor: 'ew-resize',\n });\n}\n\nexport function actualSx(span: Span): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n left: `${span.at}%`,\n width: `${span.share}%`,\n top: rem(theme, M.actual.top),\n height: rem(theme, M.actual.height),\n borderRadius: rem(theme, M.actual.radius),\n backgroundColor: actualBarColor(theme),\n pointerEvents: 'none',\n [compact(theme)]: { top: rem(theme, M.actual.compactTop), height: rem(theme, M.actual.compactHeight) },\n });\n}\n\nexport function actualLabelSx(left: number): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n left: `calc(${left}% + ${rem(theme, M.actualLabel.offset)})`,\n top: rem(theme, M.actualLabel.top),\n fontSize: rem(theme, M.actualLabel.font),\n color: theme.palette.text.secondary,\n whiteSpace: 'nowrap',\n pointerEvents: 'none',\n [compact(theme)]: { display: 'none' },\n });\n}\n\nexport function nowSx(left: number): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n left: `${left}%`,\n top: rem(theme, -M.now.overhang),\n bottom: rem(theme, -M.now.overhang),\n width: rem(theme, M.now.width),\n backgroundColor: theme.palette.primary.main,\n pointerEvents: 'none',\n });\n}\n\nexport const skeletonTrackSx: SxProps<Theme> = (theme: Theme) => ({\n gridArea: 'track',\n height: rem(theme, M.track.height),\n borderRadius: rem(theme, M.track.radius),\n backgroundColor: theme.palette.action.hover,\n});\n\nexport const skeletonNameSx: SxProps<Theme> = (theme: Theme) => ({\n gridArea: 'who',\n height: rem(theme, M.name),\n width: '60%',\n borderRadius: rem(theme, M.skeletonNameRadius),\n backgroundColor: theme.palette.action.hover,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,aAAuD;AAazD,SAAS,OAAO,YAAqC;AAC1D,SAAO,CAAC,WAAkB;AAAA,IACxB,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,gBAAgB,aAAa,IAAI,OAAO,kBAAE,UAAU,IAAI;AAAA,EAC1D;AACF;AAGA,SAAS,QAAQ,OAAsB;AACrC,SAAO,uBAAuB,IAAI,OAAO,kBAAE,YAAY,CAAC;AAC1D;AAGA,SAAS,MAAM,OAAsB;AACnC,SAAO,uBAAuB,IAAI,OAAO,kBAAE,UAAU,CAAC;AACxD;AAGO,IAAM,SAAyB,CAAC,WAAkB;AAAA,EACvD,SAAS;AAAA,EACT,qBAAqB,GAAG,IAAI,OAAO,kBAAE,UAAU,CAAC;AAAA,EAChD,WAAW,IAAI,OAAO,kBAAE,GAAG;AAAA,EAC3B,YAAY;AAAA;AAAA,EAEZ,CAAC,QAAQ,KAAK,CAAC,GAAG;AAAA,IAChB,qBAAqB;AAAA,IACrB,QAAQ,IAAI,OAAO,kBAAE,SAAS,GAAG;AAAA,IACjC,kBAAkB,EAAE,SAAS,OAAO;AAAA,EACtC;AAAA,EACA,CAAC,MAAM,KAAK,CAAC,GAAG,EAAE,S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AAM,GAAG,IAAI;AAAA,IACb,KAAK,IAAI,OAAO,CAAC,kBAAE,IAAI,QAAQ;AAAA,IAC/B,QAAQ,IAAI,OAAO,CAAC,kBAAE,IAAI,QAAQ;AAAA,IAClC,OAAO,IAAI,OAAO,kBAAE,IAAI,KAAK;AAAA,IAC7B,iBAAiB,MAAM,QAAQ,QAAQ;AAAA,IACvC,eAAe;AAAA,EACjB;AACF;AAEO,IAAM,kBAAkC,CAAC,WAAkB;AAAA,EAChE,UAAU;AAAA,EACV,QAAQ,IAAI,OAAO,kBAAE,MAAM,MAAM;AAAA,EACjC,cAAc,IAAI,OAAO,kBAAE,MAAM,MAAM;AAAA,EACvC,iBAAiB,MAAM,QAAQ,OAAO;AACxC;AAEO,IAAM,iBAAiC,CAAC,WAAkB;AAAA,EAC/D,UAAU;AAAA,EACV,QAAQ,IAAI,OAAO,kBAAE,IAAI;AAAA,EACzB,OAAO;AAAA,EACP,cAAc,IAAI,OAAO,kBAAE,kBAAkB;AAAA,EAC7C,iBAAiB,MAAM,QAAQ,OAAO;AACxC;","names":[]}
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
Axis,
|
|
3
3
|
Coverage,
|
|
4
4
|
RulerRow
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ACM3HHZY.js";
|
|
6
6
|
import {
|
|
7
7
|
groupTitleSx,
|
|
8
8
|
rootSx,
|
|
9
9
|
rowSx,
|
|
10
10
|
skeletonNameSx,
|
|
11
11
|
skeletonTrackSx
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-G2PVUPE7.js";
|
|
13
13
|
import {
|
|
14
14
|
handleBlockKey,
|
|
15
15
|
keyCreateSpan
|
|
@@ -117,4 +117,4 @@ function DayRuler(props) {
|
|
|
117
117
|
export {
|
|
118
118
|
DayRuler
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-HMEGQKNQ.js.map
|
|
@@ -67,6 +67,23 @@ var StyledToggleGroup = styled(ToggleButtonGroup, {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
});
|
|
70
|
+
function selectedSx(theme, palette, gradient) {
|
|
71
|
+
const ring = rem(theme, FIELD_BORDER_WIDTH * 2);
|
|
72
|
+
return {
|
|
73
|
+
"&.Mui-selected": {
|
|
74
|
+
backgroundColor: palette.main,
|
|
75
|
+
color: palette.contrastText,
|
|
76
|
+
...gradient && { background: `linear-gradient(135deg, ${palette.main}, ${palette.dark})` }
|
|
77
|
+
},
|
|
78
|
+
"&.Mui-selected:hover": {
|
|
79
|
+
backgroundColor: palette.dark,
|
|
80
|
+
color: palette.contrastText,
|
|
81
|
+
...gradient && { background: `linear-gradient(135deg, ${palette.dark}, ${palette.dark})` }
|
|
82
|
+
},
|
|
83
|
+
"&.Mui-selected.Mui-focusVisible": { backgroundColor: palette.main, color: palette.contrastText },
|
|
84
|
+
"&.Mui-focusVisible": { outline: `${ring} solid ${palette.main}`, outlineOffset: ring }
|
|
85
|
+
};
|
|
86
|
+
}
|
|
70
87
|
var ToggleGroup = forwardRef(
|
|
71
88
|
({
|
|
72
89
|
variant = "single",
|
|
@@ -116,13 +133,7 @@ var ToggleGroup = forwardRef(
|
|
|
116
133
|
minHeight: (theme2) => fieldHeight(theme2, asFieldSize(size)),
|
|
117
134
|
paddingTop: 0,
|
|
118
135
|
paddingBottom: 0,
|
|
119
|
-
|
|
120
|
-
backgroundColor: colorPalette.main,
|
|
121
|
-
color: colorPalette.contrastText,
|
|
122
|
-
...gradient && {
|
|
123
|
-
background: `linear-gradient(135deg, ${colorPalette.main}, ${colorPalette.dark})`
|
|
124
|
-
}
|
|
125
|
-
}
|
|
136
|
+
...selectedSx(theme, colorPalette, gradient)
|
|
126
137
|
},
|
|
127
138
|
children: /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
128
139
|
option.icon,
|
|
@@ -140,4 +151,4 @@ ToggleGroup.displayName = "ToggleGroup";
|
|
|
140
151
|
export {
|
|
141
152
|
ToggleGroup
|
|
142
153
|
};
|
|
143
|
-
//# sourceMappingURL=chunk-
|
|
154
|
+
//# sourceMappingURL=chunk-HWQM5D3V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/form/ToggleGroup/ToggleGroup.tsx"],"sourcesContent":["import Box from '@mui/material/Box/index.js';\nimport ToggleButton from '@mui/material/ToggleButton/index.js';\nimport ToggleButtonGroup from '@mui/material/ToggleButtonGroup/index.js';\nimport { alpha, useTheme, styled } from '@mui/material/styles/index.js';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport React, { forwardRef } from 'react';\n\nimport type { ToggleGroupProps } from './ToggleGroup.types';\nimport { asFieldSize, FIELD_BORDER_WIDTH, fieldHeight } from '../../../tokens/field-height';\nimport { fieldRadius } from '../../../tokens/field-radius';\nimport { controlNeutral } from '../../../tokens/ink';\nimport { rem, remPx, rems } from '../../../tokens/relative';\nimport { cssLengthToPx } from '../../../tokens/css-units';\n\n/** The glass frame's padding (4px at the design scale); its border is the field hairline. */\nconst glassPadding = (theme: Theme): string => rem(theme, 4);\n\nconst getColorFromTheme = (theme: Theme, color: string) => {\n if (color === 'neutral') {\n const neutral = controlNeutral(theme);\n return { ...neutral, contrastText: theme.palette.getContrastText(neutral.main) };\n }\n\n const colorMap = {\n primary: theme.palette.primary,\n secondary: theme.palette.secondary,\n success: theme.palette.success,\n warning: theme.palette.warning,\n info: theme.palette.info,\n danger: theme.palette.error,\n };\n\n const palette = colorMap[color as keyof typeof colorMap] || theme.palette.primary;\n\n // Ensure palette has required properties\n return {\n main: palette.main,\n dark: palette.dark || palette.main,\n light: palette.light || palette.main,\n contrastText: palette.contrastText || theme.palette.getContrastText(palette.main),\n };\n};\n\n/** The glass frame's radius: the field radius plus its padding, the buttons' margin and its border. */\nconst glassFrameRadius = (theme: Theme): number =>\n fieldRadius(theme) + remPx(theme, 4) + cssLengthToPx(theme.spacing(0.5), 4) + FIELD_BORDER_WIDTH;\n\nconst StyledToggleGroup = styled(ToggleButtonGroup, {\n shouldForwardProp: (prop) => !['customColor', 'customSize', 'glass'].includes(prop as string),\n})<{\n customColor?: string;\n customSize?: string;\n glass?: boolean;\n}>(({ theme, glass }) => {\n // Each button is the field, so it takes the field radius. The glass frame\n // around them is inset by its padding, the buttons' margin and its border,\n // and rounds by that much more so the two corners stay concentric.\n const radius = fieldRadius(theme);\n return {\n backgroundColor: glass ? alpha(theme.palette.background.paper, 0.1) : 'transparent',\n backdropFilter: glass ? `blur(${rem(theme, 20)})` : 'none',\n borderRadius: glass ? glassFrameRadius(theme) : radius,\n padding: glass ? glassPadding(theme) : 0,\n border: glass ? `${FIELD_BORDER_WIDTH}px solid ${alpha(theme.palette.divider, 0.2)}` : 'none',\n\n '& .MuiToggleButtonGroup-grouped': {\n margin: theme.spacing(0.5),\n border: 0,\n borderRadius: `${radius}px !important`,\n },\n };\n});\n\ntype Palette = ReturnType<typeof getColorFromTheme>;\n\n/**\n * The chosen option's fill, in every state. MUI's own `.Mui-selected:hover` (and\n * its focus-visible) out-rank a plain `.Mui-selected` rule and paint the chosen\n * option a translucent grey under white text: hovered — as it always is right\n * after a click — or focused, it stopped reading as chosen (FUT-3831). It keeps\n * its colour's fill, the darker step on hover, and keyboard focus adds a ring,\n * never a new fill.\n */\nfunction selectedSx(theme: Theme, palette: Palette, gradient: boolean) {\n const ring = rem(theme, FIELD_BORDER_WIDTH * 2);\n return {\n '&.Mui-selected': {\n backgroundColor: palette.main,\n color: palette.contrastText,\n ...(gradient && { background: `linear-gradient(135deg, ${palette.main}, ${palette.dark})` }),\n },\n '&.Mui-selected:hover': {\n backgroundColor: palette.dark,\n color: palette.contrastText,\n ...(gradient && { background: `linear-gradient(135deg, ${palette.dark}, ${palette.dark})` }),\n },\n '&.Mui-selected.Mui-focusVisible': { backgroundColor: palette.main, color: palette.contrastText },\n '&.Mui-focusVisible': { outline: `${ring} solid ${palette.main}`, outlineOffset: ring },\n };\n}\n\nexport const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(\n (\n {\n variant = 'single',\n color = 'primary',\n size = 'md',\n options,\n glass = false,\n gradient = false,\n value,\n onChange,\n dataTestId = 'toggle-group',\n ...props\n },\n ref,\n ) => {\n const theme = useTheme();\n const colorPalette = getColorFromTheme(theme, color);\n\n const sizeMap = {\n xs: { padding: rems(theme, 4, 8), fontSize: rem(theme, 12) },\n sm: { padding: rems(theme, 6, 12), fontSize: rem(theme, 14) },\n md: { padding: rems(theme, 8, 16), fontSize: rem(theme, 16) },\n lg: { padding: rems(theme, 10, 20), fontSize: rem(theme, 18) },\n xl: { padding: rems(theme, 12, 24), fontSize: rem(theme, 20) },\n };\n\n return (\n <StyledToggleGroup\n ref={ref}\n customColor={color}\n customSize={size}\n glass={glass}\n value={value}\n onChange={onChange}\n exclusive={variant === 'exclusive' || variant === 'single'}\n data-testid={dataTestId}\n {...props}\n >\n {options.map((option) => (\n <ToggleButton\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n data-testid={`${dataTestId}-item-${option.value}`}\n sx={{\n textTransform: 'none',\n fontWeight: 500,\n transition: 'all 0.3s ease',\n ...sizeMap[size as keyof typeof sizeMap],\n // The theme's field height for the size; the label centres in it.\n minHeight: (theme) => fieldHeight(theme, asFieldSize(size)),\n paddingTop: 0,\n paddingBottom: 0,\n\n ...selectedSx(theme, colorPalette, gradient),\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n {option.icon}\n {option.label}\n </Box>\n </ToggleButton>\n ))}\n </StyledToggleGroup>\n );\n },\n);\n\nToggleGroup.displayName = 'ToggleGroup';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS;AAChB,OAAO,kBAAkB;AACzB,OAAO,uBAAuB;AAC9B,SAAS,OAAO,UAAU,cAAc;AAExC,SAAgB,kBAAkB;AAwIxB,cAkBE,YAlBF;AA9HV,IAAM,eAAe,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-4XK6JQ4D.js";
|
|
4
4
|
import {
|
|
5
5
|
ToggleGroup
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HWQM5D3V.js";
|
|
7
7
|
import {
|
|
8
8
|
FormControl,
|
|
9
9
|
FormLabel,
|
|
@@ -39,4 +39,4 @@ function ToggleField({ name, options, label }) {
|
|
|
39
39
|
export {
|
|
40
40
|
ToggleField
|
|
41
41
|
};
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-RLTYBV4N.js.map
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
import "../chunk-D3OXTS7Y.js";
|
|
6
6
|
import {
|
|
7
7
|
DayRuler
|
|
8
|
-
} from "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
8
|
+
} from "../chunk-HMEGQKNQ.js";
|
|
9
|
+
import "../chunk-ACM3HHZY.js";
|
|
10
|
+
import "../chunk-G2PVUPE7.js";
|
|
11
11
|
import "../chunk-Y3F2F36I.js";
|
|
12
12
|
import "../chunk-K3IB7S7Q.js";
|
|
13
13
|
import "../chunk-YMYJO2CZ.js";
|
package/dist/form/ToggleGroup.js
CHANGED
package/dist/form/total-form.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "../chunk-CPAJYJUD.js";
|
|
10
10
|
import {
|
|
11
11
|
Fields_exports
|
|
12
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-BR3WBTTQ.js";
|
|
13
13
|
import {
|
|
14
14
|
TextField
|
|
15
15
|
} from "../chunk-3IX2TP4I.js";
|
|
@@ -20,7 +20,7 @@ import "../chunk-YGWLMTPB.js";
|
|
|
20
20
|
import {
|
|
21
21
|
CategoryField
|
|
22
22
|
} from "../chunk-NQ6P7O7C.js";
|
|
23
|
-
import "../chunk-
|
|
23
|
+
import "../chunk-RLTYBV4N.js";
|
|
24
24
|
import {
|
|
25
25
|
FormContext,
|
|
26
26
|
useFormContext
|
|
@@ -29,7 +29,7 @@ import "../chunk-II3YNC5S.js";
|
|
|
29
29
|
import "../chunk-NZBEE2PR.js";
|
|
30
30
|
import "../chunk-NKHNUTTY.js";
|
|
31
31
|
import "../chunk-ONMSTW4B.js";
|
|
32
|
-
import "../chunk-
|
|
32
|
+
import "../chunk-HWQM5D3V.js";
|
|
33
33
|
import "../chunk-OQW4OERS.js";
|
|
34
34
|
import "../chunk-6VTOGR36.js";
|
|
35
35
|
import "../chunk-IYC7NPX7.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SxProps, type Theme } from '@mui/material/styles/index.js';
|
|
2
2
|
import type { ScheduleBlockTone } from '../ScheduleGrid/ScheduleGrid.types';
|
|
3
3
|
/** The container narrow rows answer to (container queries, never media queries). */
|
|
4
4
|
/**
|
|
@@ -10,6 +10,11 @@ export declare function rootSx(hasActions: boolean): SxProps<Theme>;
|
|
|
10
10
|
export declare const lineSx: SxProps<Theme>;
|
|
11
11
|
export declare const coverageLabelSx: SxProps<Theme>;
|
|
12
12
|
export declare function coverageSx(hours: number): SxProps<Theme>;
|
|
13
|
+
/**
|
|
14
|
+
* How strongly a staffed hour is filled: the prototype's tonal success step, deeper with each
|
|
15
|
+
* person on the escala (0.18 + 0.09 per person, at most 0.85). An empty hour has none.
|
|
16
|
+
*/
|
|
17
|
+
export declare function coverageStrength(count: number): number;
|
|
13
18
|
export declare function coverageCellSx(count: number): SxProps<Theme>;
|
|
14
19
|
export declare const axisSx: SxProps<Theme>;
|
|
15
20
|
export declare const groupTitleSx: SxProps<Theme>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DayRuler.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/DayRuler/DayRuler.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"DayRuler.styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/data-display/DayRuler/DayRuler.styles.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G;AAED,qEAAqE;AACrE,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;IAAE,QAAQ,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CA4C1H;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CASxD;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAYnD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAW1D;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAUlD;AAED,eAAO,MAAM,eAAe,EAAE,OAAO,CAAC,KAAK,CAKzC,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,KAAK,CAMxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToggleGroup.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/ToggleGroup/ToggleGroup.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ToggleGroup.d.ts","sourceRoot":"","sources":["../../../../../src/components/form/ToggleGroup/ToggleGroup.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AA8F5D,eAAO,MAAM,WAAW,sGAmEvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { alpha, type CSSObject, type SxProps, type Theme } from '@mui/material/styles/index.js';
|
|
2
2
|
|
|
3
3
|
import { FIELD_BORDER_WIDTH } from '../../../tokens/field-height.core';
|
|
4
4
|
import { rem, sxRem } from '../../../tokens/relative';
|
|
5
|
-
import { softSignal } from '../../../tokens/surfaces';
|
|
6
5
|
import { actualBarColor, blockToneStyles, breakHatch } from '../ScheduleGrid/schedule-tones';
|
|
7
6
|
import type { ScheduleBlockTone } from '../ScheduleGrid/ScheduleGrid.types';
|
|
8
7
|
import { DAY_RULER_METRICS as M } from './DayRuler.metrics';
|
|
@@ -58,19 +57,35 @@ export function coverageSx(hours: number): SxProps<Theme> {
|
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
59
|
|
|
60
|
+
/**
|
|
61
|
+
* How strongly a staffed hour is filled: the prototype's tonal success step, deeper with each
|
|
62
|
+
* person on the escala (0.18 + 0.09 per person, at most 0.85). An empty hour has none.
|
|
63
|
+
*/
|
|
64
|
+
export function coverageStrength(count: number): number {
|
|
65
|
+
if (count <= 0) return 0;
|
|
66
|
+
return Math.min(0.85, 0.18 + count * 0.09);
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
export function coverageCellSx(count: number): SxProps<Theme> {
|
|
62
|
-
return (theme: Theme) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
return (theme: Theme) => {
|
|
71
|
+
const strength = coverageStrength(count);
|
|
72
|
+
return {
|
|
73
|
+
display: 'flex',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
justifyContent: 'center',
|
|
76
|
+
fontSize: rem(theme, M.coverage.font),
|
|
77
|
+
borderRadius: rem(theme, M.coverage.radius),
|
|
78
|
+
color: theme.palette.text.primary,
|
|
79
|
+
// A tonal fill, as the prototype's coverage line draws it — never an outline (FUT-3831). It is
|
|
80
|
+
// the success colour over the page, so a staffed hour is LIGHTER than an empty one in dark mode
|
|
81
|
+
// and plainly green in light, where the soft-signal blend read as the empty grey. The hairline
|
|
82
|
+
// stays transparent so a count never shifts its cell.
|
|
83
|
+
backgroundColor: strength > 0 ? alpha(theme.palette.success.main, strength) : theme.palette.action.hover,
|
|
84
|
+
border: '1px solid transparent',
|
|
85
|
+
minWidth: 0,
|
|
86
|
+
overflow: 'hidden',
|
|
87
|
+
};
|
|
88
|
+
};
|
|
74
89
|
}
|
|
75
90
|
|
|
76
91
|
export const axisSx: SxProps<Theme> = (theme: Theme) => ({
|
|
@@ -71,6 +71,34 @@ const StyledToggleGroup = styled(ToggleButtonGroup, {
|
|
|
71
71
|
};
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
+
type Palette = ReturnType<typeof getColorFromTheme>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The chosen option's fill, in every state. MUI's own `.Mui-selected:hover` (and
|
|
78
|
+
* its focus-visible) out-rank a plain `.Mui-selected` rule and paint the chosen
|
|
79
|
+
* option a translucent grey under white text: hovered — as it always is right
|
|
80
|
+
* after a click — or focused, it stopped reading as chosen (FUT-3831). It keeps
|
|
81
|
+
* its colour's fill, the darker step on hover, and keyboard focus adds a ring,
|
|
82
|
+
* never a new fill.
|
|
83
|
+
*/
|
|
84
|
+
function selectedSx(theme: Theme, palette: Palette, gradient: boolean) {
|
|
85
|
+
const ring = rem(theme, FIELD_BORDER_WIDTH * 2);
|
|
86
|
+
return {
|
|
87
|
+
'&.Mui-selected': {
|
|
88
|
+
backgroundColor: palette.main,
|
|
89
|
+
color: palette.contrastText,
|
|
90
|
+
...(gradient && { background: `linear-gradient(135deg, ${palette.main}, ${palette.dark})` }),
|
|
91
|
+
},
|
|
92
|
+
'&.Mui-selected:hover': {
|
|
93
|
+
backgroundColor: palette.dark,
|
|
94
|
+
color: palette.contrastText,
|
|
95
|
+
...(gradient && { background: `linear-gradient(135deg, ${palette.dark}, ${palette.dark})` }),
|
|
96
|
+
},
|
|
97
|
+
'&.Mui-selected.Mui-focusVisible': { backgroundColor: palette.main, color: palette.contrastText },
|
|
98
|
+
'&.Mui-focusVisible': { outline: `${ring} solid ${palette.main}`, outlineOffset: ring },
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
|
|
74
102
|
export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
75
103
|
(
|
|
76
104
|
{
|
|
@@ -126,14 +154,7 @@ export const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(
|
|
|
126
154
|
paddingTop: 0,
|
|
127
155
|
paddingBottom: 0,
|
|
128
156
|
|
|
129
|
-
|
|
130
|
-
backgroundColor: colorPalette.main,
|
|
131
|
-
color: colorPalette.contrastText,
|
|
132
|
-
|
|
133
|
-
...(gradient && {
|
|
134
|
-
background: `linear-gradient(135deg, ${colorPalette.main}, ${colorPalette.dark})`,
|
|
135
|
-
}),
|
|
136
|
-
},
|
|
157
|
+
...selectedSx(theme, colorPalette, gradient),
|
|
137
158
|
}}
|
|
138
159
|
>
|
|
139
160
|
<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/DayRuler/DayRuler.styles.ts"],"sourcesContent":["import type { CSSObject, SxProps, Theme } from '@mui/material/styles/index.js';\n\nimport { FIELD_BORDER_WIDTH } from '../../../tokens/field-height.core';\nimport { rem, sxRem } from '../../../tokens/relative';\nimport { softSignal } from '../../../tokens/surfaces';\nimport { actualBarColor, blockToneStyles, breakHatch } from '../ScheduleGrid/schedule-tones';\nimport type { ScheduleBlockTone } from '../ScheduleGrid/ScheduleGrid.types';\nimport { DAY_RULER_METRICS as M } from './DayRuler.metrics';\n\n/** The container narrow rows answer to (container queries, never media queries). */\n/**\n * `--dr-actions`: the actions column, 220px when any row has actions and\n * nothing when none does (no empty column at the end of every row).\n */\nexport function rootSx(hasActions: boolean): SxProps<Theme> {\n return (theme: Theme) => ({\n containerType: 'inline-size',\n minWidth: 0,\n width: '100%',\n userSelect: 'none',\n '--dr-actions': hasActions ? rem(theme, M.sideColumn) : '0%',\n });\n}\n\n/** `@container` below which a row stacks (the coverage and axis rows go full width). Bounds are \"from px up\". */\nfunction compact(theme: Theme): string {\n return `@container (width < ${rem(theme, M.compactBelow)})`;\n}\n\n/** `@container` below which the pane is phone-sized: no coverage row, no axis. Bounds are \"from px up\". */\nfunction phone(theme: Theme): string {\n return `@container (width < ${rem(theme, M.phoneBelow)})`;\n}\n\n/** Name · track · actions, the coverage row and the axis row share these columns on a computer. */\nexport const lineSx: SxProps<Theme> = (theme: Theme) => ({\n display: 'grid',\n gridTemplateColumns: `${rem(theme, M.sideColumn)} minmax(0, 1fr) var(--dr-actions)`,\n columnGap: rem(theme, M.gap),\n alignItems: 'center',\n // Stacked: across the full width, like the tracks; the label above the counts.\n [compact(theme)]: {\n gridTemplateColumns: 'minmax(0, 1fr)',\n rowGap: rem(theme, M.coverage.gap),\n '& > span:empty': { display: 'none' },\n },\n [phone(theme)]: { display: 'none' },\n});\n\nexport const coverageLabelSx: SxProps<Theme> = { fontSize: sxRem(M.meta), color: 'text.secondary' };\n\nexport function coverageSx(hours: number): SxProps<Theme> {\n return (theme: Theme) => ({\n display: 'grid',\n gridTemplateColumns: `repeat(${hours}, minmax(0, 1fr))`,\n gap: rem(theme, M.coverage.gap),\n height: rem(theme, M.coverage.height),\n });\n}\n\nexport function coverageCellSx(count: number): SxProps<Theme> {\n return (theme: Theme) => ({\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontSize: rem(theme, M.coverage.font),\n borderRadius: rem(theme, M.coverage.radius),\n color: theme.palette.text.primary,\n backgroundColor: count > 0 ? softSignal(theme, 'success') : theme.palette.action.hover,\n border: count > 0 ? `1px solid ${theme.palette.success.main}` : '1px solid transparent',\n minWidth: 0,\n overflow: 'hidden',\n });\n}\n\nexport const axisSx: SxProps<Theme> = (theme: Theme) => ({\n position: 'relative',\n height: rem(theme, M.axis.height),\n fontSize: rem(theme, M.axis.font),\n color: theme.palette.text.secondary,\n mt: 0.5,\n '& > span': { position: 'absolute', transform: 'translateX(-50%)', whiteSpace: 'nowrap' },\n});\n\nexport const groupTitleSx: SxProps<Theme> = {\n fontSize: sxRem(M.groupTitle),\n letterSpacing: '0.05em',\n textTransform: 'uppercase',\n color: 'text.secondary',\n fontWeight: 500,\n pt: 1.5,\n pb: 0.5,\n m: 0,\n};\n\n/**\n * One person's row. A computer: name · track · actions on one line. A narrow\n * ruler (a phone): name and actions on top, the track under them, full width.\n */\nexport const rowSx: SxProps<Theme> = (theme: Theme) => ({\n display: 'grid',\n gridTemplateColumns: `${rem(theme, M.sideColumn)} minmax(0, 1fr) var(--dr-actions)`,\n gridTemplateAreas: '\"who track actions\"',\n columnGap: rem(theme, M.gap),\n alignItems: 'center',\n py: rem(theme, M.rowPaddingY),\n borderBottom: `1px solid ${theme.palette.divider}`,\n [compact(theme)]: {\n gridTemplateColumns: 'minmax(0, 1fr) auto',\n gridTemplateAreas: '\"who actions\" \"track track\"',\n rowGap: theme.spacing(1),\n py: theme.spacing(1.5),\n },\n});\n\nexport const whoSx: SxProps<Theme> = { gridArea: 'who', minWidth: 0 };\n\nexport const actionsSx: SxProps<Theme> = {\n gridArea: 'actions',\n display: 'flex',\n gap: 1,\n alignItems: 'center',\n justifyContent: 'flex-end',\n flexWrap: 'wrap',\n minWidth: 0,\n};\n\n/** A break inside a block: a hatched band across its height, under its text. `span` is in % of the block. */\nexport function breakSx(span: Span): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: `${span.at}%`,\n width: `${span.share}%`,\n background: breakHatch(theme, rem(theme, M.breakStripe.ink), rem(theme, M.breakStripe.ink + M.breakStripe.gap)),\n pointerEvents: 'none',\n // Where the band meets an end of the block it takes the block's rounding:\n // on a phone the block does not clip (its hit area reaches past it).\n ...(span.at <= 0.01 ? { borderTopLeftRadius: 'inherit', borderBottomLeftRadius: 'inherit' } : {}),\n ...(span.at + span.share >= 99.99 ? { borderTopRightRadius: 'inherit', borderBottomRightRadius: 'inherit' } : {}),\n });\n}\n\n/** The hour lines: one every `every` hours of a `hours`-long ruler. */\nfunction hourLines(theme: Theme, hours: number, every: number): string {\n const line = theme.palette.divider;\n const step = `${(100 * every) / hours}%`;\n const hairline = `${FIELD_BORDER_WIDTH}px`;\n return `repeating-linear-gradient(to right, ${line} 0, ${line} ${hairline}, transparent ${hairline}, transparent ${step})`;\n}\n\nexport function trackSx(opts: { hours: number; tickHours: number; interactive: boolean }): SxProps<Theme> {\n return (theme: Theme) => ({\n gridArea: 'track',\n position: 'relative',\n height: rem(theme, M.track.height),\n borderRadius: rem(theme, M.track.radius),\n backgroundColor: theme.palette.action.hover,\n backgroundImage: hourLines(theme, opts.hours, 1),\n cursor: opts.interactive ? 'crosshair' : 'default',\n touchAction: 'auto',\n outline: 'none',\n '&:focus-visible': { boxShadow: `0 0 0 ${rem(theme, M.ring)} ${theme.palette.primary.main}` },\n [compact(theme)]: {\n height: rem(theme, M.track.compactHeight),\n borderRadius: rem(theme, M.track.compactRadius),\n backgroundImage: hourLines(theme, opts.hours, opts.tickHours),\n },\n });\n}\n\n/** Where a bar starts and how long it is, both in % of the track. */\nexport interface Span {\n at: number;\n share: number;\n}\n\nexport function blockSx(tone: ScheduleBlockTone, span: Span, opts: { selected: boolean; movable: boolean }): SxProps<Theme> {\n return (theme: Theme): CSSObject => ({\n ...blockToneStyles(theme, tone, true),\n position: 'absolute',\n left: `${span.at}%`,\n width: `${span.share}%`,\n top: rem(theme, M.block.top),\n height: rem(theme, M.block.height),\n boxSizing: 'border-box',\n borderRadius: rem(theme, M.block.radius),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: `0 ${rem(theme, M.block.paddingX)}`,\n margin: 0,\n font: 'inherit',\n fontSize: rem(theme, M.block.font),\n fontWeight: 500,\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n cursor: opts.movable ? 'grab' : 'pointer',\n boxShadow: opts.selected ? `0 0 0 ${rem(theme, M.ring)} ${theme.palette.primary.main}` : 'none',\n '&:focus-visible': { outline: `${rem(theme, M.ring)} solid ${theme.palette.primary.main}`, outlineOffset: rem(theme, M.ringOffset) },\n '& [data-dr-text]': { position: 'relative', overflow: 'hidden', textOverflow: 'ellipsis', minWidth: 0 },\n '& [data-dr-text=\"short\"]': { display: 'none' },\n [compact(theme)]: {\n top: rem(theme, M.block.compactTop),\n height: rem(theme, M.block.compactHeight),\n // A 40px hit area around the 20px bar, the look unchanged: the text cuts\n // itself (its spans ellipsize), so the block need not clip.\n overflow: 'visible',\n '&::after': {\n content: '\"\"',\n position: 'absolute',\n left: 0,\n right: 0,\n top: '50%',\n height: rem(theme, M.block.hitArea),\n transform: 'translateY(-50%)',\n },\n '&[data-narrow] [data-dr-text=\"full\"]': { display: 'none' },\n '&[data-narrow] [data-dr-text=\"short\"]': { display: 'inline' },\n },\n });\n}\n\nexport function handleSx(side: 'l' | 'r'): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n top: 0,\n bottom: 0,\n [side === 'l' ? 'left' : 'right']: 0,\n width: rem(theme, M.handle),\n cursor: 'ew-resize',\n });\n}\n\nexport function actualSx(span: Span): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n left: `${span.at}%`,\n width: `${span.share}%`,\n top: rem(theme, M.actual.top),\n height: rem(theme, M.actual.height),\n borderRadius: rem(theme, M.actual.radius),\n backgroundColor: actualBarColor(theme),\n pointerEvents: 'none',\n [compact(theme)]: { top: rem(theme, M.actual.compactTop), height: rem(theme, M.actual.compactHeight) },\n });\n}\n\nexport function actualLabelSx(left: number): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n left: `calc(${left}% + ${rem(theme, M.actualLabel.offset)})`,\n top: rem(theme, M.actualLabel.top),\n fontSize: rem(theme, M.actualLabel.font),\n color: theme.palette.text.secondary,\n whiteSpace: 'nowrap',\n pointerEvents: 'none',\n [compact(theme)]: { display: 'none' },\n });\n}\n\nexport function nowSx(left: number): SxProps<Theme> {\n return (theme: Theme) => ({\n position: 'absolute',\n left: `${left}%`,\n top: rem(theme, -M.now.overhang),\n bottom: rem(theme, -M.now.overhang),\n width: rem(theme, M.now.width),\n backgroundColor: theme.palette.primary.main,\n pointerEvents: 'none',\n });\n}\n\nexport const skeletonTrackSx: SxProps<Theme> = (theme: Theme) => ({\n gridArea: 'track',\n height: rem(theme, M.track.height),\n borderRadius: rem(theme, M.track.radius),\n backgroundColor: theme.palette.action.hover,\n});\n\nexport const skeletonNameSx: SxProps<Theme> = (theme: Theme) => ({\n gridArea: 'who',\n height: rem(theme, M.name),\n width: '60%',\n borderRadius: rem(theme, M.skeletonNameRadius),\n backgroundColor: theme.palette.action.hover,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAcO,SAAS,OAAO,YAAqC;AAC1D,SAAO,CAAC,WAAkB;AAAA,IACxB,eAAe;AAAA,IACf,UAAU;AAAA,IACV,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,gBAAgB,aAAa,IAAI,OAAO,kBAAE,UAAU,IAAI;AAAA,EAC1D;AACF;AAGA,SAAS,QAAQ,OAAsB;AACrC,SAAO,uBAAuB,IAAI,OAAO,kBAAE,YAAY,CAAC;AAC1D;AAGA,SAAS,MAAM,OAAsB;AACnC,SAAO,uBAAuB,IAAI,OAAO,kBAAE,UAAU,CAAC;AACxD;AAGO,IAAM,SAAyB,CAAC,WAAkB;AAAA,EACvD,SAAS;AAAA,EACT,qBAAqB,GAAG,IAAI,OAAO,kBAAE,UAAU,CAAC;AAAA,EAChD,WAAW,IAAI,OAAO,kBAAE,GAAG;AAAA,EAC3B,YAAY;AAAA;AAAA,EAEZ,CAAC,QAAQ,KAAK,CAAC,GAAG;AAAA,IAChB,qBAAqB;AAAA,I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AAA,IACb,KAAK,IAAI,OAAO,CAAC,kBAAE,IAAI,QAAQ;AAAA,IAC/B,QAAQ,IAAI,OAAO,CAAC,kBAAE,IAAI,QAAQ;AAAA,IAClC,OAAO,IAAI,OAAO,kBAAE,IAAI,KAAK;AAAA,IAC7B,iBAAiB,MAAM,QAAQ,QAAQ;AAAA,IACvC,eAAe;AAAA,EACjB;AACF;AAEO,IAAM,kBAAkC,CAAC,WAAkB;AAAA,EAChE,UAAU;AAAA,EACV,QAAQ,IAAI,OAAO,kBAAE,MAAM,MAAM;AAAA,EACjC,cAAc,IAAI,OAAO,kBAAE,MAAM,MAAM;AAAA,EACvC,iBAAiB,MAAM,QAAQ,OAAO;AACxC;AAEO,IAAM,iBAAiC,CAAC,WAAkB;AAAA,EAC/D,UAAU;AAAA,EACV,QAAQ,IAAI,OAAO,kBAAE,IAAI;AAAA,EACzB,OAAO;AAAA,EACP,cAAc,IAAI,OAAO,kBAAE,kBAAkB;AAAA,EAC7C,iBAAiB,MAAM,QAAQ,OAAO;AACxC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/form/ToggleGroup/ToggleGroup.tsx"],"sourcesContent":["import Box from '@mui/material/Box/index.js';\nimport ToggleButton from '@mui/material/ToggleButton/index.js';\nimport ToggleButtonGroup from '@mui/material/ToggleButtonGroup/index.js';\nimport { alpha, useTheme, styled } from '@mui/material/styles/index.js';\nimport type { Theme } from '@mui/material/styles/index.js';\nimport React, { forwardRef } from 'react';\n\nimport type { ToggleGroupProps } from './ToggleGroup.types';\nimport { asFieldSize, FIELD_BORDER_WIDTH, fieldHeight } from '../../../tokens/field-height';\nimport { fieldRadius } from '../../../tokens/field-radius';\nimport { controlNeutral } from '../../../tokens/ink';\nimport { rem, remPx, rems } from '../../../tokens/relative';\nimport { cssLengthToPx } from '../../../tokens/css-units';\n\n/** The glass frame's padding (4px at the design scale); its border is the field hairline. */\nconst glassPadding = (theme: Theme): string => rem(theme, 4);\n\nconst getColorFromTheme = (theme: Theme, color: string) => {\n if (color === 'neutral') {\n const neutral = controlNeutral(theme);\n return { ...neutral, contrastText: theme.palette.getContrastText(neutral.main) };\n }\n\n const colorMap = {\n primary: theme.palette.primary,\n secondary: theme.palette.secondary,\n success: theme.palette.success,\n warning: theme.palette.warning,\n info: theme.palette.info,\n danger: theme.palette.error,\n };\n\n const palette = colorMap[color as keyof typeof colorMap] || theme.palette.primary;\n\n // Ensure palette has required properties\n return {\n main: palette.main,\n dark: palette.dark || palette.main,\n light: palette.light || palette.main,\n contrastText: palette.contrastText || theme.palette.getContrastText(palette.main),\n };\n};\n\n/** The glass frame's radius: the field radius plus its padding, the buttons' margin and its border. */\nconst glassFrameRadius = (theme: Theme): number =>\n fieldRadius(theme) + remPx(theme, 4) + cssLengthToPx(theme.spacing(0.5), 4) + FIELD_BORDER_WIDTH;\n\nconst StyledToggleGroup = styled(ToggleButtonGroup, {\n shouldForwardProp: (prop) => !['customColor', 'customSize', 'glass'].includes(prop as string),\n})<{\n customColor?: string;\n customSize?: string;\n glass?: boolean;\n}>(({ theme, glass }) => {\n // Each button is the field, so it takes the field radius. The glass frame\n // around them is inset by its padding, the buttons' margin and its border,\n // and rounds by that much more so the two corners stay concentric.\n const radius = fieldRadius(theme);\n return {\n backgroundColor: glass ? alpha(theme.palette.background.paper, 0.1) : 'transparent',\n backdropFilter: glass ? `blur(${rem(theme, 20)})` : 'none',\n borderRadius: glass ? glassFrameRadius(theme) : radius,\n padding: glass ? glassPadding(theme) : 0,\n border: glass ? `${FIELD_BORDER_WIDTH}px solid ${alpha(theme.palette.divider, 0.2)}` : 'none',\n\n '& .MuiToggleButtonGroup-grouped': {\n margin: theme.spacing(0.5),\n border: 0,\n borderRadius: `${radius}px !important`,\n },\n };\n});\n\nexport const ToggleGroup = forwardRef<HTMLDivElement, ToggleGroupProps>(\n (\n {\n variant = 'single',\n color = 'primary',\n size = 'md',\n options,\n glass = false,\n gradient = false,\n value,\n onChange,\n dataTestId = 'toggle-group',\n ...props\n },\n ref,\n ) => {\n const theme = useTheme();\n const colorPalette = getColorFromTheme(theme, color);\n\n const sizeMap = {\n xs: { padding: rems(theme, 4, 8), fontSize: rem(theme, 12) },\n sm: { padding: rems(theme, 6, 12), fontSize: rem(theme, 14) },\n md: { padding: rems(theme, 8, 16), fontSize: rem(theme, 16) },\n lg: { padding: rems(theme, 10, 20), fontSize: rem(theme, 18) },\n xl: { padding: rems(theme, 12, 24), fontSize: rem(theme, 20) },\n };\n\n return (\n <StyledToggleGroup\n ref={ref}\n customColor={color}\n customSize={size}\n glass={glass}\n value={value}\n onChange={onChange}\n exclusive={variant === 'exclusive' || variant === 'single'}\n data-testid={dataTestId}\n {...props}\n >\n {options.map((option) => (\n <ToggleButton\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n data-testid={`${dataTestId}-item-${option.value}`}\n sx={{\n textTransform: 'none',\n fontWeight: 500,\n transition: 'all 0.3s ease',\n ...sizeMap[size as keyof typeof sizeMap],\n // The theme's field height for the size; the label centres in it.\n minHeight: (theme) => fieldHeight(theme, asFieldSize(size)),\n paddingTop: 0,\n paddingBottom: 0,\n\n '&.Mui-selected': {\n backgroundColor: colorPalette.main,\n color: colorPalette.contrastText,\n\n ...(gradient && {\n background: `linear-gradient(135deg, ${colorPalette.main}, ${colorPalette.dark})`,\n }),\n },\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n {option.icon}\n {option.label}\n </Box>\n </ToggleButton>\n ))}\n </StyledToggleGroup>\n );\n },\n);\n\nToggleGroup.displayName = 'ToggleGroup';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS;AAChB,OAAO,kBAAkB;AACzB,OAAO,uBAAuB;AAC9B,SAAS,OAAO,UAAU,cAAc;AAExC,SAAgB,kBAAkB;AA4GxB,cAyBE,YAzBF;AAlGV,IAAM,eAAe,CAAC,UAAyB,IAAI,OAAO,CAAC;AAE3D,IAAM,oBAAoB,CAAC,O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