@scality/core-ui 0.118.0 → 0.119.0
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/buttonv2/Buttonv2.component.js +2 -2
- package/dist/components/card/Card.component.d.ts +1 -1
- package/dist/components/card/Card.component.d.ts.map +1 -1
- package/dist/components/card/Card.component.js +7 -13
- package/dist/components/checkbox/Checkbox.component.js +2 -2
- package/dist/components/dropdown/Dropdown.component.d.ts.map +1 -1
- package/dist/components/dropdown/Dropdown.component.js +0 -1
- package/dist/components/inputv2/inputv2.d.ts +1 -2
- package/dist/components/inputv2/inputv2.d.ts.map +1 -1
- package/dist/components/inputv2/inputv2.js +5 -3
- package/dist/components/searchinput/SearchInput.component.d.ts +3 -0
- package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -1
- package/dist/components/searchinput/SearchInput.component.js +33 -52
- package/dist/components/sidebar/Sidebar.component.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.component.js +8 -7
- package/dist/components/tablev2/Search.d.ts +1 -1
- package/dist/components/tablev2/Search.d.ts.map +1 -1
- package/dist/components/tablev2/Search.js +1 -1
- package/dist/components/tablev2/SearchWithQueryParams.d.ts +2 -2
- package/dist/components/tablev2/SearchWithQueryParams.d.ts.map +1 -1
- package/dist/components/tablev2/SearchWithQueryParams.js +1 -1
- package/dist/components/tablev2/Tablestyle.js +2 -2
- package/dist/components/vegachartv2/VegaChartV2.component.d.ts.map +1 -1
- package/dist/components/vegachartv2/VegaChartV2.component.js +44 -42
- package/dist/icons/branding-logo.d.ts +4 -0
- package/dist/icons/branding-logo.d.ts.map +1 -0
- package/dist/icons/branding-logo.js +3 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/style/theme.js +15 -15
- package/package.json +15 -15
- package/src/lib/components/buttonv2/Buttonv2.component.tsx +2 -2
- package/src/lib/components/card/Card.component.tsx +10 -19
- package/src/lib/components/checkbox/Checkbox.component.tsx +14 -2
- package/src/lib/components/dropdown/Dropdown.component.tsx +0 -1
- package/src/lib/components/inputv2/inputv2.tsx +19 -24
- package/src/lib/components/searchinput/SearchInput.component.tsx +54 -62
- package/src/lib/components/sidebar/Sidebar.component.tsx +8 -9
- package/src/lib/components/tablev2/Search.tsx +2 -1
- package/src/lib/components/tablev2/SearchWithQueryParams.tsx +4 -3
- package/src/lib/components/tablev2/Tablestyle.tsx +2 -2
- package/src/lib/components/vegachartv2/VegaChartV2.component.tsx +47 -50
- package/src/lib/icons/branding-logo.tsx +47 -0
- package/src/lib/index.ts +0 -1
- package/src/lib/style/theme.ts +15 -15
- package/stories/card.stories.tsx +4 -11
- package/stories/color.mdx +3 -3
- package/stories/layout.stories.tsx +11 -60
- package/stories/navbar.stories.tsx +4 -2
- package/stories/searchinput.stories.tsx +21 -1
- package/stories/spacing.stories.tsx +8 -8
- package/stories/steppers.stories.tsx +14 -15
- package/stories/tablev2.stories.tsx +23 -10
- package/stories/tabsv2.stories.tsx +0 -2
- package/dist/components/input/Input.component.d.ts +0 -24
- package/dist/components/input/Input.component.d.ts.map +0 -1
- package/dist/components/input/Input.component.js +0 -55
- package/dist/components/input/Input.component.style.d.ts +0 -9
- package/dist/components/input/Input.component.style.d.ts.map +0 -1
- package/dist/components/input/Input.component.style.js +0 -136
- package/src/lib/components/input/Input.component.style.ts +0 -141
- package/src/lib/components/input/Input.component.tsx +0 -174
|
@@ -37,7 +37,7 @@ export const ButtonStyled = styled.button `
|
|
|
37
37
|
return css `
|
|
38
38
|
background-color: ${brand.buttonPrimary};
|
|
39
39
|
border: ${spacing.r1} solid ${brand.buttonPrimary};
|
|
40
|
-
color: ${brand.
|
|
40
|
+
color: ${brand.textPrimary};
|
|
41
41
|
&:hover:enabled {
|
|
42
42
|
cursor: pointer;
|
|
43
43
|
border: ${spacing.r1} solid ${brand.infoPrimary};
|
|
@@ -58,7 +58,7 @@ export const ButtonStyled = styled.button `
|
|
|
58
58
|
return css `
|
|
59
59
|
background-color: ${brand.buttonSecondary};
|
|
60
60
|
border: ${spacing.r1} solid ${brand.buttonSecondary};
|
|
61
|
-
color: ${brand.
|
|
61
|
+
color: ${brand.textPrimary};
|
|
62
62
|
&:hover:enabled {
|
|
63
63
|
cursor: pointer;
|
|
64
64
|
border: ${spacing.r1} solid ${brand.infoPrimary};
|
|
@@ -15,7 +15,7 @@ type CardProps = {
|
|
|
15
15
|
onClick?: () => void;
|
|
16
16
|
active?: boolean;
|
|
17
17
|
disabled?: boolean;
|
|
18
|
-
children:
|
|
18
|
+
children: React.ReactNode;
|
|
19
19
|
className?: string;
|
|
20
20
|
} & HTMLProps<HTMLDivElement>;
|
|
21
21
|
declare function Card({ width, height, headerBackgroundColor, bodyBackgroundColor, status, onClick, active, disabled, children, className, ...rest }: CardProps): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/card/Card.component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Card.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/card/Card.component.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKlC,KAAK,gBAAgB,GAAG;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAmDF,eAAO,MAAM,UAAU,qCAhDqB,gBAAgB,gBAgDC,CAAC;AAC9D,eAAO,MAAM,QAAQ,qCAjDuB,gBAAgB,gBAiDH,CAAC;AAC1D,eAAO,MAAM,iBAAiB,qCAlDc,gBAAgB,gBAkDe,CAAC;AAmD5E,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,UAAU,CAAC;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC;AAC9B,iBAAS,IAAI,CAAC,EACZ,KAAc,EACd,MAAe,EACf,qBAAyC,EACzC,mBAAwC,EACxC,MAAa,EACb,OAAc,EACd,MAAc,EACd,QAAgB,EAChB,QAAQ,EACR,SAAS,EACT,GAAG,IAAI,EACR,EAAE,SAAS,eA6CX;kBAzDQ,IAAI;;;;;AA6Db,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { hex2RGB } from '../../utils';
|
|
5
4
|
import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
|
|
6
5
|
const CardContext = createContext(null);
|
|
7
6
|
function withCompoundCheck(Component) {
|
|
@@ -18,7 +17,8 @@ function withCompoundCheck(Component) {
|
|
|
18
17
|
}
|
|
19
18
|
const StyledCardHeader = styled.div `
|
|
20
19
|
padding: 0.7rem;
|
|
21
|
-
border-radius: 3px;
|
|
20
|
+
border-top-left-radius: 3px;
|
|
21
|
+
border-top-right-radius: 3px;
|
|
22
22
|
font-weight: bold;
|
|
23
23
|
`;
|
|
24
24
|
StyledCardHeader.displayName = 'CardHeader';
|
|
@@ -43,22 +43,16 @@ const StyledCard = styled.div `
|
|
|
43
43
|
flex-flow: column;
|
|
44
44
|
width: ${(props) => props.width};
|
|
45
45
|
height: ${(props) => props.height};
|
|
46
|
-
background: ${(props) => props.theme[props.bodyBackgroundColor
|
|
47
|
-
|
|
46
|
+
background: ${(props) => props.theme[props.bodyBackgroundColor]};
|
|
47
|
+
filter: drop-shadow(0px 2px 4px rgba(0, 0, 0, 0.2));
|
|
48
48
|
${StyledCardBody} {
|
|
49
49
|
opacity: ${(props) => (props.disabled ? '0.2' : '1')};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
${StyledCardHeader} {
|
|
53
|
-
border-radius: 2px;
|
|
54
53
|
color: ${(props) => props.theme.textPrimary};
|
|
55
|
-
${(props) =>
|
|
56
|
-
|
|
57
|
-
let opacity = 1;
|
|
58
|
-
if (props.colorStatus && props.colorStatus !== 'backgroundLevel4')
|
|
59
|
-
opacity = 0.4;
|
|
60
|
-
return `background: rgba(${hexColor}, ${opacity});`;
|
|
61
|
-
}}
|
|
54
|
+
background: ${(props) => props.theme[props.colorStatus || props.headerBackgroundColor]};
|
|
55
|
+
opacity: ${(props) => props.colorStatus && props.colorStatus !== 'backgroundLevel4' ? 0.4 : 1};
|
|
62
56
|
${(props) => props.disabled && 'opacity: 0.3;'}
|
|
63
57
|
}
|
|
64
58
|
|
|
@@ -81,7 +75,7 @@ const StyledCard = styled.div `
|
|
|
81
75
|
${(props) => props.theme[props.activeBorderColor || 'selectedActive']};
|
|
82
76
|
}
|
|
83
77
|
`;
|
|
84
|
-
function Card({ width = 'auto', height = 'auto', headerBackgroundColor = '
|
|
78
|
+
function Card({ width = 'auto', height = 'auto', headerBackgroundColor = 'buttonSecondary', bodyBackgroundColor = 'backgroundLevel3', status = null, onClick = null, active = false, disabled = false, children, className, ...rest }) {
|
|
85
79
|
let colorStatus = null;
|
|
86
80
|
if (status) {
|
|
87
81
|
colorStatus =
|
|
@@ -52,7 +52,7 @@ const StyledCheckbox = styled.label `
|
|
|
52
52
|
|
|
53
53
|
[type='checkbox']:checked::before {
|
|
54
54
|
box-shadow: none;
|
|
55
|
-
background-image: url('data:image/svg+xml,%3Csvg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath d="M3 6.68646L5.0671 9L9 3" stroke="%
|
|
55
|
+
background-image: url('data:image/svg+xml,%3Csvg width="13" height="13" viewBox="0 0 13 13" fill="none" xmlns="http://www.w3.org/2000/svg"%3E %3Cpath d="M3 6.68646L5.0671 9L9 3" stroke="${(props) => props.theme.textPrimary.replace('#', '%23')}" stroke-width="1.5"/%3E %3C/svg%3E');
|
|
56
56
|
background-repeat: no-repeat;
|
|
57
57
|
background-position: center;
|
|
58
58
|
}
|
|
@@ -63,7 +63,7 @@ const StyledCheckbox = styled.label `
|
|
|
63
63
|
box-shadow: inset 0 0 0 ${spacing.r1}
|
|
64
64
|
${(props) => props.theme.selectedActive};
|
|
65
65
|
background-color: ${(props) => props.theme.highlight};
|
|
66
|
-
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cline x1='6' y1='12' x2='20' y2='12' style='stroke
|
|
66
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E %3Cline x1='6' y1='12' x2='20' y2='12' style='stroke:${(props) => props.theme.textPrimary.replace('#', '%23')};stroke-width:4'/%3E %3C/svg%3E");
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/* Hover & focus */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown/Dropdown.component.tsx"],"names":[],"mappings":";AAgBA,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC9B,CAAC;AACF,KAAK,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;
|
|
1
|
+
{"version":3,"file":"Dropdown.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/dropdown/Dropdown.component.tsx"],"names":[],"mappings":";AAgBA,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CAC9B,CAAC;AACF,KAAK,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,KAAK,KAAK,GAAG;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AA4DF,iBAAS,QAAQ,CAAC,EAChB,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,IAAa,EACb,OAA2B,EAC3B,KAAK,EACL,KAAY,EACZ,GAAG,IAAI,EACR,EAAE,KAAK,eAgEP;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -38,7 +38,6 @@ const DropdownMenuItemStyled = styled.li `
|
|
|
38
38
|
cursor: pointer;
|
|
39
39
|
font-size: ${fontSize.base};
|
|
40
40
|
${(props) => {
|
|
41
|
-
console.log(props.isSelected);
|
|
42
41
|
return props.isSelected
|
|
43
42
|
? `background-color: ${props.theme.highlight};`
|
|
44
43
|
: `background-color: ${props.theme.backgroundLevel1};`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { IconName } from '../icon/Icon.component';
|
|
3
3
|
export declare const convertSizeToRem: (size?: '1' | '2/3' | '1/2' | '1/3') => "14rem" | "6rem" | "10rem" | "20.5rem";
|
|
4
|
-
type InputSize = '1' | '2/3' | '1/2' | '1/3';
|
|
4
|
+
export type InputSize = '1' | '2/3' | '1/2' | '1/3';
|
|
5
5
|
export type InputProps = {
|
|
6
6
|
error?: string;
|
|
7
7
|
id: string;
|
|
@@ -16,5 +16,4 @@ export declare const Input: import("react").ForwardRefExoticComponent<{
|
|
|
16
16
|
rightIcon?: "Account" | "Backend" | "Tape" | "Node-backend" | "Volume-backend" | "Node-pdf" | "Volume-pdf" | "Network" | "Bucket" | "Cloud-backend" | "Datacenter" | "Simple-user" | "User" | "Group" | "Alert" | "Bell" | "Lat-menu" | "Dashboard" | "Workflow" | "Expiration" | "Replication" | "Transition" | "Discovery" | "Metrics" | "Edit" | "Logs" | "Lock" | "Lock-open" | "Create-add" | "Delete" | "Save" | "External-link" | "Link" | "Unlink" | "Close" | "Dropdown-down" | "Dropdown-up" | "Search" | "More" | "Info" | "Sync" | "Export" | "Copy" | "Simple-upload" | "Upload" | "Add-plus" | "Minus" | "Remove-minus" | "Sort" | "Sort-up" | "Sort-down" | "Calendar" | "Calendar-minus" | "Arrow-up" | "Arrow-down" | "Arrow-right" | "Arrow-left" | "Arrow-alt-circle-up" | "Folder" | "File" | "File-invoice" | "Deletion-marker" | "Map-marker" | "Location" | "Info-circle" | "Exclamation-triangle" | "Exclamation-circle" | "Exclamation" | "Check" | "Protected" | "Chevron-left" | "Chevron-right" | "Chevron-down" | "Chevron-up" | "Angle-right" | "Angle-double-right" | "Language" | "Theme" | "Documentation" | "Support" | "EULA" | "Log-out" | "Hourglass" | "Pause" | "Pause-circle" | "Play-circle" | "Upgrade" | "Expansion" | "Rebalance" | "Maintenance" | "Role" | "Change-erasure" | "Circle-health" | "Circle-empty" | "Dot-circle" | "Check-circle" | "Times-circle" | "Toolbox" | "Cubes" | "File-alt" | "Policy" | "Pen" | "Pencil" | "Eye" | "EyeSlash" | "Snowflake" | "Key" | "Filter" | "Download" | "Certificate" | "Redo" | "Eraser" | "ID-card" | "Setting" | undefined;
|
|
17
17
|
size?: InputSize | undefined;
|
|
18
18
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, "size"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
|
-
export {};
|
|
20
19
|
//# sourceMappingURL=inputv2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputv2.d.ts","sourceRoot":"","sources":["../../../src/lib/components/inputv2/inputv2.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"inputv2.d.ts","sourceRoot":"","sources":["../../../src/lib/components/inputv2/inputv2.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIxD,OAAO,EAAQ,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAExD,eAAO,MAAM,gBAAgB,UAAW,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,2CAKlE,CAAC;AAgFF,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,CAAC;AAExD,eAAO,MAAM,KAAK;;QANZ,MAAM;;;;0GAsDX,CAAC"}
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import styled from 'styled-components';
|
|
4
4
|
import { spacing } from '../../spacing';
|
|
5
|
-
import { Box } from '../box/Box';
|
|
6
5
|
import { DESCRIPTION_PREFIX, useFieldContext } from '../form/Form.component';
|
|
7
6
|
import { Icon } from '../icon/Icon.component';
|
|
8
7
|
export const convertSizeToRem = (size) => {
|
|
@@ -16,7 +15,8 @@ export const convertSizeToRem = (size) => {
|
|
|
16
15
|
return '20.5rem';
|
|
17
16
|
};
|
|
18
17
|
const StyledInput = styled.input `
|
|
19
|
-
max-width: 100
|
|
18
|
+
max-width: ${(props) => props.hasIcon ? `calc(100% - 1rem - ${spacing.f8})` : '100%'};
|
|
19
|
+
|
|
20
20
|
font-family: 'Lato';
|
|
21
21
|
${(props) => props.disabled &&
|
|
22
22
|
`
|
|
@@ -45,6 +45,7 @@ const InputContainer = styled.div `
|
|
|
45
45
|
height: 100%;
|
|
46
46
|
display: flex;
|
|
47
47
|
align-items: center;
|
|
48
|
+
gap: ${spacing.f8};
|
|
48
49
|
padding: 0 ${spacing.r8} 0 ${spacing.r8};
|
|
49
50
|
background: ${(props) => props.theme.backgroundLevel1};
|
|
50
51
|
border-radius: ${spacing.r4};
|
|
@@ -72,9 +73,10 @@ const InputBorder = styled.div `
|
|
|
72
73
|
`;
|
|
73
74
|
const SelfCenterredIcon = styled(Icon) `
|
|
74
75
|
align-self: center;
|
|
76
|
+
color: ${(props) => props.theme.textSecondary};
|
|
75
77
|
`;
|
|
76
78
|
export const Input = forwardRef(({ error, disabled, id, leftIcon, rightIcon, placeholder, size, ...inputProps }, ref) => {
|
|
77
79
|
const { isContextAvailable, disabled: disabledFromFieldContext, error: errorFromFieldContext, } = useFieldContext();
|
|
78
80
|
placeholder = placeholder ? `Example: ${placeholder}` : undefined;
|
|
79
|
-
return (_jsx(InputBorder, { disabled: !!(disabled || disabledFromFieldContext), hasError: !!(error || errorFromFieldContext), width: convertSizeToRem(size), children:
|
|
81
|
+
return (_jsx(InputBorder, { disabled: !!(disabled || disabledFromFieldContext), hasError: !!(error || errorFromFieldContext), width: convertSizeToRem(size), children: _jsxs(InputContainer, { isContextAvailable: isContextAvailable, disabled: !!(disabled || disabledFromFieldContext), hasError: !!(error || errorFromFieldContext), children: [leftIcon && _jsx(SelfCenterredIcon, { name: leftIcon }), _jsx(StyledInput, { ref: ref, disabled: disabled || disabledFromFieldContext, "aria-invalid": !!(error || errorFromFieldContext), "aria-describedby": `${DESCRIPTION_PREFIX}${id}`, hasIcon: !!(leftIcon || rightIcon), id: id, ...inputProps, placeholder: placeholder }), rightIcon && _jsx(SelfCenterredIcon, { name: rightIcon })] }) }));
|
|
80
82
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChangeEvent } from 'react';
|
|
2
|
+
import { InputSize } from '../inputv2/inputv2';
|
|
2
3
|
export type Props = {
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
value: string;
|
|
@@ -6,6 +7,8 @@ export type Props = {
|
|
|
6
7
|
onReset?: () => void;
|
|
7
8
|
disableToggle: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
10
|
+
id?: string;
|
|
11
|
+
size?: InputSize;
|
|
9
12
|
};
|
|
10
13
|
declare const SearchInput: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<unknown>>;
|
|
11
14
|
export { SearchInput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchInput.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/searchinput/SearchInput.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"SearchInput.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/searchinput/SearchInput.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA2C,MAAM,OAAO,CAAC;AAG7E,OAAO,EAAS,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAGtD,MAAM,MAAM,KAAK,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACrD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAkCF,QAAA,MAAM,WAAW,2FAsFhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useRef, useState } from 'react';
|
|
2
|
+
import { forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import { fontSize } from '../../style/theme';
|
|
5
|
-
import { getThemePropSelector } from '../../utils';
|
|
6
4
|
import { Icon } from '../icon/Icon.component';
|
|
7
|
-
import { Input } from '../
|
|
5
|
+
import { Input } from '../inputv2/inputv2';
|
|
6
|
+
import { Button } from '../buttonv2/Buttonv2.component';
|
|
7
|
+
import { spacing } from '../../spacing';
|
|
8
8
|
const SearchInputContainer = styled.div `
|
|
9
9
|
position: relative;
|
|
10
|
+
width: max-content;
|
|
11
|
+
input {
|
|
12
|
+
max-width: calc(100% - 1rem - ${spacing.f8} - 1rem);
|
|
13
|
+
}
|
|
10
14
|
|
|
11
15
|
${(props) => {
|
|
12
16
|
if (props.disabled) {
|
|
@@ -19,66 +23,43 @@ const SearchInputContainer = styled.div `
|
|
|
19
23
|
}
|
|
20
24
|
}}
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
width: ${(props) => (props.docked ? '40px' : '100%')};
|
|
26
|
-
box-sizing: border-box;
|
|
27
|
-
padding-left: ${(props) => (props.docked ? '28px' : '40px')};
|
|
28
|
-
transition: width 0.2s ease-in-out;
|
|
29
|
-
}
|
|
26
|
+
//hide the default clear button in chrome
|
|
27
|
+
.search-box::-webkit-search-cancel-button {
|
|
28
|
+
display: none;
|
|
30
29
|
}
|
|
31
30
|
`;
|
|
32
|
-
const
|
|
31
|
+
const ClearButton = styled.div `
|
|
33
32
|
position: absolute;
|
|
34
|
-
border: none;
|
|
35
|
-
outline: none;
|
|
36
|
-
top: 1px;
|
|
37
|
-
padding: 8px 12px;
|
|
38
|
-
border-radius: 5px;
|
|
39
|
-
font-size: ${fontSize.base};
|
|
40
|
-
color: ${getThemePropSelector('textSecondary')};
|
|
41
|
-
background-color: transparent;
|
|
42
|
-
${(props) => {
|
|
43
|
-
// TODO
|
|
44
|
-
return (!props.disabled &&
|
|
45
|
-
css `
|
|
46
|
-
cursor: pointer;
|
|
47
|
-
&:hover {
|
|
48
|
-
color: ${getThemePropSelector('selectedActive')};
|
|
49
|
-
}
|
|
50
|
-
`);
|
|
51
|
-
}};
|
|
52
|
-
`;
|
|
53
|
-
const SearchIcon = styled(IconButton) `
|
|
54
|
-
left: 1px;
|
|
55
|
-
`;
|
|
56
|
-
const ResetIcon = styled(IconButton) `
|
|
57
33
|
right: 1px;
|
|
58
|
-
|
|
59
|
-
opacity: ${(props) => (props.visible ? 1 : 0)};
|
|
60
|
-
transition: opacity 0.5s ease-in-out;
|
|
34
|
+
top: 0px;
|
|
61
35
|
`;
|
|
62
|
-
const SearchInput = forwardRef(({ disableToggle, placeholder, value, onChange, onReset, disabled, ...rest }, forwardedRef) => {
|
|
63
|
-
const [docked, setDocked] = useState(!disableToggle);
|
|
36
|
+
const SearchInput = forwardRef(({ disableToggle, placeholder, value, onChange, onReset, disabled, id, size, ...rest }, forwardedRef) => {
|
|
64
37
|
const myInputRef = useRef(null);
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
38
|
+
const debounce = useRef(null);
|
|
39
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
return () => {
|
|
42
|
+
if (debounce.current) {
|
|
43
|
+
clearTimeout(debounce.current);
|
|
70
44
|
}
|
|
71
|
-
}
|
|
72
|
-
};
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
73
47
|
const reset = () => {
|
|
48
|
+
setDebouncedValue('');
|
|
74
49
|
if (onReset) {
|
|
75
50
|
onReset();
|
|
76
51
|
}
|
|
77
|
-
|
|
78
|
-
|
|
52
|
+
};
|
|
53
|
+
const handleChange = (e) => {
|
|
54
|
+
setDebouncedValue(e.target.value);
|
|
55
|
+
if (debounce.current) {
|
|
56
|
+
clearTimeout(debounce.current);
|
|
79
57
|
}
|
|
58
|
+
debounce.current = setTimeout(() => {
|
|
59
|
+
onChange(e);
|
|
60
|
+
}, 300);
|
|
80
61
|
};
|
|
81
|
-
return (_jsxs(SearchInputContainer, { className: "sc-searchinput", disabled: disabled,
|
|
62
|
+
return (_jsxs(SearchInputContainer, { className: "sc-searchinput", disabled: disabled, ...rest, children: [_jsx(Input, { min: '1', id: id || 'search', type: "search", "aria-label": "search", name: "search", placeholder: placeholder, value: debouncedValue, onChange: handleChange, onReset: reset, size: size, leftIcon: "Search", className: "search-box", disabled: disabled, ref: (element) => {
|
|
82
63
|
myInputRef.current = element;
|
|
83
64
|
if (typeof forwardedRef === 'function') {
|
|
84
65
|
forwardedRef(element);
|
|
@@ -86,6 +67,6 @@ const SearchInput = forwardRef(({ disableToggle, placeholder, value, onChange, o
|
|
|
86
67
|
else if (forwardedRef) {
|
|
87
68
|
forwardedRef.current = element;
|
|
88
69
|
}
|
|
89
|
-
} }), _jsx(
|
|
70
|
+
} }), debouncedValue && (_jsx(ClearButton, { className: "close-icon", children: _jsx(Button, { icon: _jsx(Icon, { name: "Close" }), tooltip: { overlay: 'Reset' }, onClick: reset }) }))] }));
|
|
90
71
|
});
|
|
91
72
|
export { SearchInput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/sidebar/Sidebar.component.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Sidebar.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/sidebar/Sidebar.component.tsx"],"names":[],"mappings":";AAaA,KAAK,IAAI,GAAG;IACV,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACpB,CAAC;AACF,KAAK,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;AACzB,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B,CAAC;AACF,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAwIF,iBAAS,OAAO,CAAC,EACf,QAAQ,EACR,OAAO,EACP,aAAa,EACb,SAAS,EACT,GAAG,IAAI,EACR,EAAE,KAAK,eA8DP;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -2,8 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { fontSize, zIndex, sidebarWidth, sidebarItemHeight, } from '../../style/theme';
|
|
5
|
-
import {
|
|
6
|
-
import { Button } from '../button/Button.component';
|
|
5
|
+
import { Button } from '../buttonv2/Buttonv2.component';
|
|
7
6
|
import { Icon } from '../icon/Icon.component';
|
|
8
7
|
import { spacing } from '../../spacing';
|
|
9
8
|
import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
|
|
@@ -19,7 +18,8 @@ const Wrapper = styled.div `
|
|
|
19
18
|
}
|
|
20
19
|
`;
|
|
21
20
|
}}
|
|
22
|
-
|
|
21
|
+
margin-top: 1px;
|
|
22
|
+
border-right: 1px solid ${(props) => props.theme.backgroundLevel3};
|
|
23
23
|
${(props) => {
|
|
24
24
|
if (props.expanded) {
|
|
25
25
|
return css `
|
|
@@ -68,9 +68,10 @@ const SidebarContainer = styled.div `
|
|
|
68
68
|
|
|
69
69
|
.sc-button {
|
|
70
70
|
border-radius: 0;
|
|
71
|
-
background-color: ${
|
|
71
|
+
background-color: ${(props) => props.theme.backgroundLevel1};
|
|
72
|
+
color: ${(props) => props.theme.textPrimary};
|
|
72
73
|
&:hover {
|
|
73
|
-
background-color: ${
|
|
74
|
+
background-color: ${(props) => props.theme.highlight};
|
|
74
75
|
}
|
|
75
76
|
&:focus-visible {
|
|
76
77
|
${FocusVisibleStyle}
|
|
@@ -125,7 +126,7 @@ const MenuItemSelected = styled.div `
|
|
|
125
126
|
width: 3px;
|
|
126
127
|
height: 100%;
|
|
127
128
|
right: 0;
|
|
128
|
-
background-color: ${
|
|
129
|
+
background-color: ${(props) => props.theme.selectedActive};
|
|
129
130
|
`;
|
|
130
131
|
const MenuItemIcon = styled.div `
|
|
131
132
|
width: ${sidebarWidth};
|
|
@@ -136,7 +137,7 @@ const MenuItemIcon = styled.div `
|
|
|
136
137
|
`;
|
|
137
138
|
function Sidebar({ expanded, actions, onToggleClick, hoverable, ...rest }) {
|
|
138
139
|
const [hovered, setHovered] = useState(false);
|
|
139
|
-
return (_jsx(Wrapper, { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), hoverable: hoverable, hovered: hovered, expanded: expanded, children: _jsxs(SidebarContainer, { expanded: expanded, className: "sc-sidebar", hoverable: hoverable, hovered: hovered, ...rest, children: [onToggleClick && (_jsx(MenuItemIcon, { children: _jsx(Button, {
|
|
140
|
+
return (_jsx(Wrapper, { onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), hoverable: hoverable, hovered: hovered, expanded: expanded, children: _jsxs(SidebarContainer, { expanded: expanded, className: "sc-sidebar", hoverable: hoverable, hovered: hovered, ...rest, children: [onToggleClick && (_jsx(MenuItemIcon, { children: _jsx(Button, { icon: _jsx(Icon, { size: "lg", name: "Lat-menu" }), onClick: () => {
|
|
140
141
|
setHovered(false);
|
|
141
142
|
onToggleClick();
|
|
142
143
|
} }) })), actions.map(({ active, label, onClick, icon = null, ...actionRest }, index) => {
|
|
@@ -16,7 +16,7 @@ export type SearchProps = {
|
|
|
16
16
|
displayedName: DisplayedName;
|
|
17
17
|
locale?: TableLocalType;
|
|
18
18
|
totalCount?: number;
|
|
19
|
-
} & Omit<Props, 'disableToggle'>;
|
|
19
|
+
} & Omit<Props, 'disableToggle' | 'onChange'>;
|
|
20
20
|
export declare const TableItemCount: ({ entity, count, locale, }: {
|
|
21
21
|
entity: {
|
|
22
22
|
singular: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/Search.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Search.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/Search.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CAAC,CAAC;AA0B9C,eAAO,MAAM,cAAc;YAKjB;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;WACrC,MAAM;YACL,IAAI,GAAG,IAAI;iBAapB,CAAC;AAEF,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,eAuC7C"}
|
|
@@ -40,7 +40,7 @@ export function TableSearch(props) {
|
|
|
40
40
|
React.useEffect(() => {
|
|
41
41
|
setGlobalFilter(value);
|
|
42
42
|
}, [value, setGlobalFilter, preGlobalFilteredRows]);
|
|
43
|
-
return (_jsxs(SearchContainer, { children: [displayTotalOf && (_jsx(TableItemCount, { entity: displayedName, count: totalDispayedRows, locale: locale })), _jsx(SearchInput, { value: value, placeholder: translations[locale].search, disableToggle: true, onChange: (evt) => {
|
|
43
|
+
return (_jsxs(SearchContainer, { children: [displayTotalOf && (_jsx(TableItemCount, { entity: displayedName, count: totalDispayedRows, locale: locale })), _jsx(SearchInput, { value: value, placeholder: translations[locale].search, disableToggle: true, size: "2/3", onChange: (evt) => {
|
|
44
44
|
if (typeof onChange === 'function') {
|
|
45
45
|
// @ts-ignore
|
|
46
46
|
onChange(evt.target.value);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
import { SearchProps } from './Search';
|
|
3
3
|
export type SearchWithQueryParamsProps = {
|
|
4
4
|
queryParams?: string;
|
|
5
|
-
} & SearchProps
|
|
6
|
-
export declare function SearchWithQueryParams(props:
|
|
5
|
+
} & Omit<SearchProps, 'onChange' | 'value'> & Partial<Pick<SearchProps, 'onChange'>>;
|
|
6
|
+
export declare function SearchWithQueryParams(props: SearchWithQueryParamsProps): JSX.Element;
|
|
7
7
|
//# sourceMappingURL=SearchWithQueryParams.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/SearchWithQueryParams.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAyB,WAAW,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"SearchWithQueryParams.d.ts","sourceRoot":"","sources":["../../../src/lib/components/tablev2/SearchWithQueryParams.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAyB,WAAW,EAAE,MAAM,UAAU,CAAC;AAE9D,MAAM,MAAM,0BAA0B,GAAG;IACvC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,OAAO,CAAC,GACzC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEzC,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,eA6BtE"}
|
|
@@ -7,7 +7,7 @@ export function SearchWithQueryParams(props) {
|
|
|
7
7
|
const { search, pathname } = useLocation();
|
|
8
8
|
const history = useHistory();
|
|
9
9
|
const params = new URLSearchParams(search);
|
|
10
|
-
const initialValue = params.get(queryParams);
|
|
10
|
+
const initialValue = params.get(queryParams) || '';
|
|
11
11
|
const [value, setValue] = useState(initialValue);
|
|
12
12
|
function handleOnChange(value) {
|
|
13
13
|
const { onChange } = props;
|
|
@@ -35,8 +35,8 @@ export const HeadRow = styled.div `
|
|
|
35
35
|
align-items: center;
|
|
36
36
|
height: 2.286rem;
|
|
37
37
|
width: ${(props) => props.hasScrollBar
|
|
38
|
-
? `calc(100% - ${props.scrollBarWidth}px - ${borderSize} )!important
|
|
39
|
-
: `calc(100% - ${borderSize} ) !important
|
|
38
|
+
? `calc(100% - ${props.scrollBarWidth}px - ${borderSize} )!important` // -4px for border
|
|
39
|
+
: `calc(100% - ${borderSize} ) !important`};
|
|
40
40
|
height: ${(props) => tableRowHeight[props.rowHeight]}rem;
|
|
41
41
|
table-layout: fixed;
|
|
42
42
|
color: ${(props) => props.theme.textPrimary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VegaChartV2.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/vegachartv2/VegaChartV2.component.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"VegaChartV2.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/vegachartv2/VegaChartV2.component.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsD,MAAM,OAAO,CAAC;AAC3E,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAK7B,eAAO,MAAM,GAAG,QAAQ,CAAC;AACzB,eAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,KAAK,QAAQ,GAAG,OAAO,GAAG,GAAG,OAAO,MAAM,CAAC;AAC3C,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,eAAe,CAAC,EAAE,QAAQ,CAAC;IAC3B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,aAAa,CAAC,EAAE,CACd,KAAK,EAAE,GAAG,EACV,WAAW,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,MAAM,EACnC,QAAQ,EAAE,MAAM,KACb,MAAM,CAAC;CACb,CAAC;AA8PF,eAAO,MAAM,SAAS,gFAAsC,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
import React, { useEffect,
|
|
3
|
+
import React, { useEffect, useRef, useLayoutEffect, useMemo } from 'react';
|
|
4
4
|
import * as vega from 'vega';
|
|
5
5
|
import vegaEmbed from 'vega-embed';
|
|
6
|
-
import {
|
|
7
|
-
import { getThemePropSelector } from '../../utils';
|
|
6
|
+
import { createGlobalStyle, css, useTheme } from 'styled-components';
|
|
8
7
|
import { useCursorX, SyncedCursorChartsContext } from './SyncedCursorCharts';
|
|
9
8
|
import { TooltipHandlerWithPaint } from '../linetemporalchart/tooltip';
|
|
10
9
|
export const TOP = 'top';
|
|
@@ -14,68 +13,70 @@ https://github.com/vega/vega-tooltip/blob/master/docs/customizing_your_tooltip.m
|
|
|
14
13
|
*/
|
|
15
14
|
const VegaTooltipTheme = createGlobalStyle `
|
|
16
15
|
#vg-tooltip-element.vg-tooltip.custom-theme {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
16
|
+
${(props) => {
|
|
17
|
+
const { theme } = props;
|
|
18
|
+
return css `
|
|
19
|
+
padding: 8px;
|
|
20
|
+
position: fixed;
|
|
21
|
+
z-index: 1000;
|
|
22
|
+
width: calc(100vw / 6);
|
|
23
|
+
font-family: 'Lato';
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
border-radius: 3px;
|
|
26
|
+
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
|
|
27
|
+
color: ${theme.textPrimary};
|
|
28
|
+
background-color: ${theme.backgroundLevel1};
|
|
29
|
+
border: 1px solid ${theme.border};
|
|
30
|
+
// customize the title
|
|
31
|
+
h2 {
|
|
32
|
+
color: ${theme.textPrimary};
|
|
33
|
+
margin-bottom: 10px;
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
}
|
|
36
|
+
table {
|
|
37
|
+
width: 100%;
|
|
38
|
+
}
|
|
39
|
+
table tr td.key {
|
|
40
|
+
color: ${theme.textSecondary};
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
}}
|
|
44
|
+
|
|
40
45
|
}
|
|
41
46
|
`;
|
|
42
47
|
function VegaChartInternal({ spec, tooltipPosition = BOTTOM, theme = 'custom', formatTooltip, onHover, }, ref) {
|
|
43
48
|
// $FlowFixMe
|
|
44
49
|
const { cursorX, setCursorX } = useCursorX();
|
|
45
|
-
const
|
|
46
|
-
// the background color of the view
|
|
47
|
-
const seriesBackgroundColor = themeContext && themeContext.brand
|
|
48
|
-
? themeContext.brand.backgroundLevel1
|
|
49
|
-
: themeContext.backgroundLevel1;
|
|
50
|
-
const brandText = themeContext && themeContext.brand
|
|
51
|
-
? themeContext.brand.textPrimary
|
|
52
|
-
: themeContext.textPrimary;
|
|
50
|
+
const currentTheme = useTheme();
|
|
53
51
|
const themeConfig = {
|
|
54
52
|
config: {
|
|
55
|
-
background:
|
|
53
|
+
background: currentTheme.backgroundLevel1,
|
|
56
54
|
axis: {
|
|
57
|
-
labelColor:
|
|
58
|
-
titleColor:
|
|
55
|
+
labelColor: currentTheme.textSecondary,
|
|
56
|
+
titleColor: currentTheme.textSecondary,
|
|
59
57
|
grid: false,
|
|
60
58
|
domainColor: 'transparent',
|
|
61
59
|
},
|
|
62
60
|
title: {
|
|
63
|
-
color:
|
|
61
|
+
color: currentTheme.buttonDelete,
|
|
64
62
|
font: 'Lato',
|
|
65
63
|
},
|
|
66
64
|
view: {
|
|
67
65
|
stroke: 'transparent',
|
|
68
|
-
fill:
|
|
66
|
+
fill: currentTheme.backgroundLevel1,
|
|
69
67
|
},
|
|
70
68
|
// the headers provide a title and labels for faceted plots.
|
|
71
69
|
header: {
|
|
72
|
-
labelColor:
|
|
70
|
+
labelColor: currentTheme.textPrimary,
|
|
73
71
|
},
|
|
74
72
|
// the label of max/min
|
|
75
73
|
text: {
|
|
76
|
-
color:
|
|
74
|
+
color: currentTheme.textPrimary,
|
|
77
75
|
font: 'Lato',
|
|
78
76
|
},
|
|
77
|
+
legend: {
|
|
78
|
+
labelColor: currentTheme.textSecondary,
|
|
79
|
+
},
|
|
79
80
|
},
|
|
80
81
|
};
|
|
81
82
|
const themedSpec = { ...spec, ...themeConfig };
|
|
@@ -149,7 +150,7 @@ function VegaChartInternal({ spec, tooltipPosition = BOTTOM, theme = 'custom', f
|
|
|
149
150
|
vegaInstance.current.view.finalize();
|
|
150
151
|
}
|
|
151
152
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
152
|
-
}, [vegaDOMInstance]);
|
|
153
|
+
}, [vegaDOMInstance, currentTheme]);
|
|
153
154
|
useLayoutEffect(() => {
|
|
154
155
|
if (vegaInstance.current) {
|
|
155
156
|
const view = vegaInstance.current.view;
|
|
@@ -211,6 +212,7 @@ function VegaChartInternal({ spec, tooltipPosition = BOTTOM, theme = 'custom', f
|
|
|
211
212
|
]);
|
|
212
213
|
return (_jsx("div", { className: "sc-vegachart", ref: vegaDOMInstance, style: {
|
|
213
214
|
width: '100%',
|
|
215
|
+
border: `${currentTheme.backgroundLevel3} 1px solid`,
|
|
214
216
|
}, children: _jsx(VegaTooltipTheme, {}) }));
|
|
215
217
|
} // @ts-expect-error
|
|
216
218
|
export const VegaChart = React.forwardRef(VegaChartInternal);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding-logo.d.ts","sourceRoot":"","sources":["../../src/lib/icons/branding-logo.tsx"],"names":[],"mappings":";AAEA,QAAA,MAAM,IAAI,mBA0CT,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const Logo = () => (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "49", height: "49", viewBox: "0 0 49 49", children: [_jsx("path", { fill: "#3d9bd6", d: "M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z" }), _jsx("path", { fill: "#007664", d: "M21.25 4.42v7.25h3.99V4.33l5.16 2.92 2-3.36L27.14.97A7.7 7.7 0 0 0 23.15 0c-1.36 0-2.72.35-3.89 1.06L14 3.98l1.99 3.36z" }), _jsx("path", { fill: "#ee4642", d: "M21.16 44.25V37h3.99v7.25l5.16-2.92 2 3.36-5.17 2.92a7.9 7.9 0 0 1-7.88 0L14 44.69l1.99-3.36z" }), _jsx("path", { fill: "#2aad8e", d: "M40.43 13.28L34 16.9l1.99 3.36 6.44-3.62v5.83h3.99v-5.92c0-1.33-.37-2.65-1.09-3.8a8.82 8.82 0 0 0-2.9-2.83L37.17 7l-1.99 3.36z" }), _jsx("path", { fill: "#d71d4f", d: "M4.99 32.84l6.43-3.63 2 3.36-6.44 3.63 5.17 2.91-2 3.36-5.25-2.92a7.6 7.6 0 0 1-2.81-2.82A7.1 7.1 0 0 1 1 32.92V27h3.99z" }), _jsx("path", { fill: "#9e2569", d: "M4.08 16.64l6.43 3.62 2-3.36-6.44-3.62 5.17-2.92-2-3.36-5.25 2.92a8.72 8.72 0 0 0-2.9 2.83A7.16 7.16 0 0 0 0 16.64v5.92h3.99z" }), _jsx("path", { fill: "#f79836", d: "M40.34 36.2L34 32.57l1.99-3.36 6.44 3.63V27h3.99v5.92c0 1.33-.37 2.57-1.09 3.81a8.69 8.69 0 0 1-2.9 2.82l-5.26 2.92-1.99-3.36z" }), _jsx("path", { fill: "#007664", d: "M24 15v8.22l7.34-4.06z" }), _jsx("path", { fill: "#9e2569", d: "M23.25 15L16 19.16l7.25 4.06z" }), _jsx("path", { fill: "#d71d4f", d: "M22.25 25.07L15 21v8.13z" }), _jsx("path", { fill: "#2aad8e", d: "M24 24.98l7.25 4.07V21z" }), _jsx("path", { fill: "#ee4642", d: "M23.16 26L16 30.07l7.16 4.15z" }), _jsx("path", { fill: "#f79836", d: "M24 26v8.22l7.25-4.15z" })] }));
|
|
3
|
+
export { Logo };
|