@temp-spotwork/ui 1.7.6 → 1.7.8
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/atoms/badge/badge.d.ts +2 -0
- package/dist/components/atoms/badge/badge.js +11 -9
- package/dist/components/atoms/badge/badge.stories.d.ts +1 -0
- package/dist/components/atoms/badge/badge.stories.js +10 -4
- package/dist/components/atoms/form/chips/chips.stories.d.ts +2 -0
- package/dist/components/atoms/form/chips/chips.stories.js +26 -8
- package/dist/components/atoms/form/chips/styles.d.ts +1 -0
- package/dist/components/atoms/form/chips/styles.js +2 -0
- package/dist/components/atoms/form/dropdown-item/dropdown-item.d.ts +40 -0
- package/dist/components/atoms/form/dropdown-item/dropdown-item.js +49 -0
- package/dist/components/atoms/form/dropdown-item/dropdown-item.stories.d.ts +11 -0
- package/dist/components/atoms/form/dropdown-item/dropdown-item.stories.js +109 -0
- package/dist/components/atoms/form/dropdown-item/index.d.ts +2 -0
- package/dist/components/atoms/form/dropdown-item/index.js +5 -0
- package/dist/components/atoms/form/dropdown-item/styles.d.ts +6 -0
- package/dist/components/atoms/form/dropdown-item/styles.js +9 -0
- package/dist/components/atoms/form/dropdown-search/dropdown-search.stories.d.ts +1 -0
- package/dist/components/atoms/form/dropdown-search/dropdown-search.stories.js +80 -53
- package/dist/components/atoms/form/typeahead/typeahead.d.ts +5 -1
- package/dist/components/atoms/form/typeahead/typeahead.js +60 -59
- package/dist/components/styles/colors/colormap.d.ts +4 -0
- package/dist/components/styles/colors/colormap.js +17 -13
- package/dist/main.d.ts +2 -0
- package/dist/main.js +144 -141
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { Typography as
|
|
3
|
-
const
|
|
2
|
+
import { Typography as d } from "../../styles/typography/typography.js";
|
|
3
|
+
const a = {
|
|
4
4
|
active: "active",
|
|
5
5
|
affirmative: "active",
|
|
6
6
|
affirmativeInverted: "activeInverted",
|
|
@@ -10,20 +10,22 @@ const t = {
|
|
|
10
10
|
warningInverted: "warningInverted",
|
|
11
11
|
alert: "alert",
|
|
12
12
|
alertInverted: "alertInverted",
|
|
13
|
+
paidBackup: "paidBackup",
|
|
14
|
+
paidBackupInverted: "paidBackupInverted",
|
|
13
15
|
disabled: "disabled",
|
|
14
16
|
disabledInverted: "disabledInverted"
|
|
15
17
|
};
|
|
16
|
-
function
|
|
17
|
-
const n =
|
|
18
|
+
function s({ text: t, color: r }) {
|
|
19
|
+
const n = a[r];
|
|
18
20
|
return /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
19
21
|
"div",
|
|
20
22
|
{
|
|
21
23
|
"data-testid": "Badge-container",
|
|
22
|
-
className: `px-[0.5rem] py-[0.2rem] bg-surface-${
|
|
24
|
+
className: `px-[0.5rem] py-[0.2rem] bg-surface-${a[r]} rounded-[0.9rem] min-w-[1.8rem] max-w-max h-[1.8rem] flex items-center place-content-around m-[0.1rem]`,
|
|
23
25
|
children: /* @__PURE__ */ e(
|
|
24
|
-
|
|
26
|
+
d,
|
|
25
27
|
{
|
|
26
|
-
children: `${
|
|
28
|
+
children: `${t}`.trim().toUpperCase(),
|
|
27
29
|
color: n,
|
|
28
30
|
swStyle: 6,
|
|
29
31
|
lineHeight: 1.4
|
|
@@ -33,6 +35,6 @@ function c({ text: a, color: r }) {
|
|
|
33
35
|
) });
|
|
34
36
|
}
|
|
35
37
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
s as Badge,
|
|
39
|
+
a as badgeColorVariants
|
|
38
40
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { f as o } from "../../../index-Dpx0xQmQ.js";
|
|
2
|
-
import { Badge as
|
|
2
|
+
import { Badge as a } from "./badge.js";
|
|
3
3
|
const e = {
|
|
4
4
|
title: "@spotwork-ui/badge",
|
|
5
|
-
component:
|
|
5
|
+
component: a,
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: "centered"
|
|
8
8
|
},
|
|
@@ -11,13 +11,19 @@ const e = {
|
|
|
11
11
|
backgroundColor: { control: "color" }
|
|
12
12
|
},
|
|
13
13
|
args: { onClick: o() }
|
|
14
|
-
},
|
|
14
|
+
}, c = {
|
|
15
15
|
args: {
|
|
16
16
|
text: "badge item",
|
|
17
17
|
color: "affirmative"
|
|
18
18
|
}
|
|
19
|
+
}, s = {
|
|
20
|
+
args: {
|
|
21
|
+
text: "Paid Backup",
|
|
22
|
+
color: "paidBackup"
|
|
23
|
+
}
|
|
19
24
|
};
|
|
20
25
|
export {
|
|
21
|
-
s as
|
|
26
|
+
s as PaidBackup,
|
|
27
|
+
c as Primary,
|
|
22
28
|
e as default
|
|
23
29
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as
|
|
2
|
-
import { Chips as
|
|
3
|
-
const
|
|
1
|
+
import { f as a } from "../../../../index-Dpx0xQmQ.js";
|
|
2
|
+
import { Chips as o } from "./chips.js";
|
|
3
|
+
const t = {
|
|
4
4
|
title: "@spotwork-ui/chips",
|
|
5
|
-
component:
|
|
5
|
+
component: o,
|
|
6
6
|
parameters: {
|
|
7
7
|
layout: "centered"
|
|
8
8
|
},
|
|
@@ -10,15 +10,33 @@ const a = {
|
|
|
10
10
|
argTypes: {
|
|
11
11
|
backgroundColor: { control: "color" }
|
|
12
12
|
},
|
|
13
|
-
args: { onClick:
|
|
14
|
-
},
|
|
13
|
+
args: { onClick: a() }
|
|
14
|
+
}, c = {
|
|
15
15
|
args: {
|
|
16
|
+
id: "primary",
|
|
16
17
|
chipText: "some chips",
|
|
17
18
|
color: "affirmative",
|
|
18
19
|
chipSelected: !1
|
|
19
20
|
}
|
|
21
|
+
}, e = {
|
|
22
|
+
args: {
|
|
23
|
+
id: "paid-backup-readonly",
|
|
24
|
+
chipText: "Ready to Work",
|
|
25
|
+
color: "paidBackup",
|
|
26
|
+
variant: "largeReadOnly",
|
|
27
|
+
infoBubbleContent: "icons:WaitingSmall"
|
|
28
|
+
}
|
|
29
|
+
}, p = {
|
|
30
|
+
args: {
|
|
31
|
+
id: "paid-backup-pill",
|
|
32
|
+
chipText: "Paid Backup",
|
|
33
|
+
color: "paidBackup",
|
|
34
|
+
variant: "pill"
|
|
35
|
+
}
|
|
20
36
|
};
|
|
21
37
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
38
|
+
e as PaidBackupLargeReadOnly,
|
|
39
|
+
p as PaidBackupPill,
|
|
40
|
+
c as Primary,
|
|
41
|
+
t as default
|
|
24
42
|
};
|
|
@@ -34,12 +34,14 @@ const n = (e) => ({
|
|
|
34
34
|
success: "success",
|
|
35
35
|
warning: "warning",
|
|
36
36
|
alert: "alert",
|
|
37
|
+
paidBackup: "paidBackup",
|
|
37
38
|
disabled: "disabled"
|
|
38
39
|
}, i = {
|
|
39
40
|
affirmative: "affirmativeInverted",
|
|
40
41
|
success: "successInverted",
|
|
41
42
|
warning: "warningInverted",
|
|
42
43
|
alert: "alertInverted",
|
|
44
|
+
paidBackup: "paidBackupInverted",
|
|
43
45
|
disabled: "disabledInverted"
|
|
44
46
|
};
|
|
45
47
|
export {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LabelValuePair } from '../form-types';
|
|
2
|
+
|
|
3
|
+
export type SpotterDropdownOption = LabelValuePair & {
|
|
4
|
+
/**
|
|
5
|
+
* URL of the spotter profile image.
|
|
6
|
+
*/
|
|
7
|
+
image?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional secondary line (e.g. email, role, location).
|
|
10
|
+
*/
|
|
11
|
+
subtitle?: string;
|
|
12
|
+
};
|
|
13
|
+
export type DropdownItemProps = {
|
|
14
|
+
/**
|
|
15
|
+
* Unique identifier for the avatar.
|
|
16
|
+
*/
|
|
17
|
+
avatarId: string;
|
|
18
|
+
/**
|
|
19
|
+
* Spotter display name.
|
|
20
|
+
*/
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* URL of the spotter profile image.
|
|
24
|
+
*/
|
|
25
|
+
image?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Text abbreviation fallback when no image is provided.
|
|
28
|
+
*/
|
|
29
|
+
textView?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional secondary line displayed below the name.
|
|
32
|
+
*/
|
|
33
|
+
subtitle?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Optional classes for the container.
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
};
|
|
39
|
+
export declare function DropdownItem({ avatarId, name, image, textView, subtitle, className, }: DropdownItemProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function renderSpotterDropdownOption(option: string | LabelValuePair | SpotterDropdownOption): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsxs as o, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { t as c } from "../../../../bundle-mjs-BjFsLjkg.js";
|
|
3
|
+
import { Avatar as p } from "../../avatar/avatar.js";
|
|
4
|
+
import { Typography as s } from "../../../styles/typography/typography.js";
|
|
5
|
+
import { getStyles as u } from "./styles.js";
|
|
6
|
+
function n({
|
|
7
|
+
avatarId: e,
|
|
8
|
+
name: t,
|
|
9
|
+
image: l,
|
|
10
|
+
textView: m,
|
|
11
|
+
subtitle: i,
|
|
12
|
+
className: d
|
|
13
|
+
}) {
|
|
14
|
+
const a = u();
|
|
15
|
+
return /* @__PURE__ */ o("div", { className: c(a.container, d), "data-testid": "dropdown-item", children: [
|
|
16
|
+
/* @__PURE__ */ r(
|
|
17
|
+
p,
|
|
18
|
+
{
|
|
19
|
+
id: e,
|
|
20
|
+
variant: "circular",
|
|
21
|
+
image: l,
|
|
22
|
+
textView: m ?? t,
|
|
23
|
+
size: 3.5
|
|
24
|
+
}
|
|
25
|
+
),
|
|
26
|
+
/* @__PURE__ */ o("div", { className: a.textContainer, children: [
|
|
27
|
+
/* @__PURE__ */ r(s, { swStyle: 5, color: "default", className: a.name, children: t }),
|
|
28
|
+
i && /* @__PURE__ */ r(s, { swStyle: 6, color: "subdued", className: a.subtitle, children: i })
|
|
29
|
+
] })
|
|
30
|
+
] });
|
|
31
|
+
}
|
|
32
|
+
function h(e) {
|
|
33
|
+
if (typeof e == "string")
|
|
34
|
+
return /* @__PURE__ */ r(n, { avatarId: e, name: e });
|
|
35
|
+
const t = e;
|
|
36
|
+
return /* @__PURE__ */ r(
|
|
37
|
+
n,
|
|
38
|
+
{
|
|
39
|
+
avatarId: t.value,
|
|
40
|
+
name: t.label,
|
|
41
|
+
image: t.image,
|
|
42
|
+
subtitle: t.subtitle
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
n as DropdownItem,
|
|
48
|
+
h as renderSpotterDropdownOption
|
|
49
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { DropdownItem } from './dropdown-item';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof DropdownItem>;
|
|
5
|
+
export default meta;
|
|
6
|
+
type Story = StoryObj<typeof meta>;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const WithoutImage: Story;
|
|
9
|
+
export declare const WithoutSubtitle: Story;
|
|
10
|
+
export declare const WithDropdownSearch: Story;
|
|
11
|
+
export declare const WithTypeahead: Story;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { useState as o } from "react";
|
|
3
|
+
import { DropdownItem as l, renderSpotterDropdownOption as a } from "./dropdown-item.js";
|
|
4
|
+
import { DropdownSearch as p } from "../dropdown-search/dropdown-search.js";
|
|
5
|
+
import { Typeahead as c } from "../typeahead/typeahead.js";
|
|
6
|
+
const s = [
|
|
7
|
+
{
|
|
8
|
+
label: "Sarah Johnson",
|
|
9
|
+
value: "spotter-1",
|
|
10
|
+
image: "https://i.pravatar.cc/150?u=spotter-1",
|
|
11
|
+
subtitle: "Toronto, ON"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
label: "Michael Chen",
|
|
15
|
+
value: "spotter-2",
|
|
16
|
+
image: "https://i.pravatar.cc/150?u=spotter-2",
|
|
17
|
+
subtitle: "Vancouver, BC"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "Emily Rodriguez",
|
|
21
|
+
value: "spotter-3",
|
|
22
|
+
subtitle: "Calgary, AB"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
label: "James Wilson",
|
|
26
|
+
value: "spotter-4",
|
|
27
|
+
image: "https://i.pravatar.cc/150?u=spotter-4"
|
|
28
|
+
}
|
|
29
|
+
], g = {
|
|
30
|
+
title: "@spotwork-ui/atoms/form/DropdownItem",
|
|
31
|
+
component: l,
|
|
32
|
+
parameters: {
|
|
33
|
+
layout: "centered",
|
|
34
|
+
docs: {
|
|
35
|
+
description: {
|
|
36
|
+
component: "A reusable dropdown row for spotter search results. Displays an avatar, name, and optional subtitle using design tokens."
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
tags: ["autodocs"],
|
|
41
|
+
argTypes: {
|
|
42
|
+
name: { control: "text" },
|
|
43
|
+
subtitle: { control: "text" },
|
|
44
|
+
image: { control: "text" }
|
|
45
|
+
}
|
|
46
|
+
}, n = {
|
|
47
|
+
args: {
|
|
48
|
+
avatarId: "spotter-1",
|
|
49
|
+
name: "Sarah Johnson",
|
|
50
|
+
image: "https://i.pravatar.cc/150?u=spotter-1",
|
|
51
|
+
subtitle: "Toronto, ON"
|
|
52
|
+
},
|
|
53
|
+
decorators: [
|
|
54
|
+
(t) => /* @__PURE__ */ e("div", { className: "w-[32rem] border border-bcolor-subdued rounded", children: /* @__PURE__ */ e("div", { className: "min-h-[4rem] w-full flex items-center border-b border-bcolor-subdued py-[0.75rem] px-[1rem]", children: /* @__PURE__ */ e(t, {}) }) })
|
|
55
|
+
]
|
|
56
|
+
}, w = {
|
|
57
|
+
args: {
|
|
58
|
+
avatarId: "spotter-3",
|
|
59
|
+
name: "Emily Rodriguez",
|
|
60
|
+
subtitle: "Calgary, AB"
|
|
61
|
+
},
|
|
62
|
+
decorators: n.decorators
|
|
63
|
+
}, y = {
|
|
64
|
+
args: {
|
|
65
|
+
avatarId: "spotter-4",
|
|
66
|
+
name: "James Wilson",
|
|
67
|
+
image: "https://i.pravatar.cc/150?u=spotter-4"
|
|
68
|
+
},
|
|
69
|
+
decorators: n.decorators
|
|
70
|
+
}, i = () => {
|
|
71
|
+
const [t, r] = o("");
|
|
72
|
+
return /* @__PURE__ */ e("div", { className: "w-[36rem]", children: /* @__PURE__ */ e(
|
|
73
|
+
p,
|
|
74
|
+
{
|
|
75
|
+
label: "Search spotters",
|
|
76
|
+
placeholder: "Search by name...",
|
|
77
|
+
options: s,
|
|
78
|
+
value: t,
|
|
79
|
+
selectValue: r,
|
|
80
|
+
renderOption: a
|
|
81
|
+
}
|
|
82
|
+
) });
|
|
83
|
+
}, S = {
|
|
84
|
+
render: () => /* @__PURE__ */ e(i, {})
|
|
85
|
+
}, d = () => {
|
|
86
|
+
const [t, r] = o("");
|
|
87
|
+
return /* @__PURE__ */ e("div", { className: "w-[36rem]", children: /* @__PURE__ */ e(
|
|
88
|
+
c,
|
|
89
|
+
{
|
|
90
|
+
label: "Search spotters",
|
|
91
|
+
placeholder: "Search by name...",
|
|
92
|
+
options: s,
|
|
93
|
+
value: t,
|
|
94
|
+
onChange: r,
|
|
95
|
+
selectValue: r,
|
|
96
|
+
renderOption: a
|
|
97
|
+
}
|
|
98
|
+
) });
|
|
99
|
+
}, f = {
|
|
100
|
+
render: () => /* @__PURE__ */ e(d, {})
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
n as Default,
|
|
104
|
+
S as WithDropdownSearch,
|
|
105
|
+
f as WithTypeahead,
|
|
106
|
+
w as WithoutImage,
|
|
107
|
+
y as WithoutSubtitle,
|
|
108
|
+
g as default
|
|
109
|
+
};
|
|
@@ -16,6 +16,7 @@ export declare const Controlled: Story;
|
|
|
16
16
|
export declare const ControlledWithExternalState: Story;
|
|
17
17
|
export declare const WithAddValue: Story;
|
|
18
18
|
export declare const CustomRenderOption: Story;
|
|
19
|
+
export declare const SpotterSearch: Story;
|
|
19
20
|
export declare const LargeDataset: Story;
|
|
20
21
|
export declare const AutoFocus: Story;
|
|
21
22
|
export declare const CustomNotFoundText: Story;
|