@situaction/traq-ui-ste 1.0.6 → 1.0.7
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/components/button/Button.d.ts +16 -0
- package/dist/components/button/Button.js +52 -0
- package/dist/components/theme/ThemeContext.d.ts +12 -0
- package/dist/components/theme/ThemeContext.js +17 -0
- package/dist/components/theme/createTheme.d.ts +7 -0
- package/dist/components/theme/createTheme.js +1 -0
- package/dist/main.d.ts +4 -2
- package/dist/main.js +7 -4
- package/dist/styles/Button.css +1 -1
- package/dist/styles/main.css +1 -0
- package/package.json +13 -2
- package/dist/components/Button/Button.d.ts +0 -27
- package/dist/components/Button/Button.js +0 -30
- /package/dist/components/{Input → input}/Input.d.ts +0 -0
- /package/dist/components/{Input → input}/Input.js +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
mode?: string; /** Is this the principal call to action on the page? */
|
|
5
|
+
color?: string; /** What background color to use (blue, red, ...)*/
|
|
6
|
+
size?: 's' | 'm' | 'l' | 'xl'; /** How large should the button be? */
|
|
7
|
+
label: string; /** button contents */
|
|
8
|
+
children?: ReactNode; /** Additional content inside the button */
|
|
9
|
+
childrenPosition?: 'left' | 'right' | 'both'; /** Position of the children relative to the label */
|
|
10
|
+
onClick?: () => void; /** Optional click handler */
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Primary UI component for user interaction
|
|
14
|
+
*/
|
|
15
|
+
export declare const Button: ({ mode, size, color, label, children, childrenPosition, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { jsxs as m, jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import '../../styles/Button.css';const l = "_button_hzvpr_28", n = {
|
|
3
|
+
button: l,
|
|
4
|
+
"button-primary": "_button-primary_hzvpr_44",
|
|
5
|
+
"button-secondary": "_button-secondary_hzvpr_58",
|
|
6
|
+
"button-size-xl": "_button-size-xl_hzvpr_62",
|
|
7
|
+
"button-size-l": "_button-size-l_hzvpr_67",
|
|
8
|
+
"button-size-m": "_button-size-m_hzvpr_72",
|
|
9
|
+
"button-size-s": "_button-size-s_hzvpr_77",
|
|
10
|
+
"button-gap-xl": "_button-gap-xl_hzvpr_82",
|
|
11
|
+
"button-gap-l": "_button-gap-l_hzvpr_85",
|
|
12
|
+
"button-gap-m": "_button-gap-m_hzvpr_88",
|
|
13
|
+
"button-gap-s": "_button-gap-s_hzvpr_88"
|
|
14
|
+
}, v = ({
|
|
15
|
+
mode: b = "primary",
|
|
16
|
+
size: a = "m",
|
|
17
|
+
color: t = "blue",
|
|
18
|
+
label: p,
|
|
19
|
+
children: o,
|
|
20
|
+
childrenPosition: r,
|
|
21
|
+
...u
|
|
22
|
+
}) => {
|
|
23
|
+
const _ = [
|
|
24
|
+
n.button,
|
|
25
|
+
n[`button-${b}`],
|
|
26
|
+
n[`button-size-${a}`],
|
|
27
|
+
n[`button-gap-${a}`],
|
|
28
|
+
"flexHorizontalCenter"
|
|
29
|
+
].join(" "), e = {
|
|
30
|
+
"--dynamic-color": `var(--primary-color-${t})`,
|
|
31
|
+
"--dynamic-hover-color": `var(--primary-color-hover-${t})`,
|
|
32
|
+
"--dynamic-pressed-color": `var(--primary-color-pressed-${t})`,
|
|
33
|
+
"--dynamic-disabled-color": `var(--primary-color-disabled-${t})`
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ m(
|
|
36
|
+
"button",
|
|
37
|
+
{
|
|
38
|
+
type: "button",
|
|
39
|
+
className: _,
|
|
40
|
+
style: e,
|
|
41
|
+
...u,
|
|
42
|
+
children: [
|
|
43
|
+
(r === "left" || r === "both") && o && /* @__PURE__ */ s("span", { children: o }),
|
|
44
|
+
/* @__PURE__ */ s("span", { children: p }),
|
|
45
|
+
(r === "right" || r === "both") && o && /* @__PURE__ */ s("span", { children: o })
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
export {
|
|
51
|
+
v as Button
|
|
52
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type Theme = 'light' | 'dark';
|
|
4
|
+
interface ThemeContextType {
|
|
5
|
+
theme: Theme;
|
|
6
|
+
toggleTheme: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const ThemeProvider: ({ children }: {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const useTheme: () => ThemeContextType;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as m, useState as s, useContext as d } from "react";
|
|
3
|
+
const r = m(void 0), a = ({ children: e }) => {
|
|
4
|
+
const [t, h] = s("light"), i = () => {
|
|
5
|
+
h((n) => n === "light" ? "dark" : "light");
|
|
6
|
+
};
|
|
7
|
+
return /* @__PURE__ */ o(r.Provider, { value: { theme: t, toggleTheme: i }, children: /* @__PURE__ */ o("div", { "data-theme": t, children: e }) });
|
|
8
|
+
}, v = () => {
|
|
9
|
+
const e = d(r);
|
|
10
|
+
if (e === void 0)
|
|
11
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
12
|
+
return e;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
a as ThemeProvider,
|
|
16
|
+
v as useTheme
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/dist/main.d.ts
CHANGED
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
1
|
+
/** Export components **/
|
|
2
|
+
export { Button } from './components/button/Button';
|
|
3
|
+
export { Input } from './components/input/Input';
|
|
4
|
+
export { ThemeProvider, useTheme } from './components/theme/ThemeContext';
|
package/dist/main.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { Button as r } from "./components/
|
|
2
|
-
import { Input as
|
|
3
|
-
|
|
1
|
+
import { Button as r } from "./components/button/Button.js";
|
|
2
|
+
import { Input as m } from "./components/input/Input.js";
|
|
3
|
+
import { ThemeProvider as f, useTheme as u } from "./components/theme/ThemeContext.js";
|
|
4
|
+
import './styles/main.css';export {
|
|
4
5
|
r as Button,
|
|
5
|
-
|
|
6
|
+
m as Input,
|
|
7
|
+
f as ThemeProvider,
|
|
8
|
+
u as useTheme
|
|
6
9
|
};
|
package/dist/styles/Button.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
[data-theme=light]{--primary-color-blue: #1D3557;--primary-color-hover-blue: #1F416D;--primary-color-pressed-blue: #214B83;--primary-color-disabled-blue: #E5E7EA;--primary-color-text: #FFF;--primary-color-red: #dc3545;--primary-color-hover-red: #c82333;--primary-color-pressed-red: #bd2130;--primary-color-disabled-red: #c0c0c0}[data-theme=dark]{--primary-color-blue: #C3E9FD;--primary-color-hover-blue: #DFF1FF;--primary-color-pressed-blue: #EFF8FF;--primary-color-disabled-blue: #383F45;--primary-color-text: #1D3557;--primary-color-red: #bd7c88;--primary-color-hover-red: #80464c;--primary-color-pressed-red: #503135;--primary-color-disabled-red: #c0c0c0}._button_hzvpr_28{font-family:Urbanist,sans-serif;font-weight:500;border:0;border-radius:8px;cursor:pointer;display:inline-block;line-height:1;box-shadow:0 4px 10px #00000008;width:fit-content}._button_hzvpr_28:focus{outline:2px solid var(--dynamic-color);outline-offset:2px}._button-primary_hzvpr_44{color:var(--primary-color-text);background-color:var(--dynamic-color)}._button-primary_hzvpr_44:hover{background-color:var(--dynamic-hover-color)}._button-primary_hzvpr_44:active{background-color:var(--dynamic-pressed-color)}._button-primary_hzvpr_44:disabled{background-color:var(--dynamic-disabled-color);cursor:initial}._button-secondary_hzvpr_58{color:#333;background-color:transparent}._button-size-xl_hzvpr_62{padding:16px 32px;font-size:1.125em;line-height:28px}._button-size-l_hzvpr_67{padding:12px 24px;font-size:1em;line-height:24px}._button-size-m_hzvpr_72{padding:8px 16px;font-size:.875em;line-height:22px}._button-size-s_hzvpr_77{padding:6px 12px;font-size:.75em;line-height:16px}._button-gap-xl_hzvpr_82{gap:12px}._button-gap-l_hzvpr_85{gap:8px}._button-gap-m_hzvpr_88,._button-gap-s_hzvpr_88{gap:4px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@font-face{font-family:Urbanist-Thin;src:url(./public/static/Urbanist-Thin.ttf) format("truetype");font-weight:100;font-style:normal}@font-face{font-family:Urbanist-Extra-Light;src:url(./public/static/Urbanist-ExtraLight.ttf) format("truetype");font-weight:200;font-style:normal}@font-face{font-family:Urbanist-Light;src:url(./public/static/Urbanist-Light.ttf) format("truetype");font-weight:300;font-style:normal}@font-face{font-family:Urbanist-Regular;src:url(./public/static/Urbanist-Regular.ttf) format("truetype");font-weight:400;font-style:normal}@font-face{font-family:Urbanist;src:url(./public/static/Urbanist-Medium.ttf) format("truetype");font-weight:500;font-style:normal}@font-face{font-family:Urbanist-Back;src:url(./public/static/Urbanist-Back.ttf) format("truetype");font-weight:600;font-style:normal}@font-face{font-family:Urbanist-Semi-Bold;src:url(./public/static/Urbanist-SemiBold.ttf) format("truetype");font-weight:700;font-style:normal}@font-face{font-family:Urbanist-Bold;src:url(./public/static/Urbanist-Bold.ttf) format("truetype");font-weight:800;font-style:normal}@font-face{font-family:Urbanist-Extra-Bold;src:url(./public/static/Urbanist-ExtraBold.ttf) format("truetype");font-weight:900;font-style:normal}:root,body{font-family:Urbanist,sans-serif}.fontUrbanist{font-family:Urbanist,sans-serif}.flexHorizontal{display:flex;justify-content:flex-start;align-items:center;flex-direction:row}.flexHorizontalCenter{display:flex;justify-content:center;align-items:center;flex-direction:row}.flexVertical{display:flex;justify-content:flex-start;align-items:center;flex-direction:column}.flexVerticalCenter{display:flex;justify-content:center;align-items:center;flex-direction:row}html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}html{overflow-x:hidden}body{line-height:1;width:100vw;height:100vh}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:"";content:none}table{border-collapse:collapse;border-spacing:0}button{border:none;padding:0;cursor:pointer}[data-theme=light]{--primary-color-blue: #1D3557;--primary-color-hover-blue: #1F416D;--primary-color-pressed-blue: #214B83;--primary-color-disabled-blue: #E5E7EA;--primary-color-text: #FFF;--primary-color-red: #dc3545;--primary-color-hover-red: #c82333;--primary-color-pressed-red: #bd2130;--primary-color-disabled-red: #c0c0c0}[data-theme=dark]{--primary-color-blue: #C3E9FD;--primary-color-hover-blue: #DFF1FF;--primary-color-pressed-blue: #EFF8FF;--primary-color-disabled-blue: #383F45;--primary-color-text: #1D3557;--primary-color-red: #bd7c88;--primary-color-hover-red: #80464c;--primary-color-pressed-red: #503135;--primary-color-disabled-red: #c0c0c0}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@situaction/traq-ui-ste",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "library react component Situaction",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"types": "dist/main.d.ts",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "vite",
|
|
12
|
+
"test": "jest",
|
|
12
13
|
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
13
14
|
"prepublish": "npm run build",
|
|
14
15
|
"publish": "npm publish --access public",
|
|
@@ -43,6 +44,10 @@
|
|
|
43
44
|
"@storybook/react": "^8.1.9",
|
|
44
45
|
"@storybook/react-vite": "^8.1.9",
|
|
45
46
|
"@storybook/test": "^8.1.9",
|
|
47
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
48
|
+
"@testing-library/react": "^16.0.0",
|
|
49
|
+
"@testing-library/user-event": "^14.5.2",
|
|
50
|
+
"@types/jest": "^29.5.12",
|
|
46
51
|
"@types/node": "^20.14.2",
|
|
47
52
|
"@types/react": "^18.2.66",
|
|
48
53
|
"@types/react-dom": "^18.2.22",
|
|
@@ -55,16 +60,22 @@
|
|
|
55
60
|
"eslint-plugin-react-refresh": "^0.4.6",
|
|
56
61
|
"eslint-plugin-storybook": "^0.8.0",
|
|
57
62
|
"glob": "^10.4.1",
|
|
63
|
+
"identity-obj-proxy": "^3.0.0",
|
|
64
|
+
"jest": "^29.7.0",
|
|
65
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
58
66
|
"sass": "^1.77.5",
|
|
59
67
|
"sass-loader": "^14.2.0",
|
|
60
68
|
"storybook": "^8.1.9",
|
|
61
69
|
"style-loader": "^4.0.0",
|
|
70
|
+
"ts-jest": "^29.1.5",
|
|
71
|
+
"ts-node": "^10.9.2",
|
|
62
72
|
"typescript": "^5.2.2",
|
|
63
73
|
"vite": "^5.2.0",
|
|
64
74
|
"vite-plugin-dts": "^3.9.1",
|
|
65
75
|
"vite-plugin-lib-inject-css": "^2.1.1"
|
|
66
76
|
},
|
|
67
77
|
"dependencies": {
|
|
68
|
-
"storybook-figma": "^0.1.2"
|
|
78
|
+
"storybook-figma": "^0.1.2",
|
|
79
|
+
"storybook-react-context": "^0.6.0"
|
|
69
80
|
}
|
|
70
81
|
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
interface ButtonProps {
|
|
2
|
-
/**
|
|
3
|
-
* Is this the principal call to action on the page?
|
|
4
|
-
*/
|
|
5
|
-
primary?: boolean;
|
|
6
|
-
/**
|
|
7
|
-
* What background color to use
|
|
8
|
-
*/
|
|
9
|
-
backgroundColor?: string;
|
|
10
|
-
/**
|
|
11
|
-
* How large should the button be?
|
|
12
|
-
*/
|
|
13
|
-
size?: 'small' | 'medium' | 'large';
|
|
14
|
-
/**
|
|
15
|
-
* Button contents
|
|
16
|
-
*/
|
|
17
|
-
label: string;
|
|
18
|
-
/**
|
|
19
|
-
* Optional click handler
|
|
20
|
-
*/
|
|
21
|
-
onClick?: () => void;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Primary UI component for user interaction
|
|
25
|
-
*/
|
|
26
|
-
export declare const Button: ({ primary, size, backgroundColor, label, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import '../../styles/Button.css';const o = {
|
|
3
|
-
"storybook-button": "_storybook-button_rvsxb_1",
|
|
4
|
-
"storybook-button--primary": "_storybook-button--primary_rvsxb_11",
|
|
5
|
-
"storybook-button--secondary": "_storybook-button--secondary_rvsxb_16",
|
|
6
|
-
"storybook-button--small": "_storybook-button--small_rvsxb_22",
|
|
7
|
-
"storybook-button--medium": "_storybook-button--medium_rvsxb_27",
|
|
8
|
-
"storybook-button--large": "_storybook-button--large_rvsxb_32"
|
|
9
|
-
}, e = ({
|
|
10
|
-
primary: t = !1,
|
|
11
|
-
size: b = "medium",
|
|
12
|
-
backgroundColor: r,
|
|
13
|
-
label: s,
|
|
14
|
-
...n
|
|
15
|
-
}) => {
|
|
16
|
-
const y = t ? o["storybook-button--primary"] : o["storybook-button--secondary"];
|
|
17
|
-
return /* @__PURE__ */ u(
|
|
18
|
-
"button",
|
|
19
|
-
{
|
|
20
|
-
type: "button",
|
|
21
|
-
className: [o["storybook-button"], o[`storybook-button--${b}`], y].join(" "),
|
|
22
|
-
style: { backgroundColor: r },
|
|
23
|
-
...n,
|
|
24
|
-
children: s
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
e as Button
|
|
30
|
-
};
|
|
File without changes
|
|
File without changes
|