@mantine/core 6.0.0-alpha.2 → 6.0.0-alpha.3
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/cjs/JsonInput/JsonInput.js +12 -6
- package/cjs/JsonInput/JsonInput.js.map +1 -1
- package/cjs/JsonInput/validate-json/validate-json.js +2 -2
- package/cjs/JsonInput/validate-json/validate-json.js.map +1 -1
- package/esm/JsonInput/JsonInput.js +12 -6
- package/esm/JsonInput/JsonInput.js.map +1 -1
- package/esm/JsonInput/validate-json/validate-json.js +2 -2
- package/esm/JsonInput/validate-json/validate-json.js.map +1 -1
- package/lib/AppShell/HorizontalSection/HorizontalSection.d.ts +1 -1
- package/lib/JsonInput/JsonInput.d.ts +4 -0
- package/lib/JsonInput/JsonInput.d.ts.map +1 -1
- package/lib/JsonInput/validate-json/validate-json.d.ts +1 -1
- package/lib/JsonInput/validate-json/validate-json.d.ts.map +1 -1
- package/lib/ScrollArea/ScrollArea.d.ts +1 -1
- package/lib/Select/SelectScrollArea/SelectScrollArea.d.ts +1 -1
- package/package.json +4 -4
|
@@ -46,7 +46,9 @@ var __objRest = (source, exclude) => {
|
|
|
46
46
|
};
|
|
47
47
|
const defaultProps = {
|
|
48
48
|
formatOnBlur: false,
|
|
49
|
-
size: "sm"
|
|
49
|
+
size: "sm",
|
|
50
|
+
serialize: JSON.stringify,
|
|
51
|
+
deserialize: JSON.stringify
|
|
50
52
|
};
|
|
51
53
|
const JsonInput = React.forwardRef((props, ref) => {
|
|
52
54
|
const _a = styles.useComponentDefaultProps("JsonInput", defaultProps, props), {
|
|
@@ -62,7 +64,9 @@ const JsonInput = React.forwardRef((props, ref) => {
|
|
|
62
64
|
classNames,
|
|
63
65
|
unstyled,
|
|
64
66
|
readOnly,
|
|
65
|
-
variant
|
|
67
|
+
variant,
|
|
68
|
+
serialize,
|
|
69
|
+
deserialize
|
|
66
70
|
} = _a, others = __objRest(_a, [
|
|
67
71
|
"value",
|
|
68
72
|
"defaultValue",
|
|
@@ -76,7 +80,9 @@ const JsonInput = React.forwardRef((props, ref) => {
|
|
|
76
80
|
"classNames",
|
|
77
81
|
"unstyled",
|
|
78
82
|
"readOnly",
|
|
79
|
-
"variant"
|
|
83
|
+
"variant",
|
|
84
|
+
"serialize",
|
|
85
|
+
"deserialize"
|
|
80
86
|
]);
|
|
81
87
|
const { classes, cx } = JsonInput_styles['default'](null, { name: "JsonInput", unstyled, size, variant });
|
|
82
88
|
const [_value, setValue] = hooks.useUncontrolled({
|
|
@@ -85,15 +91,15 @@ const JsonInput = React.forwardRef((props, ref) => {
|
|
|
85
91
|
finalValue: "",
|
|
86
92
|
onChange
|
|
87
93
|
});
|
|
88
|
-
const [valid, setValid] = React.useState(validateJson.validateJson(_value));
|
|
94
|
+
const [valid, setValid] = React.useState(validateJson.validateJson(_value, deserialize));
|
|
89
95
|
const handleFocus = (event) => {
|
|
90
96
|
typeof onFocus === "function" && onFocus(event);
|
|
91
97
|
setValid(true);
|
|
92
98
|
};
|
|
93
99
|
const handleBlur = (event) => {
|
|
94
100
|
typeof onBlur === "function" && onBlur(event);
|
|
95
|
-
const isValid = validateJson.validateJson(event.currentTarget.value);
|
|
96
|
-
isValid && event.currentTarget.value.trim() !== "" && setValue(
|
|
101
|
+
const isValid = validateJson.validateJson(event.currentTarget.value, deserialize);
|
|
102
|
+
isValid && event.currentTarget.value.trim() !== "" && setValue(serialize(deserialize(event.currentTarget.value), null, 2));
|
|
97
103
|
setValid(isValid);
|
|
98
104
|
};
|
|
99
105
|
return /* @__PURE__ */ React__default.createElement(Textarea.Textarea, __spreadValues({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonInput.js","sources":["../../src/JsonInput/JsonInput.tsx"],"sourcesContent":["import React, { forwardRef, useState } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { DefaultProps, useComponentDefaultProps } from '@mantine/styles';\nimport { validateJson } from './validate-json/validate-json';\nimport { Textarea, TextareaProps } from '../Textarea';\nimport { TextInputStylesNames } from '../TextInput';\nimport useStyles from './JsonInput.styles';\n\nexport type JsonInputStylesNames = TextInputStylesNames;\n\nexport interface JsonInputProps\n extends DefaultProps<JsonInputStylesNames>,\n Omit<TextareaProps, 'onChange'> {\n /** Value for controlled input */\n value?: string;\n\n /** Default value for uncontrolled input */\n defaultValue?: string;\n\n /** onChange value for controlled input */\n onChange?(value: string): void;\n\n /** Format json on blur */\n formatOnBlur?: boolean;\n\n /** Error message shown when json is not valid */\n validationError?: React.ReactNode;\n}\n\nconst defaultProps: Partial<JsonInputProps> = {\n formatOnBlur: false,\n size: 'sm',\n};\n\nexport const JsonInput = forwardRef<HTMLTextAreaElement, JsonInputProps>((props, ref) => {\n const {\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n error,\n formatOnBlur,\n size,\n validationError,\n classNames,\n unstyled,\n readOnly,\n variant,\n ...others\n } = useComponentDefaultProps('JsonInput', defaultProps, props);\n\n const { classes, cx } = useStyles(null, { name: 'JsonInput', unstyled, size, variant });\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n onChange,\n });\n\n const [valid, setValid] = useState(validateJson(_value));\n\n const handleFocus = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onFocus === 'function' && onFocus(event);\n setValid(true);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onBlur === 'function' && onBlur(event);\n const isValid = validateJson(event.currentTarget.value);\n formatOnBlur && !readOnly;\n isValid &&\n event.currentTarget.value.trim() !== '' &&\n setValue(
|
|
1
|
+
{"version":3,"file":"JsonInput.js","sources":["../../src/JsonInput/JsonInput.tsx"],"sourcesContent":["import React, { forwardRef, useState } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { DefaultProps, useComponentDefaultProps } from '@mantine/styles';\nimport { validateJson } from './validate-json/validate-json';\nimport { Textarea, TextareaProps } from '../Textarea';\nimport { TextInputStylesNames } from '../TextInput';\nimport useStyles from './JsonInput.styles';\n\nexport type JsonInputStylesNames = TextInputStylesNames;\n\nexport interface JsonInputProps\n extends DefaultProps<JsonInputStylesNames>,\n Omit<TextareaProps, 'onChange'> {\n /** Value for controlled input */\n value?: string;\n\n /** Default value for uncontrolled input */\n defaultValue?: string;\n\n /** onChange value for controlled input */\n onChange?(value: string): void;\n\n /** Format json on blur */\n formatOnBlur?: boolean;\n\n /** Error message shown when json is not valid */\n validationError?: React.ReactNode;\n\n /** Function to serialize value into string, used for value formatting, JSON.stringify by default */\n serialize?: typeof JSON.stringify;\n\n /** Function to deserialize string value, used for value formatting and input json validation, must throw error if string cannot be processed, JSON.parse by default */\n deserialize?: typeof JSON.parse;\n}\n\nconst defaultProps: Partial<JsonInputProps> = {\n formatOnBlur: false,\n size: 'sm',\n serialize: JSON.stringify,\n deserialize: JSON.stringify,\n};\n\nexport const JsonInput = forwardRef<HTMLTextAreaElement, JsonInputProps>((props, ref) => {\n const {\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n error,\n formatOnBlur,\n size,\n validationError,\n classNames,\n unstyled,\n readOnly,\n variant,\n serialize,\n deserialize,\n ...others\n } = useComponentDefaultProps('JsonInput', defaultProps, props);\n\n const { classes, cx } = useStyles(null, { name: 'JsonInput', unstyled, size, variant });\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n onChange,\n });\n\n const [valid, setValid] = useState(validateJson(_value, deserialize));\n\n const handleFocus = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onFocus === 'function' && onFocus(event);\n setValid(true);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onBlur === 'function' && onBlur(event);\n const isValid = validateJson(event.currentTarget.value, deserialize);\n formatOnBlur && !readOnly;\n isValid &&\n event.currentTarget.value.trim() !== '' &&\n setValue(serialize(deserialize(event.currentTarget.value), null, 2));\n setValid(isValid);\n };\n\n return (\n <Textarea\n value={_value}\n onChange={(event) => setValue(event.currentTarget.value)}\n onFocus={handleFocus}\n onBlur={handleBlur}\n error={valid ? error : validationError || true}\n __staticSelector=\"JsonInput\"\n classNames={{ ...classNames, input: cx(classes.input, classNames?.input) }}\n autoComplete=\"nope\"\n ref={ref}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n {...others}\n />\n );\n});\n\nJsonInput.displayName = '@mantine/core/JsonInput';\n"],"names":["forwardRef","useComponentDefaultProps","useStyles","useUncontrolled","useState","validateJson","React","Textarea"],"mappings":";;;;;;;;;;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAAe,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,KAAK,GAAG,IAAI,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAChK,IAAI,cAAc,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK;AAC/B,EAAE,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AAChC,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC;AAClC,MAAM,eAAe,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACxC,EAAE,IAAI,mB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AI,GAAG,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3I,IAAI,YAAY,EAAE,MAAM;AACxB,IAAI,GAAG;AACP,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,IAAI;AACR,IAAI,OAAO;AACX,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AACd,CAAC,EAAE;AACH,SAAS,CAAC,WAAW,GAAG,yBAAyB;;;;"}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
function validateJson(value) {
|
|
5
|
+
function validateJson(value, deserialize) {
|
|
6
6
|
if (typeof value === "string" && value.trim().length === 0) {
|
|
7
7
|
return true;
|
|
8
8
|
}
|
|
9
9
|
try {
|
|
10
|
-
|
|
10
|
+
deserialize(value);
|
|
11
11
|
return true;
|
|
12
12
|
} catch (e) {
|
|
13
13
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-json.js","sources":["../../../src/JsonInput/validate-json/validate-json.ts"],"sourcesContent":["export function validateJson(value: string) {\n if (typeof value === 'string' && value.trim().length === 0) {\n return true;\n }\n\n try {\n
|
|
1
|
+
{"version":3,"file":"validate-json.js","sources":["../../../src/JsonInput/validate-json/validate-json.ts"],"sourcesContent":["export function validateJson(value: string, deserialize: typeof JSON.parse) {\n if (typeof value === 'string' && value.trim().length === 0) {\n return true;\n }\n\n try {\n deserialize(value);\n return true;\n } catch (e) {\n return false;\n }\n}\n"],"names":[],"mappings":";;;;AAAO,SAAS,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE;AACjD,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AAC9D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,IAAI;AACN,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;AACvB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH;;;;"}
|
|
@@ -38,7 +38,9 @@ var __objRest = (source, exclude) => {
|
|
|
38
38
|
};
|
|
39
39
|
const defaultProps = {
|
|
40
40
|
formatOnBlur: false,
|
|
41
|
-
size: "sm"
|
|
41
|
+
size: "sm",
|
|
42
|
+
serialize: JSON.stringify,
|
|
43
|
+
deserialize: JSON.stringify
|
|
42
44
|
};
|
|
43
45
|
const JsonInput = forwardRef((props, ref) => {
|
|
44
46
|
const _a = useComponentDefaultProps("JsonInput", defaultProps, props), {
|
|
@@ -54,7 +56,9 @@ const JsonInput = forwardRef((props, ref) => {
|
|
|
54
56
|
classNames,
|
|
55
57
|
unstyled,
|
|
56
58
|
readOnly,
|
|
57
|
-
variant
|
|
59
|
+
variant,
|
|
60
|
+
serialize,
|
|
61
|
+
deserialize
|
|
58
62
|
} = _a, others = __objRest(_a, [
|
|
59
63
|
"value",
|
|
60
64
|
"defaultValue",
|
|
@@ -68,7 +72,9 @@ const JsonInput = forwardRef((props, ref) => {
|
|
|
68
72
|
"classNames",
|
|
69
73
|
"unstyled",
|
|
70
74
|
"readOnly",
|
|
71
|
-
"variant"
|
|
75
|
+
"variant",
|
|
76
|
+
"serialize",
|
|
77
|
+
"deserialize"
|
|
72
78
|
]);
|
|
73
79
|
const { classes, cx } = useStyles(null, { name: "JsonInput", unstyled, size, variant });
|
|
74
80
|
const [_value, setValue] = useUncontrolled({
|
|
@@ -77,15 +83,15 @@ const JsonInput = forwardRef((props, ref) => {
|
|
|
77
83
|
finalValue: "",
|
|
78
84
|
onChange
|
|
79
85
|
});
|
|
80
|
-
const [valid, setValid] = useState(validateJson(_value));
|
|
86
|
+
const [valid, setValid] = useState(validateJson(_value, deserialize));
|
|
81
87
|
const handleFocus = (event) => {
|
|
82
88
|
typeof onFocus === "function" && onFocus(event);
|
|
83
89
|
setValid(true);
|
|
84
90
|
};
|
|
85
91
|
const handleBlur = (event) => {
|
|
86
92
|
typeof onBlur === "function" && onBlur(event);
|
|
87
|
-
const isValid = validateJson(event.currentTarget.value);
|
|
88
|
-
isValid && event.currentTarget.value.trim() !== "" && setValue(
|
|
93
|
+
const isValid = validateJson(event.currentTarget.value, deserialize);
|
|
94
|
+
isValid && event.currentTarget.value.trim() !== "" && setValue(serialize(deserialize(event.currentTarget.value), null, 2));
|
|
89
95
|
setValid(isValid);
|
|
90
96
|
};
|
|
91
97
|
return /* @__PURE__ */ React.createElement(Textarea, __spreadValues({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonInput.js","sources":["../../src/JsonInput/JsonInput.tsx"],"sourcesContent":["import React, { forwardRef, useState } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { DefaultProps, useComponentDefaultProps } from '@mantine/styles';\nimport { validateJson } from './validate-json/validate-json';\nimport { Textarea, TextareaProps } from '../Textarea';\nimport { TextInputStylesNames } from '../TextInput';\nimport useStyles from './JsonInput.styles';\n\nexport type JsonInputStylesNames = TextInputStylesNames;\n\nexport interface JsonInputProps\n extends DefaultProps<JsonInputStylesNames>,\n Omit<TextareaProps, 'onChange'> {\n /** Value for controlled input */\n value?: string;\n\n /** Default value for uncontrolled input */\n defaultValue?: string;\n\n /** onChange value for controlled input */\n onChange?(value: string): void;\n\n /** Format json on blur */\n formatOnBlur?: boolean;\n\n /** Error message shown when json is not valid */\n validationError?: React.ReactNode;\n}\n\nconst defaultProps: Partial<JsonInputProps> = {\n formatOnBlur: false,\n size: 'sm',\n};\n\nexport const JsonInput = forwardRef<HTMLTextAreaElement, JsonInputProps>((props, ref) => {\n const {\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n error,\n formatOnBlur,\n size,\n validationError,\n classNames,\n unstyled,\n readOnly,\n variant,\n ...others\n } = useComponentDefaultProps('JsonInput', defaultProps, props);\n\n const { classes, cx } = useStyles(null, { name: 'JsonInput', unstyled, size, variant });\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n onChange,\n });\n\n const [valid, setValid] = useState(validateJson(_value));\n\n const handleFocus = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onFocus === 'function' && onFocus(event);\n setValid(true);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onBlur === 'function' && onBlur(event);\n const isValid = validateJson(event.currentTarget.value);\n formatOnBlur && !readOnly;\n isValid &&\n event.currentTarget.value.trim() !== '' &&\n setValue(
|
|
1
|
+
{"version":3,"file":"JsonInput.js","sources":["../../src/JsonInput/JsonInput.tsx"],"sourcesContent":["import React, { forwardRef, useState } from 'react';\nimport { useUncontrolled } from '@mantine/hooks';\nimport { DefaultProps, useComponentDefaultProps } from '@mantine/styles';\nimport { validateJson } from './validate-json/validate-json';\nimport { Textarea, TextareaProps } from '../Textarea';\nimport { TextInputStylesNames } from '../TextInput';\nimport useStyles from './JsonInput.styles';\n\nexport type JsonInputStylesNames = TextInputStylesNames;\n\nexport interface JsonInputProps\n extends DefaultProps<JsonInputStylesNames>,\n Omit<TextareaProps, 'onChange'> {\n /** Value for controlled input */\n value?: string;\n\n /** Default value for uncontrolled input */\n defaultValue?: string;\n\n /** onChange value for controlled input */\n onChange?(value: string): void;\n\n /** Format json on blur */\n formatOnBlur?: boolean;\n\n /** Error message shown when json is not valid */\n validationError?: React.ReactNode;\n\n /** Function to serialize value into string, used for value formatting, JSON.stringify by default */\n serialize?: typeof JSON.stringify;\n\n /** Function to deserialize string value, used for value formatting and input json validation, must throw error if string cannot be processed, JSON.parse by default */\n deserialize?: typeof JSON.parse;\n}\n\nconst defaultProps: Partial<JsonInputProps> = {\n formatOnBlur: false,\n size: 'sm',\n serialize: JSON.stringify,\n deserialize: JSON.stringify,\n};\n\nexport const JsonInput = forwardRef<HTMLTextAreaElement, JsonInputProps>((props, ref) => {\n const {\n value,\n defaultValue,\n onChange,\n onFocus,\n onBlur,\n error,\n formatOnBlur,\n size,\n validationError,\n classNames,\n unstyled,\n readOnly,\n variant,\n serialize,\n deserialize,\n ...others\n } = useComponentDefaultProps('JsonInput', defaultProps, props);\n\n const { classes, cx } = useStyles(null, { name: 'JsonInput', unstyled, size, variant });\n const [_value, setValue] = useUncontrolled({\n value,\n defaultValue,\n finalValue: '',\n onChange,\n });\n\n const [valid, setValid] = useState(validateJson(_value, deserialize));\n\n const handleFocus = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onFocus === 'function' && onFocus(event);\n setValid(true);\n };\n\n const handleBlur = (event: React.FocusEvent<HTMLTextAreaElement>) => {\n typeof onBlur === 'function' && onBlur(event);\n const isValid = validateJson(event.currentTarget.value, deserialize);\n formatOnBlur && !readOnly;\n isValid &&\n event.currentTarget.value.trim() !== '' &&\n setValue(serialize(deserialize(event.currentTarget.value), null, 2));\n setValid(isValid);\n };\n\n return (\n <Textarea\n value={_value}\n onChange={(event) => setValue(event.currentTarget.value)}\n onFocus={handleFocus}\n onBlur={handleBlur}\n error={valid ? error : validationError || true}\n __staticSelector=\"JsonInput\"\n classNames={{ ...classNames, input: cx(classes.input, classNames?.input) }}\n autoComplete=\"nope\"\n ref={ref}\n unstyled={unstyled}\n readOnly={readOnly}\n size={size}\n variant={variant}\n {...others}\n />\n );\n});\n\nJsonInput.displayName = '@mantine/core/JsonInput';\n"],"names":[],"mappings":";;;;;;;AAAA,IAAI,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC;AACtC,IAAI,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AACzC,IAAI,iBAAiB,GAAG,MAAM,CAAC,yBAAyB,CAAC;AACzD,IAAI,mBAAmB,GAAG,MAAM,CAAC,qBAAqB,CAAC;AACvD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC;AACnD,IAAI,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,oBAAoB,CAAC;AACzD,IAAI,eAA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AC,OAAO,CAAC,CAAC;AACtB,GAAG,CAAC;AACJ,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,cAAc,CAAC;AACtE,IAAI,KAAK,EAAE,MAAM;AACjB,IAAI,QAAQ,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC;AAC5D,IAAI,OAAO,EAAE,WAAW;AACxB,IAAI,MAAM,EAAE,UAAU;AACtB,IAAI,KAAK,EAAE,KAAK,GAAG,KAAK,GAAG,eAAe,IAAI,IAAI;AAClD,IAAI,gBAAgB,EAAE,WAAW;AACjC,IAAI,UAAU,EAAE,aAAa,CAAC,cAAc,CAAC,EAAE,EAAE,UAAU,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,UAAU,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3I,IAAI,YAAY,EAAE,MAAM;AACxB,IAAI,GAAG;AACP,IAAI,QAAQ;AACZ,IAAI,QAAQ;AACZ,IAAI,IAAI;AACR,IAAI,OAAO;AACX,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;AACd,CAAC,EAAE;AACH,SAAS,CAAC,WAAW,GAAG,yBAAyB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-json.js","sources":["../../../src/JsonInput/validate-json/validate-json.ts"],"sourcesContent":["export function validateJson(value: string) {\n if (typeof value === 'string' && value.trim().length === 0) {\n return true;\n }\n\n try {\n
|
|
1
|
+
{"version":3,"file":"validate-json.js","sources":["../../../src/JsonInput/validate-json/validate-json.ts"],"sourcesContent":["export function validateJson(value: string, deserialize: typeof JSON.parse) {\n if (typeof value === 'string' && value.trim().length === 0) {\n return true;\n }\n\n try {\n deserialize(value);\n return true;\n } catch (e) {\n return false;\n }\n}\n"],"names":[],"mappings":"AAAO,SAAS,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE;AACjD,EAAE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AAC9D,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,IAAI;AACN,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;AACvB,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,OAAO,KAAK,CAAC;AACjB,GAAG;AACH;;;;"}
|
|
@@ -26,5 +26,5 @@ export interface HorizontalSectionProps extends HorizontalSectionSharedProps, Om
|
|
|
26
26
|
section: 'navbar' | 'aside';
|
|
27
27
|
__staticSelector: string;
|
|
28
28
|
}
|
|
29
|
-
export declare const HorizontalSection: React.ForwardRefExoticComponent<Pick<HorizontalSectionProps, "
|
|
29
|
+
export declare const HorizontalSection: React.ForwardRefExoticComponent<Pick<HorizontalSectionProps, "variant" | "bottom" | "color" | "display" | "height" | "inset" | "left" | "opacity" | "position" | "right" | "top" | "translate" | "width" | "zIndex" | "fixed" | "unstyled" | "dir" | "onChange" | "p" | "slot" | "section" | "style" | "td" | "title" | "key" | "placeholder" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "__staticSelector" | "sx" | "classNames" | "styles" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "py" | "px" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "withBorder" | "hiddenBreakpoint"> & React.RefAttributes<HTMLElement>>;
|
|
30
30
|
//# sourceMappingURL=HorizontalSection.d.ts.map
|
|
@@ -14,6 +14,10 @@ export interface JsonInputProps extends DefaultProps<JsonInputStylesNames>, Omit
|
|
|
14
14
|
formatOnBlur?: boolean;
|
|
15
15
|
/** Error message shown when json is not valid */
|
|
16
16
|
validationError?: React.ReactNode;
|
|
17
|
+
/** Function to serialize value into string, used for value formatting, JSON.stringify by default */
|
|
18
|
+
serialize?: typeof JSON.stringify;
|
|
19
|
+
/** Function to deserialize string value, used for value formatting and input json validation, must throw error if string cannot be processed, JSON.parse by default */
|
|
20
|
+
deserialize?: typeof JSON.parse;
|
|
17
21
|
}
|
|
18
22
|
export declare const JsonInput: React.ForwardRefExoticComponent<JsonInputProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
19
23
|
//# sourceMappingURL=JsonInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonInput.d.ts","sourceRoot":"","sources":["../../src/JsonInput/JsonInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,YAAY,EAA4B,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EAAY,aAAa,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAExD,MAAM,WAAW,cACf,SAAQ,YAAY,CAAC,oBAAoB,CAAC,EACxC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IACjC,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,0CAA0C;IAC1C,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,0BAA0B;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,iDAAiD;IACjD,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"JsonInput.d.ts","sourceRoot":"","sources":["../../src/JsonInput/JsonInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,YAAY,EAA4B,MAAM,iBAAiB,CAAC;AAEzE,OAAO,EAAY,aAAa,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,MAAM,MAAM,oBAAoB,GAAG,oBAAoB,CAAC;AAExD,MAAM,WAAW,cACf,SAAQ,YAAY,CAAC,oBAAoB,CAAC,EACxC,IAAI,CAAC,aAAa,EAAE,UAAU,CAAC;IACjC,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,0CAA0C;IAC1C,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,0BAA0B;IAC1B,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,iDAAiD;IACjD,eAAe,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAElC,oGAAoG;IACpG,SAAS,CAAC,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC;IAElC,uKAAuK;IACvK,WAAW,CAAC,EAAE,OAAO,IAAI,CAAC,KAAK,CAAC;CACjC;AASD,eAAO,MAAM,SAAS,4FA+DpB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function validateJson(value: string): boolean;
|
|
1
|
+
export declare function validateJson(value: string, deserialize: typeof JSON.parse): boolean;
|
|
2
2
|
//# sourceMappingURL=validate-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-json.d.ts","sourceRoot":"","sources":["../../../src/JsonInput/validate-json/validate-json.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"validate-json.d.ts","sourceRoot":"","sources":["../../../src/JsonInput/validate-json/validate-json.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,IAAI,CAAC,KAAK,WAWzE"}
|
|
@@ -28,7 +28,7 @@ export interface ScrollAreaProps extends DefaultProps<ScrollAreaStylesNames, Scr
|
|
|
28
28
|
export declare const _ScrollArea: any;
|
|
29
29
|
export interface ScrollAreaAutosizeProps extends ScrollAreaProps {
|
|
30
30
|
}
|
|
31
|
-
declare const ScrollAreaAutosize: React.ForwardRefExoticComponent<Pick<ScrollAreaAutosizeProps, "
|
|
31
|
+
declare const ScrollAreaAutosize: React.ForwardRefExoticComponent<Pick<ScrollAreaAutosizeProps, "variant" | "bottom" | "color" | "display" | "inset" | "left" | "opacity" | "right" | "top" | "translate" | "unstyled" | "dir" | "onChange" | "p" | "slot" | "style" | "td" | "title" | "key" | "placeholder" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "classNames" | "styles" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "py" | "px" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "type" | "offsetScrollbars" | "scrollbarSize" | "scrollHideDelay" | "viewportRef" | "viewportProps" | "onScrollPositionChange"> & React.RefAttributes<HTMLDivElement>>;
|
|
32
32
|
export declare const ScrollArea: ForwardRefWithStaticComponents<ScrollAreaProps, {
|
|
33
33
|
Autosize: typeof ScrollAreaAutosize;
|
|
34
34
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ScrollAreaProps } from '../../ScrollArea';
|
|
3
|
-
export declare const SelectScrollArea: React.ForwardRefExoticComponent<Pick<ScrollAreaProps, "
|
|
3
|
+
export declare const SelectScrollArea: React.ForwardRefExoticComponent<Pick<ScrollAreaProps, "variant" | "bottom" | "color" | "display" | "inset" | "left" | "opacity" | "right" | "top" | "translate" | "unstyled" | "dir" | "onChange" | "p" | "slot" | "style" | "td" | "title" | "key" | "placeholder" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "classNames" | "styles" | "m" | "my" | "mx" | "mt" | "mb" | "ml" | "mr" | "py" | "px" | "pt" | "pb" | "pl" | "pr" | "bg" | "c" | "ff" | "fz" | "fw" | "lts" | "ta" | "lh" | "fs" | "tt" | "w" | "miw" | "maw" | "h" | "mih" | "mah" | "bgsz" | "bgp" | "bgr" | "bga" | "pos" | "type" | "offsetScrollbars" | "scrollbarSize" | "scrollHideDelay" | "viewportRef" | "viewportProps" | "onScrollPositionChange"> & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
//# sourceMappingURL=SelectScrollArea.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mantine/core",
|
|
3
3
|
"description": "React components library focused on usability, accessibility and developer experience",
|
|
4
|
-
"version": "6.0.0-alpha.
|
|
4
|
+
"version": "6.0.0-alpha.3",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"emotion"
|
|
28
28
|
],
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@mantine/hooks": "6.0.0-alpha.
|
|
30
|
+
"@mantine/hooks": "6.0.0-alpha.3",
|
|
31
31
|
"react": ">=16.8.0",
|
|
32
32
|
"react-dom": ">=16.8.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@mantine/utils": "6.0.0-alpha.
|
|
36
|
-
"@mantine/styles": "6.0.0-alpha.
|
|
35
|
+
"@mantine/utils": "6.0.0-alpha.3",
|
|
36
|
+
"@mantine/styles": "6.0.0-alpha.3",
|
|
37
37
|
"@radix-ui/react-scroll-area": "1.0.2",
|
|
38
38
|
"react-textarea-autosize": "8.3.4",
|
|
39
39
|
"react-remove-scroll": "^2.5.5",
|