@scality/core-ui 0.120.0 → 0.122.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.
Files changed (31) hide show
  1. package/.storybook/preview.js +1 -0
  2. package/dist/components/card/Card.component.d.ts.map +1 -1
  3. package/dist/components/card/Card.component.js +7 -5
  4. package/dist/components/checkbox/Checkbox.component.d.ts +7 -0
  5. package/dist/components/checkbox/Checkbox.component.d.ts.map +1 -1
  6. package/dist/components/checkbox/Checkbox.component.js +2 -0
  7. package/dist/components/layout/v2/AppContainer.js +1 -1
  8. package/dist/components/linetemporalchart/LineTemporalChart.component.d.ts.map +1 -1
  9. package/dist/components/linetemporalchart/LineTemporalChart.component.js +7 -8
  10. package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -1
  11. package/dist/components/searchinput/SearchInput.component.js +6 -1
  12. package/dist/components/selectv2/Selectv2.component.d.ts +1 -1
  13. package/dist/components/selectv2/Selectv2.component.d.ts.map +1 -1
  14. package/dist/components/selectv2/Selectv2.component.js +10 -7
  15. package/dist/components/steppers/Steppers.component.d.ts.map +1 -1
  16. package/dist/components/steppers/Steppers.component.js +9 -3
  17. package/dist/components/vegachartv2/VegaChartV2.component.js +4 -4
  18. package/package.json +18 -16
  19. package/src/lib/components/card/Card.component.tsx +7 -6
  20. package/src/lib/components/checkbox/Checkbox.component.tsx +3 -1
  21. package/src/lib/components/layout/v2/AppContainer.tsx +1 -1
  22. package/src/lib/components/linetemporalchart/LineTemporalChart.component.tsx +7 -8
  23. package/src/lib/components/searchinput/SearchInput.component.tsx +6 -1
  24. package/src/lib/components/selectv2/Selectv2.component.tsx +12 -8
  25. package/src/lib/components/selectv2/selectv2.test.tsx +193 -5
  26. package/src/lib/components/steppers/Steppers.component.tsx +13 -3
  27. package/src/lib/components/vegachartv2/VegaChartV2.component.tsx +4 -4
  28. package/stories/Checkbox/checkbox.guideline.mdx +55 -0
  29. package/stories/Checkbox/checkbox.stories.tsx +173 -0
  30. package/stories/barchart.stories.tsx +1 -7
  31. package/stories/checkbox.stories.tsx +0 -63
@@ -58,6 +58,7 @@ export const parameters = {
58
58
  matchers: {
59
59
  color: /color/i,
60
60
  },
61
+ exclude: ['data-cy'],
61
62
  },
