xmlui 0.7.17 → 0.7.19
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/{apiInterceptorWorker-DkEyFV8g.mjs → apiInterceptorWorker-C3bvewX6.mjs} +1 -1
- package/dist/{grammar.tmLanguage-Qpdanc5_.mjs → grammar.tmLanguage-69iP6c5d.mjs} +23 -9
- package/dist/{index-BiwoF6JS.mjs → index-BwlAHBcX.mjs} +10377 -12573
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/AppHeader/AppHeader.js +2 -2
- package/dist/scripts/src/components/AppState/AppState.js +4 -0
- package/dist/scripts/src/components/Carousel/Carousel.js +7 -4
- package/dist/scripts/src/components/Carousel/CarouselContext.js +48 -0
- package/dist/scripts/src/components/Carousel/CarouselItem.js +1 -4
- package/dist/scripts/src/components/Carousel/CarouselItemNative.js +18 -8
- package/dist/scripts/src/components/Carousel/CarouselNative.js +20 -11
- package/dist/scripts/src/components/ComponentProvider.js +0 -4
- package/dist/scripts/src/components/Markdown/Markdown.js +11 -2
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +1 -1
- package/dist/scripts/src/components/{slot-helpers.js → SlotItem.js} +9 -0
- package/dist/scripts/src/components/Tabs/TabContext.js +5 -1
- package/dist/scripts/src/components/Tabs/TabItem.js +1 -1
- package/dist/scripts/src/components/Tabs/TabItemNative.js +11 -5
- package/dist/scripts/src/components/Tabs/TabsNative.js +21 -10
- package/dist/scripts/src/components/Text/Text.js +3 -2
- package/dist/scripts/src/components/Text/TextNative.js +4 -84
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +1 -4
- package/dist/scripts/src/components/Toggle/Toggle.js +2 -3
- package/dist/scripts/src/components/abstractions.js +158 -19
- package/dist/scripts/src/components-core/ComponentBed.js +83 -78
- package/dist/scripts/src/components-core/CompoundComponent.js +2 -1
- package/dist/scripts/src/components-core/appContext/misc-utils.js +1 -0
- package/dist/scripts/src/components-core/container/Container.js +43 -21
- package/dist/scripts/src/components-core/event-handlers.js +43 -0
- package/dist/scripts/src/components-core/utils/misc.js +7 -0
- package/dist/scripts/src/parsers/xmlui-parser/ParserError.js +39 -41
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +42 -20
- package/dist/scripts/src/syntax/grammar.tmLanguage.json +17 -11
- package/dist/xmlui-metadata.mjs +2032 -1956
- package/dist/xmlui-metadata.umd.js +16 -16
- package/dist/xmlui-standalone.umd.js +149 -149
- package/dist/xmlui.d.ts +3 -2
- package/dist/xmlui.mjs +1 -1
- package/package.json +1 -1
- package/dist/scripts/src/components/Animation/Animation.js +0 -59
- package/dist/scripts/src/components/Animation/AnimationNative.js +0 -75
|
@@ -12,7 +12,7 @@ const themeVars_1 = require("@components-core/theming/themeVars");
|
|
|
12
12
|
const base_utils_1 = require("@components-core/theming/themes/base-utils");
|
|
13
13
|
const AppHeaderNative_1 = require("./AppHeaderNative");
|
|
14
14
|
const metadata_helpers_1 = require("@components/metadata-helpers");
|
|
15
|
-
const
|
|
15
|
+
const SlotItem_1 = require("@components/SlotItem");
|
|
16
16
|
const COMP = "AppHeader";
|
|
17
17
|
exports.AppHeaderMd = (0, ComponentDefs_1.createMetadata)({
|
|
18
18
|
status: "experimental",
|
|
@@ -49,7 +49,7 @@ exports.appHeaderComponentRenderer = (0, renderers_1.createComponentRenderer)(CO
|
|
|
49
49
|
// --- Convert the plain (text) logo template into component definition
|
|
50
50
|
const logoTemplate = node.props.logoTemplate || ((_a = node.slots) === null || _a === void 0 ? void 0 : _a.logoSlot);
|
|
51
51
|
const titleTemplate = node.props.titleTemplate || ((_b = node.slots) === null || _b === void 0 ? void 0 : _b.titleSlot);
|
|
52
|
-
return ((0, jsx_runtime_1.jsx)(AppHeaderNative_1.AppContextAwareAppHeader, { profileMenu: renderChild(extractValue(node.props.profileMenuTemplate, true)), title: extractValue(node.props.title), showLogo: extractValue.asOptionalBoolean(node.props.showLogo, true), titleContent: titleTemplate && ((0, jsx_runtime_1.jsx)(
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(AppHeaderNative_1.AppContextAwareAppHeader, { profileMenu: renderChild(extractValue(node.props.profileMenuTemplate, true)), title: extractValue(node.props.title), showLogo: extractValue.asOptionalBoolean(node.props.showLogo, true), titleContent: titleTemplate && ((0, jsx_runtime_1.jsx)(SlotItem_1.SlotItem, { node: titleTemplate, renderChild: renderChild, slotProps: { title: extractValue(node.props.title) } })), logoContent: renderChild(logoTemplate, {
|
|
53
53
|
type: "Stack",
|
|
54
54
|
orientation: "horizontal",
|
|
55
55
|
}), style: layoutCss, className: layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.themeClassName, renderChild: renderChild, children: renderChild(node.children, {
|
|
@@ -19,6 +19,10 @@ exports.AppStateMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
19
19
|
`value, that value is immediately set. Multiple initial values may result in ` +
|
|
20
20
|
`undesired initialization.`),
|
|
21
21
|
},
|
|
22
|
+
apis: {
|
|
23
|
+
update: (0, ComponentDefs_1.d)("This method updates the application state object bound to the `AppState` instance. The " +
|
|
24
|
+
"function's single argument is an object that specifies the new state value."),
|
|
25
|
+
},
|
|
22
26
|
nonVisual: true,
|
|
23
27
|
});
|
|
24
28
|
exports.appStateComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppStateMd, ({ node, extractValue, updateState, registerComponentApi }) => {
|
|
@@ -23,6 +23,9 @@ exports.CarouselMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
23
23
|
autoplay: (0, ComponentDefs_1.d)("This property indicates whether the carousel automatically scrolls.", null, null, "false"),
|
|
24
24
|
loop: (0, ComponentDefs_1.d)("This property indicates whether the carousel loops.", null, null, "false"),
|
|
25
25
|
startIndex: (0, ComponentDefs_1.d)("This property indicates the index of the first slide to display.", null, null, "0"),
|
|
26
|
+
transitionDuration: (0, ComponentDefs_1.d)("This property specifies the duration of the transition between slides."),
|
|
27
|
+
autoplayInterval: (0, ComponentDefs_1.d)("This property specifies the interval between autoplay transitions."),
|
|
28
|
+
stopAutoplayOnInteraction: (0, ComponentDefs_1.d)("This property indicates whether autoplay stops on interaction."),
|
|
26
29
|
prevIcon: (0, ComponentDefs_1.d)("This property specifies the icon to display for the previous control."),
|
|
27
30
|
nextIcon: (0, ComponentDefs_1.d)("This property specifies the icon to display for the next control."),
|
|
28
31
|
keyboard: (0, ComponentDefs_1.d)("This property indicates whether the carousel responds to keyboard events."),
|
|
@@ -40,9 +43,9 @@ exports.CarouselMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
40
43
|
themeVars: (0, themeVars_1.parseScssVar)(Carousel_module_scss_1.default.themeVars),
|
|
41
44
|
defaultThemeVars: {
|
|
42
45
|
[`color-bg-control-${COMP}`]: "$color-primary",
|
|
43
|
-
[`color-text-control-${COMP}`]: "$color-
|
|
46
|
+
[`color-text-control-${COMP}`]: "$color-text",
|
|
44
47
|
[`color-bg-control-hover-${COMP}`]: "$color-primary",
|
|
45
|
-
[`color-text-control-hover-${COMP}`]: "$color-
|
|
48
|
+
[`color-text-control-hover-${COMP}`]: "$color-text",
|
|
46
49
|
[`color-bg-control-active-${COMP}`]: "$color-primary",
|
|
47
50
|
[`color-bg-control-disabled-${COMP}`]: "$color-surface-200",
|
|
48
51
|
[`color-text-control-disabled-${COMP}`]: "$color-text-disabled",
|
|
@@ -63,6 +66,6 @@ exports.CarouselMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
63
66
|
},
|
|
64
67
|
});
|
|
65
68
|
exports.carouselComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.CarouselMd, ({ node, renderChild, layoutCss, extractValue, lookupEventHandler, registerComponentApi }) => {
|
|
66
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
67
|
-
return ((0, jsx_runtime_1.jsx)(CarouselNative_1.CarouselComponent, { style: layoutCss,
|
|
69
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
70
|
+
return ((0, jsx_runtime_1.jsx)(CarouselNative_1.CarouselComponent, { style: layoutCss, stopAutoplayOnInteraction: extractValue.asOptionalBoolean((_a = node.props) === null || _a === void 0 ? void 0 : _a.stopAutoplayOnInteraction), autoplayInterval: extractValue.asOptionalNumber((_b = node.props) === null || _b === void 0 ? void 0 : _b.autoplayInterval), transitionDuration: extractValue.asOptionalNumber((_c = node.props) === null || _c === void 0 ? void 0 : _c.transitionDuration), indicators: extractValue.asOptionalBoolean((_d = node.props) === null || _d === void 0 ? void 0 : _d.indicators), controls: extractValue.asOptionalBoolean((_e = node.props) === null || _e === void 0 ? void 0 : _e.controls), orientation: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.orientation), onDisplayDidChange: lookupEventHandler("displayDidChange"), autoplay: extractValue.asOptionalBoolean((_g = node.props) === null || _g === void 0 ? void 0 : _g.autoplay), registerComponentApi: registerComponentApi, loop: extractValue.asOptionalBoolean((_h = node.props) === null || _h === void 0 ? void 0 : _h.loop), startIndex: extractValue.asOptionalNumber((_j = node.props) === null || _j === void 0 ? void 0 : _j.startIndex), prevIcon: extractValue((_k = node.props) === null || _k === void 0 ? void 0 : _k.prevIcon), nextIcon: extractValue((_l = node.props) === null || _l === void 0 ? void 0 : _l.nextIcon), keyboard: extractValue.asOptionalBoolean((_m = node.props) === null || _m === void 0 ? void 0 : _m.keyboard), children: renderChild(node.children) }));
|
|
68
71
|
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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.useCarousel = exports.CarouselContext = void 0;
|
|
7
|
+
exports.useCarouselContextValue = useCarouselContextValue;
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const immer_1 = __importDefault(require("immer"));
|
|
10
|
+
exports.CarouselContext = (0, react_1.createContext)({
|
|
11
|
+
register: (column) => { },
|
|
12
|
+
unRegister: (id) => { },
|
|
13
|
+
});
|
|
14
|
+
const useCarousel = () => {
|
|
15
|
+
const context = (0, react_1.useContext)(exports.CarouselContext);
|
|
16
|
+
if (!context) {
|
|
17
|
+
throw new Error("useCarousel must be used within a Carousel");
|
|
18
|
+
}
|
|
19
|
+
return context;
|
|
20
|
+
};
|
|
21
|
+
exports.useCarousel = useCarousel;
|
|
22
|
+
function useCarouselContextValue() {
|
|
23
|
+
const [carouselItems, setCarouselItems] = (0, react_1.useState)([]);
|
|
24
|
+
const carouselContextValue = (0, react_1.useMemo)(() => {
|
|
25
|
+
return {
|
|
26
|
+
register: (column) => {
|
|
27
|
+
setCarouselItems((0, immer_1.default)((draft) => {
|
|
28
|
+
const existing = draft.findIndex((col) => col.id === column.id);
|
|
29
|
+
if (existing < 0) {
|
|
30
|
+
draft.push(column);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
draft[existing] = column;
|
|
34
|
+
}
|
|
35
|
+
}));
|
|
36
|
+
},
|
|
37
|
+
unRegister: (id) => {
|
|
38
|
+
setCarouselItems((0, immer_1.default)((draft) => {
|
|
39
|
+
return draft.filter((col) => col.id !== id);
|
|
40
|
+
}));
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}, [setCarouselItems]);
|
|
44
|
+
return {
|
|
45
|
+
carouselItems,
|
|
46
|
+
carouselContextValue,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -9,8 +9,5 @@ const COMP = "CarouselItem";
|
|
|
9
9
|
exports.CarouselItemMd = (0, ComponentDefs_1.createMetadata)({});
|
|
10
10
|
exports.carouselItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.CarouselItemMd, (rendererContext) => {
|
|
11
11
|
const { node, renderChild } = rendererContext;
|
|
12
|
-
return (0, jsx_runtime_1.jsx)(CarouselItemNative_1.CarouselItemComponent, {
|
|
13
|
-
type: "Stack",
|
|
14
|
-
orientation: "vertical",
|
|
15
|
-
}) });
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(CarouselItemNative_1.CarouselItemComponent, { children: renderChild(node.children) });
|
|
16
13
|
});
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.CarouselItemComponent = void 0;
|
|
7
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
4
|
const react_1 = require("react");
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
const CarouselContext_1 = require("@components/Carousel/CarouselContext");
|
|
6
|
+
exports.CarouselItemComponent = (0, react_1.forwardRef)(function CarouselItemComponent({ children, style }, forwardedRef) {
|
|
7
|
+
const id = (0, react_1.useId)();
|
|
8
|
+
const { register, unRegister } = (0, CarouselContext_1.useCarousel)();
|
|
9
|
+
(0, react_1.useEffect)(() => {
|
|
10
|
+
register({
|
|
11
|
+
children,
|
|
12
|
+
style,
|
|
13
|
+
ref: forwardedRef,
|
|
14
|
+
id,
|
|
15
|
+
});
|
|
16
|
+
}, [id, children, style, register, forwardedRef]);
|
|
17
|
+
(0, react_1.useEffect)(() => {
|
|
18
|
+
return () => {
|
|
19
|
+
unRegister(id);
|
|
20
|
+
};
|
|
21
|
+
}, [id, unRegister]);
|
|
22
|
+
return null;
|
|
13
23
|
});
|
|
@@ -47,24 +47,32 @@ const IconNative_1 = __importDefault(require("@components/Icon/IconNative"));
|
|
|
47
47
|
const constants_1 = require("@components-core/constants");
|
|
48
48
|
const embla_carousel_autoplay_1 = __importDefault(require("embla-carousel-autoplay"));
|
|
49
49
|
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
50
|
-
|
|
50
|
+
const CarouselContext_1 = require("@components/Carousel/CarouselContext");
|
|
51
|
+
exports.CarouselComponent = (0, react_1.forwardRef)(function CarouselComponent({ orientation = "horizontal", children, style, indicators = true, onDisplayDidChange = constants_1.noop, autoplay = false, controls = true, loop = false, startIndex = 0, prevIcon, nextIcon, transitionDuration = 25, autoplayInterval = 5000, stopAutoplayOnInteraction = true, registerComponentApi, }, forwardedRef) {
|
|
51
52
|
const referenceElement = (0, react_1.useRef)(null);
|
|
52
53
|
const [activeSlide, setActiveSlide] = (0, react_1.useState)(0);
|
|
53
54
|
const [plugins, setPlugins] = (0, react_1.useState)([]);
|
|
54
55
|
const [isPlaying, setIsPlaying] = (0, react_1.useState)(false);
|
|
56
|
+
const { carouselContextValue, carouselItems } = (0, CarouselContext_1.useCarouselContextValue)();
|
|
55
57
|
const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(referenceElement, forwardedRef) : referenceElement;
|
|
56
58
|
const [carouselRef, api] = (0, embla_carousel_react_1.default)({
|
|
57
59
|
axis: orientation === "horizontal" ? "x" : "y",
|
|
58
60
|
loop,
|
|
59
61
|
startIndex,
|
|
62
|
+
duration: transitionDuration,
|
|
60
63
|
}, plugins);
|
|
61
64
|
const prevIconName = prevIcon || orientation === "horizontal" ? "arrowleft" : "arrowup";
|
|
62
65
|
const nextIconName = nextIcon || orientation === "horizontal" ? "arrowright" : "arrowdown";
|
|
63
66
|
(0, react_1.useEffect)(() => {
|
|
64
67
|
if (autoplay) {
|
|
65
|
-
setPlugins([
|
|
68
|
+
setPlugins([
|
|
69
|
+
(0, embla_carousel_autoplay_1.default)({
|
|
70
|
+
delay: autoplayInterval,
|
|
71
|
+
stopOnInteraction: stopAutoplayOnInteraction,
|
|
72
|
+
}),
|
|
73
|
+
]);
|
|
66
74
|
}
|
|
67
|
-
}, [autoplay]);
|
|
75
|
+
}, [autoplayInterval, autoplay, stopAutoplayOnInteraction]);
|
|
68
76
|
const toggleAutoplay = (0, react_1.useCallback)(() => {
|
|
69
77
|
var _a;
|
|
70
78
|
const autoplay = (_a = api === null || api === void 0 ? void 0 : api.plugins()) === null || _a === void 0 ? void 0 : _a.autoplay;
|
|
@@ -98,7 +106,7 @@ exports.CarouselComponent = (0, react_1.forwardRef)(function CarouselComponent({
|
|
|
98
106
|
setActiveSlide(activeIndex);
|
|
99
107
|
setCanScrollPrev(api.canScrollPrev());
|
|
100
108
|
setCanScrollNext(api.canScrollNext());
|
|
101
|
-
}, []);
|
|
109
|
+
}, [onDisplayDidChange]);
|
|
102
110
|
const scrollPrev = (0, react_1.useCallback)(() => {
|
|
103
111
|
if (api) {
|
|
104
112
|
api === null || api === void 0 ? void 0 : api.scrollPrev();
|
|
@@ -128,7 +136,7 @@ exports.CarouselComponent = (0, react_1.forwardRef)(function CarouselComponent({
|
|
|
128
136
|
scrollNext();
|
|
129
137
|
}
|
|
130
138
|
}
|
|
131
|
-
}, [scrollPrev, scrollNext]);
|
|
139
|
+
}, [orientation, scrollPrev, scrollNext]);
|
|
132
140
|
(0, react_1.useEffect)(() => {
|
|
133
141
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
134
142
|
scrollTo,
|
|
@@ -143,6 +151,7 @@ exports.CarouselComponent = (0, react_1.forwardRef)(function CarouselComponent({
|
|
|
143
151
|
return;
|
|
144
152
|
}
|
|
145
153
|
onSelect(api);
|
|
154
|
+
api.on("init", onSelect);
|
|
146
155
|
api.on("reInit", onSelect);
|
|
147
156
|
api.on("select", onSelect);
|
|
148
157
|
return () => {
|
|
@@ -154,10 +163,10 @@ exports.CarouselComponent = (0, react_1.forwardRef)(function CarouselComponent({
|
|
|
154
163
|
referenceElement.current.addEventListener("keydown", handleKeyDown);
|
|
155
164
|
}
|
|
156
165
|
}, [ref, handleKeyDown]);
|
|
157
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: style, ref: ref, className: (0, classnames_1.default)(Carousel_module_scss_1.default.carousel), role: "region", tabIndex: -1, "aria-roledescription": "carousel", children: [(0, jsx_runtime_1.jsx)("div", { ref: carouselRef, className: Carousel_module_scss_1.default.carouselContentWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Carousel_module_scss_1.default.carouselContent, {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
166
|
+
return ((0, jsx_runtime_1.jsxs)(CarouselContext_1.CarouselContext.Provider, { value: carouselContextValue, children: [children, (0, jsx_runtime_1.jsxs)("div", { style: style, ref: ref, className: (0, classnames_1.default)(Carousel_module_scss_1.default.carousel), role: "region", tabIndex: -1, "aria-roledescription": "carousel", children: [(0, jsx_runtime_1.jsx)("div", { ref: carouselRef, className: Carousel_module_scss_1.default.carouselContentWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Carousel_module_scss_1.default.carouselContent, {
|
|
167
|
+
[Carousel_module_scss_1.default.horizontal]: orientation === "horizontal",
|
|
168
|
+
[Carousel_module_scss_1.default.vertical]: orientation === "vertical",
|
|
169
|
+
}), children: carouselItems.map((item, index) => ((0, jsx_runtime_1.jsx)("div", { role: "group", "aria-roledescription": "slide", className: (0, classnames_1.default)(Carousel_module_scss_1.default.carouselItem), children: (0, jsx_runtime_1.jsx)("div", { className: Carousel_module_scss_1.default.innerWrapper, ref: item.ref, style: item.style, children: item.children }) }, item.id))) }) }), controls && ((0, jsx_runtime_1.jsxs)("div", { className: Carousel_module_scss_1.default.controls, children: [autoplay && ((0, jsx_runtime_1.jsx)("button", { className: Carousel_module_scss_1.default.controlButton, onClick: toggleAutoplay, children: isPlaying ? (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "pause" }) : (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "play" }) })), (0, jsx_runtime_1.jsx)("button", { className: Carousel_module_scss_1.default.controlButton, disabled: !canScrollPrev, onClick: scrollPrev, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: prevIconName }) }), (0, jsx_runtime_1.jsx)("button", { className: Carousel_module_scss_1.default.controlButton, onClick: scrollNext, disabled: !canScrollNext, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: nextIconName }) })] })), indicators && ((0, jsx_runtime_1.jsx)("div", { className: Carousel_module_scss_1.default.indicators, children: carouselItems.map((_, index) => ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => scrollTo(index), className: (0, classnames_1.default)(Carousel_module_scss_1.default.indicator, {
|
|
170
|
+
[Carousel_module_scss_1.default.active]: index === activeSlide,
|
|
171
|
+
}), "aria-current": index === activeSlide }, index))) }))] })] }));
|
|
163
172
|
});
|
|
@@ -108,7 +108,6 @@ const APICall_2 = require("@components/APICall/APICall");
|
|
|
108
108
|
const Option_1 = require("@components/Option/Option");
|
|
109
109
|
const AutoComplete_1 = require("@components/AutoComplete/AutoComplete");
|
|
110
110
|
const Backdrop_1 = require("./Backdrop/Backdrop");
|
|
111
|
-
const Animation_1 = require("@components/Animation/Animation");
|
|
112
111
|
/**
|
|
113
112
|
* The framework has a specialized component concept, the "property holder
|
|
114
113
|
* component." These components only hold property values but do not render
|
|
@@ -343,9 +342,6 @@ class ComponentRegistry {
|
|
|
343
342
|
this.registerComponentRenderer(Theme_1.themeComponentRenderer);
|
|
344
343
|
this.registerComponentRenderer(AppState_1.appStateComponentRenderer);
|
|
345
344
|
this.registerComponentRenderer(APICall_2.apiCallRenderer);
|
|
346
|
-
this.registerComponentRenderer(Animation_1.animationComponentRenderer);
|
|
347
|
-
this.registerComponentRenderer(Animation_1.fadeInAnimationRenderer);
|
|
348
|
-
this.registerComponentRenderer(Animation_1.slideInAnimationRenderer);
|
|
349
345
|
// --- Added after tabler-clone review
|
|
350
346
|
this.registerCompoundComponentRenderer(PageHeader_1.pageHeaderRenderer);
|
|
351
347
|
this.registerCompoundComponentRenderer(TrendLabel_1.trendLabelRenderer);
|
|
@@ -40,6 +40,15 @@ exports.MarkdownMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
exports.markdownComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.MarkdownMd, ({ node, extractValue, renderChild, layoutCss }) => {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
var _a;
|
|
44
|
+
let renderedChildren = extractValue.asString(node.props.content);
|
|
45
|
+
if (!renderedChildren) {
|
|
46
|
+
((_a = node.children) !== null && _a !== void 0 ? _a : []).forEach((child) => {
|
|
47
|
+
const renderedChild = renderChild(child);
|
|
48
|
+
if (typeof renderedChild === "string") {
|
|
49
|
+
renderedChildren += renderedChild;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return ((0, jsx_runtime_1.jsx)(MarkdownNative_1.Markdown, { style: layoutCss, removeIndents: extractValue.asOptionalBoolean(node.props.removeIndents, false), children: renderedChildren }));
|
|
45
54
|
});
|
|
@@ -288,7 +288,7 @@ exports.NumberBox = (0, react_1.forwardRef)(function NumberBox({ id, value, init
|
|
|
288
288
|
}), tabIndex: -1, onFocus: () => {
|
|
289
289
|
var _a;
|
|
290
290
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
291
|
-
}, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: NumberBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: "text", inputMode: "numeric", className: (0, classnames_1.default)(NumberBox_module_scss_1.default.input, { [NumberBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required
|
|
291
|
+
}, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: NumberBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: "text", inputMode: "numeric", className: (0, classnames_1.default)(NumberBox_module_scss_1.default.input, { [NumberBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: valueStrRep, step: step, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onBeforeInput: handleOnBeforeInput, onKeyDown: handleOnKey, readOnly: readOnly, ref: inputRef, autoFocus: autoFocus, maxLength: maxLength, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: NumberBox_module_scss_1.default.adornment }), hasSpinBox && ((0, jsx_runtime_1.jsxs)("div", { className: NumberBox_module_scss_1.default.spinnerBox, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "up", type: "button", variant: "ghost", themeColor: "secondary", tabIndex: -1, className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: upButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "chevronup", size: "sm" }) }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { "data-spinner": "down", type: "button", tabIndex: -1, variant: "ghost", themeColor: "secondary", className: NumberBox_module_scss_1.default.spinnerButton, disabled: !enabled || readOnly, ref: downButton, children: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "chevrondown", size: "sm" }) })] }))] }) }));
|
|
292
292
|
});
|
|
293
293
|
function applyStep(valueStrRep, step, min, max, integersOnly) {
|
|
294
294
|
const currentValue = (0, numberbox_abstractions_1.toUsableNumber)(valueStrRep, integersOnly);
|
|
@@ -5,18 +5,27 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const constants_1 = require("@components-core/constants");
|
|
7
7
|
const hooks_1 = require("@components-core/utils/hooks");
|
|
8
|
+
/**
|
|
9
|
+
* This React component wraps the slot content defined in a parent component into a container.
|
|
10
|
+
* This container may contain context values pushed from a compound component back to
|
|
11
|
+
* the parent.
|
|
12
|
+
*/
|
|
8
13
|
exports.SlotItem = (0, react_1.memo)(({ node, renderChild, layoutContext, slotProps = constants_1.EMPTY_OBJECT }) => {
|
|
9
14
|
const shallowMemoedSlotProps = (0, hooks_1.useShallowCompareMemoize)(slotProps);
|
|
15
|
+
// --- Transform all Slot properties into context values so that they can be
|
|
16
|
+
// --- used in the slot content (in the parent component)
|
|
10
17
|
const nodeWithItem = (0, react_1.useMemo)(() => {
|
|
11
18
|
const templateProps = {};
|
|
12
19
|
Object.entries(shallowMemoedSlotProps).forEach(([key, value]) => {
|
|
13
20
|
templateProps["$" + key] = value;
|
|
14
21
|
});
|
|
22
|
+
// --- Create a container for the slot content with the cotext values
|
|
15
23
|
return {
|
|
16
24
|
type: "Container",
|
|
17
25
|
contextVars: templateProps,
|
|
18
26
|
children: Array.isArray(node) ? node : [node],
|
|
19
27
|
};
|
|
20
28
|
}, [node, shallowMemoedSlotProps]);
|
|
29
|
+
// --- Render the slot content
|
|
21
30
|
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: renderChild(nodeWithItem, layoutContext) });
|
|
22
31
|
});
|
|
@@ -12,9 +12,11 @@ const constants_1 = require("@components-core/constants");
|
|
|
12
12
|
exports.TabContext = (0, react_1.createContext)({
|
|
13
13
|
register: (tabItem) => { },
|
|
14
14
|
unRegister: (id) => { },
|
|
15
|
+
activeTabId: "",
|
|
15
16
|
});
|
|
16
17
|
function useTabContextValue() {
|
|
17
18
|
const [tabItems, setTabItems] = (0, react_1.useState)(constants_1.EMPTY_ARRAY);
|
|
19
|
+
const [activeTabId, setActiveTabId] = (0, react_1.useState)("");
|
|
18
20
|
const tabContextValue = (0, react_1.useMemo)(() => {
|
|
19
21
|
return {
|
|
20
22
|
register: (column) => {
|
|
@@ -33,8 +35,10 @@ function useTabContextValue() {
|
|
|
33
35
|
return draft.filter((col) => col.id !== id);
|
|
34
36
|
}));
|
|
35
37
|
},
|
|
38
|
+
activeTabId,
|
|
39
|
+
setActiveTabId,
|
|
36
40
|
};
|
|
37
|
-
}, [
|
|
41
|
+
}, [activeTabId]);
|
|
38
42
|
return {
|
|
39
43
|
tabItems,
|
|
40
44
|
tabContextValue,
|
|
@@ -16,5 +16,5 @@ exports.TabItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
16
16
|
});
|
|
17
17
|
exports.tabItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TabItemMd, (rendererContext) => {
|
|
18
18
|
const { node, renderChild, extractValue } = rendererContext;
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(TabItemNative_1.TabItemComponent, { label: extractValue(node.props.label),
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(TabItemNative_1.TabItemComponent, { label: extractValue(node.props.label), children: renderChild(node.children) }));
|
|
20
20
|
});
|
|
@@ -9,16 +9,22 @@ const react_1 = require("react");
|
|
|
9
9
|
const Tabs_module_scss_1 = __importDefault(require("@components/Tabs/Tabs.module.scss"));
|
|
10
10
|
const react_tabs_1 = require("@radix-ui/react-tabs");
|
|
11
11
|
const TabContext_1 = require("@components/Tabs/TabContext");
|
|
12
|
-
exports.TabItemComponent = (0, react_1.forwardRef)(function TabItemComponent(
|
|
12
|
+
exports.TabItemComponent = (0, react_1.forwardRef)(function TabItemComponent({ children, label, style }, forwardedRef) {
|
|
13
13
|
const id = (0, react_1.useId)();
|
|
14
|
-
const { register, unRegister } = (0, TabContext_1.useTabContext)();
|
|
14
|
+
const { register, unRegister, activeTabId } = (0, TabContext_1.useTabContext)();
|
|
15
15
|
(0, react_1.useEffect)(() => {
|
|
16
|
-
register(
|
|
17
|
-
|
|
16
|
+
register({
|
|
17
|
+
children,
|
|
18
|
+
label,
|
|
19
|
+
id,
|
|
20
|
+
});
|
|
21
|
+
}, [id, children, label, register]);
|
|
18
22
|
(0, react_1.useEffect)(() => {
|
|
19
23
|
return () => {
|
|
20
24
|
unRegister(id);
|
|
21
25
|
};
|
|
22
26
|
}, [id, unRegister]);
|
|
23
|
-
|
|
27
|
+
if (activeTabId !== id)
|
|
28
|
+
return null;
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)(react_tabs_1.Content, { value: id, className: Tabs_module_scss_1.default.tabsContent, ref: forwardedRef, style: style, children: children }, id));
|
|
24
30
|
});
|
|
@@ -49,17 +49,24 @@ exports.Tabs = (0, react_1.forwardRef)(function Tabs({ activeTab = 0, orientatio
|
|
|
49
49
|
const currentTab = (0, react_1.useMemo)(() => {
|
|
50
50
|
var _a;
|
|
51
51
|
return (_a = tabItems[activeIndex]) === null || _a === void 0 ? void 0 : _a.id;
|
|
52
|
-
}, [activeIndex]);
|
|
52
|
+
}, [activeIndex, tabItems]);
|
|
53
53
|
(0, react_1.useEffect)(() => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
tabContextValue.setActiveTabId(currentTab);
|
|
55
|
+
}, [currentTab, tabContextValue]);
|
|
56
|
+
(0, react_1.useEffect)(() => {
|
|
57
|
+
if (activeTab !== undefined) {
|
|
58
|
+
setActiveIndex(() => {
|
|
59
|
+
const maxIndex = tabItems.length - 1;
|
|
60
|
+
const newIndex = activeTab - 1;
|
|
61
|
+
return newIndex < 0 ? 0 : newIndex > maxIndex ? maxIndex : newIndex;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}, [activeTab, tabItems.length]);
|
|
59
65
|
const next = (0, misc_1.useEvent)(() => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
setActiveIndex((prevIndex) => {
|
|
67
|
+
const maxIndex = tabItems.length - 1;
|
|
68
|
+
return prevIndex >= maxIndex ? 0 : prevIndex + 1;
|
|
69
|
+
});
|
|
63
70
|
});
|
|
64
71
|
(0, react_1.useEffect)(() => {
|
|
65
72
|
registerComponentApi === null || registerComponentApi === void 0 ? void 0 : registerComponentApi({
|
|
@@ -67,6 +74,10 @@ exports.Tabs = (0, react_1.forwardRef)(function Tabs({ activeTab = 0, orientatio
|
|
|
67
74
|
});
|
|
68
75
|
}, [next, registerComponentApi]);
|
|
69
76
|
return ((0, jsx_runtime_1.jsx)(TabContext_1.TabContext.Provider, { value: tabContextValue, children: (0, jsx_runtime_1.jsxs)(RTabs.Root, { ref: forwardedRef, className: Tabs_module_scss_1.default.tabs, value: `${currentTab}`, onValueChange: (tab) => {
|
|
70
|
-
|
|
77
|
+
const newIndex = tabItems.findIndex((item) => item.id === tab);
|
|
78
|
+
if (newIndex !== activeIndex) {
|
|
79
|
+
tabContextValue.setActiveTabId(tab);
|
|
80
|
+
setActiveIndex(newIndex);
|
|
81
|
+
}
|
|
71
82
|
}, orientation: orientation, style: style, children: [(0, jsx_runtime_1.jsxs)(RTabs.List, { className: Tabs_module_scss_1.default.tabsList, children: [tabItems.map((tab) => tabRenderer ? ((0, jsx_runtime_1.jsx)(RTabs.Trigger, { value: tab.id, children: tabRenderer({ label: tab.label, isActive: tab.id === currentTab }) }, tab.id)) : ((0, jsx_runtime_1.jsx)(RTabs.Trigger, { className: Tabs_module_scss_1.default.tabTrigger, value: tab.id, children: tab.label }, tab.id))), (0, jsx_runtime_1.jsx)("div", { className: Tabs_module_scss_1.default.filler, "data-orientation": orientation })] }), children] }) }));
|
|
72
83
|
});
|
|
@@ -20,6 +20,7 @@ const Text_module_scss_1 = __importDefault(require("./Text.module.scss"));
|
|
|
20
20
|
const ComponentDefs_1 = require("@abstractions/ComponentDefs");
|
|
21
21
|
const renderers_1 = require("@components-core/renderers");
|
|
22
22
|
const themeVars_1 = require("@components-core/theming/themeVars");
|
|
23
|
+
const abstractions_1 = require("@components/abstractions");
|
|
23
24
|
const TextNative_1 = require("./TextNative");
|
|
24
25
|
const COMP = "Text";
|
|
25
26
|
exports.TextMd = (0, ComponentDefs_1.createMetadata)({
|
|
@@ -29,7 +30,7 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
29
30
|
value: (0, ComponentDefs_1.d)(`The text to be displayed. This value can also be set via nesting the text into ` +
|
|
30
31
|
`the \`${COMP}\` component.`),
|
|
31
32
|
variant: (0, ComponentDefs_1.d)(`Optional string value that provides named presets for text variants with a ` +
|
|
32
|
-
`unique combination of font style, weight, size, color and other parameters.`,
|
|
33
|
+
`unique combination of font style, weight, size, color and other parameters.`, abstractions_1.variantOptionsMd),
|
|
33
34
|
maxLines: (0, ComponentDefs_1.d)(`This property determines the maximum number of lines the component can wrap to. ` +
|
|
34
35
|
`If there is no space to display all the contents, the component displays up to ` +
|
|
35
36
|
`as many lines as specified in this property.`),
|
|
@@ -116,7 +117,7 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
116
117
|
exports.textComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TextMd, ({ node, extractValue, layoutCss, renderChild }) => {
|
|
117
118
|
const _a = node.props, { variant, maxLines, preserveLinebreaks, ellipses, value } = _a, variantSpecific = __rest(_a, ["variant", "maxLines", "preserveLinebreaks", "ellipses", "value"]);
|
|
118
119
|
const variantSpecificProps = Object.fromEntries(Object.entries(variantSpecific)
|
|
119
|
-
.filter(([key, _]) =>
|
|
120
|
+
.filter(([key, _]) => abstractions_1.VariantPropsKeys.includes(key))
|
|
120
121
|
.map(([key, value]) => [key, extractValue(value)]));
|
|
121
122
|
return ((0, jsx_runtime_1.jsx)(TextNative_1.Text, Object.assign({ variant: extractValue(variant), maxLines: extractValue.asOptionalNumber(maxLines), style: layoutCss, preserveLinebreaks: extractValue.asOptionalBoolean(preserveLinebreaks, false), ellipses: extractValue.asOptionalBoolean(ellipses, true) }, variantSpecificProps, { children: extractValue.asDisplayText(value) || renderChild(node.children) })));
|
|
122
123
|
});
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Text =
|
|
17
|
+
exports.Text = void 0;
|
|
18
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const react_1 = require("react");
|
|
20
20
|
const react_2 = require("react");
|
|
@@ -22,95 +22,15 @@ const Text_module_scss_1 = __importDefault(require("./Text.module.scss"));
|
|
|
22
22
|
const classnames_1 = __importDefault(require("@components-core/utils/classnames"));
|
|
23
23
|
const css_utils_1 = require("@components-core/utils/css-utils");
|
|
24
24
|
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
25
|
-
const
|
|
26
|
-
"abbr", // use <abbr>
|
|
27
|
-
"cite", // use <cite>
|
|
28
|
-
"code", // use <code>
|
|
29
|
-
"codefence", // use uniquely styled <![CDATA[
|
|
30
|
-
"deleted", // use <del>
|
|
31
|
-
"inserted", // use <ins>
|
|
32
|
-
"keyboard", // use <kbd>,
|
|
33
|
-
"marked", // use <mark>
|
|
34
|
-
"sample", // use <samp>
|
|
35
|
-
"sub", // use <sub>
|
|
36
|
-
"sup", // use <sup>
|
|
37
|
-
"var", // use <var>
|
|
38
|
-
"strong", // use <strong> element for content that is of greater importance (used in Markdown)
|
|
39
|
-
"em", // use <em> element changes the meaning of a sentence - as spoken emphasis does (used in Markdown)
|
|
40
|
-
"mono", // use monospace font with <![CDATA[
|
|
41
|
-
"title", // Title text in the particular context
|
|
42
|
-
"subtitle", // Subtitle text in the particular context
|
|
43
|
-
"small", // Small text in the particular context
|
|
44
|
-
"caption", // Caption text in the particular context
|
|
45
|
-
"placeholder", // Placeholder text in the particular context
|
|
46
|
-
"paragraph", // use <p>
|
|
47
|
-
"subheading", // use a H6 with some specific defaults
|
|
48
|
-
"tableheading", // use a H3 with some specific defaults
|
|
49
|
-
"secondary", // use a secondary text style
|
|
50
|
-
];
|
|
51
|
-
const TextVariantElement = {
|
|
52
|
-
abbr: "abbr",
|
|
53
|
-
cite: "cite",
|
|
54
|
-
code: "code",
|
|
55
|
-
codefence: "pre",
|
|
56
|
-
deleted: "del",
|
|
57
|
-
inserted: "ins",
|
|
58
|
-
keyboard: "kbd",
|
|
59
|
-
marked: "mark",
|
|
60
|
-
sample: "samp",
|
|
61
|
-
sub: "sub",
|
|
62
|
-
sup: "sup",
|
|
63
|
-
var: "var",
|
|
64
|
-
mono: "pre",
|
|
65
|
-
strong: "strong",
|
|
66
|
-
em: "em",
|
|
67
|
-
title: "span",
|
|
68
|
-
subtitle: "span",
|
|
69
|
-
small: "span",
|
|
70
|
-
caption: "span",
|
|
71
|
-
placeholder: "span",
|
|
72
|
-
paragraph: "p",
|
|
73
|
-
subheading: "h6",
|
|
74
|
-
tableheading: "h6",
|
|
75
|
-
secondary: "span",
|
|
76
|
-
};
|
|
77
|
-
exports.variantOptionsMd = [
|
|
78
|
-
{ value: "abbr", description: "Represents an abbreviation or acronym" },
|
|
79
|
-
{ value: "caption", description: "Represents the caption (or title) of a table" },
|
|
80
|
-
{ value: "cite", description: "Is used to mark up the title of a cited work" },
|
|
81
|
-
{ value: "code", description: "Represents a line of code" },
|
|
82
|
-
{ value: "codefence", description: "Handles the display of code blocks if combined with a `code` variant" },
|
|
83
|
-
{ value: "deleted", description: "Represents text that has been deleted" },
|
|
84
|
-
{ value: "em", description: "Marks text to stress emphasis" },
|
|
85
|
-
{ value: "inserted", description: "Represents a range of text that has been added to a document" },
|
|
86
|
-
{ value: "keyboard", description: "Represents a span of text denoting textual user input from a keyboard or voice input" },
|
|
87
|
-
{ value: "marked", description: "Represents text which is marked or highlighted for reference or notation" },
|
|
88
|
-
{ value: "mono", description: "Text using a mono style font family" },
|
|
89
|
-
{ value: "paragraph", description: "Represents a paragraph" },
|
|
90
|
-
{ value: "placeholder", description: "Text that is mostly used as the placeholder style in input controls" },
|
|
91
|
-
{ value: "sample", description: "Represents sample (or quoted) output from a computer program" },
|
|
92
|
-
{ value: "secondary", description: "Represents a bit dimmed secondary text" },
|
|
93
|
-
{ value: "small", description: "Represents side-comments and small print" },
|
|
94
|
-
{ value: "sub", description: "Specifies inline text as subscript" },
|
|
95
|
-
{ value: "strong", description: "Contents have strong importance" },
|
|
96
|
-
{ value: "subheading", description: "Indicates that the text is the subtitle in a heading" },
|
|
97
|
-
{ value: "subtitle", description: "Indicates that the text is the subtitle of some other content" },
|
|
98
|
-
{ value: "sup", description: "Specifies inline text as superscript" },
|
|
99
|
-
{ value: "tableheading", description: "Indicates that the text is a table heading" },
|
|
100
|
-
{ value: "title", description: "Indicates that the text is the title of some other content" },
|
|
101
|
-
{ value: "var", description: "Represents the name of a variable in a mathematical expression" },
|
|
102
|
-
];
|
|
103
|
-
const AbbreviationKeys = ["title"];
|
|
104
|
-
const InsertedKeys = ["cite", "dateTime"];
|
|
105
|
-
exports.VariantPropsKeys = [...AbbreviationKeys, ...InsertedKeys];
|
|
25
|
+
const abstractions_1 = require("@components/abstractions");
|
|
106
26
|
exports.Text = (0, react_1.forwardRef)(function Text(_a, forwardedRef) {
|
|
107
27
|
var { uid, variant, maxLines = 0, style, children, preserveLinebreaks, ellipses = true } = _a, variantSpecificProps = __rest(_a, ["uid", "variant", "maxLines", "style", "children", "preserveLinebreaks", "ellipses"]);
|
|
108
28
|
const innerRef = (0, react_2.useRef)(null);
|
|
109
29
|
const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(innerRef, forwardedRef) : innerRef;
|
|
110
30
|
const Element = (0, react_2.useMemo)(() => {
|
|
111
|
-
if (!variant || !TextVariantElement[variant])
|
|
31
|
+
if (!variant || !abstractions_1.TextVariantElement[variant])
|
|
112
32
|
return "div"; //todo illesg, could be a span?
|
|
113
|
-
return TextVariantElement[variant];
|
|
33
|
+
return abstractions_1.TextVariantElement[variant];
|
|
114
34
|
}, [variant]);
|
|
115
35
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(Element, Object.assign({}, variantSpecificProps, { ref: ref, className: (0, classnames_1.default)([
|
|
116
36
|
Text_module_scss_1.default.text,
|
|
@@ -102,8 +102,5 @@ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text",
|
|
|
102
102
|
[TextBox_module_scss_1.default.error]: validationStatus === "error",
|
|
103
103
|
[TextBox_module_scss_1.default.warning]: validationStatus === "warning",
|
|
104
104
|
[TextBox_module_scss_1.default.valid]: validationStatus === "valid",
|
|
105
|
-
}), tabIndex: -1, onFocus: ()
|
|
106
|
-
var _a;
|
|
107
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
108
|
-
}, 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, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: tabIndex, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
|
|
105
|
+
}), tabIndex: -1, onFocus: focus, 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, 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 })] }) }));
|
|
109
106
|
});
|