@scality/core-ui 0.194.0 → 0.195.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 (104) hide show
  1. package/dist/components/UnsuccessfulResult.component.d.ts.map +1 -1
  2. package/dist/components/accordion/Accordion.component.d.ts.map +1 -1
  3. package/dist/components/banner/Banner.component.d.ts +6 -1
  4. package/dist/components/banner/Banner.component.d.ts.map +1 -1
  5. package/dist/components/banner/Banner.component.js +30 -9
  6. package/dist/components/breadcrumb/Breadcrumb.component.d.ts.map +1 -1
  7. package/dist/components/buttonv2/CopyButton.component.d.ts.map +1 -1
  8. package/dist/components/charts/MetricsTimeSpanProvider.d.ts.map +1 -1
  9. package/dist/components/charts/barchart/Barchart.d.ts.map +1 -1
  10. package/dist/components/charts/barchart/Barchart.utils.d.ts.map +1 -1
  11. package/dist/components/charts/barchart/BarchartTooltip.d.ts.map +1 -1
  12. package/dist/components/charts/common/ChartTooltip.d.ts.map +1 -1
  13. package/dist/components/charts/common/SharedComponents.d.ts +6 -6
  14. package/dist/components/charts/common/SharedComponents.d.ts.map +1 -1
  15. package/dist/components/charts/common/SharedComponents.js +7 -3
  16. package/dist/components/charts/common/chartUtils.d.ts.map +1 -1
  17. package/dist/components/charts/globalhealthbar/GlobalHealthBar.hooks.d.ts.map +1 -1
  18. package/dist/components/charts/globalhealthbar/GlobalHealthBar.utils.d.ts +3 -1
  19. package/dist/components/charts/globalhealthbar/GlobalHealthBar.utils.d.ts.map +1 -1
  20. package/dist/components/charts/globalhealthbar/GlobalHealthBarTooltip.d.ts.map +1 -1
  21. package/dist/components/charts/globalhealthbar/HealthBarXAxis.d.ts.map +1 -1
  22. package/dist/components/charts/legend/ChartLegend.d.ts.map +1 -1
  23. package/dist/components/charts/legend/ChartLegendWrapper.d.ts.map +1 -1
  24. package/dist/components/charts/linetimeseries/LineTimeSerieChart.types.d.ts.map +1 -1
  25. package/dist/components/charts/linetimeseries/LineTimeSerieChart.utils.d.ts.map +1 -1
  26. package/dist/components/charts/linetimeseries/LineTimeSerieChartTooltip.d.ts.map +1 -1
  27. package/dist/components/constrainedtext/Constrainedtext.component.d.ts.map +1 -1
  28. package/dist/components/constrainedtext/Constrainedtext.component.js +1 -0
  29. package/dist/components/coreuithemeprovider/CoreUiThemeProvider.d.ts.map +1 -1
  30. package/dist/components/date/FormattedDateTime.d.ts.map +1 -1
  31. package/dist/components/form/Form.component.d.ts.map +1 -1
  32. package/dist/components/form/Form.component.js +3 -3
  33. package/dist/components/icon/CustomsIcons.d.ts.map +1 -1
  34. package/dist/components/icon/Icon.component.d.ts +2 -130
  35. package/dist/components/icon/Icon.component.d.ts.map +1 -1
  36. package/dist/components/icon/Icon.component.js +5 -131
  37. package/dist/components/icon/iconTable.d.ts +138 -0
  38. package/dist/components/icon/iconTable.d.ts.map +1 -0
  39. package/dist/components/icon/iconTable.js +137 -0
  40. package/dist/components/iconhelper/IconHelper.d.ts.map +1 -1
  41. package/dist/components/infomessage/InfoMessage.component.d.ts.map +1 -1
  42. package/dist/components/infomessage/InfoMessageUtils.d.ts.map +1 -1
  43. package/dist/components/inlineinput/InlineInput.d.ts.map +1 -1
  44. package/dist/components/inputlist/InputButtons.d.ts.map +1 -1
  45. package/dist/components/inputlist/InputList.component.d.ts +2 -0
  46. package/dist/components/inputlist/InputList.component.d.ts.map +1 -1
  47. package/dist/components/inputlist/InputList.component.js +2 -2
  48. package/dist/components/inputv2/inputv2.d.ts +2 -0
  49. package/dist/components/inputv2/inputv2.d.ts.map +1 -1
  50. package/dist/components/inputv2/inputv2.js +6 -2
  51. package/dist/components/layout/v2/panels.d.ts.map +1 -1
  52. package/dist/components/modal/Modal.component.d.ts.map +1 -1
  53. package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -1
  54. package/dist/components/searchinput/SearchInput.component.js +1 -1
  55. package/dist/components/statusicon/StatusIcon.component.d.ts.map +1 -1
  56. package/dist/components/tablev2/MultiSelectableContent.d.ts.map +1 -1
  57. package/dist/components/tablev2/Search.d.ts.map +1 -1
  58. package/dist/components/tablev2/TableCommon.d.ts.map +1 -1
  59. package/dist/components/tablev2/TableUtils.d.ts.map +1 -1
  60. package/dist/components/tablev2/Tablestyle.d.ts.map +1 -1
  61. package/dist/components/tablev2/Tablev2.component.d.ts.map +1 -1
  62. package/dist/components/tabsv2/useScrollingTabs.d.ts.map +1 -1
  63. package/dist/components/text/Text.component.d.ts +9 -6
  64. package/dist/components/text/Text.component.d.ts.map +1 -1
  65. package/dist/components/text/Text.component.js +5 -0
  66. package/dist/components/toast/Toast.component.d.ts.map +1 -1
  67. package/dist/components/toast/useMutationsHandler.d.ts.map +1 -1
  68. package/dist/index.d.ts +3 -2
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/next.d.ts +3 -3
  71. package/dist/next.d.ts.map +1 -1
  72. package/dist/organisms/attachments/AttachmentTable.d.ts.map +1 -1
  73. package/dist/spacing.d.ts.map +1 -1
  74. package/dist/utils.d.ts +2 -0
  75. package/dist/utils.d.ts.map +1 -1
  76. package/dist/utils.js +2 -0
  77. package/jest.config.js +6 -1
  78. package/package.json +7 -7
  79. package/src/lib/components/banner/Banner.component.test.tsx +58 -0
  80. package/src/lib/components/banner/Banner.component.tsx +57 -10
  81. package/src/lib/components/charts/barchart/Barchart.test.tsx +3 -1
  82. package/src/lib/components/charts/common/SharedComponents.tsx +15 -11
  83. package/src/lib/components/constrainedtext/Constrainedtext.component.tsx +1 -0
  84. package/src/lib/components/form/Form.component.tsx +5 -19
  85. package/src/lib/components/icon/Icon.component.tsx +8 -135
  86. package/src/lib/components/icon/iconTable.ts +137 -0
  87. package/src/lib/components/iconhelper/IconHelper.test.tsx +2 -2
  88. package/src/lib/components/inputlist/InputList.component.tsx +4 -2
  89. package/src/lib/components/inputv2/inputv2.tsx +11 -5
  90. package/src/lib/components/searchinput/SearchInput.component.tsx +1 -0
  91. package/src/lib/components/searchinput/SearchInput.test.tsx +6 -6
  92. package/src/lib/components/text/Text.component.tsx +18 -10
  93. package/src/lib/index.ts +2 -2
  94. package/src/lib/next.ts +3 -3
  95. package/src/lib/utils.ts +4 -0
  96. package/stories/banner.stories.tsx +37 -5
  97. package/stories/inputlist.stories.tsx +18 -6
  98. package/tsconfig.json +1 -1
  99. package/dist/components/date/FormattedDateTime.spec.d.ts +0 -2
  100. package/dist/components/date/FormattedDateTime.spec.d.ts.map +0 -1
  101. package/dist/components/date/FormattedDateTime.spec.js +0 -161
  102. package/dist/components/date/dateDiffer.spec.d.ts +0 -2
  103. package/dist/components/date/dateDiffer.spec.d.ts.map +0 -1
  104. package/dist/components/date/dateDiffer.spec.js +0 -6