62
63
  options: {
63
64
  storySort: {
@@ -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;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,S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AE,IAAI,EAAE,CAAC"}
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { createContext } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
5
+ import { hex2RGB } from '../../utils';
5
6
  const CardContext = createContext(null);
6
7
  function withCompoundCheck(Component) {
7
8
  return ({ children, className, ...rest }) => (_jsx(CardContext.Consumer, { children: (value) => {
@@ -51,8 +52,10 @@ const StyledCard = styled.div `
51
52
 
52
53
  ${StyledCardHeader} {
53
54
  color: ${(props) => props.theme.textPrimary};
54
- background: ${(props) => props.theme[props.colorStatus || props.headerBackgroundColor]};
55
- opacity: ${(props) => props.colorStatus && props.colorStatus !== 'backgroundLevel4' ? 0.4 : 1};
55
+ background: ${(props) => props.colorStatus
56
+ ? `rgba(${hex2RGB(props.theme[props.colorStatus]).join(',')}, 0.7)`
57
+ : props.theme[props.headerBackgroundColor]};
58
+
56
59
  ${(props) => props.disabled && 'opacity: 0.3;'}
57
60
  }
58
61
 
@@ -79,9 +82,8 @@ function Card({ width = 'auto', height = 'auto', headerBackgroundColor = 'button
79
82
  let colorStatus = null;
80
83
  if (status) {
81
84
  colorStatus =
82
- status === 'healthy'
83
- ? 'backgroundLevel4'
84
- : 'status' + status.replace(/^\w/, (c) => c.toUpperCase());
85
+ status != 'healthy' &&
86
+ 'status' + status.replace(/^\w/, (c) => c.toUpperCase());
85
87
  }
86
88
  return (_jsx(CardContext.Provider, { value: true, children: _jsx(StyledCard, { className: [`sc-card ${active ? 'active' : ''}`, className].join(' '), width: width, height: height, headerBackgroundColor: headerBackgroundColor, bodyBackgroundColor: bodyBackgroundColor, colorStatus: colorStatus, activeBorderColor: !status || status === 'healthy' ? 'selectedActive' : colorStatus, disabled: disabled, role: onClick && !disabled ? 'button' : null, "aria-pressed": onClick && !disabled ? active : null, tabIndex: onClick && !disabled ? 0 : null, onClick: !disabled ? onClick : undefined, active: active, onKeyDown: (event) => {
87
89
  if (!disabled &&
@@ -1,4 +1,11 @@
1
1
  import { ChangeEvent, InputHTMLAttributes } from 'react';
2
+ export type Props = {
3
+ label?: string;
4
+ value?: string;
5
+ checked?: boolean;
6
+ disabled?: boolean;
7
+ onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
8
+ } & InputHTMLAttributes<HTMLInputElement>;
2
9
  declare const Checkbox: import("react").ForwardRefExoticComponent<{
3
10
  label?: string | undefined;
4
11
  value?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/checkbox/Checkbox.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAc,MAAM,OAAO,CAAC;AAerE,QAAA,MAAM,QAAQ;;;;;oBAHG,YAAY,gBAAgB,CAAC,KAAK,IAAI;4FA0BtD,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"Checkbox.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/checkbox/Checkbox.component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAc,MAAM,OAAO,CAAC;AAOrE,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CACvD,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;AAE1C,QAAA,MAAM,QAAQ;;;;;oBAHG,YAAY,gBAAgB,CAAC,KAAK,IAAI;4FA0BtD,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -18,6 +18,8 @@ const StyledCheckbox = styled.label `
18
18
  color: ${(props) => props.theme.textPrimary};
19
19
  vertical-align: middle;
20
20
  -webkit-appearance: none;
21
+ -moz-appearance: none;
22
+ appearance: none;
21
23
  background: none;
22
24
  border: 0;
23
25
  outline: 0;
@@ -27,7 +27,7 @@ const ContextWrapper = styled.div `
27
27
  const ContextContainer = ({ children, background, ...rest }) => (_jsx(ContextWrapper, { background: background, children: _jsx(FillAvailableFlexBox, { ...rest, children: children }) }));
28
28
  const OverallSummaryContainer = styled.div `
29
29
  background: ${(props) => props.theme[props.background || 'backgroundLevel2']};
30
- height: 6rem;
30
+ min-height: 6rem;
31
31
  padding: ${({ noPadding }) => (noPadding ? '0' : '0 1rem')};
32
32
  margin-bottom: ${({ noBottomMargin }) => noBottomMargin ? '0' : sectionDistance};
33
33
  margin-top: ${({ hasTopMargin }) => (hasTopMargin ? '1rem' : '0')};
@@ -1 +1 @@
1
- {"version":3,"file":"LineTemporalChart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linetemporalchart/LineTemporalChart.component.tsx"],"names":[],"mappings":";AAoCA,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAC3D,eAAO,MAAM,kBAAkB,mBAAmB,CAAC;AACnD,eAAO,MAAM,aAAa;;;GAqBzB,CAAC;AA+BF,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,MAAM,CAAC;IAEjB,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IAEhC,eAAe,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtE,cAAc,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAEtE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB,EAAE,MAAM,CAAC;IAE1B,SAAS,CAAC,EAAE;QACV,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,GAAG,YAAY,GAAG,aAAa,CAAC;IACrD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,kBAAkB,CAAC,EAAE,CACnB,IAAI,EAAE;QACJ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,EACD,WAAW,EAAE,GAAG,KACb,MAAM,CAAC;CACb,CAAC;AAkCF,iBAAS,iBAAiB,CAAC,EACzB,MAAM,EACN,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,SAAiB,EACjB,cAAsB,EACtB,SAAqB,EACrB,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,GAAG,IAAI,EACR,EAAE,cAAc,eAqmBhB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
1
+ {"version":3,"file":"LineTemporalChart.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/linetemporalchart/LineTemporalChart.component.tsx"],"names":[],"mappings":";AAoCA,eAAO,MAAM,sBAAsB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ACvB,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,SAAS,EAAE,MAAM,CAAC;KACnB,EACD,WAAW,EAAE,GAAG,KACb,MAAM,CAAC;CACb,CAAC;AAkCF,iBAAS,iBAAiB,CAAC,EACzB,MAAM,EACN,KAAK,EACL,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,SAAiB,EACjB,cAAsB,EACtB,SAAqB,EACrB,UAAU,EACV,QAAQ,EACR,kBAAkB,EAClB,OAAO,EACP,GAAG,IAAI,EACR,EAAE,cAAc,eAomBhB;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -10,7 +10,7 @@ import { useCursorX } from '../vegachartv2/SyncedCursorCharts';
10
10
  import { ChartTitleText } from '../text/Text.component';
11
11
  import { convert2VegaData, getUnitLabel, convertDataBaseValue, addMissingDataPoint, getRelativeValue, getColorDomains, relativeDatumToOriginalDatum, normlizeVegaFieldName, } from './ChartUtil';
12
12
  import { useMetricsTimeSpan } from './MetricTimespanProvider';
13
- import { spacing } from '../../style/theme';
13
+ import { spacing } from '../../spacing';
14
14
  import { SmallerText } from '../text/Text.component';
15
15
  import { Loader } from '../loader/Loader.component';
16
16
  import { formatValue } from './tooltip/index';
@@ -51,12 +51,12 @@ const Legends = styled.div `
51
51
  align-items: center;
52
52
  `;
53
53
  const LegendStroke = styled.div `
54
- margin: 0 ${spacing.sp8} 0 ${spacing.sp16};
55
- height: ${spacing.sp2};
54
+ margin: 0 ${spacing.r8} 0 ${spacing.r16};
55
+ height: ${spacing.r2};
56
56
  background: ${(props) => props.isLineDashed
57
- ? `repeating-linear-gradient(to right,${props.lineColor} 0,${props.lineColor} ${spacing.sp1},transparent ${spacing.sp1},transparent ${spacing.sp2})`
57
+ ? `repeating-linear-gradient(to right,${props.lineColor} 0,${props.lineColor} ${spacing.r1},transparent ${spacing.r1},transparent ${spacing.r2})`
58
58
  : props.lineColor};
59
- width: ${spacing.sp8};
59
+ width: ${spacing.r8};
60
60
  `;
61
61
  const ChartHeader = styled.div `
62
62
  display: flex;
@@ -205,8 +205,7 @@ function LineTemporalChart({ series, title, height, startingTimeStamp, unitRange
205
205
  //https://vega.github.io/vega-lite/docs/datetime.html
206
206
  },
207
207
  color: {
208
- value: theme.highlight,
209
- opacity: 0.3,
208
+ value: theme.selectedActive,
210
209
  },
211
210
  /*
212
211
  According to the design, the vertical ruler should be hided when the mouse points out of the graph area.
@@ -552,7 +551,7 @@ function LineTemporalChart({ series, title, height, startingTimeStamp, unitRange
552
551
  minWidth: '15rem',
553
552
  display: 'block',
554
553
  }, children: helpText }), children: _jsx(Icon, { name: "Info", color: theme.buttonSecondary }) })), isLoading && (_jsx(Loader, { style: {
555
- paddingLeft: `${spacing.sp4}`,
554
+ paddingLeft: `${spacing.r4}`,
556
555
  } }))] }), _jsx(VegaChart, { spec: spec, onHover: (datum) => {
557
556
  if (onHover) {
558
557
  onHover({
@@ -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,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
+ {"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;AAuCF,QAAA,MAAM,WAAW,2FAsFhB,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -8,10 +8,15 @@ import { spacing } from '../../spacing';
8
8
  const SearchInputContainer = styled.div `
9
9
  position: relative;
10
10
  width: max-content;
11
- input {
11
+
12
+ input[value] {
12
13
  max-width: calc(100% - 1rem - ${spacing.f8} - 1rem);
13
14
  }
14
15
 
16
+ input[value=''] {
17
+ max-width: calc(100% - 1rem - ${spacing.f8});
18
+ }
19
+
15
20
  ${(props) => {
16
21
  if (props.disabled) {
17
22
  return css `
@@ -5,7 +5,7 @@ export type OptionProps = {
5
5
  icon?: React.ReactNode;
6
6
  children?: React.ReactNode;
7
7
  value: string;
8
- disabledReason?: React.ReactNode;
8
+ disabledReason?: JSX.Element;
9
9
  };
10
10
  export declare function Option({ value, children, disabled, icon, disabledReason, ...rest }: OptionProps): JSX.Element;
11
11
  export type SelectProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"Selectv2.component.d.ts","sourceRoot":"","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C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CACrC,CAAC;AAgBF,iBAAS,uBAAuB,CAAC,KAAK,EAAE,WAAW,eAyBlD;kBAzBQ,uBAAuB;;;AAiKhC,eAAO,MAAM,MAAM,gCAA0B,CAAC"}
@@ -50,12 +50,7 @@ export function Option({ value, children, disabled, icon, disabledReason, ...res
50
50
  return _jsx(_Fragment, {});
51
51
  }
52
52
  const Input = (props) => {
53
- const ariaProps = {
54
- role: props.selectProps.isSearchable ? 'combobox' : 'listbox',
55
- 'aria-expanded': props.selectProps.menuIsOpen,
56
- 'aria-autocomplete': 'list',
57
- };
58
- return _jsx(components.Input, { ...props, ...ariaProps });
53
+ return _jsx(components.Input, { ...props });
59
54
  };
60
55
  const selectDropdownIndicator = (caretType, indicatorDirection) => {
61
56
  if (caretType === 'chevron') {
@@ -171,7 +166,15 @@ const MenuList = (props) => {
171
166
  const ValueContainer = ({ children, ...props }) => {
172
167
  const selectedOption = props.selectProps.selectedOption;
173
168
  const icon = selectedOption ? selectedOption.icon : null;
174
- return (_jsxs(components.ValueContainer, { ...props, children: [icon ? _jsx("div", { className: "value-container-icon", children: icon }) : null, _jsx("div", { children: children })] }));
169
+ const ariaProps = {
170
+ innerProps: {
171
+ role: props.selectProps.isSearchable ? 'combobox' : 'listbox',
172
+ 'aria-expanded': props.selectProps.menuIsOpen,
173
+ 'aria-autocomplete': 'list',
174
+ 'aria-label': props.selectProps.placeholder,
175
+ },
176
+ };
177
+ return (_jsxs(components.ValueContainer, { ...props, ...ariaProps, children: [icon ? _jsx("div", { className: "value-container-icon", children: icon }) : null, _jsx("div", { children: children })] }));
175
178
  };
176
179
  const OptionContext = createContext(null);
177
180
  function SelectWithOptionContext(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"Steppers.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/steppers/Steppers.component.tsx"],"names":[],"mappings":";AAMA,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAsHF,iBAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAiBtD;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"Steppers.component.d.ts","sourceRoot":"","sources":["../../../src/lib/components/steppers/Steppers.component.tsx"],"names":[],"mappings":";AAMA,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AACF,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAgIF,iBAAS,QAAQ,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,EAAE,EAAE,KAAK,eAiBtD;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -22,6 +22,7 @@ const Circle = styled.div `
22
22
  display: flex;
23
23
  justify-content: center;
24
24
  align-items: center;
25
+ line-height: 30px;
25
26
  width: 30px;
26
27
  height: 30px;
27
28
  border-radius: 50%;
@@ -58,13 +59,14 @@ const Circle = styled.div `
58
59
  }};
59
60
  `;
60
61
  const StepHeader = styled.span `
61
- padding: 8px;
62
+ margin-left: ${spacing.r8};
63
+ line-height: 30px;
62
64
  color: ${(props) => props.active
63
65
  ? getThemePropSelector('textPrimary')
64
66
  : getThemePropSelector('textSecondary')};
65
67
  `;
66
68
  const StepContent = styled.div `
67
- padding: ${spacing.r8};
69
+ padding: ${spacing.r8} 0 ${spacing.r8} ${spacing.r8};
68
70
  `;
69
71
  const BottomBar = styled.hr `
70
72
  flex-grow: 1;
@@ -88,7 +90,11 @@ const BottomBar = styled.hr `
88
90
  function Step(props) {
89
91
  const { title, content, active, completed, isLast, index = 0, error, inProgress, } = props;
90
92
  const circleContent = completed ? _jsx(Icon, { name: "Check" }) : index + 1;
91
- return (_jsxs(StepContainer, { children: [_jsxs(Panel, { children: [_jsx(Circle, { active: active, error: error, completed: completed, children: active && inProgress ? (_jsx(Loader, { size: "base" })) : (_jsx("span", { children: circleContent })) }), !isLast && _jsx(BottomBar, { completed: completed })] }), _jsxs(Panel, { children: [_jsx(StepHeader, { active: active, children: title }), active && _jsx(StepContent, { children: content })] })] }));
93
+ return (_jsxs(StepContainer, { children: [_jsxs(Panel, { children: [_jsx(Circle, { active: active, error: error, completed: completed, children: active && inProgress ? (_jsx(Loader, { size: "base" })) : (_jsx("span", { children: circleContent })) }), !isLast && _jsx(BottomBar, { completed: completed })] }), _jsxs(Panel, { children: [_jsx("div", { style: {
94
+ height: '30px',
95
+ display: 'flex',
96
+ alignItems: 'center',
97
+ }, children: _jsx(StepHeader, { active: active, children: title }) }), active && _jsx(StepContent, { children: content })] })] }));
92
98
  }
93
99
  function Steppers({ steps, activeStep, ...rest }) {
94
100
  return (_jsx(SteppersContainer, { className: "sc-steppers", ...rest, children: steps.map(({ title, content, ...stepRest }, index) => (_jsx(Step, { title: title, content: content, active: index === activeStep, completed: index < activeStep, isLast: index === steps.length - 1, index: index, ...stepRest }, index))) }));
@@ -50,7 +50,7 @@ function VegaChartInternal({ spec, tooltipPosition = BOTTOM, theme = 'custom', f
50
50
  const currentTheme = useTheme();
51
51
  const themeConfig = {
52
52
  config: {
53
- background: currentTheme.backgroundLevel1,
53
+ background: 'transparent',
54
54
  axis: {
55
55
  labelColor: currentTheme.textSecondary,
56
56
  titleColor: currentTheme.textSecondary,
@@ -58,11 +58,12 @@ function VegaChartInternal({ spec, tooltipPosition = BOTTOM, theme = 'custom', f
58
58
  domainColor: 'transparent',
59
59
  },
60
60
  title: {
61
- color: currentTheme.buttonDelete,
61
+ color: currentTheme.textPrimary,
62
62
  font: 'Lato',
63
63
  },
64
64
  view: {
65
- stroke: 'transparent',
65
+ stroke: currentTheme.border,
66
+ strokeWidth: 0.5,
66
67
  fill: currentTheme.backgroundLevel1,
67
68
  },
68
69
  // the headers provide a title and labels for faceted plots.
@@ -212,7 +213,6 @@ function VegaChartInternal({ spec, tooltipPosition = BOTTOM, theme = 'custom', f
212
213
  ]);
213
214
  return (_jsx("div", { className: "sc-vegachart", ref: vegaDOMInstance, style: {
214
215
  width: '100%',
215
- border: `${currentTheme.backgroundLevel3} 1px solid`,
216
216
  }, children: _jsx(VegaTooltipTheme, {}) }));
217
217
  } // @ts-expect-error
218
218
  export const VegaChart = React.forwardRef(VegaChartInternal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scality/core-ui",
3
- "version": "0.120.0",
3
+ "version": "0.122.0",
4
4
  "description": "Scality common React component library",
5
5
  "author": "Scality Engineering",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -18,7 +18,8 @@
18
18
  "test": "jest",
19
19
  "storybook": "storybook dev -p 3000",
20
20
  "build-storybook": "storybook build",
21
- "storybook:deploy": "storybook-to-ghpages"
21
+ "storybook:deploy": "storybook-to-ghpages",
22
+ "preview": "jest-preview"
22
23
  },
23
24
  "keywords": [],
24
25
  "browserslist": [
@@ -33,18 +34,18 @@
33
34
  "@babel/preset-env": "^7.17.10",
34
35
  "@babel/preset-react": "^7.16.7",
35
36
  "@babel/preset-typescript": "^7.16.7",
36
- "@storybook/addon-actions": "^7.6.14",
37
- "@storybook/addon-essentials": "^7.6.14",
38
- "@storybook/addon-links": "^7.6.14",
39
- "@storybook/addon-mdx-gfm": "^7.6.14",
40
- "@storybook/addon-storyshots": "^7.6.14",
41
- "@storybook/addon-storysource": "^7.6.14",
42
- "@storybook/blocks": "^7.6.14",
43
- "@storybook/manager-api": "^7.6.14",
44
- "@storybook/react": "^7.6.14",
45
- "@storybook/react-webpack5": "^7.6.14",
37
+ "@storybook/addon-actions": "^7.6.17",
38
+ "@storybook/addon-essentials": "^7.6.17",
39
+ "@storybook/addon-links": "^7.6.17",
40
+ "@storybook/addon-mdx-gfm": "^7.6.17",
41
+ "@storybook/addon-storyshots": "^7.6.17",
42
+ "@storybook/addon-storysource": "^7.6.17",
43
+ "@storybook/blocks": "^7.6.17",
44
+ "@storybook/manager-api": "^7.6.17",
45
+ "@storybook/react": "^7.6.17",
46
+ "@storybook/react-webpack5": "^7.6.17",
46
47
  "@storybook/storybook-deployer": "^2.8.16",
47
- "@storybook/theming": "^7.6.14",
48
+ "@storybook/theming": "^7.6.17",
48
49
  "@testing-library/jest-dom": "^5.14.1",
49
50
  "@testing-library/react": "^11.2.7",
50
51
  "@testing-library/react-hooks": "^8.0.1",
@@ -71,11 +72,12 @@
71
72
  "identity-obj-proxy": "^3.0.0",
72
73
  "jest": "^26.6.3",
73
74
  "jest-canvas-mock": "^2.3.1",
75
+ "jest-preview": "^0.3.1",
74
76
  "plop": "^2.4.0",
75
77
  "regenerator-runtime": "^0.13.7",
76
78
  "rimraf": "^3.0.0",
77
79
  "source-map-explorer": "^2.0.1",
78
- "storybook": "^7.6.14",
80
+ "storybook": "^7.6.17",
79
81
  "typescript": "^5.3.2"
80
82
  },
81
83
  "husky": {
@@ -100,11 +102,11 @@
100
102
  "@fortawesome/free-solid-svg-icons": "^5.15.3",
101
103
  "@fortawesome/react-fontawesome": "^0.1.14",
102
104
  "@js-temporal/polyfill": "^0.4.4",
103
- "@storybook/preview-api": "^7.6.14",
105
+ "@storybook/preview-api": "^7.6.17",
106
+ "downshift": "^7.0.5",
104
107
  "framer-motion": "^4.1.17",
105
108
  "polished": "3.4.1",
106
109
  "pretty-bytes": "^5.6.0",
107
- "downshift": "^7.0.5",
108
110
  "react": "^17.0.2",
109
111
  "react-debounce-input": "3.2.2",
110
112
  "react-dom": "^17.0.2",
@@ -3,6 +3,7 @@ import { HTMLProps } from 'react';
3
3
  import { createContext } from 'react';
4
4
  import styled, { css } from 'styled-components';
5
5
  import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
6
+ import { hex2RGB } from '../../utils';
6
7
  const CardContext = createContext(null);
7
8
  type CardElementProps = {
8
9
  children: React.ReactNode;
@@ -85,9 +86,10 @@ const StyledCard = styled.div<{
85
86
  ${StyledCardHeader} {
86
87
  color: ${(props) => props.theme.textPrimary};
87
88
  background: ${(props) =>
88
- props.theme[props.colorStatus || props.headerBackgroundColor]};
89
- opacity: ${(props) =>
90
- props.colorStatus && props.colorStatus !== 'backgroundLevel4' ? 0.4 : 1};
89
+ props.colorStatus
90
+ ? `rgba(${hex2RGB(props.theme[props.colorStatus]).join(',')}, 0.7)`
91
+ : props.theme[props.headerBackgroundColor]};
92
+
91
93
  ${(props) => props.disabled && 'opacity: 0.3;'}
92
94
  }
93
95
 
@@ -140,9 +142,8 @@ function Card({
140
142
 
141
143
  if (status) {
142
144
  colorStatus =
143
- status === 'healthy'
144
- ? 'backgroundLevel4'
145
- : 'status' + status.replace(/^\w/, (c) => c.toUpperCase());
145
+ status != 'healthy' &&
146
+ 'status' + status.replace(/^\w/, (c) => c.toUpperCase());
146
147
  }
147
148
 
148
149
  return (
@@ -5,7 +5,7 @@ import { spacing, Stack } from '../../spacing';
5
5
  import { Text } from '../text/Text.component';
6
6
  import { FocusVisibleStyle } from '../buttonv2/Buttonv2.component';
7
7
 
8
- type Props = {
8
+ export type Props = {
9
9
  label?: string;
10
10
  value?: string;
11
11
  checked?: boolean;
@@ -53,6 +53,8 @@ const StyledCheckbox = styled.label<{
53
53
  color: ${(props) => props.theme.textPrimary};
54
54
  vertical-align: middle;
55
55
  -webkit-appearance: none;
56
+ -moz-appearance: none;
57
+ appearance: none;
56
58
  background: none;
57
59
  border: 0;
58
60
  outline: 0;
@@ -53,7 +53,7 @@ const OverallSummaryContainer = styled.div<{
53
53
  background?: ThemeColors;
54
54
  }>`
55
55
  background: ${(props) => props.theme[props.background || 'backgroundLevel2']};
56
- height: 6rem;
56
+ min-height: 6rem;
57
57
  padding: ${({ noPadding }) => (noPadding ? '0' : '0 1rem')};
58
58
  margin-bottom: ${({ noBottomMargin }) =>
59
59
  noBottomMargin ? '0' : sectionDistance};
@@ -27,7 +27,7 @@ import {
27
27
  normlizeVegaFieldName,
28
28
  } from './ChartUtil';
29
29
  import { useMetricsTimeSpan } from './MetricTimespanProvider';
30
- import { spacing } from '../../style/theme';
30
+ import { spacing } from '../../spacing';
31
31
  import { SmallerText } from '../text/Text.component';
32
32
  import { Loader } from '../loader/Loader.component';
33
33
  import { formatValue } from './tooltip/index';
@@ -68,13 +68,13 @@ const Legends = styled.div`
68
68
  align-items: center;
69
69
  `;
70
70
  const LegendStroke = styled.div`
71
- margin: 0 ${spacing.sp8} 0 ${spacing.sp16};
72
- height: ${spacing.sp2};
71
+ margin: 0 ${spacing.r8} 0 ${spacing.r16};
72
+ height: ${spacing.r2};
73
73
  background: ${(props) =>
74
74
  props.isLineDashed
75
- ? `repeating-linear-gradient(to right,${props.lineColor} 0,${props.lineColor} ${spacing.sp1},transparent ${spacing.sp1},transparent ${spacing.sp2})`
75
+ ? `repeating-linear-gradient(to right,${props.lineColor} 0,${props.lineColor} ${spacing.r1},transparent ${spacing.r1},transparent ${spacing.r2})`
76
76
  : props.lineColor};
77
- width: ${spacing.sp8};
77
+ width: ${spacing.r8};
78
78
  `;
79
79
  const ChartHeader = styled.div`
80
80
  display: flex;
@@ -327,8 +327,7 @@ function LineTemporalChart({
327
327
  //https://vega.github.io/vega-lite/docs/datetime.html
328
328
  },
329
329
  color: {
330
- value: theme.highlight,
331
- opacity: 0.3,
330
+ value: theme.selectedActive,
332
331
  },
333
332
 
334
333
  /*
@@ -731,7 +730,7 @@ function LineTemporalChart({
731
730
  {isLoading && (
732
731
  <Loader
733
732
  style={{
734
- paddingLeft: `${spacing.sp4}`,
733
+ paddingLeft: `${spacing.r4}`,
735
734
  }}
736
735
  />
737
736
  )}
@@ -20,10 +20,15 @@ const SearchInputContainer = styled.div<{
20
20
  }>`
21
21
  position: relative;
22
22
  width: max-content;
23
- input {
23
+
24
+ input[value] {
24
25
  max-width: calc(100% - 1rem - ${spacing.f8} - 1rem);
25
26
  }
26
27
 
28
+ input[value=''] {
29
+ max-width: calc(100% - 1rem - ${spacing.f8});
30
+ }
31
+
27
32
  ${(props) => {
28
33
  if (props.disabled) {
29
34
  return css`
@@ -24,7 +24,7 @@ export type OptionProps = {
24
24
  icon?: React.ReactNode;
25
25
  children?: React.ReactNode;
26
26
  value: string;
27
- disabledReason?: React.ReactNode;
27
+ disabledReason?: JSX.Element;
28
28
  };
29
29
  const usePreviousValue = (value) => {
30
30
  const ref = useRef(null);
@@ -79,12 +79,7 @@ export function Option({
79
79
  }
80
80
 
81
81
  const Input = (props) => {
82
- const ariaProps = {
83
- role: props.selectProps.isSearchable ? 'combobox' : 'listbox',
84
- 'aria-expanded': props.selectProps.menuIsOpen,
85
- 'aria-autocomplete': 'list',
86
- };
87
- return <components.Input {...props} {...ariaProps} />;
82
+ return <components.Input {...props} />;
88
83
  };
89
84
 
90
85
  const selectDropdownIndicator = (
@@ -285,8 +280,17 @@ const MenuList = (props) => {
285
280
  const ValueContainer = ({ children, ...props }) => {
286
281
  const selectedOption = props.selectProps.selectedOption;
287
282
  const icon = selectedOption ? selectedOption.icon : null;
283
+ const ariaProps = {
284
+ innerProps: {
285
+ role: props.selectProps.isSearchable ? 'combobox' : 'listbox',
286
+ 'aria-expanded': props.selectProps.menuIsOpen,
287
+ 'aria-autocomplete': 'list',
288
+ 'aria-label': props.selectProps.placeholder,
289
+ },
290
+ };
291
+
288
292
  return (
289
- <components.ValueContainer {...props}>
293
+ <components.ValueContainer {...props} {...ariaProps}>
290
294
  {icon ? <div className="value-container-icon">{icon}</div> : null}
291
295
  <div>{children}</div>
292
296
  </components.ValueContainer>
@@ -1,11 +1,16 @@
1
- import { Select, Option } from '../selectv2/Selectv2.component';
2
- import React, { useState } from 'react';
3
- import { render as testingRender } from '@testing-library/react';
1
+ import {
2
+ screen,
3
+ render as testingRender,
4
+ within,
5
+ } from '@testing-library/react';
4
6
  import userEvent from '@testing-library/user-event';
5
- import { Icon } from '../icon/Icon.component';
7
+ import React, { useState } from 'react';
6
8
  import { QueryClient, QueryClientProvider } from 'react-query';
9
+ import { debug } from 'jest-preview';
10
+ import { Icon } from '../icon/Icon.component';
11
+ import { Option, Select } from '../selectv2/Selectv2.component';
7
12
 
8
- const render = (...args) => {
13
+ const render = (args) => {
9
14
  return testingRender(
10
15
  <QueryClientProvider client={new QueryClient()}>
11
16
  {args}
@@ -274,4 +279,187 @@ describe('SelectV2', () => {
274
279
  );
275
280
  expect(onChange).toBeCalledTimes(0);
276
281
  });
282
+
283
+ it('should select with the right selector', async () => {
284
+ const accounts = [
285
+ {
286
+ name: 'Account 1',
287
+ },
288
+ {
289
+ name: 'Account 2',
290
+ },
291
+ ];
292
+
293
+ const MyWrapper = () => {
294
+ const [value, setValue] = useState('');
295
+ return (
296
+ <Select
297
+ id="select-account"
298
+ value={value}
299
+ onChange={(accountName) => {
300
+ setValue(accountName);
301
+ }}
302
+ size="1/2"
303
+ placeholder="Select Account"
304
+ >
305
+ {accounts.map((account) => (
306
+ <Select.Option key={`${account.name}`} value={account.name}>
307
+ {account.name}
308
+ </Select.Option>
309
+ ))}
310
+ </Select>
311
+ );
312
+ };
313
+
314
+ render(<MyWrapper />);
315
+
316
+ // If you only have one select, you can use the role, otherwise, you should use the label
317
+ // screen.getByLabelText(/select account/i)
318
+ // In a normal select, we should have a label span attach to it.
319
+ // It's not our case here, so it makes thing difficult to select the right select
320
+ // I workaround this by using setting the aria-label to the select container (cf: test below)
321
+ const singleSelect = screen.getByRole('listbox');
322
+ await userEvent.click(singleSelect);
323
+
324
+ await userEvent.click(screen.getByRole('option', { name: /account 1/i }));
325
+ });
326
+
327
+ it('should be testable if we have several select', async () => {
328
+ const MyWrapperWith2Select = () => {
329
+ const [value, setValue] = useState('');
330
+ const [value2, setValue2] = useState('');
331
+ const accounts = [
332
+ {
333
+ name: 'Account 1',
334
+ },
335
+ {
336
+ name: 'Account 2',
337
+ },
338
+ ];
339
+ const users = [
340
+ {
341
+ name: 'User 1',
342
+ },
343
+ {
344
+ name: 'User 2',
345
+ },
346
+ ];
347
+ return (
348
+ <div>
349
+ <Select
350
+ id="select-account"
351
+ value={value}
352
+ onChange={(accountName) => {
353
+ setValue(accountName);
354
+ }}
355
+ size="1/2"
356
+ placeholder="Select Account"
357
+ >
358
+ {accounts.map((account) => (
359
+ <Select.Option key={`${account.name}`} value={account.name}>
360
+ {account.name}
361
+ </Select.Option>
362
+ ))}
363
+ </Select>
364
+ <Select
365
+ id="select-user"
366
+ value={value2}
367
+ onChange={(accountName) => {
368
+ setValue2(accountName);
369
+ }}
370
+ size="1/2"
371
+ placeholder="Select User"
372
+ >
373
+ {users.map((user) => (
374
+ <Select.Option key={`${user.name}`} value={user.name}>
375
+ {user.name}
376
+ </Select.Option>
377
+ ))}
378
+ </Select>
379
+ </div>
380
+ );
381
+ };
382
+
383
+ render(<MyWrapperWith2Select />);
384
+
385
+ await userEvent.click(screen.getByLabelText(/select account/i));
386
+
387
+ await userEvent.click(screen.getByRole('option', { name: /account 1/i }));
388
+
389
+ await userEvent.click(screen.getByLabelText(/select user/i));
390
+
391
+ await userEvent.click(screen.getByRole('option', { name: /user 1/i }));
392
+ });
393
+
394
+ it('should be testable even if we have several select with the same value, the placeholder should be different', async () => {
395
+ const MyWrapperWith2Select = () => {
396
+ const [value, setValue] = useState('');
397
+ const [value2, setValue2] = useState('');
398
+ const accounts = [
399
+ {
400
+ name: 'Account 1',
401
+ },
402
+ {
403
+ name: 'Account 2',
404
+ },
405
+ ];
406
+ const accounts2 = [
407
+ {
408
+ name: 'Account 1',
409
+ },
410
+ {
411
+ name: 'Account 2',
412
+ },
413
+ ];
414
+ return (
415
+ <div style={{ display: 'flex' }}>
416
+ <Select
417
+ id="select-account"
418
+ value={value}
419
+ onChange={(accountName) => {
420
+ setValue(accountName);
421
+ }}
422
+ size="1/2"
423
+ placeholder="Select Account"
424
+ >
425
+ {accounts.map((account) => (
426
+ <Select.Option key={`${account.name}`} value={account.name}>
427
+ {account.name}
428
+ </Select.Option>
429
+ ))}
430
+ </Select>
431
+ <Select
432
+ id="select-account2"
433
+ value={value2}
434
+ onChange={(accountName) => {
435
+ setValue2(accountName);
436
+ }}
437
+ size="1"
438
+ placeholder="Select Second Account"
439
+ >
440
+ {accounts2.map((user) => (
441
+ <Select.Option key={`${user.name}`} value={user.name}>
442
+ {user.name}
443
+ </Select.Option>
444
+ ))}
445
+ </Select>
446
+ </div>
447
+ );
448
+ };
449
+
450
+ render(<MyWrapperWith2Select />);
451
+
452
+ await userEvent.click(screen.getByLabelText(/select account/i));
453
+ await userEvent.click(screen.getByLabelText(/Select Second Account/i));
454
+
455
+ /**
456
+ * This is possible because only 1 select can be open at a time
457
+ * If for some reason, you have multiple select open at the same time, you can select the select by its label
458
+ * and check the option from it parent like this :
459
+ * const select = screen.getByLabelText(/select account/i);
460
+ * const selectContainer = select?.parentElement?.parentElement;
461
+ * const option = within(selectContainer).getByRole('option', { name: /account 1/i });
462
+ */
463
+ await userEvent.click(screen.getByRole('option', { name: /account 1/i }));
464
+ });
277
465
  });
@@ -39,6 +39,7 @@ const Circle = styled.div<{
39
39
  display: flex;
40
40
  justify-content: center;
41
41
  align-items: center;
42
+ line-height: 30px;
42
43
  width: 30px;
43
44
  height: 30px;
44
45
  border-radius: 50%;
@@ -74,14 +75,15 @@ const Circle = styled.div<{
74
75
  }};
75
76
  `;
76
77
  const StepHeader = styled.span<{ active?: boolean }>`
77
- padding: 8px;
78
+ margin-left: ${spacing.r8};
79
+ line-height: 30px;
78
80
  color: ${(props) =>
79
81
  props.active
80
82
  ? getThemePropSelector('textPrimary')
81
83
  : getThemePropSelector('textSecondary')};
82
84
  `;
83
85
  const StepContent = styled.div`
84
- padding: ${spacing.r8};
86
+ padding: ${spacing.r8} 0 ${spacing.r8} ${spacing.r8};
85
87
  `;
86
88
  const BottomBar = styled.hr<{ completed?: boolean }>`
87
89
  flex-grow: 1;
@@ -128,7 +130,15 @@ function Step(props: StepProps) {
128
130
  {!isLast && <BottomBar completed={completed} />}
129
131
  </Panel>
130
132
  <Panel>
131
- <StepHeader active={active}>{title}</StepHeader>
133
+ <div
134
+ style={{
135
+ height: '30px',
136
+ display: 'flex',
137
+ alignItems: 'center',
138
+ }}
139
+ >
140
+ <StepHeader active={active}>{title}</StepHeader>
141
+ </div>
132
142
  {active && <StepContent>{content}</StepContent>}
133
143
  </Panel>
134
144
  </StepContainer>
@@ -75,7 +75,7 @@ function VegaChartInternal(
75
75
  const currentTheme = useTheme();
76
76
  const themeConfig = {
77
77
  config: {
78
- background: currentTheme.backgroundLevel1,
78
+ background: 'transparent',
79
79
  axis: {
80
80
  labelColor: currentTheme.textSecondary,
81
81
  titleColor: currentTheme.textSecondary,
@@ -83,11 +83,12 @@ function VegaChartInternal(
83
83
  domainColor: 'transparent',
84
84
  },
85
85
  title: {
86
- color: currentTheme.buttonDelete,
86
+ color: currentTheme.textPrimary,
87
87
  font: 'Lato',
88
88
  },
89
89
  view: {
90
- stroke: 'transparent',
90
+ stroke: currentTheme.border,
91
+ strokeWidth: 0.5,
91
92
  fill: currentTheme.backgroundLevel1,
92
93
  },
93
94
  // the headers provide a title and labels for faceted plots.
@@ -265,7 +266,6 @@ function VegaChartInternal(
265
266
  ref={vegaDOMInstance}
266
267
  style={{
267
268
  width: '100%',
268
- border: `${currentTheme.backgroundLevel3} 1px solid`,
269
269
  }}
270
270
  >
271
271
  <VegaTooltipTheme />
@@ -0,0 +1,55 @@
1
+ import {
2
+ Meta,
3
+ Story,
4
+ Canvas,
5
+ Primary,
6
+ Controls,
7
+ Unstyled,
8
+ Source,
9
+ } from '@storybook/blocks';
10
+ import { Checkbox } from '../../src/lib/components/checkbox/Checkbox.component';
11
+
12
+ import * as CheckboxStories from './checkbox.stories';
13
+
14
+ <Meta of={CheckboxStories} name="Guideline" />
15
+
16
+ # Checkbox
17
+
18
+ Checkboxes are used to select one or more options in a list.
19
+
20
+ ## Usage
21
+
22
+ Unlike the radio element it is possible to select more than one option. \
23
+ A tick/check indicates that the element is selected. \
24
+
25
+ <Canvas of={CheckboxStories.ChoiceCheckbox} layout="fullscreen" />
26
+
27
+ It is possible to use the checkbox to enable or disable an option:
28
+
29
+ <Canvas of={CheckboxStories.OptionCheckbox} layout="fullscreen" />
30
+
31
+ ## State Variations
32
+
33
+ ### Indeterminate State
34
+
35
+ Apart from checked and unchecked, checkboxes can be in a third state : indeterminate. \
36
+ When a checkbox has sub-options checkboxes, this state indicates that some of the sub-options are checked. \
37
+ Clicking on the main checkbox select or unselect all the sub-options boxes.
38
+
39
+ <Canvas of={CheckboxStories.IndeterminateUseCase} layout="fullscreen" />
40
+
41
+ ### Disabled state
42
+
43
+ Checkboxes can be disabled, making it impossible to change the box state. \
44
+ A not-allowed cursor inform the user about the unavaibility of the action.
45
+
46
+ <Canvas
47
+ of={CheckboxStories.DisabledCheckboxes}
48
+
49
+ layout="fullscreen"
50
+ />
51
+
52
+ ### Playground
53
+
54
+ <Canvas of={CheckboxStories.Playground} layout="fullscreen" />
55
+ <Controls of={CheckboxStories.Playground} />
@@ -0,0 +1,173 @@
1
+ import { action } from '@storybook/addon-actions';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ import React, { ComponentProps, useEffect, useRef } from 'react';
4
+ import {
5
+ Checkbox,
6
+ Props,
7
+ } from '../../src/lib/components/checkbox/Checkbox.component';
8
+ import { Column } from '../../src/lib/components/tablev2/Tablev2.component';
9
+ import { Box, Input, Table } from '../../src/lib/next';
10
+ import { Form, FormGroup, FormSection } from '../../src/lib';
11
+
12
+ type CheckboxStory = StoryObj<Props>;
13
+
14
+ const meta: Meta<Props> = {
15
+ title: 'Components/Inputs/Checkbox',
16
+ component: Checkbox,
17
+ args: {
18
+ label: 'interested ?',
19
+ onChange: action('Checkbox clicked'),
20
+ },
21
+ argTypes: {
22
+ onChange: {
23
+ description:
24
+ 'Function to be called when the checkbox is clicked, optional',
25
+ },
26
+ label: { control: 'text', description: 'Label of the checkbox, optional' },
27
+ checked: {
28
+ control: 'boolean',
29
+ description: 'Control if the checkbox is checked, optional',
30
+ },
31
+ disabled: {
32
+ control: 'boolean',
33
+ description: 'Control if the checkbox is disabled, optional',
34
+ },
35
+ value: { control: 'text' },
36
+ },
37
+ };
38
+
39
+ export default meta;
40
+
41
+ export const Playground: CheckboxStory = {};
42
+
43
+ export const ChoiceCheckbox: CheckboxStory = {
44
+ render: () => {
45
+ return (
46
+ <>
47
+ What are you interested in ?
48
+ <Checkbox label="Sport" />
49
+ <Checkbox label="Music" />
50
+ <Checkbox label="Drawing" />
51
+ </>
52
+ );
53
+ },
54
+ };
55
+
56
+ export const OptionCheckbox: CheckboxStory = {
57
+ render: () => {
58
+ return (
59
+ <Form layout={{ kind: 'tab' }}>
60
+ <FormSection>
61
+ <FormGroup
62
+ id="check"
63
+ label="Enable this option ?"
64
+ content={<Checkbox />}
65
+ ></FormGroup>
66
+ </FormSection>
67
+ </Form>
68
+ );
69
+ },
70
+ };
71
+
72
+ export const IndeterminateCheckbox: StoryObj<
73
+ ComponentProps<typeof Checkbox> & { 'data-cy': string }
74
+ > = {
75
+ render: (args) => {
76
+ const checkboxRef = useRef<HTMLInputElement>(null);
77
+ useEffect(() => {
78
+ if (checkboxRef.current) {
79
+ checkboxRef.current.indeterminate = true;
80
+ }
81
+ }, [checkboxRef]);
82
+ return <Checkbox ref={checkboxRef} {...args} />;
83
+ },
84
+ args: {
85
+ 'data-cy': 'checked_checkbox',
86
+ },
87
+ };
88
+
89
+ export const CheckedCheckbox: StoryObj<
90
+ ComponentProps<typeof Checkbox> & { 'data-cy': string }
91
+ > = {
92
+ args: {
93
+ checked: true,
94
+ 'data-cy': 'checked_checkbox',
95
+ },
96
+ };
97
+
98
+ export const UncheckedCheckbox: CheckboxStory = {
99
+ args: {
100
+ checked: false,
101
+ },
102
+ };
103
+
104
+ export const DisabledCheckboxes: CheckboxStory = {
105
+ render: () => {
106
+ return (
107
+ <>
108
+ <Checkbox disabled checked label="Disabled & checked " />
109
+ <Checkbox disabled label="Disabled & unchecked" />
110
+ </>
111
+ );
112
+ },
113
+ };
114
+
115
+ export const DisabledCheckedCheckbox: CheckboxStory = {
116
+ args: {
117
+ checked: true,
118
+ disabled: true,
119
+ },
120
+ };
121
+ export const DisabledUncheckedCheckbox: CheckboxStory = {
122
+ args: {
123
+ checked: false,
124
+ disabled: true,
125
+ },
126
+ };
127
+
128
+ export const IndeterminateUseCase = {
129
+ render: ({}) => {
130
+ const data = [
131
+ {
132
+ name: 'test 1',
133
+ volume: 1,
134
+ capacity: '1Gi',
135
+ },
136
+ {
137
+ name: 'test 2',
138
+ volume: 1,
139
+ capacity: '1Gi',
140
+ },
141
+ {
142
+ name: 'test 2',
143
+ volume: 1,
144
+ capacity: '1Gi',
145
+ },
146
+ ];
147
+
148
+ const columns: Column<(typeof data)[number]>[] = [
149
+ {
150
+ Header: 'Name',
151
+ accessor: 'name',
152
+ },
153
+ {
154
+ Header: 'Volume',
155
+ accessor: 'volume',
156
+ },
157
+ {
158
+ Header: 'Capacity',
159
+ accessor: 'capacity',
160
+ },
161
+ ];
162
+
163
+ return (
164
+ <Box width="500px" height="200px">
165
+ <Table columns={columns} data={data} defaultSortingKey={'health'}>
166
+ <Table.MultiSelectableContent
167
+ onMultiSelectionChanged={action('Selection changed')}
168
+ />
169
+ </Table>
170
+ </Box>
171
+ );
172
+ },
173
+ };
@@ -114,13 +114,7 @@ export default {
114
114
  title: 'Components/Data Display/Charts/BarChart',
115
115
  component: BarChart,
116
116
  decorators: [
117
- (story: Component) => (
118
- <Wrapper
119
- style={{ minHeight: '30vh', padding: '3rem', backgroundColor: 'white' }}
120
- >
121
- <SyncedCursorCharts>{story()}</SyncedCursorCharts>
122
- </Wrapper>
123
- ),
117
+ (story: Component) => <SyncedCursorCharts>{story()}</SyncedCursorCharts>,
124
118
  ],
125
119
  argTypes: {
126
120
  data: {
@@ -1,63 +0,0 @@
1
- import React, { useEffect, useRef } from 'react';
2
- import { action } from '@storybook/addon-actions';
3
- import { Checkbox } from '../src/lib/components/checkbox/Checkbox.component';
4
- import { Wrapper } from './common';
5
- export default {
6
- title: 'Components/Inputs/Checkbox',
7
- component: Checkbox,
8
- decorators: [
9
- (story) => (
10
- <Wrapper style={{ minHeight: '10vh', padding: '3rem' }}>
11
- {story()}
12
- </Wrapper>
13
- ),
14
- ],
15
- args: {
16
- label: 'interrested ?',
17
- onChange: action('Checkbox clicked'),
18
- },
19
- };
20
-
21
- export const DefaultCheckbox = {};
22
-
23
- export const IndeterminateCheckbox = {
24
- render: (args) => {
25
- const checkboxRef = useRef<HTMLInputElement>(null);
26
- useEffect(() => {
27
- if (checkboxRef.current) {
28
- checkboxRef.current.indeterminate = true;
29
- }
30
- }, [checkboxRef]);
31
- return <Checkbox ref={checkboxRef} {...args} />;
32
- },
33
- args: {
34
- 'data-cy': 'checked_checkbox',
35
- },
36
- };
37
-
38
- export const CheckedCheckbox = {
39
- args: {
40
- checked: true,
41
- 'data-cy': 'checked_checkbox',
42
- },
43
- };
44
-
45
- export const UncheckedCheckbox = {
46
- args: {
47
- checked: false,
48
- },
49
- };
50
-
51
- export const DisabledCheckedCheckbox = {
52
- args: {
53
- checked: true,
54
- disabled: true,
55
- },
56
- };
57
-
58
- export const DisabledUncheckedCheckbox = {
59
- args: {
60
- checked: false,
61
- disabled: true,
62
- },
63
- };