@linzjs/step-ag-grid 15.1.3 → 17.0.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 (127) hide show
  1. package/dist/GridTheme.scss +138 -106
  2. package/dist/index.css +1 -8
  3. package/dist/node_modules/@linzjs/lui/dist/assets/svg-content.d.ts +7 -0
  4. package/dist/src/components/ComponentLoadingWrapper.d.ts +3 -4
  5. package/dist/src/components/Grid.d.ts +2 -2
  6. package/dist/src/components/GridCell.d.ts +6 -6
  7. package/dist/src/components/GridCellMultiEditor.d.ts +2 -2
  8. package/dist/src/components/GridIcon.d.ts +2 -2
  9. package/dist/src/components/GridLoadableCell.d.ts +1 -2
  10. package/dist/src/components/GridNoRowsOverlay.d.ts +5 -4
  11. package/dist/src/components/GridPopoverHook.d.ts +3 -3
  12. package/dist/src/components/GridWrapper.d.ts +2 -3
  13. package/dist/src/components/PostSortRowsHook.d.ts +1 -1
  14. package/dist/src/components/gridFilter/GridFilterButtons.d.ts +2 -2
  15. package/dist/src/components/gridFilter/GridFilterColumnsToggle.d.ts +2 -2
  16. package/dist/src/components/gridFilter/GridFilterDownloadCsvButton.d.ts +1 -2
  17. package/dist/src/components/gridFilter/GridFilterQuick.d.ts +1 -2
  18. package/dist/src/components/gridFilter/GridFilters.d.ts +2 -5
  19. package/dist/src/components/gridForm/GridFormDropDown.d.ts +3 -3
  20. package/dist/src/components/gridForm/GridFormEditBearing.d.ts +1 -2
  21. package/dist/src/components/gridForm/GridFormMessage.d.ts +3 -3
  22. package/dist/src/components/gridForm/GridFormMultiSelect.d.ts +3 -3
  23. package/dist/src/components/gridForm/GridFormPopoverMenu.d.ts +4 -4
  24. package/dist/src/components/gridForm/GridFormSubComponentTextArea.d.ts +2 -2
  25. package/dist/src/components/gridForm/GridFormSubComponentTextInput.d.ts +2 -2
  26. package/dist/src/components/gridForm/GridFormTextArea.d.ts +2 -2
  27. package/dist/src/components/gridForm/GridFormTextInput.d.ts +1 -2
  28. package/dist/src/components/gridHeader/GridHeaderSelect.d.ts +1 -2
  29. package/dist/src/components/gridHook/useGridContextMenu.d.ts +1 -1
  30. package/dist/src/components/gridRender/GridRenderGenericCell.d.ts +2 -2
  31. package/dist/src/components/gridRender/GridRenderPopoutMenuCell.d.ts +1 -2
  32. package/dist/src/contexts/GridContext.d.ts +5 -5
  33. package/dist/src/contexts/GridContextProvider.d.ts +2 -6
  34. package/dist/src/contexts/GridPopoverContextProvider.d.ts +2 -3
  35. package/dist/src/contexts/GridUpdatingContextProvider.d.ts +2 -6
  36. package/dist/src/lui/ActionButton.d.ts +3 -3
  37. package/dist/src/lui/FormError.d.ts +3 -3
  38. package/dist/src/lui/TextAreaInput.d.ts +4 -4
  39. package/dist/src/lui/TextInputFormatted.d.ts +3 -3
  40. package/dist/src/react-menu3/components/ControlledMenu.d.ts +3 -3
  41. package/dist/src/react-menu3/components/FocusableItem.d.ts +4 -4
  42. package/dist/src/react-menu3/components/Menu.d.ts +2 -2
  43. package/dist/src/react-menu3/components/MenuButton.d.ts +1 -1
  44. package/dist/src/react-menu3/components/MenuDivider.d.ts +1 -1
  45. package/dist/src/react-menu3/components/MenuGroup.d.ts +2 -2
  46. package/dist/src/react-menu3/components/MenuHeader.d.ts +2 -2
  47. package/dist/src/react-menu3/components/MenuItem.d.ts +1 -1
  48. package/dist/src/react-menu3/components/MenuList.d.ts +1 -2
  49. package/dist/src/react-menu3/components/MenuRadioGroup.d.ts +2 -2
  50. package/dist/src/react-menu3/components/SubMenu.d.ts +2 -2
  51. package/dist/src/react-menu3/utils/utils.d.ts +1 -1
  52. package/dist/src/react-menu3/utils/withHovering.d.ts +2 -2
  53. package/dist/src/utils/textValidator.d.ts +3 -3
  54. package/dist/step-ag-grid.cjs.js +1007 -3909
  55. package/dist/step-ag-grid.cjs.js.map +1 -1
  56. package/dist/step-ag-grid.esm.js +1008 -3910
  57. package/dist/step-ag-grid.esm.js.map +1 -1
  58. package/package.json +63 -59
  59. package/src/components/ComponentLoadingWrapper.tsx +9 -6
  60. package/src/components/Grid.tsx +32 -27
  61. package/src/components/GridCell.tsx +5 -5
  62. package/src/components/GridCellMultiEditor.tsx +2 -2
  63. package/src/components/GridIcon.tsx +2 -1
  64. package/src/components/GridNoRowsOverlay.tsx +10 -11
  65. package/src/components/GridPopoverHook.tsx +4 -4
  66. package/src/components/GridWrapper.tsx +2 -3
  67. package/src/components/PostSortRowsHook.ts +4 -4
  68. package/src/components/gridFilter/GridFilterButtons.tsx +2 -2
  69. package/src/components/gridFilter/GridFilterColumnsToggle.tsx +2 -2
  70. package/src/components/gridFilter/GridFilters.tsx +4 -6
  71. package/src/components/gridForm/GridFormDropDown.tsx +4 -4
  72. package/src/components/gridForm/GridFormMessage.tsx +3 -3
  73. package/src/components/gridForm/GridFormMultiSelect.tsx +2 -1
  74. package/src/components/gridForm/GridFormPopoverMenu.tsx +4 -4
  75. package/src/components/gridForm/GridFormSubComponentTextArea.tsx +2 -2
  76. package/src/components/gridForm/GridFormSubComponentTextInput.tsx +2 -2
  77. package/src/components/gridForm/GridFormTextArea.tsx +2 -2
  78. package/src/components/gridPopoverEdit/GridPopoverMessage.ts +1 -1
  79. package/src/components/gridRender/GridRenderGenericCell.tsx +2 -1
  80. package/src/contexts/GridContext.tsx +5 -5
  81. package/src/contexts/GridContextProvider.tsx +57 -32
  82. package/src/contexts/GridPopoverContextProvider.tsx +2 -3
  83. package/src/contexts/GridUpdatingContextProvider.tsx +2 -6
  84. package/src/lui/ActionButton.tsx +4 -3
  85. package/src/lui/FormError.tsx +3 -1
  86. package/src/lui/TextAreaInput.tsx +3 -3
  87. package/src/lui/TextInputFormatted.tsx +5 -4
  88. package/src/lui/reactUtils.test.tsx +7 -6
  89. package/src/react-menu3/components/FocusableItem.tsx +2 -2
  90. package/src/react-menu3/utils/utils.ts +1 -1
  91. package/src/react-menu3/utils/withHovering.tsx +2 -2
  92. package/src/stories/components/ActionButton.stories.tsx +2 -1
  93. package/src/stories/grid/FormTest.tsx +4 -3
  94. package/src/stories/grid/GridFilterButtons.stories.tsx +13 -16
  95. package/src/stories/grid/GridNoRowsOverlay.stories.tsx +14 -11
  96. package/src/stories/grid/GridNonEditableRow.stories.tsx +13 -5
  97. package/src/stories/grid/GridPopoutContextMenu.stories.tsx +12 -4
  98. package/src/stories/grid/GridPopoutEditGeneric.stories.tsx +12 -4
  99. package/src/stories/grid/GridPopoutEditGenericTextArea.stories.tsx +13 -5
  100. package/src/stories/grid/GridPopoverEditBearing.stories.tsx +11 -3
  101. package/src/stories/grid/GridPopoverEditDropDown.stories.tsx +11 -3
  102. package/src/stories/grid/GridPopoverEditMultiSelect.stories.tsx +11 -3
  103. package/src/stories/grid/GridPopoverEditMultiSelectGrid.stories.tsx +12 -3
  104. package/src/stories/grid/GridReadOnly.stories.tsx +22 -5
  105. package/src/stories/grid/gridFormInteraction/GridFormDropDownInteraction.stories.tsx +15 -12
  106. package/src/stories/grid/gridFormInteraction/GridFormEditBearingCorrectionInteraction.stories.tsx +20 -12
  107. package/src/stories/grid/gridFormInteraction/GridFormEditBearingInteraction.stories.tsx +20 -12
  108. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectGridInteraction.stories.tsx +13 -10
  109. package/src/stories/grid/gridFormInteraction/GridFormMultiSelectInteraction.stories.tsx +19 -16
  110. package/src/stories/grid/gridFormInteraction/GridFormPopoverMenuInteraction.stories.tsx +21 -17
  111. package/src/stories/grid/gridFormInteraction/GridFormTextAreaInteraction.stories.tsx +13 -10
  112. package/src/stories/grid/gridFormInteraction/GridFormTextInputInteraction.stories.tsx +15 -12
  113. package/src/stories/grid/gridFormStatic/GridFormDropDown.stories.tsx +5 -2
  114. package/src/stories/grid/gridFormStatic/GridFormEditBearing.stories.tsx +5 -2
  115. package/src/stories/grid/gridFormStatic/GridFormEditBearingCorrection.stories.tsx +5 -2
  116. package/src/stories/grid/gridFormStatic/GridFormMessage.stories.tsx +6 -3
  117. package/src/stories/grid/gridFormStatic/GridFormMultiSelect.stories.tsx +4 -1
  118. package/src/stories/grid/gridFormStatic/GridFormPopoverMenu.stories.tsx +4 -1
  119. package/src/stories/grid/gridFormStatic/GridFormTextArea.stories.tsx +5 -2
  120. package/src/stories/grid/gridFormStatic/GridFormTextInput.stories.tsx +5 -2
  121. package/src/stories/grid/interactions/GridKeyboardInteractions.stories.tsx +25 -12
  122. package/src/stories/react-menu/ReactMenu.stories.tsx +6 -4
  123. package/src/styles/ComponentLoadingWrapper.scss +1 -4
  124. package/src/styles/Grid.scss +0 -4
  125. package/src/styles/GridTheme.scss +138 -106
  126. package/src/utils/testUtil.ts +3 -0
  127. package/src/utils/textValidator.ts +3 -1
