@scality/core-ui 0.135.0 → 0.137.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 (55) hide show
  1. package/dist/components/searchinput/SearchInput.component.d.ts +0 -1
  2. package/dist/components/searchinput/SearchInput.component.d.ts.map +1 -1
  3. package/dist/components/searchinput/SearchInput.component.js +1 -1
  4. package/dist/components/selectv2/Selectv2.component.d.ts +1 -1
  5. package/dist/components/selectv2/Selectv2.component.d.ts.map +1 -1
  6. package/dist/components/selectv2/Selectv2.component.js +5 -9
  7. package/dist/components/tablev2/Search.d.ts +1 -1
  8. package/dist/components/tablev2/Search.d.ts.map +1 -1
  9. package/dist/components/tablev2/Search.js +1 -1
  10. package/dist/components/tablev2/TableCommon.d.ts +1 -1
  11. package/dist/components/tablev2/TableCommon.js +3 -3
  12. package/dist/components/tablev2/Tablestyle.d.ts +1 -1
  13. package/dist/components/tablev2/Tablestyle.d.ts.map +1 -1
  14. package/dist/components/tablev2/Tablev2.component.d.ts +5 -1
  15. package/dist/components/tablev2/Tablev2.component.d.ts.map +1 -1
  16. package/dist/components/tablev2/Tablev2.component.js +6 -0
  17. package/dist/components/tablev2/useSyncedScroll.d.ts +2 -1
  18. package/dist/components/tablev2/useSyncedScroll.d.ts.map +1 -1
  19. package/dist/components/tablev2/useSyncedScroll.js +17 -19
  20. package/dist/components/tabsv2/StyledTabs.d.ts +1 -1
  21. package/dist/components/tabsv2/StyledTabs.d.ts.map +1 -1
  22. package/dist/components/tabsv2/Tabsv2.component.js +5 -1
  23. package/dist/components/toggle/Toggle.component.d.ts +1 -1
  24. package/dist/components/toggle/Toggle.component.d.ts.map +1 -1
  25. package/dist/components/toggle/Toggle.component.js +8 -11
  26. package/dist/organisms/attachments/AttachmentConfirmationModal.d.ts +4 -3
  27. package/dist/organisms/attachments/AttachmentConfirmationModal.d.ts.map +1 -1
  28. package/dist/organisms/attachments/AttachmentConfirmationModal.js +1 -0
  29. package/dist/organisms/attachments/AttachmentTable.d.ts +10 -10
  30. package/dist/organisms/attachments/AttachmentTable.d.ts.map +1 -1
  31. package/dist/organisms/attachments/AttachmentTable.js +2 -2
  32. package/dist/organisms/attachments/AttachmentTypes.d.ts +4 -3
  33. package/dist/organisms/attachments/AttachmentTypes.d.ts.map +1 -1
  34. package/package.json +2 -2
  35. package/src/lib/components/searchinput/SearchInput.component.tsx +0 -2
  36. package/src/lib/components/searchinput/SearchInput.test.tsx +88 -0
  37. package/src/lib/components/selectv2/Selectv2.component.tsx +7 -11
  38. package/src/lib/components/selectv2/selectv2.test.tsx +190 -200
  39. package/src/lib/components/tablev2/Search.tsx +1 -2
  40. package/src/lib/components/tablev2/TableCommon.tsx +5 -5
  41. package/src/lib/components/tablev2/Tablestyle.tsx +1 -1
  42. package/src/lib/components/tablev2/Tablev2.component.tsx +14 -0
  43. package/src/lib/components/tablev2/useSyncedScroll.ts +22 -24
  44. package/src/lib/components/tabsv2/StyledTabs.ts +1 -1
  45. package/src/lib/components/tabsv2/Tabsv2.component.tsx +1 -1
  46. package/src/lib/components/toggle/Toggle.component.tsx +9 -12
  47. package/src/lib/components/toggle/Toggle.test.tsx +56 -0
  48. package/src/lib/organisms/attachments/AttachmentConfirmationModal.tsx +11 -5
  49. package/src/lib/organisms/attachments/AttachmentTable.tsx +53 -31
  50. package/src/lib/organisms/attachments/AttachmentTypes.ts +10 -3
  51. package/stories/SearchInput/searchinput.guideline.mdx +20 -0
  52. package/stories/{searchinput.stories.tsx → SearchInput/searchinput.stories.tsx} +13 -20
  53. package/stories/Select/selectv2.stories.tsx +23 -5
  54. package/stories/Toggle/toggle.guideline.mdx +20 -0
  55. package/stories/{toggle.stories.tsx → Toggle/toggle.stories.tsx} +17 -10
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { action } from '@storybook/addon-actions';
3
- import { SearchInput } from '../src/lib/components/searchinput/SearchInput.component';
4
- import { Wrapper, Title } from './common';
3
+ import { SearchInput } from '../../src/lib/components/searchinput/SearchInput.component';
4
+ import { Wrapper, Title } from '../common';
5
5
  export default {
6
6
  title: 'Components/Inputs/SearchInput',
7
7
  component: SearchInput,
@@ -21,7 +21,7 @@ export const Default = {
21
21
  placeholder="Search server..."
22
22
  onChange={action('on input change')}
23
23
  onReset={action('on input reset')}
24
- disableToggle={false}
24
+ autoComplete="off"
25
25
  />
26
26
  </div>
27
27
  <Title>Disabled</Title>
@@ -36,7 +36,6 @@ export const Default = {
36
36
  placeholder="Search server..."
37
37
  onChange={action('on input change')}
38
38
  onReset={action('on input reset')}
39
- disableToggle={true}
40
39
  />
41
40
  </div>
42
41
  <Title>Search Input filled</Title>
@@ -49,7 +48,6 @@ export const Default = {
49
48
  value="carlito"
50
49
  onChange={action('on input change')}
51
50
  onReset={action('on input reset')}
52
- disableToggle={false}
53
51
  data-cy="carlito_searchinput"
54
52
  />
55
53
  </div>
@@ -64,7 +62,6 @@ export const Default = {
64
62
  placeholder="Search and Filter…"
65
63
  onChange={action('on input change')}
66
64
  onReset={action('on input reset')}
67
- disableToggle={true}
68
65
  />
69
66
  </div>
70
67
  <Title>Disable the default toggle undefined onReset action</Title>
@@ -77,7 +74,6 @@ export const Default = {
77
74
  value=""
78
75
  placeholder="Search and Filter…"
79
76
  onChange={action('on input change')}
80
- disableToggle={true}
81
77
  />
82
78
  </div>
83
79
  </Wrapper>
@@ -88,19 +84,16 @@ export const Debounce = {
88
84
  render: (args) => {
89
85
  const [value, setValue] = useState('');
90
86
  return (
91
- <Wrapper>
92
- <SearchInput
93
- placeholder="Search"
94
- value={value}
95
- disableToggle
96
- onReset={action('on input reset')}
97
- onChange={(e) => {
98
- setValue(e.target.value);
99
- action('debounce')(`${e.target} changed`);
100
- }}
101
- {...args}
102
- />
103
- </Wrapper>
87
+ <SearchInput
88
+ placeholder="Search"
89
+ value={value}
90
+ onReset={action('on input reset')}
91
+ onChange={(e) => {
92
+ setValue(e.target.value);
93
+ action('debounce')(`${e.target} changed`);
94
+ }}
95
+ {...args}
96
+ />
104
97
  );
105
98
  },
106
99
  };
@@ -5,14 +5,15 @@ import { Modal } from '../../src/lib/components/modal/Modal.component';
5
5
  import { Select } from '../../src/lib/components/selectv2/Selectv2.component';
6
6
  import { Wrapper } from '../common';
7
7
  import { Meta, StoryObj } from '@storybook/react';
8
+ import { useArgs } from '@storybook/preview-api';
8
9
 
9
10
  type SelectStory = StoryObj<typeof Select>;
10
11
  const meta: Meta<typeof Select> = {
11
12
  title: 'Components/Inputs/Select',
12
13
  component: Select,
13
- decorators: [
14
- (story) => <Wrapper style={{ minHeight: '15rem' }}>{story()}</Wrapper>,
15
- ],
14
+ // decorators: [
15
+ // (story) => <Wrapper style={{ minHeight: '15rem' }}>{story()}</Wrapper>,
16
+ // ],
16
17
  };
17
18
 
18
19
  export default meta;
@@ -37,7 +38,7 @@ const generateOptions = (n = 10) =>
37
38
 
38
39
  const optionsWithSearchBar = generateOptions(25);
39
40
  const optionsWithoutSearchBar = generateOptions(7);
40
- const defaultOptions = generateOptions(4);
41
+ const defaultOptions = generateOptions(5);
41
42
  const thousandsOfOptions = generateOptions(1000);
42
43
  const optionsWithDisabledWithoutMessage = optionsWithSearchBar.map(
43
44
  (option, index) => {
@@ -78,7 +79,6 @@ export const WithoutOptions: SelectStory = {
78
79
  export const DisabledSelect: SelectStory = {
79
80
  args: {
80
81
  disabled: true,
81
- defaultValue: defaultOptions[0].props.value,
82
82
  children: defaultOptions,
83
83
  },
84
84
  };
@@ -167,3 +167,21 @@ export const NotEnoughPlaceAtTheBottom: SelectStory = {
167
167
  children: optionsWithSearchBar,
168
168
  },
169
169
  };
170
+
171
+ export const WithDefaultValue: SelectStory = {
172
+ render: (args) => {
173
+ const [{ value }, updateArgs] = useArgs();
174
+ return (
175
+ <Select
176
+ {...args}
177
+ onChange={(value) => updateArgs({ value })}
178
+ value={value}
179
+ ></Select>
180
+ );
181
+ },
182
+ args: {
183
+ value: defaultOptions[0].props.value,
184
+ placeholder: 'Select an option',
185
+ children: defaultOptions,
186
+ },
187
+ };
@@ -0,0 +1,20 @@
1
+ import {
2
+ Meta,
3
+ Story,
4
+ Canvas,
5
+ Primary,
6
+ Controls,
7
+ Unstyled,
8
+ Source,
9
+ } from '@storybook/blocks';
10
+
11
+ import * as Stories from './toggle.stories';
12
+
13
+ <Meta name="Guideline" of={Stories} />
14
+
15
+ <Primary>
16
+ <Stories.Playground />
17
+ </Primary>
18
+ <Controls />
19
+
20
+ <Source />
@@ -1,22 +1,29 @@
1
1
  import React, { useState } from 'react';
2
- import { Toggle } from '../src/lib/components/toggle/Toggle.component';
3
- import { Wrapper } from './common';
2
+ import {
3
+ Props,
4
+ Toggle,
5
+ } from '../../src/lib/components/toggle/Toggle.component';
4
6
  import { useArgs } from '@storybook/preview-api';
5
- export default {
7
+ import { Meta, StoryObj } from '@storybook/react';
8
+
9
+ type Story = StoryObj<Props>;
10
+ const meta: Meta = {
6
11
  title: 'Components/Inputs/Toggle',
7
12
  component: Toggle,
8
13
  args: {
9
14
  name: 'toggle',
10
15
  },
11
16
  };
12
- export const Playground = {
17
+ export default meta;
18
+
19
+ export const Playground: Story = {
13
20
  render: (args) => {
14
- const [{ toggle }, updateArgs] = useArgs();
21
+ const [{ toggle }, updateArgs] = useArgs<{ toggle: boolean }>();
15
22
  return (
16
23
  <Toggle
17
- toggle={toggle}
18
- onChange={() => updateArgs({ toggle: !toggle })}
19
24
  {...args}
25
+ onChange={() => updateArgs({ toggle: !toggle })}
26
+ toggle={toggle}
20
27
  />
21
28
  );
22
29
  },
@@ -24,18 +31,18 @@ export const Playground = {
24
31
  label: 'Playground',
25
32
  },
26
33
  };
27
- export const LabelledToggle = {
34
+ export const LabelledToggle: Story = {
28
35
  render: (args) => {
29
36
  const [toggle, setToggle] = useState(false);
30
37
  return (
31
- <Toggle toggle={toggle} onChange={() => setToggle(!toggle)} {...args} />
38
+ <Toggle {...args} toggle={toggle} onChange={() => setToggle(!toggle)} />
32
39
  );
33
40
  },
34
41
  args: {
35
42
  label: 'Airplane mode',
36
43
  },
37
44
  };
38
- export const DisabledToggle = {
45
+ export const DisabledToggle: Story = {
39
46
  ...Playground,
40
47
  args: {
41
48
  label: 'Disabled Toggle',