@ultraviolet/ui 3.0.0 → 3.1.1
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/Alert/styles.css.js +0 -1
- package/dist/components/Avatar/styles.css.js +2 -0
- package/dist/components/Avatar/variables.css.js +0 -1
- package/dist/components/Badge/constant.d.ts +2 -0
- package/dist/components/Badge/constant.js +2 -1
- package/dist/components/Badge/styles.css.d.ts +4 -3
- package/dist/components/Badge/styles.css.js +1 -1
- package/dist/components/BarStack/index.d.ts +8 -1
- package/dist/components/BarStack/index.js +135 -59
- package/dist/components/BarStack/styles.css.d.ts +44 -1
- package/dist/components/BarStack/styles.css.js +7 -2
- package/dist/components/Chip/index.d.ts +1 -1
- package/dist/components/NumberInput/index.d.ts +1 -1
- package/dist/components/Popup/index.js +1 -1
- package/dist/components/Popup/styles.css.js +1 -0
- package/dist/components/Popup/variables.css.js +0 -1
- package/dist/components/ProgressBar/styles.css.js +1 -0
- package/dist/components/ProgressBar/variables.css.js +0 -1
- package/dist/components/SelectInput/components/DropdownOption.js +4 -14
- package/dist/components/SelectInput/components/selectBar.css.d.ts +1 -0
- package/dist/components/SelectableCard/styles.css.js +0 -1
- package/dist/components/SelectableCard/variables.css.js +1 -0
- package/dist/components/Snippet/index.d.ts +5 -2
- package/dist/components/Snippet/index.js +85 -77
- package/dist/components/TagInput/styles.css.d.ts +3 -3
- package/dist/components/TextInput/index.d.ts +1 -1
- package/dist/ui.css +1 -1
- package/package.json +3 -3
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
3
|
import { ArrowDownIcon } from "@ultraviolet/icons";
|
|
4
4
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
5
5
|
import { useReducer, Children } from "react";
|
|
6
6
|
import { useTheme } from "../../theme/ThemeProvider.js";
|
|
7
7
|
import { CopyButton } from "../CopyButton/index.js";
|
|
8
8
|
import { Expandable } from "../Expandable/index.js";
|
|
9
|
+
import { Label } from "../Label/index.js";
|
|
9
10
|
import { Stack } from "../Stack/index.js";
|
|
10
11
|
import { Text } from "../Text/index.js";
|
|
11
12
|
import { snippetContainer, stackStyle, buttonContainer, showMoreContainer, showMoreButton, centeredText, animatedArrowIcon, pretext, line, prefix, rowsVar } from "./styles.css.js";
|
|
@@ -55,7 +56,10 @@ const Snippet = ({
|
|
|
55
56
|
rows = 4,
|
|
56
57
|
noExpandable = false,
|
|
57
58
|
onCopy,
|
|
58
|
-
style
|
|
59
|
+
style,
|
|
60
|
+
helper,
|
|
61
|
+
label,
|
|
62
|
+
labelDescription
|
|
59
63
|
}) => {
|
|
60
64
|
const theme = useTheme();
|
|
61
65
|
const [showMore, setShowMore] = useReducer(
|
|
@@ -67,81 +71,85 @@ const Snippet = ({
|
|
|
67
71
|
const multiline = numberOfLines > 1;
|
|
68
72
|
const hasShowMoreButton = numberOfLines > rows && multiline && !noExpandable;
|
|
69
73
|
const minHeight = rows * Number.parseFloat(theme.typography.code.lineHeight) * 16 + Number.parseFloat(theme.space[4]) * 16;
|
|
70
|
-
return /* @__PURE__ */
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
{
|
|
117
|
-
"
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
74
|
+
return /* @__PURE__ */ jsxs(Stack, { direction: "column", gap: 1, width: "100%", children: [
|
|
75
|
+
label ? /* @__PURE__ */ jsx(Label, { labelDescription, children: label }) : null,
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: `${className ? `${className} ` : ""}${snippetContainer[multiline ? "multiline" : "oneLine"]}`,
|
|
80
|
+
"data-testid": dataTestId,
|
|
81
|
+
style,
|
|
82
|
+
children: /* @__PURE__ */ jsxs(Stack, { className: stackStyle, children: [
|
|
83
|
+
hasShowMoreButton ? /* @__PURE__ */ jsx(Expandable, { minHeight, opened: showMore, children: /* @__PURE__ */ jsx(
|
|
84
|
+
CodeContent,
|
|
85
|
+
{
|
|
86
|
+
lines,
|
|
87
|
+
multiline,
|
|
88
|
+
noExpandable,
|
|
89
|
+
prefix: prefix2,
|
|
90
|
+
rows,
|
|
91
|
+
children
|
|
92
|
+
}
|
|
93
|
+
) }) : /* @__PURE__ */ jsx(
|
|
94
|
+
CodeContent,
|
|
95
|
+
{
|
|
96
|
+
lines,
|
|
97
|
+
multiline,
|
|
98
|
+
noExpandable,
|
|
99
|
+
prefix: prefix2,
|
|
100
|
+
rows,
|
|
101
|
+
children
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
"div",
|
|
106
|
+
{
|
|
107
|
+
className: buttonContainer[multiline && numberOfLines > 1 ? "multiline" : "oneLine"],
|
|
108
|
+
children: /* @__PURE__ */ jsx(
|
|
109
|
+
CopyButton,
|
|
110
|
+
{
|
|
111
|
+
copiedText,
|
|
112
|
+
copyText,
|
|
113
|
+
onCopy,
|
|
114
|
+
sentiment: "neutral",
|
|
115
|
+
value: children
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
),
|
|
120
|
+
hasShowMoreButton ? /* @__PURE__ */ jsx("div", { className: showMoreContainer[showMore ? "true" : "false"], children: /* @__PURE__ */ jsx(
|
|
121
|
+
"button",
|
|
122
|
+
{
|
|
123
|
+
"aria-expanded": showMore,
|
|
124
|
+
className: showMoreButton,
|
|
125
|
+
onClick: setShowMore,
|
|
126
|
+
type: "button",
|
|
127
|
+
children: /* @__PURE__ */ jsxs(
|
|
128
|
+
Text,
|
|
129
|
+
{
|
|
130
|
+
as: "span",
|
|
131
|
+
className: centeredText,
|
|
132
|
+
sentiment: "neutral",
|
|
133
|
+
variant: "bodySmallStrong",
|
|
134
|
+
children: [
|
|
135
|
+
showMore ? hideText : showText,
|
|
136
|
+
" ",
|
|
137
|
+
/* @__PURE__ */ jsx(
|
|
138
|
+
ArrowDownIcon,
|
|
139
|
+
{
|
|
140
|
+
className: animatedArrowIcon[showMore ? "true" : "false"]
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
)
|
|
146
|
+
}
|
|
147
|
+
) }) : null
|
|
148
|
+
] })
|
|
149
|
+
}
|
|
150
|
+
),
|
|
151
|
+
helper ? /* @__PURE__ */ jsx(Text, { as: "p", prominence: "weak", sentiment: "neutral", variant: "caption", children: helper }) : null
|
|
152
|
+
] });
|
|
145
153
|
};
|
|
146
154
|
export {
|
|
147
155
|
Snippet
|
|
@@ -7,15 +7,15 @@ export declare const tagInputContainer: import("@vanilla-extract/recipes").Runti
|
|
|
7
7
|
size: {
|
|
8
8
|
large: {
|
|
9
9
|
padding: `calc(var(--${string}) - 1px) var(--${string})`;
|
|
10
|
-
|
|
10
|
+
minHeight: `var(--${string})`;
|
|
11
11
|
};
|
|
12
12
|
small: {
|
|
13
13
|
padding: `calc(var(--${string}) - 1px) var(--${string})`;
|
|
14
|
-
|
|
14
|
+
minHeight: `var(--${string})`;
|
|
15
15
|
};
|
|
16
16
|
medium: {
|
|
17
17
|
padding: `calc(var(--${string}) - 1px) var(--${string})`;
|
|
18
|
-
|
|
18
|
+
minHeight: `var(--${string})`;
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
21
|
}>;
|
|
@@ -26,4 +26,4 @@ export declare const TextInput: import("react").ForwardRefExoticComponent<{
|
|
|
26
26
|
value?: string;
|
|
27
27
|
defaultValue?: string;
|
|
28
28
|
onChangeValue?: (value: string) => void;
|
|
29
|
-
} & Pick<InputHTMLAttributes<HTMLInputElement>, "style" | "disabled" | "id" | "autoComplete" | "role" | "autoFocus" | "tabIndex" | "aria-atomic" | "aria-label" | "aria-labelledby" | "aria-live" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "name" | "
|
|
29
|
+
} & Pick<InputHTMLAttributes<HTMLInputElement>, "style" | "disabled" | "id" | "autoComplete" | "role" | "autoFocus" | "tabIndex" | "aria-atomic" | "aria-label" | "aria-labelledby" | "aria-live" | "onFocus" | "onBlur" | "onChange" | "onKeyDown" | "onKeyUp" | "name" | "required" | "placeholder" | "readOnly"> & import("react").RefAttributes<HTMLInputElement>>;
|