@getsoren/design-system 4.83.3 → 4.84.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,24 @@
1
+ import { ReactNode } from 'react';
2
+ import { InvalidColor } from '../../../utils/getInvalidColor';
3
+ export interface CounterProps {
4
+ label: ReactNode;
5
+ /** Secondary line under the label */
6
+ description?: ReactNode;
7
+ value: number;
8
+ min?: number;
9
+ max?: number;
10
+ step?: number;
11
+ onChange: (value: number) => void;
12
+ /** Suffix after the value, e.g. "h" */
13
+ unit?: string;
14
+ error?: boolean;
15
+ /** Palette of the helper text when in error */
16
+ errorColor?: InvalidColor;
17
+ helperText?: ReactNode;
18
+ disabled?: boolean;
19
+ /** Test id of the row; its parts get the `-minus`, `-value` and `-plus` suffixes */
20
+ testId?: string;
21
+ }
22
+ /** A labelled row with a value stepped by a minus and a plus button */
23
+ declare const Counter: ({ label, description, value, min, max, step, onChange, unit, error, errorColor, helperText, disabled, testId, }: CounterProps) => import("@emotion/react/jsx-runtime").JSX.Element;
24
+ export default Counter;
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from 'react';
2
+ import { InvalidColor } from '../../../utils/getInvalidColor';
3
+ export interface PillOption {
4
+ value: string;
5
+ label: ReactNode;
6
+ /** Leading visual, sized by the consumer (18px reads well) */
7
+ icon?: ReactNode;
8
+ }
9
+ interface PillGroupBaseProps {
10
+ options: PillOption[];
11
+ /** Draws the pills in the invalid colour */
12
+ error?: boolean;
13
+ /** Palette of the invalid state and of the helper text */
14
+ errorColor?: InvalidColor;
15
+ helperText?: ReactNode;
16
+ "aria-label"?: string;
17
+ disabled?: boolean;
18
+ }
19
+ export interface PillGroupSingleProps extends PillGroupBaseProps {
20
+ multiple?: false;
21
+ value?: string | null;
22
+ /** Called with the tapped option, even when it is already selected: clearing is the consumer's call */
23
+ onChange: (value: string) => void;
24
+ }
25
+ export interface PillGroupMultipleProps extends PillGroupBaseProps {
26
+ multiple: true;
27
+ value?: string[];
28
+ /** Called with the selection after the tapped option was added or removed */
29
+ onChange: (values: string[]) => void;
30
+ }
31
+ export type PillGroupProps = PillGroupSingleProps | PillGroupMultipleProps;
32
+ /** Short options as pills: a radio group, or a checkbox group when `multiple` */
33
+ declare const PillGroup: (props: PillGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
34
+ export default PillGroup;
@@ -0,0 +1,19 @@
1
+ import { SxProps, Theme } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ import { InvalidColor } from '../../../utils/getInvalidColor';
4
+ export interface TextFieldGroupProps extends PropsWithChildren {
5
+ /** `row` puts two short fields side by side */
6
+ direction?: "column" | "row";
7
+ /** Draws the frame in the invalid colour; the helper text belongs to the consumer */
8
+ error?: boolean;
9
+ /** Palette of the invalid frame */
10
+ errorColor?: InvalidColor;
11
+ sx?: SxProps<Theme>;
12
+ }
13
+ /**
14
+ * One frame around several filled TextFields: hairlines between them, the outer corners on the first and
15
+ * the last one. The fields lose their own border, and the focused one draws its ring over the frame.
16
+ * Every child is a field (or a wrapper holding one, such as an Autocomplete): a helper text goes under the group.
17
+ */
18
+ declare const TextFieldGroup: ({ children, direction, error, errorColor, sx }: TextFieldGroupProps) => import("@emotion/react/jsx-runtime").JSX.Element;
19
+ export default TextFieldGroup;
@@ -7,9 +7,11 @@ declare const _default: {
7
7
  closed: string;
8
8
  collapseSidebar: string;
9
9
  day: string;
10
+ decrement: string;
10
11
  escape: string;
11
12
  expandSidebar: string;
12
13
  files: string;
14
+ increment: string;
13
15
  month: string;
14
16
  noResult: string;
15
17
  oops: string;
@@ -7,9 +7,11 @@ declare const _default: {
7
7
  closed: string;
8
8
  collapseSidebar: string;
9
9
  day: string;
10
+ decrement: string;
10
11
  escape: string;
11
12
  expandSidebar: string;
12
13
  files: string;
14
+ increment: string;
13
15
  month: string;
14
16
  noResult: string;
15
17
  oops: string;
@@ -82,10 +82,14 @@ export * from './components/Inputs/ChipFilter/ChipFilter';
82
82
  export { default as ChipFilter } from './components/Inputs/ChipFilter/ChipFilter';
83
83
  export * from './components/Inputs/ChipQuantityEditor/ChipQuantityEditor';
84
84
  export { default as ChipQuantityEditor } from './components/Inputs/ChipQuantityEditor/ChipQuantityEditor';
85
+ export * from './components/Inputs/Counter/Counter';
86
+ export { default as Counter } from './components/Inputs/Counter/Counter';
85
87
  export * from './components/Inputs/CountryAutocomplete/CountryAutocomplete';
86
88
  export { default as CountryAutocomplete } from './components/Inputs/CountryAutocomplete/CountryAutocomplete';
87
89
  export * from './components/Inputs/File/File';
88
90
  export { default as File } from './components/Inputs/File/File';
91
+ export * from './components/Inputs/PillGroup/PillGroup';
92
+ export { default as PillGroup } from './components/Inputs/PillGroup/PillGroup';
89
93
  export * from './components/Inputs/QuantityField/QuantityField';
90
94
  export { default as QuantityField } from './components/Inputs/QuantityField/QuantityField';
91
95
  export * from './components/Inputs/TextArea/TextArea';
@@ -94,6 +98,8 @@ export * from './components/Inputs/TextFieldAppBar/TextFieldAppBar';
94
98
  export { default as TextFieldAppBar } from './components/Inputs/TextFieldAppBar/TextFieldAppBar';
95
99
  export * from './components/Inputs/TextFieldAutosize/TextFieldAutosize';
96
100
  export { default as TextFieldAutosize } from './components/Inputs/TextFieldAutosize/TextFieldAutosize';
101
+ export * from './components/Inputs/TextFieldGroup/TextFieldGroup';
102
+ export { default as TextFieldGroup } from './components/Inputs/TextFieldGroup/TextFieldGroup';
97
103
  export * from './components/Inputs/TextFieldPassword/TextFieldPassword';
98
104
  export { default as TextFieldPassword } from './components/Inputs/TextFieldPassword/TextFieldPassword';
99
105
  export * from './components/Layout/Backoffice/Backoffice';
@@ -136,6 +142,7 @@ export { default as useTabs } from './hooks/useTabs/useTabs';
136
142
  export type { DataAttributes } from './types/dataAttributes';
137
143
  export * from './utils/getBackgroundImageElevation';
138
144
  export { default as getBackgroundImageElevation } from './utils/getBackgroundImageElevation';
145
+ export type { InvalidColor } from './utils/getInvalidColor';
139
146
  export { default as isoToEmojiFlag } from './utils/isoToEmojiFlag';
140
147
  export { default as pickDataAttributes } from './utils/pickDataAttributes';
141
148
  export * from './utils/pxToRem';
@@ -0,0 +1,5 @@
1
+ import { Theme } from '@mui/material';
2
+ export type InvalidColor = "error" | "warning";
3
+ /** Colour of an invalid control: the error palette, or the softer warning one for an answer still to be given */
4
+ declare const getInvalidColor: (theme: Theme, color?: InvalidColor) => string;
5
+ export default getInvalidColor;
@@ -0,0 +1,4 @@
1
+ import { Theme } from '@mui/material';
2
+ /** Resting border of a control: grey 400 in light mode, the translucent outline of the dark palette otherwise */
3
+ declare const getOutlineColor: (theme: Theme) => string;
4
+ export default getOutlineColor;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@getsoren/design-system",
3
3
  "description": "Design System React library",
4
4
  "sideEffects": false,
5
- "version": "4.83.3",
5
+ "version": "4.84.0",
6
6
  "license": "ISC",
7
7
  "type": "module",
8
8
  "types": "./dist/src/main.d.ts",