xmlui 0.9.76 → 0.9.78

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.
Files changed (30) hide show
  1. package/dist/lib/{index-mdlNmhj_.mjs → index-j0JcJZMC.mjs} +11664 -11434
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-BXQ0HzU7.mjs → initMock-Co9BqeUA.mjs} +1 -1
  4. package/dist/lib/language-server-web-worker.mjs +1 -1
  5. package/dist/lib/language-server.mjs +1 -1
  6. package/dist/lib/{server-common-CfdMYx46.mjs → server-common-LUcdzTQs.mjs} +4433 -4463
  7. package/dist/lib/xmlui.d.ts +23 -0
  8. package/dist/lib/xmlui.mjs +1 -1
  9. package/dist/metadata/{collectedComponentMetadata-CWaLbEQz.mjs → collectedComponentMetadata-tSxX8HKm.mjs} +10688 -10458
  10. package/dist/metadata/{initMock-BLnKtG1C.mjs → initMock-B7VL6XTr.mjs} +1 -1
  11. package/dist/metadata/style.css +1 -1
  12. package/dist/metadata/xmlui-metadata.mjs +1 -1
  13. package/dist/metadata/xmlui-metadata.umd.js +99 -99
  14. package/dist/scripts/package.json +1 -1
  15. package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +63 -19
  16. package/dist/scripts/src/components/ComponentProvider.js +2 -0
  17. package/dist/scripts/src/components/IconProvider.js +6 -4
  18. package/dist/scripts/src/components/Input/InputAdornment.js +4 -2
  19. package/dist/scripts/src/components/Link/LinkNative.js +2 -47
  20. package/dist/scripts/src/components/Markdown/MarkdownNative.js +89 -42
  21. package/dist/scripts/src/components/NestedApp/NestedApp.js +2 -0
  22. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +1 -1
  23. package/dist/scripts/src/components/TextBox/TextBox.js +16 -1
  24. package/dist/scripts/src/components/TextBox/TextBoxNative.js +12 -2
  25. package/dist/scripts/src/components/ToneSwitch/ToneSwitch.js +51 -0
  26. package/dist/scripts/src/components/ToneSwitch/ToneSwitchNative.js +29 -0
  27. package/dist/scripts/src/components-core/rendering/AppContent.js +65 -5
  28. package/dist/standalone/xmlui-standalone.es.d.ts +26 -0
  29. package/dist/standalone/xmlui-standalone.umd.js +241 -241
  30. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmlui",
