@pglevy/sailwind 0.1.0
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/README.md +219 -0
- package/dist/components/Button/ButtonArrayLayout.d.ts +37 -0
- package/dist/components/Button/ButtonArrayLayout.d.ts.map +1 -0
- package/dist/components/Button/ButtonArrayLayout.js +42 -0
- package/dist/components/Button/ButtonWidget.d.ts +75 -0
- package/dist/components/Button/ButtonWidget.d.ts.map +1 -0
- package/dist/components/Button/ButtonWidget.js +101 -0
- package/dist/components/Button/index.d.ts +5 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/Card/CardLayout.d.ts +55 -0
- package/dist/components/Card/CardLayout.d.ts.map +1 -0
- package/dist/components/Card/CardLayout.js +139 -0
- package/dist/components/Card/index.d.ts +3 -0
- package/dist/components/Card/index.d.ts.map +1 -0
- package/dist/components/Checkbox/CheckboxField.d.ts +65 -0
- package/dist/components/Checkbox/CheckboxField.d.ts.map +1 -0
- package/dist/components/Checkbox/CheckboxField.js +136 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.d.ts.map +1 -0
- package/dist/components/Dialog/DialogField.d.ts +51 -0
- package/dist/components/Dialog/DialogField.d.ts.map +1 -0
- package/dist/components/Dialog/DialogField.js +113 -0
- package/dist/components/Dialog/index.d.ts +3 -0
- package/dist/components/Dialog/index.d.ts.map +1 -0
- package/dist/components/Dropdown/DropdownField.d.ts +87 -0
- package/dist/components/Dropdown/DropdownField.d.ts.map +1 -0
- package/dist/components/Dropdown/DropdownField.js +7 -0
- package/dist/components/Dropdown/DropdownFieldBase.d.ts +54 -0
- package/dist/components/Dropdown/DropdownFieldBase.d.ts.map +1 -0
- package/dist/components/Dropdown/DropdownFieldBase.js +183 -0
- package/dist/components/Dropdown/MultipleDropdownField.d.ts +85 -0
- package/dist/components/Dropdown/MultipleDropdownField.d.ts.map +1 -0
- package/dist/components/Dropdown/MultipleDropdownField.js +7 -0
- package/dist/components/Dropdown/index.d.ts +5 -0
- package/dist/components/Dropdown/index.d.ts.map +1 -0
- package/dist/components/Heading/HeadingField.d.ts +48 -0
- package/dist/components/Heading/HeadingField.d.ts.map +1 -0
- package/dist/components/Heading/HeadingField.js +103 -0
- package/dist/components/Heading/index.d.ts +3 -0
- package/dist/components/Heading/index.d.ts.map +1 -0
- package/dist/components/Image/DocumentImage.d.ts +20 -0
- package/dist/components/Image/DocumentImage.d.ts.map +1 -0
- package/dist/components/Image/ImageField.d.ts +42 -0
- package/dist/components/Image/ImageField.d.ts.map +1 -0
- package/dist/components/Image/ImageField.js +159 -0
- package/dist/components/Image/UserImage.d.ts +49 -0
- package/dist/components/Image/UserImage.d.ts.map +1 -0
- package/dist/components/Image/index.d.ts +5 -0
- package/dist/components/Image/index.d.ts.map +1 -0
- package/dist/components/MessageBanner/MessageBanner.d.ts +33 -0
- package/dist/components/MessageBanner/MessageBanner.d.ts.map +1 -0
- package/dist/components/MessageBanner/MessageBanner.js +97 -0
- package/dist/components/MessageBanner/index.d.ts +2 -0
- package/dist/components/MessageBanner/index.d.ts.map +1 -0
- package/dist/components/Milestone/MilestoneField.d.ts +50 -0
- package/dist/components/Milestone/MilestoneField.d.ts.map +1 -0
- package/dist/components/Milestone/MilestoneField.js +206 -0
- package/dist/components/Milestone/index.d.ts +3 -0
- package/dist/components/Milestone/index.d.ts.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +32 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.js +117 -0
- package/dist/components/ProgressBar/index.d.ts +2 -0
- package/dist/components/ProgressBar/index.d.ts.map +1 -0
- package/dist/components/RadioButton/RadioButtonField.d.ts +63 -0
- package/dist/components/RadioButton/RadioButtonField.d.ts.map +1 -0
- package/dist/components/RadioButton/RadioButtonField.js +128 -0
- package/dist/components/RadioButton/index.d.ts +3 -0
- package/dist/components/RadioButton/index.d.ts.map +1 -0
- package/dist/components/RichText/Icon.d.ts +28 -0
- package/dist/components/RichText/Icon.d.ts.map +1 -0
- package/dist/components/RichText/Icon.js +94 -0
- package/dist/components/RichText/RichTextDisplayField.d.ts +36 -0
- package/dist/components/RichText/RichTextDisplayField.d.ts.map +1 -0
- package/dist/components/RichText/RichTextDisplayField.js +79 -0
- package/dist/components/RichText/TextItem.d.ts +27 -0
- package/dist/components/RichText/TextItem.d.ts.map +1 -0
- package/dist/components/RichText/TextItem.js +58 -0
- package/dist/components/RichText/index.d.ts +7 -0
- package/dist/components/RichText/index.d.ts.map +1 -0
- package/dist/components/Slider/SliderField.d.ts +63 -0
- package/dist/components/Slider/SliderField.d.ts.map +1 -0
- package/dist/components/Slider/SliderField.js +164 -0
- package/dist/components/Slider/index.d.ts +3 -0
- package/dist/components/Slider/index.d.ts.map +1 -0
- package/dist/components/Stamp/StampField.d.ts +48 -0
- package/dist/components/Stamp/StampField.d.ts.map +1 -0
- package/dist/components/Stamp/StampField.js +173 -0
- package/dist/components/Stamp/index.d.ts +3 -0
- package/dist/components/Stamp/index.d.ts.map +1 -0
- package/dist/components/Switch/SwitchField.d.ts +49 -0
- package/dist/components/Switch/SwitchField.d.ts.map +1 -0
- package/dist/components/Switch/SwitchField.js +106 -0
- package/dist/components/Switch/index.d.ts +3 -0
- package/dist/components/Switch/index.d.ts.map +1 -0
- package/dist/components/TableOfContents.d.ts +2 -0
- package/dist/components/TableOfContents.d.ts.map +1 -0
- package/dist/components/TableOfContents.js +142 -0
- package/dist/components/Tabs/TabsField.d.ts +50 -0
- package/dist/components/Tabs/TabsField.d.ts.map +1 -0
- package/dist/components/Tabs/TabsField.js +96 -0
- package/dist/components/Tabs/index.d.ts +3 -0
- package/dist/components/Tabs/index.d.ts.map +1 -0
- package/dist/components/Tag/TagField.d.ts +52 -0
- package/dist/components/Tag/TagField.d.ts.map +1 -0
- package/dist/components/Tag/TagField.js +125 -0
- package/dist/components/Tag/TagItem.d.ts +26 -0
- package/dist/components/Tag/TagItem.d.ts.map +1 -0
- package/dist/components/Tag/TagItem.js +4 -0
- package/dist/components/Tag/index.d.ts +5 -0
- package/dist/components/Tag/index.d.ts.map +1 -0
- package/dist/components/TextField/TextField.d.ts +88 -0
- package/dist/components/TextField/TextField.d.ts.map +1 -0
- package/dist/components/TextField/TextField.js +113 -0
- package/dist/components/TextField/index.d.ts +3 -0
- package/dist/components/TextField/index.d.ts.map +1 -0
- package/dist/components/Toggle/ToggleField.d.ts +62 -0
- package/dist/components/Toggle/ToggleField.d.ts.map +1 -0
- package/dist/components/Toggle/ToggleField.js +126 -0
- package/dist/components/Toggle/index.d.ts +3 -0
- package/dist/components/Toggle/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +22 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/shared/CollapsibleSection.d.ts +9 -0
- package/dist/components/shared/CollapsibleSection.d.ts.map +1 -0
- package/dist/components/shared/CollapsibleSection.js +39 -0
- package/dist/components/shared/FieldLabel.d.ts +27 -0
- package/dist/components/shared/FieldLabel.d.ts.map +1 -0
- package/dist/components/shared/FieldLabel.js +40 -0
- package/dist/components/shared/FieldWrapper.d.ts +35 -0
- package/dist/components/shared/FieldWrapper.d.ts.map +1 -0
- package/dist/components/shared/FieldWrapper.js +71 -0
- package/dist/components/shared/index.d.ts +6 -0
- package/dist/components/shared/index.d.ts.map +1 -0
- package/dist/esg_world_logo_no_year.png +0 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +58 -0
- package/dist/types/sail.d.ts +37 -0
- package/dist/types/sail.d.ts.map +1 -0
- package/dist/uifaces-human-avatar.jpg +0 -0
- package/dist/utils/classNames.d.ts +21 -0
- package/dist/utils/classNames.d.ts.map +1 -0
- package/dist/utils/classNames.js +16 -0
- package/dist/vite.svg +1 -0
- package/package.json +85 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { jsx as t, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import * as a from "@radix-ui/react-avatar";
|
|
4
|
+
import { FieldWrapper as D } from "../shared/FieldWrapper.js";
|
|
5
|
+
function z(l) {
|
|
6
|
+
return "imageType" in l && l.imageType === "user";
|
|
7
|
+
}
|
|
8
|
+
const W = ({
|
|
9
|
+
label: l,
|
|
10
|
+
labelPosition: d = "ABOVE",
|
|
11
|
+
instructions: u,
|
|
12
|
+
helpTooltip: f,
|
|
13
|
+
images: m,
|
|
14
|
+
showWhen: w = !0,
|
|
15
|
+
size: s = "MEDIUM",
|
|
16
|
+
isThumbnail: A = !1,
|
|
17
|
+
style: o = "STANDARD",
|
|
18
|
+
align: L = "START",
|
|
19
|
+
accessibilityText: p,
|
|
20
|
+
marginAbove: v = "NONE",
|
|
21
|
+
marginBelow: M = "STANDARD"
|
|
22
|
+
}) => {
|
|
23
|
+
if (!w) return null;
|
|
24
|
+
const S = `imagefield-${Math.random().toString(36).substr(2, 9)}`, E = {
|
|
25
|
+
ICON: "w-5 h-5",
|
|
26
|
+
// 20x20px
|
|
27
|
+
ICON_PLUS: "w-10 h-10",
|
|
28
|
+
// 40x40px
|
|
29
|
+
TINY: "w-16 h-32",
|
|
30
|
+
// ~60x120px
|
|
31
|
+
EXTRA_SMALL: "w-20 h-40",
|
|
32
|
+
// ~80x160px
|
|
33
|
+
SMALL: "w-24 h-48",
|
|
34
|
+
// ~100x200px
|
|
35
|
+
SMALL_PLUS: "w-36 h-72",
|
|
36
|
+
// ~150x300px
|
|
37
|
+
MEDIUM: "w-48 h-96",
|
|
38
|
+
// ~200x400px
|
|
39
|
+
MEDIUM_PLUS: "w-72 h-96",
|
|
40
|
+
// ~300x500px (limited by h-96)
|
|
41
|
+
LARGE: "w-96 h-96",
|
|
42
|
+
// ~400x600px (limited by available classes)
|
|
43
|
+
LARGE_PLUS: "w-96 h-96",
|
|
44
|
+
// ~600x800px (limited by available classes)
|
|
45
|
+
EXTRA_LARGE: "w-96 h-96",
|
|
46
|
+
// ~800x1000px (limited by available classes)
|
|
47
|
+
GALLERY: "w-60 h-20",
|
|
48
|
+
// 240x80px
|
|
49
|
+
FIT: "max-w-full h-auto"
|
|
50
|
+
// Natural dimensions
|
|
51
|
+
}, r = {
|
|
52
|
+
ICON: "w-5 h-5",
|
|
53
|
+
// 20x20px
|
|
54
|
+
ICON_PLUS: "w-10 h-10",
|
|
55
|
+
// 40x40px
|
|
56
|
+
TINY: "w-16 h-16",
|
|
57
|
+
// 64x64px
|
|
58
|
+
EXTRA_SMALL: "w-20 h-20",
|
|
59
|
+
// 80x80px
|
|
60
|
+
SMALL: "w-24 h-24",
|
|
61
|
+
// 96x96px
|
|
62
|
+
SMALL_PLUS: "w-36 h-36",
|
|
63
|
+
// 144x144px
|
|
64
|
+
MEDIUM: "w-48 h-48",
|
|
65
|
+
// 192x192px
|
|
66
|
+
MEDIUM_PLUS: "w-72 h-72",
|
|
67
|
+
// 288x288px
|
|
68
|
+
LARGE: "w-96 h-96",
|
|
69
|
+
// 384x384px
|
|
70
|
+
LARGE_PLUS: "w-96 h-96",
|
|
71
|
+
// 384x384px (same as LARGE)
|
|
72
|
+
EXTRA_LARGE: "w-96 h-96",
|
|
73
|
+
// 384x384px (same as LARGE)
|
|
74
|
+
GALLERY: "w-20 h-20",
|
|
75
|
+
// 80x80px (square version of gallery)
|
|
76
|
+
FIT: "max-w-full h-auto aspect-square"
|
|
77
|
+
// Natural dimensions, square
|
|
78
|
+
}, N = {
|
|
79
|
+
START: "justify-start",
|
|
80
|
+
CENTER: "justify-center",
|
|
81
|
+
END: "justify-end"
|
|
82
|
+
}, R = () => [
|
|
83
|
+
(o === "AVATAR" ? r : E)[s],
|
|
84
|
+
"object-cover",
|
|
85
|
+
// Maintain aspect ratio
|
|
86
|
+
o === "AVATAR" ? "rounded-full" : "rounded-sm",
|
|
87
|
+
A ? "cursor-pointer hover:opacity-80 transition-opacity" : ""
|
|
88
|
+
].filter(Boolean).join(" "), y = [
|
|
89
|
+
"flex flex-wrap gap-2",
|
|
90
|
+
N[L]
|
|
91
|
+
].filter(Boolean).join(" "), T = m.filter((e) => e.showWhen !== !1), I = /* @__PURE__ */ t("div", { className: y, children: T.map((e, n) => {
|
|
92
|
+
if (z(e)) {
|
|
93
|
+
const { user: i, altText: b, caption: U, link: c } = e, k = b || i?.name || "User profile photo", j = r[s], _ = i?.initials ? /* @__PURE__ */ t("span", { className: "font-medium text-gray-700", children: i.initials }) : (
|
|
94
|
+
// Default user icon SVG
|
|
95
|
+
/* @__PURE__ */ t("svg", { className: "w-3/5 h-3/5 text-gray-400", fill: "currentColor", viewBox: "0 0 20 20", children: /* @__PURE__ */ t("path", { fillRule: "evenodd", d: "M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z", clipRule: "evenodd" }) })
|
|
96
|
+
);
|
|
97
|
+
return /* @__PURE__ */ h(
|
|
98
|
+
a.Root,
|
|
99
|
+
{
|
|
100
|
+
className: `inline-flex items-center justify-center align-middle overflow-hidden select-none rounded-full bg-gray-100 ${j} ${c ? "cursor-pointer hover:opacity-80 transition-opacity" : ""}`,
|
|
101
|
+
title: U,
|
|
102
|
+
onClick: c,
|
|
103
|
+
children: [
|
|
104
|
+
/* @__PURE__ */ t(
|
|
105
|
+
a.Image,
|
|
106
|
+
{
|
|
107
|
+
className: "w-full h-full object-cover rounded-full",
|
|
108
|
+
src: i?.photoUrl,
|
|
109
|
+
alt: k
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ t(
|
|
113
|
+
a.Fallback,
|
|
114
|
+
{
|
|
115
|
+
className: "w-full h-full flex items-center justify-center bg-gray-100",
|
|
116
|
+
delayMs: 600,
|
|
117
|
+
children: _
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
n
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
const g = e.document.startsWith("/") ? e.document : `/${e.document}`, x = R(), C = () => {
|
|
126
|
+
e.link && e.link();
|
|
127
|
+
};
|
|
128
|
+
return /* @__PURE__ */ h("div", { className: "relative", children: [
|
|
129
|
+
/* @__PURE__ */ t(
|
|
130
|
+
"img",
|
|
131
|
+
{
|
|
132
|
+
src: g,
|
|
133
|
+
alt: e.altText || "",
|
|
134
|
+
title: e.caption,
|
|
135
|
+
className: x,
|
|
136
|
+
onClick: e.link ? C : void 0
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
e.link && /* @__PURE__ */ t("div", { className: "absolute inset-0 flex items-center justify-center opacity-0 hover:opacity-100 bg-black bg-opacity-20 transition-opacity rounded-sm", children: /* @__PURE__ */ t("div", { className: "w-6 h-6 bg-white rounded-full flex items-center justify-center", children: /* @__PURE__ */ t("svg", { className: "w-4 h-4 text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ t("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }) }) })
|
|
140
|
+
] }, n);
|
|
141
|
+
}) });
|
|
142
|
+
return /* @__PURE__ */ t(
|
|
143
|
+
D,
|
|
144
|
+
{
|
|
145
|
+
label: l,
|
|
146
|
+
labelPosition: d,
|
|
147
|
+
instructions: u,
|
|
148
|
+
helpTooltip: f,
|
|
149
|
+
accessibilityText: p,
|
|
150
|
+
inputId: S,
|
|
151
|
+
marginAbove: v,
|
|
152
|
+
marginBelow: M,
|
|
153
|
+
children: I
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
};
|
|
157
|
+
export {
|
|
158
|
+
W as ImageField
|
|
159
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock User type - in production, this would come from your data layer
|
|
3
|
+
* For prototyping, we just need a way to represent user data
|
|
4
|
+
*/
|
|
5
|
+
export interface User {
|
|
6
|
+
/** User's full name for display */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** URL to user's profile photo */
|
|
9
|
+
photoUrl?: string;
|
|
10
|
+
/** User's initials for fallback display */
|
|
11
|
+
initials?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UserImageProps {
|
|
14
|
+
/** Discriminator to identify this as a user image */
|
|
15
|
+
imageType: 'user';
|
|
16
|
+
/** The user whose profile photo will be shown */
|
|
17
|
+
user?: User;
|
|
18
|
+
/** Alternate text for accessibility and screen readers */
|
|
19
|
+
altText?: string;
|
|
20
|
+
/** Optional caption text for mouseover (tooltip) */
|
|
21
|
+
caption?: string;
|
|
22
|
+
/** Link behavior when image is clicked */
|
|
23
|
+
link?: () => void;
|
|
24
|
+
/** Controls visibility of the image */
|
|
25
|
+
showWhen?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* User image interface for use within ImageField
|
|
29
|
+
* Maps to SAIL's a!userImage() function
|
|
30
|
+
*
|
|
31
|
+
* This is not a React component - it's a data structure
|
|
32
|
+
* that gets processed by ImageField for rendering with Radix Avatar
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* <ImageField
|
|
36
|
+
* label="Assigned To"
|
|
37
|
+
* images={[
|
|
38
|
+
* {
|
|
39
|
+
* imageType: 'user',
|
|
40
|
+
* user: { name: "John Smith", photoUrl: "/avatars/john.jpg", initials: "JS" },
|
|
41
|
+
* altText: "John Smith profile photo",
|
|
42
|
+
* caption: "Click to view profile"
|
|
43
|
+
* }
|
|
44
|
+
* ]}
|
|
45
|
+
* style="AVATAR"
|
|
46
|
+
* size="MEDIUM"
|
|
47
|
+
* />
|
|
48
|
+
*/
|
|
49
|
+
//# sourceMappingURL=UserImage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserImage.d.ts","sourceRoot":"","sources":["../../../src/components/Image/UserImage.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,IAAI;IACnB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,qDAAqD;IACrD,SAAS,EAAE,MAAM,CAAA;IACjB,iDAAiD;IACjD,IAAI,CAAC,EAAE,IAAI,CAAA;IACX,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,oDAAoD;IACpD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Image/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACzD,YAAY,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { SAILShape, SAILMarginSize } from '../../types/sail';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type BackgroundColor = "INFO" | "SUCCESS" | "WARN" | "ERROR" | string;
|
|
4
|
+
export type HighlightColor = "INFO" | "POSITIVE" | "WARN" | "NEGATIVE" | string;
|
|
5
|
+
export type AnnounceBehavior = "DISPLAY_ONLY" | "DISPLAY_AND_ANNOUNCE" | "ANNOUNCE_ONLY";
|
|
6
|
+
export interface MessageBannerProps {
|
|
7
|
+
/** Text to display on the first line inside the banner */
|
|
8
|
+
primaryText?: string;
|
|
9
|
+
/** Text to display beneath the primary text inside the banner */
|
|
10
|
+
secondaryText?: string;
|
|
11
|
+
/** Background color - semantic values or hex color (with optional transparency) */
|
|
12
|
+
backgroundColor?: BackgroundColor;
|
|
13
|
+
/** Color of the decorative bar and icon - semantic values or hex color */
|
|
14
|
+
highlightColor?: HighlightColor;
|
|
15
|
+
/** Icon to display before the primary text (decorative only) */
|
|
16
|
+
icon?: "info" | "success" | "warning" | "error";
|
|
17
|
+
/** Whether to show the decorative bar */
|
|
18
|
+
showDecorativeBar?: boolean;
|
|
19
|
+
/** Banner shape */
|
|
20
|
+
shape?: SAILShape;
|
|
21
|
+
/** Space above the banner */
|
|
22
|
+
marginAbove?: SAILMarginSize;
|
|
23
|
+
/** Space below the banner */
|
|
24
|
+
marginBelow?: SAILMarginSize;
|
|
25
|
+
/** Whether the component is evaluated */
|
|
26
|
+
showWhen?: boolean;
|
|
27
|
+
/** Screen reader behavior for announcing banner text */
|
|
28
|
+
announceBehavior?: AnnounceBehavior;
|
|
29
|
+
/** Additional text for screen readers only */
|
|
30
|
+
accessibilityText?: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const MessageBanner: React.FC<MessageBannerProps>;
|
|
33
|
+
//# sourceMappingURL=MessageBanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageBanner.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBanner/MessageBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAC5E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAA;AAC/E,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,sBAAsB,GAAG,eAAe,CAAA;AAExF,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mFAAmF;IACnF,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;IAC/C,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,mBAAmB;IACnB,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,6BAA6B;IAC7B,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,6BAA6B;IAC7B,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,wDAAwD;IACxD,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;IACnC,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA6JtD,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { AlertCircle as _, AlertTriangle as w, CheckCircle as L, Info as y } from "lucide-react";
|
|
4
|
+
const F = ({
|
|
5
|
+
primaryText: r,
|
|
6
|
+
secondaryText: N,
|
|
7
|
+
backgroundColor: t = "INFO",
|
|
8
|
+
highlightColor: s = "INFO",
|
|
9
|
+
icon: m,
|
|
10
|
+
showDecorativeBar: O = !0,
|
|
11
|
+
shape: u = "SQUARED",
|
|
12
|
+
marginAbove: p = "NONE",
|
|
13
|
+
marginBelow: x = "STANDARD",
|
|
14
|
+
showWhen: f = !0,
|
|
15
|
+
announceBehavior: i = "DISPLAY_ONLY",
|
|
16
|
+
accessibilityText: c
|
|
17
|
+
}) => {
|
|
18
|
+
if (!f) return null;
|
|
19
|
+
const R = i === "ANNOUNCE_ONLY", D = {
|
|
20
|
+
NONE: "mt-0",
|
|
21
|
+
EVEN_LESS: "mt-1",
|
|
22
|
+
LESS: "mt-2",
|
|
23
|
+
STANDARD: "mt-4",
|
|
24
|
+
MORE: "mt-6",
|
|
25
|
+
EVEN_MORE: "mt-8"
|
|
26
|
+
}, h = {
|
|
27
|
+
NONE: "mb-0",
|
|
28
|
+
EVEN_LESS: "mb-1",
|
|
29
|
+
LESS: "mb-2",
|
|
30
|
+
STANDARD: "mb-4",
|
|
31
|
+
MORE: "mb-6",
|
|
32
|
+
EVEN_MORE: "mb-8"
|
|
33
|
+
}, M = {
|
|
34
|
+
SQUARED: "rounded-none",
|
|
35
|
+
SEMI_ROUNDED: "rounded-sm",
|
|
36
|
+
ROUNDED: "rounded-md"
|
|
37
|
+
}, E = {
|
|
38
|
+
INFO: { bg: "bg-blue-100", text: "text-blue-900" },
|
|
39
|
+
SUCCESS: { bg: "bg-green-100", text: "text-green-900" },
|
|
40
|
+
WARN: { bg: "bg-yellow-100", text: "text-yellow-900" },
|
|
41
|
+
ERROR: { bg: "bg-red-100", text: "text-red-900" }
|
|
42
|
+
}, d = {
|
|
43
|
+
INFO: "bg-blue-500",
|
|
44
|
+
POSITIVE: "bg-green-700",
|
|
45
|
+
WARN: "bg-yellow-500",
|
|
46
|
+
NEGATIVE: "bg-red-700"
|
|
47
|
+
}, g = m ? {
|
|
48
|
+
info: y,
|
|
49
|
+
success: L,
|
|
50
|
+
warning: w,
|
|
51
|
+
error: _
|
|
52
|
+
}[m] : null, n = t in E, b = n ? E[t] : { bg: "", text: "text-gray-900" }, l = s in d, I = l ? d[s] : "", C = [
|
|
53
|
+
"relative",
|
|
54
|
+
"flex",
|
|
55
|
+
"items-start",
|
|
56
|
+
"p-4",
|
|
57
|
+
M[u],
|
|
58
|
+
D[p],
|
|
59
|
+
h[x],
|
|
60
|
+
n ? b.bg : "",
|
|
61
|
+
n ? b.text : "text-gray-900",
|
|
62
|
+
R && "sr-only"
|
|
63
|
+
].filter(Boolean).join(" "), S = {};
|
|
64
|
+
!n && t && (S.backgroundColor = t);
|
|
65
|
+
const A = {};
|
|
66
|
+
!l && s && (A.backgroundColor = s);
|
|
67
|
+
const a = {};
|
|
68
|
+
return (i === "DISPLAY_AND_ANNOUNCE" || i === "ANNOUNCE_ONLY") && (a.role = "status", a["aria-live"] = "polite"), /* @__PURE__ */ o(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
className: C,
|
|
72
|
+
style: S,
|
|
73
|
+
...a,
|
|
74
|
+
children: [
|
|
75
|
+
O && /* @__PURE__ */ e(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
className: `absolute left-0 top-0 bottom-0 w-1 ${l ? I : ""}`,
|
|
79
|
+
style: l ? void 0 : A,
|
|
80
|
+
"aria-hidden": "true"
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ o("div", { className: "flex items-start w-full pl-3", children: [
|
|
84
|
+
g && /* @__PURE__ */ e("div", { className: "flex-shrink-0 mr-3 mt-0.5", "aria-hidden": "true", children: /* @__PURE__ */ e(g, { className: "w-5 h-5" }) }),
|
|
85
|
+
/* @__PURE__ */ o("div", { className: "flex-1 min-w-0", children: [
|
|
86
|
+
r && /* @__PURE__ */ e("p", { className: "text-base font-medium leading-5", children: r }),
|
|
87
|
+
N && /* @__PURE__ */ e("p", { className: `text-sm leading-5 ${r ? "mt-1" : ""}`, children: N })
|
|
88
|
+
] })
|
|
89
|
+
] }),
|
|
90
|
+
c && /* @__PURE__ */ e("span", { className: "sr-only", children: c })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
export {
|
|
96
|
+
F as MessageBanner
|
|
97
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/MessageBanner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { SAILLabelPosition, SAILMarginSize } from '../../types/sail';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
type Orientation = "HORIZONTAL" | "VERTICAL";
|
|
4
|
+
type StepStyle = "LINE" | "CHEVRON" | "DOT";
|
|
5
|
+
type Color = "ACCENT" | "POSITIVE" | "NEGATIVE" | "WARN" | string;
|
|
6
|
+
export interface MilestoneFieldProps {
|
|
7
|
+
/** Text to display as the field label */
|
|
8
|
+
label?: string;
|
|
9
|
+
/** Supplemental text about this field */
|
|
10
|
+
instructions?: string;
|
|
11
|
+
/** Array of labels describing the sequence of steps */
|
|
12
|
+
steps: string[];
|
|
13
|
+
/** Array of links to apply to the steps */
|
|
14
|
+
links?: any[];
|
|
15
|
+
/** Index of the current step. When null, all steps are future. When -1, all steps are completed */
|
|
16
|
+
active?: number | null;
|
|
17
|
+
/** Determines where the label appears */
|
|
18
|
+
labelPosition?: SAILLabelPosition;
|
|
19
|
+
/** Displays a help icon with tooltip text */
|
|
20
|
+
helpTooltip?: string;
|
|
21
|
+
/** Determines whether the component is displayed */
|
|
22
|
+
showWhen?: boolean;
|
|
23
|
+
/** Determines the layout of the milestone steps */
|
|
24
|
+
orientation?: Orientation;
|
|
25
|
+
/** Additional text for screen readers */
|
|
26
|
+
accessibilityText?: string;
|
|
27
|
+
/** Determines the fill color */
|
|
28
|
+
color?: Color;
|
|
29
|
+
/** Determines how much space is added above the layout */
|
|
30
|
+
marginAbove?: SAILMarginSize;
|
|
31
|
+
/** Determines how much space is added below the layout */
|
|
32
|
+
marginBelow?: SAILMarginSize;
|
|
33
|
+
/** Determines the style of the milestone steps */
|
|
34
|
+
stepStyle?: StepStyle;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Displays the completed, current, and future steps of a process or sequence
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <MilestoneField
|
|
41
|
+
* label="Home Repair Claim Process"
|
|
42
|
+
* instructions="Customer #2325691"
|
|
43
|
+
* steps={["Submit Request", "Set Up Appointment", "File Assessment", "Submit Proposal"]}
|
|
44
|
+
* active={2}
|
|
45
|
+
* color="ACCENT"
|
|
46
|
+
* />
|
|
47
|
+
*/
|
|
48
|
+
export declare const MilestoneField: React.FC<MilestoneFieldProps>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=MilestoneField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MilestoneField.d.ts","sourceRoot":"","sources":["../../../src/components/Milestone/MilestoneField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEzE,KAAK,WAAW,GAAG,YAAY,GAAG,UAAU,CAAA;AAC5C,KAAK,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,KAAK,CAAA;AAC3C,KAAK,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;AAEjE,MAAM,WAAW,mBAAmB;IAClC,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uDAAuD;IACvD,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,2CAA2C;IAC3C,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;IACb,mGAAmG;IACnG,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,yCAAyC;IACzC,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mDAAmD;IACnD,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gCAAgC;IAChC,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,0DAA0D;IAC1D,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,kDAAkD;IAClD,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAsTxD,CAAA"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { jsxs as s, jsx as t, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { FieldLabel as k } from "../shared/FieldLabel.js";
|
|
4
|
+
const M = ({
|
|
5
|
+
label: x,
|
|
6
|
+
instructions: g,
|
|
7
|
+
steps: c,
|
|
8
|
+
links: f = [],
|
|
9
|
+
active: d = null,
|
|
10
|
+
labelPosition: y = "ABOVE",
|
|
11
|
+
helpTooltip: C,
|
|
12
|
+
showWhen: h = !0,
|
|
13
|
+
orientation: n = "HORIZONTAL",
|
|
14
|
+
accessibilityText: E,
|
|
15
|
+
color: v = "ACCENT",
|
|
16
|
+
marginAbove: O = "NONE",
|
|
17
|
+
marginBelow: p = "STANDARD",
|
|
18
|
+
stepStyle: a = "LINE"
|
|
19
|
+
}) => {
|
|
20
|
+
if (!h) return null;
|
|
21
|
+
const u = `milestone-${Math.random().toString(36).slice(2, 11)}`, $ = {
|
|
22
|
+
NONE: "mt-0",
|
|
23
|
+
EVEN_LESS: "mt-1",
|
|
24
|
+
LESS: "mt-2",
|
|
25
|
+
STANDARD: "mt-4",
|
|
26
|
+
MORE: "mt-6",
|
|
27
|
+
EVEN_MORE: "mt-8"
|
|
28
|
+
}, R = {
|
|
29
|
+
NONE: "mb-0",
|
|
30
|
+
EVEN_LESS: "mb-1",
|
|
31
|
+
LESS: "mb-2",
|
|
32
|
+
STANDARD: "mb-4",
|
|
33
|
+
MORE: "mb-6",
|
|
34
|
+
EVEN_MORE: "mb-8"
|
|
35
|
+
}, r = ((l) => {
|
|
36
|
+
const o = {
|
|
37
|
+
ACCENT: { bg: "bg-blue-500", text: "text-blue-500", border: "border-blue-500" },
|
|
38
|
+
POSITIVE: { bg: "bg-green-700", text: "text-green-700", border: "border-green-700" },
|
|
39
|
+
NEGATIVE: { bg: "bg-red-700", text: "text-red-700", border: "border-red-700" },
|
|
40
|
+
WARN: { bg: "bg-yellow-500", text: "text-yellow-500", border: "border-yellow-500" }
|
|
41
|
+
};
|
|
42
|
+
return o[l] ? {
|
|
43
|
+
...o[l],
|
|
44
|
+
style: void 0
|
|
45
|
+
} : {
|
|
46
|
+
bg: "",
|
|
47
|
+
text: "",
|
|
48
|
+
border: "",
|
|
49
|
+
style: { backgroundColor: l, borderColor: l, color: l }
|
|
50
|
+
};
|
|
51
|
+
})(v), A = (l) => d === null ? "future" : d === -1 || l < d ? "completed" : l === d ? "current" : "future", L = (l, o) => {
|
|
52
|
+
const e = A(o), b = f[o], m = o + 1, N = /* @__PURE__ */ s("div", { className: `flex ${a === "DOT" && n === "VERTICAL" ? "items-start" : a === "CHEVRON" ? "items-center" : "flex-col items-center"} ${n === "VERTICAL" ? "relative" : ""}`, children: [
|
|
53
|
+
/* @__PURE__ */ s("div", { className: "flex items-center justify-center relative", children: [
|
|
54
|
+
a === "DOT" && /* @__PURE__ */ s(I, { children: [
|
|
55
|
+
/* @__PURE__ */ t(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: `w-3 h-3 rounded-full border-2 relative z-10 flex-shrink-0 ${e === "completed" ? `${r.bg} ${r.border}` : e === "current" ? `bg-white ${r.border}` : "bg-gray-200 border-gray-300"}`,
|
|
59
|
+
style: r.style ? {
|
|
60
|
+
backgroundColor: e === "completed" ? r.style.backgroundColor : e === "current" ? "white" : void 0,
|
|
61
|
+
borderColor: e === "completed" || e === "current" ? r.style.borderColor : void 0
|
|
62
|
+
} : void 0
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
n === "VERTICAL" && o < c.length - 1 && /* @__PURE__ */ t(
|
|
66
|
+
"div",
|
|
67
|
+
{
|
|
68
|
+
className: `absolute top-3 left-1.5 w-0.5 h-[32px] transform -translate-x-px ${e === "completed" ? r.bg || "bg-gray-400" : "bg-gray-200"}`,
|
|
69
|
+
style: r.style && e === "completed" ? {
|
|
70
|
+
backgroundColor: r.style.backgroundColor
|
|
71
|
+
} : void 0
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
] }),
|
|
75
|
+
a === "LINE" && /* @__PURE__ */ t(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
className: `w-6 h-6 rounded-full border-2 flex items-center justify-center text-xs font-semibold relative z-10 ${e === "completed" || e === "current" ? `${r.bg} ${r.border} text-white` : "bg-gray-200 border-gray-300 text-gray-600"}`,
|
|
79
|
+
style: r.style ? {
|
|
80
|
+
backgroundColor: e === "completed" || e === "current" ? r.style.backgroundColor : void 0,
|
|
81
|
+
borderColor: e === "completed" || e === "current" ? r.style.borderColor : void 0,
|
|
82
|
+
color: e === "completed" || e === "current" ? "white" : void 0
|
|
83
|
+
} : void 0,
|
|
84
|
+
children: m
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
a === "CHEVRON" && /* @__PURE__ */ s("div", { className: "relative flex items-center", children: [
|
|
88
|
+
/* @__PURE__ */ t(
|
|
89
|
+
"div",
|
|
90
|
+
{
|
|
91
|
+
className: `px-4 py-2 text-base font-medium relative ${e === "completed" || e === "current" ? `${r.bg} text-white` : "bg-gray-200 text-gray-600"}`,
|
|
92
|
+
style: r.style && (e === "completed" || e === "current") ? {
|
|
93
|
+
backgroundColor: r.style.backgroundColor,
|
|
94
|
+
color: "white"
|
|
95
|
+
} : void 0,
|
|
96
|
+
children: l
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
n === "HORIZONTAL" && o < c.length - 1 && /* @__PURE__ */ t(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
className: `w-0 h-0 border-l-[16px] border-y-[20px] border-y-transparent relative z-10 ${e === "completed" || e === "current" ? r.border : "border-l-gray-200"}`,
|
|
103
|
+
style: r.style && (e === "completed" || e === "current") ? {
|
|
104
|
+
borderLeftColor: r.style.backgroundColor
|
|
105
|
+
} : void 0
|
|
106
|
+
}
|
|
107
|
+
),
|
|
108
|
+
n === "VERTICAL" && o < c.length - 1 && /* @__PURE__ */ t(
|
|
109
|
+
"div",
|
|
110
|
+
{
|
|
111
|
+
className: `absolute -bottom-2 left-4 w-0 h-0 border-t-[16px] border-x-[20px] border-x-transparent ${e === "completed" || e === "current" ? r.border : "border-t-gray-200"}`,
|
|
112
|
+
style: r.style && (e === "completed" || e === "current") ? {
|
|
113
|
+
borderTopColor: r.style.backgroundColor
|
|
114
|
+
} : void 0
|
|
115
|
+
}
|
|
116
|
+
)
|
|
117
|
+
] })
|
|
118
|
+
] }),
|
|
119
|
+
a !== "CHEVRON" && /* @__PURE__ */ t(
|
|
120
|
+
"span",
|
|
121
|
+
{
|
|
122
|
+
className: `${a === "DOT" && n === "VERTICAL" ? "ml-3 text-base leading-3" : "mt-2 text-base text-center"} ${e === "current" ? "font-semibold" : "font-normal"} ${e === "completed" || e === "current" ? r.text || "text-gray-900" : "text-gray-500"}`,
|
|
123
|
+
style: r.style && (e === "completed" || e === "current") ? {
|
|
124
|
+
color: r.style.color
|
|
125
|
+
} : void 0,
|
|
126
|
+
children: l
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
] });
|
|
130
|
+
return b ? /* @__PURE__ */ t(
|
|
131
|
+
"button",
|
|
132
|
+
{
|
|
133
|
+
onClick: () => {
|
|
134
|
+
const i = b.onClick || b.saveInto;
|
|
135
|
+
i && typeof i == "function" && i(b.value);
|
|
136
|
+
},
|
|
137
|
+
className: `text-left hover:opacity-80 transition-opacity ${n === "HORIZONTAL" && a === "LINE" ? "flex-1" : ""}`,
|
|
138
|
+
"aria-label": `${l} - Step ${m}`,
|
|
139
|
+
children: N
|
|
140
|
+
},
|
|
141
|
+
o
|
|
142
|
+
) : /* @__PURE__ */ t(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
"aria-label": `${l} - Step ${m}`,
|
|
146
|
+
className: n === "HORIZONTAL" && a === "LINE" ? "flex-1" : "",
|
|
147
|
+
children: N
|
|
148
|
+
},
|
|
149
|
+
o
|
|
150
|
+
);
|
|
151
|
+
}, T = [
|
|
152
|
+
$[O],
|
|
153
|
+
R[p]
|
|
154
|
+
].filter(Boolean).join(" ");
|
|
155
|
+
return /* @__PURE__ */ s("div", { className: T, children: [
|
|
156
|
+
/* @__PURE__ */ t(
|
|
157
|
+
k,
|
|
158
|
+
{
|
|
159
|
+
label: x,
|
|
160
|
+
labelPosition: y,
|
|
161
|
+
helpTooltip: C,
|
|
162
|
+
htmlFor: u,
|
|
163
|
+
accessibilityText: E
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
/* @__PURE__ */ s(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
id: u,
|
|
170
|
+
className: n === "HORIZONTAL" ? "relative" : "flex flex-col",
|
|
171
|
+
role: "progressbar",
|
|
172
|
+
"aria-valuemin": 0,
|
|
173
|
+
"aria-valuemax": c.length - 1,
|
|
174
|
+
"aria-valuenow": d ?? 0,
|
|
175
|
+
"aria-valuetext": d !== null && d >= 0 && d < c.length ? c[d] : void 0,
|
|
176
|
+
children: [
|
|
177
|
+
n === "HORIZONTAL" && a === "LINE" && c.length > 1 && /* @__PURE__ */ t(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
className: "absolute top-3 h-0.5 bg-gray-200 z-0",
|
|
181
|
+
style: {
|
|
182
|
+
left: `calc(100% / ${c.length} / 2)`,
|
|
183
|
+
right: `calc(100% / ${c.length} / 2)`
|
|
184
|
+
},
|
|
185
|
+
children: /* @__PURE__ */ t(
|
|
186
|
+
"div",
|
|
187
|
+
{
|
|
188
|
+
className: `h-full transition-all duration-300 ${r.bg || "bg-gray-400"}`,
|
|
189
|
+
style: {
|
|
190
|
+
width: d === null ? "0%" : d === -1 ? "100%" : `${d / (c.length - 1) * 100}%`,
|
|
191
|
+
...r.style ? { backgroundColor: r.style.backgroundColor } : {}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
),
|
|
197
|
+
/* @__PURE__ */ t("div", { className: n === "HORIZONTAL" ? a === "CHEVRON" ? "flex items-center" : "flex items-start" : a === "CHEVRON" ? "flex flex-col space-y-4" : "flex flex-col space-y-8", children: c.map((l, o) => L(l, o)) })
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
),
|
|
201
|
+
g && /* @__PURE__ */ t("p", { className: "text-gray-700 text-sm mt-1", children: g })
|
|
202
|
+
] });
|
|
203
|
+
};
|
|
204
|
+
export {
|
|
205
|
+
M as MilestoneField
|
|
206
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Milestone/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { SAILLabelPosition, SAILMarginSize } from '../../types/sail';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type ProgressBarColor = "ACCENT" | "POSITIVE" | "NEGATIVE" | "WARN" | string;
|
|
4
|
+
export type ProgressBarStyle = "THIN" | "THICK";
|
|
5
|
+
export interface ProgressBarProps {
|
|
6
|
+
/** Text to display as the field label */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Supplemental text about this field */
|
|
9
|
+
instructions?: string;
|
|
10
|
+
/** Number to display between 0 and 100 */
|
|
11
|
+
percentage: number;
|
|
12
|
+
/** Determines where the label appears */
|
|
13
|
+
labelPosition?: SAILLabelPosition;
|
|
14
|
+
/** Help tooltip text */
|
|
15
|
+
helpTooltip?: string;
|
|
16
|
+
/** Additional text for screen readers only */
|
|
17
|
+
accessibilityText?: string;
|
|
18
|
+
/** Progress bar color - semantic values or hex color */
|
|
19
|
+
color?: ProgressBarColor;
|
|
20
|
+
/** Whether the component is displayed */
|
|
21
|
+
showWhen?: boolean;
|
|
22
|
+
/** Thickness of the progress bar */
|
|
23
|
+
style?: ProgressBarStyle;
|
|
24
|
+
/** Whether to display the percentage text */
|
|
25
|
+
showPercentage?: boolean;
|
|
26
|
+
/** Space above the component */
|
|
27
|
+
marginAbove?: SAILMarginSize;
|
|
28
|
+
/** Space below the component */
|
|
29
|
+
marginBelow?: SAILMarginSize;
|
|
30
|
+
}
|
|
31
|
+
export declare const ProgressBar: React.FC<ProgressBarProps>;
|
|
32
|
+
//# sourceMappingURL=ProgressBar.d.ts.map
|