@12-apps/ui 1.8.0 → 1.8.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@12-apps/ui",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"packageManager": "pnpm@9.0.0",
|
|
6
6
|
"type": "module",
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
195
195
|
},
|
|
196
196
|
"dependencies": {
|
|
197
|
-
"@12-apps/forms-core": "^1.7.
|
|
197
|
+
"@12-apps/forms-core": "^1.7.1",
|
|
198
198
|
"@emotion/react": "^11.14.0",
|
|
199
199
|
"@emotion/styled": "^11.14.0",
|
|
200
200
|
"@monaco-editor/react": "^4.7.0",
|
|
@@ -209,8 +209,8 @@
|
|
|
209
209
|
"recharts": "^3.5.1"
|
|
210
210
|
},
|
|
211
211
|
"devDependencies": {
|
|
212
|
-
"@12-apps/eslint-config": "^1.
|
|
213
|
-
"@12-apps/typescript-config": "^1.
|
|
212
|
+
"@12-apps/eslint-config": "^1.8.1",
|
|
213
|
+
"@12-apps/typescript-config": "^1.8.1",
|
|
214
214
|
"@playwright/test": "^1.55.0",
|
|
215
215
|
"@storybook/addon-docs": "^9.1.10",
|
|
216
216
|
"@storybook/addon-links": "^9.1.10",
|
|
@@ -20,6 +20,7 @@ import { Text } from "../../typography/Text";
|
|
|
20
20
|
|
|
21
21
|
import type { OverflowField } from "./data-views-overflow";
|
|
22
22
|
import { RangePresets } from "./data-views-preset-chips";
|
|
23
|
+
import { RangeBounds } from "./data-views-range-pill";
|
|
23
24
|
import { presetsFor } from "./data-views-range-presets";
|
|
24
25
|
import { isRangeSet } from "./data-views-range-values";
|
|
25
26
|
import type { RangeValue } from "./data-views-types";
|
|
@@ -112,7 +113,22 @@ function OverflowPill<T extends Record<string, unknown>>({
|
|
|
112
113
|
}
|
|
113
114
|
|
|
114
115
|
|
|
115
|
-
/**
|
|
116
|
+
/**
|
|
117
|
+
* One overflowed range: its two bounds, as the same inputs the pill uses.
|
|
118
|
+
*
|
|
119
|
+
* The bounds DELEGATE to {@link RangeBounds} rather than being built here,
|
|
120
|
+
* which is the whole point — this panel used to render a raw
|
|
121
|
+
* `<input type="date">`, so the masked `dd/mm/aaaa` field existed only while
|
|
122
|
+
* the filter FITTED on the bar. The moment "Data" overflowed it reverted to the
|
|
123
|
+
* native control the mask replaced, and a merchant on a narrow screen never saw
|
|
124
|
+
* the fix at all (FUT-744). `Valor` had the twin bug: a bare `type="number"`
|
|
125
|
+
* plus `Number(raw)` dropped the decimal comma this panel is meant to accept.
|
|
126
|
+
*
|
|
127
|
+
* That also retires the intrinsic-width workaround this pair used to need — a
|
|
128
|
+
* native date input reports a wide minimum (its own mask plus the picker
|
|
129
|
+
* glyph), which is what made two of them refuse to shrink and scrolled the
|
|
130
|
+
* panel sideways. A text input has no such minimum.
|
|
131
|
+
*/
|
|
116
132
|
function OverflowRange<T extends Record<string, unknown>>({
|
|
117
133
|
field,
|
|
118
134
|
value,
|
|
@@ -123,14 +139,10 @@ function OverflowRange<T extends Record<string, unknown>>({
|
|
|
123
139
|
value: RangeValue;
|
|
124
140
|
onChange: (range: RangeValue) => void;
|
|
125
141
|
testIdPrefix: string;
|
|
126
|
-
}): React.JSX.Element {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (raw === "") delete next[bound];
|
|
131
|
-
else next[bound] = day ? raw : Number(raw);
|
|
132
|
-
onChange(next);
|
|
133
|
-
};
|
|
142
|
+
}): React.JSX.Element | null {
|
|
143
|
+
// `group === "range"` is what selects this component, so `range` is always
|
|
144
|
+
// set; the guard is for the type, not for a state the caller can reach.
|
|
145
|
+
if (!field.range) return null;
|
|
134
146
|
return (
|
|
135
147
|
<Box sx={{ display: "flex", flexDirection: "column", gap: 1 }}>
|
|
136
148
|
{/* The overflow offers the same one-click windows the pill does. A field
|
|
@@ -138,44 +150,17 @@ function OverflowRange<T extends Record<string, unknown>>({
|
|
|
138
150
|
controls — otherwise "Data" gains and loses its presets as the window
|
|
139
151
|
is resized. */}
|
|
140
152
|
<RangePresets
|
|
141
|
-
presets={
|
|
153
|
+
presets={presetsFor(field.range)}
|
|
154
|
+
value={value}
|
|
155
|
+
onChange={onChange}
|
|
156
|
+
testId={`${testIdPrefix}-more-${field.id}`}
|
|
157
|
+
/>
|
|
158
|
+
<RangeBounds
|
|
159
|
+
field={field.range}
|
|
142
160
|
value={value}
|
|
143
161
|
onChange={onChange}
|
|
144
162
|
testId={`${testIdPrefix}-more-${field.id}`}
|
|
145
163
|
/>
|
|
146
|
-
<Box sx={{ display: "flex", alignItems: "center", gap: 1, minWidth: 0 }}>
|
|
147
|
-
{(["min", "max"] as const).map((bound, index) => (
|
|
148
|
-
<Box key={bound} sx={{ display: "contents" }}>
|
|
149
|
-
{index === 1 && <Box component="span" sx={{ color: "text.disabled" }}>–</Box>}
|
|
150
|
-
<Box
|
|
151
|
-
component="input"
|
|
152
|
-
type={day ? "date" : "number"}
|
|
153
|
-
placeholder={bound === "min" ? "de" : "até"}
|
|
154
|
-
aria-label={`${field.label} ${bound === "min" ? "de" : "até"}`}
|
|
155
|
-
data-testid={`${testIdPrefix}-more-${field.id}-${bound}`}
|
|
156
|
-
value={value[bound] ?? ""}
|
|
157
|
-
onChange={(event: React.ChangeEvent<HTMLInputElement>) => set(bound, event.target.value)}
|
|
158
|
-
sx={{
|
|
159
|
-
// `flex:1` + `minWidth:0` rather than `width:100%`. A native
|
|
160
|
-
// date input reports a wide intrinsic minimum (its dd/mm/aaaa
|
|
161
|
-
// mask plus the picker glyph), and a flex child defaults to
|
|
162
|
-
// min-width:auto — so two of them plus the dash refused to
|
|
163
|
-
// shrink and the whole panel scrolled sideways.
|
|
164
|
-
flex: "1 1 0",
|
|
165
|
-
minWidth: 0,
|
|
166
|
-
px: 1,
|
|
167
|
-
py: 0.75,
|
|
168
|
-
border: 1,
|
|
169
|
-
borderStyle: "solid",
|
|
170
|
-
borderColor: "divider",
|
|
171
|
-
borderRadius: 1,
|
|
172
|
-
font: "inherit",
|
|
173
|
-
fontSize: "0.8125rem",
|
|
174
|
-
}}
|
|
175
|
-
/>
|
|
176
|
-
</Box>
|
|
177
|
-
))}
|
|
178
|
-
</Box>
|
|
179
164
|
</Box>
|
|
180
165
|
);
|
|
181
166
|
}
|