xmlui 0.10.10 → 0.10.12
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/{metadata/apiInterceptorWorker-Bb5-fQup.mjs → lib/apiInterceptorWorker-DPgtUtdA.mjs} +5870 -3195
- package/dist/lib/index-CDOoBf2R.mjs +49626 -0
- package/dist/lib/index.css +1 -1
- package/dist/lib/initMock-BAV9RKui.mjs +843 -0
- package/dist/lib/language-server-web-worker.mjs +8 -7
- package/dist/lib/language-server.mjs +6 -6
- package/dist/lib/{metadata-utils-gIOZMGG7.mjs → metadata-utils-D90qqMGc.mjs} +159 -114
- package/dist/lib/scss/components-core/theming/_themes.scss +6 -7
- package/dist/lib/{server-common-BfCSNpXG.mjs → server-common-lmBDLpUh.mjs} +14848 -10785
- package/dist/lib/syntax-monaco.mjs +14 -11
- package/dist/lib/syntax-textmate.d.ts +2 -2
- package/dist/lib/syntax-textmate.mjs +128 -109
- package/dist/lib/transform-bHBjkKSL.mjs +7376 -0
- package/dist/lib/xmlui-parser.d.ts +17 -8
- package/dist/lib/xmlui-parser.mjs +49 -49
- package/dist/lib/xmlui-serializer-DB6BLiXK.mjs +667 -0
- package/dist/lib/xmlui.d.ts +5 -2
- package/dist/lib/xmlui.mjs +43 -43
- package/dist/{lib/apiInterceptorWorker-DH8wqOVq.mjs → metadata/apiInterceptorWorker-BmKP8bnq.mjs} +5432 -3502
- package/dist/metadata/collectedComponentMetadata-Dp8BqWQO.mjs +55444 -0
- package/dist/metadata/initMock-BvEO8W8r.mjs +843 -0
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +3 -3
- package/dist/metadata/xmlui-metadata.umd.js +207 -419
- package/dist/scripts/package.json +3 -1
- package/dist/scripts/src/components/APICall/APICall.js +4 -4
- package/dist/scripts/src/components/Accordion/Accordion.js +1 -1
- package/dist/scripts/src/components/Animation/AnimationNative.js +259 -0
- package/dist/scripts/src/components/App/App.js +10 -0
- package/dist/scripts/src/components/App/AppNative.js +23 -2
- package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +6 -2
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +11 -7
- package/dist/scripts/src/components/Avatar/Avatar.js +1 -1
- package/dist/scripts/src/components/Button/Button.js +1 -1
- package/dist/scripts/src/components/Charts/AreaChart/AreaChart.js +92 -0
- package/dist/scripts/src/components/Charts/AreaChart/AreaChartNative.js +127 -0
- package/dist/scripts/src/components/Charts/BarChart/BarChart.js +6 -6
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +110 -96
- package/dist/scripts/src/components/Charts/LineChart/LineChart.js +5 -5
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +14 -4
- package/dist/scripts/src/components/Charts/RadarChart/RadarChart.js +92 -0
- package/dist/scripts/src/components/Charts/RadarChart/RadarChartNative.js +125 -0
- package/dist/scripts/src/components/Checkbox/Checkbox.js +2 -1
- package/dist/scripts/src/components/ComponentProvider.js +4 -2
- package/dist/scripts/src/components/DataSource/DataSource.js +124 -0
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +1 -1
- package/dist/scripts/src/components/Footer/Footer.js +1 -1
- package/dist/scripts/src/components/Footer/FooterNative.js +1 -1
- package/dist/scripts/src/components/Form/FormNative.js +5 -3
- package/dist/scripts/src/components/FormItem/FormItem.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItemNative.js +0 -9
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +3 -3
- package/dist/scripts/src/components/Heading/Heading.js +83 -28
- package/dist/scripts/src/components/Heading/HeadingNative.js +10 -1
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +1 -1
- package/dist/scripts/src/components/Icon/IconNative.js +24 -6
- package/dist/scripts/src/components/Image/ImageNative.js +13 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialog.js +8 -0
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +5 -3
- package/dist/scripts/src/components/NavLink/NavLink.js +1 -1
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +208 -78
- package/dist/scripts/src/components/Option/Option.js +2 -2
- package/dist/scripts/src/components/Option/OptionNative.js +12 -1
- package/dist/scripts/src/components/RadioGroup/RadioGroup.js +7 -3
- package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +20 -5
- package/dist/scripts/src/components/RadioGroup/RadioItemNative.js +2 -1
- package/dist/scripts/src/components/Select/Select.js +1 -1
- package/dist/scripts/src/components/Select/SelectNative.js +1 -1
- package/dist/scripts/src/components/Spinner/SpinnerNative.js +3 -2
- package/dist/scripts/src/components/Switch/Switch.js +2 -1
- package/dist/scripts/src/components/Table/Table.js +1 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -1
- package/dist/scripts/src/components/Text/Text.js +32 -14
- package/dist/scripts/src/components/Text/TextNative.js +17 -5
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +1 -1
- package/dist/scripts/src/components/Toggle/Toggle.js +2 -2
- package/dist/scripts/src/components/abstractions.js +2 -1
- package/dist/scripts/src/components/collectedComponentMetadata.js +316 -0
- package/dist/scripts/src/components-core/RestApiProxy.js +3 -1
- package/dist/scripts/src/components-core/StandaloneApp.js +823 -0
- package/dist/scripts/src/components-core/markup-check.js +279 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +36 -16
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +4 -1
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +4 -1
- package/dist/scripts/src/components-core/theming/themes/root.js +30 -17
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +14 -7
- package/dist/scripts/src/components-core/xmlui-parser.js +60 -43
- package/dist/scripts/src/index.js +120 -0
- package/dist/scripts/src/parsers/xmlui-parser/syntax-kind.js +9 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +17 -5
- package/dist/standalone/xmlui-standalone.es.d.ts +6 -2
- package/dist/standalone/xmlui-standalone.umd.js +319 -823
- package/package.json +3 -1
- package/src/syntax/textMate/xmlui.tmLanguage.json +2 -2
- package/dist/lib/index-C71PAj7E.mjs +0 -38677
- package/dist/lib/initMock-Bvbl2Pa3.mjs +0 -571
- package/dist/lib/transform-SMWeyMoq.mjs +0 -5391
- package/dist/lib/xmlui-serializer-a0O0jFY-.mjs +0 -497
- package/dist/metadata/collectedComponentMetadata-Dn91__HO.mjs +0 -43087
- package/dist/metadata/initMock-ghNfStAu.mjs +0 -571
- package/dist/scripts/src/components/NumberBox/NumberBox2.js +0 -99
- package/dist/scripts/src/components/NumberBox/NumberBox2Native.js +0 -420
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.12",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@radix-ui/react-tabs": "1.1.0",
|
|
45
45
|
"@radix-ui/react-tooltip": "^1.2.4",
|
|
46
46
|
"@radix-ui/react-visually-hidden": "1.0.3",
|
|
47
|
+
"@react-spring/web": "^10.0.2",
|
|
47
48
|
"@remix-run/react": "2.12.1",
|
|
48
49
|
"@tanstack/react-query": "^4.36.1",
|
|
49
50
|
"@tanstack/react-query-devtools": "^4.36.1",
|
|
@@ -148,6 +149,7 @@
|
|
|
148
149
|
"rollup-plugin-copy": "^3.5.0",
|
|
149
150
|
"rollup-plugin-visualizer": "5.8.3",
|
|
150
151
|
"serve": "14.2.0",
|
|
152
|
+
"terser": "^5.44.0",
|
|
151
153
|
"typescript": "5.7.3",
|
|
152
154
|
"vite": "5.4.19",
|
|
153
155
|
"vite-plugin-dts": "4.5.0",
|
|
@@ -107,10 +107,10 @@ exports.APICallMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
107
107
|
"`$params[0]`, `$params[1]`, etc.)",
|
|
108
108
|
},
|
|
109
109
|
$result: {
|
|
110
|
-
description: "Response data (available in `completedNotificationMessage`
|
|
110
|
+
description: "Response data (available in `completedNotificationMessage`)",
|
|
111
111
|
},
|
|
112
112
|
$error: {
|
|
113
|
-
description: "Error details (available in `errorNotificationMessage`
|
|
113
|
+
description: "Error details (available in `errorNotificationMessage`)",
|
|
114
114
|
},
|
|
115
115
|
},
|
|
116
116
|
apis: {
|
|
@@ -125,6 +125,6 @@ exports.APICallMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
125
125
|
},
|
|
126
126
|
},
|
|
127
127
|
});
|
|
128
|
-
exports.apiCallRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.APICallMd, ({ node, registerComponentApi, uid
|
|
129
|
-
return (0, jsx_runtime_1.jsx)(APICallNative_1.APICallNative, { registerComponentApi: registerComponentApi, node: node, uid: uid });
|
|
128
|
+
exports.apiCallRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.APICallMd, ({ node, registerComponentApi, uid }) => {
|
|
129
|
+
return ((0, jsx_runtime_1.jsx)(APICallNative_1.APICallNative, { registerComponentApi: registerComponentApi, node: node, uid: uid }));
|
|
130
130
|
});
|
|
@@ -77,7 +77,7 @@ exports.AccordionMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
77
77
|
[`paddingHorizontal-header-${COMP}`]: "$space-3",
|
|
78
78
|
[`paddingVertical-header-${COMP}`]: "$space-3",
|
|
79
79
|
[`verticalAlignment-header-${COMP}`]: "center",
|
|
80
|
-
[`fontSize-header-${COMP}`]: "$fontSize-
|
|
80
|
+
[`fontSize-header-${COMP}`]: "$fontSize-base",
|
|
81
81
|
[`fontWeight-header-${COMP}`]: "$fontWeight-normal",
|
|
82
82
|
[`fontFamily-header-${COMP}`]: "$fontFamily",
|
|
83
83
|
[`border-${COMP}`]: "0px solid $borderColor",
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.Animation = exports.parseAnimation = exports.defaultProps = void 0;
|
|
48
|
+
exports.parseAnimationOptions = parseAnimationOptions;
|
|
49
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
50
|
+
const web_1 = require("@react-spring/web");
|
|
51
|
+
const react_1 = __importStar(require("react"));
|
|
52
|
+
const react_2 = require("react");
|
|
53
|
+
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
54
|
+
const lodash_es_1 = require("lodash-es");
|
|
55
|
+
const AnimatedComponent = (0, web_1.animated)((0, react_1.forwardRef)(function InlineComponentDef(props, ref) {
|
|
56
|
+
const { children } = props, rest = __rest(props, ["children"]);
|
|
57
|
+
if (!react_1.default.isValidElement(children)) {
|
|
58
|
+
return children;
|
|
59
|
+
}
|
|
60
|
+
return react_1.default.cloneElement(children, Object.assign(Object.assign({}, rest), { ref }));
|
|
61
|
+
}));
|
|
62
|
+
exports.defaultProps = {
|
|
63
|
+
delay: 0,
|
|
64
|
+
animateWhenInView: false,
|
|
65
|
+
reverse: false,
|
|
66
|
+
loop: false,
|
|
67
|
+
once: false
|
|
68
|
+
};
|
|
69
|
+
const parseAnimation = (animation) => {
|
|
70
|
+
if (typeof animation === 'object') {
|
|
71
|
+
return animation;
|
|
72
|
+
}
|
|
73
|
+
const presetAnimations = {
|
|
74
|
+
fadein: {
|
|
75
|
+
from: { opacity: 0 },
|
|
76
|
+
to: { opacity: 1 }
|
|
77
|
+
},
|
|
78
|
+
fadeout: {
|
|
79
|
+
from: { opacity: 1 },
|
|
80
|
+
to: { opacity: 0 }
|
|
81
|
+
},
|
|
82
|
+
slidein: {
|
|
83
|
+
from: { transform: 'translateX(-100%)' },
|
|
84
|
+
to: { transform: 'translateX(0%)' }
|
|
85
|
+
},
|
|
86
|
+
slideout: {
|
|
87
|
+
from: { transform: 'translateX(0%)' },
|
|
88
|
+
to: { transform: 'translateX(100%)' }
|
|
89
|
+
},
|
|
90
|
+
popin: {
|
|
91
|
+
from: { transform: 'scale(0.8)', opacity: 0 },
|
|
92
|
+
to: { transform: 'scale(1)', opacity: 1 }
|
|
93
|
+
},
|
|
94
|
+
popout: {
|
|
95
|
+
from: { transform: 'scale(1)', opacity: 1 },
|
|
96
|
+
to: { transform: 'scale(0.8)', opacity: 0 }
|
|
97
|
+
},
|
|
98
|
+
flipin: {
|
|
99
|
+
from: { transform: 'rotateY(90deg)', opacity: 0 },
|
|
100
|
+
to: { transform: 'rotateY(0deg)', opacity: 1 }
|
|
101
|
+
},
|
|
102
|
+
flipout: {
|
|
103
|
+
from: { transform: 'rotateY(0deg)', opacity: 1 },
|
|
104
|
+
to: { transform: 'rotateY(90deg)', opacity: 0 }
|
|
105
|
+
},
|
|
106
|
+
rotatein: {
|
|
107
|
+
from: { transform: 'rotate(-180deg)', opacity: 0 },
|
|
108
|
+
to: { transform: 'rotate(0deg)', opacity: 1 }
|
|
109
|
+
},
|
|
110
|
+
rotateout: {
|
|
111
|
+
from: { transform: 'rotate(0deg)', opacity: 1 },
|
|
112
|
+
to: { transform: 'rotate(180deg)', opacity: 0 }
|
|
113
|
+
},
|
|
114
|
+
zoomin: {
|
|
115
|
+
from: { transform: 'scale(0)', opacity: 0 },
|
|
116
|
+
to: { transform: 'scale(1)', opacity: 1 }
|
|
117
|
+
},
|
|
118
|
+
zoomout: {
|
|
119
|
+
from: { transform: 'scale(1)', opacity: 1 },
|
|
120
|
+
to: { transform: 'scale(0)', opacity: 0 }
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
return presetAnimations[animation] || { from: {}, to: {} };
|
|
124
|
+
};
|
|
125
|
+
exports.parseAnimation = parseAnimation;
|
|
126
|
+
/**
|
|
127
|
+
* Helper function to parse a single animation-specific option value.
|
|
128
|
+
*/
|
|
129
|
+
function parseAnimationOptionValue(name, value) {
|
|
130
|
+
switch (name) {
|
|
131
|
+
case "duration":
|
|
132
|
+
case "delay":
|
|
133
|
+
const num = parseInt(value, 10);
|
|
134
|
+
return isNaN(num) ? undefined : num;
|
|
135
|
+
case "animateWhenInView":
|
|
136
|
+
case "reverse":
|
|
137
|
+
case "loop":
|
|
138
|
+
case "once":
|
|
139
|
+
const lowerVal = value.toLowerCase();
|
|
140
|
+
if (lowerVal === "true" || lowerVal === "1" || lowerVal === "yes")
|
|
141
|
+
return true;
|
|
142
|
+
if (lowerVal === "false" || lowerVal === "0" || lowerVal === "no")
|
|
143
|
+
return false;
|
|
144
|
+
return undefined;
|
|
145
|
+
default:
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Parses animation options from a string or object.
|
|
151
|
+
*/
|
|
152
|
+
function parseAnimationOptions(input) {
|
|
153
|
+
if ((0, lodash_es_1.isPlainObject)(input)) {
|
|
154
|
+
return input;
|
|
155
|
+
}
|
|
156
|
+
if (typeof input === "string") {
|
|
157
|
+
const options = {};
|
|
158
|
+
const values = input
|
|
159
|
+
.split(";")
|
|
160
|
+
.map((value) => value.trim())
|
|
161
|
+
.filter((value) => value.length > 0);
|
|
162
|
+
for (const value of values) {
|
|
163
|
+
if (value.includes(":")) {
|
|
164
|
+
const [name, val] = value.split(":").map((part) => part.trim());
|
|
165
|
+
if (name && val) {
|
|
166
|
+
const parsedValue = parseAnimationOptionValue(name, val);
|
|
167
|
+
if (parsedValue !== undefined) {
|
|
168
|
+
options[name] = parsedValue;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
const booleanOptions = ["animateWhenInView", "reverse", "loop", "once"];
|
|
174
|
+
if (booleanOptions.includes(value)) {
|
|
175
|
+
options[value] = true;
|
|
176
|
+
}
|
|
177
|
+
else if (value.startsWith("!") && value.length > 1) {
|
|
178
|
+
const optionName = value.substring(1);
|
|
179
|
+
if (booleanOptions.includes(optionName)) {
|
|
180
|
+
options[optionName] = false;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return options;
|
|
186
|
+
}
|
|
187
|
+
return {};
|
|
188
|
+
}
|
|
189
|
+
exports.Animation = (0, react_1.forwardRef)(function Animation(_a, forwardedRef) {
|
|
190
|
+
var { children, registerComponentApi, animation, duration, onStop, onStart, delay = exports.defaultProps.delay, animateWhenInView = exports.defaultProps.animateWhenInView, reverse = exports.defaultProps.reverse, loop = exports.defaultProps.loop, once = exports.defaultProps.once } = _a, rest = __rest(_a, ["children", "registerComponentApi", "animation", "duration", "onStop", "onStart", "delay", "animateWhenInView", "reverse", "loop", "once"]);
|
|
191
|
+
const [_animation] = (0, react_1.useState)(animation);
|
|
192
|
+
const [toggle, setToggle] = (0, react_1.useState)(false);
|
|
193
|
+
const [reset, setReset] = (0, react_1.useState)(false);
|
|
194
|
+
const [count, setCount] = (0, react_1.useState)(0);
|
|
195
|
+
const times = 1;
|
|
196
|
+
const animationSettings = (0, react_1.useMemo)(() => ({
|
|
197
|
+
from: _animation.from,
|
|
198
|
+
to: _animation.to,
|
|
199
|
+
config: Object.assign(Object.assign({}, _animation.config), { duration }),
|
|
200
|
+
delay,
|
|
201
|
+
loop,
|
|
202
|
+
reset,
|
|
203
|
+
reverse: toggle,
|
|
204
|
+
onRest: () => {
|
|
205
|
+
onStop === null || onStop === void 0 ? void 0 : onStop();
|
|
206
|
+
if (loop) {
|
|
207
|
+
if (reverse) {
|
|
208
|
+
setCount(count + 1);
|
|
209
|
+
setToggle(!toggle);
|
|
210
|
+
}
|
|
211
|
+
setReset(true);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
if (reverse && count < times) {
|
|
215
|
+
setCount(count + 1);
|
|
216
|
+
setToggle(!toggle);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
},
|
|
220
|
+
onStart: () => onStart === null || onStart === void 0 ? void 0 : onStart(),
|
|
221
|
+
}), [
|
|
222
|
+
_animation.config,
|
|
223
|
+
_animation.from,
|
|
224
|
+
_animation.to,
|
|
225
|
+
count,
|
|
226
|
+
delay,
|
|
227
|
+
duration,
|
|
228
|
+
loop,
|
|
229
|
+
onStart,
|
|
230
|
+
onStop,
|
|
231
|
+
reset,
|
|
232
|
+
reverse,
|
|
233
|
+
toggle,
|
|
234
|
+
]);
|
|
235
|
+
const [springs, api] = (0, web_1.useSpring)(() => (Object.assign({}, animationSettings)), [animationSettings]);
|
|
236
|
+
const [ref, animationStyles] = (0, web_1.useInView)(() => animationSettings, {
|
|
237
|
+
once,
|
|
238
|
+
});
|
|
239
|
+
const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, forwardedRef) : forwardedRef;
|
|
240
|
+
const startAnimation = (0, react_2.useCallback)(() => {
|
|
241
|
+
api.start(_animation);
|
|
242
|
+
return () => {
|
|
243
|
+
api.stop();
|
|
244
|
+
};
|
|
245
|
+
}, [_animation, api]);
|
|
246
|
+
const stopAnimation = (0, react_2.useCallback)(() => {
|
|
247
|
+
api.stop();
|
|
248
|
+
}, [api]);
|
|
249
|
+
(0, react_1.useEffect)(() => {
|
|
250
|
+
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
251
|
+
start: startAnimation,
|
|
252
|
+
stop: stopAnimation,
|
|
253
|
+
});
|
|
254
|
+
}, [registerComponentApi, startAnimation, stopAnimation]);
|
|
255
|
+
const content = (0, react_1.useMemo)(() => {
|
|
256
|
+
return react_1.Children.map(children, (child, index) => animateWhenInView ? ((0, jsx_runtime_1.jsx)(AnimatedComponent, Object.assign({}, rest, { style: animationStyles, ref: composedRef, children: child }), index)) : ((0, jsx_runtime_1.jsx)(AnimatedComponent, Object.assign({}, rest, { style: springs, ref: forwardedRef, children: child }), index)));
|
|
257
|
+
}, [animateWhenInView, animationStyles, children, springs, rest]);
|
|
258
|
+
return content;
|
|
259
|
+
});
|
|
@@ -76,6 +76,14 @@ exports.AppMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
76
76
|
valueType: "string",
|
|
77
77
|
defaultValue: AppNative_1.defaultProps.defaultTheme,
|
|
78
78
|
},
|
|
79
|
+
autoDetectTone: {
|
|
80
|
+
description: 'This boolean property enables automatic detection of the system theme preference. ' +
|
|
81
|
+
'When set to true and no defaultTone is specified, the app will automatically use ' +
|
|
82
|
+
'"light" or "dark" tone based on the user\'s system theme setting. The app will ' +
|
|
83
|
+
'also respond to changes in the system theme preference.',
|
|
84
|
+
valueType: "boolean",
|
|
85
|
+
defaultValue: AppNative_1.defaultProps.autoDetectTone,
|
|
86
|
+
},
|
|
79
87
|
},
|
|
80
88
|
events: {
|
|
81
89
|
ready: {
|
|
@@ -298,6 +306,7 @@ function AppNode({ node, extractValue, renderChild, className, lookupEventHandle
|
|
|
298
306
|
logoLight: extractValue(node.props["logo-light"]),
|
|
299
307
|
defaultTone: extractValue(node.props.defaultTone),
|
|
300
308
|
defaultTheme: extractValue(node.props.defaultTheme),
|
|
309
|
+
autoDetectTone: extractValue.asOptionalBoolean(node.props.autoDetectTone, false),
|
|
301
310
|
applyDefaultContentPadding
|
|
302
311
|
}), [
|
|
303
312
|
extractValue,
|
|
@@ -312,6 +321,7 @@ function AppNode({ node, extractValue, renderChild, className, lookupEventHandle
|
|
|
312
321
|
node.props["logo-light"],
|
|
313
322
|
node.props.defaultTone,
|
|
314
323
|
node.props.defaultTheme,
|
|
324
|
+
node.props.autoDetectTone,
|
|
315
325
|
className,
|
|
316
326
|
applyDefaultContentPadding
|
|
317
327
|
]);
|
|
@@ -39,11 +39,12 @@ exports.defaultProps = {
|
|
|
39
39
|
noScrollbarGutters: false,
|
|
40
40
|
defaultTone: undefined,
|
|
41
41
|
defaultTheme: undefined,
|
|
42
|
+
autoDetectTone: false,
|
|
42
43
|
onReady: lodash_es_1.noop,
|
|
43
44
|
onMessageReceived: lodash_es_1.noop,
|
|
44
45
|
};
|
|
45
46
|
function App(_a) {
|
|
46
|
-
var { children, style = constants_1.EMPTY_OBJECT, layout, loggedInUser, scrollWholePage = exports.defaultProps.scrollWholePage, noScrollbarGutters = exports.defaultProps.noScrollbarGutters, onReady = exports.defaultProps.onReady, onMessageReceived = exports.defaultProps.onMessageReceived, header, navPanel, footer, navPanelDef, logoContentDef, logo, logoDark, logoLight, defaultTone, defaultTheme, renderChild, name, className, applyDefaultContentPadding } = _a, rest = __rest(_a, ["children", "style", "layout", "loggedInUser", "scrollWholePage", "noScrollbarGutters", "onReady", "onMessageReceived", "header", "navPanel", "footer", "navPanelDef", "logoContentDef", "logo", "logoDark", "logoLight", "defaultTone", "defaultTheme", "renderChild", "name", "className", "applyDefaultContentPadding"]);
|
|
47
|
+
var { children, style = constants_1.EMPTY_OBJECT, layout, loggedInUser, scrollWholePage = exports.defaultProps.scrollWholePage, noScrollbarGutters = exports.defaultProps.noScrollbarGutters, onReady = exports.defaultProps.onReady, onMessageReceived = exports.defaultProps.onMessageReceived, header, navPanel, footer, navPanelDef, logoContentDef, logo, logoDark, logoLight, defaultTone, defaultTheme, autoDetectTone = exports.defaultProps.autoDetectTone, renderChild, name, className, applyDefaultContentPadding } = _a, rest = __rest(_a, ["children", "style", "layout", "loggedInUser", "scrollWholePage", "noScrollbarGutters", "onReady", "onMessageReceived", "header", "navPanel", "footer", "navPanelDef", "logoContentDef", "logo", "logoDark", "logoLight", "defaultTone", "defaultTheme", "autoDetectTone", "renderChild", "name", "className", "applyDefaultContentPadding"]);
|
|
47
48
|
const { getThemeVar } = (0, ThemeContext_1.useTheme)();
|
|
48
49
|
const { setActiveThemeTone, setActiveThemeId, themes } = (0, ThemeContext_1.useThemes)();
|
|
49
50
|
const mounted = (0, react_1.useRef)(false);
|
|
@@ -62,13 +63,19 @@ function App(_a) {
|
|
|
62
63
|
if (defaultTone === "dark" || defaultTone === "light") {
|
|
63
64
|
setActiveThemeTone(defaultTone);
|
|
64
65
|
}
|
|
66
|
+
else if (autoDetectTone) {
|
|
67
|
+
// Auto-detect system theme preference when no defaultTone is set
|
|
68
|
+
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
69
|
+
const detectedTone = systemPrefersDark ? "dark" : "light";
|
|
70
|
+
setActiveThemeTone(detectedTone);
|
|
71
|
+
}
|
|
65
72
|
if (defaultTheme) {
|
|
66
73
|
setActiveThemeId(defaultTheme);
|
|
67
74
|
}
|
|
68
75
|
return () => {
|
|
69
76
|
mounted.current = false;
|
|
70
77
|
};
|
|
71
|
-
}, [defaultTone, defaultTheme, setActiveThemeTone, setActiveThemeId, themes]);
|
|
78
|
+
}, [defaultTone, defaultTheme, autoDetectTone, setActiveThemeTone, setActiveThemeId, themes]);
|
|
72
79
|
(0, react_1.useEffect)(() => {
|
|
73
80
|
onReady();
|
|
74
81
|
}, [onReady]);
|
|
@@ -81,6 +88,20 @@ function App(_a) {
|
|
|
81
88
|
window.removeEventListener("message", handleMessage);
|
|
82
89
|
};
|
|
83
90
|
}, [onMessageReceived]);
|
|
91
|
+
// Listen for system theme changes when autoDetectTone is enabled
|
|
92
|
+
(0, react_1.useEffect)(() => {
|
|
93
|
+
if (!autoDetectTone || defaultTone)
|
|
94
|
+
return;
|
|
95
|
+
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
|
96
|
+
const handleThemeChange = (e) => {
|
|
97
|
+
const detectedTone = e.matches ? "dark" : "light";
|
|
98
|
+
setActiveThemeTone(detectedTone);
|
|
99
|
+
};
|
|
100
|
+
mediaQuery.addEventListener('change', handleThemeChange);
|
|
101
|
+
return () => {
|
|
102
|
+
mediaQuery.removeEventListener('change', handleThemeChange);
|
|
103
|
+
};
|
|
104
|
+
}, [autoDetectTone, defaultTone, setActiveThemeTone]);
|
|
84
105
|
// --- We don't hide the nav panel if there's no header; in that case, we don't have a show drawer
|
|
85
106
|
// --- button. The exception is the condensed layout because we render a header in that case (otherwise,
|
|
86
107
|
// --- we couldn't show the NavPanel)
|
|
@@ -53,7 +53,7 @@ const AppHeader = (_a) => {
|
|
|
53
53
|
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
54
54
|
registerSubNavPanelSlot === null || registerSubNavPanelSlot === void 0 ? void 0 : registerSubNavPanelSlot(subNavPanelSlot.current);
|
|
55
55
|
}, []);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.header, className), style: style, children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.headerInner, {
|
|
56
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, rest, { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.header, className), style: style, role: "banner", children: (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(AppHeader_module_scss_1.default.headerInner, {
|
|
57
57
|
[AppHeader_module_scss_1.default.full]: !canRestrictContentWidth,
|
|
58
58
|
}), children: [hasRegisteredNavPanel && ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: toggleDrawer, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "hamburger" }), variant: "ghost", className: AppHeader_module_scss_1.default.drawerToggle, style: { color: "inherit", flexShrink: 0 } })), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoAndTitle, children: (showLogo || !navPanelVisible) &&
|
|
59
59
|
(logoContent ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.customLogoContainer, children: logoContent }), safeLogoTitle] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [!!logoUrl && ((0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.logoContainer, children: (0, jsx_runtime_1.jsx)(NavLinkNative_1.NavLink, { to: "/", displayActive: false, className: AppHeader_module_scss_1.default.logoLink, children: (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }) })), safeLogoTitle] }))) }), (0, jsx_runtime_1.jsx)("div", { ref: subNavPanelSlot, className: AppHeader_module_scss_1.default.subNavPanelSlot }), (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.childrenWrapper, children: children }), profileMenu && (0, jsx_runtime_1.jsx)("div", { className: AppHeader_module_scss_1.default.rightItems, children: profileMenu })] }) })));
|
|
@@ -43,6 +43,10 @@ exports.AutoCompleteMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
43
43
|
gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
|
|
44
44
|
lostFocus: (0, metadata_helpers_1.dLostFocus)(COMP),
|
|
45
45
|
didChange: (0, metadata_helpers_1.dDidChange)(COMP),
|
|
46
|
+
itemCreated: {
|
|
47
|
+
description: "This event is triggered when a new item is created by the user " +
|
|
48
|
+
"(if `creatable` is enabled).",
|
|
49
|
+
}
|
|
46
50
|
},
|
|
47
51
|
apis: {
|
|
48
52
|
focus: {
|
|
@@ -80,7 +84,7 @@ exports.AutoCompleteMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
80
84
|
[`backgroundColor-item-${COMP}--active`]: "$backgroundColor-dropdown-item--active",
|
|
81
85
|
[`minHeight-Input`]: "39px",
|
|
82
86
|
[`backgroundColor-${COMP}-badge`]: "$color-primary-500",
|
|
83
|
-
[`fontSize-${COMP}-badge`]: "$fontSize-
|
|
87
|
+
[`fontSize-${COMP}-badge`]: "$fontSize-sm",
|
|
84
88
|
[`borderRadius-${COMP}-badge`]: "$borderRadius",
|
|
85
89
|
[`paddingHorizontal-${COMP}-badge`]: "$space-2",
|
|
86
90
|
[`paddingVertical-${COMP}-badge`]: "$space-1",
|
|
@@ -93,7 +97,7 @@ exports.AutoCompleteMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
93
97
|
},
|
|
94
98
|
});
|
|
95
99
|
exports.autoCompleteComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AutoCompleteMd, ({ node, state, updateState, extractValue, renderChild, lookupEventHandler, registerComponentApi, className, }) => {
|
|
96
|
-
return ((0, jsx_runtime_1.jsx)(AutoCompleteNative_1.AutoComplete, { multi: extractValue.asOptionalBoolean(node.props.multi), className: className, updateState: updateState, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, creatable: extractValue.asOptionalBoolean(node.props.creatable), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), initiallyOpen: extractValue.asOptionalBoolean(node.props.initiallyOpen), optionRenderer: node.props.optionTemplate
|
|
100
|
+
return ((0, jsx_runtime_1.jsx)(AutoCompleteNative_1.AutoComplete, { multi: extractValue.asOptionalBoolean(node.props.multi), className: className, updateState: updateState, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, creatable: extractValue.asOptionalBoolean(node.props.creatable), label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), onItemCreated: lookupEventHandler("itemCreated"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), initiallyOpen: extractValue.asOptionalBoolean(node.props.initiallyOpen), optionRenderer: node.props.optionTemplate
|
|
97
101
|
? (item, val, inTrigger) => {
|
|
98
102
|
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.optionTemplate, item: item, context: {
|
|
99
103
|
$selectedValue: val,
|
|
@@ -30,6 +30,8 @@ const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
|
30
30
|
const react_popover_1 = require("@radix-ui/react-popover");
|
|
31
31
|
const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
|
|
32
32
|
const HiddenOption_1 = require("../Select/HiddenOption");
|
|
33
|
+
const parts_1 = require("../../components-core/parts");
|
|
34
|
+
const PART_LIST_WRAPPER = "listWrapper";
|
|
33
35
|
function isOptionsExist(options, newOptions) {
|
|
34
36
|
return newOptions.some((option) => Array.from(options).some((o) => o.value === option.value || o.label === option.label));
|
|
35
37
|
}
|
|
@@ -45,10 +47,11 @@ exports.defaultProps = {
|
|
|
45
47
|
onDidChange: constants_1.noop,
|
|
46
48
|
onFocus: constants_1.noop,
|
|
47
49
|
onBlur: constants_1.noop,
|
|
50
|
+
onItemCreated: constants_1.noop,
|
|
48
51
|
initiallyOpen: false,
|
|
49
52
|
};
|
|
50
53
|
exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forwardedRef) {
|
|
51
|
-
var { id, initialValue, value, enabled = exports.defaultProps.enabled, placeholder, updateState = exports.defaultProps.updateState, validationStatus = exports.defaultProps.validationStatus, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, registerComponentApi, emptyListTemplate, style, className, children, readOnly = exports.defaultProps.readOnly, autoFocus = exports.defaultProps.autoFocus, dropdownHeight, multi = exports.defaultProps.multi, label, labelPosition, labelWidth, labelBreak, required = exports.defaultProps.required, creatable = exports.defaultProps.creatable, optionRenderer, initiallyOpen = exports.defaultProps.initiallyOpen } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "placeholder", "updateState", "validationStatus", "onDidChange", "onFocus", "onBlur", "registerComponentApi", "emptyListTemplate", "style", "className", "children", "readOnly", "autoFocus", "dropdownHeight", "multi", "label", "labelPosition", "labelWidth", "labelBreak", "required", "creatable", "optionRenderer", "initiallyOpen"]);
|
|
54
|
+
var { id, initialValue, value, enabled = exports.defaultProps.enabled, placeholder, updateState = exports.defaultProps.updateState, validationStatus = exports.defaultProps.validationStatus, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, onItemCreated = exports.defaultProps.onItemCreated, registerComponentApi, emptyListTemplate, style, className, children, readOnly = exports.defaultProps.readOnly, autoFocus = exports.defaultProps.autoFocus, dropdownHeight, multi = exports.defaultProps.multi, label, labelPosition, labelWidth, labelBreak, required = exports.defaultProps.required, creatable = exports.defaultProps.creatable, optionRenderer, initiallyOpen = exports.defaultProps.initiallyOpen } = _a, rest = __rest(_a, ["id", "initialValue", "value", "enabled", "placeholder", "updateState", "validationStatus", "onDidChange", "onFocus", "onBlur", "onItemCreated", "registerComponentApi", "emptyListTemplate", "style", "className", "children", "readOnly", "autoFocus", "dropdownHeight", "multi", "label", "labelPosition", "labelWidth", "labelBreak", "required", "creatable", "optionRenderer", "initiallyOpen"]);
|
|
52
55
|
const [referenceElement, setReferenceElement] = (0, react_1.useState)(null);
|
|
53
56
|
const inputRef = (0, react_1.useRef)(null);
|
|
54
57
|
const [open, setOpen] = (0, react_1.useState)(initiallyOpen);
|
|
@@ -114,7 +117,7 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
114
117
|
updateState({ value: newSelectedValue });
|
|
115
118
|
onDidChange(newSelectedValue);
|
|
116
119
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
117
|
-
}, [multi, value, updateState, onDidChange
|
|
120
|
+
}, [multi, value, updateState, onDidChange]);
|
|
118
121
|
(0, react_1.useEffect)(() => {
|
|
119
122
|
if (!Array.isArray(selectedValue)) {
|
|
120
123
|
setInputValue((selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label) || "");
|
|
@@ -144,7 +147,7 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
144
147
|
const focus = (0, react_1.useCallback)(() => {
|
|
145
148
|
var _a;
|
|
146
149
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
147
|
-
}, [inputRef
|
|
150
|
+
}, [inputRef]);
|
|
148
151
|
const setValue = (0, misc_1.useEvent)((newValue) => {
|
|
149
152
|
updateState({ value: newValue });
|
|
150
153
|
});
|
|
@@ -183,7 +186,7 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
183
186
|
if (extendedValue.toLowerCase().includes(search.toLowerCase()))
|
|
184
187
|
return 1;
|
|
185
188
|
return 0;
|
|
186
|
-
}, children: [(0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { id: inputId, ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, className: className, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)("div", { id:
|
|
189
|
+
}, children: [(0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, Object.assign({}, rest, { id: inputId, ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, className: className, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { asChild: true, children: (0, jsx_runtime_1.jsxs)("div", { "data-part-id": PART_LIST_WRAPPER, ref: setReferenceElement, style: Object.assign({ width: "100%" }, style), className: (0, classnames_1.default)(className, AutoComplete_module_scss_1.default.badgeListWrapper, AutoComplete_module_scss_1.default[validationStatus], {
|
|
187
190
|
[AutoComplete_module_scss_1.default.disabled]: !enabled,
|
|
188
191
|
[AutoComplete_module_scss_1.default.focused]: isFocused,
|
|
189
192
|
}), children: [Array.isArray(selectedValue) && ((0, jsx_runtime_1.jsx)("div", { className: AutoComplete_module_scss_1.default.badgeList, children: selectedValue.map((v, index) => ((0, jsx_runtime_1.jsxs)("span", { className: AutoComplete_module_scss_1.default.badge, children: [v === null || v === void 0 ? void 0 : v.label, !readOnly && ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close", size: "sm", onClick: (event) => {
|
|
@@ -215,7 +218,7 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
215
218
|
if (event.key === "Enter") {
|
|
216
219
|
setOpen((prev) => !prev);
|
|
217
220
|
}
|
|
218
|
-
}, id: id, readOnly: readOnly, autoFocus: autoFocus, ref: inputRef, value: inputValue, disabled: !enabled, onValueChange: (value) => {
|
|
221
|
+
}, id: inputId, "data-part-id": parts_1.PART_INPUT, readOnly: readOnly, autoFocus: autoFocus, "aria-expanded": open, ref: inputRef, value: inputValue, disabled: !enabled, onValueChange: (value) => {
|
|
219
222
|
setOpen(true);
|
|
220
223
|
setInputValue(value);
|
|
221
224
|
setSearchTerm(value);
|
|
@@ -226,9 +229,9 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete(_a, forward
|
|
|
226
229
|
if (readOnly)
|
|
227
230
|
return;
|
|
228
231
|
setOpen(!open);
|
|
229
|
-
}, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] })] }) }) })), open && ((0, jsx_runtime_1.jsx)(react_popover_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { asChild: true, style: { width, height: dropdownHeight }, className: AutoComplete_module_scss_1.default.popoverContent, align: "start", onOpenAutoFocus: (e) => e.preventDefault(), children: (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { role: "listbox", className: AutoComplete_module_scss_1.default.commandList, style: { height: dropdownHeight }, children: [(0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode }), creatable && (0, jsx_runtime_1.jsx)(CreatableItem, {}), (0, jsx_runtime_1.jsx)(cmdk_1.CommandGroup, { children: Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(AutoCompleteOption, { value: value, label: label, enabled: enabled, keywords: keywords, readOnly: readOnly }, value))) })] }) }) }))] }) }), children] }) }) }));
|
|
232
|
+
}, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] })] }) }) })), open && ((0, jsx_runtime_1.jsx)(react_popover_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { asChild: true, style: { width, height: dropdownHeight }, className: AutoComplete_module_scss_1.default.popoverContent, align: "start", onOpenAutoFocus: (e) => e.preventDefault(), children: (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { role: "listbox", className: AutoComplete_module_scss_1.default.commandList, style: { height: dropdownHeight }, children: [(0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode }), creatable && (0, jsx_runtime_1.jsx)(CreatableItem, { onNewItem: onItemCreated }), (0, jsx_runtime_1.jsx)(cmdk_1.CommandGroup, { children: Array.from(options).map(({ value, label, enabled, keywords }) => ((0, jsx_runtime_1.jsx)(AutoCompleteOption, { value: value, label: label, enabled: enabled, keywords: keywords, readOnly: readOnly }, value))) })] }) }) }))] }) }), children] }) }) }));
|
|
230
233
|
});
|
|
231
|
-
function CreatableItem() {
|
|
234
|
+
function CreatableItem({ onNewItem }) {
|
|
232
235
|
const { value, options, inputValue, onChange, setOpen } = (0, AutoCompleteContext_1.useAutoComplete)();
|
|
233
236
|
const { onOptionAdd } = (0, OptionContext_1.useOption)();
|
|
234
237
|
if (isOptionsExist(options, [{ value: inputValue, label: inputValue }]) ||
|
|
@@ -242,6 +245,7 @@ function CreatableItem() {
|
|
|
242
245
|
}, onSelect: (value) => {
|
|
243
246
|
const newOption = { value, label: value, enabled: true };
|
|
244
247
|
onOptionAdd(newOption);
|
|
248
|
+
onNewItem === null || onNewItem === void 0 ? void 0 : onNewItem(value);
|
|
245
249
|
onChange(value);
|
|
246
250
|
setOpen(false);
|
|
247
251
|
}, children: `Create "${inputValue}"` }));
|
|
@@ -51,5 +51,5 @@ exports.AvatarMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
51
51
|
});
|
|
52
52
|
exports.avatarComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AvatarMd, ({ node, extractValue, lookupEventHandler, className, extractResourceUrl }) => {
|
|
53
53
|
var _a;
|
|
54
|
-
return ((0, jsx_runtime_1.jsx)(AvatarNative_1.Avatar, { className: className, size: (_a = node.props) === null || _a === void 0 ? void 0 : _a.size, url: extractResourceUrl(node.props.url), name: extractValue(node.props.name), onClick: lookupEventHandler("click") }));
|
|
54
|
+
return ((0, jsx_runtime_1.jsx)(AvatarNative_1.Avatar, { className: className, size: (_a = node.props) === null || _a === void 0 ? void 0 : _a.size, url: node.props.url ? extractResourceUrl(node.props.url) : undefined, name: extractValue(node.props.name), onClick: lookupEventHandler("click") }));
|
|
55
55
|
});
|
|
@@ -101,7 +101,7 @@ exports.ButtonMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
101
101
|
[`width-${COMP}`]: "fit-content",
|
|
102
102
|
[`height-${COMP}`]: "fit-content",
|
|
103
103
|
[`borderRadius-${COMP}`]: "$borderRadius",
|
|
104
|
-
[`fontSize-${COMP}`]: "$fontSize-
|
|
104
|
+
[`fontSize-${COMP}`]: "$fontSize-sm",
|
|
105
105
|
[`fontWeight-${COMP}`]: "$fontWeight-medium",
|
|
106
106
|
[`backgroundColor-${COMP}-primary`]: "$color-primary-500",
|
|
107
107
|
[`backgroundColor-${COMP}-attention`]: "$backgroundColor-attention",
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areaChartComponentRenderer = exports.AreaChartMd = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const AreaChartNative_1 = require("./AreaChartNative");
|
|
6
|
+
const renderers_1 = require("../../../components-core/renderers");
|
|
7
|
+
const metadata_helpers_1 = require("../../metadata-helpers");
|
|
8
|
+
const container_helpers_1 = require("../../container-helpers");
|
|
9
|
+
const COMP = "AreaChart";
|
|
10
|
+
exports.AreaChartMd = (0, metadata_helpers_1.createMetadata)({
|
|
11
|
+
status: "experimental",
|
|
12
|
+
description: "Interactive area chart for showing data trends over time with filled areas under the curve",
|
|
13
|
+
docFolder: "Charts/AreaChart",
|
|
14
|
+
props: {
|
|
15
|
+
data: {
|
|
16
|
+
description: "This property is used to provide the component with data to display. " +
|
|
17
|
+
"The data needs to be an array of objects.",
|
|
18
|
+
},
|
|
19
|
+
dataKeys: {
|
|
20
|
+
description: "This property specifies the keys in the data objects that should be used for rendering the chart elements. " +
|
|
21
|
+
"E.g. 'value' or 'amount'.",
|
|
22
|
+
valueType: "string",
|
|
23
|
+
},
|
|
24
|
+
nameKey: {
|
|
25
|
+
description: "Specifies the key in the data objects that will be used to label the different data series.",
|
|
26
|
+
valueType: "string",
|
|
27
|
+
},
|
|
28
|
+
hideX: {
|
|
29
|
+
description: "Determines whether the X-axis should be hidden. If set to `true`, the axis will not be rendered.",
|
|
30
|
+
valueType: "boolean",
|
|
31
|
+
defaultValue: AreaChartNative_1.defaultProps.hideX,
|
|
32
|
+
},
|
|
33
|
+
hideY: {
|
|
34
|
+
description: "Determines whether the Y-axis should be hidden. If set to `true`, the axis will not be rendered.",
|
|
35
|
+
valueType: "boolean",
|
|
36
|
+
defaultValue: AreaChartNative_1.defaultProps.hideY,
|
|
37
|
+
},
|
|
38
|
+
hideTickX: {
|
|
39
|
+
description: "Determines whether the X-axis tick labels should be hidden. If set to `true`, the tick labels will not be rendered.",
|
|
40
|
+
valueType: "boolean",
|
|
41
|
+
defaultValue: AreaChartNative_1.defaultProps.hideTickX,
|
|
42
|
+
},
|
|
43
|
+
hideTickY: {
|
|
44
|
+
description: "Determines whether the Y-axis tick labels should be hidden. If set to `true`, the tick labels will not be rendered.",
|
|
45
|
+
valueType: "boolean",
|
|
46
|
+
defaultValue: AreaChartNative_1.defaultProps.hideTickY,
|
|
47
|
+
},
|
|
48
|
+
hideTooltip: {
|
|
49
|
+
description: "Determines whether the tooltip should be hidden. If set to `true`, the tooltip will not be rendered.",
|
|
50
|
+
valueType: "boolean",
|
|
51
|
+
defaultValue: AreaChartNative_1.defaultProps.hideTooltip,
|
|
52
|
+
},
|
|
53
|
+
showLegend: {
|
|
54
|
+
description: "Determines whether the legend should be shown. If set to `true`, the legend will be rendered.",
|
|
55
|
+
valueType: "boolean",
|
|
56
|
+
defaultValue: AreaChartNative_1.defaultProps.showLegend,
|
|
57
|
+
},
|
|
58
|
+
stacked: {
|
|
59
|
+
description: "Determines whether multiple areas should be stacked on top of each other. If set to `true`, areas will be stacked.",
|
|
60
|
+
valueType: "boolean",
|
|
61
|
+
defaultValue: AreaChartNative_1.defaultProps.stacked,
|
|
62
|
+
},
|
|
63
|
+
curved: {
|
|
64
|
+
description: "Determines whether the area lines should be curved (smooth) or straight. If set to `true`, lines will be curved.",
|
|
65
|
+
valueType: "boolean",
|
|
66
|
+
defaultValue: AreaChartNative_1.defaultProps.curved,
|
|
67
|
+
},
|
|
68
|
+
tooltipTemplate: {
|
|
69
|
+
description: "This property allows replacing the default template to display a tooltip.",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
events: {
|
|
73
|
+
// Standard chart events - customize based on chart type
|
|
74
|
+
},
|
|
75
|
+
apis: {
|
|
76
|
+
// Chart-specific APIs if needed
|
|
77
|
+
},
|
|
78
|
+
contextVars: {
|
|
79
|
+
// Add context variables if needed
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
// Component renderer
|
|
83
|
+
exports.areaChartComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AreaChartMd, ({ extractValue, node, className, lookupSyncCallback, renderChild }) => {
|
|
84
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)(AreaChartNative_1.AreaChart, { className: className, tickFormatterX: lookupSyncCallback((_a = node.props) === null || _a === void 0 ? void 0 : _a.tickFormatterX), tickFormatterY: lookupSyncCallback((_b = node.props) === null || _b === void 0 ? void 0 : _b.tickFormatterY), data: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.data), nameKey: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.nameKey), dataKeys: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.dataKeys), hideX: extractValue.asOptionalBoolean((_f = node.props) === null || _f === void 0 ? void 0 : _f.hideX), hideY: extractValue.asOptionalBoolean((_g = node.props) === null || _g === void 0 ? void 0 : _g.hideY), hideTickX: extractValue.asOptionalBoolean((_h = node.props) === null || _h === void 0 ? void 0 : _h.hideTickX), hideTickY: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.hideTickY), hideTooltip: extractValue.asOptionalBoolean((_k = node.props) === null || _k === void 0 ? void 0 : _k.hideTooltip), showLegend: extractValue.asOptionalBoolean((_l = node.props) === null || _l === void 0 ? void 0 : _l.showLegend), stacked: extractValue.asOptionalBoolean((_m = node.props) === null || _m === void 0 ? void 0 : _m.stacked), curved: extractValue.asOptionalBoolean((_o = node.props) === null || _o === void 0 ? void 0 : _o.curved), tooltipRenderer: node.props.tooltipTemplate
|
|
86
|
+
? (tooltipData) => {
|
|
87
|
+
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.tooltipTemplate, item: tooltipData, contextVars: {
|
|
88
|
+
$tooltip: tooltipData,
|
|
89
|
+
}, renderChild: renderChild }));
|
|
90
|
+
}
|
|
91
|
+
: undefined, children: renderChild(node.children) }));
|
|
92
|
+
});
|