@syscore/ui-library 2.0.0-beta-publish-workflow-beta.14 → 2.0.0-beta-publish-workflow-beta.16
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.
|
@@ -41,6 +41,7 @@ export type DropdownProps = Omit<
|
|
|
41
41
|
"onChange"
|
|
42
42
|
> & {
|
|
43
43
|
label?: string;
|
|
44
|
+
required?: boolean;
|
|
44
45
|
placeholder?: string;
|
|
45
46
|
options?: DropdownOption[];
|
|
46
47
|
value?: string;
|
|
@@ -94,6 +95,7 @@ const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
|
|
|
94
95
|
{
|
|
95
96
|
className,
|
|
96
97
|
label = "Label",
|
|
98
|
+
required = false,
|
|
97
99
|
placeholder = "Placeholder",
|
|
98
100
|
options = [],
|
|
99
101
|
value: valueProp,
|
|
@@ -255,6 +257,12 @@ const Dropdown = React.forwardRef<HTMLDivElement, DropdownProps>(
|
|
|
255
257
|
<div className="dropdown-label-row">
|
|
256
258
|
<label className="dropdown-label overline-medium" htmlFor={inputId}>
|
|
257
259
|
{label}
|
|
260
|
+
{required ? (
|
|
261
|
+
<span className="label__required-mark" aria-hidden="true">
|
|
262
|
+
{" "}
|
|
263
|
+
*
|
|
264
|
+
</span>
|
|
265
|
+
) : null}
|
|
258
266
|
</label>
|
|
259
267
|
{onClearTags ? (
|
|
260
268
|
<span className="dropdown-label-actions">
|
|
@@ -86,7 +86,7 @@ FormItem.displayName = "FormItem";
|
|
|
86
86
|
|
|
87
87
|
const FormLabel = React.forwardRef<
|
|
88
88
|
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
89
|
-
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>
|
|
89
|
+
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> & { required?: boolean }
|
|
90
90
|
>(({ className, ...props }, ref) => {
|
|
91
91
|
const { error, formItemId } = useFormField();
|
|
92
92
|
|
|
@@ -9,16 +9,33 @@ const labelVariants = cva("label");
|
|
|
9
9
|
const Label = React.forwardRef<
|
|
10
10
|
React.ElementRef<typeof LabelPrimitive.Root>,
|
|
11
11
|
React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &
|
|
12
|
-
VariantProps<typeof labelVariants>
|
|
13
|
-
>(({ className, children, ...props }, ref) => (
|
|
12
|
+
VariantProps<typeof labelVariants> & { required?: boolean }
|
|
13
|
+
>(({ className, children, required, ...props }, ref) => (
|
|
14
14
|
<LabelPrimitive.Root
|
|
15
15
|
ref={ref}
|
|
16
16
|
className={cn(labelVariants(), className)}
|
|
17
17
|
{...props}
|
|
18
18
|
>
|
|
19
|
-
<div className="overline-medium">
|
|
19
|
+
<div className="overline-medium">
|
|
20
|
+
{" "}
|
|
21
|
+
{children}
|
|
22
|
+
{required ? (
|
|
23
|
+
<span className="label__required-mark" aria-hidden="true">
|
|
24
|
+
{" "}
|
|
25
|
+
*
|
|
26
|
+
</span>
|
|
27
|
+
) : null}
|
|
28
|
+
</div>
|
|
20
29
|
</LabelPrimitive.Root>
|
|
21
30
|
));
|
|
22
31
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
23
32
|
|
|
24
|
-
|
|
33
|
+
/** Standalone required-field asterisk, for call sites that build their own label (e.g. a fieldset legend in `Copy`) instead of using `Label`/`FormLabel` directly — same mark, same color, so every required indicator in the app matches. */
|
|
34
|
+
const RequiredAsterisk = () => (
|
|
35
|
+
<span className="label__required-mark" aria-hidden="true">
|
|
36
|
+
{" "}
|
|
37
|
+
*
|
|
38
|
+
</span>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export { Label, RequiredAsterisk };
|
package/client/global.css
CHANGED
|
@@ -1576,6 +1576,10 @@ body {
|
|
|
1576
1576
|
opacity: 0.7;
|
|
1577
1577
|
}
|
|
1578
1578
|
|
|
1579
|
+
.label__required-mark {
|
|
1580
|
+
color: hsl(var(--destructive));
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1579
1583
|
/* Separator Styles */
|
|
1580
1584
|
.separator {
|
|
1581
1585
|
flex-shrink: 0;
|
|
@@ -2531,9 +2535,18 @@ body {
|
|
|
2531
2535
|
gap: 1rem;
|
|
2532
2536
|
}
|
|
2533
2537
|
|
|
2538
|
+
/* Previously just `width/height: 3rem` — a bare 48px outline icon with no
|
|
2539
|
+
backdrop, unstyled and easy to miss next to the title. A tinted circular
|
|
2540
|
+
chip (same brand-teal `--primary` used for Swatch/calendar) reads as an
|
|
2541
|
+
intentional icon treatment instead. */
|
|
2534
2542
|
.card-with-icon__icon {
|
|
2543
|
+
box-sizing: border-box;
|
|
2535
2544
|
width: 3rem;
|
|
2536
2545
|
height: 3rem;
|
|
2546
|
+
padding: 0.75rem;
|
|
2547
|
+
border-radius: 999px;
|
|
2548
|
+
background-color: hsl(var(--primary) / 0.12);
|
|
2549
|
+
color: hsl(var(--primary));
|
|
2537
2550
|
}
|
|
2538
2551
|
|
|
2539
2552
|
/* Input Styles */
|