@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 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressBar/ProgressBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGzE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;AACnF,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAA;AAE/C,MAAM,WAAW,gBAAgB;IAC/B,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0CAA0C;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,yCAAyC;IACzC,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8CAA8C;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,wDAAwD;IACxD,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oCAAoC;IACpC,KAAK,CAAC,EAAE,gBAAgB,CAAA;IACxB,6CAA6C;IAC7C,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,gCAAgC;IAChC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,gCAAgC;IAChC,WAAW,CAAC,EAAE,cAAc,CAAA;CAC7B;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAgKlD,CAAA"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as R from "react";
|
|
3
|
+
import * as b from "@radix-ui/react-progress";
|
|
4
|
+
import { FieldLabel as O } from "../shared/FieldLabel.js";
|
|
5
|
+
const V = ({
|
|
6
|
+
label: f,
|
|
7
|
+
instructions: n,
|
|
8
|
+
percentage: d,
|
|
9
|
+
labelPosition: p = "ABOVE",
|
|
10
|
+
helpTooltip: g,
|
|
11
|
+
accessibilityText: o,
|
|
12
|
+
color: r = "ACCENT",
|
|
13
|
+
showWhen: x = !0,
|
|
14
|
+
style: t = "THIN",
|
|
15
|
+
showPercentage: i = !0,
|
|
16
|
+
marginAbove: S = "NONE",
|
|
17
|
+
marginBelow: u = "STANDARD"
|
|
18
|
+
}) => {
|
|
19
|
+
if (!x) return null;
|
|
20
|
+
const a = Math.max(0, Math.min(100, d)), m = Math.round(d), N = R.useId(), I = {
|
|
21
|
+
NONE: "mt-0",
|
|
22
|
+
EVEN_LESS: "mt-1",
|
|
23
|
+
LESS: "mt-2",
|
|
24
|
+
STANDARD: "mt-4",
|
|
25
|
+
MORE: "mt-6",
|
|
26
|
+
EVEN_MORE: "mt-8"
|
|
27
|
+
}, C = {
|
|
28
|
+
NONE: "mb-0",
|
|
29
|
+
EVEN_LESS: "mb-1",
|
|
30
|
+
LESS: "mb-2",
|
|
31
|
+
STANDARD: "mb-4",
|
|
32
|
+
MORE: "mb-6",
|
|
33
|
+
EVEN_MORE: "mb-8"
|
|
34
|
+
}, l = {
|
|
35
|
+
THIN: { height: "h-2", textSize: "text-sm" },
|
|
36
|
+
THICK: { height: "h-6", textSize: "text-base" }
|
|
37
|
+
}, h = {
|
|
38
|
+
ACCENT: "bg-blue-500",
|
|
39
|
+
POSITIVE: "bg-green-700",
|
|
40
|
+
NEGATIVE: "bg-red-700",
|
|
41
|
+
WARN: "bg-yellow-500"
|
|
42
|
+
}, c = r in h, v = c ? h[r] : "", A = [
|
|
43
|
+
I[S],
|
|
44
|
+
C[u]
|
|
45
|
+
].filter(Boolean).join(" "), T = [
|
|
46
|
+
"relative",
|
|
47
|
+
"overflow-hidden",
|
|
48
|
+
"bg-gray-300",
|
|
49
|
+
"rounded-sm",
|
|
50
|
+
l[t].height
|
|
51
|
+
].join(" "), M = [
|
|
52
|
+
"h-full",
|
|
53
|
+
"transition-transform",
|
|
54
|
+
"duration-300",
|
|
55
|
+
"ease-in-out",
|
|
56
|
+
c ? v : "bg-gray-500"
|
|
57
|
+
].join(" "), E = {};
|
|
58
|
+
return !c && r && (E.backgroundColor = r), /* @__PURE__ */ s("div", { className: A, children: [
|
|
59
|
+
/* @__PURE__ */ e(
|
|
60
|
+
O,
|
|
61
|
+
{
|
|
62
|
+
label: f,
|
|
63
|
+
labelPosition: p,
|
|
64
|
+
helpTooltip: g,
|
|
65
|
+
htmlFor: N,
|
|
66
|
+
accessibilityText: o
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ s("div", { className: "relative", children: [
|
|
70
|
+
/* @__PURE__ */ e(
|
|
71
|
+
b.Root,
|
|
72
|
+
{
|
|
73
|
+
id: N,
|
|
74
|
+
className: T,
|
|
75
|
+
value: a,
|
|
76
|
+
max: 100,
|
|
77
|
+
children: /* @__PURE__ */ e(
|
|
78
|
+
b.Indicator,
|
|
79
|
+
{
|
|
80
|
+
className: M,
|
|
81
|
+
style: {
|
|
82
|
+
width: `${a}%`,
|
|
83
|
+
...E
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
i && t === "THICK" && a > 15 && /* @__PURE__ */ e(
|
|
90
|
+
"div",
|
|
91
|
+
{
|
|
92
|
+
className: "absolute inset-y-0 flex items-center pr-2",
|
|
93
|
+
style: { left: "0", width: `${a}%` },
|
|
94
|
+
children: /* @__PURE__ */ e("div", { className: "w-full flex justify-end", children: /* @__PURE__ */ s("span", { className: `${l[t].textSize} font-semibold text-white`, children: [
|
|
95
|
+
m,
|
|
96
|
+
"%"
|
|
97
|
+
] }) })
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
i && t === "THICK" && a <= 15 && /* @__PURE__ */ e("div", { className: "absolute inset-0 flex items-center justify-start pl-3", children: /* @__PURE__ */ s("span", { className: `${l[t].textSize} font-semibold text-black`, children: [
|
|
101
|
+
m,
|
|
102
|
+
"%"
|
|
103
|
+
] }) })
|
|
104
|
+
] }),
|
|
105
|
+
(n || i && t === "THIN") && /* @__PURE__ */ s("div", { className: "flex justify-between items-start mt-1", children: [
|
|
106
|
+
/* @__PURE__ */ e("div", { className: "flex-1", children: n && /* @__PURE__ */ e("p", { className: "text-gray-700 text-sm", children: n }) }),
|
|
107
|
+
i && t === "THIN" && /* @__PURE__ */ s("span", { className: `${l[t].textSize} font-semibold text-black ml-4`, children: [
|
|
108
|
+
m,
|
|
109
|
+
"%"
|
|
110
|
+
] })
|
|
111
|
+
] }),
|
|
112
|
+
o && /* @__PURE__ */ e("span", { className: "sr-only", children: o })
|
|
113
|
+
] });
|
|
114
|
+
};
|
|
115
|
+
export {
|
|
116
|
+
V as ProgressBar
|
|
117
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressBar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { SAILLabelPosition, SAILMarginSize } from '../../types/sail';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
type ChoiceLayout = "STACKED" | "COMPACT";
|
|
4
|
+
type ChoiceStyle = "STANDARD" | "CARDS";
|
|
5
|
+
type Spacing = "STANDARD" | "MORE" | "EVEN_MORE";
|
|
6
|
+
type ChoicePosition = "START" | "END";
|
|
7
|
+
/**
|
|
8
|
+
* Displays a set of radio buttons for single-select input
|
|
9
|
+
* Maps to SAIL a!radioButtonField()
|
|
10
|
+
*/
|
|
11
|
+
export interface RadioButtonFieldProps {
|
|
12
|
+
/** Text to display as the field label */
|
|
13
|
+
label?: string;
|
|
14
|
+
/** Supplemental text about this field */
|
|
15
|
+
instructions?: string;
|
|
16
|
+
/** Determines if a value is required to submit the form */
|
|
17
|
+
required?: boolean;
|
|
18
|
+
/** Determines if the field should display as grayed out */
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/** Array of options for the user to select */
|
|
21
|
+
choiceLabels: any[];
|
|
22
|
+
/** Array of values associated with the corresponding choices */
|
|
23
|
+
choiceValues: any[];
|
|
24
|
+
/** Value of choice to display as selected */
|
|
25
|
+
value?: any;
|
|
26
|
+
/** Validation errors to display below the field */
|
|
27
|
+
validations?: string[];
|
|
28
|
+
/** Callback when the user changes the selection */
|
|
29
|
+
saveInto?: (value: any) => void;
|
|
30
|
+
/** Callback when the user changes the selection (React-style alias for saveInto) */
|
|
31
|
+
onChange?: (value: any) => void;
|
|
32
|
+
/** Validation group name (no spaces) */
|
|
33
|
+
validationGroup?: string;
|
|
34
|
+
/** Custom message when field is required and not provided */
|
|
35
|
+
requiredMessage?: string;
|
|
36
|
+
/** Determines where the label appears */
|
|
37
|
+
labelPosition?: SAILLabelPosition;
|
|
38
|
+
/** Determines the layout of choices */
|
|
39
|
+
choiceLayout?: ChoiceLayout;
|
|
40
|
+
/** Displays a help icon with tooltip text */
|
|
41
|
+
helpTooltip?: string;
|
|
42
|
+
/** Additional text for screen readers */
|
|
43
|
+
accessibilityText?: string;
|
|
44
|
+
/** Determines whether component is displayed */
|
|
45
|
+
showWhen?: boolean;
|
|
46
|
+
/** Determines how choices are displayed */
|
|
47
|
+
choiceStyle?: ChoiceStyle;
|
|
48
|
+
/** Determines space between options */
|
|
49
|
+
spacing?: Spacing;
|
|
50
|
+
/** Data source (record type) - not implemented in prototype */
|
|
51
|
+
data?: any;
|
|
52
|
+
/** Sort configurations - not implemented in prototype */
|
|
53
|
+
sort?: any[];
|
|
54
|
+
/** Space added above component */
|
|
55
|
+
marginAbove?: SAILMarginSize;
|
|
56
|
+
/** Space added below component */
|
|
57
|
+
marginBelow?: SAILMarginSize;
|
|
58
|
+
/** Determines whether radio buttons appear on left or right */
|
|
59
|
+
choicePosition?: ChoicePosition;
|
|
60
|
+
}
|
|
61
|
+
export declare const RadioButtonField: React.FC<RadioButtonFieldProps>;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=RadioButtonField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RadioButtonField.d.ts","sourceRoot":"","sources":["../../../src/components/RadioButton/RadioButtonField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEzE,KAAK,YAAY,GAAG,SAAS,GAAG,SAAS,CAAA;AACzC,KAAK,WAAW,GAAG,UAAU,GAAG,OAAO,CAAA;AACvC,KAAK,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,WAAW,CAAA;AAChD,KAAK,cAAc,GAAG,OAAO,GAAG,KAAK,CAAA;AAErC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,8CAA8C;IAC9C,YAAY,EAAE,GAAG,EAAE,CAAA;IACnB,gEAAgE;IAChE,YAAY,EAAE,GAAG,EAAE,CAAA;IACnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,mDAAmD;IACnD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAC/B,oFAAoF;IACpF,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAA;IAC/B,wCAAwC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,yCAAyC;IACzC,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,uCAAuC;IACvC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yCAAyC;IACzC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gDAAgD;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,uCAAuC;IACvC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,+DAA+D;IAC/D,IAAI,CAAC,EAAE,GAAG,CAAA;IACV,yDAAyD;IACzD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAA;IACZ,kCAAkC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,kCAAkC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,cAAc,CAAA;CAChC;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAsK5D,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as e, jsxs as N, Fragment as G } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { FieldWrapper as I } from "../shared/FieldWrapper.js";
|
|
4
|
+
const X = ({
|
|
5
|
+
label: h,
|
|
6
|
+
instructions: d,
|
|
7
|
+
required: l = !1,
|
|
8
|
+
disabled: t = !1,
|
|
9
|
+
choiceLabels: C,
|
|
10
|
+
choiceValues: E,
|
|
11
|
+
value: p,
|
|
12
|
+
validations: m = [],
|
|
13
|
+
saveInto: R,
|
|
14
|
+
onChange: x,
|
|
15
|
+
validationGroup: P,
|
|
16
|
+
requiredMessage: f,
|
|
17
|
+
labelPosition: b = "ABOVE",
|
|
18
|
+
choiceLayout: s = "STACKED",
|
|
19
|
+
helpTooltip: S,
|
|
20
|
+
accessibilityText: T,
|
|
21
|
+
showWhen: v = !0,
|
|
22
|
+
choiceStyle: a = "STANDARD",
|
|
23
|
+
spacing: g = "STANDARD",
|
|
24
|
+
data: U,
|
|
25
|
+
sort: W,
|
|
26
|
+
marginAbove: w = "NONE",
|
|
27
|
+
marginBelow: B = "STANDARD",
|
|
28
|
+
choicePosition: M
|
|
29
|
+
}) => {
|
|
30
|
+
if (!v) return null;
|
|
31
|
+
const o = `radiobuttonfield-${Math.random().toString(36).substr(2, 9)}`, j = M ?? (a === "CARDS" ? "END" : "START"), O = {
|
|
32
|
+
STANDARD: s === "STACKED" ? "gap-2" : "gap-4",
|
|
33
|
+
MORE: s === "STACKED" ? "gap-4" : "gap-6",
|
|
34
|
+
EVEN_MORE: s === "STACKED" ? "gap-6" : "gap-8"
|
|
35
|
+
}, $ = {
|
|
36
|
+
STANDARD: "gap-2",
|
|
37
|
+
MORE: "gap-4",
|
|
38
|
+
EVEN_MORE: "gap-6"
|
|
39
|
+
}, u = (n) => {
|
|
40
|
+
const r = x || R;
|
|
41
|
+
r && r(n);
|
|
42
|
+
}, i = m.length > 0, K = l && p === void 0 && f, V = /* @__PURE__ */ e(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
className: [
|
|
46
|
+
s === "STACKED" ? "flex flex-col" : "flex flex-wrap",
|
|
47
|
+
O[g]
|
|
48
|
+
].filter(Boolean).join(" "),
|
|
49
|
+
role: "radiogroup",
|
|
50
|
+
"aria-describedby": d ? `${o}-instructions` : void 0,
|
|
51
|
+
"aria-required": l,
|
|
52
|
+
children: C.map((n, r) => {
|
|
53
|
+
const c = E[r], A = p === c, D = `${o}-choice-${r}`, F = [
|
|
54
|
+
"flex",
|
|
55
|
+
"items-center",
|
|
56
|
+
$[g],
|
|
57
|
+
j === "END" && "flex-row-reverse",
|
|
58
|
+
a === "CARDS" && "border border-gray-200 rounded-sm p-4 hover:border-blue-500 transition-colors cursor-pointer",
|
|
59
|
+
a === "CARDS" && A && "border-blue-500 bg-blue-50",
|
|
60
|
+
t && "opacity-50 cursor-not-allowed"
|
|
61
|
+
].filter(Boolean).join(" ");
|
|
62
|
+
return /* @__PURE__ */ N(
|
|
63
|
+
"div",
|
|
64
|
+
{
|
|
65
|
+
className: F,
|
|
66
|
+
onClick: (k) => {
|
|
67
|
+
a === "CARDS" && !t && k.target.tagName !== "INPUT" && u(c);
|
|
68
|
+
},
|
|
69
|
+
children: [
|
|
70
|
+
/* @__PURE__ */ e(
|
|
71
|
+
"input",
|
|
72
|
+
{
|
|
73
|
+
id: D,
|
|
74
|
+
type: "radio",
|
|
75
|
+
name: o,
|
|
76
|
+
checked: A,
|
|
77
|
+
disabled: t,
|
|
78
|
+
onChange: () => u(c),
|
|
79
|
+
className: [
|
|
80
|
+
"h-4 w-4 border-gray-200 text-blue-500 focus:ring-blue-500",
|
|
81
|
+
t ? "cursor-not-allowed" : "cursor-pointer"
|
|
82
|
+
].filter(Boolean).join(" "),
|
|
83
|
+
"aria-invalid": i,
|
|
84
|
+
"aria-errormessage": i ? `${o}-error` : void 0
|
|
85
|
+
}
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ e(
|
|
88
|
+
"label",
|
|
89
|
+
{
|
|
90
|
+
htmlFor: D,
|
|
91
|
+
className: [
|
|
92
|
+
"text-base text-gray-900",
|
|
93
|
+
a === "CARDS" && "flex-1",
|
|
94
|
+
t ? "cursor-not-allowed" : "cursor-pointer"
|
|
95
|
+
].filter(Boolean).join(" "),
|
|
96
|
+
children: n
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
r
|
|
102
|
+
);
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
), _ = /* @__PURE__ */ N(G, { children: [
|
|
106
|
+
i && /* @__PURE__ */ e("div", { id: `${o}-error`, className: "mt-2", role: "alert", children: m.map((n, r) => /* @__PURE__ */ e("p", { className: "text-sm text-red-700", children: n }, r)) }),
|
|
107
|
+
K && /* @__PURE__ */ e("p", { className: "text-sm text-red-700 mt-2", role: "alert", children: f })
|
|
108
|
+
] });
|
|
109
|
+
return /* @__PURE__ */ e(
|
|
110
|
+
I,
|
|
111
|
+
{
|
|
112
|
+
label: h,
|
|
113
|
+
labelPosition: b,
|
|
114
|
+
required: l,
|
|
115
|
+
instructions: d,
|
|
116
|
+
helpTooltip: S,
|
|
117
|
+
accessibilityText: T,
|
|
118
|
+
inputId: o,
|
|
119
|
+
marginAbove: w,
|
|
120
|
+
marginBelow: B,
|
|
121
|
+
footer: _,
|
|
122
|
+
children: V
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
X as RadioButtonField
|
|
128
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/RadioButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AACrD,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SAILSizeExtended, SAILSemanticColor } from '../../types/sail';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
type LinkStyle = "INLINE" | "STANDALONE";
|
|
4
|
+
export interface IconProps {
|
|
5
|
+
/** The key of the icon to display */
|
|
6
|
+
icon: string;
|
|
7
|
+
/** Alternative text for accessibility */
|
|
8
|
+
altText?: string;
|
|
9
|
+
/** Text to display on mouseover */
|
|
10
|
+
caption?: string;
|
|
11
|
+
/** Icon size */
|
|
12
|
+
size?: SAILSizeExtended;
|
|
13
|
+
/** Icon color - semantic color or hex value */
|
|
14
|
+
color?: SAILSemanticColor | string;
|
|
15
|
+
/** Link behavior when icon is clicked */
|
|
16
|
+
link?: () => void;
|
|
17
|
+
/** How the link is underlined */
|
|
18
|
+
linkStyle?: LinkStyle;
|
|
19
|
+
/** Whether to show this component */
|
|
20
|
+
showWhen?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Icon component for use within Rich Text Display Field
|
|
24
|
+
* Displays icons with various formatting options
|
|
25
|
+
*/
|
|
26
|
+
export declare const Icon: React.FC<IconProps>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAA;AAExC,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,IAAI,EAAE,MAAM,CAAA;IACZ,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,gBAAgB;IAChB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAA;IAClC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB,iCAAiC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAiIpC,CAAA"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import * as t from "lucide-react";
|
|
4
|
+
const f = ({
|
|
5
|
+
icon: i,
|
|
6
|
+
altText: c,
|
|
7
|
+
caption: r,
|
|
8
|
+
size: p = "STANDARD",
|
|
9
|
+
color: o = "STANDARD",
|
|
10
|
+
link: n,
|
|
11
|
+
linkStyle: S = "INLINE",
|
|
12
|
+
// Note: linkStyle not implemented yet for icons
|
|
13
|
+
showWhen: C = !0
|
|
14
|
+
}) => {
|
|
15
|
+
if (!C || !i) return null;
|
|
16
|
+
const T = {
|
|
17
|
+
SMALL: 12,
|
|
18
|
+
STANDARD: 16,
|
|
19
|
+
MEDIUM: 20,
|
|
20
|
+
MEDIUM_PLUS: 24,
|
|
21
|
+
LARGE: 28,
|
|
22
|
+
LARGE_PLUS: 32,
|
|
23
|
+
EXTRA_LARGE: 40
|
|
24
|
+
}, R = {
|
|
25
|
+
STANDARD: "text-gray-900",
|
|
26
|
+
ACCENT: "text-blue-500",
|
|
27
|
+
POSITIVE: "text-green-700",
|
|
28
|
+
NEGATIVE: "text-red-700",
|
|
29
|
+
SECONDARY: "text-gray-700"
|
|
30
|
+
}, m = [
|
|
31
|
+
"inline-block",
|
|
32
|
+
// Handle color - use semantic mapping or inline style for hex
|
|
33
|
+
o.startsWith("#") ? "" : R[o] || "text-gray-900",
|
|
34
|
+
// Link styles
|
|
35
|
+
n && "cursor-pointer",
|
|
36
|
+
n && "hover:opacity-75"
|
|
37
|
+
].filter(Boolean).join(" "), u = o.startsWith("#") ? { color: o } : void 0, N = ((e) => {
|
|
38
|
+
const E = ((D) => D.split("-").map((I) => I.charAt(0).toUpperCase() + I.slice(1)).join(""))(e);
|
|
39
|
+
if (E in t)
|
|
40
|
+
return t[E];
|
|
41
|
+
const A = e.charAt(0).toUpperCase() + e.slice(1).toLowerCase();
|
|
42
|
+
if (A in t)
|
|
43
|
+
return t[A];
|
|
44
|
+
const s = {
|
|
45
|
+
USER: "User",
|
|
46
|
+
PHONE: "Phone",
|
|
47
|
+
"BUILDING-O": "Building",
|
|
48
|
+
HOME: "Home",
|
|
49
|
+
"CHECK-SQUARE-O": "SquareCheck",
|
|
50
|
+
"FILE-TEXT-O": "FileText",
|
|
51
|
+
"PICTURE-O": "Image",
|
|
52
|
+
HEADPHONES: "Headphones",
|
|
53
|
+
"VIDEO-CAMERA": "Video",
|
|
54
|
+
WRENCH: "Wrench",
|
|
55
|
+
EXCLAMATION: "AlertTriangle",
|
|
56
|
+
TICKET: "Ticket",
|
|
57
|
+
"ARROW-RIGHT": "ArrowRight",
|
|
58
|
+
CHECK: "Check"
|
|
59
|
+
}[e.toUpperCase()];
|
|
60
|
+
return s && s in t ? t[s] : t.Circle;
|
|
61
|
+
})(i), l = /* @__PURE__ */ a(
|
|
62
|
+
"span",
|
|
63
|
+
{
|
|
64
|
+
className: "inline-flex items-center translate-y-0.5",
|
|
65
|
+
title: r,
|
|
66
|
+
"aria-label": c || r,
|
|
67
|
+
role: c || r ? "img" : "presentation",
|
|
68
|
+
children: /* @__PURE__ */ a(
|
|
69
|
+
N,
|
|
70
|
+
{
|
|
71
|
+
size: T[p],
|
|
72
|
+
className: m,
|
|
73
|
+
style: u
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
return n ? /* @__PURE__ */ a(
|
|
79
|
+
"span",
|
|
80
|
+
{
|
|
81
|
+
onClick: n,
|
|
82
|
+
role: "button",
|
|
83
|
+
tabIndex: 0,
|
|
84
|
+
className: "inline-block",
|
|
85
|
+
onKeyDown: (e) => {
|
|
86
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), n());
|
|
87
|
+
},
|
|
88
|
+
children: l
|
|
89
|
+
}
|
|
90
|
+
) : l;
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
f as Icon
|
|
94
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { SAILLabelPosition, SAILMarginSize } from '../../types/sail';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
type TextAlign = "LEFT" | "CENTER" | "RIGHT";
|
|
4
|
+
export interface RichTextDisplayFieldProps {
|
|
5
|
+
/** Text to display as the field label */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Position of the label */
|
|
8
|
+
labelPosition?: SAILLabelPosition;
|
|
9
|
+
/** Supplemental text about this field */
|
|
10
|
+
instructions?: string;
|
|
11
|
+
/** Alignment of the text value */
|
|
12
|
+
align?: TextAlign;
|
|
13
|
+
/** Array of rich text to display */
|
|
14
|
+
value?: React.ReactNode[];
|
|
15
|
+
/** Help tooltip text */
|
|
16
|
+
helpTooltip?: string;
|
|
17
|
+
/** Screen reader text */
|
|
18
|
+
accessibilityText?: string;
|
|
19
|
+
/** Whether to show this component */
|
|
20
|
+
showWhen?: boolean;
|
|
21
|
+
/** Prevents wrapping to multiple lines */
|
|
22
|
+
preventWrapping?: boolean;
|
|
23
|
+
/** Tooltip text on mouseover */
|
|
24
|
+
tooltip?: string;
|
|
25
|
+
/** Margin above the component */
|
|
26
|
+
marginAbove?: SAILMarginSize;
|
|
27
|
+
/** Margin below the component */
|
|
28
|
+
marginBelow?: SAILMarginSize;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Rich Text Display Field component
|
|
32
|
+
* Displays text in variety of styles, including bold, italics, underline, links, and lists
|
|
33
|
+
*/
|
|
34
|
+
export declare const RichTextDisplayField: React.FC<RichTextDisplayFieldProps>;
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=RichTextDisplayField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RichTextDisplayField.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/RichTextDisplayField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEzE,KAAK,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAA;AAE5C,MAAM,WAAW,yBAAyB;IACxC,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4BAA4B;IAC5B,aAAa,CAAC,EAAE,iBAAiB,CAAA;IACjC,yCAAyC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kCAAkC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,oCAAoC;IACpC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,EAAE,CAAA;IACzB,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,yBAAyB;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,iCAAiC;IACjC,WAAW,CAAC,EAAE,cAAc,CAAA;CAC7B;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAyFpE,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { jsxs as x, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import * as o from "react";
|
|
3
|
+
import { FieldLabel as A } from "../shared/FieldLabel.js";
|
|
4
|
+
const L = ({
|
|
5
|
+
label: a,
|
|
6
|
+
labelPosition: l = "ABOVE",
|
|
7
|
+
instructions: i,
|
|
8
|
+
align: m = "LEFT",
|
|
9
|
+
value: n = [],
|
|
10
|
+
helpTooltip: s,
|
|
11
|
+
accessibilityText: e,
|
|
12
|
+
showWhen: E = !0,
|
|
13
|
+
preventWrapping: c = !1,
|
|
14
|
+
tooltip: N,
|
|
15
|
+
marginAbove: d = "NONE",
|
|
16
|
+
marginBelow: S = "STANDARD"
|
|
17
|
+
}) => {
|
|
18
|
+
if (!E) return null;
|
|
19
|
+
const R = {
|
|
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
|
+
}, g = {
|
|
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
|
+
}, h = {
|
|
34
|
+
LEFT: "text-left",
|
|
35
|
+
CENTER: "text-center",
|
|
36
|
+
RIGHT: "text-right"
|
|
37
|
+
}, p = [
|
|
38
|
+
R[d],
|
|
39
|
+
g[S]
|
|
40
|
+
].filter(Boolean).join(" "), f = [
|
|
41
|
+
h[m],
|
|
42
|
+
c && "truncate",
|
|
43
|
+
"leading-relaxed"
|
|
44
|
+
// Better line spacing for rich text
|
|
45
|
+
].filter(Boolean).join(" "), r = o.useMemo(
|
|
46
|
+
() => `richtext-${Math.random().toString(36).substr(2, 9)}`,
|
|
47
|
+
[]
|
|
48
|
+
);
|
|
49
|
+
return /* @__PURE__ */ x("div", { className: p, children: [
|
|
50
|
+
/* @__PURE__ */ t(
|
|
51
|
+
A,
|
|
52
|
+
{
|
|
53
|
+
label: a,
|
|
54
|
+
labelPosition: l,
|
|
55
|
+
instructions: i,
|
|
56
|
+
helpTooltip: s,
|
|
57
|
+
htmlFor: r,
|
|
58
|
+
accessibilityText: e
|
|
59
|
+
}
|
|
60
|
+
),
|
|
61
|
+
/* @__PURE__ */ t(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
id: r,
|
|
65
|
+
className: f,
|
|
66
|
+
title: N,
|
|
67
|
+
role: e ? "region" : void 0,
|
|
68
|
+
"aria-label": e,
|
|
69
|
+
children: n.length > 0 ? n.map((M, b) => /* @__PURE__ */ t(o.Fragment, { children: M }, b)) : (
|
|
70
|
+
// Show empty state if no content
|
|
71
|
+
/* @__PURE__ */ t("span", { className: "text-gray-500 italic", children: "No content" })
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
] });
|
|
76
|
+
};
|
|
77
|
+
export {
|
|
78
|
+
L as RichTextDisplayField
|
|
79
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SAILSizeExtended, SAILSemanticColor } from '../../types/sail';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
type TextStyle = "PLAIN" | "EMPHASIS" | "STRONG" | "UNDERLINE" | "STRIKETHROUGH";
|
|
4
|
+
type LinkStyle = "INLINE" | "STANDALONE";
|
|
5
|
+
export interface TextItemProps {
|
|
6
|
+
/** Array of text to display as a rich text item */
|
|
7
|
+
text: string | React.ReactNode | (string | React.ReactNode)[];
|
|
8
|
+
/** Text style(s) to apply. Multiple styles may be applied */
|
|
9
|
+
style?: TextStyle | TextStyle[];
|
|
10
|
+
/** Text size */
|
|
11
|
+
size?: SAILSizeExtended;
|
|
12
|
+
/** Text color - semantic color or hex value */
|
|
13
|
+
color?: SAILSemanticColor | string;
|
|
14
|
+
/** Link to apply to the text */
|
|
15
|
+
link?: () => void;
|
|
16
|
+
/** How the link is underlined */
|
|
17
|
+
linkStyle?: LinkStyle;
|
|
18
|
+
/** Whether to show this component */
|
|
19
|
+
showWhen?: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Text Item component for use within Rich Text Display Field
|
|
23
|
+
* Displays styled text with various formatting options
|
|
24
|
+
*/
|
|
25
|
+
export declare const TextItem: React.FC<TextItemProps>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=TextItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextItem.d.ts","sourceRoot":"","sources":["../../../src/components/RichText/TextItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAE3E,KAAK,SAAS,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,GAAG,eAAe,CAAA;AAChF,KAAK,SAAS,GAAG,QAAQ,GAAG,YAAY,CAAA;AAExC,MAAM,WAAW,aAAa;IAC5B,mDAAmD;IACnD,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,EAAE,CAAA;IAC7D,6DAA6D;IAC7D,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAA;IAC/B,gBAAgB;IAChB,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAAA;IAClC,gCAAgC;IAChC,IAAI,CAAC,EAAE,MAAM,IAAI,CAAA;IACjB,iCAAiC;IACjC,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,qCAAqC;IACrC,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED;;;GAGG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CA0F5C,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import * as D from "react";
|
|
3
|
+
const I = ({
|
|
4
|
+
text: s,
|
|
5
|
+
style: i = "PLAIN",
|
|
6
|
+
size: c = "STANDARD",
|
|
7
|
+
color: r = "STANDARD",
|
|
8
|
+
link: t,
|
|
9
|
+
linkStyle: a = "INLINE",
|
|
10
|
+
showWhen: d = !0
|
|
11
|
+
}) => {
|
|
12
|
+
if (!d) return null;
|
|
13
|
+
const n = Array.isArray(i) ? i : [i], x = {
|
|
14
|
+
SMALL: "text-xs",
|
|
15
|
+
STANDARD: "text-base",
|
|
16
|
+
MEDIUM: "text-lg",
|
|
17
|
+
MEDIUM_PLUS: "text-xl",
|
|
18
|
+
LARGE: "text-2xl",
|
|
19
|
+
LARGE_PLUS: "text-3xl",
|
|
20
|
+
EXTRA_LARGE: "text-4xl"
|
|
21
|
+
}, E = {
|
|
22
|
+
STANDARD: "text-gray-900",
|
|
23
|
+
ACCENT: "text-blue-500",
|
|
24
|
+
POSITIVE: "text-green-700",
|
|
25
|
+
NEGATIVE: "text-red-700",
|
|
26
|
+
SECONDARY: "text-gray-700"
|
|
27
|
+
}, l = [
|
|
28
|
+
x[c],
|
|
29
|
+
// Handle color - use semantic mapping or inline style for hex
|
|
30
|
+
r.startsWith("#") ? "" : E[r] || "text-gray-900",
|
|
31
|
+
// Apply text styles
|
|
32
|
+
n.includes("STRONG") && "font-bold",
|
|
33
|
+
n.includes("EMPHASIS") && "italic",
|
|
34
|
+
n.includes("UNDERLINE") && "underline",
|
|
35
|
+
n.includes("STRIKETHROUGH") && "line-through",
|
|
36
|
+
// Link styles
|
|
37
|
+
t && a === "INLINE" && "underline decoration-dotted decoration-current/50 underline-offset-5 hover:no-underline",
|
|
38
|
+
t && a === "STANDALONE" && "no-underline decoration-current/50 underline-offset-5 hover:underline"
|
|
39
|
+
].filter(Boolean).join(" "), u = r.startsWith("#") ? { color: r } : void 0, A = () => Array.isArray(s) ? s.map((e, N) => /* @__PURE__ */ o(D.Fragment, { children: e }, N)) : s;
|
|
40
|
+
return t ? /* @__PURE__ */ o(
|
|
41
|
+
"a",
|
|
42
|
+
{
|
|
43
|
+
href: "#",
|
|
44
|
+
className: l,
|
|
45
|
+
style: u,
|
|
46
|
+
onClick: (e) => {
|
|
47
|
+
e.preventDefault(), t();
|
|
48
|
+
},
|
|
49
|
+
onKeyDown: (e) => {
|
|
50
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), t());
|
|
51
|
+
},
|
|
52
|
+
children: A()
|
|
53
|
+
}
|
|
54
|
+
) : /* @__PURE__ */ o("span", { className: l, style: u, children: A() });
|
|
55
|
+
};
|
|
56
|
+
export {
|
|
57
|
+
I as TextItem
|
|
58
|
+
};
|