@redsift/table-pro 12.5.4

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 (44) hide show
  1. package/CONTRIBUTING.md +435 -0
  2. package/_internal/BaseComponents.js +3 -0
  3. package/_internal/BaseComponents.js.map +1 -0
  4. package/_internal/BaseIconButton.js +126 -0
  5. package/_internal/BaseIconButton.js.map +1 -0
  6. package/_internal/BaseTextField.js +26 -0
  7. package/_internal/BaseTextField.js.map +1 -0
  8. package/_internal/DataGrid.js +2 -0
  9. package/_internal/DataGrid.js.map +1 -0
  10. package/_internal/DataGrid2.js +507 -0
  11. package/_internal/DataGrid2.js.map +1 -0
  12. package/_internal/GridToolbarFilterSemanticField.js +2 -0
  13. package/_internal/GridToolbarFilterSemanticField.js.map +1 -0
  14. package/_internal/GridToolbarFilterSemanticField2.js +6962 -0
  15. package/_internal/GridToolbarFilterSemanticField2.js.map +1 -0
  16. package/_internal/Pagination.js +2 -0
  17. package/_internal/Pagination.js.map +1 -0
  18. package/_internal/ServerSideControlledPagination.js +324 -0
  19. package/_internal/ServerSideControlledPagination.js.map +1 -0
  20. package/_internal/StatefulDataGrid.js +2 -0
  21. package/_internal/StatefulDataGrid.js.map +1 -0
  22. package/_internal/StatefulDataGrid2.js +3237 -0
  23. package/_internal/StatefulDataGrid2.js.map +1 -0
  24. package/_internal/TextCell.js +2 -0
  25. package/_internal/TextCell.js.map +1 -0
  26. package/_internal/TextCell2.js +66 -0
  27. package/_internal/TextCell2.js.map +1 -0
  28. package/_internal/Toolbar.js +2 -0
  29. package/_internal/Toolbar.js.map +1 -0
  30. package/_internal/Toolbar2.js +102 -0
  31. package/_internal/Toolbar2.js.map +1 -0
  32. package/_internal/ToolbarWrapper.js +2 -0
  33. package/_internal/ToolbarWrapper.js.map +1 -0
  34. package/_internal/ToolbarWrapper2.js +53 -0
  35. package/_internal/ToolbarWrapper2.js.map +1 -0
  36. package/_internal/_rollupPluginBabelHelpers.js +93 -0
  37. package/_internal/_rollupPluginBabelHelpers.js.map +1 -0
  38. package/_internal/useControlledDatagridState.js +170 -0
  39. package/_internal/useControlledDatagridState.js.map +1 -0
  40. package/index.d.ts +1223 -0
  41. package/index.js +721 -0
  42. package/index.js.map +1 -0
  43. package/package.json +96 -0
  44. package/style/index.css +7 -0
