@olenbetong/synergi-react 0.6.7
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/esm/ob.react.css +708 -0
- package/dist/esm/ob.react.js +3077 -0
- package/dist/esm/ob.react.min.css +2 -0
- package/dist/esm/ob.react.min.css.map +7 -0
- package/dist/esm/ob.react.min.js +8 -0
- package/dist/esm/ob.react.min.js.map +7 -0
- package/dist/iife/ob.react.css +708 -0
- package/dist/iife/ob.react.js +3089 -0
- package/dist/iife/ob.react.min.css +2 -0
- package/dist/iife/ob.react.min.css.map +7 -0
- package/dist/iife/ob.react.min.js +8 -0
- package/dist/iife/ob.react.min.js.map +7 -0
- package/dist/styles/styles.css +1 -0
- package/dist/styles/styles.css.map +1 -0
- package/es/Checkbox/index.css +1 -0
- package/es/ColorCard/index.css +1 -0
- package/es/DateNavigator/index.css +1 -0
- package/es/LinkedCardList/index.css +1 -0
- package/es/PageBanner/index.css +1 -0
- package/es/ProgressBar/index.css +1 -0
- package/es/Sidebar/index.css +1 -0
- package/es/Spinner/index.css +1 -0
- package/es/SplitContainer/index.css +1 -0
- package/es/ValueToggle/index.css +1 -0
- package/es/appframe-react/src/useDebounce.d.ts +8 -0
- package/es/appframe-react/src/useDebounce.js +16 -0
- package/es/index.css +1 -0
- package/es/styles/_mixins.css +0 -0
- package/es/styles/_variables.css +0 -0
- package/es/synergi-react/src/Checkbox/index.d.ts +9 -0
- package/es/synergi-react/src/Checkbox/index.js +41 -0
- package/es/synergi-react/src/ColorCard/index.d.ts +14 -0
- package/es/synergi-react/src/ColorCard/index.js +16 -0
- package/es/synergi-react/src/DateNavigator/index.d.ts +6 -0
- package/es/synergi-react/src/DateNavigator/index.js +51 -0
- package/es/synergi-react/src/LinkedCardList/index.d.ts +9 -0
- package/es/synergi-react/src/LinkedCardList/index.js +13 -0
- package/es/synergi-react/src/PageBanner/index.d.ts +27 -0
- package/es/synergi-react/src/PageBanner/index.js +24 -0
- package/es/synergi-react/src/Portal/index.d.ts +6 -0
- package/es/synergi-react/src/Portal/index.js +32 -0
- package/es/synergi-react/src/ProgressBar/index.d.ts +4 -0
- package/es/synergi-react/src/ProgressBar/index.js +7 -0
- package/es/synergi-react/src/Sidebar/index.d.ts +10 -0
- package/es/synergi-react/src/Sidebar/index.js +57 -0
- package/es/synergi-react/src/Spinner/index.d.ts +10 -0
- package/es/synergi-react/src/Spinner/index.js +6 -0
- package/es/synergi-react/src/SplitContainer/index.d.ts +20 -0
- package/es/synergi-react/src/SplitContainer/index.js +151 -0
- package/es/synergi-react/src/ValueToggle/index.d.ts +19 -0
- package/es/synergi-react/src/ValueToggle/index.js +38 -0
- package/es/synergi-react/src/index.d.ts +15 -0
- package/es/synergi-react/src/index.js +15 -0
- package/es/synergi-react/src/useDebounce.d.ts +9 -0
- package/es/synergi-react/src/useDebounce.js +17 -0
- package/es/synergi-react/src/usePersistedSetting.d.ts +7 -0
- package/es/synergi-react/src/usePersistedSetting.js +53 -0
- package/es/synergi-react/src/useSearchParamState.d.ts +13 -0
- package/es/synergi-react/src/useSearchParamState.js +42 -0
- package/es/synergi-react/src/useTranslation/index.d.ts +7 -0
- package/es/synergi-react/src/useTranslation/index.js +64 -0
- package/package.json +90 -0
- package/src/Checkbox/index.scss +119 -0
- package/src/Checkbox/index.tsx +81 -0
- package/src/ColorCard/index.scss +154 -0
- package/src/ColorCard/index.tsx +58 -0
- package/src/DateNavigator/index.scss +60 -0
- package/src/DateNavigator/index.tsx +92 -0
- package/src/LinkedCardList/index.scss +86 -0
- package/src/LinkedCardList/index.tsx +38 -0
- package/src/PageBanner/index.scss +99 -0
- package/src/PageBanner/index.tsx +79 -0
- package/src/Portal/index.tsx +36 -0
- package/src/ProgressBar/index.scss +86 -0
- package/src/ProgressBar/index.tsx +13 -0
- package/src/Sidebar/index.scss +53 -0
- package/src/Sidebar/index.tsx +117 -0
- package/src/Spinner/index.scss +71 -0
- package/src/Spinner/index.tsx +21 -0
- package/src/SplitContainer/index.scss +43 -0
- package/src/SplitContainer/index.tsx +271 -0
- package/src/ValueToggle/index.scss +50 -0
- package/src/ValueToggle/index.tsx +75 -0
- package/src/global.d.ts +2 -0
- package/src/index.scss +9 -0
- package/src/index.ts +27 -0
- package/src/styles/_mixins.scss +19 -0
- package/src/styles/_variables.scss +70 -0
- package/src/useDebounce.ts +21 -0
- package/src/usePersistedSetting.ts +78 -0
- package/src/useSearchParamState.ts +78 -0
- package/src/useTranslation/index.ts +74 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { HTMLAttributes, forwardRef, useEffect, useId, useRef } from "react";
|
|
5
|
+
|
|
6
|
+
function Mark(props: HTMLAttributes<SVGElement>) {
|
|
7
|
+
return (
|
|
8
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" {...props}>
|
|
9
|
+
<path d="M20.285 2L9 13.567 3.714 8.556 0 12.272 9 21 24 5.715z" fill="currentColor" />
|
|
10
|
+
</svg>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type CheckboxProps = React.RefAttributes<HTMLInputElement> &
|
|
15
|
+
Omit<React.HTMLProps<HTMLInputElement>, "value"> & {
|
|
16
|
+
className?: string;
|
|
17
|
+
id?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
value?: boolean;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>(function Checkbox(
|
|
23
|
+
{ className, disabled = false, id, onChange = () => null, title, value, ...other }: CheckboxProps,
|
|
24
|
+
ref: React.ForwardedRef<HTMLInputElement>
|
|
25
|
+
) {
|
|
26
|
+
const inputId = useId() + (id ?? "");
|
|
27
|
+
const input = useRef<HTMLInputElement>(null);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (typeof ref === "function") {
|
|
31
|
+
ref(input.current);
|
|
32
|
+
} else if (ref) {
|
|
33
|
+
ref.current = input.current;
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
37
|
+
function handleClick() {
|
|
38
|
+
let elem = input.current;
|
|
39
|
+
if (elem) {
|
|
40
|
+
elem.focus();
|
|
41
|
+
elem.click();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function handleInputChanged(evt: any) {
|
|
46
|
+
if (!disabled) {
|
|
47
|
+
onChange(evt);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function handleKeyDown(evt: any) {
|
|
52
|
+
if (evt.nativeEvent) {
|
|
53
|
+
const { nativeEvent } = evt;
|
|
54
|
+
|
|
55
|
+
if (nativeEvent.key === " ") {
|
|
56
|
+
nativeEvent.preventDefault();
|
|
57
|
+
input.current?.click();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<div className={clsx("ObCheckbox-root", disabled && "Ob-disabled", className)} title={title}>
|
|
64
|
+
<input
|
|
65
|
+
className="ObCheckbox-input"
|
|
66
|
+
id={inputId}
|
|
67
|
+
type="checkbox"
|
|
68
|
+
onChange={handleInputChanged}
|
|
69
|
+
checked={value}
|
|
70
|
+
disabled={disabled}
|
|
71
|
+
ref={input}
|
|
72
|
+
{...other}
|
|
73
|
+
/>
|
|
74
|
+
<label htmlFor={`#${inputId}`} className="ObCheckbox-label" onKeyDown={handleKeyDown} onClick={handleClick}>
|
|
75
|
+
<div className="ObCheckbox-box">
|
|
76
|
+
<Mark className="ObCheckbox-mark" />
|
|
77
|
+
</div>
|
|
78
|
+
</label>
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
});
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
@import "../styles/variables";
|
|
2
|
+
|
|
3
|
+
.ObColorCard-root {
|
|
4
|
+
--bg-color-border: black;
|
|
5
|
+
--bg-color-main: white;
|
|
6
|
+
--bg-size: 0.75rem;
|
|
7
|
+
--card-color: rgb(0, 0, 0);
|
|
8
|
+
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
background-image: linear-gradient(to right, $brand-primary, $brand-primary 0.75rem, white 0.75rem, white);
|
|
11
|
+
background-image: linear-gradient(
|
|
12
|
+
to right,
|
|
13
|
+
var(--bg-color-border),
|
|
14
|
+
var(--bg-color-border) var(--bg-size),
|
|
15
|
+
var(--bg-color-main) var(--bg-size),
|
|
16
|
+
var(--bg-color-main)
|
|
17
|
+
);
|
|
18
|
+
border-radius: 0.25rem;
|
|
19
|
+
box-shadow: 0 1px 12px rgba(0, 0, 0, 0.15), 0 1px 6px rgba(0, 0, 0, 0.25);
|
|
20
|
+
color: #666;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
display: flex;
|
|
23
|
+
font-family: "Variable Bahnschrift", "Bahnschrift", "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
|
24
|
+
"Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
|
25
|
+
font-size: 1rem;
|
|
26
|
+
min-height: 10rem;
|
|
27
|
+
overflow: hidden;
|
|
28
|
+
transition: all ease-in-out 300ms;
|
|
29
|
+
|
|
30
|
+
&:nth-of-type(5n + 1) {
|
|
31
|
+
--bg-color-border: rgb(178, 108, 190);
|
|
32
|
+
}
|
|
33
|
+
&:nth-of-type(5n + 2) {
|
|
34
|
+
--bg-color-border: rgb(79, 164, 61);
|
|
35
|
+
}
|
|
36
|
+
&:nth-of-type(5n + 3) {
|
|
37
|
+
--bg-color-border: rgb(246, 170, 23);
|
|
38
|
+
}
|
|
39
|
+
&:nth-of-type(5n + 4) {
|
|
40
|
+
--bg-color-border: rgb(218, 93, 83);
|
|
41
|
+
}
|
|
42
|
+
&:nth-of-type(5n + 5) {
|
|
43
|
+
--bg-color-border: rgb(23, 162, 184);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:hover,
|
|
47
|
+
&:focus {
|
|
48
|
+
/*--bg-size: 1rem;*/
|
|
49
|
+
--bg-color-main: #f5f5f5;
|
|
50
|
+
|
|
51
|
+
box-shadow: 0 3px 18px rgba(0, 0, 0, 0.15), 0 3px 12px rgba(0, 0, 0, 0.25);
|
|
52
|
+
color: #666;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
/*transform: scale(1.03) translateY(-3px);*/
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media screen and (min-width: 48rem) {
|
|
58
|
+
font-size: 1.2rem;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.ObColorCard-column {
|
|
63
|
+
display: flex;
|
|
64
|
+
flex: 1 1 100%;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
justify-content: space-between;
|
|
67
|
+
margin: 1rem 0;
|
|
68
|
+
overflow: hidden;
|
|
69
|
+
padding: 0.5rem 1.5rem 0.5rem 1rem;
|
|
70
|
+
text-overflow: ellipsis;
|
|
71
|
+
|
|
72
|
+
&:first-child {
|
|
73
|
+
margin-left: 0.75rem;
|
|
74
|
+
margin-left: var(--bg-size);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.ObColorCard-minor {
|
|
78
|
+
border-right: 1px solid #e3e3e3;
|
|
79
|
+
flex: 0 0 4rem;
|
|
80
|
+
transition: margin ease-in-out 300ms;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media screen and (min-width: 48rem) {
|
|
84
|
+
&.ObColorCard-minor {
|
|
85
|
+
flex: 0 0 8rem;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.ObColorCard-detailLabel {
|
|
91
|
+
color: #ccc;
|
|
92
|
+
font-size: 0.8rem;
|
|
93
|
+
text-transform: uppercase;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.ObColorCard-detail {
|
|
97
|
+
&:not(:last-child) {
|
|
98
|
+
margin-right: 1.5rem;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&.ObColorCard-primary,
|
|
102
|
+
&.ObColorCard-primary .ObColorCard-detailValue {
|
|
103
|
+
font-size: 1.25rem;
|
|
104
|
+
font-weight: 300;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
&.ObColorCard-primary .ObColorCard-detailValue {
|
|
108
|
+
color: unset;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@media screen and (min-width: 48rem) {
|
|
112
|
+
font-size: 1rem;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.ObColorCard-detailValue {
|
|
117
|
+
color: #999;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.ObColorCard-label {
|
|
121
|
+
position: relative;
|
|
122
|
+
padding-left: 1.5rem;
|
|
123
|
+
/* white-space: nowrap; */
|
|
124
|
+
|
|
125
|
+
&:not(:last-child) {
|
|
126
|
+
margin-bottom: 1rem;
|
|
127
|
+
|
|
128
|
+
&::after {
|
|
129
|
+
content: "";
|
|
130
|
+
position: absolute;
|
|
131
|
+
width: 0.2rem;
|
|
132
|
+
height: calc(100% + 1rem);
|
|
133
|
+
border-left: 0.2rem dotted #666;
|
|
134
|
+
left: 0.25rem;
|
|
135
|
+
top: 0.5rem;
|
|
136
|
+
z-index: 0;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
&::before {
|
|
141
|
+
background: white;
|
|
142
|
+
border: 0.2rem solid $brand-primary;
|
|
143
|
+
border: 0.2rem solid var(--bg-color-border);
|
|
144
|
+
border-radius: 50%;
|
|
145
|
+
content: "";
|
|
146
|
+
display: block;
|
|
147
|
+
height: 0.75rem;
|
|
148
|
+
left: 0;
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 0.3rem;
|
|
151
|
+
width: 0.75rem;
|
|
152
|
+
z-index: 1;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
|
|
5
|
+
export function ColorCard({
|
|
6
|
+
as: Component,
|
|
7
|
+
children,
|
|
8
|
+
className,
|
|
9
|
+
href,
|
|
10
|
+
...other
|
|
11
|
+
}: Pick<React.HTMLAttributes<HTMLDivElement>, "id" | "className" | "children"> & {
|
|
12
|
+
as?: "a" | "div" | "button" | "span" | "section" | "article";
|
|
13
|
+
href?: string;
|
|
14
|
+
}) {
|
|
15
|
+
const BaseElement = Component ? Component : href ? "a" : "div";
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<BaseElement className={clsx("ObColorCard-root", className)} href={href} {...other}>
|
|
19
|
+
{children}
|
|
20
|
+
</BaseElement>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function CardColumn({
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
minor,
|
|
28
|
+
...other
|
|
29
|
+
}: React.HTMLAttributes<HTMLDivElement> & { minor?: boolean }) {
|
|
30
|
+
return (
|
|
31
|
+
<div className={clsx("ObColorCard-column", minor && "ObColorCard-minor", className)} {...other}>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function CardDetail({
|
|
38
|
+
children,
|
|
39
|
+
className,
|
|
40
|
+
label,
|
|
41
|
+
primary,
|
|
42
|
+
...other
|
|
43
|
+
}: React.HTMLAttributes<HTMLDivElement> & { label?: React.ReactNode; primary?: boolean }) {
|
|
44
|
+
return (
|
|
45
|
+
<div className={clsx("ObColorCard-detail", primary && "ObColorCard-primary", className)} {...other}>
|
|
46
|
+
{label && <div className="ObColorCard-detailLabel">{label}</div>}
|
|
47
|
+
<div className="ObColorCard-detailValue">{children}</div>
|
|
48
|
+
</div>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function CardLabel({ children, className, ...other }: React.HTMLAttributes<HTMLDivElement>) {
|
|
53
|
+
return (
|
|
54
|
+
<div className={clsx("ObColorCard-label", className)} {...other}>
|
|
55
|
+
{children}
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
@import "../styles/mixins";
|
|
2
|
+
|
|
3
|
+
$date-select-height: 3rem;
|
|
4
|
+
|
|
5
|
+
.ObDateNavigator-icon {
|
|
6
|
+
display: inline-block;
|
|
7
|
+
|
|
8
|
+
svg {
|
|
9
|
+
width: 0.625em;
|
|
10
|
+
position: relative;
|
|
11
|
+
top: -1px;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.ObDateNavigator-root {
|
|
16
|
+
background-color: hsl(220, 20%, 96%);
|
|
17
|
+
background-color: var(--block-header-color-bg);
|
|
18
|
+
display: flex;
|
|
19
|
+
font-size: 1rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.ObDateNavigator-arrow {
|
|
23
|
+
@include btn-reset;
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
flex: 0 0 $date-select-height;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
|
|
29
|
+
height: $date-select-height;
|
|
30
|
+
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
text-align: center;
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
background-color: #e3e3e3;
|
|
36
|
+
background-color: var(--block-header-button-hover);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.ObDateNavigator-arrowLeft {
|
|
41
|
+
border-right: 1px solid #dddddd;
|
|
42
|
+
order: 1;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ObDateNavigator-arrowRight {
|
|
46
|
+
border-left: 1px solid #dddddd;
|
|
47
|
+
order: 3;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.ObDateNavigator-date {
|
|
51
|
+
display: flex;
|
|
52
|
+
flex: 1 1 100%;
|
|
53
|
+
flex-direction: column;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
order: 2;
|
|
56
|
+
|
|
57
|
+
height: $date-select-height;
|
|
58
|
+
|
|
59
|
+
text-align: center;
|
|
60
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
|
|
6
|
+
import { getLocalizedString } from "@olenbetong/appframe-core";
|
|
7
|
+
|
|
8
|
+
function getUiCulture() {
|
|
9
|
+
return af?.userSession?.culture ?? "default";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function Arrow(props) {
|
|
13
|
+
const { direction, ...rest } = props;
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<button
|
|
17
|
+
className={clsx(
|
|
18
|
+
"ObDateNavigator-arrow",
|
|
19
|
+
direction === "left" ? "ObDateNavigator-arrowLeft" : "ObDateNavigator-arrowRight"
|
|
20
|
+
)}
|
|
21
|
+
{...rest}
|
|
22
|
+
>
|
|
23
|
+
<span className="ObDateNavigator-icon">
|
|
24
|
+
{direction === "left" ? (
|
|
25
|
+
<svg aria-hidden="true" focusable="false" role="img" viewBox="0 0 320 512">
|
|
26
|
+
<path
|
|
27
|
+
fill="currentColor"
|
|
28
|
+
d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
) : (
|
|
32
|
+
<svg aria-hidden="true" focusable="false" role="img" viewBox="0 0 320 512">
|
|
33
|
+
<path
|
|
34
|
+
fill="currentColor"
|
|
35
|
+
d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"
|
|
36
|
+
/>
|
|
37
|
+
</svg>
|
|
38
|
+
)}
|
|
39
|
+
</span>
|
|
40
|
+
</button>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const formatter = new Intl.DateTimeFormat(getUiCulture(), {
|
|
45
|
+
weekday: "short",
|
|
46
|
+
day: "numeric",
|
|
47
|
+
month: "short",
|
|
48
|
+
year: "numeric",
|
|
49
|
+
timeZone: "utc"
|
|
50
|
+
});
|
|
51
|
+
const today = new Date();
|
|
52
|
+
const todayUtc = Date.UTC(today.getFullYear(), today.getMonth(), today.getDate());
|
|
53
|
+
|
|
54
|
+
const oneDay = 24 * 60 * 60 * 1000;
|
|
55
|
+
|
|
56
|
+
export function DateNavigator({ date: dateProp, onChange }: { date?: Date; onChange?: (date: Date) => void }) {
|
|
57
|
+
let [internalDate, setInternalDate] = useState(new Date());
|
|
58
|
+
const date = dateProp ?? internalDate;
|
|
59
|
+
const dateUtc = Date.UTC(date.getFullYear(), date.getMonth(), date.getDate());
|
|
60
|
+
let dateValue = new Date(dateUtc);
|
|
61
|
+
|
|
62
|
+
let text = formatter.format(dateValue);
|
|
63
|
+
let altText;
|
|
64
|
+
|
|
65
|
+
if (todayUtc === dateUtc) {
|
|
66
|
+
altText = getLocalizedString("Today");
|
|
67
|
+
} else if (todayUtc === dateUtc + oneDay) {
|
|
68
|
+
altText = getLocalizedString("Yesterday");
|
|
69
|
+
} else if (todayUtc === dateUtc - oneDay) {
|
|
70
|
+
altText = getLocalizedString("Tomorrow");
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (altText) {
|
|
74
|
+
text = `${altText}, ${text}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function handleDateChanged(date: Date) {
|
|
78
|
+
if (typeof onChange === "function") {
|
|
79
|
+
onChange(date);
|
|
80
|
+
} else {
|
|
81
|
+
setInternalDate(date);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<div className="ObDateNavigator-root">
|
|
87
|
+
<Arrow direction="left" onClick={() => handleDateChanged(new Date(dateUtc - oneDay))} />
|
|
88
|
+
<div className="ObDateNavigator-date">{text}</div>
|
|
89
|
+
<Arrow direction="right" onClick={() => handleDateChanged(new Date(dateUtc + oneDay))} />
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
@import "../styles/variables";
|
|
2
|
+
|
|
3
|
+
$bullet-size: 0.7em;
|
|
4
|
+
$line-width: 0.2em;
|
|
5
|
+
|
|
6
|
+
.ObLinkedList-root {
|
|
7
|
+
list-style-type: none;
|
|
8
|
+
margin-left: 0;
|
|
9
|
+
padding-left: 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.ObLinkedList-item {
|
|
13
|
+
display: flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
flex-direction: row;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ObLinkedList-leftColumn {
|
|
19
|
+
flex: 1 1 4em;
|
|
20
|
+
font-size: 0.75em;
|
|
21
|
+
padding: 0 1em;
|
|
22
|
+
text-align: center;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ObLinkedList-rightColumn {
|
|
26
|
+
flex: 1 1 100%;
|
|
27
|
+
padding: 1em 1em 1em 1.5em;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ObLinkedList-line {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-self: stretch;
|
|
33
|
+
flex: 0 0 $line-width;
|
|
34
|
+
background: white;
|
|
35
|
+
position: relative;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.ObLinkedList-bullet {
|
|
39
|
+
background: white;
|
|
40
|
+
|
|
41
|
+
border: 1px solid rgba(50, 50, 50, 0.25);
|
|
42
|
+
border-radius: 0.55em;
|
|
43
|
+
height: $bullet-size;
|
|
44
|
+
width: $bullet-size;
|
|
45
|
+
|
|
46
|
+
position: absolute;
|
|
47
|
+
left: 0;
|
|
48
|
+
top: 50%;
|
|
49
|
+
|
|
50
|
+
transform: translate(calc(-1 * ($bullet-size / 2) + ($line-width / 2)), -50%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ObLinkedList-card {
|
|
54
|
+
background: white;
|
|
55
|
+
border: 1px solid;
|
|
56
|
+
border-color: $color-border-top $color-border-side $color-border-bottom;
|
|
57
|
+
border-radius: 0.1875em;
|
|
58
|
+
color: inherit;
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
flex: 100% 1 1;
|
|
61
|
+
position: relative;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.ObLinkedList-card::before {
|
|
65
|
+
border-bottom: 0.5em solid transparent;
|
|
66
|
+
border-right: 1em solid white;
|
|
67
|
+
border-top: 0.5em solid transparent;
|
|
68
|
+
content: " ";
|
|
69
|
+
filter: drop-shadow(-1px 0px 1px rgba(50, 50, 50, 0.2));
|
|
70
|
+
height: 1em;
|
|
71
|
+
left: -1em;
|
|
72
|
+
margin-top: -0.5em;
|
|
73
|
+
position: absolute;
|
|
74
|
+
top: 50%;
|
|
75
|
+
width: 1em;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ObLinkedList-card:hover {
|
|
79
|
+
background-color: $block-color-bg-hover !important;
|
|
80
|
+
color: inherit;
|
|
81
|
+
text-decoration: inherit;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ObLinkedList-card:hover::before {
|
|
85
|
+
border-right-color: $block-color-bg-hover !important;
|
|
86
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import "./index.scss";
|
|
2
|
+
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
|
|
5
|
+
export function List({ children, className, ...other }: React.HTMLProps<HTMLUListElement>) {
|
|
6
|
+
return (
|
|
7
|
+
<ul className={clsx("ObLinkedList-root", className)} {...other}>
|
|
8
|
+
{children}
|
|
9
|
+
</ul>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function ListItem({
|
|
14
|
+
children,
|
|
15
|
+
className,
|
|
16
|
+
label,
|
|
17
|
+
...other
|
|
18
|
+
}: React.HTMLProps<HTMLLIElement> & { label: React.ReactNode }) {
|
|
19
|
+
return (
|
|
20
|
+
<li className={clsx("ObLinkedList-item", className)} {...other}>
|
|
21
|
+
{label && <div className="ObLinkedList-leftColumn">{label}</div>}
|
|
22
|
+
<div className="ObLinkedList-line">
|
|
23
|
+
<div className="ObLinkedList-bullet" />
|
|
24
|
+
</div>
|
|
25
|
+
<div className="ObLinkedList-rightColumn">{children}</div>
|
|
26
|
+
</li>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function Card({ as, children, className, ...other }: React.HTMLProps<HTMLDivElement> & { as?: any }) {
|
|
31
|
+
const Component = as || "div";
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Component className={clsx("ObLinkedList-card", className)} {...other}>
|
|
35
|
+
{children}
|
|
36
|
+
</Component>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
@import "../styles/variables";
|
|
2
|
+
|
|
3
|
+
.ObPageBanner-root {
|
|
4
|
+
background-color: $brand-primary;
|
|
5
|
+
background-color: var(--brand-dark);
|
|
6
|
+
box-shadow: 0px 8px 8px rgba(0, 0, 0, 0.2);
|
|
7
|
+
color: white;
|
|
8
|
+
|
|
9
|
+
a {
|
|
10
|
+
color: hsl(200, 50%, 80%);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.ObPageBanner-inner {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
|
|
19
|
+
@media screen and (min-width: $screen-md) {
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ObPageBanner-plantTitle {
|
|
26
|
+
font-size: 2rem;
|
|
27
|
+
|
|
28
|
+
@media screen and (min-width: $screen-lg) {
|
|
29
|
+
font-size: 3rem;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ObPageBanner-bannerImage {
|
|
34
|
+
align-self: stretch;
|
|
35
|
+
background-color: #ddd;
|
|
36
|
+
display: inline-block;
|
|
37
|
+
height: 20vh;
|
|
38
|
+
object-fit: cover;
|
|
39
|
+
object-position: center center;
|
|
40
|
+
width: 100%;
|
|
41
|
+
|
|
42
|
+
@media screen and (min-width: $screen-sm) {
|
|
43
|
+
align-self: center;
|
|
44
|
+
margin: 0;
|
|
45
|
+
margin-right: 1rem;
|
|
46
|
+
border: 0.4rem solid white;
|
|
47
|
+
border-radius: 50%;
|
|
48
|
+
height: 150px;
|
|
49
|
+
width: 150px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media screen and (min-width: $screen-lg) {
|
|
53
|
+
height: 250px;
|
|
54
|
+
width: 250px;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.ObPageBanner-bannerTitle {
|
|
59
|
+
margin-bottom: 1rem;
|
|
60
|
+
margin-top: 1rem;
|
|
61
|
+
font-size: 2rem;
|
|
62
|
+
|
|
63
|
+
@media screen and (min-width: $screen-md) {
|
|
64
|
+
margin-top: 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media screen and (min-width: $screen-lg) {
|
|
68
|
+
font-size: 3rem;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ObPageBanner-tabList {
|
|
73
|
+
&.sticky {
|
|
74
|
+
position: -webkit-sticky;
|
|
75
|
+
position: sticky;
|
|
76
|
+
top: 0;
|
|
77
|
+
z-index: 1000;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ObPageBanner-tabListInner {
|
|
82
|
+
overflow-x: auto;
|
|
83
|
+
scrollbar-width: thin;
|
|
84
|
+
white-space: nowrap;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.ObPageBanner-tab {
|
|
88
|
+
border-bottom: 0.25rem solid transparent;
|
|
89
|
+
display: inline-block;
|
|
90
|
+
margin-top: 0.5rem;
|
|
91
|
+
min-width: 8rem;
|
|
92
|
+
padding: 0.5rem 1rem;
|
|
93
|
+
text-align: center;
|
|
94
|
+
text-transform: capitalize;
|
|
95
|
+
|
|
96
|
+
&.active {
|
|
97
|
+
border-color: white;
|
|
98
|
+
}
|
|
99
|
+
}
|