@northlight/ui 2.30.0 → 2.31.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/dist/es/northlight.d.ts +46 -5
- package/dist/es/northlight.js +18 -10
- package/dist/es/northlight.js.map +1 -1
- package/dist/umd/northlight.cjs +18 -10
- package/dist/umd/northlight.cjs.map +1 -1
- package/dist/umd/northlight.min.cjs +2 -2
- package/dist/umd/northlight.min.cjs.map +1 -1
- package/package.json +2 -2
package/dist/es/northlight.d.ts
CHANGED
|
@@ -4247,11 +4247,15 @@ type ComboPickerOption = {
|
|
|
4247
4247
|
label: string;
|
|
4248
4248
|
value: string;
|
|
4249
4249
|
};
|
|
4250
|
-
interface ComboPickerProps extends Omit<
|
|
4250
|
+
interface ComboPickerProps extends Omit<FormattedNumberInputProps, 'value' | 'onChange'> {
|
|
4251
4251
|
options: ComboPickerOption[];
|
|
4252
4252
|
value?: ComboPickerValue;
|
|
4253
4253
|
onChange?: (value: ComboPickerValue) => void;
|
|
4254
4254
|
defaultOption?: ComboPickerOption;
|
|
4255
|
+
precision?: number;
|
|
4256
|
+
formatPreset?: FormattedNumberInputPreset;
|
|
4257
|
+
isDisabled?: boolean;
|
|
4258
|
+
isReadOnly?: boolean;
|
|
4255
4259
|
}
|
|
4256
4260
|
interface ComboPickerFieldProps extends ComboPickerProps {
|
|
4257
4261
|
name: string;
|
|
@@ -4267,7 +4271,7 @@ interface ComboPickerFieldProps extends ComboPickerProps {
|
|
|
4267
4271
|
* @see ComboPickerField
|
|
4268
4272
|
* @see {@link https://northlight.dev/reference/combo-picker}
|
|
4269
4273
|
*/
|
|
4270
|
-
declare const ComboPicker: ({ onChange, options, size, value, placeholder, isDisabled, ...rest }: ComboPickerProps) => JSX.Element;
|
|
4274
|
+
declare const ComboPicker: ({ onChange, options, size, value, placeholder, precision, formatPreset, isDisabled, isReadOnly, ...rest }: ComboPickerProps) => JSX.Element;
|
|
4271
4275
|
|
|
4272
4276
|
/**
|
|
4273
4277
|
* The <ComboPicker /> component wrapped in a <Field />
|
|
@@ -4276,13 +4280,50 @@ declare const ComboPicker: ({ onChange, options, size, value, placeholder, isDis
|
|
|
4276
4280
|
* @see {@link https://northlight.dev/reference/combo-picker}
|
|
4277
4281
|
*
|
|
4278
4282
|
* @example (Example)
|
|
4279
|
-
* ##
|
|
4283
|
+
* ##Default number format preset(EU) with default decimals(2):
|
|
4284
|
+
* (?
|
|
4285
|
+
* <Form initialValues={{"budget": {input: 123456789.123, option:{label: 'EUR', value: 'eur'}}}}>
|
|
4286
|
+
* <ComboPickerField
|
|
4287
|
+
* label="Budget"
|
|
4288
|
+
* name="budget"
|
|
4289
|
+
* options={ [
|
|
4290
|
+
* { label: 'USD', value: 'usd' },
|
|
4291
|
+
* { label: 'EUR', value: 'eur' },
|
|
4292
|
+
* { label: 'SEK', value: 'sek' },
|
|
4293
|
+
* ] }
|
|
4294
|
+
* />
|
|
4295
|
+
* </Form>
|
|
4296
|
+
*
|
|
4297
|
+
* ?)
|
|
4298
|
+
* <br />
|
|
4299
|
+
* ##US number format preset with three decimals as Disabled:
|
|
4300
|
+
* (?
|
|
4301
|
+
* <Form initialValues={{"budget": {input: 123456789.1234, option:{label: 'USD', value: 'usd'}}}}>
|
|
4302
|
+
* <ComboPickerField
|
|
4303
|
+
* label="Budget"
|
|
4304
|
+
* name="budget"
|
|
4305
|
+
* precision={ 3 }
|
|
4306
|
+
* isDisabled={true}
|
|
4307
|
+
* formatPreset='us'
|
|
4308
|
+
* options={ [
|
|
4309
|
+
* { label: 'USD', value: 'usd' },
|
|
4310
|
+
* { label: 'EUR', value: 'eur' },
|
|
4311
|
+
* { label: 'SEK', value: 'sek' },
|
|
4312
|
+
* ] }
|
|
4313
|
+
* />
|
|
4314
|
+
* </Form>
|
|
4315
|
+
*
|
|
4316
|
+
* ?)
|
|
4317
|
+
* <br />
|
|
4318
|
+
* ##NOR number format preset with four decimals as ReadOnly:
|
|
4280
4319
|
* (?
|
|
4281
|
-
* <Form initialValues={{"budget": {input:
|
|
4320
|
+
* <Form initialValues={{"budget": {input: 123456789.1234, option:{label: 'SEK', value: 'sek'}}}}>
|
|
4282
4321
|
* <ComboPickerField
|
|
4283
4322
|
* label="Budget"
|
|
4284
4323
|
* name="budget"
|
|
4285
|
-
* precision={
|
|
4324
|
+
* precision={ 4 }
|
|
4325
|
+
* isReadOnly={true}
|
|
4326
|
+
* formatPreset='nor'
|
|
4286
4327
|
* options={ [
|
|
4287
4328
|
* { label: 'USD', value: 'usd' },
|
|
4288
4329
|
* { label: 'EUR', value: 'eur' },
|
package/dist/es/northlight.js
CHANGED
|
@@ -14276,14 +14276,20 @@ const ComboPicker = (_a) => {
|
|
|
14276
14276
|
size,
|
|
14277
14277
|
value,
|
|
14278
14278
|
placeholder,
|
|
14279
|
-
|
|
14279
|
+
precision,
|
|
14280
|
+
formatPreset,
|
|
14281
|
+
isDisabled,
|
|
14282
|
+
isReadOnly
|
|
14280
14283
|
} = _b, rest = __objRest$1(_b, [
|
|
14281
14284
|
"onChange",
|
|
14282
14285
|
"options",
|
|
14283
14286
|
"size",
|
|
14284
14287
|
"value",
|
|
14285
14288
|
"placeholder",
|
|
14286
|
-
"
|
|
14289
|
+
"precision",
|
|
14290
|
+
"formatPreset",
|
|
14291
|
+
"isDisabled",
|
|
14292
|
+
"isReadOnly"
|
|
14287
14293
|
]);
|
|
14288
14294
|
const { isOpen, onToggle, onClose } = useDisclosure();
|
|
14289
14295
|
const [inputValue, setInputValue] = useState(value ? value.input : 0);
|
|
@@ -14292,9 +14298,9 @@ const ComboPicker = (_a) => {
|
|
|
14292
14298
|
const buttonRef = useRef();
|
|
14293
14299
|
const selectRef = useRef();
|
|
14294
14300
|
const handleInputChange = (newInputvalue) => {
|
|
14295
|
-
setInputValue(Number(newInputvalue));
|
|
14301
|
+
setInputValue(Number(newInputvalue.floatValue));
|
|
14296
14302
|
onChange == null ? void 0 : onChange({
|
|
14297
|
-
input: Number(newInputvalue),
|
|
14303
|
+
input: Number(newInputvalue.floatValue),
|
|
14298
14304
|
option: selectOption
|
|
14299
14305
|
});
|
|
14300
14306
|
};
|
|
@@ -14326,17 +14332,19 @@ const ComboPicker = (_a) => {
|
|
|
14326
14332
|
selectRef.current.focus();
|
|
14327
14333
|
}
|
|
14328
14334
|
}, [enableSelectInput]);
|
|
14329
|
-
return /* @__PURE__ */ React.createElement(InputGroup,
|
|
14330
|
-
|
|
14335
|
+
return /* @__PURE__ */ React.createElement(InputGroup, null, /* @__PURE__ */ React.createElement(
|
|
14336
|
+
FormattedNumberInput,
|
|
14331
14337
|
__spreadValues$1({
|
|
14332
14338
|
width: "100%",
|
|
14333
|
-
overflow: "hidden",
|
|
14334
14339
|
onChange: handleInputChange,
|
|
14335
14340
|
defaultValue: inputValue,
|
|
14336
14341
|
placeholder,
|
|
14337
|
-
|
|
14338
|
-
|
|
14339
|
-
|
|
14342
|
+
size,
|
|
14343
|
+
numberOfDecimals: precision,
|
|
14344
|
+
preset: formatPreset,
|
|
14345
|
+
disabled: isDisabled,
|
|
14346
|
+
readOnly: isReadOnly
|
|
14347
|
+
}, rest)
|
|
14340
14348
|
), /* @__PURE__ */ React.createElement(
|
|
14341
14349
|
InputRightElement,
|
|
14342
14350
|
{
|