@publicplan/kern-react-kit 1.3.2 → 1.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +119 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +24 -0
- package/dist/index.d.cts +29 -9
- package/dist/index.d.ts +29 -9
- package/dist/index.js +119 -37
- package/dist/index.js.map +1 -1
- package/dist/skills/kern-react-kit/SKILL.md +343 -0
- package/dist/skills/kern-react-kit/references/COMPONENTS.md +686 -0
- package/dist/skills/kern-react-kit/references/REFERENCE.md +316 -0
- package/dist/skills/skills.index.json +10 -0
- package/package.json +10 -4
package/dist/index.cjs
CHANGED
|
@@ -299,7 +299,7 @@ const _excluded$86 = [
|
|
|
299
299
|
"isStretched",
|
|
300
300
|
"className"
|
|
301
301
|
];
|
|
302
|
-
const getIcon
|
|
302
|
+
const getIcon = (iconProps) => iconProps ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
303
303
|
name: iconProps.name,
|
|
304
304
|
size: iconProps.size
|
|
305
305
|
}) : null;
|
|
@@ -311,9 +311,9 @@ const Link = (_ref) => {
|
|
|
311
311
|
className: linkClass,
|
|
312
312
|
target: (icon === null || icon === void 0 ? void 0 : icon.name) === "open-in-new" ? "_blank" : target,
|
|
313
313
|
children: [
|
|
314
|
-
iconLeft && getIcon
|
|
314
|
+
iconLeft && getIcon(icon),
|
|
315
315
|
linkText,
|
|
316
|
-
!iconLeft && getIcon
|
|
316
|
+
!iconLeft && getIcon(icon)
|
|
317
317
|
]
|
|
318
318
|
}));
|
|
319
319
|
};
|
|
@@ -584,16 +584,18 @@ const _excluded$70 = [
|
|
|
584
584
|
"variant",
|
|
585
585
|
"isBlock",
|
|
586
586
|
"icon",
|
|
587
|
+
"iconSize",
|
|
587
588
|
"iconOnly",
|
|
588
589
|
"iconLeft",
|
|
589
590
|
"text",
|
|
590
591
|
"children",
|
|
591
592
|
"className"
|
|
593
|
+
], _excluded2 = [
|
|
594
|
+
"href",
|
|
595
|
+
"target",
|
|
596
|
+
"disabled"
|
|
592
597
|
];
|
|
593
|
-
const
|
|
594
|
-
name: iconProps.name,
|
|
595
|
-
size: iconProps.size
|
|
596
|
-
}) : null;
|
|
598
|
+
const isIconProps = (icon) => typeof icon === "object" && icon !== null && "name" in icon && !react.default.isValidElement(icon);
|
|
597
599
|
const IconOnlyLabel = ({ labelText }) => {
|
|
598
600
|
if (!labelText) return null;
|
|
599
601
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -601,26 +603,80 @@ const IconOnlyLabel = ({ labelText }) => {
|
|
|
601
603
|
children: labelText.replace(/^./, (c) => c.toUpperCase())
|
|
602
604
|
});
|
|
603
605
|
};
|
|
604
|
-
const Button = (
|
|
605
|
-
|
|
606
|
+
const Button = react.default.forwardRef((props, ref) => {
|
|
607
|
+
const { variant = "primary", isBlock, icon, iconSize = "default", iconOnly, iconLeft, text, children, className } = props, rest = _objectWithoutProperties(props, _excluded$70);
|
|
606
608
|
const classes = cn("kern-btn", isBlock && "kern-btn--block", `kern-btn--${variant}`, className);
|
|
607
|
-
|
|
608
|
-
if (
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
609
|
+
let iconElement = null;
|
|
610
|
+
if (icon && (typeof icon === "object" && "name" in icon && icon.name.length > 0 || react.default.isValidElement(icon))) {
|
|
611
|
+
if (isIconProps(icon)) iconElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
612
|
+
name: icon.name,
|
|
613
|
+
size: icon.size
|
|
614
|
+
});
|
|
615
|
+
else if (react.default.isValidElement(icon)) iconElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
616
|
+
className: cn("kern-icon", `kern-icon--${iconSize}`),
|
|
617
|
+
style: {
|
|
618
|
+
mask: "none",
|
|
619
|
+
WebkitMask: "none",
|
|
620
|
+
background: "none",
|
|
621
|
+
display: "inline-flex"
|
|
622
|
+
},
|
|
623
|
+
"aria-hidden": true,
|
|
624
|
+
children: icon
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
if ("as" in props && props.as === "a" && props.href) {
|
|
628
|
+
const _ref = rest, { href, target, disabled } = _ref, anchorRest = _objectWithoutProperties(_ref, _excluded2);
|
|
629
|
+
if (iconOnly) {
|
|
630
|
+
const labelText = text || (isIconProps(icon) ? icon.name : void 0);
|
|
631
|
+
const ariaDisabled = disabled ? {
|
|
632
|
+
"aria-disabled": true,
|
|
633
|
+
tabIndex: -1,
|
|
634
|
+
onClick: (e) => e.preventDefault(),
|
|
635
|
+
href: void 0
|
|
636
|
+
} : {};
|
|
637
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", _objectSpread2(_objectSpread2(_objectSpread2({
|
|
638
|
+
ref,
|
|
639
|
+
href,
|
|
640
|
+
target,
|
|
641
|
+
className: classes
|
|
642
|
+
}, anchorRest), ariaDisabled), {}, { children: [iconElement, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconOnlyLabel, { labelText })] }));
|
|
643
|
+
}
|
|
644
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("a", _objectSpread2(_objectSpread2({
|
|
645
|
+
ref,
|
|
646
|
+
href,
|
|
647
|
+
target,
|
|
648
|
+
className: classes
|
|
649
|
+
}, anchorRest), {}, { children: [
|
|
615
650
|
iconLeft && iconElement,
|
|
616
|
-
|
|
651
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
617
652
|
className: "kern-label",
|
|
618
653
|
children: children || text
|
|
619
654
|
}),
|
|
620
655
|
!iconLeft && iconElement
|
|
621
|
-
]
|
|
622
|
-
}
|
|
623
|
-
|
|
656
|
+
] }));
|
|
657
|
+
}
|
|
658
|
+
const buttonRest = rest;
|
|
659
|
+
if (iconOnly) {
|
|
660
|
+
const labelText = text || (isIconProps(icon) ? icon.name : void 0);
|
|
661
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", _objectSpread2(_objectSpread2({
|
|
662
|
+
ref,
|
|
663
|
+
type: "button",
|
|
664
|
+
className: classes
|
|
665
|
+
}, buttonRest), {}, { children: [iconElement, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconOnlyLabel, { labelText })] }));
|
|
666
|
+
}
|
|
667
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", _objectSpread2(_objectSpread2({
|
|
668
|
+
ref,
|
|
669
|
+
type: "button",
|
|
670
|
+
className: classes
|
|
671
|
+
}, buttonRest), {}, { children: [
|
|
672
|
+
iconLeft && iconElement,
|
|
673
|
+
text && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
674
|
+
className: "kern-label",
|
|
675
|
+
children: children || text
|
|
676
|
+
}),
|
|
677
|
+
!iconLeft && iconElement
|
|
678
|
+
] }));
|
|
679
|
+
});
|
|
624
680
|
Button.isInteractive = true;
|
|
625
681
|
|
|
626
682
|
//#endregion
|
|
@@ -1228,7 +1284,6 @@ const FieldsetRoot = ({ children, id, className, style, error = false }) => {
|
|
|
1228
1284
|
className: cn(`kern-fieldset`, error && "kern-fieldset--error", className),
|
|
1229
1285
|
style,
|
|
1230
1286
|
id,
|
|
1231
|
-
role: "group",
|
|
1232
1287
|
"aria-describedby": hintText,
|
|
1233
1288
|
children
|
|
1234
1289
|
});
|
|
@@ -1318,12 +1373,13 @@ const _excluded$41 = [
|
|
|
1318
1373
|
"children",
|
|
1319
1374
|
"className",
|
|
1320
1375
|
"size",
|
|
1321
|
-
"type"
|
|
1376
|
+
"type",
|
|
1377
|
+
"horizontal"
|
|
1322
1378
|
];
|
|
1323
1379
|
const ListsRoot = (_ref) => {
|
|
1324
|
-
let { children, className, size = "default", type = "bullet" } = _ref, rest = _objectWithoutProperties(_ref, _excluded$41);
|
|
1380
|
+
let { children, className, size = "default", type = "bullet", horizontal = false } = _ref, rest = _objectWithoutProperties(_ref, _excluded$41);
|
|
1325
1381
|
const Component = type === "number" ? "ol" : "ul";
|
|
1326
|
-
const listClasses = cn("kern-list", size !== "default" && `kern-list--${size}`, type && `kern-list--${type}`, className);
|
|
1382
|
+
const listClasses = cn("kern-list", size !== "default" && `kern-list--${size}`, type && `kern-list--${type}`, horizontal && "kern-list--horizontal", className);
|
|
1327
1383
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
1328
1384
|
className: listClasses,
|
|
1329
1385
|
children
|
|
@@ -1907,23 +1963,39 @@ const _excluded$18 = [
|
|
|
1907
1963
|
"variant",
|
|
1908
1964
|
"className",
|
|
1909
1965
|
"icon",
|
|
1966
|
+
"iconSize",
|
|
1910
1967
|
"showIcon"
|
|
1911
1968
|
];
|
|
1912
1969
|
const Badge = (_ref) => {
|
|
1913
|
-
let { title, variant, className, icon, showIcon = false } = _ref, rest = _objectWithoutProperties(_ref, _excluded$18);
|
|
1970
|
+
let { title, variant, className, icon, iconSize = "default", showIcon = false } = _ref, rest = _objectWithoutProperties(_ref, _excluded$18);
|
|
1971
|
+
const customIconElement = icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1972
|
+
className: cn("kern-icon", `kern-icon--${iconSize}`),
|
|
1973
|
+
style: {
|
|
1974
|
+
mask: "none",
|
|
1975
|
+
WebkitMask: "none",
|
|
1976
|
+
background: "none",
|
|
1977
|
+
display: "inline-flex"
|
|
1978
|
+
},
|
|
1979
|
+
"aria-hidden": true,
|
|
1980
|
+
children: icon
|
|
1981
|
+
}) : null;
|
|
1914
1982
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
1915
1983
|
role: "status",
|
|
1916
1984
|
className: cn(`kern-badge kern-badge--${variant}`, className),
|
|
1917
|
-
children: [
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1985
|
+
children: [
|
|
1986
|
+
customIconElement,
|
|
1987
|
+
!icon && showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
1988
|
+
"aria-hidden": true,
|
|
1989
|
+
name: variant
|
|
1990
|
+
}),
|
|
1991
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1992
|
+
className: "kern-label kern-label-small",
|
|
1993
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1994
|
+
className: "kern-label kern-sr-only",
|
|
1995
|
+
children: variant.replace(/^./, (c) => c.toUpperCase())
|
|
1996
|
+
}), title]
|
|
1997
|
+
})
|
|
1998
|
+
]
|
|
1927
1999
|
}));
|
|
1928
2000
|
};
|
|
1929
2001
|
|
|
@@ -2474,6 +2546,16 @@ const Kopfzeile = (_ref) => {
|
|
|
2474
2546
|
})), customStyle] });
|
|
2475
2547
|
};
|
|
2476
2548
|
|
|
2549
|
+
//#endregion
|
|
2550
|
+
//#region src/components/LinkButton/LinkButton.tsx
|
|
2551
|
+
const LinkButton = (props) => {
|
|
2552
|
+
if (!props.href) {
|
|
2553
|
+
console.error("href ist für LinkButton erforderlich");
|
|
2554
|
+
return null;
|
|
2555
|
+
}
|
|
2556
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button, _objectSpread2({ as: "a" }, props));
|
|
2557
|
+
};
|
|
2558
|
+
|
|
2477
2559
|
//#endregion
|
|
2478
2560
|
//#region src/components/Loader/Loader.tsx
|
|
2479
2561
|
const _excluded$3 = [
|
|
@@ -2640,6 +2722,7 @@ exports.InputPrimitive = InputPrimitive;
|
|
|
2640
2722
|
exports.Kopfzeile = Kopfzeile;
|
|
2641
2723
|
exports.Label = Label;
|
|
2642
2724
|
exports.Link = Link;
|
|
2725
|
+
exports.LinkButton = LinkButton;
|
|
2643
2726
|
exports.Lists = Lists;
|
|
2644
2727
|
exports.Loader = Loader;
|
|
2645
2728
|
exports.NumberInput = NumberInput;
|