@@ -0,0 +1,435 @@
1
+ # Contribute
2
+
3
+ ## Setup
4
+
5
+ Make sure you have the following requirements installed: [node](https://nodejs.org/) (v16+) and [yarn](https://yarnpkg.com/en/) (v1.22.0+)
6
+
7
+ Clone the repo (or fork it first if you're not part of Red Sift organization).
8
+
9
+ ```
10
+ git clone git@github.com:redsift/design-system.git
11
+ cd design-system
12
+ yarn install
13
+ ```
14
+
15
+ Set up your environment variable file by copying the template file:
16
+
17
+ ```bash
18
+ cp .env.template .env
19
+ ```
20
+
21
+ Then edit the `.env` file with the correct values. NEVER commit the `.env` file directly or any secrets and credentials it might contain.
22
+
23
+ You can then run the storybook and browse to [http://localhost:9000](http://localhost:9000) with:
24
+
25
+ ```bash
26
+ yarn start:storybook
27
+ ```
28
+
29
+ ## Architecture
30
+
31
+ The Design System is following a monorepo architecture, providing multiple packages based on different use cases.
32
+
33
+ - `@redsift/icons`
34
+
35
+ This package provides icons based on [Material Design Icon](https://pictogrammers.com/library/mdi/) library.
36
+
37
+ - `@redsift/design-system`
38
+
39
+ This package is the main package of Red Sift's Design System. It provides the majority of the components, including layout, formatting, navigation, form and interactive components.
40
+
41
+ - `@redsift/popovers`
42
+
43
+ This package provides popover components. Popover components are based on [floating-ui](https://floating-ui.com/) and [@floating-ui/react](https://floating-ui.com/docs/react). Toasts are based on [react-toastify](https://fkhadra.github.io/react-toastify).
44
+
45
+ - `@redsift/pickers`
46
+
47
+ This package provides selection components. The Popover part of the Pickers comes from `@redsift/popovers`.
48
+
49
+ - `@redsift/table`
50
+
51
+ This package provides datagrid components and features based on [MUI DataGrid](https://mui.com/x/react-data-grid/). The muiv6 and muiv7 branches use MUI DataGrid Pro; muiv8 (main) uses MUI DataGrid Premium. A [Pro or Premium license](https://mui.com/x/introduction/licensing/) from MUI is required.
52
+
53
+ - `@redsift/charts`
54
+
55
+ This package provides charts components. Charts are based on [d3.js](https://d3js.org/) for computation, [react](https://react.dev/) for rendering and events and [react-spring](https://www.react-spring.dev/) for animations and transitions.
56
+
57
+ - `@redsift/dashboard`
58
+
59
+ This package provides dashboard-related components and decorators to make charts and datagrid filterable using [crossfilter](https://crossfilter.github.io/crossfilter/).
60
+
61
+ - `@redsift/products`
62
+
63
+ This package provides ready-to-use implementation of components with a customize style to fit Red Sift's use cases. It is based on all other packages.
64
+
65
+ Please make sure to work inside the correct package when making contribution.
66
+
67
+ If you need something inside more than one package, do not duplicate the code. Place it inside one package, export it from this package and import it inside the others.
68
+
69
+ For instance, `@redsift/dashboard` and `@redsift/charts` both have a `PieChart` component that both share the `PieChartVariant` type interface. `PieChartVariant` has been implemented inside `@redsift/charts` and is imported inside `@redsift/dashboard`.
70
+
71
+ For more convenience, add an export of this shared code in every package using it. In this example, `@redsift/dashboard` also exports `PieChartVariant`. This will make it easier for the user later.
72
+
73
+ ```ts
74
+ // Even if PieChartVariant is implemented inside the charts package, the following code is not practical
75
+ import { PieChartVariant } from '@redsift/charts';
76
+ import { PieChart } from '@redsift/dashbord';
77
+
78
+ // Reexporting it from the dashboard package makes it really easier
79
+ import { PieChart, PieChartVariant } from '@redsift/dashbord';
80
+ ```
81
+
82
+ To define which package should contain the shared code, select the one that would not create any circular dependencies.
83
+
84
+ ### Dependencies
85
+
86
+ We try to use as few dependencies as possible.
87
+
88
+ For instance, we don't want to use `lodash` or `underscore` in the Design System. See why [you don't need them](https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore) and how to work without them.
89
+
90
+ We also don't want to use `momentjs`. See why [you don't need it](https://github.com/you-dont-need/You-Dont-Need-Momentjs) and what alternatives are there.
91
+
92
+ When dependencies are required, we try not to import them entirely to optimise the tree-shaking of the Design System.
93
+
94
+ ```ts
95
+ // don't
96
+ import * as d3 from 'd3';
97
+
98
+ // do
99
+ import { sum as d3sum, scaleOrdinal as d3scaleOrdinal, ScaleOrdinal as d3ScaleOrdinal } from 'd3';
100
+ ```
101
+
102
+ ## Component
103
+
104
+ ### Scaffolding
105
+
106
+ Each component should be in its own folder. If a subcomponent can be used as a standalone component, it should be in its own folder too. For instance, `CheckboxGroup` uses `Checkbox` but `Checkbox` can be used alone. In this case, `CheckboxGroup` and `Checkbox` both have their own folder. For `PieChart` and `PieChartSlice`, a `PieChartSlice` can not be used alone. It only exists inside a `PieChart` component. Therefore, both components are inside the same folder.
107
+
108
+ The name of the folder shoud be in kebab-case, the names of the component files are in PascalCase and the names of others files are in kebab-case. The scaffolding should be the same for every component. For instance, for the `Badge` component, it looks like this:
109
+
110
+ ```
111
+ badge/
112
+ __snapshots__/
113
+ Badge.stories.tsx
114
+ Badge.test.tsx
115
+ Badge.tsx
116
+ index.ts
117
+ styles.ts
118
+ types.ts
119
+ ```
120
+
121
+ See the Typescript section to see what to put inside the `types.ts` file.
122
+
123
+ See the Styling section to see what to put inside the `styles.ts` file.
124
+
125
+ The component should stricly follow the following structure:
126
+
127
+ ```ts
128
+ import React, { forwardRef, RefObject, useRef } from 'react';
129
+ import classNames from 'classnames';
130
+ import { Comp } from '../../types';
131
+ import { StyledBadge } from './styles';
132
+ import { BadgeProps } from './types';
133
+
134
+ const COMPONENT_NAME = 'Badge';
135
+ const CLASSNAME = 'redsift-badge';
136
+
137
+ /**
138
+ * The Badge component.
139
+ */
140
+ export const Badge: Comp<BadgeProps, HTMLDivElement> = forwardRef((props, ref) => {
141
+ const {
142
+ // props
143
+ ...forwardedProps
144
+ } = props;
145
+
146
+ return (
147
+ <StyledBadge
148
+ {...forwardedProps}
149
+ // transient props
150
+ className={classNames(Badge.className, `${Badge.className}-${variant}`, className)}
151
+ ref={ref as RefObject<HTMLDivElement>}
152
+ >
153
+ // content of the component if needed
154
+ </StyledBadge>
155
+ );
156
+ });
157
+ Badge.className = CLASSNAME;
158
+ Badge.displayName = COMPONENT_NAME;
159
+ ```
160
+
161
+ The main things to keep in mind here are:
162
+
163
+ - to use the custom `Comp` type,
164
+ - to forward ref and props,
165
+ - to concatenate classNames,
166
+ - to define default values and
167
+ - to use types from `types.ts` and styles from `styles.ts`.
168
+
169
+ ### API
170
+
171
+ The API of the components should be consistent with other components.
172
+
173
+ For instance, `isSelected` is the dedicated name for a prop indicating whether a component is selected or not. You should not use `selected` for instance. You could even be tempted to use `checked` or `isChecked` for a Checkbox component, but even if it can feel more suitable for this particular component, it creates inconsistencies among all components.
174
+
175
+ Try to think Design System when creating the API of your component. We want to provide visual options and variants for our components, but the possibilities should be limited.
176
+
177
+ ```ts
178
+ // don't
179
+ innerRadius?: number;
180
+ outerRadius?: number;
181
+ height?: number;
182
+ width?: number;
183
+
184
+ // do
185
+ size?: PieChartSize;
186
+ ```
187
+
188
+ To know how to define your API, to name and document your props, take a look at the existing components.
189
+
190
+ ## Linting
191
+
192
+ The code is linted with [eslint](https://eslint.org/). You can run the linter with:
193
+
194
+ ```bash
195
+ yarn lint
196
+ ```
197
+
198
+ Or for a specific package with:
199
+
200
+ ```bash
201
+ yarn lint:charts
202
+ yarn lint:dashboard
203
+ yarn lint:design-system
204
+ yarn lint:table
205
+ ```
206
+
207
+ ## Typing
208
+
209
+ The code is written in [TypeScript](https://www.typescriptlang.org/). The type checker will usually run in your editor, but also runs when you run:
210
+
211
+ ```bash
212
+ yarn check-types
213
+ ```
214
+
215
+ Or for a specific package with:
216
+
217
+ ```bash
218
+ yarn check-types:charts
219
+ yarn check-types:dashboard
220
+ yarn check-types:design-system
221
+ yarn check-types:table
222
+ ```
223
+
224
+ Types and interfaces are implemented inside `types.ts` files. Every shared type and interface should be placed inside a `types.ts` file at the root of the `src` folder of a component.
225
+
226
+ The `types.ts` file of a component should at minima export an interface for the component itself, named using the name of the component followed by `Props` (i.e. `BadgeProps`) and extending the HTML element it is based on (i.e. `React.ComponentProps<'div'>`). It should also export an interface for the main styled components it uses, using the same name prefixed by `Styled` (i.e. `StyledBadgeProps`). The props of the main interface **must** be documented with [jsdoc](https://jsdoc.app/) comments because this will be automatically parsed to fill the prop table inside the documentation website.
227
+
228
+ ```ts
229
+ /**
230
+ * Component props.
231
+ */
232
+ export interface BadgeProps extends ComponentProps<'div'> {
233
+ /** Badge variant. */
234
+ variant?: BadgeVariant;
235
+ }
236
+ ```
237
+
238
+ The styled component interface should be based on the main interface but omit every prop you don't want to forward to the rendered component. Every non native prop you need to use inside the styled component should be use as [transient props](https://styled-components.com/docs/api#transient-props) and therefore prefixed by a `$` character.
239
+
240
+ ```ts
241
+ export type StyledBadgeProps = Omit<BadgeProps, 'variant'> & {
242
+ $variant: BadgeProps['variant'];
243
+ };
244
+ ```
245
+
246
+ This file is also use to implement and export any other props you may need for your component like variant interface, color interface, etc.
247
+
248
+ ```ts
249
+ /**
250
+ * Component variant.
251
+ */
252
+ export const BadgeVariant = {
253
+ dot: 'dot',
254
+ standard: 'standard',
255
+ } as const;
256
+ export type BadgeVariant = ValueOf<typeof BadgeVariant>;
257
+ ```
258
+
259
+ The variants, colors and all other enum-based interfaces should be implemented exactly as above to make the property compatible with both the enum values and their string equivalent values. In this example, `BadgeVariant.standard` and `"standard"` are both valid values for the `variant` prop.
260
+
261
+ ## Styling
262
+
263
+ We use [styled-components](https://styled-components.com/) and [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) for styling. CSS variables are centralized through a [style dictionary](https://amzn.github.io/style-dictionary/#/).
264
+
265
+ The `styles.ts` of a component should contain all the styled-component codes. At least one main variable should be implemented and named using the name of the component prefixed by `Styled` (i.e. `StyledBadge`).
266
+
267
+ ```ts
268
+ /**
269
+ * Component style.
270
+ */
271
+ export const StyledBadge = styled.div<StyledBadgeProps>`
272
+ ${({ $color }) =>
273
+ $color
274
+ ? css`
275
+ color: var(--redsift-color-neutral-white);
276
+ background-color: var(--redsift-color-presentation-color-${$color}-standard);
277
+ `
278
+ : ''}
279
+ `;
280
+ ```
281
+
282
+ Make sure you are using the same HTML element for the styled component (i.e. `styled.div`) and the type interface (i.e. `ComponentProps<'div'>`). Type your variable with the interface you created in the `types.ts` file.
283
+
284
+ Make sure to use only [transient props](https://styled-components.com/docs/api#transient-props) and to use the styled-component's `css` helper when conditionnaly creating a new CSS block.
285
+
286
+ ## Accessibility
287
+
288
+ We are trying to make the Design System as accessible as possible by following the [Web Accessibility Initiative guidelines](https://www.w3.org/WAI/ARIA/apg/).
289
+
290
+ Before implementing a component, try to see if there is a [pattern](https://www.w3.org/WAI/ARIA/apg/patterns/) - or a composition of multiple patterns - that is suitable for this component and follow the guidelines.
291
+
292
+ However, before using any ARIA, [read this disclaimer carefully](https://www.w3.org/WAI/ARIA/apg/practices/read-me-first/).
293
+
294
+ ## Tests
295
+
296
+ We use [jest](https://jestjs.io/) for unit tests and [react-testing-library](https://testing-library.com/docs/react-testing-library/intro) for rendering and writing assertions. We also use [Storyshots](https://storybook.js.org/addons/@storybook/addon-storyshots) to automatically take a code snapshot of every story.
297
+
298
+ Please make sure you include tests with your pull requests. Our CI will run the tests on each PR. A minimum of 90% code coverage is required for statements, branches, functions and lines of every package. However, in practice, we try to reach a 100% code coverage.
299
+
300
+ We split the tests into 2 groups.
301
+
302
+ _Visual tests_
303
+
304
+ - A Storybook story should be written for each visual state that a component can be in (based on props).
305
+
306
+ _Unit tests_
307
+
308
+ - (Props) Anything that should be changed by a prop should be tested via react-testing-library.
309
+ - (Events) Anything that should trigger an event should be tested via react-testing-library.
310
+
311
+ You can run the tests with:
312
+
313
+ ```bash
314
+ yarn test
315
+ ```
316
+
317
+ Or for a specific package with:
318
+
319
+ ```bash
320
+ yarn test:charts
321
+ yarn test:design-system
322
+ yarn test:dashboard
323
+ yarn test:table
324
+ ```
325
+
326
+ Do not forget to update the snapshots with the `-u` option when you modify or create stories. However, you should **always** check the generated snapshots to see if they are correct. Do **not** blindly update the snapshots.
327
+
328
+ ## Storybook
329
+
330
+ We use [Storybook](https://storybooks.js.org) for local development. Run the following command to start it:
331
+
332
+ ```bash
333
+ yarn start:storybook
334
+ ```
335
+
336
+ Then, open [http://localhost:9000](http://localhost:9000) in your browser to play around with the components and test your changes.
337
+
338
+ You can use knobs and other storybook addons to create your stories. However, it is necessary to create stories covering all the options and variants of your component to generate snapshots.
339
+
340
+ Storybook is shared among every packages of the Design System. Follow the naming of the components that already exists in the same package to make sure it will appear in the correct section.
341
+
342
+ ## Documentation
343
+
344
+ We use a [Next.js](https://nextjs.org/) app with [MDX](https://mdxjs.com/) support as a documentation and demonstration site for the Design System. This app can be run as following:
345
+
346
+ ```bash
347
+ yarn dev:website
348
+ ```
349
+
350
+ Then, open [http://localhost:3000](http://localhost:3000) in your browser.
351
+
352
+ To add documentation for a component, a MDX file should be created in the `apps/website/pages/` folder and more precisely inside the subfolder corresponding to the section the page belongs to (i.e. `apps/website/pages/forms/checkbox.mdx` for the `Checkbox` component inside the `Forms` section).
353
+
354
+ To appear in the website's Side Panel, the page should be listed in `apps/website/components/CustomAppSidePanel/CustomAppSidePanel.tsx`) under the corresponding section.
355
+
356
+ A component page should be structured as following:
357
+
358
+ - **Introduction**
359
+ - **Installation**: explains which package to install and how
360
+ - **Usage**: explains how to import the component
361
+ - **Example**: explains the simplest example of usage for the component
362
+ - **Content** (optional): explains what the component can contain, if it can (for instance, a CheckboxGroup can contain Checkboxes)
363
+ - **Labeling** (optional): explains how to label the component, with accessibility and internationalization concerns; should only be used when the label is the only accessibility concern for this component, if there is more, use the Accessbility section below instead
364
+ - **Value** (optional): explains the values and states a component can have; only used for form components
365
+ - **Data** (optional): explains how the data should be formatted to display the component; only used for charts, table and dashboard components
366
+ - **Events** (optional): explains the different events attached to the component, controlled and uncontrolled version, validation system, etc...
367
+ - **Accessibility** (optional): dedicated accessibility section when it goes beyond the labeling, for instance to give navigation advice, etc
368
+ - **Visual options**: displays all the visual options and variants of the component
369
+ - **Props**: displays a table of component props
370
+
371
+ To display a prop table, use the `PropsTable` component as following:
372
+
373
+ ```ts
374
+ <PropsTable component="Button" />
375
+ ```
376
+
377
+ To display a demo, first create a demo (a simple `tsx` file) in the demo folder (`apps/website/demo/`) inside a subfolder with the name of the component (i.e. `apps/website/demo/button/coloring` for a coloring demo of the `Button` component). Then use the `DemoBlock` as following:
378
+
379
+ ```ts
380
+ <DemoBlock withThemeSwitcher path="button/coloring" />
381
+ ```
382
+
383
+ To display simple code, use the `CodeBlock` as following:
384
+
385
+ ```ts
386
+ <CodeBlock
387
+ codeString={`
388
+ yarn add @redsift/design-system
389
+ `}
390
+ language="sh"
391
+ />
392
+ ```
393
+
394
+ ## Build
395
+
396
+ The Design System is built using [Rollup](https://rollupjs.org/guide/en/) inside the `dist` folder of each package by running the following command:
397
+
398
+ ```bash
399
+ yarn build
400
+ ```
401
+
402
+ Or for a specific package with:
403
+
404
+ ```bash
405
+ yarn build:charts
406
+ yarn build:dashboard
407
+ yarn build:design-system
408
+ yarn build:icons
409
+ yarn build:table
410
+ yarn build:products
411
+ ```
412
+
413
+ ## Publishing a release
414
+
415
+ ### Stable release
416
+
417
+ 1. Make sure you're on the release branch (ex: `release/vX.Y.Z`) and a PR is opened on Github
418
+ 2. Login to NPM with an authorized account: `npm login`
419
+ 3. Make sure your packages are up to date: `yarn`
420
+ 4. Make sure the CI entirely passed on Github
421
+ 5. (Optional) Make sure the build doesn't crash locally: `yarn build:design-system`
422
+ 6. Publish the packages to NPM: `yarn release vX.Y.Z`
423
+
424
+ ### Alpha release
425
+
426
+ If you need to test your contribution in a product before releasing -and you're not using `yarn link`, you can create an alpha release using the following process:
427
+
428
+ 1. Create an alpha release branch (ex: `release/vX.Y.Z-alpha.N`) based on `release/vX.Y.Z`
429
+ 2. Push it to remote (`git push origin release/vX.Y.Z-alpha.N`)
430
+ 3. Login to NPM with an authorized account: `npm login`
431
+ 4. Make sure your packages are up to date: `yarn`
432
+ 5. (Optional) Make sure the build doesn't crash: `yarn build:design-system`
433
+ 6. Publish the packages to NPM: `yarn release --dist-tag alpha vX.Y.Z-alpha.N`
434
+
435
+ After that if you need to make modification to your contribution, go back to `release/vX.Y.Z` and make the necessary modifications. Then remove the alpha release branch, and redo the process from step 1, incrementing `N` by 1.
@@ -0,0 +1,3 @@
1
+ export { B as BaseButton, a as BaseCheckbox, b as BaseIcon, c as BaseIconButton, m as muiIconToDSIcon } from './BaseIconButton.js';
2
+ export { B as BaseTextField } from './BaseTextField.js';
3
+ //# sourceMappingURL=BaseComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseComponents.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,126 @@
1
+ import { a as _objectWithoutProperties, b as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default, { forwardRef } from 'react';
3
+ import { ButtonsColorPalette, IconButton, Button, Checkbox, Icon } from '@redsift/design-system';
4
+ import { mdiFilterVariant, mdiViewColumn, mdiArrowUp, mdiArrowDown, mdiViewHeadline, mdiViewSequential, mdiViewStream, mdiChevronDown, mdiChevronRight, mdiTrayArrowDown } from '@redsift/icons';
5
+
6
+ const _excluded$3 = ["children", "color", "onClick", "startIcon"];
7
+ const BaseButton = /*#__PURE__*/forwardRef((props, ref) => {
8
+ var _props$className;
9
+ const {
10
+ children,
11
+ color: propsColor,
12
+ onClick,
13
+ startIcon
14
+ } = props,
15
+ forwardedProps = _objectWithoutProperties(props, _excluded$3);
16
+ const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
17
+ if ((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('redsift-condensed')) {
18
+ return /*#__PURE__*/React__default.createElement(IconButton, _extends({}, forwardedProps, {
19
+ color: color,
20
+ onClick: onClick,
21
+ ref: ref,
22
+ variant: "unstyled",
23
+ isActive: props['aria-expanded'] === 'true',
24
+ icon: typeof startIcon !== 'string' ? /*#__PURE__*/React__default.cloneElement(startIcon, {
25
+ fontSize: 'medium'
26
+ }) : startIcon,
27
+ "aria-label": children,
28
+ size: "medium"
29
+ }));
30
+ }
31
+ return /*#__PURE__*/React__default.createElement(Button, _extends({}, forwardedProps, {
32
+ color: color,
33
+ onClick: onClick,
34
+ ref: ref,
35
+ variant: "unstyled",
36
+ isActive: props['aria-expanded'] === 'true',
37
+ leftIcon: startIcon
38
+ }), children);
39
+ });
40
+
41
+ const _excluded$2 = ["checked", "indeterminate", "disabled", "onChange", "label", "slotProps", "material", "field", "isSelected", "inputProps", "touchRippleRef"];
42
+ const BaseCheckbox = /*#__PURE__*/forwardRef((props, ref) => {
43
+ const {
44
+ checked,
45
+ indeterminate,
46
+ disabled,
47
+ onChange,
48
+ label,
49
+ // MUI DataGrid v8 injects these props — strip them to avoid DOM warnings
50
+ slotProps,
51
+ material,
52
+ field,
53
+ isSelected,
54
+ inputProps,
55
+ touchRippleRef
56
+ } = props,
57
+ forwardedProps = _objectWithoutProperties(props, _excluded$2);
58
+ return /*#__PURE__*/React__default.createElement(Checkbox, _extends({}, forwardedProps, inputProps, {
59
+ isSelected: checked && !indeterminate,
60
+ isDisabled: disabled,
61
+ isIndeterminate: indeterminate,
62
+ ref: ref,
63
+ onChange: (isChecked, value, name, event) => onChange(event),
64
+ "aria-label": label || 'Select row'
65
+ }), label);
66
+ });
67
+
68
+ const _excluded$1 = ["displayName"];
69
+ const muiIconToDSIcon = {
70
+ columnFilteredIcon: mdiFilterVariant,
71
+ columnSelectorIcon: mdiViewColumn,
72
+ columnSortedAscendingIcon: mdiArrowUp,
73
+ columnSortedDescendingIcon: mdiArrowDown,
74
+ densityCompactIcon: mdiViewHeadline,
75
+ densityStandardIcon: mdiViewSequential,
76
+ densityComfortableIcon: mdiViewStream,
77
+ detailPanelCollapseIcon: mdiChevronDown,
78
+ detailPanelExpandIcon: mdiChevronRight,
79
+ exportIcon: mdiTrayArrowDown,
80
+ openFilterButtonIcon: mdiFilterVariant
81
+ };
82
+ const BaseIcon = /*#__PURE__*/forwardRef((props, ref) => {
83
+ const {
84
+ displayName
85
+ } = props,
86
+ forwardedProps = _objectWithoutProperties(props, _excluded$1);
87
+ return /*#__PURE__*/React__default.createElement(Icon, _extends({}, forwardedProps, forwardedProps.inputProps, {
88
+ ref: ref,
89
+ size: forwardedProps.fontSize,
90
+ icon: muiIconToDSIcon[displayName]
91
+ }));
92
+ });
93
+
94
+ const _excluded = ["children", "color", "onClick", "field"];
95
+ const BaseIconButton = /*#__PURE__*/forwardRef((props, ref) => {
96
+ const {
97
+ children,
98
+ color: propsColor,
99
+ onClick,
100
+ field
101
+ } = props,
102
+ forwardedProps = _objectWithoutProperties(props, _excluded);
103
+ const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
104
+
105
+ // MUI passes the icon as children (already rendered), but DS IconButton expects an icon prop
106
+ // We pass children directly as the icon - the Icon component can handle ReactElements
107
+ return /*#__PURE__*/React__default.createElement(IconButton, _extends({}, forwardedProps, {
108
+ color: color,
109
+ onClick: onClick,
110
+ ref: ref,
111
+ variant: "unstyled",
112
+ isActive: props['aria-expanded'] === 'true',
113
+ icon: children,
114
+ size: "medium",
115
+ iconProps: {
116
+ style: {
117
+ display: 'flex',
118
+ alignItems: 'center',
119
+ justifyContent: 'center'
120
+ }
121
+ }
122
+ }));
123
+ });
124
+
125
+ export { BaseButton as B, BaseCheckbox as a, BaseIcon as b, BaseIconButton as c, muiIconToDSIcon as m };
126
+ //# sourceMappingURL=BaseIconButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseIconButton.js","sources":["../../src/components/BaseComponents/BaseButton.tsx","../../src/components/BaseComponents/BaseCheckbox.tsx","../../src/components/BaseComponents/BaseIcon.tsx","../../src/components/BaseComponents/BaseIconButton.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\nimport { Button, ButtonsColorPalette, IconButton } from '@redsift/design-system';\n\nexport const BaseButton: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const { children, color: propsColor, onClick, startIcon, ...forwardedProps } = props;\n\n const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';\n\n if (props.className?.includes('redsift-condensed')) {\n return (\n <IconButton\n {...forwardedProps}\n color={color}\n onClick={onClick}\n ref={ref}\n variant=\"unstyled\"\n isActive={props['aria-expanded'] === 'true'}\n icon={typeof startIcon !== 'string' ? React.cloneElement(startIcon, { fontSize: 'medium' }) : startIcon}\n aria-label={children}\n size=\"medium\"\n />\n );\n }\n\n return (\n <Button\n {...forwardedProps}\n color={color}\n onClick={onClick}\n ref={ref}\n variant=\"unstyled\"\n isActive={props['aria-expanded'] === 'true'}\n leftIcon={startIcon}\n >\n {children}\n </Button>\n );\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React, { forwardRef, MutableRefObject } from 'react';\nimport { Checkbox } from '@redsift/design-system';\n\nexport const BaseCheckbox: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const {\n checked,\n indeterminate,\n disabled,\n onChange,\n label,\n // MUI DataGrid v8 injects these props — strip them to avoid DOM warnings\n slotProps,\n material,\n field,\n isSelected,\n inputProps,\n touchRippleRef,\n ...forwardedProps\n } = props;\n\n return (\n <Checkbox\n {...forwardedProps}\n {...inputProps}\n isSelected={checked && !indeterminate}\n isDisabled={disabled}\n isIndeterminate={indeterminate}\n ref={ref as MutableRefObject<HTMLLabelElement>}\n onChange={(isChecked, value, name, event) => onChange(event)}\n aria-label={label || 'Select row'}\n >\n {label}\n </Checkbox>\n );\n});\n","import React, { forwardRef } from 'react';\nimport { Icon } from '@redsift/design-system';\nimport {\n mdiArrowDown,\n mdiArrowUp,\n mdiChevronDown,\n mdiChevronRight,\n mdiFilterVariant,\n mdiTrayArrowDown,\n mdiViewColumn,\n mdiViewHeadline,\n mdiViewSequential,\n mdiViewStream,\n} from '@redsift/icons';\nimport { GridSlotsComponent } from '@mui/x-data-grid-pro';\n\nexport const muiIconToDSIcon: Partial<Record<keyof GridSlotsComponent, string>> = {\n columnFilteredIcon: mdiFilterVariant,\n columnSelectorIcon: mdiViewColumn,\n columnSortedAscendingIcon: mdiArrowUp,\n columnSortedDescendingIcon: mdiArrowDown,\n densityCompactIcon: mdiViewHeadline,\n densityStandardIcon: mdiViewSequential,\n densityComfortableIcon: mdiViewStream,\n detailPanelCollapseIcon: mdiChevronDown,\n detailPanelExpandIcon: mdiChevronRight,\n exportIcon: mdiTrayArrowDown,\n openFilterButtonIcon: mdiFilterVariant,\n};\n\nexport const BaseIcon: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const { displayName, ...forwardedProps } = props;\n\n return (\n <Icon\n {...forwardedProps}\n {...forwardedProps.inputProps}\n ref={ref}\n size={forwardedProps.fontSize}\n icon={muiIconToDSIcon[displayName as keyof GridSlotsComponent]}\n />\n );\n});\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport React, { forwardRef } from 'react';\nimport { IconButton, ButtonsColorPalette } from '@redsift/design-system';\n\nexport const BaseIconButton: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const { children, color: propsColor, onClick, field, ...forwardedProps } = props;\n\n const color = Object.keys(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';\n\n // MUI passes the icon as children (already rendered), but DS IconButton expects an icon prop\n // We pass children directly as the icon - the Icon component can handle ReactElements\n return (\n <IconButton\n {...forwardedProps}\n color={color}\n onClick={onClick}\n ref={ref}\n variant=\"unstyled\"\n isActive={props['aria-expanded'] === 'true'}\n icon={children}\n size=\"medium\"\n iconProps={{ style: { display: 'flex', alignItems: 'center', justifyContent: 'center' } }}\n />\n );\n});\n"],"names":["BaseButton","forwardRef","props","ref","_props$className","children","color","propsColor","onClick","startIcon","forwardedProps","_objectWithoutProperties","_excluded","Object","keys","ButtonsColorPalette","includes","className","React","createElement","IconButton","_extends","variant","isActive","icon","cloneElement","fontSize","size","Button","leftIcon","BaseCheckbox","checked","indeterminate","disabled","onChange","label","slotProps","material","field","isSelected","inputProps","touchRippleRef","Checkbox","isDisabled","isIndeterminate","isChecked","value","name","event","muiIconToDSIcon","columnFilteredIcon","mdiFilterVariant","columnSelectorIcon","mdiViewColumn","columnSortedAscendingIcon","mdiArrowUp","columnSortedDescendingIcon","mdiArrowDown","densityCompactIcon","mdiViewHeadline","densityStandardIcon","mdiViewSequential","densityComfortableIcon","mdiViewStream","detailPanelCollapseIcon","mdiChevronDown","detailPanelExpandIcon","mdiChevronRight","exportIcon","mdiTrayArrowDown","openFilterButtonIcon","BaseIcon","displayName","Icon","BaseIconButton","iconProps","style","display","alignItems","justifyContent"],"mappings":";;;;;;AAGO,MAAMA,UAA4C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;AAAA,EAAA,IAAAC,gBAAA,CAAA;EACrF,MAAM;MAAEC,QAAQ;AAAEC,MAAAA,KAAK,EAAEC,UAAU;MAAEC,OAAO;AAAEC,MAAAA,SAAAA;AAA6B,KAAC,GAAGP,KAAK;AAAxBQ,IAAAA,cAAc,GAAAC,wBAAA,CAAKT,KAAK,EAAAU,WAAA,CAAA,CAAA;AAEpF,EAAA,MAAMN,KAAK,GAAGO,MAAM,CAACC,IAAI,CAACC,mBAAmB,CAAC,CAACC,QAAQ,CAACT,UAAU,CAAC,GAAGA,UAAU,GAAG,SAAS,CAAA;AAE5F,EAAA,IAAA,CAAAH,gBAAA,GAAIF,KAAK,CAACe,SAAS,MAAAb,IAAAA,IAAAA,gBAAA,KAAfA,KAAAA,CAAAA,IAAAA,gBAAA,CAAiBY,QAAQ,CAAC,mBAAmB,CAAC,EAAE;IAClD,oBACEE,cAAA,CAAAC,aAAA,CAACC,UAAU,EAAAC,QAAA,KACLX,cAAc,EAAA;AAClBJ,MAAAA,KAAK,EAAEA,KAAM;AACbE,MAAAA,OAAO,EAAEA,OAAQ;AACjBL,MAAAA,GAAG,EAAEA,GAAI;AACTmB,MAAAA,OAAO,EAAC,UAAU;AAClBC,MAAAA,QAAQ,EAAErB,KAAK,CAAC,eAAe,CAAC,KAAK,MAAO;MAC5CsB,IAAI,EAAE,OAAOf,SAAS,KAAK,QAAQ,gBAAGS,cAAK,CAACO,YAAY,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AEC,OAAO;AAAE8B,MAAAA,KAAAA;AAAyB,KAAC,GAAGpC,KAAK;AAAxBQ,IAAAA,cAAc,GAAAC,wBAAA,CAAKT,KAAK,EAAAU,SAAA,CAAA,CAAA;AAEhF,EAAA,MAAMN,KAAK,GAAGO,MAAM,CAACC,IAAI,CAACC,mBAAmB,CAAC,CAACC,QAAQ,CAACT,UAAU,CAAC,GAAGA,UAAU,GAAG,SAAS,CAAA;;AAE5F;AACA;EACA,oBACEW,cAAA,CAAAC,aAAA,CAACC,UAAU,EAAAC,QAAA,KACLX,cAAc,EAAA;AAClBJ,IAAAA,KAAK,EAAEA,KAAM;AACbE,IAAAA,OAAO,EAAEA,OAAQ;AACjBL,IAAAA,GAAG,EAAEA,GAAI;AACTmB,IAAAA,OAAO,EAAC,UAAU;AAClBC,IAAAA,QAAQ,EAAErB,KAAK,CAAC,eAAe,CAAC,KAAK,MAAO;AAC5CsB,IAAAA,IAAI,EAAEnB,QAAS;AACfsB,IAAAA,IAAI,EAAC,QAAQ;AACbgD,IAAAA,SAAS,EAAE;AAAEC,MAAAA,KAAK,EAAE;AAAEC,QAAAA,OAAO,EAAE,MAAM;AAAEC,QAAAA,UAAU,EAAE,QAAQ;AAAEC,QAAAA,cAAc,EAAE,QAAA;AAAS,OAAA;AAAE,KAAA;AAAE,GAAA,CAC3F,CAAC,CAAA;AAEN,CAAC;;;;"}
@@ -0,0 +1,26 @@
1
+ import React__default, { forwardRef } from 'react';
2
+ import { TextField } from '@redsift/design-system';
3
+
4
+ const BaseTextField = /*#__PURE__*/forwardRef((props, ref) => {
5
+ const {
6
+ label,
7
+ id,
8
+ value,
9
+ onChange,
10
+ placeholder
11
+ } = props;
12
+ return /*#__PURE__*/React__default.createElement(TextField, {
13
+ marginTop: "6px",
14
+ inputRef: ref,
15
+ label: label,
16
+ id: id,
17
+ value: value,
18
+ variant: "underline",
19
+ onChange: (value, name, event) => onChange(event),
20
+ autoFocus: true,
21
+ placeholder: placeholder
22
+ });
23
+ });
24
+
25
+ export { BaseTextField as B };
26
+ //# sourceMappingURL=BaseTextField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseTextField.js","sources":["../../src/components/BaseComponents/BaseTextField.tsx"],"sourcesContent":["import React, { forwardRef, MutableRefObject } from 'react';\nimport { TextField } from '@redsift/design-system';\n\nexport const BaseTextField: React.JSXElementConstructor<any> = forwardRef((props, ref) => {\n const { label, id, value, onChange, placeholder } = props;\n return (\n <TextField\n marginTop=\"6px\"\n inputRef={ref as MutableRefObject<HTMLInputElement>}\n label={label}\n id={id}\n value={value}\n variant=\"underline\"\n onChange={(value, name, event) => onChange(event)}\n autoFocus\n placeholder={placeholder}\n />\n );\n});\n"],"names":["BaseTextField","forwardRef","props","ref","label","id","value","onChange","placeholder","React","createElement","TextField","marginTop","inputRef","variant","name","event","autoFocus"],"mappings":";;;AAGO,MAAMA,aAA+C,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACxF,MAAM;IAAEC,KAAK;IAAEC,EAAE;IAAEC,KAAK;IAAEC,QAAQ;AAAEC,IAAAA,WAAAA;AAAY,GAAC,GAAGN,KAAK,CAAA;AACzD,EAAA,oBACEO,cAAA,CAAAC,aAAA,CAACC,SAAS,EAAA;AACRC,IAAAA,SAAS,EAAC,KAAK;AACfC,IAAAA,QAAQ,EAAEV,GAA0C;AACpDC,IAAAA,KAAK,EAAEA,KAAM;AACbC,IAAAA,EAAE,EAAEA,EAAG;AACPC,IAAAA,KAAK,EAAEA,KAAM;AACbQ,IAAAA,OAAO,EAAC,WAAW;IACnBP,QAAQ,EAAEA,CAACD,KAAK,EAAES,IAAI,EAAEC,KAAK,KAAKT,QAAQ,CAACS,KAAK,CAAE;IAClDC,SAAS,EAAA,IAAA;AACTT,IAAAA,WAAW,EAAEA,WAAAA;AAAY,GAC1B,CAAC,CAAA;AAEN,CAAC;;;;"}
@@ -0,0 +1,2 @@
1
+ export { D as DataGrid } from './DataGrid2.js';
2
+ //# sourceMappingURL=DataGrid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataGrid.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}