@nexus-cross/design-system 2.0.4 → 2.0.6
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/cursor-rules/nexus-ui-api.mdc +4 -2
- package/dist/chunks/chunk-3BMVYJCA.js +15 -0
- package/dist/chunks/{chunk-2BINGHGR.js → chunk-EBMOQIY5.js} +17 -3
- package/dist/chunks/{chunk-RL5UAEGQ.mjs → chunk-FMUWSORG.mjs} +17 -3
- package/dist/chunks/{chunk-JFZLKFFM.mjs → chunk-JBMN6DY3.mjs} +1 -1
- package/dist/chunks/chunk-KHCPES3K.mjs +12 -0
- package/dist/chunks/{chunk-4ENXP7WH.js → chunk-L7SGGDY3.js} +4 -12
- package/dist/chunks/{chunk-WGGBE4ZD.mjs → chunk-QBMDWUQU.mjs} +1 -9
- package/dist/chunks/{chunk-7G7U4DP2.js → chunk-YMLPMIWX.js} +1 -1
- package/dist/components/NumberInput.d.ts +8 -0
- package/dist/components/NumberInput.d.ts.map +1 -1
- package/dist/components/PriceInput.d.ts.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.mjs +3 -2
- package/dist/number-input.js +5 -4
- package/dist/number-input.mjs +2 -1
- package/dist/price-input.js +4 -3
- package/dist/price-input.mjs +2 -1
- package/dist/schemas/_all.json +6 -1
- package/dist/schemas/number-input.d.ts +3 -0
- package/dist/schemas/number-input.d.ts.map +1 -1
- package/dist/schemas/numberInput.json +6 -1
- package/dist/schemas.js +6 -2
- package/dist/schemas.mjs +6 -2
- package/dist/styles/.generated/built.d.ts +1 -1
- package/dist/styles/.generated/built.d.ts.map +1 -1
- package/dist/styles/layer.js +2 -2
- package/dist/styles/layer.mjs +1 -1
- package/dist/styles.css +8 -8
- package/dist/styles.js +2 -2
- package/dist/styles.layered.css +8 -8
- package/dist/styles.mjs +1 -1
- package/dist/tokens/company.css +1 -1
- package/dist/tokens/css.css +1 -1
- package/dist/tokens-domains/gamehub-vars.css +1 -1
- package/dist/tokens-domains/gamehub.css +1 -1
- package/dist/tokens-domains/prediction-vars.css +1 -1
- package/dist/tokens-domains/prediction.css +1 -1
- package/dist/utils/numberFormat.d.ts +15 -0
- package/dist/utils/numberFormat.d.ts.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/utils/numberFormat.ts
|
|
2
|
+
function formatWithComma(value) {
|
|
3
|
+
if (!value) return value;
|
|
4
|
+
const [intPart, decPart] = value.split(".");
|
|
5
|
+
const formatted = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
6
|
+
return decPart !== void 0 ? `${formatted}.${decPart}` : formatted;
|
|
7
|
+
}
|
|
8
|
+
function stripComma(value) {
|
|
9
|
+
return value.replace(/,/g, "");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { formatWithComma, stripComma };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunk3BMVYJCA_js = require('./chunk-3BMVYJCA.js');
|
|
3
4
|
var chunkCZC76ZD5_js = require('./chunk-CZC76ZD5.js');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
var classVarianceAuthority = require('class-variance-authority');
|
|
@@ -25,15 +26,6 @@ function _interopNamespace(e) {
|
|
|
25
26
|
|
|
26
27
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
28
|
|
|
28
|
-
function formatWithComma(value) {
|
|
29
|
-
if (!value) return value;
|
|
30
|
-
const [intPart, decPart] = value.split(".");
|
|
31
|
-
const formatted = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
32
|
-
return decPart !== void 0 ? `${formatted}.${decPart}` : formatted;
|
|
33
|
-
}
|
|
34
|
-
function stripComma(value) {
|
|
35
|
-
return value.replace(/,/g, "");
|
|
36
|
-
}
|
|
37
29
|
var priceInputVariants = classVarianceAuthority.cva("nexus-price-input", {
|
|
38
30
|
variants: {
|
|
39
31
|
size: {
|
|
@@ -98,14 +90,14 @@ var PriceInput = React__namespace.forwardRef(
|
|
|
98
90
|
const handleChange = React__namespace.useCallback(
|
|
99
91
|
(e) => {
|
|
100
92
|
const rawInput = e.target.value;
|
|
101
|
-
const raw = separator ? stripComma(rawInput) : rawInput;
|
|
93
|
+
const raw = separator ? chunk3BMVYJCA_js.stripComma(rawInput) : rawInput;
|
|
102
94
|
if (!isControlled) setInternalValue(raw);
|
|
103
95
|
onValueChange?.(raw);
|
|
104
96
|
onChange?.(e);
|
|
105
97
|
if (separator && inputRef.current) {
|
|
106
98
|
const cursorPos = e.target.selectionStart ?? 0;
|
|
107
99
|
const commasBefore = (rawInput.slice(0, cursorPos).match(/,/g) || []).length;
|
|
108
|
-
const formatted = formatWithComma(raw);
|
|
100
|
+
const formatted = chunk3BMVYJCA_js.formatWithComma(raw);
|
|
109
101
|
const el = inputRef.current;
|
|
110
102
|
requestAnimationFrame(() => {
|
|
111
103
|
el.value = formatted;
|
|
@@ -162,7 +154,7 @@ var PriceInput = React__namespace.forwardRef(
|
|
|
162
154
|
disabled,
|
|
163
155
|
"aria-invalid": hasError || void 0,
|
|
164
156
|
"aria-describedby": description ? `${inputId}-desc` : void 0,
|
|
165
|
-
value: isControlled ? separator ? formatWithComma(String(controlledValue)) : controlledValue : void 0,
|
|
157
|
+
value: isControlled ? separator ? chunk3BMVYJCA_js.formatWithComma(String(controlledValue)) : controlledValue : void 0,
|
|
166
158
|
defaultValue: !isControlled ? void 0 : void 0,
|
|
167
159
|
onChange: handleChange,
|
|
168
160
|
inputMode: "decimal",
|
|
@@ -1,17 +1,9 @@
|
|
|
1
|
+
import { stripComma, formatWithComma } from './chunk-KHCPES3K.mjs';
|
|
1
2
|
import { cn } from './chunk-MCKOWMLS.mjs';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
import { cva } from 'class-variance-authority';
|
|
4
5
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
6
|
|
|
6
|
-
function formatWithComma(value) {
|
|
7
|
-
if (!value) return value;
|
|
8
|
-
const [intPart, decPart] = value.split(".");
|
|
9
|
-
const formatted = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
10
|
-
return decPart !== void 0 ? `${formatted}.${decPart}` : formatted;
|
|
11
|
-
}
|
|
12
|
-
function stripComma(value) {
|
|
13
|
-
return value.replace(/,/g, "");
|
|
14
|
-
}
|
|
15
7
|
var priceInputVariants = cva("nexus-price-input", {
|
|
16
8
|
variants: {
|
|
17
9
|
size: {
|