3
- "version": "0.9.76",
3
+ "version": "0.9.78",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "start-test-bed": "cd src/testing/infrastructure && xmlui start",
@@ -117,10 +117,11 @@ function BarChart({ data = [], layout = exports.defaultProps.layout, nameKey, st
117
117
  const [tickAnchor, setTickAnchor] = (0, react_1.useState)("middle");
118
118
  const [miniMode, setMiniMode] = (0, react_1.useState)(false);
119
119
  const [yAxisWidth, setYAxisWidth] = (0, react_1.useState)(40);
120
+ const wrapperRef = (0, react_1.useRef)(null);
120
121
  (0, react_1.useEffect)(() => {
121
122
  const calc = () => {
122
123
  var _a, _b, _c, _d, _e;
123
- const width = ((_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 800;
124
+ const width = ((_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.offsetWidth) || 800;
124
125
  const spans = ((_b = labelsRef.current) === null || _b === void 0 ? void 0 : _b.querySelectorAll("span")) || [];
125
126
  const yTicks = Array.from(document.querySelectorAll(".recharts-y-axis .recharts-layer tspan"));
126
127
  const maxYTickWidth = yTicks.length > 0 ? Math.max(...yTicks.map((t) => t.getBBox().width)) : 40;
@@ -159,12 +160,12 @@ function BarChart({ data = [], layout = exports.defaultProps.layout, nameKey, st
159
160
  bottomMargin = Math.max(xAxisH, maxXTickHeight);
160
161
  }
161
162
  setChartMargin({ left: leftMargin, right: rightMargin, top: 10, bottom: bottomMargin });
162
- const chartHeight = ((_c = containerRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) || 300;
163
+ const chartHeight = ((_c = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _c === void 0 ? void 0 : _c.offsetHeight) || 300;
163
164
  const maxYTicks = Math.max(2, Math.floor(chartHeight / (fontSize * 3)));
164
165
  setYTickCount(maxYTicks);
165
166
  setXAxisHeight(Math.ceil(fontSize));
166
- const containerHeight = ((_d = containerRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
167
- const containerWidth = ((_e = containerRef.current) === null || _e === void 0 ? void 0 : _e.offsetWidth) || 0;
167
+ const containerHeight = ((_d = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _d === void 0 ? void 0 : _d.offsetHeight) || 0;
168
+ const containerWidth = ((_e = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _e === void 0 ? void 0 : _e.offsetWidth) || 0;
168
169
  const neededHeight = 10 + xAxisHeight + 10 + 32;
169
170
  const neededWidth = chartMargin.left + chartMargin.right + yAxisWidth + 32;
170
171
  setMiniMode(neededHeight > containerHeight || neededWidth > containerWidth);
@@ -172,21 +173,64 @@ function BarChart({ data = [], layout = exports.defaultProps.layout, nameKey, st
172
173
  calc();
173
174
  window.addEventListener("resize", calc);
174
175
  return () => window.removeEventListener("resize", calc);
175
- }, [data, xAxisHeight]);
176
+ }, [data]);
177
+ const containerSize = (0, react_2.useMemo)(() => {
178
+ const parseSize = (value) => {
179
+ if (!value)
180
+ return "100%";
181
+ if (value.endsWith("px")) {
182
+ return parseInt(value, 10);
183
+ }
184
+ return value;
185
+ };
186
+ const width = parseSize(style === null || style === void 0 ? void 0 : style.width);
187
+ const height = parseSize(style === null || style === void 0 ? void 0 : style.height);
188
+ return {
189
+ width,
190
+ height,
191
+ };
192
+ }, [style === null || style === void 0 ? void 0 : style.width, style === null || style === void 0 ? void 0 : style.height]);
193
+ const content = (0, react_2.useMemo)(() => {
194
+ const auto = (style === null || style === void 0 ? void 0 : style.width) === "*" || (style === null || style === void 0 ? void 0 : style.height) === "*";
195
+ const chart = ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { ref: containerRef, minWidth: 60, minHeight: 60, debounce: 100, width: auto ? "100%" : containerSize.width, height: auto ? "100%" : containerSize.height, children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { style: style, accessibilityLayer: true, data: data, layout: layout, margin: miniMode ? { left: 0, right: 0, top: 0, bottom: 0 } : chartMargin, children: [(0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { vertical: true, strokeDasharray: "3 3" }), layout === "vertical" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(recharts_1.XAxis, { type: "number", axisLine: false, hide: miniMode || hideX, tickFormatter: miniMode ? undefined : tickFormatterX, tick: miniMode ? false : { fill: "currentColor", fontSize } }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { hide: miniMode || hideY, dataKey: nameKey, type: "category", interval: "equidistantPreserveStart", tickLine: false, tickFormatter: miniMode ? undefined : tickFormatterY, tick: miniMode ? false : !hideTickX && { fill: "currentColor", fontSize } })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: nameKey, type: "category", interval: interval, tickLine: false, angle: tickAngle, textAnchor: tickAnchor, tick: miniMode ? false : !hideTickX && { fill: "currentColor", fontSize }, tickFormatter: miniMode ? undefined : tickFormatterX, height: miniMode || hideX ? 0 : xAxisHeight, hide: miniMode || hideX }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { type: "number", axisLine: false, tick: miniMode ? false : !hideTickY && { fill: "currentColor", fontSize }, hide: miniMode || hideY, tickCount: yTickCount, tickFormatter: miniMode ? undefined : tickFormatterY, width: miniMode || hideY || hideTickY ? 0 : 40 })] })), !miniMode && (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { content: (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, {}) }), Object.keys(config).map((key, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { dataKey: key, fill: config[key].color, radius: stacked ? 0 : 8, stackId: stacked ? "stacked" : undefined, strokeWidth: 1 }, index))), showLegend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, { wrapperStyle: {
196
+ bottom: 0,
197
+ left: 0,
198
+ right: 0,
199
+ margin: "0 auto",
200
+ width: "100%",
201
+ textAlign: "center",
202
+ } }))] }) }));
203
+ return auto ? ((0, jsx_runtime_1.jsx)("div", { ref: wrapperRef, style: {
204
+ flexGrow: 1,
205
+ width: containerSize.width,
206
+ height: containerSize.height,
207
+ padding: 0,
208
+ margin: 0,
209
+ }, children: chart })) : (chart);
210
+ }, [
211
+ data,
212
+ layout,
213
+ nameKey,
214
+ stacked,
215
+ dataKeys,
216
+ style,
217
+ miniMode,
218
+ chartMargin,
219
+ interval,
220
+ tickAngle,
221
+ tickAnchor,
222
+ xAxisHeight,
223
+ hideX,
224
+ hideY,
225
+ hideTickX,
226
+ hideTickY,
227
+ tickFormatterX,
228
+ tickFormatterY,
229
+ yTickCount,
230
+ showLegend,
231
+ config,
232
+ ]);
176
233
  return ((0, jsx_runtime_1.jsxs)(ChartProvider_1.default, { value: chartContextValue, children: [children, (0, jsx_runtime_1.jsx)("div", { ref: labelsRef, style: { position: "absolute", visibility: "hidden", height: 0, overflow: "hidden" }, children: data
177
234
  .map((d) => d[nameKey])
178
- .map((label, idx) => ((0, jsx_runtime_1.jsx)("span", { style: { fontSize: 12, whiteSpace: "nowrap" }, children: label }, idx))) }), (0, jsx_runtime_1.jsx)("div", { style: {
179
- flexGrow: 1,
180
- width: style.width || "100%",
181
- height: style.height || "100%",
182
- padding: 0,
183
- margin: 0,
184
- }, children: (0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, { style: style, ref: containerRef, width: "100%", height: "100%", debounce: 100, children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, { accessibilityLayer: true, data: data, layout: layout, margin: miniMode ? { left: 0, right: 0, top: 0, bottom: 0 } : chartMargin, children: [(0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, { vertical: true, strokeDasharray: "3 3" }), layout === "vertical" ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(recharts_1.XAxis, { type: "number", axisLine: false, hide: miniMode || hideX, tickFormatter: miniMode ? undefined : tickFormatterX, tick: miniMode ? false : { fill: "currentColor", fontSize } }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { hide: miniMode || hideY, dataKey: nameKey, type: "category", interval: "equidistantPreserveStart", tickLine: false, tickFormatter: miniMode ? undefined : tickFormatterY, tick: miniMode ? false : !hideTickX && { fill: "currentColor", fontSize } })] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(recharts_1.XAxis, { dataKey: nameKey, type: "category", interval: interval, tickLine: false, angle: tickAngle, textAnchor: tickAnchor, tick: miniMode ? false : !hideTickX && { fill: "currentColor", fontSize }, tickFormatter: miniMode ? undefined : tickFormatterX, height: miniMode || hideX ? 0 : xAxisHeight, hide: miniMode || hideX }), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, { type: "number", axisLine: false, tick: miniMode ? false : !hideTickY && { fill: "currentColor", fontSize }, hide: miniMode || hideY, tickCount: yTickCount, tickFormatter: miniMode ? undefined : tickFormatterY, width: miniMode || hideY || hideTickY ? 0 : 40 })] })), !miniMode && (0, jsx_runtime_1.jsx)(recharts_1.Tooltip, { content: (0, jsx_runtime_1.jsx)(TooltipContent_1.TooltipContent, {}) }), Object.keys(config).map((key, index) => ((0, jsx_runtime_1.jsx)(recharts_1.Bar, { dataKey: key, fill: config[key].color, radius: stacked ? 0 : 8, stackId: stacked ? "stacked" : undefined, strokeWidth: 1 }, index))), showLegend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, { wrapperStyle: {
185
- bottom: 0,
186
- left: 0,
187
- right: 0,
188
- margin: "0 auto",
189
- width: "100%",
190
- textAlign: "center",
191
- } }))] }) }) })] }));
235
+ .map((label, idx) => ((0, jsx_runtime_1.jsx)("span", { style: { fontSize: 12, whiteSpace: "nowrap" }, children: label }, idx))) }), content] }));
192
236
  }
