@firecms/ui 3.0.0-canary.16 → 3.0.0-canary.160
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 +60 -150
- package/dist/components/Avatar.d.ts +1 -0
- package/dist/components/BooleanSwitch.d.ts +1 -1
- package/dist/components/BooleanSwitchWithLabel.d.ts +4 -1
- package/dist/components/Button.d.ts +1 -1
- package/dist/components/CenteredView.d.ts +4 -2
- package/dist/components/Checkbox.d.ts +3 -2
- package/dist/components/Chip.d.ts +3 -2
- package/dist/components/DateTimeField.d.ts +5 -7
- package/dist/components/Dialog.d.ts +4 -1
- package/dist/components/DialogContent.d.ts +2 -1
- package/dist/components/DialogTitle.d.ts +10 -0
- package/dist/components/ExpandablePanel.d.ts +2 -1
- package/dist/components/FileUpload.d.ts +2 -2
- package/dist/components/InputLabel.d.ts +2 -2
- package/dist/components/Label.d.ts +4 -1
- package/dist/components/Markdown.d.ts +1 -0
- package/dist/components/Menu.d.ts +6 -2
- package/dist/components/Menubar.d.ts +79 -0
- package/dist/components/MultiSelect.d.ts +32 -16
- package/dist/components/Popover.d.ts +2 -1
- package/dist/components/RadioGroup.d.ts +26 -3
- package/dist/components/Select.d.ts +8 -11
- package/dist/components/Separator.d.ts +2 -1
- package/dist/components/Sheet.d.ts +6 -0
- package/dist/components/Slider.d.ts +21 -0
- package/dist/components/Table.d.ts +10 -10
- package/dist/components/Tabs.d.ts +4 -2
- package/dist/components/TextField.d.ts +1 -1
- package/dist/components/TextareaAutosize.d.ts +3 -34
- package/dist/components/Tooltip.d.ts +6 -2
- package/dist/components/Typography.d.ts +5 -4
- package/dist/components/index.d.ts +3 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/icons/Icon.d.ts +3 -3
- package/dist/index.css +73 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +50174 -20590
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +50441 -857
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.d.ts +9 -9
- package/dist/util/{cn.d.ts → cls.d.ts} +4 -0
- package/dist/util/index.d.ts +1 -3
- package/package.json +119 -118
- package/src/components/Alert.tsx +4 -4
- package/src/components/Autocomplete.tsx +7 -5
- package/src/components/Avatar.tsx +41 -26
- package/src/components/Badge.tsx +2 -2
- package/src/components/BooleanSwitch.tsx +14 -13
- package/src/components/BooleanSwitchWithLabel.tsx +17 -8
- package/src/components/Button.tsx +31 -23
- package/src/components/Card.tsx +4 -3
- package/src/components/CenteredView.tsx +26 -15
- package/src/components/Checkbox.tsx +16 -14
- package/src/components/Chip.tsx +13 -10
- package/src/components/CircularProgress.tsx +3 -3
- package/src/components/Collapse.tsx +4 -2
- package/src/components/Container.tsx +3 -2
- package/src/components/DateTimeField.tsx +144 -921
- package/src/components/DebouncedTextField.tsx +1 -0
- package/src/components/Dialog.tsx +17 -7
- package/src/components/DialogActions.tsx +3 -3
- package/src/components/DialogContent.tsx +7 -3
- package/src/components/DialogTitle.tsx +41 -0
- package/src/components/ExpandablePanel.tsx +20 -12
- package/src/components/FileUpload.tsx +11 -13
- package/src/components/IconButton.tsx +7 -11
- package/src/components/InfoLabel.tsx +2 -2
- package/src/components/InputLabel.tsx +12 -9
- package/src/components/Label.tsx +18 -4
- package/src/components/Markdown.tsx +15 -3
- package/src/components/Menu.tsx +50 -31
- package/src/components/Menubar.tsx +322 -0
- package/src/components/MultiSelect.tsx +341 -167
- package/src/components/Paper.tsx +2 -2
- package/src/components/Popover.tsx +19 -15
- package/src/components/RadioGroup.tsx +42 -9
- package/src/components/SearchBar.tsx +12 -11
- package/src/components/Select.tsx +142 -130
- package/src/components/Separator.tsx +10 -4
- package/src/components/Sheet.tsx +53 -31
- package/src/components/Skeleton.tsx +9 -6
- package/src/components/Slider.tsx +110 -0
- package/src/components/Table.tsx +54 -35
- package/src/components/Tabs.tsx +17 -15
- package/src/components/TextField.tsx +25 -23
- package/src/components/TextareaAutosize.tsx +4 -3
- package/src/components/Tooltip.tsx +33 -16
- package/src/components/Typography.tsx +42 -26
- package/src/components/common/SelectInputLabel.tsx +3 -3
- package/src/components/index.tsx +3 -1
- package/src/hooks/index.ts +3 -0
- package/src/{util → hooks}/useDebounceValue.tsx +2 -0
- package/src/{util → hooks}/useInjectStyles.tsx +1 -0
- package/src/{util → hooks}/useOutsideAlerter.tsx +2 -0
- package/src/icons/Icon.tsx +48 -43
- package/src/icons/icon_keys.ts +114 -1301
- package/src/index.css +73 -0
- package/src/index.ts +1 -0
- package/src/scripts/generateIconKeys.ts +20 -11
- package/src/styles.ts +9 -9
- package/src/util/cls.ts +14 -0
- package/src/util/index.ts +1 -3
- package/tailwind.config.js +42 -26
- package/dist/components/Spinner.d.ts +0 -1
- package/src/components/Spinner.tsx +0 -18
- package/src/util/cn.ts +0 -6
- /package/dist/{util → hooks}/useDebounceValue.d.ts +0 -0
- /package/dist/{util → hooks}/useInjectStyles.d.ts +0 -0
- /package/dist/{util → hooks}/useOutsideAlerter.d.ts +0 -0
@@ -1,15 +1,37 @@
|
|
1
|
+
"use client";
|
1
2
|
import * as React from "react"
|
2
3
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
3
|
-
import {
|
4
|
-
|
4
|
+
import { cls } from "../util";
|
5
|
+
|
6
|
+
export interface RadioGroupProps {
|
7
|
+
id?: string;
|
8
|
+
children: React.ReactNode;
|
9
|
+
name?: string
|
10
|
+
required?: boolean;
|
11
|
+
disabled?: boolean;
|
12
|
+
/**
|
13
|
+
* Whether keyboard navigation should loop around
|
14
|
+
* @defaultValue false
|
15
|
+
*/
|
16
|
+
loop?: boolean;
|
17
|
+
defaultValue?: string;
|
18
|
+
value?: string;
|
19
|
+
|
20
|
+
onValueChange?(value: string): void;
|
21
|
+
|
22
|
+
className?: string;
|
23
|
+
}
|
5
24
|
|
6
25
|
const RadioGroup = React.forwardRef<
|
7
26
|
React.ElementRef<typeof RadioGroupPrimitive.Root>,
|
8
|
-
|
9
|
-
>(({
|
27
|
+
RadioGroupProps
|
28
|
+
>(({
|
29
|
+
className,
|
30
|
+
...props
|
31
|
+
}, ref) => {
|
10
32
|
return (
|
11
33
|
<RadioGroupPrimitive.Root
|
12
|
-
className={
|
34
|
+
className={cls("grid gap-2", className)}
|
13
35
|
{...props}
|
14
36
|
ref={ref}
|
15
37
|
/>
|
@@ -17,21 +39,32 @@ const RadioGroup = React.forwardRef<
|
|
17
39
|
})
|
18
40
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName
|
19
41
|
|
42
|
+
export interface RadioGroupItemProps {
|
43
|
+
id?: string;
|
44
|
+
value: string;
|
45
|
+
checked?: boolean;
|
46
|
+
required?: boolean;
|
47
|
+
className?: string;
|
48
|
+
disabled?: boolean;
|
49
|
+
}
|
20
50
|
const RadioGroupItem = React.forwardRef<
|
21
51
|
React.ElementRef<typeof RadioGroupPrimitive.Item>,
|
22
|
-
|
23
|
-
>(({
|
52
|
+
RadioGroupItemProps
|
53
|
+
>(({
|
54
|
+
className,
|
55
|
+
...props
|
56
|
+
}, ref) => {
|
24
57
|
return (
|
25
58
|
<RadioGroupPrimitive.Item
|
26
59
|
ref={ref}
|
27
|
-
className={
|
60
|
+
className={cls(
|
28
61
|
"aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",
|
29
62
|
className
|
30
63
|
)}
|
31
64
|
{...props}
|
32
65
|
>
|
33
66
|
<RadioGroupPrimitive.Indicator className="flex items-center justify-center">
|
34
|
-
<div className="h-2.5 w-2.5 fill-current text-current bg-primary rounded-lg"
|
67
|
+
<div className="h-2.5 w-2.5 fill-current text-current bg-primary rounded-lg"/>
|
35
68
|
</RadioGroupPrimitive.Indicator>
|
36
69
|
</RadioGroupPrimitive.Item>
|
37
70
|
)
|
@@ -1,10 +1,11 @@
|
|
1
|
+
"use client";
|
1
2
|
import React, { useCallback, useState } from "react";
|
2
3
|
|
3
|
-
import { defaultBorderMixin
|
4
|
+
import { defaultBorderMixin } from "../styles";
|
4
5
|
import { CircularProgress, IconButton } from "./index";
|
5
6
|
import { ClearIcon, SearchIcon } from "../icons";
|
6
|
-
import {
|
7
|
-
import { useDebounceValue } from "../
|
7
|
+
import { cls } from "../util";
|
8
|
+
import { useDebounceValue } from "../hooks";
|
8
9
|
|
9
10
|
interface SearchBarProps {
|
10
11
|
onClick?: () => void;
|
@@ -60,15 +61,15 @@ export function SearchBar({
|
|
60
61
|
return (
|
61
62
|
<div
|
62
63
|
onClick={onClick}
|
63
|
-
className={
|
64
|
+
className={cls("relative",
|
64
65
|
large ? "h-14" : "h-[42px]",
|
65
|
-
"bg-
|
66
|
+
"bg-surface-accent-50 dark:bg-surface-800 border",
|
66
67
|
defaultBorderMixin,
|
67
|
-
"rounded",
|
68
|
+
"rounded-lg",
|
68
69
|
className)}>
|
69
70
|
<div
|
70
|
-
className="absolute p-0 px-4 h-full
|
71
|
-
{loading ? <CircularProgress size={"small"}/> : <SearchIcon className={"text-
|
71
|
+
className="absolute p-0 px-4 h-full pointer-events-none flex items-center justify-center top-0">
|
72
|
+
{loading ? <CircularProgress size={"small"}/> : <SearchIcon className={"text-text-disabled dark:text-text-disabled-dark"}/>}
|
72
73
|
</div>
|
73
74
|
<input
|
74
75
|
value={searchText ?? ""}
|
@@ -84,12 +85,12 @@ export function SearchBar({
|
|
84
85
|
autoFocus={autoFocus}
|
85
86
|
onFocus={() => setActive(true)}
|
86
87
|
onBlur={() => setActive(false)}
|
87
|
-
className={
|
88
|
+
className={cls(
|
88
89
|
(disabled || loading) && "pointer-events-none",
|
89
|
-
"
|
90
|
+
"placeholder-text-disabled dark:placeholder-text-disabled-dark",
|
91
|
+
"relative flex items-center rounded-lg transition-all bg-transparent outline-none appearance-none border-none",
|
90
92
|
"pl-12 h-full text-current ",
|
91
93
|
expandable ? (active ? "w-[220px]" : "w-[180px]") : "",
|
92
|
-
focusedMixin,
|
93
94
|
innerClassName
|
94
95
|
)}
|
95
96
|
/>
|
@@ -1,105 +1,94 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
"use client";
|
2
|
+
import React, { ChangeEvent, Children, forwardRef, useCallback, useEffect, useState } from "react";
|
3
3
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
4
4
|
import {
|
5
|
+
defaultBorderMixin,
|
5
6
|
fieldBackgroundDisabledMixin,
|
6
7
|
fieldBackgroundHoverMixin,
|
7
8
|
fieldBackgroundInvisibleMixin,
|
8
9
|
fieldBackgroundMixin,
|
9
|
-
|
10
|
+
focusedDisabled
|
10
11
|
} from "../styles";
|
11
12
|
import { CheckIcon, ExpandMoreIcon } from "../icons";
|
12
|
-
import {
|
13
|
+
import { cls } from "../util";
|
13
14
|
import { SelectInputLabel } from "./common/SelectInputLabel";
|
14
15
|
|
15
16
|
export type SelectProps = {
|
16
17
|
open?: boolean,
|
17
18
|
name?: string,
|
19
|
+
fullWidth?: boolean,
|
18
20
|
id?: string,
|
19
21
|
onOpenChange?: (open: boolean) => void,
|
20
|
-
value?: string
|
22
|
+
value?: string,
|
21
23
|
className?: string,
|
22
24
|
inputClassName?: string,
|
23
|
-
onChange?: React.EventHandler<
|
25
|
+
onChange?: React.EventHandler<ChangeEvent<HTMLSelectElement>>,
|
24
26
|
onValueChange?: (updatedValue: string) => void,
|
25
|
-
onMultiValueChange?: (updatedValue: string[]) => void,
|
26
27
|
placeholder?: React.ReactNode,
|
27
|
-
renderValue?: (value: string
|
28
|
-
|
29
|
-
|
30
|
-
label?: React.ReactNode,
|
28
|
+
renderValue?: (value: string) => React.ReactNode,
|
29
|
+
size?: "small" | "medium" | "large",
|
30
|
+
label?: React.ReactNode | string,
|
31
31
|
disabled?: boolean,
|
32
32
|
error?: boolean,
|
33
33
|
position?: "item-aligned" | "popper",
|
34
34
|
endAdornment?: React.ReactNode,
|
35
|
-
multiple?: boolean,
|
36
35
|
inputRef?: React.RefObject<HTMLButtonElement>,
|
37
36
|
padding?: boolean,
|
38
|
-
includeFocusOutline?: boolean,
|
39
37
|
invisible?: boolean,
|
40
|
-
children?: React.ReactNode
|
38
|
+
children?: React.ReactNode;
|
41
39
|
};
|
42
40
|
|
43
|
-
export
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
}: SelectProps) {
|
41
|
+
export const Select = forwardRef<HTMLDivElement, SelectProps>(({
|
42
|
+
inputRef,
|
43
|
+
open,
|
44
|
+
name,
|
45
|
+
fullWidth = false,
|
46
|
+
id,
|
47
|
+
onOpenChange,
|
48
|
+
value,
|
49
|
+
onChange,
|
50
|
+
onValueChange,
|
51
|
+
className,
|
52
|
+
inputClassName,
|
53
|
+
placeholder,
|
54
|
+
renderValue,
|
55
|
+
label,
|
56
|
+
size = "large",
|
57
|
+
error,
|
58
|
+
disabled,
|
59
|
+
padding = true,
|
60
|
+
position = "item-aligned",
|
61
|
+
endAdornment,
|
62
|
+
invisible,
|
63
|
+
children,
|
64
|
+
...props
|
65
|
+
}, ref) => {
|
66
|
+
|
67
|
+
const [openInternal, setOpenInternal] = useState(open ?? false);
|
71
68
|
|
72
|
-
const [openInternal, setOpenInternal] = React.useState(false);
|
73
69
|
useEffect(() => {
|
74
70
|
setOpenInternal(open ?? false);
|
75
71
|
}, [open]);
|
76
72
|
|
77
|
-
const onValueChangeInternal =
|
78
|
-
|
79
|
-
|
80
|
-
onMultiValueChange?.(value.filter(v => v !== newValue));
|
81
|
-
} else {
|
82
|
-
onMultiValueChange?.([...(value as string[] ?? []), newValue]);
|
83
|
-
}
|
84
|
-
} else {
|
85
|
-
onValueChange?.(newValue);
|
86
|
-
}
|
87
|
-
if (!multiple && onChange) {
|
73
|
+
const onValueChangeInternal = useCallback((newValue: string) => {
|
74
|
+
onValueChange?.(newValue);
|
75
|
+
if (onChange) {
|
88
76
|
const event = {
|
89
77
|
target: {
|
90
78
|
name,
|
91
79
|
value: newValue
|
92
80
|
}
|
93
|
-
} as
|
81
|
+
} as ChangeEvent<HTMLSelectElement>;
|
94
82
|
onChange(event);
|
95
83
|
}
|
96
|
-
}, [
|
84
|
+
}, [onChange, value, onValueChange]);
|
85
|
+
|
86
|
+
const hasValue = Array.isArray(value) ? value.length > 0 : (value != null && value !== "" && value !== undefined);
|
97
87
|
|
98
88
|
return (
|
99
89
|
<SelectPrimitive.Root
|
100
90
|
name={name}
|
101
|
-
value={
|
102
|
-
defaultOpen={open}
|
91
|
+
value={value}
|
103
92
|
open={openInternal}
|
104
93
|
disabled={disabled}
|
105
94
|
onValueChange={onValueChangeInternal}
|
@@ -108,90 +97,119 @@ export function Select({
|
|
108
97
|
setOpenInternal(open);
|
109
98
|
}}
|
110
99
|
{...props}>
|
111
|
-
|
112
100
|
{typeof label === "string" ? <SelectInputLabel error={error}>{label}</SelectInputLabel> : label}
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
"
|
121
|
-
|
122
|
-
|
101
|
+
<div className={cls(
|
102
|
+
"select-none rounded-md text-sm",
|
103
|
+
invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,
|
104
|
+
disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
|
105
|
+
"relative flex items-center",
|
106
|
+
className,
|
107
|
+
{
|
108
|
+
"min-h-[28px]": size === "small",
|
109
|
+
"min-h-[42px]": size === "medium",
|
110
|
+
"min-h-[64px]": size === "large",
|
111
|
+
"w-fit": !fullWidth,
|
112
|
+
"w-full": fullWidth
|
113
|
+
}
|
114
|
+
)}>
|
123
115
|
<SelectPrimitive.Trigger
|
124
116
|
ref={inputRef}
|
125
117
|
id={id}
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
118
|
+
asChild
|
119
|
+
>
|
120
|
+
<div className={cls(
|
121
|
+
"h-full",
|
122
|
+
padding ? {
|
123
|
+
"px-4": size === "large",
|
124
|
+
"px-3": size === "medium",
|
125
|
+
"px-2": size === "small"
|
126
|
+
} : "",
|
130
127
|
"outline-none focus:outline-none",
|
131
128
|
"select-none rounded-md text-sm",
|
132
129
|
error ? "text-red-500 dark:text-red-600" : "focus:text-text-primary dark:focus:text-text-primary-dark",
|
133
130
|
error ? "border border-red-500 dark:border-red-600" : "",
|
134
|
-
disabled ? "text-
|
135
|
-
"relative flex items-center",
|
136
|
-
|
131
|
+
disabled ? "text-surface-accent-600 dark:text-surface-accent-400" : "text-surface-accent-800 dark:text-white",
|
132
|
+
"relative flex flex-row items-center",
|
133
|
+
{
|
134
|
+
"min-h-[28px]": size === "small",
|
135
|
+
"min-h-[42px]": size === "medium",
|
136
|
+
"min-h-[64px]": size === "large",
|
137
|
+
"w-full": fullWidth,
|
138
|
+
"w-fit": !fullWidth
|
139
|
+
},
|
137
140
|
inputClassName
|
138
141
|
)}>
|
142
|
+
<div
|
143
|
+
ref={ref}
|
144
|
+
className={cls(
|
145
|
+
"flex-grow max-w-full flex flex-row gap-2 items-center",
|
146
|
+
"overflow-visible",
|
147
|
+
{
|
148
|
+
"min-h-[28px]": size === "small",
|
149
|
+
"min-h-[42px]": size === "medium",
|
150
|
+
"min-h-[64px]": size === "large"
|
151
|
+
}
|
152
|
+
)}>
|
153
|
+
<SelectPrimitive.Value
|
154
|
+
onClick={(e) => {
|
155
|
+
e.preventDefault();
|
156
|
+
e.stopPropagation();
|
157
|
+
}}
|
158
|
+
placeholder={placeholder}
|
159
|
+
className={"w-full"}>
|
160
|
+
{hasValue && value && renderValue ? renderValue(value) : placeholder}
|
161
|
+
{/*{hasValue && !renderValue && value}*/}
|
162
|
+
{hasValue && !renderValue && (() => {
|
139
163
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
{renderValue &&
|
147
|
-
(value && Array.isArray(value)
|
148
|
-
? value.map((v, i) => (
|
149
|
-
<div key={v} className={"flex items-center gap-1 max-w-full"}>
|
150
|
-
{renderValue ? renderValue(v, i) : v}
|
151
|
-
</div>))
|
152
|
-
: (typeof value === "string" ? (renderValue ? renderValue(value, 0) : value) : placeholder))}
|
164
|
+
// @ts-ignore
|
165
|
+
const childrenProps: SelectItemProps[] = Children.map(children, (child) => {
|
166
|
+
if (React.isValidElement(child)) {
|
167
|
+
return child.props;
|
168
|
+
}
|
169
|
+
}).filter(Boolean);
|
153
170
|
|
154
|
-
|
155
|
-
|
156
|
-
|
171
|
+
const option = childrenProps.find((o) => o.value === value);
|
172
|
+
return option?.children;
|
173
|
+
})()}
|
157
174
|
|
158
|
-
|
175
|
+
</SelectPrimitive.Value>
|
176
|
+
</div>
|
159
177
|
|
160
|
-
|
178
|
+
{endAdornment && (
|
179
|
+
<div
|
180
|
+
className={cls("h-full flex items-center")}
|
181
|
+
onClick={(e) => {
|
182
|
+
e.preventDefault();
|
183
|
+
e.stopPropagation();
|
184
|
+
}}>
|
185
|
+
{endAdornment}
|
186
|
+
</div>
|
187
|
+
)}
|
188
|
+
<SelectPrimitive.Icon asChild>
|
189
|
+
<ExpandMoreIcon size={"medium"}
|
190
|
+
className={cls("transition", open ? "rotate-180" : "", {
|
191
|
+
"px-2": size === "large",
|
192
|
+
"px-1": size === "medium" || size === "small",
|
193
|
+
})}/>
|
194
|
+
</SelectPrimitive.Icon>
|
161
195
|
</div>
|
162
|
-
|
163
|
-
<SelectPrimitive.Icon className={cn(
|
164
|
-
"px-2 h-full flex items-center",
|
165
|
-
)}>
|
166
|
-
<ExpandMoreIcon size={"small"}
|
167
|
-
className={cn("transition", open ? "rotate-180" : "")}/>
|
168
|
-
</SelectPrimitive.Icon>
|
169
|
-
|
170
196
|
</SelectPrimitive.Trigger>
|
171
197
|
|
172
|
-
{endAdornment && <div className={cn("absolute h-full flex items-center",
|
173
|
-
size === "small" ? "right-10" : "right-14")}
|
174
|
-
onClick={(e) => e.stopPropagation()}>
|
175
|
-
{endAdornment}
|
176
|
-
</div>}
|
177
|
-
|
178
198
|
</div>
|
179
199
|
<SelectPrimitive.Portal>
|
180
|
-
<SelectPrimitive.Content
|
181
|
-
|
182
|
-
className="
|
183
|
-
|
184
|
-
className={"p-1"}
|
185
|
-
style={{
|
186
|
-
maxHeight: "var(--radix-select-content-available-height)"
|
187
|
-
}}>
|
200
|
+
<SelectPrimitive.Content position={position}
|
201
|
+
className={cls(focusedDisabled, "z-50 relative overflow-hidden border bg-white dark:bg-surface-900 p-2 rounded-lg", defaultBorderMixin)}>
|
202
|
+
<SelectPrimitive.Viewport className={"p-1"}
|
203
|
+
style={{ maxHeight: "var(--radix-select-content-available-height)" }}>
|
188
204
|
{children}
|
189
205
|
</SelectPrimitive.Viewport>
|
190
206
|
</SelectPrimitive.Content>
|
191
207
|
</SelectPrimitive.Portal>
|
192
208
|
</SelectPrimitive.Root>
|
193
209
|
);
|
194
|
-
}
|
210
|
+
});
|
211
|
+
|
212
|
+
Select.displayName = "Select";
|
195
213
|
|
196
214
|
export type SelectItemProps = {
|
197
215
|
value: string,
|
@@ -210,23 +228,17 @@ export function SelectItem({
|
|
210
228
|
key={value}
|
211
229
|
value={value}
|
212
230
|
disabled={disabled}
|
213
|
-
|
214
|
-
e.preventDefault();
|
215
|
-
e.stopPropagation();
|
216
|
-
}}
|
217
|
-
className={cn(
|
231
|
+
className={cls(
|
218
232
|
"w-full",
|
219
|
-
"relative
|
220
|
-
focusedMixin,
|
233
|
+
"relative flex items-center p-2 rounded-md text-sm text-surface-accent-700 dark:text-surface-accent-300",
|
221
234
|
"focus:z-10",
|
222
|
-
"data-[state=checked]:bg-
|
223
|
-
"data-[state=checked]:focus:bg-
|
235
|
+
"data-[state=checked]:bg-surface-accent-100 data-[state=checked]:dark:bg-surface-accent-800 focus:bg-surface-accent-100 dark:focus:bg-surface-950",
|
236
|
+
"data-[state=checked]:focus:bg-surface-accent-200 data-[state=checked]:dark:focus:bg-surface-950",
|
224
237
|
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
225
238
|
"[&>*]:w-full",
|
226
239
|
"overflow-visible",
|
227
240
|
className
|
228
|
-
)}
|
229
|
-
>
|
241
|
+
)}>
|
230
242
|
<SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>
|
231
243
|
<div
|
232
244
|
className="absolute left-1 data-[state=checked]:block hidden">
|
@@ -248,8 +260,8 @@ export function SelectGroup({
|
|
248
260
|
}: SelectGroupProps) {
|
249
261
|
return <>
|
250
262
|
<SelectPrimitive.Group
|
251
|
-
className={
|
252
|
-
"text-xs text-
|
263
|
+
className={cls(
|
264
|
+
"text-xs text-surface-accent-900 dark:text-white uppercase tracking-wider font-bold mt-6 first:mt-2",
|
253
265
|
"px-2 py-2",
|
254
266
|
className
|
255
267
|
)}>
|
@@ -1,20 +1,26 @@
|
|
1
1
|
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
2
|
+
import { cls } from "../util";
|
2
3
|
|
3
|
-
export function Separator({
|
4
|
+
export function Separator({
|
5
|
+
orientation,
|
6
|
+
decorative,
|
7
|
+
className
|
8
|
+
}: {
|
4
9
|
orientation: "horizontal" | "vertical",
|
5
|
-
decorative?: boolean
|
10
|
+
decorative?: boolean,
|
11
|
+
className?: string
|
6
12
|
}) {
|
7
13
|
if (orientation === "horizontal")
|
8
14
|
return (
|
9
15
|
<SeparatorPrimitive.Root
|
10
16
|
decorative={decorative}
|
11
17
|
orientation="horizontal"
|
12
|
-
className="dark:bg-opacity-
|
18
|
+
className={cls("dark:bg-opacity-80 dark:bg-surface-800 bg-surface-100 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px my-4", className)}/>
|
13
19
|
);
|
14
20
|
else
|
15
21
|
return (
|
16
22
|
<SeparatorPrimitive.Root
|
17
|
-
className="dark:bg-opacity-
|
23
|
+
className={cls("dark:bg-opacity-80 dark:bg-surface-800 bg-surface-100 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px mx-4", className)}
|
18
24
|
decorative={decorative}
|
19
25
|
orientation="vertical"
|
20
26
|
/>
|