@redsift/pickers 8.1.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.
@@ -0,0 +1,415 @@
1
+ # Contribute
2
+
3
+ ## Develop
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/). Due to the use of advanced features, a [premium license](https://mui.com/x/introduction/licensing/#premium-plan) 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
+ - _Deprecated_ `@redsift/design-system-legacy`
62
+
63
+ This package contains all components prior to the 6.0.0 version. These components are deprecated and contributing to this package is discouraged since it will be removed in the future.
64
+
65
+ Please make sure to work inside the correct package when making contribution.
66
+
67
+ ### Shared code
68
+
69
+ 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.
70
+
71
+ 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`.
72
+
73
+ 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.
74
+
75
+ ```ts
76
+ // Even if PieChartVariant is implemented inside the charts package, the following code is not practical
77
+ import { PieChartVariant } from '@redsift/charts';
78
+ import { PieChart } from '@redsift/dashbord';
79
+
80
+ // Reexporting it from the dashboard package makes it really easier
81
+ import { PieChart, PieChartVariant } from '@redsift/dashbord';
82
+ ```
83
+
84
+ To define which package should contain the shared code, select the one that would not create any circular dependencies.
85
+
86
+ ### Dependencies
87
+
88
+ We try to use as few dependencies as possible.
89
+
90
+ 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.
91
+
92
+ 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.
93
+
94
+ When dependencies are required, we try not to import them entirely to optimise the tree-shaking of the Design System.
95
+
96
+ ```ts
97
+ // don't
98
+ import * as d3 from 'd3';
99
+
100
+ // do
101
+ import { sum, scaleOrdinal } from 'd3';
102
+ ```
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
+ const DEFAULT_PROPS: Partial<BadgeProps> = {
137
+ // default values
138
+ };
139
+
140
+ /**
141
+ * The Badge component.
142
+ */
143
+ export const Badge: Comp<BadgeProps, HTMLDivElement> = forwardRef((props, ref) => {
144
+ const {
145
+ // props
146
+ ...forwardedProps
147
+ } = props;
148
+
149
+ return (
150
+ <StyledBadge
151
+ {...forwardedProps}
152
+ // transient props
153
+ className={classNames(Badge.className, `${Badge.className}-${variant}`, className)}
154
+ ref={ref as RefObject<HTMLDivElement>}
155
+ >
156
+ // content of the component if needed
157
+ </StyledBadge>
158
+ );
159
+ });
160
+ Badge.className = CLASSNAME;
161
+ Badge.defaultProps = DEFAULT_PROPS;
162
+ Badge.displayName = COMPONENT_NAME;
163
+ ```
164
+
165
+ The main things to keep in mind here are:
166
+
167
+ - to use the custom `Comp` type,
168
+ - to forward ref and props,
169
+ - to concatenate classNames,
170
+ - to define default values and
171
+ - to use types from `types.ts` and styles from `styles.ts`.
172
+
173
+ ### API
174
+
175
+ The API of the components should be consistent with other components.
176
+
177
+ 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.
178
+
179
+ 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.
180
+
181
+ ```ts
182
+ // don't
183
+ innerRadius?: number;
184
+ outerRadius?: number;
185
+ height?: number;
186
+ width?: number;
187
+
188
+ // do
189
+ size?: PieChartSize;
190
+ ```
191
+
192
+ To know how to define your API, to name and document your props, take a look at the existing components.
193
+
194
+ ## Tests
195
+
196
+ 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.
197
+
198
+ 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.
199
+
200
+ We split the tests into 2 groups.
201
+
202
+ _Visual tests_
203
+
204
+ - A Storybook story should be written for each visual state that a component can be in (based on props).
205
+
206
+ _Unit tests_
207
+
208
+ - (Props) Anything that should be changed by a prop should be tested via react-testing-library.
209
+ - (Events) Anything that should trigger an event should be tested via react-testing-library.
210
+
211
+ You can run the tests with:
212
+
213
+ ```bash
214
+ yarn test
215
+ ```
216
+
217
+ Or for a specific package with:
218
+
219
+ ```bash
220
+ yarn test:charts
221
+ yarn test:design-system
222
+ yarn test:dashboard
223
+ yarn test:table
224
+ ```
225
+
226
+ 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.
227
+
228
+ ## Linting
229
+
230
+ The code is linted with [eslint](https://eslint.org/). You can run the linter with:
231
+
232
+ ```bash
233
+ yarn lint
234
+ ```
235
+
236
+ Or for a specific package with:
237
+
238
+ ```bash
239
+ yarn lint:charts
240
+ yarn lint:dashboard
241
+ yarn lint:design-system
242
+ yarn lint:table
243
+ ```
244
+
245
+ ## TypeScript
246
+
247
+ 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:
248
+
249
+ ```bash
250
+ yarn check-types
251
+ ```
252
+
253
+ Or for a specific package with:
254
+
255
+ ```bash
256
+ yarn check-types:charts
257
+ yarn check-types:dashboard
258
+ yarn check-types:design-system
259
+ yarn check-types:table
260
+ ```
261
+
262
+ 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.
263
+
264
+ 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.
265
+
266
+ ```ts
267
+ /**
268
+ * Component props.
269
+ */
270
+ export interface BadgeProps extends ComponentProps<'div'> {
271
+ /** Badge variant. */
272
+ variant?: BadgeVariant;
273
+ }
274
+ ```
275
+
276
+ 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.
277
+
278
+ ```ts
279
+ export type StyledBadgeProps = Omit<BadgeProps, 'variant'> & {
280
+ $variant: BadgeProps['variant'];
281
+ };
282
+ ```
283
+
284
+ This file is also use to implement and export any other props you may need for your component like variant interface, color interface, etc.
285
+
286
+ ```ts
287
+ /**
288
+ * Component variant.
289
+ */
290
+ export const BadgeVariant = {
291
+ dot: 'dot',
292
+ standard: 'standard',
293
+ } as const;
294
+ export type BadgeVariant = ValueOf<typeof BadgeVariant>;
295
+ ```
296
+
297
+ 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.
298
+
299
+ ## Styling
300
+
301
+ 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/#/).
302
+
303
+ 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`).
304
+
305
+ ```ts
306
+ /**
307
+ * Component style.
308
+ */
309
+ export const StyledBadge = styled.div<StyledBadgeProps>`
310
+ ${({ $color }) =>
311
+ $color
312
+ ? css`
313
+ color: var(--redsift-color-neutral-white);
314
+ background-color: var(--redsift-color-${$color}-primary);
315
+ `
316
+ : ''}
317
+ `;
318
+ ```
319
+
320
+ 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.
321
+
322
+ 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.
323
+
324
+ ## Accessibility
325
+
326
+ 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/).
327
+
328
+ 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.
329
+
330
+ However, before using any ARIA, [read this disclaimer carefully](https://www.w3.org/WAI/ARIA/apg/practices/read-me-first/).
331
+
332
+ ## Storybook
333
+
334
+ We use [Storybook](https://storybooks.js.org) for local development. Run the following command to start it:
335
+
336
+ ```bash
337
+ yarn start:storybook
338
+ ```
339
+
340
+ Then, open [http://localhost:9000](http://localhost:9000) in your browser to play around with the components and test your changes.
341
+
342
+ 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.
343
+
344
+ 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.
345
+
346
+ ## Documentation
347
+
348
+ 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:
349
+
350
+ ```bash
351
+ yarn dev:website
352
+ ```
353
+
354
+ Then, open [http://localhost:3000](http://localhost:3000) in your browser.
355
+
356
+ 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).
357
+
358
+ To appear in the website's Side Panel, the page should be listed in `apps/website/components/CustomAppSidePanel/CustomAppSidePanel.tsx`) under the corresponding section.
359
+
360
+ A component page should be structured as following:
361
+
362
+ - **Introduction**
363
+ - **Installation**: explains which package to install and how
364
+ - **Usage**: explains how to import the component
365
+ - **Example**: explains the simplest example of usage for the component
366
+ - **Content** (optional): explains what the component can contain, if it can (for instance, a CheckboxGroup can contain Checkboxes)
367
+ - **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
368
+ - **Value** (optional): explains the values and states a component can have; only used for form components
369
+ - **Data** (optional): explains how the data should be formatted to display the component; only used for charts, table and dashboard components
370
+ - **Events** (optional): explains the different events attached to the component, controlled and uncontrolled version, validation system, etc...
371
+ - **Accessibility** (optional): dedicated accessibility section when it goes beyond the labeling, for instance to give navigation advice, etc
372
+ - **Visual options**: displays all the visual options and variants of the component
373
+ - **Props**: displays a table of component props
374
+
375
+ To display a prop table, use the `PropsTable` component as following:
376
+
377
+ ```ts
378
+ <PropsTable component="Button" />
379
+ ```
380
+
381
+ 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:
382
+
383
+ ```ts
384
+ <DemoBlock path="button/coloring" />
385
+ ```
386
+
387
+ To display simple code, use the `CodeBlock` as following:
388
+
389
+ ```ts
390
+ <CodeBlock
391
+ codeString={`
392
+ yarn add @redsift/design-system
393
+ `}
394
+ language="sh"
395
+ />
396
+ ```
397
+
398
+ ## Build
399
+
400
+ The Design System is built using [Rollup](https://rollupjs.org/guide/en/) inside the `dist` folder of each package by running the following command:
401
+
402
+ ```bash
403
+ yarn build
404
+ ```
405
+
406
+ Or for a specific package with:
407
+
408
+ ```bash
409
+ yarn build:charts
410
+ yarn build:dashboard
411
+ yarn build:design-system
412
+ yarn build:icons
413
+ yarn build:legacy
414
+ yarn build:table
415
+ ```
package/index.d.ts ADDED
@@ -0,0 +1,236 @@
1
+ import * as _redsift_design_system from '@redsift/design-system';
2
+ import { TextProps, ContainerProps, Comp, FlexboxProps } from '@redsift/design-system';
3
+ import { PopoverProps, PopoverContentProps, PopoverTriggerProps } from '@redsift/popovers';
4
+ import React, { ReactElement, ComponentProps, ReactNode } from 'react';
5
+
6
+ /**
7
+ * Context props.
8
+ */
9
+ type ComboboxState = {
10
+ /** Filtering parameters. */
11
+ readonly filter?: {
12
+ type: 'startsWith' | 'contains' | 'endsWith';
13
+ caseSensitive?: boolean;
14
+ };
15
+ /** Whether the combobox is disabled or not. */
16
+ readonly isDisabled: boolean;
17
+ /** Whether the combobox is invalid or not. */
18
+ readonly isInvalid: boolean;
19
+ /** Sets the selected value. */
20
+ setValue(value: string): void;
21
+ /** Current selected value. */
22
+ readonly value: string;
23
+ };
24
+ /**
25
+ * Component props.
26
+ */
27
+ interface ComboboxProps extends PopoverProps {
28
+ /**
29
+ * Default selected value.
30
+ * Used for uncontrolled version.
31
+ */
32
+ defaultValue?: string;
33
+ /** Description of the combobox. */
34
+ description?: string | ReactElement;
35
+ /** Additional description properties. */
36
+ descriptionProps?: Omit<TextProps, 'ref'>;
37
+ /** Filtering parameters. */
38
+ filter?: {
39
+ type: 'startsWith' | 'contains' | 'endsWith';
40
+ caseSensitive?: boolean;
41
+ };
42
+ /** Whether the component is disabled or not. */
43
+ isDisabled?: boolean;
44
+ /** Whether the component is invalid or not. */
45
+ isInvalid?: boolean;
46
+ /** Method to handle component change. */
47
+ onChange?(value: string): void;
48
+ /**
49
+ * Currently selected value.
50
+ * Used for controlled version.
51
+ */
52
+ value?: string;
53
+ }
54
+ type StyledComboboxProps = ComboboxProps;
55
+
56
+ /**
57
+ * Component props.
58
+ */
59
+ interface ComboboxContentFooterProps extends ComponentProps<'div'>, ContainerProps {
60
+ }
61
+ type StyledComboboxContentFooterProps = ComboboxContentFooterProps & {};
62
+
63
+ /**
64
+ * The ComboboxContentFooter component.
65
+ */
66
+ declare const ComboboxContentFooter: Comp<ComboboxContentFooterProps, HTMLDivElement>;
67
+
68
+ /**
69
+ * Component props.
70
+ */
71
+ interface ComboboxContentListboxProps extends FlexboxProps {
72
+ }
73
+
74
+ /**
75
+ * The ComboboxContentListbox component.
76
+ */
77
+ declare const ComboboxContentListbox: Comp<ComboboxContentListboxProps, HTMLDivElement>;
78
+
79
+ /**
80
+ * Component props.
81
+ */
82
+ interface ComboboxContentHeaderProps extends ComponentProps<'div'>, ContainerProps {
83
+ }
84
+ type StyledComboboxContentHeaderProps = ComboboxContentHeaderProps & {};
85
+
86
+ /**
87
+ * The ComboboxContentHeader component.
88
+ */
89
+ declare const ComboboxContentHeader: Comp<ComboboxContentHeaderProps, HTMLDivElement>;
90
+
91
+ /**
92
+ * Component props.
93
+ */
94
+ interface ComboboxContentProps extends PopoverContentProps {
95
+ /** Whether the popover should stay open even if there is no result after filter. */
96
+ shouldStayOpenEvenIfEmpty?: boolean;
97
+ }
98
+
99
+ /**
100
+ * The ComboboxContent component.
101
+ */
102
+ declare const BaseComboboxContent: Comp<ComboboxContentProps, HTMLDivElement>;
103
+ declare const ComboboxContent: Comp<ComboboxContentProps, HTMLDivElement> & {
104
+ Header: Comp<ComboboxContentHeaderProps, HTMLDivElement>;
105
+ Listbox: Comp<ComboboxContentListboxProps, HTMLDivElement>;
106
+ Footer: Comp<ComboboxContentFooterProps, HTMLDivElement>;
107
+ };
108
+
109
+ /**
110
+ * Component props.
111
+ */
112
+ interface ComboboxTriggerProps extends Omit<PopoverTriggerProps, 'children'> {
113
+ /** Children */
114
+ children: ReactElement | ((state: {
115
+ value?: string;
116
+ isOpen?: boolean;
117
+ }) => ReactElement);
118
+ /** Whether or not the expand/collapse icon button should be displayed or not. */
119
+ hideExpandButton?: boolean;
120
+ /** Whether the popover should open on focus. */
121
+ openOnFocus?: boolean;
122
+ /** Method used to customize the content of the Button. */
123
+ render?: (value: string) => ReactNode;
124
+ }
125
+
126
+ /**
127
+ * The ComboboxTrigger component.
128
+ */
129
+ declare const ComboboxTrigger: Comp<ComboboxTriggerProps, HTMLButtonElement>;
130
+
131
+ /**
132
+ * The Combobox component.
133
+ */
134
+ declare const BaseCombobox: React.FC<ComboboxProps> & {
135
+ displayName?: string;
136
+ className?: string;
137
+ };
138
+ declare const Combobox: React.FC<ComboboxProps> & {
139
+ displayName?: string | undefined;
140
+ className?: string | undefined;
141
+ } & {
142
+ Trigger: _redsift_design_system.Comp<ComboboxTriggerProps, HTMLButtonElement>;
143
+ Content: _redsift_design_system.Comp<ComboboxContentProps, HTMLDivElement> & {
144
+ Header: _redsift_design_system.Comp<ComboboxContentHeaderProps, HTMLDivElement>;
145
+ Listbox: _redsift_design_system.Comp<ComboboxContentListboxProps, HTMLDivElement>;
146
+ Footer: _redsift_design_system.Comp<ComboboxContentFooterProps, HTMLDivElement>;
147
+ };
148
+ };
149
+
150
+ /**
151
+ * Context props.
152
+ */
153
+ type SelectState = {
154
+ /** Whether the select is disabled or not. */
155
+ readonly isDisabled: boolean;
156
+ /** Whether the select is invalid or not. */
157
+ readonly isInvalid: boolean;
158
+ /** Sets the selected value. */
159
+ setValue(value: string): void;
160
+ /** Current selected value. */
161
+ readonly value: string;
162
+ };
163
+ /**
164
+ * Component props.
165
+ */
166
+ interface SelectProps extends PopoverProps {
167
+ /**
168
+ * Default selected value.
169
+ * Used for uncontrolled version.
170
+ */
171
+ defaultValue?: string;
172
+ /** Description of the select. */
173
+ description?: string | ReactElement;
174
+ /** Additional description properties. */
175
+ descriptionProps?: Omit<TextProps, 'ref'>;
176
+ /** Whether the component is disabled or not. */
177
+ isDisabled?: boolean;
178
+ /** Whether the component is invalid or not. */
179
+ isInvalid?: boolean;
180
+ /** Label of the select. */
181
+ label?: string | ReactElement;
182
+ /** Additional label properties. */
183
+ labelProps?: Omit<TextProps, 'ref'>;
184
+ /** Method to handle component change. */
185
+ onChange?(value: string): void;
186
+ /**
187
+ * Currently selected value.
188
+ * Used for controlled version.
189
+ */
190
+ value?: string;
191
+ }
192
+ type StyledSelectProps = SelectProps;
193
+
194
+ /**
195
+ * Component props.
196
+ */
197
+ interface SelectContentProps extends PopoverContentProps {
198
+ }
199
+
200
+ /**
201
+ * The SelectContent component.
202
+ */
203
+ declare const SelectContent: Comp<SelectContentProps, HTMLDivElement>;
204
+
205
+ /**
206
+ * Component props.
207
+ */
208
+ interface SelectTriggerProps extends Omit<PopoverTriggerProps, 'children'> {
209
+ /** Children */
210
+ children: ReactElement | ((state: {
211
+ value?: string;
212
+ isOpen?: boolean;
213
+ }) => ReactElement);
214
+ }
215
+
216
+ /**
217
+ * The SelectTrigger component.
218
+ */
219
+ declare const SelectTrigger: Comp<SelectTriggerProps, HTMLButtonElement>;
220
+
221
+ /**
222
+ * The Select component.
223
+ */
224
+ declare const BaseSelect: React.FC<SelectProps> & {
225
+ displayName?: string;
226
+ className?: string;
227
+ };
228
+ declare const Select: React.FC<SelectProps> & {
229
+ displayName?: string | undefined;
230
+ className?: string | undefined;
231
+ } & {
232
+ Trigger: _redsift_design_system.Comp<SelectTriggerProps, HTMLButtonElement>;
233
+ Content: _redsift_design_system.Comp<SelectContentProps, HTMLDivElement>;
234
+ };
235
+
236
+ export { BaseCombobox, BaseComboboxContent, BaseSelect, Combobox, ComboboxContent, ComboboxContentFooter, ComboboxContentFooterProps, ComboboxContentHeader, ComboboxContentHeaderProps, ComboboxContentListbox, ComboboxContentListboxProps, ComboboxContentProps, ComboboxProps, ComboboxState, ComboboxTrigger, ComboboxTriggerProps, Select, SelectContent, SelectContentProps, SelectProps, SelectState, SelectTrigger, SelectTriggerProps, StyledComboboxContentFooterProps, StyledComboboxContentHeaderProps, StyledComboboxProps, StyledSelectProps };