@@ -93,6 +93,7 @@ const CarouselItem_1 = require("./Carousel/CarouselItem");
93
93
  const renderers_1 = require("../components-core/renderers");
94
94
  const Breakout_1 = require("./Breakout/Breakout");
95
95
  const ToneChangerButton_1 = require("./ToneChangerButton/ToneChangerButton");
96
+ const ToneSwitch_1 = require("./ToneSwitch/ToneSwitch");
96
97
  const APICall_2 = require("./APICall/APICall");
97
98
  const Option_1 = require("./Option/Option");
98
99
  const AutoComplete_1 = require("./AutoComplete/AutoComplete");
@@ -401,6 +402,7 @@ class ComponentRegistry {
401
402
  this.registerCoreComponent(AutoComplete_1.autoCompleteComponentRenderer);
402
403
  this.registerCoreComponent(DropdownMenu_1.dropdownMenuComponentRenderer);
403
404
  this.registerCoreComponent(ToneChangerButton_1.toneChangerButtonComponentRenderer);
405
+ this.registerCoreComponent(ToneSwitch_1.toneSwitchComponentRenderer);
404
406
  this.registerCoreComponent(InspectButton_1.inspectButtonComponentRenderer);
405
407
  this.registerCoreComponent(FormSection_1.formSectionRenderer);
406
408
  this.registerCoreComponent(DropdownMenu_1.dropdownMenuComponentRenderer);
@@ -224,10 +224,10 @@ registerIconRenderer("trending-level", (props) => (0, jsx_runtime_1.jsx)(Trendin
224
224
  registerIconRenderer("sortasc", (props) => (0, jsx_runtime_1.jsx)(SortAscendingIcon_1.SortAscendingIcon, Object.assign({}, props)));
225
225
  registerIconRenderer("sortdesc", (props) => (0, jsx_runtime_1.jsx)(SortDescendingIcon_1.SortDescendingIcon, Object.assign({}, props)));
226
226
  registerIconRenderer("nosort", (props) => (0, jsx_runtime_1.jsx)(NoSortIcon_1.NoSortIcon, Object.assign({}, props)));
227
- registerIconRenderer("admonition_info", (props) => (0, jsx_runtime_1.jsx)(AdmonitionInfo_1.AdmonitionInfoIcon, Object.assign({}, props)));
228
- registerIconRenderer("admonition_warning", (props) => (0, jsx_runtime_1.jsx)(AdmonitionWarning_1.AdmonitionWarningIcon, Object.assign({}, props)));
229
- registerIconRenderer("admonition_danger", (props) => (0, jsx_runtime_1.jsx)(AdmonitionDanger_1.AdmonitionDangerIcon, Object.assign({}, props)));
230
- registerIconRenderer("admonition_note", (props) => (0, jsx_runtime_1.jsx)(AdmonitionNote_1.AdmonitionNoteIcon, Object.assign({}, props)));
227
+ registerIconRenderer("admonition_info", (props) => ((0, jsx_runtime_1.jsx)(AdmonitionInfo_1.AdmonitionInfoIcon, Object.assign({}, props))));
228
+ registerIconRenderer("admonition_warning", (props) => ((0, jsx_runtime_1.jsx)(AdmonitionWarning_1.AdmonitionWarningIcon, Object.assign({}, props))));
229
+ registerIconRenderer("admonition_danger", (props) => ((0, jsx_runtime_1.jsx)(AdmonitionDanger_1.AdmonitionDangerIcon, Object.assign({}, props))));
230
+ registerIconRenderer("admonition_note", (props) => ((0, jsx_runtime_1.jsx)(AdmonitionNote_1.AdmonitionNoteIcon, Object.assign({}, props))));
231
231
  registerIconRenderer("admonition_tip", (props) => (0, jsx_runtime_1.jsx)(AdmonitionTip_1.AdmonitionTipIcon, Object.assign({}, props)));
232
232
  // --- IDE extras (temporary)
233
233
  registerIconRenderer("arrowdown", (props) => (0, jsx_runtime_1.jsx)(bs_1.BsArrowDownShort, Object.assign({}, props)));
@@ -238,6 +238,8 @@ registerIconRenderer("table-insert-row", (props) => (0, jsx_runtime_1.jsx)(Table
238
238
  registerIconRenderer("table-delete-row", (props) => (0, jsx_runtime_1.jsx)(TableDeleteRowIcon_1.default, Object.assign({}, props)));
239
239
  registerIconRenderer("table-insert-column", (props) => (0, jsx_runtime_1.jsx)(TableInsertColumnIcon_1.default, Object.assign({}, props)));
240
240
  registerIconRenderer("table-delete-column", (props) => (0, jsx_runtime_1.jsx)(TableDeleteColumnIcon_1.default, Object.assign({}, props)));
241
+ registerIconRenderer("eye", (props) => (0, jsx_runtime_1.jsx)(io5_1.IoEyeOutline, Object.assign({}, props)));
242
+ registerIconRenderer("eye-off", (props) => (0, jsx_runtime_1.jsx)(io5_1.IoEyeOffOutline, Object.assign({}, props)));
241
243
  function IconProvider({ children }) {
242
244
  const getRegisteredIconNames = (0, react_1.useCallback)(() => {
243
245
  return Array.from(pool.keys());
@@ -9,6 +9,8 @@ const classnames_1 = __importDefault(require("classnames"));
9
9
  const InputAdornment_module_scss_1 = __importDefault(require("./InputAdornment.module.scss"));
10
10
  const IconNative_1 = require("../Icon/IconNative");
11
11
  const TextNative_1 = require("../Text/TextNative");
12
- function Adornment({ iconName, text, className }) {
13
- return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: iconName || text ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(InputAdornment_module_scss_1.default.wrapper, className), role: "presentation", children: [(0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName, style: { color: "inherit" } }), text && ((0, jsx_runtime_1.jsx)("div", { style: { display: "flex", userSelect: "none" }, children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { style: { fontSize: "inherit" }, children: text }) }))] })) : null }));
12
+ function Adornment({ iconName, text, className, onClick }) {
13
+ return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: iconName || text ? ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(InputAdornment_module_scss_1.default.wrapper, className, {
14
+ [InputAdornment_module_scss_1.default.clickable]: !!onClick
15
+ }), role: onClick ? "button" : "presentation", onClick: onClick, tabIndex: onClick ? 0 : undefined, children: [(0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName, style: { color: "inherit" } }), text && ((0, jsx_runtime_1.jsx)("div", { style: { display: "flex", userSelect: "none" }, children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { style: { fontSize: "inherit" }, children: text }) }))] })) : null }));
14
16
  }
