@nurihaus/web-design-system 0.0.17 → 0.0.18

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.
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import "./avatar-style.css";
4
+ import { BaseBadge } from "../badge/badge";
5
+ var Avatar = function (props) {
6
+ var size = props.size, src = props.src, alt = props.alt, badgeOption = props.badgeOption;
7
+ var _a = useState(false), isImageDownload = _a[0], setIsImageDownload = _a[1];
8
+ return (_jsxs("div", { className: "avatar ".concat(size), children: [_jsx("img", { src: src, alt: alt !== null && alt !== void 0 ? alt : "avatar", className: "avatar ".concat(size, " ").concat(!isImageDownload ? "hidden" : ""), onLoad: function () { return setIsImageDownload(true); } }), !isImageDownload && (_jsx("div", { className: "avatar avatar-skeleton ".concat(size), children: _jsx("div", { className: "avatar skeleton-animation" }) })), _jsx(BaseBadge, { asChild: true, style: {
9
+ position: "absolute",
10
+ right: "0",
11
+ bottom: "0",
12
+ }, children: badgeOption })] }));
13
+ };
14
+ export default Avatar;
@@ -0,0 +1,34 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import "./badge.css";
14
+ import "../../styles/token/color.css";
15
+ import "../../styles/token/font.css";
16
+ import Composer from "../core/composer";
17
+ export var BaseBadge = function (props) {
18
+ var _a = props.asChild, asChild = _a === void 0 ? false : _a, borderColor = props.borderColor, _b = props.textColor, textColor = _b === void 0 ? "black" : _b, backgroundColor = props.backgroundColor, _c = props.size, size = _c === void 0 ? "l" : _c, style = props.style, children = props.children, className = props.className;
19
+ var Comp = asChild ? Composer : "div";
20
+ var composedClassName = "nuri-theme base-badge ".concat(size, " border-").concat(borderColor, " text-").concat(textColor, " background-").concat(backgroundColor, " ").concat(className);
21
+ return (_jsx(Comp, { style: style, className: composedClassName, children: children }));
22
+ };
23
+ export var OptionBadge = function (props) {
24
+ var option = props.option;
25
+ return _jsx(BaseBadge, __assign({}, props, { children: option }));
26
+ };
27
+ export var IconTextBadge = function (props) {
28
+ var icon = props.icon, text = props.text;
29
+ return (_jsxs(BaseBadge, __assign({}, props, { children: [icon, _jsx("span", { children: text })] })));
30
+ };
31
+ export var IconTextOptionBadge = function (props) {
32
+ var icon = props.icon, text = props.text, option = props.option;
33
+ return (_jsxs(BaseBadge, __assign({}, props, { className: "icon-text-option", children: [_jsxs("span", { children: [icon, _jsx("span", { children: text })] }), option] })));
34
+ };
@@ -0,0 +1,34 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ import { forwardRef } from "react";
25
+ import Composer from "../core/composer";
26
+ import "./button.css";
27
+ import "../../styles/token/color.css";
28
+ import "../../styles/token/font.css";
29
+ var BaseButton = forwardRef(function (_a, ref) {
30
+ var children = _a.children, _b = _a.asChild, asChild = _b === void 0 ? false : _b, className = _a.className, props = __rest(_a, ["children", "asChild", "className"]);
31
+ var Comp = asChild ? Composer : "button";
32
+ return (_jsx(Comp, __assign({ ref: ref, className: "base-button ".concat(className), onClick: function () { return console.log("base"); } }, props, { children: children })));
33
+ });
34
+ export default BaseButton;
@@ -0,0 +1,19 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import BaseButton from "./base-button";
14
+ import Loading from "../loading/Loading";
15
+ var CTAButton = function (props) {
16
+ var text = props.text, _a = props.variant, variant = _a === void 0 ? "primary" : _a, _b = props.size, size = _b === void 0 ? "m" : _b, _c = props.disabled, disabled = _c === void 0 ? false : _c, icon = props.icon, _d = props.loading, loading = _d === void 0 ? false : _d;
17
+ return (_jsx(BaseButton, __assign({}, props, { className: "nuri-theme cta-button ".concat(disabled ? "disabled" : variant, " ").concat(size), children: loading ? (_jsx(Loading, {})) : (_jsxs(_Fragment, { children: [icon, text] })) })));
18
+ };
19
+ export default CTAButton;
@@ -0,0 +1,107 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { Children, cloneElement, forwardRef, isValidElement, } from "react";
24
+ function composeRefs() {
25
+ var refs = [];
26
+ for (var _i = 0; _i < arguments.length; _i++) {
27
+ refs[_i] = arguments[_i];
28
+ }
29
+ return function (node) {
30
+ refs.forEach(function (ref) {
31
+ if (ref) {
32
+ if (typeof ref === "function") {
33
+ ref(node);
34
+ }
35
+ else {
36
+ ref.current = node;
37
+ }
38
+ }
39
+ });
40
+ };
41
+ }
42
+ var Composer = forwardRef(function (_a, ref) {
43
+ var children = _a.children, composerProps = __rest(_a, ["children"]);
44
+ var childArray = Children.toArray(children);
45
+ if (childArray.length > 1) {
46
+ throw new Error("Composer can only have one child");
47
+ }
48
+ var isValidChild = isValidElement(childArray[0]);
49
+ if (!isValidChild) {
50
+ throw new Error("child should be React node!");
51
+ }
52
+ var child = childArray[0];
53
+ var childRef = getElementRef(child);
54
+ var mergedProps = mergeProps(composerProps, child.props);
55
+ return cloneElement(child, __assign(__assign({}, mergedProps), { ref: ref ? composeRefs(ref, childRef) : childRef }));
56
+ });
57
+ Composer.displayName = "Composer";
58
+ function mergeProps(composerProps, childProps) {
59
+ var overrideProps = __assign({}, childProps);
60
+ var _loop_1 = function (propName) {
61
+ var composerPropValue = composerProps[propName];
62
+ var childPropValue = childProps[propName];
63
+ var isHandler = /^on[A-Z]/.test(propName);
64
+ if (isHandler) {
65
+ if (composerPropValue && childPropValue) {
66
+ overrideProps[propName] = function () {
67
+ var args = [];
68
+ for (var _i = 0; _i < arguments.length; _i++) {
69
+ args[_i] = arguments[_i];
70
+ }
71
+ childPropValue.apply(void 0, args);
72
+ composerPropValue.apply(void 0, args);
73
+ };
74
+ }
75
+ else if (composerPropValue) {
76
+ overrideProps[propName] = composerPropValue;
77
+ }
78
+ }
79
+ else if (propName === "style") {
80
+ overrideProps[propName] = __assign(__assign({}, composerPropValue), childPropValue);
81
+ }
82
+ else if (propName === "className") {
83
+ overrideProps[propName] = [composerPropValue, childPropValue]
84
+ .filter(Boolean)
85
+ .join(" ");
86
+ }
87
+ };
88
+ for (var propName in composerProps) {
89
+ _loop_1(propName);
90
+ }
91
+ return __assign(__assign({}, composerProps), overrideProps);
92
+ }
93
+ function getElementRef(element) {
94
+ var _a, _b;
95
+ var getter = (_a = Object.getOwnPropertyDescriptor(element.props, "ref")) === null || _a === void 0 ? void 0 : _a.get;
96
+ var mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
97
+ if (mayWarn) {
98
+ return element.ref;
99
+ }
100
+ getter = (_b = Object.getOwnPropertyDescriptor(element, "ref")) === null || _b === void 0 ? void 0 : _b.get;
101
+ mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
102
+ if (mayWarn) {
103
+ return element.props.ref;
104
+ }
105
+ return (element.props.ref || element.ref);
106
+ }
107
+ export default Composer;
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import "./loading.css";
3
+ var Loading = function () {
4
+ return (_jsx("div", { className: "component-loading-container", children: _jsxs("div", { className: "loading-indicator-ring", children: [_jsx("div", { className: "loading-indicator-single-ring" }), _jsx("div", { className: "loading-indicator-single-ring" }), _jsx("div", { className: "loading-indicator-single-ring" }), _jsx("div", { className: "loading-indicator-single-ring" })] }) }));
5
+ };
6
+ export default Loading;