uibee 2.9.2 → 2.9.4

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.
@@ -5,9 +5,9 @@ type ButtonProps = {
5
5
  icon: string | JSX.Element;
6
6
  path?: string;
7
7
  type?: 'button' | 'submit' | 'reset';
8
- color?: 'primary' | 'secondary';
8
+ variant?: 'primary' | 'secondary' | 'warning' | 'danger' | 'success' | 'info';
9
9
  onClick?: (_: object | string) => void;
10
10
  disabled?: boolean;
11
11
  };
12
- export default function Button({ text, className, icon, path, color, type, onClick, disabled }: ButtonProps): import("react/jsx-runtime").JSX.Element;
12
+ export default function Button({ text, className, icon, path, variant, type, onClick, disabled }: ButtonProps): import("react/jsx-runtime").JSX.Element;
13
13
  export {};
@@ -1,9 +1,15 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import Link from 'next/link';
3
- export default function Button({ text, className, icon, path, color, type, onClick, disabled }) {
4
- const bg = color === 'secondary'
5
- ? 'bg-login-500/70 outline-login-500 hover:bg-login-500/90'
6
- : 'bg-login/70 outline-login hover:bg-login/90';
3
+ const variants = {
4
+ primary: 'bg-login/70 outline-login hover:bg-login/90',
5
+ secondary: 'bg-login-500/70 outline-login-500 hover:bg-login-500/90',
6
+ warning: 'bg-yellow-500/70 outline-yellow-500 hover:bg-yellow-500/90',
7
+ danger: 'bg-red-600/70 outline-red-600 hover:bg-red-600/90',
8
+ success: 'bg-green-600/70 outline-green-600 hover:bg-green-600/90',
9
+ info: 'bg-blue-600/70 outline-blue-600 hover:bg-blue-600/90'
10
+ };
11
+ export default function Button({ text, className, icon, path, variant = 'primary', type, onClick, disabled }) {
12
+ const bg = variants[variant];
7
13
  if (!path) {
8
14
  return (_jsxs("button", { type: type || 'button', disabled: disabled, onClick: onClick, "aria-label": text, className: `
9
15
  ${bg} cursor-pointer px-4 rounded-md min-h-8 h-8 flex
@@ -1,2 +1,2 @@
1
1
  import { LoginPageProps } from 'uibee/components';
2
- export default function LoginPage({ title, description, redirectURL, version, btg, handleSubmit, guestRedirectURL, guestText }: LoginPageProps): import("react/jsx-runtime").JSX.Element;
2
+ export default function LoginPage({ title, description, redirectPath, version, btg, handleSubmit, guestRedirectPath, guestText }: LoginPageProps): import("react/jsx-runtime").JSX.Element;
@@ -2,17 +2,17 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { LogIn } from 'lucide-react';
3
3
  import Logo from '../logo/logo';
4
4
  import Link from 'next/link';
5
- export default function LoginPage({ title, description, redirectURL, version, btg, handleSubmit, guestRedirectURL, guestText }) {
5
+ export default function LoginPage({ title, description, redirectPath, version, btg, handleSubmit, guestRedirectPath, guestText }) {
6
6
  return (_jsx("main", { className: 'w-full h-full flex items-center justify-center bg-login-800 p-8', children: _jsxs("div", { className: 'flex flex-col justify-center items-center bg-login-600 px-4 py-12 rounded-xl w-full max-w-md gap-4 md:gap-6', children: [_jsx("div", { className: 'relative aspect-3/1 w-full', children: _jsx(Logo, { className: 'object-contain px-6 sm:px-12' }) }), _jsxs("h1", { className: 'text-3xl font-extrabold text-login text-center tracking-tight', children: [title, " ", btg ? ' - Break the Glass' : ''] }), description && (_jsx("p", { className: 'text-center font-medium text-lg mb-2 max-w-xs', children: description })), btg ? (_jsxs("form", { className: 'w-full flex flex-col gap-3 max-w-xs', onSubmit: e => {
7
7
  e.preventDefault();
8
8
  handleSubmit?.(new FormData(e.currentTarget));
9
9
  e.currentTarget.reset();
10
10
  }, children: [_jsx("input", { type: 'text', name: 'name', placeholder: 'Name', className: 'py-2 px-3 rounded bg-login-900 font-medium focus:outline-none', required: true }), _jsx("input", { type: 'password', name: 'token', placeholder: 'Token', className: 'py-2 px-3 rounded bg-login-900 font-medium focus:outline-none', required: true }), _jsx("button", { type: 'submit', className: 'py-2 px-4 rounded-xl bg-login font-bold text-lg ' +
11
- 'hover:bg-login/80 transition-all duration-200 mt-2', children: "Login" })] })) : (_jsxs(Link, { href: redirectURL, className: `
11
+ 'hover:bg-login/80 transition-all duration-200 mt-2', children: "Login" })] })) : (_jsxs(Link, { href: redirectPath, className: `
12
12
  flex items-center justify-center gap-2 w-full
13
13
  max-w-xs py-3 px-6 rounded-xl bg-login font-bold
14
14
  text-lg hover:bg-login/80 transition-all
15
15
  duration-200 mb-2 mt-2 cursor-pointer
16
- `, children: ["Login", _jsx(LogIn, { className: 'w-6 h-6' })] })), guestRedirectURL &&
17
- _jsx(Link, { href: guestRedirectURL, className: 'text-sm font-semibold cursor-pointer opacity-50', children: guestText || 'Continue as guest' }), _jsxs("span", { className: 'text-sm mt-2', children: ["v", version] })] }) }));
16
+ `, children: ["Login", _jsx(LogIn, { className: 'w-6 h-6' })] })), guestRedirectPath &&
17
+ _jsx(Link, { href: guestRedirectPath, className: 'text-sm font-semibold cursor-pointer opacity-50', children: guestText || 'Continue as guest' }), _jsxs("span", { className: 'text-sm mt-2', children: ["v", version] })] }) }));
18
18
  }
@@ -10,12 +10,14 @@
10
10
  --color-red-200: oklch(88.5% 0.062 18.334);
11
11
  --color-red-400: oklch(70.4% 0.191 22.216);
12
12
  --color-red-500: oklch(63.7% 0.237 25.331);
13
+ --color-red-600: oklch(57.7% 0.245 27.325);
13
14
  --color-red-700: oklch(50.5% 0.213 27.518);
14
15
  --color-red-900: oklch(39.6% 0.141 25.723);
15
16
  --color-yellow-400: oklch(85.2% 0.199 91.936);
16
17
  --color-yellow-500: oklch(79.5% 0.184 86.047);
17
18
  --color-yellow-600: oklch(68.1% 0.162 75.834);
18
19
  --color-green-500: oklch(72.3% 0.219 149.579);
20
+ --color-green-600: oklch(62.7% 0.194 149.214);
19
21
  --color-blue-500: oklch(62.3% 0.214 259.815);
20
22
  --color-blue-600: oklch(54.6% 0.245 262.881);
21
23
  --color-gray-200: oklch(92.8% 0.006 264.531);
@@ -1478,9 +1480,21 @@
1478
1480
  .bg-blue-600 {
1479
1481
  background-color: var(--color-blue-600);
1480
1482
  }
1483
+ .bg-blue-600\/70 {
1484
+ background-color: color-mix(in srgb, oklch(54.6% 0.245 262.881) 70%, transparent);
1485
+ @supports (color: color-mix(in lab, red, red)) {
1486
+ background-color: color-mix(in oklab, var(--color-blue-600) 70%, transparent);
1487
+ }
1488
+ }
1481
1489
  .bg-gray-900 {
1482
1490
  background-color: var(--color-gray-900);
1483
1491
  }
1492
+ .bg-green-600\/70 {
1493
+ background-color: color-mix(in srgb, oklch(62.7% 0.194 149.214) 70%, transparent);
1494
+ @supports (color: color-mix(in lab, red, red)) {
1495
+ background-color: color-mix(in oklab, var(--color-green-600) 70%, transparent);
1496
+ }
1497
+ }
1484
1498
  .bg-login {
1485
1499
  background-color: var(--color-login);
1486
1500
  }
@@ -1541,6 +1555,12 @@
1541
1555
  background-color: color-mix(in oklab, var(--color-login) 70%, transparent);
1542
1556
  }
1543
1557
  }
1558
+ .bg-red-600\/70 {
1559
+ background-color: color-mix(in srgb, oklch(57.7% 0.245 27.325) 70%, transparent);
1560
+ @supports (color: color-mix(in lab, red, red)) {
1561
+ background-color: color-mix(in oklab, var(--color-red-600) 70%, transparent);
1562
+ }
1563
+ }
1544
1564
  .bg-red-700\/80 {
1545
1565
  background-color: color-mix(in srgb, oklch(50.5% 0.213 27.518) 80%, transparent);
1546
1566
  @supports (color: color-mix(in lab, red, red)) {
@@ -1556,6 +1576,12 @@
1556
1576
  .bg-white {
1557
1577
  background-color: var(--color-white);
1558
1578
  }
1579
+ .bg-yellow-500\/70 {
1580
+ background-color: color-mix(in srgb, oklch(79.5% 0.184 86.047) 70%, transparent);
1581
+ @supports (color: color-mix(in lab, red, red)) {
1582
+ background-color: color-mix(in oklab, var(--color-yellow-500) 70%, transparent);
1583
+ }
1584
+ }
1559
1585
  .bg-yellow-600\/80 {
1560
1586
  background-color: color-mix(in srgb, oklch(68.1% 0.162 75.834) 80%, transparent);
1561
1587
  @supports (color: color-mix(in lab, red, red)) {
@@ -1906,6 +1932,12 @@
1906
1932
  outline-style: var(--tw-outline-style);
1907
1933
  outline-width: 1px;
1908
1934
  }
1935
+ .outline-blue-600 {
1936
+ outline-color: var(--color-blue-600);
1937
+ }
1938
+ .outline-green-600 {
1939
+ outline-color: var(--color-green-600);
1940
+ }
1909
1941
  .outline-login {
1910
1942
  outline-color: var(--color-login);
1911
1943
  }
@@ -1918,9 +1950,15 @@
1918
1950
  outline-color: color-mix(in oklab, var(--color-login-500) 60%, transparent);
1919
1951
  }
1920
1952
  }
1953
+ .outline-red-600 {
1954
+ outline-color: var(--color-red-600);
1955
+ }
1921
1956
  .outline-red-700 {
1922
1957
  outline-color: var(--color-red-700);
1923
1958
  }
1959
+ .outline-yellow-500 {
1960
+ outline-color: var(--color-yellow-500);
1961
+ }
1924
1962
  .outline-yellow-600 {
1925
1963
  outline-color: var(--color-yellow-600);
1926
1964
  }
@@ -2224,6 +2262,16 @@
2224
2262
  }
2225
2263
  }
2226
2264
  }
2265
+ .hover\:bg-blue-600\/90 {
2266
+ &:hover {
2267
+ @media (hover: hover) {
2268
+ background-color: color-mix(in srgb, oklch(54.6% 0.245 262.881) 90%, transparent);
2269
+ @supports (color: color-mix(in lab, red, red)) {
2270
+ background-color: color-mix(in oklab, var(--color-blue-600) 90%, transparent);
2271
+ }
2272
+ }
2273
+ }
2274
+ }
2227
2275
  .hover\:bg-gray-400\/10 {
2228
2276
  &:hover {
2229
2277
  @media (hover: hover) {
@@ -2234,6 +2282,16 @@
2234
2282
  }
2235
2283
  }
2236
2284
  }
2285
+ .hover\:bg-green-600\/90 {
2286
+ &:hover {
2287
+ @media (hover: hover) {
2288
+ background-color: color-mix(in srgb, oklch(62.7% 0.194 149.214) 90%, transparent);
2289
+ @supports (color: color-mix(in lab, red, red)) {
2290
+ background-color: color-mix(in oklab, var(--color-green-600) 90%, transparent);
2291
+ }
2292
+ }
2293
+ }
2294
+ }
2237
2295
  .hover\:bg-login\! {
2238
2296
  &:hover {
2239
2297
  @media (hover: hover) {
@@ -2298,6 +2356,16 @@
2298
2356
  }
2299
2357
  }
2300
2358
  }
2359
+ .hover\:bg-red-600\/90 {
2360
+ &:hover {
2361
+ @media (hover: hover) {
2362
+ background-color: color-mix(in srgb, oklch(57.7% 0.245 27.325) 90%, transparent);
2363
+ @supports (color: color-mix(in lab, red, red)) {
2364
+ background-color: color-mix(in oklab, var(--color-red-600) 90%, transparent);
2365
+ }
2366
+ }
2367
+ }
2368
+ }
2301
2369
  .hover\:bg-red-700 {
2302
2370
  &:hover {
2303
2371
  @media (hover: hover) {
@@ -2305,6 +2373,16 @@
2305
2373
  }
2306
2374
  }
2307
2375
  }
2376
+ .hover\:bg-yellow-500\/90 {
2377
+ &:hover {
2378
+ @media (hover: hover) {
2379
+ background-color: color-mix(in srgb, oklch(79.5% 0.184 86.047) 90%, transparent);
2380
+ @supports (color: color-mix(in lab, red, red)) {
2381
+ background-color: color-mix(in oklab, var(--color-yellow-500) 90%, transparent);
2382
+ }
2383
+ }
2384
+ }
2385
+ }
2308
2386
  .hover\:bg-yellow-600 {
2309
2387
  &:hover {
2310
2388
  @media (hover: hover) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uibee",
3
- "version": "2.9.2",
3
+ "version": "2.9.4",
4
4
  "description": "Shared components, functions and hooks for reuse across Login projects",
5
5
  "homepage": "https://github.com/Login-Linjeforening-for-IT/uibee#readme",
6
6
  "bugs": {
@@ -7,24 +7,31 @@ type ButtonProps = {
7
7
  icon: string | JSX.Element
8
8
  path?: string
9
9
  type?: 'button' | 'submit' | 'reset'
10
- color?: 'primary' | 'secondary'
10
+ variant?: 'primary' | 'secondary' | 'warning' | 'danger' | 'success' | 'info'
11
11
  onClick?: (_: object | string) => void
12
12
  disabled?: boolean
13
13
  }
14
14
 
15
+ const variants = {
16
+ primary: 'bg-login/70 outline-login hover:bg-login/90',
17
+ secondary: 'bg-login-500/70 outline-login-500 hover:bg-login-500/90',
18
+ warning: 'bg-yellow-500/70 outline-yellow-500 hover:bg-yellow-500/90',
19
+ danger: 'bg-red-600/70 outline-red-600 hover:bg-red-600/90',
20
+ success: 'bg-green-600/70 outline-green-600 hover:bg-green-600/90',
21
+ info: 'bg-blue-600/70 outline-blue-600 hover:bg-blue-600/90'
22
+ }
23
+
15
24
  export default function Button({
16
25
  text,
17
26
  className,
18
27
  icon,
19
28
  path,
20
- color,
29
+ variant = 'primary',
21
30
  type,
22
31
  onClick,
23
32
  disabled
24
33
  }: ButtonProps) {
25
- const bg = color === 'secondary'
26
- ? 'bg-login-500/70 outline-login-500 hover:bg-login-500/90'
27
- : 'bg-login/70 outline-login hover:bg-login/90'
34
+ const bg = variants[variant]
28
35
 
29
36
  if (!path) {
30
37
  return (
@@ -6,11 +6,11 @@ import Link from 'next/link'
6
6
  export default function LoginPage({
7
7
  title,
8
8
  description,
9
- redirectURL,
9
+ redirectPath,
10
10
  version,
11
11
  btg,
12
12
  handleSubmit,
13
- guestRedirectURL,
13
+ guestRedirectPath,
14
14
  guestText
15
15
  }: LoginPageProps) {
16
16
  return (
@@ -66,7 +66,7 @@ export default function LoginPage({
66
66
  </form>
67
67
  ) : (
68
68
  <Link
69
- href={redirectURL}
69
+ href={redirectPath}
70
70
  className={`
71
71
  flex items-center justify-center gap-2 w-full
72
72
  max-w-xs py-3 px-6 rounded-xl bg-login font-bold
@@ -78,9 +78,9 @@ export default function LoginPage({
78
78
  <LogIn className='w-6 h-6' />
79
79
  </Link>
80
80
  )}
81
- {guestRedirectURL &&
81
+ {guestRedirectPath &&
82
82
  <Link
83
- href={guestRedirectURL}
83
+ href={guestRedirectPath}
84
84
  className='text-sm font-semibold cursor-pointer opacity-50'
85
85
  >
86
86
  {guestText || 'Continue as guest'}
@@ -3,11 +3,11 @@ declare module 'uibee/components' {
3
3
  export interface LoginPageProps {
4
4
  title: string
5
5
  description?: string
6
- redirectURL: string
6
+ redirectPath: string
7
7
  version: string
8
8
  btg?: boolean
9
9
  handleSubmit?: (formData: FormData) => void
10
- guestRedirectURL?: string
10
+ guestRedirectPath?: string
11
11
  guestText?: string
12
12
  }
13
13