@arkitektbedriftene/fe-lib 0.3.12 → 0.3.13
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/colors.d.ts +1 -1
- package/dist/hooks.d.ts +1 -1
- package/dist/icons.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/oidc.d.ts +1 -1
- package/dist/{lib/rich-text → rich-text}/Editor.d.ts +1 -1
- package/dist/rich-text.d.ts +1 -1
- package/dist/rich-text.es.js +3 -3
- package/dist/ui.css.d.ts +1 -1
- package/dist/ui.d.ts +1 -1
- package/package.json +16 -9
- package/.github/workflows/auto-publish.yaml +0 -20
- package/dist/lib/index.d.ts +0 -1
- package/index.html +0 -13
- package/src/App.css +0 -42
- package/src/App.tsx +0 -44
- package/src/assets/react.svg +0 -1
- package/src/index.css +0 -69
- package/src/lib/colors/colors.ts +0 -19
- package/src/lib/hooks/hooks.ts +0 -3
- package/src/lib/icons/README.md +0 -1
- package/src/lib/icons/icons.tsx +0 -51
- package/src/lib/index.ts +0 -1
- package/src/lib/oidc/README.md +0 -28
- package/src/lib/oidc/firmAccess.ts +0 -36
- package/src/lib/oidc/impersonate.tsx +0 -104
- package/src/lib/oidc/oidc.tsx +0 -248
- package/src/lib/rich-text/Editor.tsx +0 -137
- package/src/lib/rich-text/config.ts +0 -16
- package/src/lib/rich-text/editorContext.ts +0 -34
- package/src/lib/rich-text/rich-text.ts +0 -4
- package/src/lib/rich-text/state.ts +0 -62
- package/src/lib/rich-text/theme.ts +0 -41
- package/src/lib/rich-text/trim.ts +0 -79
- package/src/lib/ui/components/Alert.tsx +0 -63
- package/src/lib/ui/components/Badge.tsx +0 -42
- package/src/lib/ui/components/Box.tsx +0 -3
- package/src/lib/ui/components/Button.tsx +0 -195
- package/src/lib/ui/components/OverlayCard.tsx +0 -50
- package/src/lib/ui/components/Popover.tsx +0 -164
- package/src/lib/ui/components/Spinner.tsx +0 -102
- package/src/lib/ui/components/Tooltip.tsx +0 -34
- package/src/lib/ui/stitches.config.ts +0 -144
- package/src/lib/ui/ui.css +0 -11
- package/src/lib/ui/ui.ts +0 -10
- package/src/main.tsx +0 -10
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -21
- package/tsconfig.node.json +0 -9
- package/vite.config.ts +0 -45
- /package/dist/{lib/colors → colors}/colors.d.ts +0 -0
- /package/dist/{lib/hooks → hooks}/hooks.d.ts +0 -0
- /package/dist/{lib/icons → icons}/icons.d.ts +0 -0
- /package/dist/{lib/oidc → oidc}/firmAccess.d.ts +0 -0
- /package/dist/{lib/oidc → oidc}/impersonate.d.ts +0 -0
- /package/dist/{lib/oidc → oidc}/oidc.d.ts +0 -0
- /package/dist/{lib/rich-text → rich-text}/config.d.ts +0 -0
- /package/dist/{lib/rich-text → rich-text}/editorContext.d.ts +0 -0
- /package/dist/{lib/rich-text → rich-text}/rich-text.d.ts +0 -0
- /package/dist/{lib/rich-text → rich-text}/state.d.ts +0 -0
- /package/dist/{lib/rich-text → rich-text}/theme.d.ts +0 -0
- /package/dist/{lib/rich-text → rich-text}/trim.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/Alert.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/Badge.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/Box.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/Button.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/OverlayCard.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/Popover.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/Spinner.d.ts +0 -0
- /package/dist/{lib/ui → ui}/components/Tooltip.d.ts +0 -0
- /package/dist/{lib/ui → ui}/stitches.config.d.ts +0 -0
- /package/dist/{lib/ui → ui}/ui.d.ts +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { styled } from "../stitches.config";
|
|
2
|
-
|
|
3
|
-
export const Badge = styled("span", {
|
|
4
|
-
flex: "0 0 auto",
|
|
5
|
-
display: "inline-flex",
|
|
6
|
-
padding: "$1 $2",
|
|
7
|
-
fontSize: "$xs",
|
|
8
|
-
fontWeight: "$medium",
|
|
9
|
-
lineHeight: "1",
|
|
10
|
-
whiteSpace: "nowrap",
|
|
11
|
-
borderRadius: "$sm",
|
|
12
|
-
overflow: "hidden",
|
|
13
|
-
|
|
14
|
-
variants: {
|
|
15
|
-
color: {
|
|
16
|
-
success: {
|
|
17
|
-
backgroundColor: "$green200",
|
|
18
|
-
color: "$green800",
|
|
19
|
-
},
|
|
20
|
-
warning: {
|
|
21
|
-
backgroundColor: "$yellow100",
|
|
22
|
-
color: "$yellow700",
|
|
23
|
-
},
|
|
24
|
-
danger: {
|
|
25
|
-
backgroundColor: "$red200",
|
|
26
|
-
color: "$red800",
|
|
27
|
-
},
|
|
28
|
-
primary: {
|
|
29
|
-
backgroundColor: "$blue200",
|
|
30
|
-
color: "$blue800",
|
|
31
|
-
},
|
|
32
|
-
secondary: {
|
|
33
|
-
backgroundColor: "$gray200",
|
|
34
|
-
color: "$gray800",
|
|
35
|
-
},
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
defaultVariants: {
|
|
40
|
-
color: "primary",
|
|
41
|
-
},
|
|
42
|
-
});
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { styled } from "../stitches.config";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { Spinner } from "./Spinner";
|
|
4
|
-
|
|
5
|
-
const ButtonStyled = styled("button", {
|
|
6
|
-
appearance: "none",
|
|
7
|
-
margin: 0,
|
|
8
|
-
padding: 0,
|
|
9
|
-
border: "none",
|
|
10
|
-
background: "none",
|
|
11
|
-
cursor: "pointer",
|
|
12
|
-
fontFamily: "inherit",
|
|
13
|
-
textAlign: "left",
|
|
14
|
-
textDecoration: "none",
|
|
15
|
-
textIndent: 0,
|
|
16
|
-
lineHeight: 1.25,
|
|
17
|
-
display: "inline-flex",
|
|
18
|
-
justifyContent: "center",
|
|
19
|
-
alignItems: "center",
|
|
20
|
-
gap: "$2",
|
|
21
|
-
position: "relative",
|
|
22
|
-
fontWeight: "$medium",
|
|
23
|
-
borderRadius: "$sm",
|
|
24
|
-
whiteSpace: "nowrap",
|
|
25
|
-
|
|
26
|
-
transition: "background 0.2s ease-in-out",
|
|
27
|
-
|
|
28
|
-
"&:focus, &:focus-visible": {
|
|
29
|
-
outline: "none",
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
"&:focus-visible": {
|
|
33
|
-
boxShadow: "0 0 0 2px white, 0 0 0 4px $colors$focusRing",
|
|
34
|
-
},
|
|
35
|
-
|
|
36
|
-
"&:disabled": {
|
|
37
|
-
cursor: "not-allowed",
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
variants: {
|
|
41
|
-
color: {
|
|
42
|
-
primary: {
|
|
43
|
-
$$solid: "$colors$blue600",
|
|
44
|
-
$$solidHover: "$colors$blue700",
|
|
45
|
-
|
|
46
|
-
$$outline: "$colors$blue600",
|
|
47
|
-
$$outlineHover: "$colors$blue100",
|
|
48
|
-
$$outlineText: "$colors$blue600",
|
|
49
|
-
|
|
50
|
-
$$disabled: "$colors$blue200",
|
|
51
|
-
},
|
|
52
|
-
secondary: {
|
|
53
|
-
$$solid: "$colors$gray600",
|
|
54
|
-
$$solidHover: "$colors$gray700",
|
|
55
|
-
|
|
56
|
-
$$outline: "$colors$gray400",
|
|
57
|
-
$$outlineHover: "$colors$gray100",
|
|
58
|
-
$$outlineText: "$colors$gray600",
|
|
59
|
-
|
|
60
|
-
$$disabled: "$colors$gray200",
|
|
61
|
-
},
|
|
62
|
-
success: {
|
|
63
|
-
$$solid: "$colors$green600",
|
|
64
|
-
$$solidHover: "$colors$green700",
|
|
65
|
-
|
|
66
|
-
$$outline: "$colors$green600",
|
|
67
|
-
$$outlineHover: "$colors$green100",
|
|
68
|
-
$$outlineText: "$colors$green600",
|
|
69
|
-
|
|
70
|
-
$$disabled: "$colors$green200",
|
|
71
|
-
},
|
|
72
|
-
danger: {
|
|
73
|
-
$$solid: "$colors$red600",
|
|
74
|
-
$$solidHover: "$colors$red700",
|
|
75
|
-
|
|
76
|
-
$$outline: "$colors$red600",
|
|
77
|
-
$$outlineHover: "$colors$red100",
|
|
78
|
-
$$outlineText: "$colors$red600",
|
|
79
|
-
|
|
80
|
-
$$disabled: "$colors$red200",
|
|
81
|
-
},
|
|
82
|
-
warning: {
|
|
83
|
-
$$solid: "$colors$yellow600",
|
|
84
|
-
$$solidHover: "$colors$yellow700",
|
|
85
|
-
|
|
86
|
-
$$outline: "$colors$yellow400",
|
|
87
|
-
$$outlineHover: "$colors$yellow50",
|
|
88
|
-
$$outlineText: "$colors$yellow600",
|
|
89
|
-
|
|
90
|
-
$$disabled: "$colors$yellow100",
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
size: {
|
|
94
|
-
md: {
|
|
95
|
-
fontSize: "$sm",
|
|
96
|
-
padding: "$2 $4",
|
|
97
|
-
height: "2.25rem",
|
|
98
|
-
},
|
|
99
|
-
lg: {
|
|
100
|
-
fontSize: "$md",
|
|
101
|
-
padding: "$3 $6",
|
|
102
|
-
height: "2.75rem",
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
variant: {
|
|
106
|
-
primary: {
|
|
107
|
-
background: "$$solid",
|
|
108
|
-
color: "white",
|
|
109
|
-
"&:hover:enabled": {
|
|
110
|
-
backgroundColor: "$$solidHover",
|
|
111
|
-
},
|
|
112
|
-
"&:disabled": {
|
|
113
|
-
backgroundColor: "$$disabled",
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
outline: {
|
|
117
|
-
boxShadow: "inset 0 0 0 1px $$outline",
|
|
118
|
-
color: "$$outlineText",
|
|
119
|
-
"&:hover:enabled": {
|
|
120
|
-
backgroundColor: "$$outlineHover",
|
|
121
|
-
},
|
|
122
|
-
"&:disabled": {
|
|
123
|
-
boxShadow: "inset 0 0 0 1px $$disabled",
|
|
124
|
-
color: "$$disabled",
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
transparent: {
|
|
128
|
-
backgroundColor: "transparent",
|
|
129
|
-
color: "$$outlineText",
|
|
130
|
-
"&:hover:enabled": {
|
|
131
|
-
backgroundColor: "$$outlineHover",
|
|
132
|
-
},
|
|
133
|
-
"&:disabled": {
|
|
134
|
-
color: "$$disabled",
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
icon: {
|
|
139
|
-
true: {}
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
|
|
143
|
-
compoundVariants: [
|
|
144
|
-
{
|
|
145
|
-
icon: true,
|
|
146
|
-
size: "md",
|
|
147
|
-
css: {
|
|
148
|
-
padding: "$2",
|
|
149
|
-
width: "2.25rem",
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
icon: true,
|
|
154
|
-
size: "lg",
|
|
155
|
-
css: {
|
|
156
|
-
padding: "$2",
|
|
157
|
-
width: "2.75rem",
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
],
|
|
161
|
-
|
|
162
|
-
defaultVariants: {
|
|
163
|
-
variant: "outline",
|
|
164
|
-
color: "secondary",
|
|
165
|
-
size: "md",
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
type ButtonProps = React.ComponentProps<typeof ButtonStyled> & {
|
|
170
|
-
as?: React.ElementType;
|
|
171
|
-
isLoading?: boolean;
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(
|
|
175
|
-
({ children, disabled, isLoading, variant, color, ...props }, ref) => {
|
|
176
|
-
|
|
177
|
-
if (!color && variant === "primary") {
|
|
178
|
-
color = "primary";
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<ButtonStyled
|
|
183
|
-
ref={ref}
|
|
184
|
-
type="button"
|
|
185
|
-
disabled={disabled || isLoading}
|
|
186
|
-
variant={variant}
|
|
187
|
-
color={color}
|
|
188
|
-
{...props}
|
|
189
|
-
>
|
|
190
|
-
{children}
|
|
191
|
-
{isLoading && <Spinner color="inherit" />}
|
|
192
|
-
</ButtonStyled>
|
|
193
|
-
);
|
|
194
|
-
},
|
|
195
|
-
);
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { css, keyframes, styled } from "../stitches.config";
|
|
2
|
-
|
|
3
|
-
// Animation
|
|
4
|
-
const slideUpAndFade = keyframes({
|
|
5
|
-
"0%": { opacity: 0, transform: "translateY(0.5rem)" },
|
|
6
|
-
"100%": { opacity: 1, transform: "translateY(0)" },
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
const slideRightAndFade = keyframes({
|
|
10
|
-
"0%": { opacity: 0, transform: "translateX(-0.5rem)" },
|
|
11
|
-
"100%": { opacity: 1, transform: "translateX(0)" },
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const slideDownAndFade = keyframes({
|
|
15
|
-
"0%": { opacity: 0, transform: "translateY(-0.5rem)" },
|
|
16
|
-
"100%": { opacity: 1, transform: "translateY(0)" },
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const slideLeftAndFade = keyframes({
|
|
20
|
-
"0%": { opacity: 0, transform: "translateX(0.5rem)" },
|
|
21
|
-
"100%": { opacity: 1, transform: "translateX(0)" },
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const overlayCardCss = css({
|
|
25
|
-
backgroundColor: "white",
|
|
26
|
-
boxShadow: "$overlayCard",
|
|
27
|
-
borderRadius: "$sm",
|
|
28
|
-
overflow: "hidden",
|
|
29
|
-
zIndex: "$overlayCard",
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
const overlayCardAnimationCss = css({
|
|
33
|
-
animationDuration: "400ms",
|
|
34
|
-
animationTimingFunction: "cubic-bezier(0.16, 1, 0.3, 1)",
|
|
35
|
-
willChange: "transform, opacity",
|
|
36
|
-
'&[data-state="open"]': {
|
|
37
|
-
'&[data-side="top"]': { animationName: slideDownAndFade },
|
|
38
|
-
'&[data-side="right"]': { animationName: slideLeftAndFade },
|
|
39
|
-
'&[data-side="bottom"]': { animationName: slideUpAndFade },
|
|
40
|
-
'&[data-side="left"]': { animationName: slideRightAndFade },
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export const OverlayCard = styled(
|
|
45
|
-
"div",
|
|
46
|
-
overlayCardCss,
|
|
47
|
-
overlayCardAnimationCss,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
export type OverlayCardProps = React.ComponentProps<typeof OverlayCard>;
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
FloatingPortal,
|
|
3
|
-
type OffsetOptions,
|
|
4
|
-
type Placement,
|
|
5
|
-
autoUpdate,
|
|
6
|
-
flip,
|
|
7
|
-
offset,
|
|
8
|
-
safePolygon,
|
|
9
|
-
shift,
|
|
10
|
-
useClick,
|
|
11
|
-
useDismiss,
|
|
12
|
-
useFloating,
|
|
13
|
-
useHover,
|
|
14
|
-
useInteractions,
|
|
15
|
-
useRole,
|
|
16
|
-
useTransitionStyles,
|
|
17
|
-
type UseRoleProps,
|
|
18
|
-
} from "@floating-ui/react";
|
|
19
|
-
import {
|
|
20
|
-
cloneElement,
|
|
21
|
-
createContext,
|
|
22
|
-
isValidElement,
|
|
23
|
-
useContext,
|
|
24
|
-
useMemo,
|
|
25
|
-
} from "react";
|
|
26
|
-
import { OverlayCard, type OverlayCardProps } from "./OverlayCard";
|
|
27
|
-
import { Box } from "./Box";
|
|
28
|
-
|
|
29
|
-
type PopoverContextValue = {
|
|
30
|
-
getFloatingProps: ReturnType<typeof useInteractions>["getFloatingProps"];
|
|
31
|
-
getReferenceProps: ReturnType<typeof useInteractions>["getReferenceProps"];
|
|
32
|
-
floatingStyles: ReturnType<typeof useFloating>["floatingStyles"];
|
|
33
|
-
refs: ReturnType<typeof useFloating>["refs"];
|
|
34
|
-
isMounted: boolean;
|
|
35
|
-
transitionStyles: ReturnType<typeof useTransitionStyles>["styles"];
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
const PopoverContext = createContext<PopoverContextValue>(
|
|
39
|
-
{} as PopoverContextValue,
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
export const Popover = ({
|
|
43
|
-
children,
|
|
44
|
-
offset: offsetOptions,
|
|
45
|
-
open,
|
|
46
|
-
onOpenChange,
|
|
47
|
-
trigger = "click",
|
|
48
|
-
hoverDelay,
|
|
49
|
-
placement = "bottom",
|
|
50
|
-
role: popoverRole = "dialog",
|
|
51
|
-
}: {
|
|
52
|
-
children: React.ReactNode;
|
|
53
|
-
offset?: OffsetOptions;
|
|
54
|
-
open: boolean;
|
|
55
|
-
onOpenChange: (open: boolean) => void;
|
|
56
|
-
trigger?: "click" | "hover";
|
|
57
|
-
hoverDelay?: number | { open: number; close: number };
|
|
58
|
-
placement?: Placement;
|
|
59
|
-
role?: UseRoleProps["role"];
|
|
60
|
-
}) => {
|
|
61
|
-
const { refs, floatingStyles, context } = useFloating({
|
|
62
|
-
open,
|
|
63
|
-
onOpenChange,
|
|
64
|
-
placement,
|
|
65
|
-
whileElementsMounted: autoUpdate,
|
|
66
|
-
middleware: [offset(offsetOptions), flip(), shift()],
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
const { isMounted, styles: transitionStyles } = useTransitionStyles(context, {
|
|
70
|
-
initial: ({ side }) => ({
|
|
71
|
-
opacity: 0,
|
|
72
|
-
transform: {
|
|
73
|
-
top: "translateY(-0.5rem)",
|
|
74
|
-
right: "translateX(0.5rem)",
|
|
75
|
-
bottom: "translateY(0.5rem)",
|
|
76
|
-
left: "translateX(-0.5rem)",
|
|
77
|
-
}[side],
|
|
78
|
-
}),
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
const click = useClick(context, { enabled: trigger === "click" });
|
|
82
|
-
const hover = useHover(context, {
|
|
83
|
-
enabled: trigger === "hover",
|
|
84
|
-
delay: hoverDelay,
|
|
85
|
-
handleClose: safePolygon(),
|
|
86
|
-
});
|
|
87
|
-
const dismiss = useDismiss(context);
|
|
88
|
-
const role = useRole(context, { role: popoverRole });
|
|
89
|
-
|
|
90
|
-
const { getFloatingProps, getReferenceProps } = useInteractions([
|
|
91
|
-
click,
|
|
92
|
-
hover,
|
|
93
|
-
dismiss,
|
|
94
|
-
role,
|
|
95
|
-
]);
|
|
96
|
-
|
|
97
|
-
const contextValue = useMemo(
|
|
98
|
-
() => ({
|
|
99
|
-
getFloatingProps,
|
|
100
|
-
getReferenceProps,
|
|
101
|
-
floatingStyles,
|
|
102
|
-
refs,
|
|
103
|
-
isMounted,
|
|
104
|
-
transitionStyles,
|
|
105
|
-
}),
|
|
106
|
-
[
|
|
107
|
-
getFloatingProps,
|
|
108
|
-
getReferenceProps,
|
|
109
|
-
isMounted,
|
|
110
|
-
refs,
|
|
111
|
-
floatingStyles,
|
|
112
|
-
transitionStyles,
|
|
113
|
-
],
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
return (
|
|
117
|
-
<PopoverContext.Provider value={contextValue}>
|
|
118
|
-
{children}
|
|
119
|
-
</PopoverContext.Provider>
|
|
120
|
-
);
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
export const PopoverTrigger = ({ children }: { children: React.ReactNode }) => {
|
|
124
|
-
const { getReferenceProps, refs } = useContext(PopoverContext);
|
|
125
|
-
|
|
126
|
-
return (
|
|
127
|
-
<>
|
|
128
|
-
{isValidElement(children) &&
|
|
129
|
-
cloneElement(children as React.ReactElement, {
|
|
130
|
-
ref: refs.setReference,
|
|
131
|
-
...getReferenceProps(),
|
|
132
|
-
})}
|
|
133
|
-
</>
|
|
134
|
-
);
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
export const PopoverContent = ({ children, overlayCardProps }: { children: React.ReactNode, overlayCardProps?: OverlayCardProps }) => {
|
|
138
|
-
const {
|
|
139
|
-
getFloatingProps,
|
|
140
|
-
isMounted,
|
|
141
|
-
refs,
|
|
142
|
-
floatingStyles,
|
|
143
|
-
transitionStyles,
|
|
144
|
-
} = useContext(PopoverContext);
|
|
145
|
-
|
|
146
|
-
if (!isMounted) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return (
|
|
151
|
-
<FloatingPortal>
|
|
152
|
-
<Box
|
|
153
|
-
ref={refs.setFloating}
|
|
154
|
-
style={floatingStyles}
|
|
155
|
-
{...getFloatingProps()}
|
|
156
|
-
css={{
|
|
157
|
-
zIndex: "$overlayCard",
|
|
158
|
-
}}
|
|
159
|
-
>
|
|
160
|
-
<OverlayCard {...overlayCardProps} style={transitionStyles}>{children}</OverlayCard>
|
|
161
|
-
</Box>
|
|
162
|
-
</FloatingPortal>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
import { keyframes, styled } from "../stitches.config";
|
|
3
|
-
|
|
4
|
-
const spinnerKeyframes = keyframes({
|
|
5
|
-
"0%": {
|
|
6
|
-
transform: "rotate(0)",
|
|
7
|
-
},
|
|
8
|
-
"100%": {
|
|
9
|
-
transform: "rotate(360deg)",
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const spinnerCircleKeyframes = keyframes({
|
|
14
|
-
"0%": {
|
|
15
|
-
strokeDashoffset: 600,
|
|
16
|
-
},
|
|
17
|
-
"100%": {
|
|
18
|
-
strokeDashoffset: 0,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
const Svg = styled("svg", {
|
|
23
|
-
animation: `${spinnerKeyframes} 2s linear infinite`,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
const Circle = styled("circle", {
|
|
27
|
-
animation: `${spinnerCircleKeyframes} 1.6s cubic-bezier(0.4, 0.15, 0.6, 0.85) infinite`,
|
|
28
|
-
fill: "transparent",
|
|
29
|
-
stroke: "currentColor",
|
|
30
|
-
strokeDasharray: 300,
|
|
31
|
-
strokeDashoffset: 600,
|
|
32
|
-
strokeLinecap: "round",
|
|
33
|
-
strokeMiterlimit: 10,
|
|
34
|
-
strokeWidth: 12,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const SpinnerStyled = styled("div", {
|
|
38
|
-
lineHeight: 0,
|
|
39
|
-
flexShrink: 0,
|
|
40
|
-
|
|
41
|
-
variants: {
|
|
42
|
-
size: {
|
|
43
|
-
xs: {
|
|
44
|
-
width: "1rem",
|
|
45
|
-
height: "1rem",
|
|
46
|
-
},
|
|
47
|
-
sm: {
|
|
48
|
-
width: "1.25rem",
|
|
49
|
-
height: "1.25rem",
|
|
50
|
-
},
|
|
51
|
-
md: {
|
|
52
|
-
width: "1.75rem",
|
|
53
|
-
height: "1.75rem",
|
|
54
|
-
},
|
|
55
|
-
lg: {
|
|
56
|
-
width: "2.25rem",
|
|
57
|
-
height: "2.25rem",
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
color: {
|
|
61
|
-
light: {
|
|
62
|
-
color: "$gray200",
|
|
63
|
-
},
|
|
64
|
-
dark: {
|
|
65
|
-
color: "$gray800",
|
|
66
|
-
},
|
|
67
|
-
inherit: {
|
|
68
|
-
color: "inherit",
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
defaultVariants: {
|
|
74
|
-
size: "sm",
|
|
75
|
-
color: "dark",
|
|
76
|
-
},
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
type SpinnerProps = React.ComponentProps<typeof SpinnerStyled>;
|
|
80
|
-
|
|
81
|
-
export const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(
|
|
82
|
-
(props, ref) => {
|
|
83
|
-
return (
|
|
84
|
-
<SpinnerStyled
|
|
85
|
-
ref={ref}
|
|
86
|
-
{...props}
|
|
87
|
-
>
|
|
88
|
-
<Svg
|
|
89
|
-
x="0px"
|
|
90
|
-
y="0px"
|
|
91
|
-
viewBox="0 0 150 150"
|
|
92
|
-
>
|
|
93
|
-
<Circle
|
|
94
|
-
cx="75"
|
|
95
|
-
cy="75"
|
|
96
|
-
r="60"
|
|
97
|
-
/>
|
|
98
|
-
</Svg>
|
|
99
|
-
</SpinnerStyled>
|
|
100
|
-
);
|
|
101
|
-
},
|
|
102
|
-
);
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
import { Popover, PopoverContent, PopoverTrigger } from "./Popover";
|
|
3
|
-
|
|
4
|
-
export const Tooltip = ({ children, content }: {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
content: React.ReactNode
|
|
7
|
-
}) => {
|
|
8
|
-
const [open, setOpen] = useState(false);
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
<Popover
|
|
12
|
-
open={open}
|
|
13
|
-
onOpenChange={setOpen}
|
|
14
|
-
trigger="hover"
|
|
15
|
-
placement="top"
|
|
16
|
-
offset={{ mainAxis: 8 }}
|
|
17
|
-
role="tooltip"
|
|
18
|
-
>
|
|
19
|
-
<PopoverTrigger>
|
|
20
|
-
{children}
|
|
21
|
-
</PopoverTrigger>
|
|
22
|
-
<PopoverContent overlayCardProps={{
|
|
23
|
-
css: {
|
|
24
|
-
background: "rgba(0,0,0, 0.9)",
|
|
25
|
-
color: "#fff",
|
|
26
|
-
fontSize: "$sm",
|
|
27
|
-
padding: "$1 $2"
|
|
28
|
-
}
|
|
29
|
-
}}>
|
|
30
|
-
{content}
|
|
31
|
-
</PopoverContent>
|
|
32
|
-
</Popover>
|
|
33
|
-
)
|
|
34
|
-
}
|