@yakad/ui 2.0.0 → 2.0.2
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/Input/Input.d.ts +11 -0
- package/dist/Input/Input.js +37 -0
- package/dist/Label/Label.d.ts +8 -0
- package/dist/{Spacer/Spacer.js → Label/Label.js} +9 -6
- package/dist/Separator/Separator.d.ts +9 -0
- package/dist/Separator/Separator.js +24 -0
- package/dist/Theme/color/generator.d.ts +1 -0
- package/dist/Theme/color/generator.js +22 -0
- package/dist/Theme/color/hct.d.ts +5 -0
- package/dist/Theme/color/hct.js +6 -0
- package/dist/Theme/color/index.d.ts +0 -0
- package/dist/Theme/color/index.js +1 -0
- package/dist/Theme/color/palettes.d.ts +0 -0
- package/dist/Theme/color/palettes.js +1 -0
- package/dist/Theme/color/roles.d.ts +53 -0
- package/dist/Theme/color/roles.js +57 -0
- package/dist/Theme/color/scheme.d.ts +3 -0
- package/dist/Theme/color/scheme.js +4 -0
- package/dist/Theme/color/source.d.ts +1 -0
- package/dist/Theme/color/source.js +1 -0
- package/dist/Theme/color/test.d.ts +1 -0
- package/dist/Theme/color/test.js +14 -0
- package/dist/Theme/color/tokens.d.ts +52 -0
- package/dist/Theme/color/tokens.js +53 -0
- package/dist/Theme/color/utils.d.ts +1 -0
- package/dist/Theme/color/utils.js +7 -0
- package/dist/Theme/index.d.ts +0 -0
- package/dist/Theme/index.js +1 -0
- package/dist/Theme/theme.d.ts +0 -0
- package/dist/Theme/theme.js +1 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.js +3 -7
- package/dist/theme/color/colors.css +103 -0
- package/package.json +7 -3
- package/dist/Dropdown/Dropdown.d.ts +0 -8
- package/dist/Dropdown/Dropdown.js +0 -99
- package/dist/Dropdown/Dropdown.module.css +0 -39
- package/dist/InputField/InputField.d.ts +0 -15
- package/dist/InputField/InputField.js +0 -82
- package/dist/InputField/cn.d.ts +0 -2
- package/dist/InputField/cn.js +0 -5
- package/dist/InputField/input.d.ts +0 -7
- package/dist/InputField/input.js +0 -18
- package/dist/Popup/Popup.d.ts +0 -8
- package/dist/Popup/Popup.js +0 -40
- package/dist/Popup/Popup.module.css +0 -15
- package/dist/Select/Select.d.ts +0 -12
- package/dist/Select/Select.js +0 -23
- package/dist/Select/Select.module.css +0 -3
- package/dist/Spacer/Spacer.d.ts +0 -5
- package/dist/Spacer/Spacer.module.css +0 -5
- package/dist/Theme/Theme.d.ts +0 -12
- package/dist/Theme/Theme.js +0 -26
- package/dist/Theme/Theme.module.css +0 -398
- package/dist/Theme/globals.css +0 -12
- package/dist/WithOverlay/WithOverlay.d.ts +0 -15
- package/dist/WithOverlay/WithOverlay.js +0 -40
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yakad/ui",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Natiq",
|
|
6
6
|
"description": "UI components for NextJS/React",
|
|
@@ -23,15 +23,18 @@
|
|
|
23
23
|
"homepage": "https://yakad.natiq.net",
|
|
24
24
|
"scripts": {
|
|
25
25
|
"clean": "rimraf dist/",
|
|
26
|
+
"generate:color": "tsx src/Theme/color/generator.ts",
|
|
26
27
|
"copy-files:css": "copyfiles -u 1 src/*.css src/**/*.css dist/",
|
|
27
28
|
"copy-files:svg": "copyfiles -u 1 src/*.svg src/**/*.svg dist/",
|
|
28
|
-
"build": "npm run clean && tsc && npm run copy-files:css && npm run copy-files:svg",
|
|
29
|
+
"build": "npm run clean && tsc && npm run generate:color && npm run copy-files:css && npm run copy-files:svg",
|
|
29
30
|
"typecheck": "tsc --noEmit",
|
|
30
31
|
"lint": "eslint src/**/*.{ts,tsx}",
|
|
31
32
|
"test": "echo \"No tests specified\" && exit 0",
|
|
32
33
|
"prepublishOnly": "npm run lint && npm run test && npm run build && npm run typecheck"
|
|
33
34
|
},
|
|
34
35
|
"dependencies": {
|
|
36
|
+
"@material/material-color-utilities": "^0.4.0",
|
|
37
|
+
"@radix-ui/react-separator": "^1.1.15",
|
|
35
38
|
"@yakad/lib": "1.0.23",
|
|
36
39
|
"@yakad/symbols": "1.0.42",
|
|
37
40
|
"@yakad/use-interactions": "1.0.0",
|
|
@@ -49,6 +52,7 @@
|
|
|
49
52
|
"@types/react": "^19.0.0",
|
|
50
53
|
"@types/react-dom": "^19.0.0",
|
|
51
54
|
"react": "^19.0.0",
|
|
52
|
-
"react-dom": "^19.0.0"
|
|
55
|
+
"react-dom": "^19.0.0",
|
|
56
|
+
"tsx": "^4.23.13"
|
|
53
57
|
}
|
|
54
58
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CardProps, OverlayProps } from "..";
|
|
3
|
-
export interface DropdownProps extends CardProps, OverlayProps {
|
|
4
|
-
teleport?: boolean;
|
|
5
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
6
|
-
}
|
|
7
|
-
export declare function Dropdown({ fullWidthOnParentDemand, // Def in Card is True
|
|
8
|
-
blur, level, triggerref, onClose, className, style, children, teleport, ref, ...restProps }: DropdownProps): import("react").JSX.Element;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { useRef, useState, useEffect, useImperativeHandle } from "react";
|
|
15
|
-
import classNames from "classnames";
|
|
16
|
-
import { Card } from "..";
|
|
17
|
-
import styles from "./Dropdown.module.css";
|
|
18
|
-
import { createPortal } from "react-dom";
|
|
19
|
-
import { useOnOutsideClick } from "@yakad/use-interactions";
|
|
20
|
-
export function Dropdown(_a) {
|
|
21
|
-
var { fullWidthOnParentDemand = false, // Def in Card is True
|
|
22
|
-
blur, level = "high", triggerref, onClose, className, style, children, teleport = false, ref } = _a, restProps = __rest(_a, ["fullWidthOnParentDemand", "blur", "level", "triggerref", "onClose", "className", "style", "children", "teleport", "ref"]);
|
|
23
|
-
const fallbackTriggerRef = useRef(null);
|
|
24
|
-
const dropdownRef = useRef(null);
|
|
25
|
-
const placementTargetRef = triggerref || fallbackTriggerRef;
|
|
26
|
-
// Let the parent access our DOM node
|
|
27
|
-
useImperativeHandle(ref, () => dropdownRef.current);
|
|
28
|
-
const [arrowPosition, setArrowPosition] = useState({
|
|
29
|
-
top: 0,
|
|
30
|
-
left: 0,
|
|
31
|
-
});
|
|
32
|
-
const [dropdownPosition, setDropdownPosition] = useState({
|
|
33
|
-
top: 0,
|
|
34
|
-
left: 0,
|
|
35
|
-
});
|
|
36
|
-
const [isPlacedAbove, setIsPlacedAbove] = useState(false);
|
|
37
|
-
const [isPlaced, setIsPlaced] = useState(false);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
document.body.style.overflow = "hidden";
|
|
40
|
-
return () => {
|
|
41
|
-
document.body.style.overflow = "initial";
|
|
42
|
-
};
|
|
43
|
-
}, []);
|
|
44
|
-
const doTeleport = () => {
|
|
45
|
-
const portalRoot = document.getElementsByClassName("portalRoot")[0] || document;
|
|
46
|
-
const t = portalRoot && createPortal(dropdown(), portalRoot);
|
|
47
|
-
return t;
|
|
48
|
-
};
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if ((placementTargetRef === null || placementTargetRef === void 0 ? void 0 : placementTargetRef.current) && dropdownRef.current) {
|
|
51
|
-
const placementTarget = placementTargetRef.current.getBoundingClientRect();
|
|
52
|
-
const dropdownRect = dropdownRef.current.getBoundingClientRect();
|
|
53
|
-
const padding = 10;
|
|
54
|
-
let dropdownY = placementTarget.bottom + padding;
|
|
55
|
-
let dropdownXPos = placementTarget.left + placementTarget.width / 2;
|
|
56
|
-
let arrowY = dropdownY;
|
|
57
|
-
const arrowX = dropdownXPos;
|
|
58
|
-
// Prevent overflow bottom
|
|
59
|
-
if (dropdownY + dropdownRect.height > window.innerHeight &&
|
|
60
|
-
placementTarget.top > dropdownRect.height) {
|
|
61
|
-
dropdownY = placementTarget.top - padding;
|
|
62
|
-
arrowY = placementTarget.top - padding;
|
|
63
|
-
setIsPlacedAbove(true);
|
|
64
|
-
}
|
|
65
|
-
else
|
|
66
|
-
setIsPlacedAbove(false);
|
|
67
|
-
// Prevent overflow right
|
|
68
|
-
if (dropdownXPos + dropdownRect.width / 2 >
|
|
69
|
-
window.innerWidth - padding) {
|
|
70
|
-
dropdownXPos =
|
|
71
|
-
window.innerWidth - dropdownRect.width / 2 - padding;
|
|
72
|
-
}
|
|
73
|
-
// Prevent overflow left
|
|
74
|
-
if (dropdownXPos - dropdownRect.width / 2 < padding) {
|
|
75
|
-
dropdownXPos = dropdownRect.width / 2 + padding;
|
|
76
|
-
}
|
|
77
|
-
setDropdownPosition({
|
|
78
|
-
top: dropdownY,
|
|
79
|
-
left: dropdownXPos,
|
|
80
|
-
});
|
|
81
|
-
setArrowPosition({
|
|
82
|
-
top: arrowY,
|
|
83
|
-
left: arrowX,
|
|
84
|
-
});
|
|
85
|
-
setIsPlaced(true);
|
|
86
|
-
}
|
|
87
|
-
}, [children, placementTargetRef]);
|
|
88
|
-
useOnOutsideClick(() => {
|
|
89
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
90
|
-
}, dropdownRef);
|
|
91
|
-
const dropdown = () => (_jsxs(_Fragment, { children: [!triggerref && _jsx("div", { ref: fallbackTriggerRef }), _jsx(Card, Object.assign({ ref: dropdownRef, fullWidthOnParentDemand: fullWidthOnParentDemand, blur: blur, level: level }, restProps, { className: classNames(styles.dropdownCard, { [styles.isPlacedAbove]: isPlacedAbove }, className), style: Object.assign({ top: dropdownPosition.top, left: dropdownPosition.left, visibility: isPlaced ? "visible" : "hidden" }, style), children: children })), _jsx("span", { className: classNames(styles.arrow, {
|
|
92
|
-
[styles.isPlacedAbove]: isPlacedAbove,
|
|
93
|
-
}, { [styles.blur]: blur }), style: {
|
|
94
|
-
top: arrowPosition.top,
|
|
95
|
-
left: arrowPosition.left,
|
|
96
|
-
visibility: isPlaced ? "visible" : "hidden",
|
|
97
|
-
} })] }));
|
|
98
|
-
return teleport ? doTeleport() : dropdown();
|
|
99
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
.dropdownCard {
|
|
2
|
-
position: fixed;
|
|
3
|
-
min-width: 6rem;
|
|
4
|
-
min-height: 10rem;
|
|
5
|
-
max-width: calc(100vw - 10rem);
|
|
6
|
-
max-height: min(50vh, 40rem);
|
|
7
|
-
transform: translate(-50%, 1rem);
|
|
8
|
-
overflow-x: auto;
|
|
9
|
-
visibility: hidden;
|
|
10
|
-
z-index: 4;
|
|
11
|
-
}
|
|
12
|
-
.dropdownCard.isPlacedAbove {
|
|
13
|
-
transform: translate(-50%, calc(-100% - 1rem));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/* Arrow */
|
|
17
|
-
.arrow {
|
|
18
|
-
position: fixed;
|
|
19
|
-
width: 0;
|
|
20
|
-
height: 0;
|
|
21
|
-
border-left: 0.8rem solid transparent;
|
|
22
|
-
border-right: 0.8rem solid transparent;
|
|
23
|
-
border-bottom: 1rem solid
|
|
24
|
-
rgb(var(--surfaceContainerHighestColor, 230 224 233));
|
|
25
|
-
transform: translate(-50%, calc(-100% + 1rem));
|
|
26
|
-
visibility: hidden;
|
|
27
|
-
z-index: 4;
|
|
28
|
-
}
|
|
29
|
-
.arrow.isPlacedAbove {
|
|
30
|
-
transform: translate(-50%, -1rem) rotate(180deg);
|
|
31
|
-
}
|
|
32
|
-
.arrow.blur {
|
|
33
|
-
border-bottom: 1rem solid
|
|
34
|
-
color-mix(
|
|
35
|
-
in srgb,
|
|
36
|
-
rgb(var(--surfaceContainerHighestColor, 230 224 233)) 85%,
|
|
37
|
-
transparent
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { type VariantProps } from "class-variance-authority";
|
|
3
|
-
import { Input } from "./input";
|
|
4
|
-
declare const inputFieldVariants: (props?: ({
|
|
5
|
-
variant?: "filled" | "outlined" | null | undefined;
|
|
6
|
-
boxSize?: "small" | "normal" | null | undefined;
|
|
7
|
-
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
|
-
export interface InputFieldProps extends Omit<React.ComponentProps<typeof Input>, "size">, VariantProps<typeof inputFieldVariants> {
|
|
9
|
-
ref?: React.Ref<HTMLInputElement>;
|
|
10
|
-
}
|
|
11
|
-
export declare function InputField({ variant, boxSize, placeholder, className, id, ref, ...restProps }: InputFieldProps): React.JSX.Element;
|
|
12
|
-
export declare namespace InputField {
|
|
13
|
-
var displayName: string;
|
|
14
|
-
}
|
|
15
|
-
export { inputFieldVariants };
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import * as React from "react";
|
|
14
|
-
import { cva } from "class-variance-authority";
|
|
15
|
-
import { cn } from "./cn";
|
|
16
|
-
import { Input } from "./input";
|
|
17
|
-
const inputFieldVariants = cva([
|
|
18
|
-
"peer",
|
|
19
|
-
"w-full",
|
|
20
|
-
"transition-colors",
|
|
21
|
-
"placeholder:text-transparent",
|
|
22
|
-
"focus-visible:ring-offset-0",
|
|
23
|
-
], {
|
|
24
|
-
variants: {
|
|
25
|
-
variant: {
|
|
26
|
-
outlined: [
|
|
27
|
-
"border",
|
|
28
|
-
"border-input",
|
|
29
|
-
"bg-transparent",
|
|
30
|
-
"focus-visible:ring-1",
|
|
31
|
-
"focus-visible:ring-ring",
|
|
32
|
-
],
|
|
33
|
-
filled: [
|
|
34
|
-
"rounded-b-none",
|
|
35
|
-
"border-0",
|
|
36
|
-
"border-b-2",
|
|
37
|
-
"border-input",
|
|
38
|
-
"bg-muted",
|
|
39
|
-
"focus-visible:ring-0",
|
|
40
|
-
"focus-visible:border-primary",
|
|
41
|
-
],
|
|
42
|
-
},
|
|
43
|
-
boxSize: {
|
|
44
|
-
small: "h-8 px-2 text-sm",
|
|
45
|
-
normal: "h-10 px-3 text-base",
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
defaultVariants: {
|
|
49
|
-
variant: "outlined",
|
|
50
|
-
boxSize: "normal",
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
const labelVariants = cva([
|
|
54
|
-
"pointer-events-none",
|
|
55
|
-
"absolute",
|
|
56
|
-
"left-3",
|
|
57
|
-
"top-1/2",
|
|
58
|
-
"-translate-y-1/2",
|
|
59
|
-
"text-muted-foreground",
|
|
60
|
-
"transition-all",
|
|
61
|
-
], {
|
|
62
|
-
variants: {
|
|
63
|
-
boxSize: {
|
|
64
|
-
small: "text-sm",
|
|
65
|
-
normal: "text-base",
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
defaultVariants: {
|
|
69
|
-
boxSize: "normal",
|
|
70
|
-
},
|
|
71
|
-
});
|
|
72
|
-
export function InputField(_a) {
|
|
73
|
-
var { variant = "outlined", boxSize = "normal", placeholder, className, id, ref } = _a, restProps = __rest(_a, ["variant", "boxSize", "placeholder", "className", "id", "ref"]);
|
|
74
|
-
const generatedId = React.useId();
|
|
75
|
-
const inputId = id !== null && id !== void 0 ? id : generatedId;
|
|
76
|
-
return (_jsxs("div", { className: "relative w-full", children: [_jsx(Input, Object.assign({ id: inputId, ref: ref, placeholder: " ", className: cn(inputFieldVariants({
|
|
77
|
-
variant,
|
|
78
|
-
boxSize,
|
|
79
|
-
}), className) }, restProps)), placeholder && (_jsx("label", { htmlFor: inputId, className: cn(labelVariants({ boxSize }), "peer-focus:top-0", "peer-focus:-translate-y-1/2", "peer-focus:bg-background", "peer-focus:px-1", "peer-focus:text-xs", "peer-focus:text-primary", "peer-[:not(:placeholder-shown)]:top-0", "peer-[:not(:placeholder-shown)]:-translate-y-1/2", "peer-[:not(:placeholder-shown)]:bg-background", "peer-[:not(:placeholder-shown)]:px-1", "peer-[:not(:placeholder-shown)]:text-xs"), children: placeholder }))] }));
|
|
80
|
-
}
|
|
81
|
-
InputField.displayName = "InputField";
|
|
82
|
-
export { inputFieldVariants };
|
package/dist/InputField/cn.d.ts
DELETED
package/dist/InputField/cn.js
DELETED
package/dist/InputField/input.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { cn } from "./cn";
|
|
14
|
-
export function Input(_a) {
|
|
15
|
-
var { className, type } = _a, props = __rest(_a, ["className", "type"]);
|
|
16
|
-
return (_jsx("input", Object.assign({ type: type, "data-slot": "input", className: cn("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]", "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", className) }, props)));
|
|
17
|
-
}
|
|
18
|
-
Input.displayName = "Input";
|
package/dist/Popup/Popup.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CardProps, OverlayProps } from "..";
|
|
3
|
-
export interface PopupProps extends CardProps, OverlayProps {
|
|
4
|
-
heading?: string;
|
|
5
|
-
teleport?: boolean;
|
|
6
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
7
|
-
}
|
|
8
|
-
export declare function Popup({ align, onClose, heading, className, children, teleport, ref, ...restProps }: PopupProps): import("react").JSX.Element;
|
package/dist/Popup/Popup.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
import { useEffect, useImperativeHandle } from "react";
|
|
15
|
-
import classNames from "classnames";
|
|
16
|
-
import { Material } from "@yakad/symbols";
|
|
17
|
-
import { Button, Card, Row, Screen, Spacer, Stack, Text, } from "..";
|
|
18
|
-
import styles from "./Popup.module.css";
|
|
19
|
-
import { createPortal } from "react-dom";
|
|
20
|
-
import { useOnOutsideClick } from "@yakad/use-interactions";
|
|
21
|
-
export function Popup(_a) {
|
|
22
|
-
var { align, onClose, heading, className, children, teleport = false, ref } = _a, restProps = __rest(_a, ["align", "onClose", "heading", "className", "children", "teleport", "ref"]);
|
|
23
|
-
const localRef = useOnOutsideClick(() => {
|
|
24
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
25
|
-
});
|
|
26
|
-
const doTeleport = () => {
|
|
27
|
-
const portalRoot = document.getElementsByClassName("portalRoot")[0] || document;
|
|
28
|
-
const t = portalRoot && createPortal(popup(), portalRoot);
|
|
29
|
-
return t;
|
|
30
|
-
};
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
document.body.style.overflow = "hidden";
|
|
33
|
-
return () => {
|
|
34
|
-
document.body.style.overflow = "initial";
|
|
35
|
-
};
|
|
36
|
-
}, []);
|
|
37
|
-
useImperativeHandle(ref, () => localRef.current);
|
|
38
|
-
const popup = () => (_jsx(Screen, { align: "center", className: styles.popupscreen, children: _jsxs(Card, Object.assign({ ref: localRef }, restProps, { className: classNames(styles.popup, className), children: [_jsxs(Row, { style: { marginBottom: "2rem" }, children: [_jsx(Text, { variant: "heading4", children: heading }), _jsx(Spacer, {}), _jsx(Button, { title: "Close", icon: _jsx(Material, { icon: "close" }), onClick: onClose })] }), _jsx(Stack, { align: align, style: { width: "100%", overflowY: "auto" }, children: children })] })) }));
|
|
39
|
-
return teleport ? doTeleport() : popup();
|
|
40
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
.popupscreen {
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
left: 0;
|
|
5
|
-
background-color: rgba(var(--surfaceContainerColor, 243 237 247), 0.2);
|
|
6
|
-
backdrop-filter: blur(0.2rem);
|
|
7
|
-
z-index: 4;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.popup {
|
|
11
|
-
width: 90%;
|
|
12
|
-
max-width: 60rem;
|
|
13
|
-
min-height: 10rem;
|
|
14
|
-
max-height: 90vh;
|
|
15
|
-
}
|
package/dist/Select/Select.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
export interface SelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
3
|
-
variant?: "outlined" | "filled";
|
|
4
|
-
boxsize?: "small" | "normal";
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
children?: React.ReactNode;
|
|
7
|
-
ref?: React.Ref<HTMLSelectElement>;
|
|
8
|
-
}
|
|
9
|
-
export declare function Select({ variant, boxsize, placeholder, className, children, ...restProps }: SelectProps): React.JSX.Element;
|
|
10
|
-
export declare namespace Select {
|
|
11
|
-
var displayName: string;
|
|
12
|
-
}
|
package/dist/Select/Select.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { cn } from "../InputField/cn";
|
|
14
|
-
export function Select(_a) {
|
|
15
|
-
var { variant = "outlined", boxsize = "normal", placeholder, className, children } = _a, restProps = __rest(_a, ["variant", "boxsize", "placeholder", "className", "children"]);
|
|
16
|
-
return (_jsxs("div", { className: "relative w-full", children: [_jsx("select", Object.assign({}, restProps, { className: cn("peer w-full transition-colors", "border-input bg-background", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", {
|
|
17
|
-
"h-8 px-2 text-sm": boxsize === "small",
|
|
18
|
-
"h-10 px-3 text-base": boxsize === "normal",
|
|
19
|
-
"rounded-md border bg-transparent": variant === "outlined",
|
|
20
|
-
"rounded-b-none border-0 border-b-2 bg-muted": variant === "filled",
|
|
21
|
-
}, className), children: children })), placeholder && (_jsx("label", { className: cn("pointer-events-none absolute left-3 top-1/2", "-translate-y-1/2 text-muted-foreground", "transition-all", "peer-focus:top-0 peer-focus:-translate-y-1/2", "peer-focus:bg-background peer-focus:px-1", "peer-focus:text-xs peer-focus:text-primary"), children: placeholder }))] }));
|
|
22
|
-
}
|
|
23
|
-
Select.displayName = "Select";
|
package/dist/Spacer/Spacer.d.ts
DELETED
package/dist/Theme/Theme.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export type DarkStyle = "light" | "dark" | "system";
|
|
3
|
-
export type ThemeColor = "green" | "red" | "yellow" | "blue" | "purple";
|
|
4
|
-
export interface ThemeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
-
align?: "start" | "space" | "center" | "end";
|
|
6
|
-
darkStyle?: DarkStyle;
|
|
7
|
-
color?: ThemeColor;
|
|
8
|
-
zoom?: number;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
ref?: React.Ref<HTMLDivElement>;
|
|
11
|
-
}
|
|
12
|
-
export declare function Theme({ align, darkStyle, color, zoom, className, children, ...restProps }: ThemeProps): import("react").JSX.Element;
|
package/dist/Theme/Theme.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
import { useEffect } from "react";
|
|
15
|
-
import classNames from "classnames";
|
|
16
|
-
import styles from "./Theme.module.css";
|
|
17
|
-
import boxingStyles from "../boxing.module.css";
|
|
18
|
-
export function Theme(_a) {
|
|
19
|
-
var { align, darkStyle = "system", color = "blue", zoom = 100, className, children } = _a, restProps = __rest(_a, ["align", "darkStyle", "color", "zoom", "className", "children"]);
|
|
20
|
-
const zoomPercentage = zoom ? (zoom / 100) * 62.5 : 62.5;
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
document.documentElement.style.setProperty("font-size", zoomPercentage + "%");
|
|
23
|
-
}, [zoomPercentage]);
|
|
24
|
-
const joinedClassNames = classNames({ portalRoot: true }, boxingStyles.flexColumnBox, { [boxingStyles[align]]: align }, { [boxingStyles.demandChildsToBeFullWidth]: true }, styles.theme, styles[darkStyle], styles[color], className);
|
|
25
|
-
return (_jsx("div", Object.assign({}, restProps, { className: joinedClassNames, children: children })));
|
|
26
|
-
}
|