@vygruppen/spor-react 10.1.0 → 10.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +16 -0
- package/dist/{CountryCodeSelect-FKWNR6SG.mjs → CountryCodeSelect-KCPHU7A7.mjs} +1 -1
- package/dist/{chunk-MLRF67YM.mjs → chunk-5HRYDWQ5.mjs} +94 -23
- package/dist/index.d.mts +50 -319
- package/dist/index.d.ts +50 -319
- package/dist/index.js +94 -22
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/input/Input.tsx +7 -1
- package/src/input/NumericStepper.tsx +72 -19
- package/src/modal/ModalHeader.tsx +1 -1
- package/src/theme/components/input.ts +32 -3
package/.turbo/turbo-build.log
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
> @vygruppen/spor-react@10.
|
2
|
+
> @vygruppen/spor-react@10.3.0 build
|
3
3
|
> tsup src/index.tsx --dts --treeshake --format cjs,esm
|
4
4
|
|
5
5
|
[34mCLI[39m Building entry: src/index.tsx
|
@@ -9,12 +9,12 @@
|
|
9
9
|
[34mCJS[39m Build start
|
10
10
|
[34mESM[39m Build start
|
11
11
|
[34mDTS[39m Build start
|
12
|
-
[32mCJS[39m [1mdist/index.js [22m[32m527.11 KB[39m
|
13
|
-
[32mCJS[39m ⚡️ Build success in 2350ms
|
14
12
|
[32mESM[39m [1mdist/index.mjs [22m[32m2.15 KB[39m
|
15
|
-
[32mESM[39m [1mdist/CountryCodeSelect-
|
16
|
-
[32mESM[39m [1mdist/chunk-
|
17
|
-
[32mESM[39m ⚡️ Build success in
|
18
|
-
[
|
19
|
-
[
|
20
|
-
[32mDTS[39m
|
13
|
+
[32mESM[39m [1mdist/CountryCodeSelect-KCPHU7A7.mjs [22m[32m1.19 KB[39m
|
14
|
+
[32mESM[39m [1mdist/chunk-5HRYDWQ5.mjs [22m[32m417.51 KB[39m
|
15
|
+
[32mESM[39m ⚡️ Build success in 2131ms
|
16
|
+
[32mCJS[39m [1mdist/index.js [22m[32m529.34 KB[39m
|
17
|
+
[32mCJS[39m ⚡️ Build success in 2132ms
|
18
|
+
[32mDTS[39m ⚡️ Build success in 15282ms
|
19
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m315.84 KB[39m
|
20
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m315.84 KB[39m
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,21 @@
|
|
1
1
|
# @vygruppen/spor-react
|
2
2
|
|
3
|
+
## 10.3.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- d3cd54d: Added input field ariaLabelContext to NummericStepper to improve functionality with screen readers.
|
8
|
+
|
9
|
+
## 10.2.0
|
10
|
+
|
11
|
+
### Minor Changes
|
12
|
+
|
13
|
+
- 0a56c3b: Added variant floating to input component.
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- da227b9: Modal: Add h1 tag to title
|
18
|
+
|
3
19
|
## 10.1.0
|
4
20
|
|
5
21
|
### Minor Changes
|
@@ -1508,8 +1508,10 @@ function NumericStepper({
|
|
1508
1508
|
withInput = true,
|
1509
1509
|
stepSize = 1,
|
1510
1510
|
showZero = false,
|
1511
|
+
ariaLabelContext = { singular: "", plural: "" },
|
1511
1512
|
...boxProps
|
1512
1513
|
}) {
|
1514
|
+
const addButtonRef = useRef(null);
|
1513
1515
|
const { t: t2 } = useTranslation();
|
1514
1516
|
const styles3 = useMultiStyleConfig("NumericStepper", {});
|
1515
1517
|
const [value, onChange] = useControllableState({
|
@@ -1519,12 +1521,26 @@ function NumericStepper({
|
|
1519
1521
|
});
|
1520
1522
|
const formControlProps = useFormControl({ id: idProp, isDisabled });
|
1521
1523
|
const clampedStepSize = Math.max(Math.min(stepSize, 10), 1);
|
1524
|
+
const focusOnAddButton = () => {
|
1525
|
+
var _a6;
|
1526
|
+
(_a6 = addButtonRef.current) == null ? void 0 : _a6.focus();
|
1527
|
+
};
|
1522
1528
|
return /* @__PURE__ */ React84__default.createElement(Flex, { __css: styles3.container, ...boxProps }, /* @__PURE__ */ React84__default.createElement(
|
1523
1529
|
VerySmallButton,
|
1524
1530
|
{
|
1525
1531
|
icon: /* @__PURE__ */ React84__default.createElement(SubtractIcon, { stepLabel: clampedStepSize }),
|
1526
|
-
"aria-label": t2(
|
1527
|
-
|
1532
|
+
"aria-label": t2(
|
1533
|
+
texts2.decrementButtonAriaLabel(
|
1534
|
+
clampedStepSize,
|
1535
|
+
stepSize == 1 ? ariaLabelContext.singular : ariaLabelContext.plural
|
1536
|
+
)
|
1537
|
+
),
|
1538
|
+
onClick: () => {
|
1539
|
+
onChange(Math.max(value - clampedStepSize, minValue));
|
1540
|
+
if (Math.max(value - clampedStepSize, minValue) <= minValue) {
|
1541
|
+
focusOnAddButton();
|
1542
|
+
}
|
1543
|
+
},
|
1528
1544
|
visibility: value <= minValue ? "hidden" : "visible",
|
1529
1545
|
isDisabled: formControlProps.disabled,
|
1530
1546
|
id: value <= minValue ? void 0 : formControlProps.id
|
@@ -1543,13 +1559,16 @@ function NumericStepper({
|
|
1543
1559
|
width: `${Math.max(value.toString().length + 1, 3)}ch`,
|
1544
1560
|
visibility: !showZero && value === 0 ? "hidden" : "visible",
|
1545
1561
|
"aria-live": "assertive",
|
1546
|
-
"aria-label":
|
1562
|
+
"aria-label": ariaLabelContext.plural !== "" ? t2(texts2.currentNumberAriaLabel(ariaLabelContext.plural)) : "",
|
1547
1563
|
onChange: (e) => {
|
1548
1564
|
const numericInput = Number(e.target.value);
|
1549
1565
|
if (Number.isNaN(numericInput)) {
|
1550
1566
|
return;
|
1551
1567
|
}
|
1552
1568
|
onChange(Math.max(Math.min(numericInput, maxValue), minValue));
|
1569
|
+
if (!showZero && Math.max(Math.min(numericInput, maxValue), minValue) === 0) {
|
1570
|
+
focusOnAddButton();
|
1571
|
+
}
|
1553
1572
|
}
|
1554
1573
|
}
|
1555
1574
|
) : /* @__PURE__ */ React84__default.createElement(
|
@@ -1557,14 +1576,21 @@ function NumericStepper({
|
|
1557
1576
|
{
|
1558
1577
|
sx: styles3.text,
|
1559
1578
|
visibility: !showZero && value === 0 ? "hidden" : "visible",
|
1560
|
-
"aria-
|
1579
|
+
"aria-live": "assertive",
|
1580
|
+
"aria-label": ariaLabelContext.plural !== "" ? t2(texts2.currentNumberAriaLabel(ariaLabelContext.plural)) : ""
|
1561
1581
|
},
|
1562
1582
|
value
|
1563
1583
|
), /* @__PURE__ */ React84__default.createElement(
|
1564
1584
|
VerySmallButton,
|
1565
1585
|
{
|
1586
|
+
ref: addButtonRef,
|
1566
1587
|
icon: /* @__PURE__ */ React84__default.createElement(AddIcon, { stepLabel: clampedStepSize }),
|
1567
|
-
"aria-label": t2(
|
1588
|
+
"aria-label": t2(
|
1589
|
+
texts2.incrementButtonAriaLabel(
|
1590
|
+
clampedStepSize,
|
1591
|
+
stepSize == 1 ? ariaLabelContext.singular : ariaLabelContext.plural
|
1592
|
+
)
|
1593
|
+
),
|
1568
1594
|
onClick: () => onChange(Math.min(value + clampedStepSize, maxValue)),
|
1569
1595
|
visibility: value >= maxValue ? "hidden" : "visible",
|
1570
1596
|
isDisabled: formControlProps.disabled,
|
@@ -1572,10 +1598,19 @@ function NumericStepper({
|
|
1572
1598
|
}
|
1573
1599
|
));
|
1574
1600
|
}
|
1575
|
-
var VerySmallButton = (props) => {
|
1601
|
+
var VerySmallButton = React84__default.forwardRef((props, ref) => {
|
1576
1602
|
const styles3 = useMultiStyleConfig("NumericStepper", {});
|
1577
|
-
return /* @__PURE__ */ React84__default.createElement(
|
1578
|
-
|
1603
|
+
return /* @__PURE__ */ React84__default.createElement(
|
1604
|
+
IconButton,
|
1605
|
+
{
|
1606
|
+
variant: "primary",
|
1607
|
+
size: "xs",
|
1608
|
+
sx: styles3.button,
|
1609
|
+
ref,
|
1610
|
+
...props
|
1611
|
+
}
|
1612
|
+
);
|
1613
|
+
});
|
1579
1614
|
var SubtractIcon = ({ stepLabel, ...props }) => /* @__PURE__ */ React84__default.createElement(React84__default.Fragment, null, /* @__PURE__ */ React84__default.createElement(
|
1580
1615
|
Box,
|
1581
1616
|
{
|
@@ -1632,20 +1667,28 @@ var AddIcon = ({ stepLabel, ...props }) => /* @__PURE__ */ React84__default.crea
|
|
1632
1667
|
)
|
1633
1668
|
), stepLabel > 1 && /* @__PURE__ */ React84__default.createElement(chakra.span, { paddingRight: "1" }, stepLabel.toString()));
|
1634
1669
|
var texts2 = createTexts({
|
1635
|
-
|
1670
|
+
currentNumberAriaLabel(ariaContext) {
|
1636
1671
|
return {
|
1637
|
-
nb: `
|
1638
|
-
en: `
|
1639
|
-
nn: `
|
1640
|
-
sv: `
|
1672
|
+
nb: `Valgt antall ${ariaContext}`,
|
1673
|
+
en: `Chosen number of ${ariaContext}`,
|
1674
|
+
nn: `Valgt antall ${ariaContext}`,
|
1675
|
+
sv: `Valgt antall ${ariaContext}`
|
1641
1676
|
};
|
1642
1677
|
},
|
1643
|
-
|
1678
|
+
decrementButtonAriaLabel(stepSize, ariaContext) {
|
1644
1679
|
return {
|
1645
|
-
nb: `
|
1646
|
-
en: `
|
1647
|
-
nn: `
|
1648
|
-
sv: `
|
1680
|
+
nb: `Trekk fra ${stepSize} ${ariaContext}`,
|
1681
|
+
en: `Subtract ${stepSize} ${ariaContext}`,
|
1682
|
+
nn: `Trekk fr\xE5 ${stepSize} ${ariaContext}`,
|
1683
|
+
sv: `Subtrahera ${stepSize} ${ariaContext}`
|
1684
|
+
};
|
1685
|
+
},
|
1686
|
+
incrementButtonAriaLabel(stepSize, ariaContext) {
|
1687
|
+
return {
|
1688
|
+
nb: `Legg til ${stepSize} ${ariaContext}`,
|
1689
|
+
en: `Add ${stepSize} ${ariaContext}`,
|
1690
|
+
nn: `Legg til ${stepSize} ${ariaContext}`,
|
1691
|
+
sv: `L\xE4gg till ${stepSize} ${ariaContext}`
|
1649
1692
|
};
|
1650
1693
|
}
|
1651
1694
|
});
|
@@ -1779,7 +1822,7 @@ var texts4 = createTexts({
|
|
1779
1822
|
sv: "Landskod"
|
1780
1823
|
}
|
1781
1824
|
});
|
1782
|
-
var LazyCountryCodeSelect = React84__default.lazy(() => import('./CountryCodeSelect-
|
1825
|
+
var LazyCountryCodeSelect = React84__default.lazy(() => import('./CountryCodeSelect-KCPHU7A7.mjs'));
|
1783
1826
|
var Radio = forwardRef((props, ref) => {
|
1784
1827
|
return /* @__PURE__ */ React84__default.createElement(Radio$1, { ...props, ref });
|
1785
1828
|
});
|
@@ -4358,7 +4401,7 @@ var ModalHeader = forwardRef(
|
|
4358
4401
|
fontSize: size2 === "lg" ? ["mobile.lg", "desktop.lg"] : ["mobile.md", "desktop.md"],
|
4359
4402
|
textAlign: size2 === "lg" ? "center" : "left"
|
4360
4403
|
};
|
4361
|
-
return /* @__PURE__ */ React84__default.createElement(ModalHeader$1, { ...props, ref, ...styles3 });
|
4404
|
+
return /* @__PURE__ */ React84__default.createElement(ModalHeader$1, { as: "h1", ...props, ref, ...styles3 });
|
4362
4405
|
}
|
4363
4406
|
);
|
4364
4407
|
|
@@ -12443,8 +12486,6 @@ var config21 = helpers14.defineMultiStyleConfig({
|
|
12443
12486
|
paddingX: 3,
|
12444
12487
|
height: 8,
|
12445
12488
|
fontSize: "mobile.md",
|
12446
|
-
...baseBackground("default", props),
|
12447
|
-
...baseBorder("default", props),
|
12448
12489
|
_hover: {
|
12449
12490
|
...baseBorder("hover", props)
|
12450
12491
|
},
|
@@ -12493,7 +12534,37 @@ var config21 = helpers14.defineMultiStyleConfig({
|
|
12493
12534
|
...baseText("disabled", props)
|
12494
12535
|
}
|
12495
12536
|
}
|
12496
|
-
})
|
12537
|
+
}),
|
12538
|
+
variants: {
|
12539
|
+
base: (props) => ({
|
12540
|
+
field: {
|
12541
|
+
...baseBackground("default", props),
|
12542
|
+
...baseBorder("default", props)
|
12543
|
+
}
|
12544
|
+
}),
|
12545
|
+
floating: (props) => ({
|
12546
|
+
field: {
|
12547
|
+
boxShadow: "sm",
|
12548
|
+
...floatingBackground("default", props),
|
12549
|
+
...floatingBorder("default", props),
|
12550
|
+
_hover: {
|
12551
|
+
...floatingBorder("hover", props),
|
12552
|
+
...floatingBackground("hover", props)
|
12553
|
+
},
|
12554
|
+
_active: {
|
12555
|
+
...floatingBorder("active", props),
|
12556
|
+
...floatingBackground("active", props)
|
12557
|
+
},
|
12558
|
+
_selected: {
|
12559
|
+
...floatingBorder("selected", props),
|
12560
|
+
...floatingBackground("selected", props)
|
12561
|
+
}
|
12562
|
+
}
|
12563
|
+
})
|
12564
|
+
},
|
12565
|
+
defaultProps: {
|
12566
|
+
variant: "base"
|
12567
|
+
}
|
12497
12568
|
});
|
12498
12569
|
var input_default = config21;
|
12499
12570
|
var parts10 = anatomy$1("line-tag").parts("iconContainer", "icon");
|