@zag-js/number-input 0.1.17 → 0.1.19
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/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/index.mjs +6 -6
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ declare type ElementIds = Partial<{
|
|
|
11
11
|
decBtn: string;
|
|
12
12
|
scrubber: string;
|
|
13
13
|
}>;
|
|
14
|
-
declare type
|
|
14
|
+
declare type IntlTranslations = {
|
|
15
15
|
/**
|
|
16
16
|
* Function that returns the human-readable value.
|
|
17
17
|
* It is used to set the `aria-valuetext` property of the input
|
|
@@ -101,7 +101,7 @@ declare type PublicContext = DirectionProperty & CommonProperties & {
|
|
|
101
101
|
/**
|
|
102
102
|
* Specifies the localized strings that identifies the accessibility elements and their states
|
|
103
103
|
*/
|
|
104
|
-
|
|
104
|
+
translations: IntlTranslations;
|
|
105
105
|
/**
|
|
106
106
|
* If using a custom display format, this converts the custom format to a format `parseFloat` understands.
|
|
107
107
|
*/
|
package/dist/index.js
CHANGED
|
@@ -412,7 +412,7 @@ function connect(state, send, normalize) {
|
|
|
412
412
|
const isValueEmpty = state.context.isValueEmpty;
|
|
413
413
|
const isIncrementDisabled = isDisabled || !state.context.canIncrement;
|
|
414
414
|
const isDecrementDisabled = isDisabled || !state.context.canDecrement;
|
|
415
|
-
const
|
|
415
|
+
const translations = state.context.translations;
|
|
416
416
|
return {
|
|
417
417
|
isFocused,
|
|
418
418
|
isInvalid,
|
|
@@ -534,7 +534,7 @@ function connect(state, send, normalize) {
|
|
|
534
534
|
id: dom.getDecButtonId(state.context),
|
|
535
535
|
disabled: isDecrementDisabled,
|
|
536
536
|
"data-disabled": dataAttr(isDecrementDisabled),
|
|
537
|
-
"aria-label":
|
|
537
|
+
"aria-label": translations.decrementLabel,
|
|
538
538
|
type: "button",
|
|
539
539
|
tabIndex: -1,
|
|
540
540
|
"aria-controls": dom.getInputId(state.context),
|
|
@@ -559,7 +559,7 @@ function connect(state, send, normalize) {
|
|
|
559
559
|
id: dom.getIncButtonId(state.context),
|
|
560
560
|
disabled: isIncrementDisabled,
|
|
561
561
|
"data-disabled": dataAttr(isIncrementDisabled),
|
|
562
|
-
"aria-label":
|
|
562
|
+
"aria-label": translations.incrementLabel,
|
|
563
563
|
type: "button",
|
|
564
564
|
tabIndex: -1,
|
|
565
565
|
"aria-controls": dom.getInputId(state.context),
|
|
@@ -653,10 +653,10 @@ function machine(ctx) {
|
|
|
653
653
|
invalid: false,
|
|
654
654
|
spinOnPress: true,
|
|
655
655
|
...ctx,
|
|
656
|
-
|
|
656
|
+
translations: {
|
|
657
657
|
incrementLabel: "increment value",
|
|
658
658
|
decrementLabel: "decrease value",
|
|
659
|
-
...ctx.
|
|
659
|
+
...ctx.translations
|
|
660
660
|
}
|
|
661
661
|
},
|
|
662
662
|
computed: {
|
|
@@ -670,7 +670,7 @@ function machine(ctx) {
|
|
|
670
670
|
canDecrement: (ctx2) => ctx2.allowOverflow || !ctx2.isAtMin,
|
|
671
671
|
valueText: (ctx2) => {
|
|
672
672
|
var _a, _b;
|
|
673
|
-
return (_b = (_a = ctx2.
|
|
673
|
+
return (_b = (_a = ctx2.translations).valueText) == null ? void 0 : _b.call(_a, ctx2.value);
|
|
674
674
|
},
|
|
675
675
|
formattedValue: (ctx2) => {
|
|
676
676
|
var _a;
|
package/dist/index.mjs
CHANGED
|
@@ -385,7 +385,7 @@ function connect(state, send, normalize) {
|
|
|
385
385
|
const isValueEmpty = state.context.isValueEmpty;
|
|
386
386
|
const isIncrementDisabled = isDisabled || !state.context.canIncrement;
|
|
387
387
|
const isDecrementDisabled = isDisabled || !state.context.canDecrement;
|
|
388
|
-
const
|
|
388
|
+
const translations = state.context.translations;
|
|
389
389
|
return {
|
|
390
390
|
isFocused,
|
|
391
391
|
isInvalid,
|
|
@@ -507,7 +507,7 @@ function connect(state, send, normalize) {
|
|
|
507
507
|
id: dom.getDecButtonId(state.context),
|
|
508
508
|
disabled: isDecrementDisabled,
|
|
509
509
|
"data-disabled": dataAttr(isDecrementDisabled),
|
|
510
|
-
"aria-label":
|
|
510
|
+
"aria-label": translations.decrementLabel,
|
|
511
511
|
type: "button",
|
|
512
512
|
tabIndex: -1,
|
|
513
513
|
"aria-controls": dom.getInputId(state.context),
|
|
@@ -532,7 +532,7 @@ function connect(state, send, normalize) {
|
|
|
532
532
|
id: dom.getIncButtonId(state.context),
|
|
533
533
|
disabled: isIncrementDisabled,
|
|
534
534
|
"data-disabled": dataAttr(isIncrementDisabled),
|
|
535
|
-
"aria-label":
|
|
535
|
+
"aria-label": translations.incrementLabel,
|
|
536
536
|
type: "button",
|
|
537
537
|
tabIndex: -1,
|
|
538
538
|
"aria-controls": dom.getInputId(state.context),
|
|
@@ -626,10 +626,10 @@ function machine(ctx) {
|
|
|
626
626
|
invalid: false,
|
|
627
627
|
spinOnPress: true,
|
|
628
628
|
...ctx,
|
|
629
|
-
|
|
629
|
+
translations: {
|
|
630
630
|
incrementLabel: "increment value",
|
|
631
631
|
decrementLabel: "decrease value",
|
|
632
|
-
...ctx.
|
|
632
|
+
...ctx.translations
|
|
633
633
|
}
|
|
634
634
|
},
|
|
635
635
|
computed: {
|
|
@@ -643,7 +643,7 @@ function machine(ctx) {
|
|
|
643
643
|
canDecrement: (ctx2) => ctx2.allowOverflow || !ctx2.isAtMin,
|
|
644
644
|
valueText: (ctx2) => {
|
|
645
645
|
var _a, _b;
|
|
646
|
-
return (_b = (_a = ctx2.
|
|
646
|
+
return (_b = (_a = ctx2.translations).valueText) == null ? void 0 : _b.call(_a, ctx2.value);
|
|
647
647
|
},
|
|
648
648
|
formattedValue: (ctx2) => {
|
|
649
649
|
var _a;
|
package/package.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zag-js/number-input",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
4
4
|
"description": "Core logic for the number-input widget implemented as a state machine",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
5
8
|
"keywords": [
|
|
6
9
|
"js",
|
|
7
10
|
"machine",
|
|
@@ -14,9 +17,6 @@
|
|
|
14
17
|
"author": "Segun Adebayo <sage@adebayosegun.com>",
|
|
15
18
|
"homepage": "https://github.com/chakra-ui/zag#readme",
|
|
16
19
|
"license": "MIT",
|
|
17
|
-
"main": "dist/index.js",
|
|
18
|
-
"types": "dist/index.d.ts",
|
|
19
|
-
"module": "dist/index.mjs",
|
|
20
20
|
"repository": "https://github.com/chakra-ui/zag/tree/main/packages/number-input",
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"files": [
|
|
@@ -29,14 +29,14 @@
|
|
|
29
29
|
"url": "https://github.com/chakra-ui/zag/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@zag-js/core": "0.1.
|
|
33
|
-
"@zag-js/types": "0.2.
|
|
32
|
+
"@zag-js/core": "0.1.12",
|
|
33
|
+
"@zag-js/types": "0.2.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@zag-js/dom-utils": "0.1.
|
|
37
|
-
"@zag-js/form-utils": "0.1.
|
|
38
|
-
"@zag-js/number-utils": "0.1.
|
|
39
|
-
"@zag-js/utils": "0.1.
|
|
36
|
+
"@zag-js/dom-utils": "0.1.13",
|
|
37
|
+
"@zag-js/form-utils": "0.1.3",
|
|
38
|
+
"@zag-js/number-utils": "0.1.6",
|
|
39
|
+
"@zag-js/utils": "0.1.6"
|
|
40
40
|
},
|
|
41
41
|
"scripts": {
|
|
42
42
|
"build-fast": "tsup src/index.ts --format=esm,cjs",
|