@@ -32,53 +32,8 @@ exports.LinkNative = (0, react_1.forwardRef)(function LinkNative(props, forwarde
32
32
  const smartTo = (0, react_1.useMemo)(() => {
33
33
  return (0, component_utils_1.createUrlWithQueryParams)(to);
34
34
  }, [to]);
35
- const Node = !to ? "div" : react_2.Link;
36
- // For hash links, we'll use a regular anchor tag to avoid React Router interference
37
- const isHashLink = typeof to === 'string' && to.startsWith('#');
38
- const FinalNode = isHashLink ? "a" : Node;
39
- // Handle hash navigation for same-page scrolling
40
- const handleClick = (0, react_1.useCallback)((event) => {
41
- const toUrl = typeof to === 'string' ? to : to === null || to === void 0 ? void 0 : to.pathname;
42
- // Check if this is a hash link (starts with #)
43
- if (toUrl && toUrl.startsWith('#')) {
44
- const targetId = toUrl.substring(1);
45
- const currentHash = window.location.hash;
46
- // Always prevent default for hash links and handle manually
47
- event.preventDefault();
48
- const targetElement = document.getElementById(targetId);
49
- if (targetElement) {
50
- targetElement.scrollIntoView();
51
- // Build the new URL with existing hash route + fragment
52
- const currentUrl = window.location.href;
53
- const baseUrl = currentUrl.split('#')[0]; // Get everything before the first #
54
- const existingHash = window.location.hash; // Current hash (e.g., #/about)
55
- let newUrl;
56
- if (existingHash && existingHash !== toUrl) {
57
- // If there's an existing hash route, append the fragment to it
58
- if (existingHash.includes('/#')) {
59
- // Remove any existing fragment and add the new one
60
- const hashRoute = existingHash.split('/#')[0];
61
- newUrl = `${baseUrl}${hashRoute}/${toUrl}`;
62
- }
63
- else {
64
- // Just append the fragment to the existing hash
65
- newUrl = `${baseUrl}${existingHash}/${toUrl}`;
66
- }
67
- }
68
- else {
69
- // No existing hash or same fragment, just use the fragment
70
- newUrl = `${baseUrl}${toUrl}`;
71
- }
72
- window.history.pushState(null, '', newUrl);
73
- }
74
- // Call the original onClick if provided
75
- onClick === null || onClick === void 0 ? void 0 : onClick();
76
- return;
77
- }
78
- // For all other cases, call the original onClick
79
- onClick === null || onClick === void 0 ? void 0 : onClick();
80
- }, [to, onClick]);
81
- return ((0, jsx_runtime_1.jsxs)(FinalNode, Object.assign({ ref: forwardedRef, to: isHashLink ? undefined : smartTo, href: isHashLink ? to : undefined, style: style, target: target, onClick: handleClick, className: (0, classnames_1.default)(Link_module_scss_1.default.container, {
35
+ const Node = to ? react_2.Link : "div";
36
+ return ((0, jsx_runtime_1.jsxs)(Node, Object.assign({ ref: forwardedRef, to: smartTo, style: style, target: target, onClick: onClick, className: (0, classnames_1.default)(Link_module_scss_1.default.container, {
82
37
  [Link_module_scss_1.default.iconLink]: iconLink,
83
38
  [Link_module_scss_1.default.active]: active,
84
39
  [Link_module_scss_1.default.disabled]: disabled,
@@ -358,56 +358,103 @@ const Blockquote = ({ children, style }) => {
358
358
  }
359
359
  return ((0, jsx_runtime_1.jsx)("blockquote", { className: Markdown_module_scss_1.default.blockquote, style: style, children: (0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.blockquoteContainer, children: children }) }));
360
360
  };
361
- function LinkAwareHeading({ children, level, showHeadingAnchors }) {
362
- var _a, _b;
363
- const appContext = (0, AppContext_1.useAppContext)();
364
- if (showHeadingAnchors === undefined) {
365
- showHeadingAnchors = (_b = (_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.showHeadingAnchors) !== null && _b !== void 0 ? _b : false;
361
+ function removeSuffixFromReactNodes(node, suffix) {
362
+ if (!suffix) {
363
+ return node;
366
364
  }
367
- let headingLabel = "";
368
- let anchorId = "";
369
- if (!children)
370
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
371
- if (typeof children === "string") {
372
- [headingLabel, anchorId] = getCustomAnchor(children);
373
- // At this point, the anchorId might still be empty
374
- }
375
- else if (Array.isArray(children)) {
376
- if (children.length === 0)
377
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
378
- if (children.length === 1) {
379
- headingLabel = children[0];
365
+ if (typeof node === "string") {
366
+ if (node.endsWith(suffix)) {
367
+ const result = node.slice(0, -suffix.length);
368
+ return result || null;
380
369
  }
381
- else {
382
- headingLabel = children.slice(0, -1);
383
- const last = children[children.length - 1];
384
- // Check for explicit anchor at the end
385
- if (typeof last === "string") {
386
- const match = last.trim().match(/^\[#([^\]]+)\]$/);
387
- if (match && match.length > 0) {
388
- anchorId = match[1];
389
- }
390
- else {
391
- // --- Generate a valid anchor ID from the last element
392
- anchorId = headingToAnchorLink(extractTextNodes(last));
393
- }
370
+ return node;
371
+ }
372
+ if (Array.isArray(node)) {
373
+ const newChildren = [...node];
374
+ let suffixRemaining = suffix;
375
+ for (let i = newChildren.length - 1; i >= 0 && suffixRemaining.length > 0; i--) {
376
+ const child = newChildren[i];
377
+ const childText = getHeadingText(child);
378
+ if (suffixRemaining.endsWith(childText)) {
379
+ newChildren[i] = null;
380
+ suffixRemaining = suffixRemaining.slice(0, -childText.length);
381
+ }
382
+ else {
383
+ newChildren[i] = removeSuffixFromReactNodes(child, suffixRemaining);
384
+ // After this call, the suffix should have been removed from the child, so we are done.
385
+ suffixRemaining = "";
394
386
  }
395
387
  }
388
+ return newChildren.filter(Boolean);
396
389
  }
397
- else {
398
- // Provided children are not a string or array but still valid React elements
399
- // if it contains text, use it as the heading label
400
- const headingContent = extractTextNodes(children);
401
- if (!headingContent)
402
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
403
- headingLabel = children;
390
+ if (react_1.default.isValidElement(node) && node.props.children) {
391
+ const newChildren = removeSuffixFromReactNodes(node.props.children, suffix);
392
+ return react_1.default.cloneElement(node, Object.assign(Object.assign({}, node.props), { children: newChildren }));
404
393
  }
405
- // Generate implicit anchor if not provided
406
- if (!anchorId) {
407
- anchorId = headingToAnchorLink(extractTextNodes(headingLabel));
394
+ return node;
395
+ }
396
+ const LinkAwareHeading = ({ level, children, showHeadingAnchors }) => {
397
+ const { appGlobals } = (0, AppContext_1.useAppContext)();
398
+ const headingRef = (0, react_1.useRef)(null);
399
+ // --- Extract the optional anchor
400
+ let anchor = undefined;
401
+ let label = children;
402
+ const textContent = getHeadingText(children);
403
+ const match = textContent.match(/^(.*)\[#([a-zA-Z0-9-]+)\]\s*$/);
404
+ if (match) {
405
+ anchor = match[2];
406
+ const anchorText = `[#${anchor}]`;
407
+ label = removeSuffixFromReactNodes(children, anchorText);
408
408
  }
409
- return ((0, jsx_runtime_1.jsx)(HeadingNative_1.Heading, { level: level, id: anchorId, showAnchor: showHeadingAnchors, children: headingLabel }));
409
+ const headingId = anchor !== null && anchor !== void 0 ? anchor : getHeadingId(children);
410
+ return ((0, jsx_runtime_1.jsxs)(HeadingNative_1.Heading, { level: level, id: headingId, className: Markdown_module_scss_1.default.linkAwareHeading, headingRef: headingRef, children: [label, showHeadingAnchors && ((0, jsx_runtime_1.jsx)("a", { href: `#${headingId}`, className: Markdown_module_scss_1.default.headingLink, onClick: (e) => {
411
+ var _a;
412
+ e.preventDefault();
413
+ (_a = appGlobals.events) === null || _a === void 0 ? void 0 : _a.emit("scroll-to-anchor", { anchor: headingId });
414
+ }, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "link" }) }))] }));
415
+ };
416
+ function getHeadingId(children) {
417
+ const text = getHeadingText(children);
418
+ return text
419
+ .toLowerCase()
420
+ .replace(/[^\w]+/g, "-")
421
+ .replace(/^-+|-+$/g, "");
410
422
  }
423
+ function getHeadingText(children) {
424
+ if (typeof children === "string") {
425
+ return children;
426
+ }
427
+ if (Array.isArray(children)) {
428
+ return children.map(getHeadingText).join("");
429
+ }
430
+ if (react_1.default.isValidElement(children) && children.props.children) {
431
+ return getHeadingText(children.props.children);
432
+ }
433
+ return "";
434
+ }
435
+ const getLabelContent = (node, labelText) => {
436
+ if (typeof node === "string") {
437
+ return labelText.includes(node) ? node : null;
438
+ }
439
+ if (Array.isArray(node)) {
440
+ const children = node.map((n) => getLabelContent(n, labelText)).filter(Boolean);
441
+ return children.length > 0 ? children : null;
442
+ }
443
+ if (react_1.default.isValidElement(node)) {
444
+ const nodeText = getHeadingText(node);
445
+ if (labelText.trim() === nodeText.trim()) {
446
+ return node;
447
+ }
448
+ if (labelText.includes(nodeText)) {
449
+ return node;
450
+ }
451
+ const newChildren = getLabelContent(node.props.children, labelText);
452
+ if (newChildren) {
453
+ return react_1.default.cloneElement(node, node.props, newChildren);
454
+ }
455
+ }
456
+ return null;
457
+ };
411
458
  // --- Helper functions
412
459
  function removeTextIndents(input) {
413
460
  if (!input) {
@@ -58,9 +58,11 @@ exports.NestedAppMd = (0, metadata_helpers_1.createMetadata)({
58
58
  [`borderRadius-viewControls-${COMP}`]: "5px",
59
59
  [`padding-viewControls-${COMP}`]: "$space-0_5",
60
60
  [`borderBottom-header-${COMP}`]: "0.5px solid $borderColor",
61
+ [`color-loadingText-${COMP}`]: "$color-surface-600",
61
62
  // --- Split view styles
62
63
  [`padding-button-splitView-${COMP}`]: "1px 6px",
63
64
  [`width-button-splitView-${COMP}`]: "60px",
65
+ [`height-button-splitView-${COMP}`]: "19px",
64
66
  [`width-logo-splitView-${COMP}`]: "1.5rem",
65
67
  [`height-logo-splitView-${COMP}`]: "2rem",
66
68
  [`backgroundColor-button-splitView-${COMP}--active`]: "$color-surface-0",
@@ -42,7 +42,7 @@ const hooks_1 = require("../../components-core/utils/hooks");
42
42
  const NestedApp_module_scss_1 = __importDefault(require("./NestedApp.module.scss"));
43
43
  const classnames_1 = __importDefault(require("classnames"));
44
44
  function AnimatedLogo() {
45
- return ((0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.logoWrapper, children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 26 26", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M9.04674 19.3954C8.2739 19.3954 7.60226 19.2265 7.03199 18.8887C6.47443 18.5384 6.0435 18.0505 5.73938 17.425C5.43526 16.7869 5.2832 16.0362 5.2832 15.173V9.89961C5.2832 9.7745 5.32771 9.66815 5.41637 9.58059C5.50502 9.493 5.61275 9.44922 5.73938 9.44922H7.41222C7.55157 9.44922 7.6593 9.493 7.73524 9.58059C7.8239 9.66815 7.86841 9.7745 7.86841 9.89961V15.0604C7.86841 16.6117 8.55895 17.3874 9.94021 17.3874C10.5991 17.3874 11.1187 17.181 11.4988 16.7681C11.8917 16.3553 12.0881 15.786 12.0881 15.0604V9.89961C12.0881 9.7745 12.1325 9.66815 12.2211 9.58059C12.3098 9.493 12.4175 9.44922 12.5443 9.44922H14.217C14.3436 9.44922 14.4513 9.493 14.54 9.58059C14.6288 9.66815 14.6732 9.7745 14.6732 9.89961V18.7574C14.6732 18.8825 14.6288 18.9888 14.54 19.0764C14.4513 19.164 14.3436 19.2078 14.217 19.2078H12.6773C12.538 19.2078 12.4239 19.164 12.3352 19.0764C12.2591 18.9888 12.2211 18.8825 12.2211 18.7574V17.988C11.879 18.4258 11.4545 18.7699 10.9476 19.0201C10.4407 19.2703 9.80704 19.3954 9.04674 19.3954Z", fill: "#3367CC" }), (0, jsx_runtime_1.jsx)("path", { d: "M17.6397 19.2104C17.5129 19.2104 17.4052 19.1666 17.3165 19.079C17.2279 18.9914 17.1835 18.8851 17.1835 18.76V9.90221C17.1835 9.7771 17.2279 9.67075 17.3165 9.58319C17.4052 9.4956 17.5129 9.45182 17.6397 9.45182H19.2174C19.3567 9.45182 19.4644 9.4956 19.5404 9.58319C19.6292 9.67075 19.6736 9.7771 19.6736 9.90221V18.76C19.6736 18.8851 19.6292 18.9914 19.5404 19.079C19.4644 19.1666 19.3567 19.2104 19.2174 19.2104H17.6397ZM17.5636 7.8379C17.4243 7.8379 17.3102 7.80038 17.2215 7.72531C17.1454 7.63773 17.1074 7.52514 17.1074 7.38751V6.03633C17.1074 5.91122 17.1454 5.80487 17.2215 5.71731C17.3102 5.62972 17.4243 5.58594 17.5636 5.58594H19.2933C19.4327 5.58594 19.5467 5.62972 19.6354 5.71731C19.7242 5.80487 19.7686 5.91122 19.7686 6.03633V7.38751C19.7686 7.52514 19.7242 7.63773 19.6354 7.72531C19.5467 7.80038 19.4327 7.8379 19.2933 7.8379H17.5636Z", fill: "#3367CC" }), (0, jsx_runtime_1.jsx)("path", { className: NestedApp_module_scss_1.default.animatedLogoPath, d: "M23.0215 2.81748H2.53486V23.044H23.0215V2.81748Z", fill: "none", stroke: "#3367CC", strokeWidth: "0.75" })] }) }));
45
+ return ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.loadingContainer, children: [(0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.loadingText, children: "Loading XMLUI App..." }), (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.logoWrapper, children: (0, jsx_runtime_1.jsxs)("svg", { viewBox: "0 0 26 26", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M9.04674 19.3954C8.2739 19.3954 7.60226 19.2265 7.03199 18.8887C6.47443 18.5384 6.0435 18.0505 5.73938 17.425C5.43526 16.7869 5.2832 16.0362 5.2832 15.173V9.89961C5.2832 9.7745 5.32771 9.66815 5.41637 9.58059C5.50502 9.493 5.61275 9.44922 5.73938 9.44922H7.41222C7.55157 9.44922 7.6593 9.493 7.73524 9.58059C7.8239 9.66815 7.86841 9.7745 7.86841 9.89961V15.0604C7.86841 16.6117 8.55895 17.3874 9.94021 17.3874C10.5991 17.3874 11.1187 17.181 11.4988 16.7681C11.8917 16.3553 12.0881 15.786 12.0881 15.0604V9.89961C12.0881 9.7745 12.1325 9.66815 12.2211 9.58059C12.3098 9.493 12.4175 9.44922 12.5443 9.44922H14.217C14.3436 9.44922 14.4513 9.493 14.54 9.58059C14.6288 9.66815 14.6732 9.7745 14.6732 9.89961V18.7574C14.6732 18.8825 14.6288 18.9888 14.54 19.0764C14.4513 19.164 14.3436 19.2078 14.217 19.2078H12.6773C12.538 19.2078 12.4239 19.164 12.3352 19.0764C12.2591 18.9888 12.2211 18.8825 12.2211 18.7574V17.988C11.879 18.4258 11.4545 18.7699 10.9476 19.0201C10.4407 19.2703 9.80704 19.3954 9.04674 19.3954Z", fill: "#3367CC" }), (0, jsx_runtime_1.jsx)("path", { d: "M17.6397 19.2104C17.5129 19.2104 17.4052 19.1666 17.3165 19.079C17.2279 18.9914 17.1835 18.8851 17.1835 18.76V9.90221C17.1835 9.7771 17.2279 9.67075 17.3165 9.58319C17.4052 9.4956 17.5129 9.45182 17.6397 9.45182H19.2174C19.3567 9.45182 19.4644 9.4956 19.5404 9.58319C19.6292 9.67075 19.6736 9.7771 19.6736 9.90221V18.76C19.6736 18.8851 19.6292 18.9914 19.5404 19.079C19.4644 19.1666 19.3567 19.2104 19.2174 19.2104H17.6397ZM17.5636 7.8379C17.4243 7.8379 17.3102 7.80038 17.2215 7.72531C17.1454 7.63773 17.1074 7.52514 17.1074 7.38751V6.03633C17.1074 5.91122 17.1454 5.80487 17.2215 5.71731C17.3102 5.62972 17.4243 5.58594 17.5636 5.58594H19.2933C19.4327 5.58594 19.5467 5.62972 19.6354 5.71731C19.7242 5.80487 19.7686 5.91122 19.7686 6.03633V7.38751C19.7686 7.52514 19.7242 7.63773 19.6354 7.72531C19.5467 7.80038 19.4327 7.8379 19.2933 7.8379H17.5636Z", fill: "#3367CC" }), (0, jsx_runtime_1.jsx)("path", { className: NestedApp_module_scss_1.default.animatedLogoPath, d: "M23.0215 2.81748H2.53486V23.044H23.0215V2.81748Z", fill: "none", stroke: "#3367CC", strokeWidth: "0.75" })] }) })] }));
46
46
  }
47
47
  function LazyNestedApp(_a) {
48
48
  var { immediate } = _a, restProps = __rest(_a, ["immediate"]);
@@ -36,6 +36,20 @@ exports.TextBoxMd = (0, metadata_helpers_1.createMetadata)({
36
36
  description: "This property defines the gap between the adornments and the input area. If not " +
37
37
  "set, the gap declared by the current theme is used.",
38
38
  },
39
+ showPasswordToggle: {
40
+ description: "If `true`, a toggle button is displayed to switch between showing and hiding the password input.",
41
+ defaultValue: false,
42
+ },
43
+ passwordVisibleIcon: {
44
+ description: "The icon to display when the password is visible (when showPasswordToggle is true).",
45
+ valueType: "string",
46
+ defaultValue: "eye",
47
+ },
48
+ passwordHiddenIcon: {
49
+ description: "The icon to display when the password is hidden (when showPasswordToggle is true).",
50
+ valueType: "string",
51
+ defaultValue: "eye-off",
52
+ }
39
53
  },
40
54
  events: {
41
55
  gotFocus: (0, metadata_helpers_1.dGotFocus)(COMP),
@@ -69,6 +83,7 @@ exports.TextBoxMd = (0, metadata_helpers_1.createMetadata)({
69
83
  "outlineWidth-Input--focus": "$outlineWidth--focus",
70
84
  "outlineStyle-Input--focus": "$outlineStyle--focus",
71
85
  "outlineOffset-Input--focus": "$outlineOffset--focus",
86
+ "color-passwordToggle-Input": "$textColor-subtitle",
72
87
  light: {
73
88
  // --- No light-specific theme vars
74
89
  },
@@ -79,7 +94,7 @@ exports.TextBoxMd = (0, metadata_helpers_1.createMetadata)({
79
94
  });
80
95
  function renderTextBox(layoutCss, state, updateState, extractValue, node, lookupEventHandler, registerComponentApi, type = "text") {
81
96
  delete layoutCss.gap;
82
- return ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, { type: type, style: layoutCss, value: state.value, updateState: updateState, initialValue: extractValue(node.props.initialValue), maxLength: extractValue(node.props.maxLength), 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, startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), gap: extractValue.asOptionalString(node.props.gap), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue.asOptionalString(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required) }));
97
+ return ((0, jsx_runtime_1.jsx)(TextBoxNative_1.TextBox, { type: type, style: layoutCss, value: state.value, updateState: updateState, initialValue: extractValue(node.props.initialValue), maxLength: extractValue(node.props.maxLength), 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, startText: extractValue.asOptionalString(node.props.startText), startIcon: extractValue.asOptionalString(node.props.startIcon), endText: extractValue.asOptionalString(node.props.endText), endIcon: extractValue.asOptionalString(node.props.endIcon), gap: extractValue.asOptionalString(node.props.gap), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), readOnly: extractValue.asOptionalBoolean(node.props.readOnly), label: extractValue.asOptionalString(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue.asOptionalString(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), required: extractValue.asOptionalBoolean(node.props.required), showPasswordToggle: extractValue.asOptionalBoolean(node.props.showPasswordToggle, false), passwordVisibleIcon: extractValue.asOptionalString(node.props.passwordVisibleIcon), passwordHiddenIcon: extractValue.asOptionalString(node.props.passwordHiddenIcon) }));
83
98
  }
84
99
  exports.textBoxComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TextBoxMd, ({ node, state, updateState, lookupEventHandler, extractValue, layoutCss, registerComponentApi, }) => {
85
100
  return renderTextBox(layoutCss, state, updateState, extractValue, node, lookupEventHandler, registerComponentApi);
@@ -57,11 +57,21 @@ exports.defaultProps = {
57
57
  onBlur: constants_1.noop,
58
58
  onKeyDown: constants_1.noop,
59
59
  updateState: constants_1.noop,
60
+ passwordVisibleIcon: "eye",
61
+ passwordHiddenIcon: "eye-off",
60
62
  };
61
- exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = exports.defaultProps.type, value = exports.defaultProps.value, updateState = exports.defaultProps.updateState, initialValue = exports.defaultProps.initialValue, style, maxLength, enabled = exports.defaultProps.enabled, placeholder, validationStatus = exports.defaultProps.validationStatus, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, onKeyDown = exports.defaultProps.onKeyDown, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
63
+ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = exports.defaultProps.type, value = exports.defaultProps.value, updateState = exports.defaultProps.updateState, initialValue = exports.defaultProps.initialValue, style, maxLength, enabled = exports.defaultProps.enabled, placeholder, validationStatus = exports.defaultProps.validationStatus, onDidChange = exports.defaultProps.onDidChange, onFocus = exports.defaultProps.onFocus, onBlur = exports.defaultProps.onBlur, onKeyDown = exports.defaultProps.onKeyDown, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, showPasswordToggle, passwordVisibleIcon = exports.defaultProps.passwordVisibleIcon, passwordHiddenIcon = exports.defaultProps.passwordHiddenIcon, }, ref) {
62
64
  const _id = (0, react_1.useId)();
63
65
  id = id || _id;
64
66
  const inputRef = (0, react_2.useRef)(null);
67
+ // State to control password visibility
68
+ const [showPassword, setShowPassword] = (0, react_1.useState)(false);
69
+ // Determine the actual input type based on the password visibility toggle
70
+ const actualType = (type === "password" && showPassword) ? "text" : type;
71
+ // Toggle password visibility
72
+ const togglePasswordVisibility = (0, react_2.useCallback)(() => {
73
+ setShowPassword(prev => !prev);
74
+ }, []);
65
75
  (0, react_2.useEffect)(() => {
66
76
  if (autoFocus) {
67
77
  setTimeout(() => {
@@ -116,5 +126,5 @@ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = exports.
116
126
  [TextBox_module_scss_1.default.error]: validationStatus === "error",
117
127
  [TextBox_module_scss_1.default.warning]: validationStatus === "warning",
118
128
  [TextBox_module_scss_1.default.valid]: validationStatus === "valid",
119
- }), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: type, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: onKeyDown, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
129
+ }), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: actualType, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: onKeyDown, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), type === "password" && showPasswordToggle ? ((0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { iconName: showPassword ? passwordVisibleIcon : passwordHiddenIcon, className: (0, classnames_1.default)(TextBox_module_scss_1.default.adornment, TextBox_module_scss_1.default.passwordToggle), onClick: togglePasswordVisibility })) : ((0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment }))] }) }));
120
130
  });
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.toneSwitchComponentRenderer = exports.ToneSwitchMd = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const renderers_1 = require("../../components-core/renderers");
9
+ const metadata_helpers_1 = require("../metadata-helpers");
10
+ const themeVars_1 = require("../../components-core/theming/themeVars");
11
+ const ToneSwitch_module_scss_1 = __importDefault(require("./ToneSwitch.module.scss"));
12
+ const ToneSwitchNative_1 = require("./ToneSwitchNative");
13
+ const COMP = "ToneSwitch";
14
+ exports.ToneSwitchMd = (0, metadata_helpers_1.createMetadata)({
15
+ status: "stable",
16
+ description: "`ToneSwitch` enables the user to switch between light and dark modes using a switch control.",
17
+ props: {
18
+ iconLight: {
19
+ type: "string",
20
+ description: "Icon to display for light mode",
21
+ defaultValue: "sun",
22
+ },
23
+ iconDark: {
24
+ type: "string",
25
+ description: "Icon to display for dark mode",
26
+ defaultValue: "moon",
27
+ },
28
+ },
29
+ themeVars: (0, themeVars_1.parseScssVar)(ToneSwitch_module_scss_1.default.themeVars),
30
+ limitThemeVarsToComponent: true,
31
+ defaultThemeVars: {
32
+ [`backgroundColor-${COMP}-light`]: "$color-surface-200",
33
+ [`color-${COMP}-light`]: "$color-text-primary",
34
+ [`backgroundColor-${COMP}-dark`]: "$color-primary-500",
35
+ [`color-${COMP}-dark`]: "$color-surface-0",
36
+ [`borderColor-${COMP}`]: "$color-surface-200",
37
+ [`borderColor-${COMP}--hover`]: "$color-surface-300",
38
+ dark: {
39
+ [`backgroundColor-${COMP}-light`]: "$color-surface-700",
40
+ [`color-${COMP}-light`]: "$color-text-primary",
41
+ [`borderColor-${COMP}`]: "$color-surface-600",
42
+ [`borderColor-${COMP}--hover`]: "$color-surface-500",
43
+ },
44
+ },
45
+ });
46
+ /**
47
+ * Define the renderer for the ToneSwitch component
48
+ */
49
+ exports.toneSwitchComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ToneSwitchMd, ({ node, extractValue }) => {
50
+ return (0, jsx_runtime_1.jsx)(ToneSwitchNative_1.ToneSwitch, { iconLight: extractValue(node.props.iconLight), iconDark: extractValue(node.props.iconDark) });
51
+ });
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ToneSwitch = ToneSwitch;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
9
+ const IconNative_1 = __importDefault(require("../Icon/IconNative"));
10
+ const Toggle_1 = require("../Toggle/Toggle");
11
+ const ToneSwitch_module_scss_1 = __importDefault(require("./ToneSwitch.module.scss"));
12
+ const classnames_1 = __importDefault(require("classnames"));
13
+ // Default icons for light and dark modes
14
+ const DEFAULT_LIGHT_ICON = "sun";
15
+ const DEFAULT_DARK_ICON = "moon";
16
+ function ToneSwitch({ iconLight = DEFAULT_LIGHT_ICON, iconDark = DEFAULT_DARK_ICON }) {
17
+ const { activeThemeTone, setActiveThemeTone } = (0, ThemeContext_1.useThemes)();
18
+ //console.log('ToneSwitch render - activeThemeTone:', activeThemeTone); // Debug log
19
+ const handleChange = (isDark) => {
20
+ setActiveThemeTone(isDark ? "dark" : "light");
21
+ };
22
+ return ((0, jsx_runtime_1.jsx)("div", { style: { width: 'fit-content', display: 'inline-block' }, className: "toneSwitchContainer", children: (0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { value: activeThemeTone === "dark", onDidChange: handleChange, variant: "switch", style: { width: 'fit-content' }, inputRenderer: (contextVars) => {
23
+ //console.log('ToneSwitch contextVars:', contextVars); // Debug log
24
+ return ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(ToneSwitch_module_scss_1.default.iconSwitch, {
25
+ [ToneSwitch_module_scss_1.default.light]: !contextVars.$checked,
26
+ [ToneSwitch_module_scss_1.default.dark]: contextVars.$checked
27
+ }), children: (0, jsx_runtime_1.jsx)("div", { className: ToneSwitch_module_scss_1.default.iconThumb, children: !contextVars.$checked ? ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: iconLight, fallback: "sun", className: ToneSwitch_module_scss_1.default.icon })) : ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: iconDark, fallback: "moon", className: ToneSwitch_module_scss_1.default.icon })) }) }));
28
+ } }) }));
29
+ }