@getsoren/design-system 4.88.0 → 4.90.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.
- package/dist/main.cjs +72 -72
- package/dist/main.js +2780 -2731
- package/dist/src/components/Inputs/Counter/Counter.d.ts +1 -1
- package/dist/src/components/Inputs/PillGroup/PillGroup.d.ts +1 -1
- package/dist/src/components/Inputs/TextFieldGroup/TextFieldGroup.d.ts +1 -1
- package/dist/src/components/Inputs/TextFieldPhone/TextFieldPhone.d.ts +15 -0
- package/dist/src/components/Inputs/TextFieldPhone/utils/computeNextPhone.d.ts +23 -0
- package/dist/src/main.d.ts +3 -1
- package/dist/src/utils/colors.d.ts +14 -0
- package/package.json +1 -1
- package/dist/src/utils/getInvalidColor.d.ts +0 -5
- package/dist/src/utils/getOutlineColor.d.ts +0 -4
- package/dist/src/utils/getSubtleSurfaceColor.d.ts +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SxProps, Theme } from '@mui/material';
|
|
2
2
|
import { PropsWithChildren, ReactNode } from 'react';
|
|
3
|
-
import { InvalidColor } from '../../../utils/
|
|
3
|
+
import { InvalidColor } from '../../../utils/colors';
|
|
4
4
|
export interface TextFieldGroupProps extends PropsWithChildren {
|
|
5
5
|
/** `row` puts two short fields side by side */
|
|
6
6
|
direction?: "column" | "row";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TextFieldProps } from '@mui/material';
|
|
2
|
+
export interface TextFieldPhoneProps extends Omit<TextFieldProps, "type" | "value" | "onChange"> {
|
|
3
|
+
/** Number as displayed, e.g. "06 34 39 39 49" */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Called with the formatted number on each change */
|
|
6
|
+
onChange: (value: string) => void;
|
|
7
|
+
/** Display of the digits left by an edit, e.g. to cap their count (defaults to `phoneNumberAdapter`: French pairs) */
|
|
8
|
+
format?: (digits: string) => string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A phone number field formatted as it is typed ("06 34 39 39 49"), the caret kept after the digit it followed:
|
|
12
|
+
* reformatting would otherwise send it to the end on each edit in the middle of the number.
|
|
13
|
+
*/
|
|
14
|
+
declare const TextFieldPhone: ({ value, onChange, format, inputRef, slotProps, ...props }: TextFieldPhoneProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
15
|
+
export default TextFieldPhone;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const toDigits: (value: string) => string;
|
|
2
|
+
export interface NextPhoneParams {
|
|
3
|
+
/** Caret index in `rawValue` */
|
|
4
|
+
caret: number;
|
|
5
|
+
/** `InputEvent.inputType` — empty when the change was not a keystroke (autofill, a test harness) */
|
|
6
|
+
inputType: string;
|
|
7
|
+
/** Display value before the edit */
|
|
8
|
+
previous: string;
|
|
9
|
+
/** Input value as written by the browser, before formatting */
|
|
10
|
+
rawValue: string;
|
|
11
|
+
/** Display value of the digits left by the edit */
|
|
12
|
+
format: (digits: string) => string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Pure transition of a phone field: previous value + raw input → next display value and caret.
|
|
16
|
+
* Reformatting rewrites the whole value, which would send the browser caret to the end: an edit in
|
|
17
|
+
* the middle of the number would then continue at the end. The caret is put back after the same
|
|
18
|
+
* count of digits it followed (spaces move, digits do not).
|
|
19
|
+
*/
|
|
20
|
+
export declare const computeNextPhone: ({ caret, inputType, previous, rawValue, format }: NextPhoneParams) => {
|
|
21
|
+
caret: number;
|
|
22
|
+
formatted: string;
|
|
23
|
+
};
|
package/dist/src/main.d.ts
CHANGED
|
@@ -105,6 +105,8 @@ export * from './components/Inputs/TextFieldGroup/TextFieldGroup';
|
|
|
105
105
|
export { default as TextFieldGroup } from './components/Inputs/TextFieldGroup/TextFieldGroup';
|
|
106
106
|
export * from './components/Inputs/TextFieldPassword/TextFieldPassword';
|
|
107
107
|
export { default as TextFieldPassword } from './components/Inputs/TextFieldPassword/TextFieldPassword';
|
|
108
|
+
export * from './components/Inputs/TextFieldPhone/TextFieldPhone';
|
|
109
|
+
export { default as TextFieldPhone } from './components/Inputs/TextFieldPhone/TextFieldPhone';
|
|
108
110
|
export * from './components/Layout/Backoffice/Backoffice';
|
|
109
111
|
export { default as Backoffice } from './components/Layout/Backoffice/Backoffice';
|
|
110
112
|
export { default as CollapsingHeader } from './components/Layout/CollapsingHeader/CollapsingHeader';
|
|
@@ -144,9 +146,9 @@ export { default as useSnackbar } from './hooks/useSnackbar/useSnackbar';
|
|
|
144
146
|
export * from './hooks/useTabs/useTabs';
|
|
145
147
|
export { default as useTabs } from './hooks/useTabs/useTabs';
|
|
146
148
|
export type { DataAttributes } from './types/dataAttributes';
|
|
149
|
+
export * from './utils/colors';
|
|
147
150
|
export * from './utils/getBackgroundImageElevation';
|
|
148
151
|
export { default as getBackgroundImageElevation } from './utils/getBackgroundImageElevation';
|
|
149
|
-
export type { InvalidColor } from './utils/getInvalidColor';
|
|
150
152
|
export { default as isoToEmojiFlag } from './utils/isoToEmojiFlag';
|
|
151
153
|
export { default as pickDataAttributes } from './utils/pickDataAttributes';
|
|
152
154
|
export * from './utils/pxToRem';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { Palette } from '@mui/material/styles';
|
|
3
|
+
export type InvalidColor = "error" | "warning";
|
|
4
|
+
/** Resting border of a control: grey 400 in light mode, the translucent outline of the dark palette otherwise */
|
|
5
|
+
export declare const getOutlineColor: (theme: Theme) => string;
|
|
6
|
+
/**
|
|
7
|
+
* Resting border of a surface read as content rather than as a form control (card, text area): grey 200 in light
|
|
8
|
+
* mode, the same dark outline as a control otherwise
|
|
9
|
+
*/
|
|
10
|
+
export declare const getSoftOutlineColor: ({ border, grey, mode }: Palette) => string;
|
|
11
|
+
/** Colour of an invalid control: the error palette, or the softer warning one for an answer still to be given */
|
|
12
|
+
export declare const getInvalidColor: (theme: Theme, color?: InvalidColor) => string;
|
|
13
|
+
/** Grey that sets a surface apart from the paper it sits on (avatar round, own message, filled composer), in both modes. */
|
|
14
|
+
export declare const getSubtleSurfaceColor: ({ grey, mode }: Palette) => string;
|
package/package.json
CHANGED
|
@@ -1,5 +0,0 @@
|
|
|
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;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Palette } from '@mui/material/styles';
|
|
2
|
-
/** Grey that sets a surface apart from the paper it sits on (avatar round, own message, filled composer), in both modes. */
|
|
3
|
-
declare const getSubtleSurfaceColor: ({ grey, mode }: Palette) => string;
|
|
4
|
-
export default getSubtleSurfaceColor;
|