@12-apps/ui 6.24.3 → 6.24.5
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/CardKit/row-actions-to-menu.js +1 -1
- package/dist/_internal/components/data-display/DataViews/DataViewsGrid.js +5 -5
- package/dist/_internal/components/data-display/DataViews/DataViewsTableBase.js +6 -6
- package/dist/_internal/components/data-display/DataViews/data-views-category-pill.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-filter-panel.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-grid-parts.js +4 -4
- package/dist/_internal/components/data-display/DataViews/data-views-inline-bar.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-more-fields.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-more-filters.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-shell-toolbar.js +3 -3
- package/dist/_internal/components/data-display/DataViews/data-views-table-parts.js +1 -1
- package/dist/_internal/components/data-display/DataViews/data-views-toolbar.js +2 -2
- package/dist/_internal/components/index.js +2 -2
- package/dist/_internal/components/layout/ContentToolbar/ContentToolbar.js +1 -1
- package/dist/_internal/components/layout/index.js +1 -1
- package/dist/_internal/components/navigation/AppHeader/AppHeader.identity.js +1 -1
- package/dist/_internal/components/navigation/index.js +1 -1
- package/dist/{chunk-JD4IVP22.js → chunk-4ZV7N5CU.js} +2 -2
- package/dist/{chunk-QX2PLXQA.js → chunk-53PDVLRK.js} +2 -2
- package/dist/{chunk-7GKRZJWI.js → chunk-EMMPNB6D.js} +2 -2
- package/dist/{chunk-TSPHRZ4U.js → chunk-L2E7TY7P.js} +76 -36
- package/dist/chunk-L2E7TY7P.js.map +1 -0
- package/dist/{chunk-NXNNICH7.js → chunk-LWRMKF7D.js} +2 -2
- package/dist/{chunk-W2YNUUVJ.js → chunk-TU6RNZUQ.js} +117 -78
- package/dist/chunk-TU6RNZUQ.js.map +1 -0
- package/dist/{chunk-5MXVT7DO.js → chunk-ZBXG6RVJ.js} +2 -2
- package/dist/chunk-ZBXG6RVJ.js.map +1 -0
- package/dist/{chunk-JPV45AD6.js → chunk-ZXOT3U6U.js} +2 -2
- package/dist/data-display/CardKit.js +1 -1
- package/dist/data-display/DataViews.js +6 -6
- package/dist/layout/ContentToolbar.js +1 -1
- package/dist/navigation/AppHeader.js +1 -1
- package/dist/types/components/data-display/CardKit/row-actions-to-menu.d.ts +18 -2
- package/dist/types/components/data-display/CardKit/row-actions-to-menu.d.ts.map +1 -1
- package/dist/types/components/layout/ContentToolbar/ContentToolbar.d.ts.map +1 -1
- package/dist/types/components/navigation/AppHeader/AppHeader.identity.d.ts +12 -5
- package/dist/types/components/navigation/AppHeader/AppHeader.identity.d.ts.map +1 -1
- package/dist/types/components/navigation/AppHeader/AppHeader.types.d.ts +12 -4
- package/dist/types/components/navigation/AppHeader/AppHeader.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/data-display/CardKit/row-actions-to-menu.ts +19 -2
- package/src/components/data-display/DataViews/RESPONSIVE-BEHAVIOUR.md +43 -0
- package/src/components/layout/ContentToolbar/ContentToolbar.tsx +82 -26
- package/src/components/navigation/AppHeader/AppHeader.identity.tsx +159 -86
- package/src/components/navigation/AppHeader/AppHeader.md +12 -5
- package/src/components/navigation/AppHeader/AppHeader.types.ts +12 -4
- package/dist/chunk-5MXVT7DO.js.map +0 -1
- package/dist/chunk-TSPHRZ4U.js.map +0 -1
- package/dist/chunk-W2YNUUVJ.js.map +0 -1
- /package/dist/{chunk-JD4IVP22.js.map → chunk-4ZV7N5CU.js.map} +0 -0
- /package/dist/{chunk-QX2PLXQA.js.map → chunk-53PDVLRK.js.map} +0 -0
- /package/dist/{chunk-7GKRZJWI.js.map → chunk-EMMPNB6D.js.map} +0 -0
- /package/dist/{chunk-NXNNICH7.js.map → chunk-LWRMKF7D.js.map} +0 -0
- /package/dist/{chunk-JPV45AD6.js.map → chunk-ZXOT3U6U.js.map} +0 -0
|
@@ -60,11 +60,24 @@ function SelectionCluster({
|
|
|
60
60
|
sx={{
|
|
61
61
|
display: 'flex',
|
|
62
62
|
minWidth: 0,
|
|
63
|
-
//
|
|
64
|
-
// (no orphaned selection row). Desktop: grow to push
|
|
65
|
-
|
|
63
|
+
// Browsing (mobile): don't grow, so the controls sit on the SAME line as
|
|
64
|
+
// the checkbox (no orphaned selection row). Desktop: grow to push
|
|
65
|
+
// controls right.
|
|
66
|
+
//
|
|
67
|
+
// SELECTING (mobile) it must be able to shrink instead. Its children are
|
|
68
|
+
// all `flex-shrink: 0`, so a cluster pinned at content width cannot wrap
|
|
69
|
+
// and the row painted past the toolbar's own edge — on Produtos at 390px
|
|
70
|
+
// that took "Ações" off-screen behind a sideways scroll, which is the
|
|
71
|
+
// one control the selection exists to reach.
|
|
72
|
+
flex: { xs: hasSelection ? '1 1 auto' : '0 0 auto', md: 1 },
|
|
66
73
|
alignItems: 'center',
|
|
67
|
-
|
|
74
|
+
// Wrapping is the phone's answer, and only the phone's: below `md` the
|
|
75
|
+
// cluster carries the count, the scope control and "Ações" at once, and
|
|
76
|
+
// no combination of those fits 320px on one line. From `md` up it stays
|
|
77
|
+
// a single line, where it always fitted.
|
|
78
|
+
flexWrap: { xs: 'wrap', md: 'nowrap' },
|
|
79
|
+
columnGap: 1.5,
|
|
80
|
+
rowGap: 1,
|
|
68
81
|
ml: edgeAlign ? -1.5 : 0,
|
|
69
82
|
}}
|
|
70
83
|
>
|
|
@@ -89,32 +102,75 @@ function SelectionCluster({
|
|
|
89
102
|
sx={{ p: 0.5, display: { xs: 'inline-flex', md: 'none' } }}
|
|
90
103
|
/>
|
|
91
104
|
{hasSelection ? (
|
|
105
|
+
<SelectionState
|
|
106
|
+
selectedCount={selectedCount}
|
|
107
|
+
clearSelection={clearSelection}
|
|
108
|
+
clearAllTestId={clearAllTestId}
|
|
109
|
+
clearAllText={clearAllText}
|
|
110
|
+
selectionExtra={selectionExtra}
|
|
111
|
+
/>
|
|
112
|
+
) : null}
|
|
113
|
+
{actionsSlot}
|
|
114
|
+
</Box>
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* What the cluster shows once something IS ticked: Clear All, the count, and
|
|
120
|
+
* the host's own `selectionExtra`.
|
|
121
|
+
*
|
|
122
|
+
* Its own component only because the cluster around it is at the complexity
|
|
123
|
+
* gate's line ceiling — but the split falls where the meaning does. Everything
|
|
124
|
+
* here exists only while a selection does, and the `actions` slot deliberately
|
|
125
|
+
* stays OUTSIDE it: a toolbar may carry actions while browsing too.
|
|
126
|
+
*/
|
|
127
|
+
function SelectionState({
|
|
128
|
+
selectedCount,
|
|
129
|
+
clearSelection,
|
|
130
|
+
clearAllTestId,
|
|
131
|
+
clearAllText,
|
|
132
|
+
selectionExtra,
|
|
133
|
+
}: Pick<
|
|
134
|
+
ContentToolbarProps,
|
|
135
|
+
'selectedCount' | 'clearSelection' | 'clearAllTestId' | 'clearAllText' | 'selectionExtra'
|
|
136
|
+
>): React.JSX.Element {
|
|
137
|
+
return (
|
|
138
|
+
<>
|
|
139
|
+
<Button
|
|
140
|
+
variant="text"
|
|
141
|
+
size="small"
|
|
142
|
+
color="inherit"
|
|
143
|
+
onClick={clearSelection}
|
|
144
|
+
data-testid={clearAllTestId}
|
|
145
|
+
sx={selectionButtonSx}
|
|
146
|
+
>
|
|
147
|
+
{clearAllText}
|
|
148
|
+
</Button>
|
|
149
|
+
<Divider orientation="vertical" flexItem sx={{ height: 16, alignSelf: 'center' }} />
|
|
150
|
+
<Typography
|
|
151
|
+
component="span"
|
|
152
|
+
data-testid="selected-count-indicator"
|
|
153
|
+
sx={{ fontSize: '0.875rem', color: 'text.secondary', whiteSpace: 'nowrap', flexShrink: 0 }}
|
|
154
|
+
>
|
|
155
|
+
{selectedCount} {selectedCount === 1 ? 'item' : 'items'} selected
|
|
156
|
+
</Typography>
|
|
157
|
+
{selectionExtra !== undefined && (
|
|
92
158
|
<>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<Typography
|
|
105
|
-
component="span"
|
|
106
|
-
data-testid="selected-count-indicator"
|
|
107
|
-
sx={{ fontSize: '0.875rem', color: 'text.secondary', whiteSpace: 'nowrap', flexShrink: 0 }}
|
|
108
|
-
>
|
|
109
|
-
{selectedCount} {selectedCount === 1 ? 'item' : 'items'} selected
|
|
110
|
-
</Typography>
|
|
159
|
+
{/* A DELIBERATE break, not a wrap that happened to land here. What
|
|
160
|
+
follows — "Seleção: 48 produtos — todas as páginas", its "Limpar
|
|
161
|
+
seleção", and "Ações" — is a sentence about the selection plus the
|
|
162
|
+
control that acts on it, and letting the phone break it wherever it
|
|
163
|
+
ran out of room split that sentence mid-phrase. Zero height so it
|
|
164
|
+
costs nothing but the row gap, and `display:none` from `md` up,
|
|
165
|
+
where the line still fits. */}
|
|
166
|
+
<Box
|
|
167
|
+
aria-hidden
|
|
168
|
+
sx={{ flexBasis: '100%', height: 0, display: { xs: 'block', md: 'none' } }}
|
|
169
|
+
/>
|
|
111
170
|
{selectionExtra}
|
|
112
|
-
{actionsSlot}
|
|
113
171
|
</>
|
|
114
|
-
) : (
|
|
115
|
-
actionsSlot
|
|
116
172
|
)}
|
|
117
|
-
|
|
173
|
+
</>
|
|
118
174
|
);
|
|
119
175
|
}
|
|
120
176
|
|
|
@@ -87,46 +87,146 @@ export const AppHeaderStatus: React.FC<AppHeaderStatusProps> = ({
|
|
|
87
87
|
|
|
88
88
|
AppHeaderStatus.displayName = 'AppHeaderStatus';
|
|
89
89
|
|
|
90
|
-
/**
|
|
91
|
-
const
|
|
92
|
-
Pick<AppHeaderIdentityProps, 'title' | '
|
|
90
|
+
/** The name and, when the block opens onto something, the chevron beside it. */
|
|
91
|
+
const IdentityTitle: React.FC<
|
|
92
|
+
Pick<AppHeaderIdentityProps, 'title' | 'size'> & {
|
|
93
93
|
interactive: boolean;
|
|
94
94
|
disclosed: boolean;
|
|
95
95
|
dataTestId: string;
|
|
96
96
|
}
|
|
97
|
-
> = ({ title,
|
|
98
|
-
<Box sx={{
|
|
99
|
-
<
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
/>
|
|
119
|
-
)}
|
|
120
|
-
</Box>
|
|
121
|
-
{subtitle && (
|
|
122
|
-
<Typography variant="body2" color="text.secondary" component="span" sx={ONE_LINE}>
|
|
123
|
-
{subtitle}
|
|
124
|
-
</Typography>
|
|
97
|
+
> = ({ title, size = 'md', interactive, disclosed, dataTestId }) => (
|
|
98
|
+
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.25, minWidth: 0, width: '100%' }}>
|
|
99
|
+
<Typography
|
|
100
|
+
component="span"
|
|
101
|
+
data-testid={`${dataTestId}-title`}
|
|
102
|
+
sx={{ fontSize: TITLE_PX[size], fontWeight: 700, lineHeight: 1.2, ...ONE_LINE }}
|
|
103
|
+
>
|
|
104
|
+
{title}
|
|
105
|
+
</Typography>
|
|
106
|
+
{interactive && (
|
|
107
|
+
<KeyboardArrowDown
|
|
108
|
+
aria-hidden
|
|
109
|
+
data-testid={`${dataTestId}-chevron`}
|
|
110
|
+
sx={{
|
|
111
|
+
flex: '0 0 auto',
|
|
112
|
+
fontSize: 20,
|
|
113
|
+
opacity: 0.7,
|
|
114
|
+
transition: 'transform 150ms ease',
|
|
115
|
+
transform: disclosed ? 'rotate(180deg)' : 'none',
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
125
118
|
)}
|
|
126
|
-
{status}
|
|
127
119
|
</Box>
|
|
128
120
|
);
|
|
129
121
|
|
|
122
|
+
/**
|
|
123
|
+
* The disclosure, wrapping the NAME ROW and nothing else (12-63).
|
|
124
|
+
*
|
|
125
|
+
* The padding is cancelled by an equal negative margin, so the hover and the
|
|
126
|
+
* focus ring bleed outward while the title still starts on the same pixel as
|
|
127
|
+
* the lines under it. A padded button with no offset moves one of the two.
|
|
128
|
+
*/
|
|
129
|
+
const discloseSx = {
|
|
130
|
+
display: 'flex',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
gap: 0.25,
|
|
133
|
+
width: '100%',
|
|
134
|
+
minWidth: 0,
|
|
135
|
+
appearance: 'none',
|
|
136
|
+
px: 0.5,
|
|
137
|
+
mx: -0.5,
|
|
138
|
+
py: 0.25,
|
|
139
|
+
my: -0.25,
|
|
140
|
+
border: 'none',
|
|
141
|
+
borderRadius: 1.5,
|
|
142
|
+
background: 'none',
|
|
143
|
+
color: 'inherit',
|
|
144
|
+
font: 'inherit',
|
|
145
|
+
textAlign: 'left',
|
|
146
|
+
cursor: 'pointer',
|
|
147
|
+
// Guarded: on a touch screen an unguarded `:hover` sticks after the tap that
|
|
148
|
+
// opened the panel, so the row stays highlighted behind it.
|
|
149
|
+
'@media (hover: hover)': { '&:hover': { backgroundColor: 'action.hover' } },
|
|
150
|
+
'&:focus-visible': { outline: '2px solid', outlineColor: 'primary.main', outlineOffset: 2 },
|
|
151
|
+
} as const;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The text column: the name row, then the quieter lines under it.
|
|
155
|
+
*
|
|
156
|
+
* ## `subtitle` and `status` are OUTSIDE the disclosure, on purpose (12-63)
|
|
157
|
+
*
|
|
158
|
+
* Both are `ReactNode`, and `AppHeaderStatus.items` is a `ReactNode[]` — so a
|
|
159
|
+
* segment of the state line is free to be a control, and consumers put controls
|
|
160
|
+
* there: a mesa chip, a service-mode picker. While the whole block was one
|
|
161
|
+
* `<button>` those were `<button>`s inside a `<button>`, which is invalid HTML
|
|
162
|
+
* (the content model of `button` excludes interactive content) and, more
|
|
163
|
+
* visibly, means one tap fires two handlers. An adopting storefront opened two
|
|
164
|
+
* popups on every tap of either control because of it, and had already
|
|
165
|
+
* hand-rolled this component at one tier to dodge the nesting — a consumer
|
|
166
|
+
* working around the component is the report.
|
|
167
|
+
*
|
|
168
|
+
* The target stays large. The button is the full-width NAME ROW, which is the
|
|
169
|
+
* thing a reader aims at — what it gives up is the mark beside it, and a mark
|
|
170
|
+
* that opens the panel is not worth a state line that cannot hold a control.
|
|
171
|
+
*/
|
|
172
|
+
const IdentityText: React.FC<
|
|
173
|
+
Pick<
|
|
174
|
+
AppHeaderIdentityProps,
|
|
175
|
+
'title' | 'subtitle' | 'status' | 'size' | 'discloseLabel' | 'className'
|
|
176
|
+
> & {
|
|
177
|
+
onDisclose: (() => void) | undefined;
|
|
178
|
+
disclosed: boolean;
|
|
179
|
+
dataTestId: string;
|
|
180
|
+
}
|
|
181
|
+
> = ({
|
|
182
|
+
title,
|
|
183
|
+
subtitle,
|
|
184
|
+
status,
|
|
185
|
+
size = 'md',
|
|
186
|
+
onDisclose,
|
|
187
|
+
disclosed,
|
|
188
|
+
discloseLabel,
|
|
189
|
+
className,
|
|
190
|
+
dataTestId,
|
|
191
|
+
}) => {
|
|
192
|
+
const name = (
|
|
193
|
+
<IdentityTitle
|
|
194
|
+
title={title}
|
|
195
|
+
size={size}
|
|
196
|
+
interactive={Boolean(onDisclose)}
|
|
197
|
+
disclosed={disclosed}
|
|
198
|
+
dataTestId={dataTestId}
|
|
199
|
+
/>
|
|
200
|
+
);
|
|
201
|
+
return (
|
|
202
|
+
<Box sx={{ minWidth: 0, flex: 1, display: 'flex', flexDirection: 'column', gap: 0.25 }}>
|
|
203
|
+
{onDisclose ? (
|
|
204
|
+
<Box
|
|
205
|
+
component="button"
|
|
206
|
+
type="button"
|
|
207
|
+
className={className}
|
|
208
|
+
data-testid={dataTestId}
|
|
209
|
+
onClick={onDisclose}
|
|
210
|
+
aria-haspopup="dialog"
|
|
211
|
+
aria-expanded={disclosed}
|
|
212
|
+
aria-label={discloseLabel ?? `Detalhes de ${title}`}
|
|
213
|
+
sx={discloseSx}
|
|
214
|
+
>
|
|
215
|
+
{name}
|
|
216
|
+
</Box>
|
|
217
|
+
) : (
|
|
218
|
+
name
|
|
219
|
+
)}
|
|
220
|
+
{subtitle && (
|
|
221
|
+
<Typography variant="body2" color="text.secondary" component="span" sx={ONE_LINE}>
|
|
222
|
+
{subtitle}
|
|
223
|
+
</Typography>
|
|
224
|
+
)}
|
|
225
|
+
{status}
|
|
226
|
+
</Box>
|
|
227
|
+
);
|
|
228
|
+
};
|
|
229
|
+
|
|
130
230
|
/** The placeholder held while the identity is still resolving. */
|
|
131
231
|
const IdentitySkeleton: React.FC<{ size: SizeValue; dataTestId: string }> = ({
|
|
132
232
|
size,
|
|
@@ -145,16 +245,13 @@ const IdentitySkeleton: React.FC<{ size: SizeValue; dataTestId: string }> = ({
|
|
|
145
245
|
);
|
|
146
246
|
|
|
147
247
|
/**
|
|
148
|
-
*
|
|
248
|
+
* The BLOCK's row: the mark, then the text column beside it.
|
|
149
249
|
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
* had a constraint to ellipsise against, and the title and state line ran
|
|
156
|
-
* straight under the actions — 327px of overlap at 320px wide. Filling the
|
|
157
|
-
* wrapper is what lets `minWidth: 0` bite and the ellipsis engage.
|
|
250
|
+
* Always a `Box` div now — since 12-63 the disclosure is the name row inside
|
|
251
|
+
* the text column ({@link discloseSx}), not this element. `width: '100%'` and
|
|
252
|
+
* `minWidth: 0` stay because the column below still has to ellipsise against
|
|
253
|
+
* something; the argument about a `<button>` sizing to max-content moved to
|
|
254
|
+
* `discloseSx`, which is where the button now is.
|
|
158
255
|
*/
|
|
159
256
|
const rowSx = {
|
|
160
257
|
display: 'flex',
|
|
@@ -166,12 +263,19 @@ const rowSx = {
|
|
|
166
263
|
} as const;
|
|
167
264
|
|
|
168
265
|
/**
|
|
169
|
-
* Mark + title + state line, and — when it can be opened —
|
|
170
|
-
*
|
|
266
|
+
* Mark + title + state line, and — when it can be opened — a name row that is
|
|
267
|
+
* the button.
|
|
171
268
|
*
|
|
172
|
-
* The
|
|
173
|
-
*
|
|
174
|
-
*
|
|
269
|
+
* The disclosure used to wrap EVERYTHING, on the argument that the chevron
|
|
270
|
+
* alone is a 20px target next to a 40px mark that does nothing. The target is
|
|
271
|
+
* still not the chevron: the button is the full-width NAME ROW, which is what a
|
|
272
|
+
* reader aims at. What it no longer swallows is the mark beside it and the
|
|
273
|
+
* quieter lines below — because those lines take `ReactNode`s, consumers put
|
|
274
|
+
* CONTROLS in them, and a control inside a button is invalid HTML whose every
|
|
275
|
+
* tap fires two handlers. See {@link IdentityText} (12-63).
|
|
276
|
+
*
|
|
277
|
+
* `className` and `dataTestId` stay on the same elements they always named: the
|
|
278
|
+
* block when it is static, the disclosure when there is one.
|
|
175
279
|
*/
|
|
176
280
|
export const AppHeaderIdentity: React.FC<AppHeaderIdentityProps> = ({
|
|
177
281
|
title,
|
|
@@ -190,8 +294,12 @@ export const AppHeaderIdentity: React.FC<AppHeaderIdentityProps> = ({
|
|
|
190
294
|
}) => {
|
|
191
295
|
if (loading) return <IdentitySkeleton size={size} dataTestId={dataTestId} />;
|
|
192
296
|
|
|
193
|
-
|
|
194
|
-
|
|
297
|
+
return (
|
|
298
|
+
<Box
|
|
299
|
+
className={onDisclose ? undefined : className}
|
|
300
|
+
data-testid={onDisclose ? undefined : dataTestId}
|
|
301
|
+
sx={rowSx}
|
|
302
|
+
>
|
|
195
303
|
{mark ?? (
|
|
196
304
|
<AppHeaderBrand
|
|
197
305
|
name={title}
|
|
@@ -206,47 +314,12 @@ export const AppHeaderIdentity: React.FC<AppHeaderIdentityProps> = ({
|
|
|
206
314
|
subtitle={subtitle}
|
|
207
315
|
status={status}
|
|
208
316
|
size={size}
|
|
209
|
-
|
|
317
|
+
onDisclose={onDisclose}
|
|
210
318
|
disclosed={disclosed}
|
|
319
|
+
discloseLabel={discloseLabel}
|
|
320
|
+
className={className}
|
|
211
321
|
dataTestId={dataTestId}
|
|
212
322
|
/>
|
|
213
|
-
</>
|
|
214
|
-
);
|
|
215
|
-
|
|
216
|
-
if (!onDisclose) {
|
|
217
|
-
return (
|
|
218
|
-
<Box className={className} data-testid={dataTestId} sx={rowSx}>
|
|
219
|
-
{body}
|
|
220
|
-
</Box>
|
|
221
|
-
);
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return (
|
|
225
|
-
<Box
|
|
226
|
-
component="button"
|
|
227
|
-
type="button"
|
|
228
|
-
className={className}
|
|
229
|
-
data-testid={dataTestId}
|
|
230
|
-
onClick={onDisclose}
|
|
231
|
-
aria-haspopup="dialog"
|
|
232
|
-
aria-expanded={disclosed}
|
|
233
|
-
aria-label={discloseLabel ?? `Detalhes de ${title}`}
|
|
234
|
-
sx={{
|
|
235
|
-
...rowSx,
|
|
236
|
-
appearance: 'none',
|
|
237
|
-
p: 0.5,
|
|
238
|
-
ml: -0.5,
|
|
239
|
-
border: 'none',
|
|
240
|
-
borderRadius: 1.5,
|
|
241
|
-
background: 'none',
|
|
242
|
-
color: 'inherit',
|
|
243
|
-
font: 'inherit',
|
|
244
|
-
cursor: 'pointer',
|
|
245
|
-
'&:hover': { backgroundColor: 'action.hover' },
|
|
246
|
-
'&:focus-visible': { outline: '2px solid', outlineColor: 'primary.main', outlineOffset: 2 },
|
|
247
|
-
}}
|
|
248
|
-
>
|
|
249
|
-
{body}
|
|
250
323
|
</Box>
|
|
251
324
|
);
|
|
252
325
|
};
|
|
@@ -118,11 +118,18 @@ throwing.
|
|
|
118
118
|
|
|
119
119
|
- The mark is `role="img"` labelled with the name, so a screen reader says
|
|
120
120
|
"Future Drink" rather than spelling out "F D".
|
|
121
|
-
- With `onDisclose`, the
|
|
122
|
-
`aria-haspopup="dialog"` and a live `aria-expanded`.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
- With `onDisclose`, the identity's **name row** is a `<button>` with
|
|
122
|
+
`aria-haspopup="dialog"` and a live `aria-expanded`. It is the full-width row,
|
|
123
|
+
chevron included, rather than the chevron alone — on a phone that would be a
|
|
124
|
+
20px target next to a 40px mark that does nothing, and a reader aiming at the
|
|
125
|
+
store's name expects the store's details.
|
|
126
|
+
- **`status` and `subtitle` render OUTSIDE that button, and must** (12-63). Both
|
|
127
|
+
are `ReactNode`, and `AppHeaderStatus.items` is a `ReactNode[]`, so a segment
|
|
128
|
+
of the state line is free to be a control — a mesa chip, a mode picker — and
|
|
129
|
+
consumers do exactly that. The disclosure used to wrap the whole block, which
|
|
130
|
+
made those `<button>`s inside a `<button>`: invalid HTML, and one tap firing
|
|
131
|
+
two handlers. Put controls in the state line freely; put nothing interactive
|
|
132
|
+
in `title`, which is a `string` and belongs to the button.
|
|
126
133
|
- The state line separates its segments with real whitespace, not CSS margin —
|
|
127
134
|
a screen reader reads `textContent`, and a margin-only gap runs "Aberto agora"
|
|
128
135
|
straight into "Retirada no balcão" as one word. The separator glyph itself is
|
|
@@ -62,20 +62,28 @@ export interface AppHeaderStatusProps {
|
|
|
62
62
|
* the consumer's own router in the `leading` slot, whereas an `href` prop would
|
|
63
63
|
* have to guess whose link component it is being handed — `to` for one router,
|
|
64
64
|
* `href` for another — and would half-work for everybody. `onDisclose` is the
|
|
65
|
-
* only interaction the block owns: with it the
|
|
66
|
-
* appears, without it the
|
|
65
|
+
* only interaction the block owns: with it the NAME ROW is a button and a
|
|
66
|
+
* chevron appears, without it the row is static text.
|
|
67
|
+
*
|
|
68
|
+
* The button stops at that row (12-63). `status` and `subtitle` render as its
|
|
69
|
+
* SIBLINGS, so a consumer may put controls in the state line — which they do,
|
|
70
|
+
* and which used to nest a `<button>` inside a `<button>`.
|
|
67
71
|
*/
|
|
68
72
|
export interface AppHeaderIdentityProps
|
|
69
73
|
extends Pick<AppHeaderBrandProps, 'logoUrl' | 'seedColor'> {
|
|
70
74
|
/** The name shown, and the one the mark derives its initials from. */
|
|
71
75
|
title: string;
|
|
72
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* A quieter line under the title — use `status` for the dotted state line.
|
|
78
|
+
*
|
|
79
|
+
* Rendered OUTSIDE the disclosure, like `status`, so it may hold a control.
|
|
80
|
+
*/
|
|
73
81
|
subtitle?: ReactNode;
|
|
74
82
|
/** The state line, usually an {@link AppHeaderStatusProps} element. */
|
|
75
83
|
status?: ReactNode;
|
|
76
84
|
/** Replaces the derived mark entirely (an icon, an `<img>`, nothing). */
|
|
77
85
|
mark?: ReactNode;
|
|
78
|
-
/** Opens the details panel. Renders the
|
|
86
|
+
/** Opens the details panel. Renders the NAME ROW as a button with a chevron. */
|
|
79
87
|
onDisclose?: () => void;
|
|
80
88
|
/** Whether the panel `onDisclose` opens is currently open (`aria-expanded`). */
|
|
81
89
|
disclosed?: boolean;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/data-display/CardKit/row-actions-to-menu.ts"],"sourcesContent":["import type { DropdownMenuItem } from '../../navigation/DropdownMenu';\nimport type { RowAction } from '../DataViews';\n\n/**\n * Adapt a list of {@link RowAction}s into single-row kebab items.\n *\n * Applies each action's `isVisible` guard, resolves its per-row `rowLabel`\n * override, carries its colour, and fires `onSelect([row])` on click.\n *\n * The point is that ONE definition drives both surfaces. An entity that already\n * declares its per-row actions as `RowAction[]` — because the table's multi-\n * select menu needs them — gets the card's kebab from the same array through\n * `renderRowMenu` / `renderCard`, with no second list to keep in step. Two\n * lists is how a \"Duplicar\" that appears in the table and not on the card\n * happens, and nothing reports it.\n */\nexport function rowActionsToMenuItems<T extends Record<string, unknown>>(\n actions: RowAction<T>[],\n row: T,\n): DropdownMenuItem[] {\n return actions\n .filter((action) => action.isVisible?.(row) ?? true)\n .map((action) => ({\n id: action.id,\n label: action.rowLabel?.(row) ?? action.label,\n color: action.color,\n onClick: () => void action.onSelect([row]),\n }));\n}\n"],"mappings":";AAgBO,SAAS,sBACd,SACA,KACoB;AACpB,SAAO,QACJ,OAAO,CAAC,WAAW,OAAO,YAAY,GAAG,KAAK,IAAI,EAClD,IAAI,CAAC,YAAY;AAAA,IAChB,IAAI,OAAO;AAAA,IACX,OAAO,OAAO,WAAW,GAAG,KAAK,OAAO;AAAA,IACxC,OAAO,OAAO;AAAA,IACd,SAAS,MAAM,KAAK,OAAO,SAAS,CAAC,GAAG,CAAC;AAAA,EAC3C,EAAE;AACN;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/layout/ContentToolbar/ContentToolbar.tsx"],"sourcesContent":["'use client';\n\nimport Box from '@mui/material/Box/index.js';\nimport Button from '@mui/material/Button/index.js';\nimport Checkbox from '@mui/material/Checkbox/index.js';\nimport Divider from '@mui/material/Divider/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport React from 'react';\n\nimport type { ContentToolbarProps } from './ContentToolbar.types';\n\nconst selectionButtonSx = {\n minWidth: 0,\n height: 'auto',\n borderRadius: 0.5,\n fontWeight: 600,\n py: 0.5,\n px: 1.5,\n fontSize: '0.75rem',\n textTransform: 'none',\n color: 'text.primary',\n} as const;\n\ntype SelectionClusterProps = Pick<\n ContentToolbarProps,\n | 'hasSelection'\n | 'selectedCount'\n | 'selectAll'\n | 'clearSelection'\n | 'actions'\n | 'selectionExtra'\n | 'selectAllTestId'\n | 'clearAllTestId'\n | 'edgeAlign'\n | 'selectAllLabel'\n | 'selectAllText'\n | 'clearAllText'\n>;\n\n/** The left cluster: Select All + (when selecting) Clear All / count / actions. */\nfunction SelectionCluster({\n hasSelection,\n selectedCount,\n selectAll,\n clearSelection,\n actions,\n selectionExtra,\n selectAllTestId,\n clearAllTestId,\n edgeAlign = false,\n selectAllLabel,\n selectAllText,\n clearAllText,\n}: SelectionClusterProps): React.JSX.Element {\n const actionsSlot = actions !== undefined && (\n <Box sx={{ ml: 0.5, display: 'flex', flexShrink: 0, alignItems: 'center' }}>{actions}</Box>\n );\n return (\n <Box\n sx={{\n display: 'flex',\n minWidth: 0,\n // Mobile: don't grow, so the controls sit on the SAME line as the checkbox\n // (no orphaned selection row). Desktop: grow to push controls right.\n flex: { xs: '0 0 auto', md: 1 },\n alignItems: 'center',\n gap: 1.5,\n ml: edgeAlign ? -1.5 : 0,\n }}\n >\n {/* Desktop: a \"Select All\" text button (md+). Mobile: a compact checkbox\n that toggles select-all/clear — the text would eat the tight row. */}\n <Button\n variant=\"text\"\n size=\"small\"\n color=\"inherit\"\n onClick={selectAll}\n data-testid={selectAllTestId}\n sx={{ ...selectionButtonSx, display: { xs: 'none', md: 'inline-flex' } }}\n >\n {selectAllText}\n </Button>\n <Checkbox\n size=\"small\"\n checked={hasSelection}\n onChange={(event) => (event.target.checked ? selectAll() : clearSelection())}\n data-testid={`${selectAllTestId}-checkbox`}\n inputProps={{ 'aria-label': selectAllLabel }}\n sx={{ p: 0.5, display: { xs: 'inline-flex', md: 'none' } }}\n />\n {hasSelection ? (\n <>\n <Button\n variant=\"text\"\n size=\"small\"\n color=\"inherit\"\n onClick={clearSelection}\n data-testid={clearAllTestId}\n sx={selectionButtonSx}\n >\n {clearAllText}\n </Button>\n <Divider orientation=\"vertical\" flexItem sx={{ height: 16, alignSelf: 'center' }} />\n <Typography\n component=\"span\"\n data-testid=\"selected-count-indicator\"\n sx={{ fontSize: '0.875rem', color: 'text.secondary', whiteSpace: 'nowrap', flexShrink: 0 }}\n >\n {selectedCount} {selectedCount === 1 ? 'item' : 'items'} selected\n </Typography>\n {selectionExtra}\n {actionsSlot}\n </>\n ) : (\n actionsSlot\n )}\n </Box>\n );\n}\n\n/**\n * The BROWSING half of the toolbar: search + filters on the left, the page's\n * own controls on the right. Split out of {@link ContentToolbar} so that\n * function stays inside the complexity gate — it is layout only, and the\n * decision of whether to show it at all is made by the caller.\n */\nfunction BrowsingClusters({\n leadingControls,\n rightControls,\n hasSelection,\n edgeAlign,\n}: {\n leadingControls?: React.ReactNode;\n rightControls: React.ReactNode;\n hasSelection: boolean;\n edgeAlign: boolean;\n}): React.JSX.Element {\n return (\n <>\n {/* minWidth:0 lets this cluster be the one that gives up width as the row\n * tightens, which is what the filter overflow measures against. */}\n {leadingControls !== undefined && (\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n flexGrow: 1,\n minWidth: 0,\n // The collapse ladder has a FLOOR — below roughly 400px even the\n // fully-collapsed row does not fit, and its controls cannot shrink\n // (they are flexShrink:0 so an over-packed row sheds instead of\n // squeezing). Past that point this scrolls rather than letting them\n // paint outside the toolbar, which is what a narrow phone did.\n overflowX: 'auto',\n // No scrollbar gutter stealing height on the common case.\n scrollbarWidth: 'thin',\n }}\n >\n {leadingControls}\n </Box>\n )}\n {/* ml:auto keeps the controls right-aligned even when the cluster wraps to\n * its own row (where justify-content:space-between would otherwise snap a\n * lone item to the left); it's a no-op on a shared row. */}\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n // Same single-line rule as the row itself: this cluster wrapping\n // INTERNALLY buys a second line just as surely as the row wrapping\n // does. It bit at exactly 900px, the `md` breakpoint where the \"N de\n // N\" counter appears and pushes Exibir/Exportar over the edge.\n flexWrap: leadingControls === undefined ? 'wrap' : 'nowrap',\n // Tight (5px) when browsing so the controls fit one line beside the\n // checkbox; roomier (14px) in selection mode where they get their own row.\n gap: hasSelection ? '14px' : '5px',\n ml: 'auto',\n mr: edgeAlign ? -1.5 : 0,\n '& > *': { flexShrink: 0 },\n }}\n >\n {rightControls}\n </Box>\n </>\n );\n}\n\n/**\n * Shared toolbar for content pages (Favorites, Personal Space, Recents, …). The\n * left cluster owns selection chrome — **Select All**, and once items are\n * selected, **Clear All** + an \"N items selected\" count + an optional `actions`\n * slot. The right cluster is a free `rightControls` slot for page-specific\n * controls (ViewSelector, SortByDropdown, MultiSelectDropdown, FilterTrigger).\n *\n * Faithful, generic MUI port of the reference `ContentPageToolbar` — the\n * domain-specific default actions are intentionally left to the consumer via\n * the `actions` slot so this stays agnostic and reusable across projects.\n *\n * @example\n * ```tsx\n * <ContentToolbar\n * hasSelection={selected.size > 0}\n * selectedCount={selected.size}\n * selectAll={selectAll}\n * clearSelection={clear}\n * rightControls={\n * <>\n * <ViewSelector viewMode={view} onViewModeChange={setView} zoom={zoom} onZoomChange={setZoom} />\n * <SortByDropdown fields={FIELDS} activeField={field} onFieldChange={setField} />\n * <MultiSelectDropdown label=\"Content Type\" options={types} selected={typeSet} onToggle={toggle} onClear={clear} />\n * <FilterTrigger open={panelOpen} onOpenChange={setPanelOpen} hasActiveFilters={hasFilters} />\n * </>\n * }\n * />\n * ```\n */\nexport function ContentToolbar({\n hasSelection,\n selectedCount,\n selectAll,\n clearSelection,\n rightControls,\n leadingControls,\n actions,\n selectionExtra,\n selectAllTestId,\n clearAllTestId,\n edgeAlign = false,\n exclusiveSelection = false,\n selectAllLabel,\n selectAllText,\n clearAllText,\n}: ContentToolbarProps): React.JSX.Element {\n // Under `exclusiveSelection` the two states are alternatives, not neighbours:\n // browsing shows the controls and no checkbox, selecting shows the checkbox\n // and no controls. Anything else double-books the row.\n const showSelection = !exclusiveSelection || hasSelection;\n const showControls = !exclusiveSelection || !hasSelection;\n return (\n // Two clusters on one line. They may wrap onto separate rows ONLY for a\n // toolbar without `leadingControls` — one carrying search + filters is\n // driven by a measured collapse ladder (see `useFilterOverflow`), and a\n // wrap there is the ladder having failed: it would silently buy a second\n // row instead of shedding a control into \"Mais\", which is the one outcome\n // the ladder exists to prevent.\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: 2,\n flexWrap: leadingControls === undefined ? 'wrap' : 'nowrap',\n rowGap: 1,\n }}\n >\n {showSelection && (\n <SelectionCluster\n selectAllText={selectAllText}\n clearAllText={clearAllText}\n hasSelection={hasSelection}\n selectedCount={selectedCount}\n selectAll={selectAll}\n clearSelection={clearSelection}\n actions={actions}\n selectionExtra={selectionExtra}\n selectAllTestId={selectAllTestId}\n clearAllTestId={clearAllTestId}\n selectAllLabel={selectAllLabel}\n edgeAlign={edgeAlign}\n />\n )}\n\n {showControls && (\n <BrowsingClusters\n leadingControls={leadingControls}\n rightControls={rightControls}\n hasSelection={hasSelection}\n edgeAlign={edgeAlign}\n />\n )}\n </Box>\n );\n}\n"],"mappings":";AAEA,OAAO,SAAS;AAChB,OAAO,YAAY;AACnB,OAAO,cAAc;AACrB,OAAO,aAAa;AACpB,OAAO,gBAAgB;AAiDnB,SAoCI,UApCJ,KAgDM,YAhDN;AA5CJ,IAAM,oBAAoB;AAAA,EACxB,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,UAAU;AAAA,EACV,eAAe;AAAA,EACf,OAAO;AACT;AAmBA,SAAS,iBAAiB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF,GAA6C;AAC3C,QAAM,cAAc,YAAY,UAC9B,oBAAC,OAAI,IAAI,EAAE,IAAI,KAAK,SAAS,QAAQ,YAAY,GAAG,YAAY,SAAS,GAAI,mBAAQ;AAEvF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,IAAI;AAAA,QACF,SAAS;AAAA,QACT,UAAU;AAAA;AAAA;AAAA,QAGV,MAAM,EAAE,IAAI,YAAY,IAAI,EAAE;AAAA,QAC9B,YAAY;AAAA,QACZ,KAAK;AAAA,QACL,IAAI,YAAY,OAAO;AAAA,MACzB;AAAA,MAIA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,SAAQ;AAAA,YACR,MAAK;AAAA,YACL,OAAM;AAAA,YACN,SAAS;AAAA,YACT,eAAa;AAAA,YACb,IAAI,EAAE,GAAG,mBAAmB,SAAS,EAAE,IAAI,QAAQ,IAAI,cAAc,EAAE;AAAA,YAEtE;AAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAK;AAAA,YACL,SAAS;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AAAA;AAAA;AAAA;AAAA;AAAA,UAKZ,UAAU,oBAAoB,SAAY,SAAS;AAAA;AAAA;AAAA,UAGnD,KAAK,eAAe,SAAS;AAAA,UAC7B,IAAI;AAAA,UACJ,IAAI,YAAY,OAAO;AAAA,UACvB,SAAS,EAAE,YAAY,EAAE;AAAA,QAC3B;AAAA,QAEC;AAAA;AAAA,IACH;AAAA,KACF;AAEJ;AA+BO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,qBAAqB;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AACF,GAA2C;AAIzC,QAAM,gBAAgB,CAAC,sBAAsB;AAC7C,QAAM,eAAe,CAAC,sBAAsB,CAAC;AAC7C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOE;AAAA,MAAC;AAAA;AAAA,QACC,IAAI;AAAA,UACF,SAAS;AAAA,UACT,YAAY;AAAA,UACZ,gBAAgB;AAAA,UAChB,KAAK;AAAA,UACL,UAAU,oBAAoB,SAAY,SAAS;AAAA,UACnD,QAAQ;AAAA,QACV;AAAA,QAEC;AAAA,2BACC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF;AAAA,UAGD,gBACC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA;AAAA,UACF;AAAA;AAAA;AAAA,IAEJ;AAAA;AAEJ;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/navigation/AppHeader/AppHeader.identity.tsx"],"sourcesContent":["'use client';\n\nimport KeyboardArrowDown from '@mui/icons-material/KeyboardArrowDown';\nimport Box from '@mui/material/Box/index.js';\nimport Skeleton from '@mui/material/Skeleton/index.js';\nimport Typography from '@mui/material/Typography/index.js';\nimport { useTheme } from '@mui/material/styles/index.js';\nimport React from 'react';\n\nimport { accentFor, type SizeValue } from '../../../tokens/scales';\n\nimport { AppHeaderBrand } from './AppHeader.brand';\nimport type { AppHeaderIdentityProps, AppHeaderStatusProps } from './AppHeader.types';\n\n/** Title type scale, per house size step. */\nconst TITLE_PX: Record<SizeValue, number> = { xs: 14, sm: 15, md: 17, lg: 20, xl: 24 };\n\n/** One line, ellipsised — a long store name must not push the actions off-screen. */\nconst ONE_LINE = {\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n} as const;\n\n/**\n * The dotted state line: \"● Aberto agora · Retirada no balcão\".\n *\n * Segments are joined here rather than by the caller because the separator is a\n * presentational choice — a caller that pre-joins its own string can never be\n * restyled, and each segment loses the chance to carry its own markup.\n */\nexport const AppHeaderStatus: React.FC<AppHeaderStatusProps> = ({\n tone,\n items,\n separator = '·',\n className,\n dataTestId = 'app-header-status',\n}) => {\n const theme = useTheme();\n const visible = items.filter((item) => item !== null && item !== undefined && item !== '');\n if (visible.length === 0) return null;\n\n return (\n <Box\n className={className}\n data-testid={dataTestId}\n sx={{ display: 'flex', alignItems: 'center', gap: 0.75, ...ONE_LINE }}\n >\n {tone && (\n <Box\n aria-hidden\n data-testid={`${dataTestId}-dot`}\n sx={{\n width: 8,\n height: 8,\n flex: '0 0 auto',\n borderRadius: '50%',\n backgroundColor: accentFor(theme, tone).main,\n }}\n />\n )}\n <Typography variant=\"body2\" color=\"text.secondary\" component=\"span\" sx={ONE_LINE}>\n {visible.map((item, index) => (\n // Index keys: the segments are positional presentation, and nothing\n // here reorders or is keyed on identity elsewhere.\n <React.Fragment key={index}>\n {index > 0 && (\n <>\n {/* Real spaces, not margin. A screen reader reads `textContent`,\n and a CSS-only gap runs \"Aberto agora\" straight into\n \"Retirada no balcão\" as one word. The glyph itself is\n hidden — it is punctuation, not something to announce. */}\n {' '}\n <Box component=\"span\" aria-hidden>\n {separator}\n </Box>{' '}\n </>\n )}\n {item}\n </React.Fragment>\n ))}\n </Typography>\n </Box>\n );\n};\n\nAppHeaderStatus.displayName = 'AppHeaderStatus';\n\n/** Title + chevron + the quieter lines under them. */\nconst IdentityText: React.FC<\n Pick<AppHeaderIdentityProps, 'title' | 'subtitle' | 'status' | 'size'> & {\n interactive: boolean;\n disclosed: boolean;\n dataTestId: string;\n }\n> = ({ title, subtitle, status, size = 'md', interactive, disclosed, dataTestId }) => (\n <Box sx={{ minWidth: 0, display: 'flex', flexDirection: 'column', gap: 0.25 }}>\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.25, minWidth: 0 }}>\n <Typography\n component=\"span\"\n data-testid={`${dataTestId}-title`}\n sx={{ fontSize: TITLE_PX[size], fontWeight: 700, lineHeight: 1.2, ...ONE_LINE }}\n >\n {title}\n </Typography>\n {interactive && (\n <KeyboardArrowDown\n aria-hidden\n data-testid={`${dataTestId}-chevron`}\n sx={{\n flex: '0 0 auto',\n fontSize: 20,\n opacity: 0.7,\n transition: 'transform 150ms ease',\n transform: disclosed ? 'rotate(180deg)' : 'none',\n }}\n />\n )}\n </Box>\n {subtitle && (\n <Typography variant=\"body2\" color=\"text.secondary\" component=\"span\" sx={ONE_LINE}>\n {subtitle}\n </Typography>\n )}\n {status}\n </Box>\n);\n\n/** The placeholder held while the identity is still resolving. */\nconst IdentitySkeleton: React.FC<{ size: SizeValue; dataTestId: string }> = ({\n size,\n dataTestId,\n}) => (\n <Box\n data-testid={`${dataTestId}-loading`}\n sx={{ display: 'flex', alignItems: 'center', gap: 1.25, minWidth: 0 }}\n >\n <Skeleton variant=\"rounded\" width={40} height={40} sx={{ flex: '0 0 auto' }} />\n <Box sx={{ minWidth: 0, flex: 1 }}>\n <Skeleton variant=\"text\" width={140} height={TITLE_PX[size] * 1.4} />\n <Skeleton variant=\"text\" width={180} height={16} />\n </Box>\n </Box>\n);\n\n/**\n * Row styling shared by the static and the button rendering.\n *\n * `width: '100%'` is load-bearing, not cosmetic. A `<button>` sizes to\n * max-content and — unlike the `div` the non-interactive path renders — does\n * not stretch to fill its block container, so without it the DISCLOSING\n * identity measured its widest possible line at every viewport: the row's\n * right edge stayed pinned at 564px while the bar narrowed, `ONE_LINE` never\n * had a constraint to ellipsise against, and the title and state line ran\n * straight under the actions — 327px of overlap at 320px wide. Filling the\n * wrapper is what lets `minWidth: 0` bite and the ellipsis engage.\n */\nconst rowSx = {\n display: 'flex',\n alignItems: 'center',\n gap: 1.25,\n width: '100%',\n minWidth: 0,\n textAlign: 'left',\n} as const;\n\n/**\n * Mark + title + state line, and — when it can be opened — the whole block as\n * one button.\n *\n * The button wraps EVERYTHING rather than sitting next to the title, because on\n * a phone the chevron alone is a 20px target next to a 40px one that does\n * nothing. A shopper aiming at the store's name expects the store's details.\n */\nexport const AppHeaderIdentity: React.FC<AppHeaderIdentityProps> = ({\n title,\n subtitle,\n status,\n mark,\n logoUrl,\n seedColor,\n onDisclose,\n disclosed = false,\n discloseLabel,\n loading = false,\n size = 'md',\n className,\n dataTestId = 'app-header-identity',\n}) => {\n if (loading) return <IdentitySkeleton size={size} dataTestId={dataTestId} />;\n\n const body = (\n <>\n {mark ?? (\n <AppHeaderBrand\n name={title}\n logoUrl={logoUrl}\n seedColor={seedColor}\n size={size}\n dataTestId={`${dataTestId}-brand`}\n />\n )}\n <IdentityText\n title={title}\n subtitle={subtitle}\n status={status}\n size={size}\n interactive={Boolean(onDisclose)}\n disclosed={disclosed}\n dataTestId={dataTestId}\n />\n </>\n );\n\n if (!onDisclose) {\n return (\n <Box className={className} data-testid={dataTestId} sx={rowSx}>\n {body}\n </Box>\n );\n }\n\n return (\n <Box\n component=\"button\"\n type=\"button\"\n className={className}\n data-testid={dataTestId}\n onClick={onDisclose}\n aria-haspopup=\"dialog\"\n aria-expanded={disclosed}\n aria-label={discloseLabel ?? `Detalhes de ${title}`}\n sx={{\n ...rowSx,\n appearance: 'none',\n p: 0.5,\n ml: -0.5,\n border: 'none',\n borderRadius: 1.5,\n background: 'none',\n color: 'inherit',\n font: 'inherit',\n cursor: 'pointer',\n '&:hover': { backgroundColor: 'action.hover' },\n '&:focus-visible': { outline: '2px solid', outlineColor: 'primary.main', outlineOffset: 2 },\n }}\n >\n {body}\n </Box>\n );\n};\n\nAppHeaderIdentity.displayName = 'AppHeaderIdentity';\n"],"mappings":";;;;;;;;AAEA,OAAO,uBAAuB;AAC9B,OAAO,SAAS;AAChB,OAAO,cAAc;AACrB,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AACzB,OAAO,WAAW;AA2CV,SAkBM,UAlBN,KAkBM,YAlBN;AAnCR,IAAM,WAAsC,EAAE,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;AAGrF,IAAM,WAAW;AAAA,EACf,UAAU;AAAA,EACV,UAAU;AAAA,EACV,cAAc;AAAA,EACd,YAAY;AACd;AASO,IAAM,kBAAkD,CAAC;AAAA,EAC9D;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,aAAa;AACf,MAAM;AACJ,QAAM,QAAQ,SAAS;AACvB,QAAM,UAAU,MAAM,OAAO,CAAC,SAAS,SAAS,QAAQ,SAAS,UAAa,SAAS,EAAE;AACzF,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAa;AAAA,MACb,IAAI,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,MAAM,GAAG,SAAS;AAAA,MAEnE;AAAA,gBACC;AAAA,UAAC;AAAA;AAAA,YACC,eAAW;AAAA,YACX,eAAa,GAAG,UAAU;AAAA,YAC1B,IAAI;AAAA,cACF,OAAO;AAAA,cACP,QAAQ;AAAA,cACR,MAAM;AAAA,cACN,cAAc;AAAA,cACd,iBAAiB,UAAU,OAAO,IAAI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,YAAY,IAAI,OACrD,gBACH;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,MAAK;AAAA,MACL;AAAA,MACA,eAAa;AAAA,MACb,SAAS;AAAA,MACT,iBAAc;AAAA,MACd,iBAAe;AAAA,MACf,cAAY,iBAAiB,eAAe,KAAK;AAAA,MACjD,IAAI;AAAA,QACF,GAAG;AAAA,QACH,YAAY;AAAA,QACZ,GAAG;AAAA,QACH,IAAI;AAAA,QACJ,QAAQ;AAAA,QACR,cAAc;AAAA,QACd,YAAY;AAAA,QACZ,OAAO;AAAA,QACP,MAAM;AAAA,QACN,QAAQ;AAAA,QACR,WAAW,EAAE,iBAAiB,eAAe;AAAA,QAC7C,mBAAmB,EAAE,SAAS,aAAa,cAAc,gBAAgB,eAAe,EAAE;AAAA,MAC5F;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEA,kBAAkB,cAAc;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|