@@ -1,3 +1,7 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { expect, jest } from "@storybook/jest";
2
6
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
3
7
  import { userEvent, waitFor, within } from "@storybook/testing-library";
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
5
9
  import { useRef } from "react";
6
10
 
7
11
  import "@linzjs/lui/dist/fonts";
8
- import "@linzjs/lui/dist/scss/base.scss";
9
12
 
10
13
  import {
11
14
  GridContextProvider,
@@ -31,7 +34,7 @@ const onSave = jest
31
34
  const onSelectFilter = jest.fn();
32
35
 
33
36
  let options: MultiSelectGridOption[] = [];
34
- const Template: ComponentStory<typeof GridFormMultiSelectGrid> = (props) => {
37
+ const Template: ComponentStory<typeof GridFormMultiSelectGrid> = (props: GridFormMultiSelectGridProps<any>) => {
35
38
  options = [
36
39
  { label: "Zero", value: 0 },
37
40
  { label: "One", value: 1 },
@@ -86,8 +89,8 @@ GridFormMultiSelectGridInteractions_.play = async ({ canvasElement }) => {
86
89
  const zeroMenuOption = await getOption(/Zero/);
87
90
  expect(zeroMenuOption).toBeInTheDocument();
88
91
 
89
- userEvent.click(zeroMenuOption);
90
- userEvent.keyboard("{Tab}");
92
+ await userEvent.click(zeroMenuOption);
93
+ await userEvent.keyboard("{Tab}");
91
94
  expect(updateValue).toHaveBeenCalled();
92
95
  await waitFor(() => expect(onSave).toHaveBeenCalledWith({ selectedRows: [], addValues: [0], removeValues: [] }));
93
96
 
@@ -97,19 +100,19 @@ GridFormMultiSelectGridInteractions_.play = async ({ canvasElement }) => {
97
100
  };
98
101
 
99
102
  // Test left/right arrow
100
- userEvent.keyboard("{ArrowRight}");
103
+ await userEvent.keyboard("{ArrowRight}");
101
104
  check("Three");
102
- userEvent.keyboard("{ArrowRight}");
105
+ await userEvent.keyboard("{ArrowRight}");
103
106
  check("Zero");
104
- userEvent.keyboard("{ArrowLeft}");
107
+ await userEvent.keyboard("{ArrowLeft}");
105
108
  check("Three");
106
- userEvent.keyboard("{ArrowLeft}");
109
+ await userEvent.keyboard("{ArrowLeft}");
107
110
  check("Zero");
108
111
 
109
112
  // Test tab to save
110
113
  updateValue.mockClear();
111
114
  onSave.mockClear();
112
- userEvent.tab();
115
+ await userEvent.tab();
113
116
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
114
117
  expect(onSave).toHaveBeenCalledWith({
115
118
  selectedRows: [],
@@ -120,7 +123,7 @@ GridFormMultiSelectGridInteractions_.play = async ({ canvasElement }) => {
120
123
  // Test shift+tab to save
121
124
  updateValue.mockClear();
122
125
  onSave.mockClear();
123
- userEvent.tab({ shift: true });
126
+ await userEvent.tab({ shift: true });
124
127
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
125
128
  expect(onSave).toHaveBeenCalled();
126
129
  };
@@ -1,3 +1,7 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { expect, jest } from "@storybook/jest";
2
6
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
3
7
  import { userEvent, within } from "@storybook/testing-library";
@@ -5,7 +9,6 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
5
9
  import { useRef } from "react";
6
10
 
7
11
  import "@linzjs/lui/dist/fonts";
8
- import "@linzjs/lui/dist/scss/base.scss";
9
12
 
10
13
  import {
11
14
  GridContextProvider,
@@ -31,7 +34,7 @@ const onSave = jest.fn<Promise<boolean>, [GridFormMultiSelectSaveProps<any>]>().
31
34
  const onSelectFilter = jest.fn();
32
35
 
33
36
  let options: MultiSelectOption[] = [];
34
- const Template: ComponentStory<typeof GridFormMultiSelect> = (props) => {
37
+ const Template: ComponentStory<typeof GridFormMultiSelect> = (props: GridFormMultiSelectProps<any>) => {
35
38
  options = [
36
39
  { label: "Zero", value: 0 },
37
40
  { label: "One", value: 1 },
@@ -92,8 +95,8 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
92
95
  const zeroMenuOption = await getOption(/Zero/);
93
96
  expect(zeroMenuOption).toBeInTheDocument();
94
97
 
95
- userEvent.click(zeroMenuOption);
96
- userEvent.keyboard("{Tab}");
98
+ await userEvent.click(zeroMenuOption);
99
+ await userEvent.keyboard("{Tab}");
97
100
  expect(updateValue).toHaveBeenCalled();
98
101
  expect(onSave).toHaveBeenCalledWith({ selectedOptions: [options[0]], selectedRows: [] });
99
102
 
@@ -103,19 +106,19 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
103
106
 
104
107
  expect(canvas.queryByPlaceholderText("Text input")).not.toBeInTheDocument();
105
108
 
106
- userEvent.click(subTextInput);
109
+ await userEvent.click(subTextInput);
107
110
  const textInput = await canvas.findByPlaceholderText("Text input");
108
111
  expect(textInput).toBeInTheDocument();
109
112
  expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
110
113
 
111
- userEvent.click(textInput);
112
- userEvent.type(textInput, "Hello");
114
+ await userEvent.click(textInput);
115
+ await userEvent.type(textInput, "Hello");
113
116
  expect(await canvas.findByText("Press enter or tab to save")).toBeInTheDocument();
114
117
 
115
118
  // Test tab to save
116
119
  updateValue.mockClear();
117
120
  onSave.mockClear();
118
- userEvent.tab();
121
+ await userEvent.tab();
119
122
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
120
123
  expect(onSave).toHaveBeenCalledWith({
121
124
  selectedRows: [],
@@ -128,43 +131,43 @@ GridFormMultiSelectInteractions_.play = async ({ canvasElement }) => {
128
131
  // Test shift+tab to save
129
132
  updateValue.mockClear();
130
133
  onSave.mockClear();
131
- userEvent.tab({ shift: true });
134
+ await userEvent.tab({ shift: true });
132
135
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
133
136
  expect(onSave).toHaveBeenCalled();
134
137
 
135
138
  // Test escape to not save
136
139
  updateValue.mockClear();
137
140
  onSave.mockClear();
138
- userEvent.type(textInput, "{Escape}");
141
+ await userEvent.type(textInput, "{Escape}");
139
142
  expect(updateValue).not.toHaveBeenCalled();
140
143
  expect(onSave).not.toHaveBeenCalled();
141
144
 
142
145
  // Test invalid value doesn't save
143
146
  updateValue.mockClear();
144
147
  onSave.mockClear();
145
- userEvent.clear(textInput);
146
- userEvent.type(textInput, "{Enter}");
148
+ await userEvent.clear(textInput);
149
+ await userEvent.type(textInput, "{Enter}");
147
150
  expect(updateValue).not.toHaveBeenCalled();
148
151
  expect(onSave).not.toHaveBeenCalled();
149
152
 
150
153
  // Test filter
151
154
  const filterText = await canvas.findByPlaceholderText("Filter...");
152
- userEvent.type(filterText, "o");
155
+ await userEvent.type(filterText, "o");
153
156
  await wait(500);
154
157
  expect(canvas.queryByText("One")).toBeInTheDocument();
155
158
  expect(canvas.queryByText("Other")).toBeInTheDocument();
156
- userEvent.type(filterText, "n");
159
+ await userEvent.type(filterText, "n");
157
160
  expect(canvas.queryByText("One")).toBeInTheDocument();
158
161
  expect(canvas.queryByText("Zero")).not.toBeInTheDocument();
159
162
  expect(canvas.queryByText("Sub component")).not.toBeInTheDocument();
160
163
  expect(canvas.queryByText("Other")).not.toBeInTheDocument();
161
164
 
162
- userEvent.type(filterText, "x");
165
+ await userEvent.type(filterText, "x");
163
166
  expect(canvas.queryByText("One")).not.toBeInTheDocument();
164
167
  expect(canvas.queryByText("No Options")).toBeInTheDocument();
165
168
 
166
169
  // Check enter works to add custom free-text
167
- userEvent.type(filterText, "{Enter}");
170
+ await userEvent.type(filterText, "{Enter}");
168
171
  expect(onSelectFilter).toHaveBeenCalledWith({
169
172
  filter: "onx",
170
173
  options: [
@@ -1,3 +1,7 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { expect, jest } from "@storybook/jest";
2
6
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
3
7
  import { userEvent, within } from "@storybook/testing-library";
@@ -5,12 +9,12 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
5
9
  import { useRef } from "react";
6
10
 
7
11
  import "@linzjs/lui/dist/fonts";
8
- import "@linzjs/lui/dist/scss/base.scss";
9
12
 
10
13
  import {
11
14
  GridBaseRow,
12
15
  GridContextProvider,
13
16
  GridFormPopoverMenu,
17
+ GridFormPopoverMenuProps,
14
18
  GridFormSubComponentTextArea,
15
19
  GridFormSubComponentTextInput,
16
20
  PopoutMenuSeparator,
@@ -37,7 +41,7 @@ const disabledAction = jest
37
41
  .fn<Promise<void>, [{ selectedRows: GridBaseRow[]; menuOption: SelectedMenuOptionResult<GridBaseRow> }]>()
38
42
  .mockResolvedValue(undefined);
39
43
 
40
- const Template: ComponentStory<typeof GridFormPopoverMenu> = (props) => {
44
+ const Template: ComponentStory<typeof GridFormPopoverMenu> = (props: GridFormPopoverMenuProps<any>) => {
41
45
  const anchorRef = useRef<HTMLHeadingElement>(null);
42
46
 
43
47
  return (
@@ -90,13 +94,13 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
90
94
 
91
95
  const enabledMenuOption = await getOption("Enabled");
92
96
  expect(enabledMenuOption).toBeInTheDocument();
93
- userEvent.click(enabledMenuOption);
97
+ await userEvent.click(enabledMenuOption);
94
98
  expect(enabledAction).toHaveBeenCalled();
95
99
 
96
100
  enabledAction.mockClear();
97
101
  const disabledMenuOption = await getOption("Disabled");
98
102
  expect(disabledMenuOption).toBeInTheDocument();
99
- userEvent.click(disabledMenuOption);
103
+ await userEvent.click(disabledMenuOption);
100
104
  expect(disabledAction).not.toHaveBeenCalled();
101
105
 
102
106
  // Sub input tests
@@ -108,34 +112,34 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
108
112
  expect(subTextArea).toBeInTheDocument();
109
113
  expect(canvas.queryByPlaceholderText("Text area")).not.toBeInTheDocument();
110
114
 
111
- userEvent.click(subTextInput);
115
+ await userEvent.click(subTextInput);
112
116
  const textInput = await canvas.findByPlaceholderText("Text input");
113
117
  expect(textInput).toBeInTheDocument();
114
118
  expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
115
119
  expect(canvas.queryByPlaceholderText("Text area")).not.toBeInTheDocument();
116
120
 
117
- userEvent.type(textInput, "Hello");
121
+ await userEvent.type(textInput, "Hello");
118
122
  expect(await canvas.findByText("Press enter or tab to save")).toBeInTheDocument();
119
123
 
120
124
  // Test tab to save
121
125
  updateValue.mockClear();
122
- userEvent.tab();
126
+ await userEvent.tab();
123
127
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
124
128
 
125
129
  // Test shift+tab to save
126
130
  updateValue.mockClear();
127
- userEvent.tab({ shift: true });
131
+ await userEvent.tab({ shift: true });
128
132
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
129
133
 
130
134
  // Test escape to not save
131
135
  updateValue.mockClear();
132
- userEvent.type(textInput, "{Escape}");
136
+ await userEvent.type(textInput, "{Escape}");
133
137
  expect(updateValue).not.toHaveBeenCalled();
134
138
 
135
139
  // Test invalid value doesn't save
136
140
  updateValue.mockClear();
137
- userEvent.clear(textInput);
138
- userEvent.type(textInput, "{Enter}");
141
+ await userEvent.clear(textInput);
142
+ await userEvent.type(textInput, "{Enter}");
139
143
  expect(updateValue).not.toHaveBeenCalled();
140
144
 
141
145
  // Sub text area tests
@@ -146,27 +150,27 @@ GridFormPopoverMenuInteractions_.play = async ({ canvasElement }) => {
146
150
  expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
147
151
  expect(canvas.queryByPlaceholderText("Text input")).not.toBeInTheDocument();
148
152
 
149
- userEvent.type(textArea, "Hello");
153
+ await userEvent.type(textArea, "Hello");
150
154
  expect(await canvas.findByText("Press tab to save")).toBeInTheDocument();
151
155
 
152
156
  // Test tab to save
153
157
  updateValue.mockClear();
154
- userEvent.tab();
158
+ await userEvent.tab();
155
159
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
156
160
 
157
161
  // Test shift+tab to save
158
162
  updateValue.mockClear();
159
- userEvent.tab({ shift: true });
163
+ await userEvent.tab({ shift: true });
160
164
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
161
165
 
162
166
  // Test escape to not save
163
167
  updateValue.mockClear();
164
- userEvent.type(textArea, "{Escape}");
168
+ await userEvent.type(textArea, "{Escape}");
165
169
  expect(updateValue).not.toHaveBeenCalled();
166
170
 
167
171
  // Test invalid value doesn't save
168
172
  updateValue.mockClear();
169
- userEvent.clear(textArea);
170
- userEvent.type(textArea, "{Enter}");
173
+ await userEvent.clear(textArea);
174
+ await userEvent.type(textArea, "{Enter}");
171
175
  expect(updateValue).not.toHaveBeenCalled();
172
176
  };
@@ -1,3 +1,7 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { expect, jest } from "@storybook/jest";
2
6
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
3
7
  import { userEvent, within } from "@storybook/testing-library";
@@ -5,9 +9,8 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
5
9
  import { useRef } from "react";
6
10
 
7
11
  import "@linzjs/lui/dist/fonts";
8
- import "@linzjs/lui/dist/scss/base.scss";
9
12
 
10
- import { GridContextProvider, GridFormTextArea } from "../../..";
13
+ import { GridContextProvider, GridFormTextArea, GridFormTextAreaProps } from "../../..";
11
14
 
12
15
  export default {
13
16
  title: "GridForm / Interactions",
@@ -17,7 +20,7 @@ export default {
17
20
 
18
21
  const updateValue = jest.fn();
19
22
 
20
- const Template: ComponentStory<typeof GridFormTextArea> = (props) => {
23
+ const Template: ComponentStory<typeof GridFormTextArea> = (props: GridFormTextAreaProps<any>) => {
21
24
  const anchorRef = useRef<HTMLHeadingElement>(null);
22
25
 
23
26
  return (
@@ -47,32 +50,32 @@ GridFormTextAreaInteractions_.play = async ({ canvasElement }) => {
47
50
  expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
48
51
 
49
52
  const inputField = canvas.getByPlaceholderText("Type here");
50
- userEvent.type(inputField, "Hello");
53
+ await userEvent.type(inputField, "Hello");
51
54
 
52
55
  expect(await canvas.findByText("Press tab to save")).toBeInTheDocument();
53
56
 
54
57
  // Test tab to save
55
58
  updateValue.mockClear();
56
- userEvent.tab();
59
+ await userEvent.tab();
57
60
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
58
61
 
59
62
  // Test shift+tab to save
60
63
  updateValue.mockClear();
61
- userEvent.tab({ shift: true });
64
+ await userEvent.tab({ shift: true });
62
65
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
63
66
 
64
67
  // Test escape not to save
65
68
  updateValue.mockClear();
66
- userEvent.type(inputField, "{Escape}");
69
+ await userEvent.type(inputField, "{Escape}");
67
70
  expect(updateValue).not.toHaveBeenCalled();
68
71
 
69
72
  // Test invalid value doesn't save
70
73
  updateValue.mockClear();
71
- userEvent.clear(inputField);
74
+ await userEvent.clear(inputField);
72
75
 
73
76
  expect(canvas.getByText("Must not be empty")).toBeInTheDocument();
74
- userEvent.tab();
77
+ await userEvent.tab();
75
78
  expect(updateValue).not.toHaveBeenCalled();
76
- userEvent.tab({ shift: true });
79
+ await userEvent.tab({ shift: true });
77
80
  expect(updateValue).not.toHaveBeenCalled();
78
81
  };
@@ -1,3 +1,7 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { expect, jest } from "@storybook/jest";
2
6
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
3
7
  import { userEvent, within } from "@storybook/testing-library";
@@ -5,9 +9,8 @@ import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopover
5
9
  import { useRef } from "react";
6
10
 
7
11
  import "@linzjs/lui/dist/fonts";
8
- import "@linzjs/lui/dist/scss/base.scss";
9
12
 
10
- import { GridContextProvider, GridFormTextInput } from "../../..";
13
+ import { GridContextProvider, GridFormTextInput, GridFormTextInputProps } from "../../..";
11
14
 
12
15
  export default {
13
16
  title: "GridForm / Interactions",
@@ -17,7 +20,7 @@ export default {
17
20
 
18
21
  const updateValue = jest.fn();
19
22
 
20
- const Template: ComponentStory<typeof GridFormTextInput> = (props) => {
23
+ const Template: ComponentStory<typeof GridFormTextInput> = (props: GridFormTextInputProps<any>) => {
21
24
  const anchorRef = useRef<HTMLHeadingElement>(null);
22
25
 
23
26
  return (
@@ -47,39 +50,39 @@ GridFormTextInputInteractions_.play = async ({ canvasElement }) => {
47
50
  expect(await canvas.findByText("Must not be empty")).toBeInTheDocument();
48
51
 
49
52
  const inputField = canvas.getByPlaceholderText("Type here");
50
- userEvent.type(inputField, "Hello");
53
+ await userEvent.type(inputField, "Hello");
51
54
 
52
55
  expect(canvas.getByText("Press enter or tab to save")).toBeInTheDocument();
53
56
 
54
57
  // Test enter to save
55
58
  updateValue.mockClear();
56
- userEvent.type(inputField, "{Enter}");
59
+ await userEvent.type(inputField, "{Enter}");
57
60
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), 0); // 0 = Enter
58
61
 
59
62
  // Test tab to save
60
63
  updateValue.mockClear();
61
- userEvent.tab();
64
+ await userEvent.tab();
62
65
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), 1); // 1 = Tab
63
66
 
64
67
  // Test shift+tab to save
65
68
  updateValue.mockClear();
66
- userEvent.tab({ shift: true });
69
+ await userEvent.tab({ shift: true });
67
70
  expect(updateValue).toHaveBeenCalledWith(expect.anything(), -1); // -1 = Shift + tab
68
71
 
69
72
  // Test escape not to save
70
73
  updateValue.mockClear();
71
- userEvent.type(inputField, "{Escape}");
74
+ await userEvent.type(inputField, "{Escape}");
72
75
  expect(updateValue).not.toHaveBeenCalled();
73
76
 
74
77
  // Test invalid value doesn't save
75
78
  updateValue.mockClear();
76
- userEvent.clear(inputField);
79
+ await userEvent.clear(inputField);
77
80
 
78
81
  expect(canvas.getByText("Must not be empty")).toBeInTheDocument();
79
- userEvent.type(inputField, "{Enter}");
82
+ await userEvent.type(inputField, "{Enter}");
80
83
  expect(updateValue).not.toHaveBeenCalled();
81
- userEvent.tab();
84
+ await userEvent.tab();
82
85
  expect(updateValue).not.toHaveBeenCalled();
83
- userEvent.tab({ shift: true });
86
+ await userEvent.tab({ shift: true });
84
87
  expect(updateValue).not.toHaveBeenCalled();
85
88
  };
@@ -1,9 +1,12 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
11
  import { GridBaseRow, GridContextProvider, GridFormDropDown, GridFormDropDownProps, MenuHeaderItem } from "../../..";
9
12
 
@@ -13,7 +16,7 @@ export default {
13
16
  args: {},
14
17
  } as ComponentMeta<typeof GridFormDropDown>;
15
18
 
16
- const Template: ComponentStory<typeof GridFormDropDown> = (props) => {
19
+ const Template: ComponentStory<typeof GridFormDropDown> = (props: GridFormDropDownProps<any>) => {
17
20
  const configs: [string, GridFormDropDownProps<GridBaseRow>, string?][] = [
18
21
  ["No options", { options: [] }],
19
22
  ["Custom no options", { options: [], noOptionsMessage: "Custom no options" }],
@@ -1,9 +1,12 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
11
  import {
9
12
  GridContextProvider,
@@ -18,7 +21,7 @@ export default {
18
21
  args: {},
19
22
  } as ComponentMeta<typeof GridFormEditBearing>;
20
23
 
21
- const Template: ComponentStory<typeof GridFormEditBearing> = (props) => {
24
+ const Template: ComponentStory<typeof GridFormEditBearing> = (props: GridFormEditBearingProps<any>) => {
22
25
  const values: [string, GridFormEditBearingProps<any>, number | null][] = [
23
26
  ["Null value", {}, null],
24
27
  ["Custom placeholder", { placeHolder: "Custom placeholder" }, null],
@@ -1,9 +1,12 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
11
  import {
9
12
  GridContextProvider,
@@ -18,7 +21,7 @@ export default {
18
21
  args: {},
19
22
  } as ComponentMeta<typeof GridFormEditBearing>;
20
23
 
21
- const Template: ComponentStory<typeof GridFormEditBearing> = (props) => {
24
+ const Template: ComponentStory<typeof GridFormEditBearing> = (props: GridFormEditBearingProps<any>) => {
22
25
  const values: [string, GridFormEditBearingProps<any>, number | null][] = [
23
26
  ["Null value", {}, null],
24
27
  ["Custom placeholder", { placeHolder: "Custom placeholder" }, null],
@@ -1,11 +1,14 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
- import { GridContextProvider, GridFormMessage } from "../../..";
11
+ import { GridContextProvider, GridFormMessage, GridFormMessageProps } from "../../..";
9
12
 
10
13
  export default {
11
14
  title: "GridForm / Static Tests",
@@ -13,7 +16,7 @@ export default {
13
16
  args: {},
14
17
  } as ComponentMeta<typeof GridFormMessage>;
15
18
 
16
- const Template: ComponentStory<typeof GridFormMessage> = (props) => {
19
+ const Template: ComponentStory<typeof GridFormMessage> = (props: GridFormMessageProps<any>) => {
17
20
  const anchorRef1 = useRef<HTMLHeadingElement>(null);
18
21
 
19
22
  return (
@@ -1,9 +1,12 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
11
  import { GridBaseRow, GridContextProvider, GridFormMultiSelect, GridFormMultiSelectProps } from "../../..";
9
12
 
@@ -1,9 +1,12 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
11
  import {
9
12
  GridBaseRow,
@@ -1,9 +1,12 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
11
  import { GridBaseRow, GridContextProvider, GridFormTextArea, GridFormTextAreaProps } from "../../..";
9
12
 
@@ -13,7 +16,7 @@ export default {
13
16
  args: {},
14
17
  } as ComponentMeta<typeof GridFormTextArea>;
15
18
 
16
- const Template: ComponentStory<typeof GridFormTextArea> = (props) => {
19
+ const Template: ComponentStory<typeof GridFormTextArea> = (props: GridFormTextAreaProps<any>) => {
17
20
  const configs: [string, GridFormTextAreaProps<GridBaseRow>, string?][] = [
18
21
  ["Text area", {}],
19
22
  ["Text area with text", {}, "Some text"],
@@ -1,9 +1,12 @@
1
+ import "../../../react-menu3/styles/index.scss";
2
+ import "../../../styles/index.scss";
3
+ import "@linzjs/lui/dist/scss/base.scss";
4
+
1
5
  import { ComponentMeta, ComponentStory } from "@storybook/react/dist/ts3.9/client/preview/types-6-3";
2
6
  import { GridPopoverContext, GridPopoverContextType } from "contexts/GridPopoverContext";
3
7
  import { useRef } from "react";
4
8
 
5
9
  import "@linzjs/lui/dist/fonts";
6
- import "@linzjs/lui/dist/scss/base.scss";
7
10
 
8
11
  import { GridBaseRow, GridContextProvider, GridFormTextInput, GridFormTextInputProps } from "../../..";
9
12
 
@@ -13,7 +16,7 @@ export default {
13
16
  args: {},
14
17
  } as ComponentMeta<typeof GridFormTextInput>;
15
18
 
16
- const Template: ComponentStory<typeof GridFormTextInput> = (props) => {
19
+ const Template: ComponentStory<typeof GridFormTextInput> = (props: GridFormTextInputProps<any>) => {
17
20
  const configs: [string, GridFormTextInputProps<GridBaseRow>, string?][] = [
18
21
  ["Text input", {}],
19
22
  ["Text input with text", {}, "Some text"],