@@ -1,6 +1,6 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
2
  import React from 'react';
3
- import { InputList } from '../src/lib/components/inputlist/InputList.component';
3
+ import { InputList, InputListProps } from '../src/lib/components/inputlist/InputList.component';
4
4
  import { Wrapper as StoryWrapper } from './common';
5
5
  import { FormSection } from '../src/lib/components/form/Form.component';
6
6
  import { Controller, useForm } from 'react-hook-form';
@@ -9,15 +9,27 @@ const meta: Meta<typeof InputList> = {
9
9
  tags: ['autodocs'],
10
10
  title: 'Components/Inputs/InputList',
11
11
  component: InputList,
12
+ args: {
13
+ value: [''],
14
+ size: '1/2',
15
+ },
16
+ argTypes: {
17
+ size: {
18
+ options: ['1/3', '1/2', '2/3', '1'],
19
+ control: 'select',
20
+ },
21
+ },
12
22
  };
13
23
  export default meta;
14
24
 
25
+ type Story = StoryObj<typeof meta>;
15
26
  interface InputListForm {
16
27
  firstNames: string[];
17
28
  lastNames: string[];
18
29
  }
19
30
 
20
- const ExampleList = () => {
31
+
32
+ const ExampleList = ({ size }: { size?: InputListProps<string>['size'] }) => {
21
33
  const { control } = useForm<InputListForm>({
22
34
  mode: 'all',
23
35
  defaultValues: {
@@ -35,10 +47,11 @@ const ExampleList = () => {
35
47
  }}
36
48
  render={({ field: { onChange, onBlur, value } }) => (
37
49
  <InputList
38
- placeholder="First name"
50
+ placeholder="San Francisco"
39
51
  onBlur={onBlur}
40
52
  onChange={onChange}
41
53
  value={value}
54
+ size={size}
42
55
  />
43
56
  )}
44
57
  name="firstNames"
@@ -46,12 +59,11 @@ const ExampleList = () => {
46
59
  </FormSection>
47
60
  );
48
61
  };
49
- type Story = StoryObj<typeof InputList>;
50
62
  export const SimpleListOfInputs: Story = {
51
63
  name: 'List of inputs',
52
- render: () => (
64
+ render: (args) => (
53
65
  <StoryWrapper>
54
- <ExampleList />
66
+ <ExampleList {...args} />
55
67
  </StoryWrapper>
56
68
  ),
57
69
  };
package/tsconfig.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "exclude": ["src/**/*.test.*", "stories/*", "dist/**/*"],
2
+ "exclude": ["src/**/*.test.*", "stories/*", "dist/**/*", "src/**/*.spec.*"],
3
3
  "compilerOptions": {
4
4
  "module": "esnext",
5
5
  "declaration": true, // Generate d.ts files
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=FormattedDateTime.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FormattedDateTime.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/components/date/FormattedDateTime.spec.tsx"],"names":[],"mappings":""}
@@ -1,161 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { render, screen } from '@testing-library/react';
3
- import { FormattedDateTime } from './FormattedDateTime';
4
- import userEvent from '@testing-library/user-event';
5
- describe('FormatttedDateTime', () => {
6
- it('should display the date in the expected format', () => {
7
- //S
8
- render(_jsx(FormattedDateTime, { format: "date", value: new Date('2022-10-01T00:00:00Z') }));
9
- //V
10
- expect(screen.getByText('2022-10-01')).toBeInTheDocument();
11
- });
12
- it('should display the date time second in the expected format', () => {
13
- //S
14
- render(_jsx(FormattedDateTime, { format: "date-time-second", value: new Date('2022-10-01T00:00:00Z') }));
15
- //V
16
- expect(screen.getByText('2022-10-01 00:00:00')).toBeInTheDocument();
17
- });
18
- it('should display the date time in the expected format', () => {
19
- //S
20
- render(_jsx(FormattedDateTime, { format: "date-time", value: new Date('2022-10-01T00:00:00Z') }));
21
- //V
22
- expect(screen.getByText('2022-10-01 00:00')).toBeInTheDocument();
23
- });
24
- it('should display the time second in the expected format', () => {
25
- //S
26
- render(_jsx(FormattedDateTime, { format: "time-second", value: new Date('2022-10-01T00:00:00Z') }));
27
- //V
28
- expect(screen.getByText('00:00:00')).toBeInTheDocument();
29
- });
30
- it('should display the time in the expected format', () => {
31
- //S
32
- render(_jsx(FormattedDateTime, { format: "time", value: new Date('2022-10-01T00:00:00Z') }));
33
- //V
34
- expect(screen.getByText('00:00')).toBeInTheDocument();
35
- });
36
- it('should display a relative date with the right format when the date occured few seconds before', async () => {
37
- //S
38
- const today = new Date('2022-10-10T12:00:00Z');
39
- jest.useFakeTimers('modern');
40
- jest.setSystemTime(today);
41
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-10-10T11:59:37Z') }));
42
- //V
43
- expect(screen.getByText('few seconds ago')).toBeInTheDocument();
44
- //E
45
- await userEvent.hover(screen.getByText('few seconds ago'));
46
- //V
47
- expect(screen.getByText('2022-10-10 11:59:37')).toBeInTheDocument();
48
- });
49
- it('should display a relative date with the right format when the date occured 1 minute before', async () => {
50
- //S
51
- const today = new Date('2022-10-10T12:00:00Z');
52
- jest.useFakeTimers('modern');
53
- jest.setSystemTime(today);
54
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-10-10T11:59:00Z') }));
55
- //V
56
- expect(screen.getByText('1 minute ago')).toBeInTheDocument();
57
- //E
58
- await userEvent.hover(screen.getByText('1 minute ago'));
59
- //V
60
- expect(screen.getByText('2022-10-10 11:59:00')).toBeInTheDocument();
61
- });
62
- it('should display a relative date with the right format when the date occured 2 minutes before', async () => {
63
- //S
64
- const today = new Date('2022-10-10T12:00:00Z');
65
- jest.useFakeTimers('modern');
66
- jest.setSystemTime(today);
67
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-10-10T11:57:26Z') }));
68
- //V
69
- expect(screen.getByText('2 minutes ago')).toBeInTheDocument();
70
- //E
71
- await userEvent.hover(screen.getByText('2 minutes ago'));
72
- //V
73
- expect(screen.getByText('2022-10-10 11:57:26')).toBeInTheDocument();
74
- });
75
- it('should display a relative date with the right format when the date occured 1 day before', async () => {
76
- //S
77
- const today = new Date('2022-10-10T12:00:00Z');
78
- jest.useFakeTimers('modern');
79
- jest.setSystemTime(today);
80
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-10-09T11:57:26Z') }));
81
- //V
82
- expect(screen.getByText('1 day ago')).toBeInTheDocument();
83
- //E
84
- await userEvent.hover(screen.getByText('1 day ago'));
85
- //V
86
- expect(screen.getByText('2022-10-09 11:57:26')).toBeInTheDocument();
87
- });
88
- it('should display a relative date with the right format when the date occured 2 days before', async () => {
89
- //S
90
- const today = new Date('2022-10-10T12:00:00Z');
91
- jest.useFakeTimers('modern');
92
- jest.setSystemTime(today);
93
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-10-08T11:57:26Z') }));
94
- //V
95
- expect(screen.getByText('2 days ago')).toBeInTheDocument();
96
- //E
97
- await userEvent.hover(screen.getByText('2 days ago'));
98
- //V
99
- expect(screen.getByText('2022-10-08 11:57:26')).toBeInTheDocument();
100
- });
101
- it('should display a relative date with the right format when the date occured 1 month before', async () => {
102
- //S
103
- const today = new Date('2022-10-10T12:00:00Z');
104
- jest.useFakeTimers('modern');
105
- jest.setSystemTime(today);
106
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-09-08T11:57:26Z') }));
107
- //V
108
- expect(screen.getByText('32 days ago')).toBeInTheDocument();
109
- //E
110
- await userEvent.hover(screen.getByText('32 days ago'));
111
- //V
112
- expect(screen.getByText('2022-09-08 11:57:26')).toBeInTheDocument();
113
- });
114
- it('should display a relative date with the right format when the date occured 2 months before', async () => {
115
- //S
116
- const today = new Date('2022-10-10T12:00:00Z');
117
- jest.useFakeTimers('modern');
118
- jest.setSystemTime(today);
119
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-08-08T11:57:26Z') }));
120
- //V
121
- expect(screen.getByText('63 days ago')).toBeInTheDocument();
122
- //E
123
- await userEvent.hover(screen.getByText('63 days ago'));
124
- //V
125
- expect(screen.getByText('2022-08-08 11:57:26')).toBeInTheDocument();
126
- });
127
- it('should display a relative date with the right format when the date occured 2 months after', async () => {
128
- //S
129
- const today = new Date('2022-10-10T12:00:00Z');
130
- jest.useFakeTimers('modern');
131
- jest.setSystemTime(today);
132
- render(_jsx(FormattedDateTime, { format: "relative", value: new Date('2022-12-12T11:57:26Z') }));
133
- //V
134
- expect(screen.getByText('in 63 days')).toBeInTheDocument();
135
- //E
136
- await userEvent.hover(screen.getByText('in 63 days'));
137
- //V
138
- expect(screen.getByText('2022-12-12 11:57:26')).toBeInTheDocument();
139
- });
140
- it('should display the date in the expected format of the xaxis tick in the chart', () => {
141
- //S
142
- render(_jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute", value: new Date('2022-10-06T18:33:00Z') }));
143
- //V
144
- expect(screen.getByText('06 Oct 18:33')).toBeInTheDocument();
145
- });
146
- it('should display the date in the expected format of date in the chart', () => {
147
- //S
148
- render(_jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute-second", value: new Date('2022-10-06T18:33:00Z') }));
149
- //V
150
- expect(screen.getByText('06 Oct 18:33:00')).toBeInTheDocument();
151
- });
152
- it('should display 3 letter month for September date', () => {
153
- //S
154
- render(_jsxs(_Fragment, { children: [_jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute", value: new Date('2022-09-06T18:33:00Z') }), _jsx(FormattedDateTime, { format: "day-month-abbreviated-hour-minute-second", value: new Date('2022-09-06T18:33:00Z') }), _jsx(FormattedDateTime, { format: "chart-date", value: new Date('2022-09-06T18:33:00Z') })] }));
155
- //V
156
- expect(screen.getByText(/06 Sep 18:33/)).toBeInTheDocument();
157
- expect(screen.getByText(/06 Sep 18:33:00/)).toBeInTheDocument();
158
- expect(screen.getByText(/Tue06Sep/)).toBeInTheDocument();
159
- expect(screen.queryByText(/Sept/)).not.toBeInTheDocument();
160
- });
161
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=dateDiffer.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dateDiffer.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/components/date/dateDiffer.spec.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import { getDateDaysDiff } from './dateDiffer';
2
- describe('Date Differ', () => {
3
- it('should computes the difference of days between 2 dates', () => {
4
- expect(getDateDaysDiff(new Date('2022-10-10T20:10:39Z'), new Date('2022-11-29T15:14:39Z'), 'days')).toBe(49);
5
- });
6
- });