@pega/cosmos-react-core 3.0.0-dev.6.0 → 3.0.0-dev.9.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/lib/components/AppShell/AppShell.d.ts.map +1 -1
- package/lib/components/AppShell/AppShell.js +3 -3
- package/lib/components/AppShell/AppShell.js.map +1 -1
- package/lib/components/Badges/Keyboard.d.ts +9 -0
- package/lib/components/Badges/Keyboard.d.ts.map +1 -0
- package/lib/components/Badges/Keyboard.js +51 -0
- package/lib/components/Badges/Keyboard.js.map +1 -0
- package/lib/components/Badges/index.d.ts +2 -0
- package/lib/components/Badges/index.d.ts.map +1 -1
- package/lib/components/Badges/index.js +1 -0
- package/lib/components/Badges/index.js.map +1 -1
- package/lib/components/ComboBox/ComboBox.d.ts.map +1 -1
- package/lib/components/ComboBox/ComboBox.js +1 -2
- package/lib/components/ComboBox/ComboBox.js.map +1 -1
- package/lib/components/Configuration/Configuration.d.ts.map +1 -1
- package/lib/components/Configuration/Configuration.js +1 -1
- package/lib/components/Configuration/Configuration.js.map +1 -1
- package/lib/components/CreditCard/CreditCard.types.d.ts +43 -0
- package/lib/components/CreditCard/CreditCard.types.d.ts.map +1 -1
- package/lib/components/CreditCard/CreditCard.types.js.map +1 -1
- package/lib/components/CreditCard/CreditCardInput.d.ts +6 -0
- package/lib/components/CreditCard/CreditCardInput.d.ts.map +1 -0
- package/lib/components/CreditCard/CreditCardInput.js +39 -0
- package/lib/components/CreditCard/CreditCardInput.js.map +1 -0
- package/lib/components/CreditCard/index.d.ts +3 -1
- package/lib/components/CreditCard/index.d.ts.map +1 -1
- package/lib/components/CreditCard/index.js +2 -0
- package/lib/components/CreditCard/index.js.map +1 -1
- package/lib/components/CreditCard/utils.d.ts +11 -0
- package/lib/components/CreditCard/utils.d.ts.map +1 -1
- package/lib/components/CreditCard/utils.js +20 -2
- package/lib/components/CreditCard/utils.js.map +1 -1
- package/lib/components/Currency/CurrencyInput.d.ts.map +1 -1
- package/lib/components/Currency/CurrencyInput.js +13 -12
- package/lib/components/Currency/CurrencyInput.js.map +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js +1 -1
- package/lib/components/DateTime/Input/DateTime.styles.js.map +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js +1 -1
- package/lib/components/DateTime/Input/Duration/NumberUnit.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.js +6 -6
- package/lib/components/DateTime/Picker/Calendar.js.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts +3 -2
- package/lib/components/DateTime/Picker/Calendar.styles.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/Calendar.styles.js +10 -8
- package/lib/components/DateTime/Picker/Calendar.styles.js.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DatePicker.js +3 -3
- package/lib/components/DateTime/Picker/DatePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/DateRangePicker.js +2 -2
- package/lib/components/DateTime/Picker/DateRangePicker.js.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.d.ts.map +1 -1
- package/lib/components/DateTime/Picker/TimePicker.js +27 -4
- package/lib/components/DateTime/Picker/TimePicker.js.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/FieldValueList/FieldValueList.js +2 -1
- package/lib/components/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/HTML/HTML.d.ts +1 -0
- package/lib/components/HTML/HTML.d.ts.map +1 -1
- package/lib/components/HTML/HTML.js +16 -4
- package/lib/components/HTML/HTML.js.map +1 -1
- package/lib/components/Link/Link.d.ts.map +1 -1
- package/lib/components/Link/Link.js +1 -2
- package/lib/components/Link/Link.js.map +1 -1
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.js +1 -2
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Modal/DockedModals.d.ts.map +1 -1
- package/lib/components/Modal/DockedModals.js +1 -2
- package/lib/components/Modal/DockedModals.js.map +1 -1
- package/lib/components/Modal/MinimizedModal.d.ts.map +1 -1
- package/lib/components/Modal/MinimizedModal.js +1 -0
- package/lib/components/Modal/MinimizedModal.js.map +1 -1
- package/lib/components/Modal/Modal.d.ts.map +1 -1
- package/lib/components/Modal/Modal.js +23 -11
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/Modal/Modal.styles.d.ts.map +1 -1
- package/lib/components/Modal/Modal.styles.js +1 -0
- package/lib/components/Modal/Modal.styles.js.map +1 -1
- package/lib/components/Number/NumberInput.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.js +40 -35
- package/lib/components/Number/NumberInput.js.map +1 -1
- package/lib/components/Number/NumberInput.types.d.ts +3 -1
- package/lib/components/Number/NumberInput.types.d.ts.map +1 -1
- package/lib/components/Number/NumberInput.types.js.map +1 -1
- package/lib/components/Number/utils.d.ts +1 -1
- package/lib/components/Number/utils.d.ts.map +1 -1
- package/lib/components/Number/utils.js +18 -32
- package/lib/components/Number/utils.js.map +1 -1
- package/lib/components/PageTemplates/DashboardPage.d.ts +2 -6
- package/lib/components/PageTemplates/DashboardPage.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.d.ts +11 -7
- package/lib/components/PageTemplates/PageTemplates.d.ts.map +1 -1
- package/lib/components/PageTemplates/PageTemplates.js +9 -17
- package/lib/components/PageTemplates/PageTemplates.js.map +1 -1
- package/lib/components/Phone/PhoneInput.d.ts +1 -1
- package/lib/components/Phone/PhoneInput.d.ts.map +1 -1
- package/lib/components/Phone/PhoneInput.js +19 -36
- package/lib/components/Phone/PhoneInput.js.map +1 -1
- package/lib/components/Phone/utils.d.ts +1 -2
- package/lib/components/Phone/utils.d.ts.map +1 -1
- package/lib/components/Phone/utils.js +3 -26
- package/lib/components/Phone/utils.js.map +1 -1
- package/lib/components/Tabs/TabPanel.d.ts.map +1 -1
- package/lib/components/Tabs/TabPanel.js +0 -1
- package/lib/components/Tabs/TabPanel.js.map +1 -1
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +1 -1
- package/lib/components/Tabs/Tabs.js.map +1 -1
- package/lib/components/VisuallyHiddenText/VisuallyHiddenText.d.ts.map +1 -1
- package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js +2 -0
- package/lib/components/VisuallyHiddenText/VisuallyHiddenText.js.map +1 -1
- package/lib/hooks/index.d.ts +2 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/index.js +2 -0
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useActiveDescendant.d.ts.map +1 -1
- package/lib/hooks/useActiveDescendant.js +6 -1
- package/lib/hooks/useActiveDescendant.js.map +1 -1
- package/lib/hooks/useAutoResize.d.ts +2 -2
- package/lib/hooks/useAutoResize.d.ts.map +1 -1
- package/lib/hooks/useAutoResize.js +7 -3
- package/lib/hooks/useAutoResize.js.map +1 -1
- package/lib/hooks/useI18n.d.ts +3 -1
- package/lib/hooks/useI18n.d.ts.map +1 -1
- package/lib/hooks/useInputFormatter.d.ts +12 -0
- package/lib/hooks/useInputFormatter.d.ts.map +1 -0
- package/lib/hooks/useInputFormatter.js +84 -0
- package/lib/hooks/useInputFormatter.js.map +1 -0
- package/lib/hooks/useOS.d.ts +7 -0
- package/lib/hooks/useOS.d.ts.map +1 -0
- package/lib/hooks/useOS.js +28 -0
- package/lib/hooks/useOS.js.map +1 -0
- package/lib/i18n/default.d.ts +3 -1
- package/lib/i18n/default.d.ts.map +1 -1
- package/lib/i18n/default.js +3 -1
- package/lib/i18n/default.js.map +1 -1
- package/lib/i18n/i18n.d.ts +6 -2
- package/lib/i18n/i18n.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.d.ts +5 -1
- package/lib/styles/GlobalStyle.d.ts.map +1 -1
- package/lib/styles/GlobalStyle.js +84 -70
- package/lib/styles/GlobalStyle.js.map +1 -1
- package/lib/styles/gradients.d.ts +4 -1
- package/lib/styles/gradients.d.ts.map +1 -1
- package/lib/styles/gradients.js +46 -3
- package/lib/styles/gradients.js.map +1 -1
- package/lib/theme/theme.d.ts +18 -0
- package/lib/theme/theme.d.ts.map +1 -1
- package/lib/theme/themeDefinition.json +10 -0
- package/lib/theme/themes/darkTheme.json +6 -0
- package/package.json +12 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberInput.types.js","sourceRoot":"","sources":["../../../src/components/Number/NumberInput.types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NumberInput.types.js","sourceRoot":"","sources":["../../../src/components/Number/NumberInput.types.ts"],"names":[],"mappings":"AAwFA,qCAAqC;AACrC,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC","sourcesContent":["import { Ref } from 'react';\n\nimport { FormControlProps } from '../FormControl';\nimport { BaseProps, NoChildrenProp } from '../../types';\n\nexport default interface NumberInputProps extends BaseProps, NoChildrenProp {\n /**\n * Sets DOM id for the control and associates label element via 'for' attribute.\n * If an id is not pass, a random id will be generated for any render.\n */\n id?: FormControlProps['id'];\n /** Set visual state based on a validation state. */\n status?: FormControlProps['status'];\n /** Pass a string or a fragment with an Icon and string. */\n label?: FormControlProps['label'];\n /**\n * Visually hides the label region.\n * @default false\n */\n labelHidden?: FormControlProps['labelHidden'];\n /** It is recommended to pass a simple string to offer guidance. Text will be styled based on status prop. */\n info?: FormControlProps['info'];\n /** Indicate if the field is required. The browser defaults to false. */\n required?: FormControlProps['required'];\n /** Placeholder text. The browser defaults to an empty string. */\n placeholder?: string;\n /** Disable the control. The browser defaults to false. */\n disabled?: FormControlProps['disabled'];\n /** Makes the component non editable and non clickable. The browser defaults to false. */\n readOnly?: FormControlProps['readOnly'];\n /** Sets html name attribute for the underlying control. Useful for mapping to a data field. */\n name?: FormControlProps['name'];\n /**\n * CurrencyInput input value.\n * Requires an onChange handler to update value.\n */\n value?: string;\n /** Callback fired when input value changes. */\n onChange: (value: string) => void;\n /** Callback fired when the component gets focus. */\n onFocus?: (value: string) => void;\n /** Callback fired when the component loses focus. */\n onBlur?: (value: string) => void;\n /** Defines unit of the number, like 'kg', 'miles' or '%'. */\n unit?: string;\n /**\n * Determines the placement of the unit.\n * @default \"after\"\n */\n unitPlacement?: 'before' | 'after';\n /** Determines whether decimal places should be shown. The value is rounded if true.\n * @default true\n */\n showDecimal?: boolean;\n /** Determines the maximum number of decimal places. The value is rounded to the number of places.\n * @default variable NUMBER_MAX_DECIMAL_PLACES. Recommended minimum: 1.\n */\n numberOfDecimals?: number;\n /** Determines whether group separators should be shown.\n * @default true\n */\n showGroupSeparators?: boolean;\n /** The minimum value to accept for this input.\n * This value must be less than or equal to the value of the max attribute.\n * @default Number.MIN_SAFE_INTEGER\n */\n min?: number;\n /**\n * The maximum value to accept for this input.\n * This value must be greater than or equal to the value of the min attribute.\n * @default Number.MAX_SAFE_INTEGER\n */\n max?: number;\n /** A stepping interval to use when using up and down arrows to adjust the value.\n * @default 1\n */\n step?: number;\n /**\n * Component variation. Might be rendered as regular input or stepper.\n * @default 'default'\n */\n variant?: 'default' | 'stepper';\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLInputElement>;\n /** Optional manual override for generated aria label */\n 'aria-label'?: string;\n}\n\n/** Maximum fraction digits is 20. */\nexport const NUMBER_MAX_DECIMAL_PLACES = 20;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare function getInteger(value: string): string;
|
|
2
2
|
export declare function getDecimal(locale: string, options?: Intl.NumberFormatOptions): string;
|
|
3
3
|
export declare function getFraction(value: string): string;
|
|
4
|
-
export declare function getCleanedValue(value: string,
|
|
4
|
+
export declare function getCleanedValue(value: string, decimalSign: string, maximumFractionDigits: number): string;
|
|
5
5
|
export declare function getFormattedValue(value: string, locale: string, showGroupSeparators: boolean, maximumFractionDigits?: number): string;
|
|
6
6
|
export declare function isValueInRange(value: number, min: number | undefined, max: number | undefined): boolean;
|
|
7
7
|
export declare function getIncrementedValue(value: string, min: number, max: number, step: number): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Number/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,UAM5E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAIxC;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Number/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,UAM5E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAIxC;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,qBAAqB,EAAE,MAAM,GAC5B,MAAM,CAUR;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,OAAO,EAC5B,qBAAqB,GAAE,MAAU,GAChC,MAAM,CAcR;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GAAG,SAAS,EACvB,GAAG,EAAE,MAAM,GAAG,SAAS,GACtB,OAAO,CAET;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAUjG;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAUjG;AAED,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,IAAI,CAAC,mBAAmB,CAAC;CACpC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,mBAAmB,UAI5F"}
|
|
@@ -14,46 +14,32 @@ export function getFraction(value) {
|
|
|
14
14
|
const substrLength = decPos === -1 ? value.length : decPos;
|
|
15
15
|
return value.substring(substrLength);
|
|
16
16
|
}
|
|
17
|
-
export function getCleanedValue(value,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (value.startsWith('-.'))
|
|
27
|
-
value = `-0${value.substring(1)}`;
|
|
28
|
-
const match = value.match(new RegExp(`-?\\d*(\\.\\d{0,${maximumFractionDigits}})?`));
|
|
17
|
+
export function getCleanedValue(value, decimalSign, maximumFractionDigits) {
|
|
18
|
+
let rawValue = value.replace(new RegExp(`[^${decimalSign}\\d-]+`, 'gu'), '');
|
|
19
|
+
if (decimalSign && decimalSign !== '.')
|
|
20
|
+
rawValue = rawValue.replace(decimalSign, '.');
|
|
21
|
+
if (rawValue.startsWith('.'))
|
|
22
|
+
rawValue = `0${value}`;
|
|
23
|
+
if (rawValue.startsWith('-.'))
|
|
24
|
+
rawValue = `-0${value.substring(1)}`;
|
|
25
|
+
const match = rawValue.match(new RegExp(`-?\\d*(\\.\\d{0,${maximumFractionDigits}})?`));
|
|
29
26
|
if (match && match.length > 0) {
|
|
30
|
-
|
|
27
|
+
rawValue = match[0];
|
|
31
28
|
}
|
|
32
|
-
return
|
|
29
|
+
return rawValue;
|
|
33
30
|
}
|
|
34
31
|
export function getFormattedValue(value, locale, showGroupSeparators, maximumFractionDigits = 0) {
|
|
35
32
|
let valueNumber;
|
|
36
|
-
|
|
37
|
-
const cleanedValue = getCleanedValue(value, '.', maximumFractionDigits);
|
|
38
|
-
let integer = getInteger(cleanedValue);
|
|
33
|
+
const integer = getInteger(value);
|
|
39
34
|
const decimal = getDecimal(locale);
|
|
40
|
-
const fractionPart = getFraction(
|
|
41
|
-
if (
|
|
42
|
-
sign = '-';
|
|
43
|
-
integer = integer.substring(1);
|
|
44
|
-
}
|
|
45
|
-
if (!integer && maximumFractionDigits && fractionPart.startsWith(decimal)) {
|
|
46
|
-
integer = '0';
|
|
47
|
-
}
|
|
48
|
-
if (cleanedValue && !Number.isNaN(parseFloat(integer))) {
|
|
35
|
+
const fractionPart = getFraction(value).replace('.', decimal);
|
|
36
|
+
if (value && !Number.isNaN(parseFloat(integer))) {
|
|
49
37
|
valueNumber = BigInt(integer);
|
|
50
|
-
return (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
.trim() +
|
|
54
|
-
(maximumFractionDigits ? fractionPart : ''));
|
|
38
|
+
return (new Intl.NumberFormat(locale, { useGrouping: showGroupSeparators })
|
|
39
|
+
.format(valueNumber)
|
|
40
|
+
.trim() + (maximumFractionDigits ? fractionPart : ''));
|
|
55
41
|
}
|
|
56
|
-
return
|
|
42
|
+
return value;
|
|
57
43
|
}
|
|
58
44
|
export function isValueInRange(value, min, max) {
|
|
59
45
|
return !((min !== undefined && value < min) || (max !== undefined && value > max));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/Number/utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAA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os = value.indexOf('.');\n const substrLength = decPos === -1 ? value.length : decPos;\n return value.substring(0, substrLength);\n}\n\nexport function getDecimal(locale: string, options?: Intl.NumberFormatOptions) {\n return (\n new Intl.NumberFormat(locale, options)\n .formatToParts(0.1)\n .filter((part: { type: string; value: string }) => part.type === 'decimal')[0]?.value || ''\n );\n}\n\nexport function getFraction(value: string) {\n const decPos = value.indexOf('.');\n const substrLength = decPos === -1 ? value.length : decPos;\n return value.substring(substrLength);\n}\n\nexport function getCleanedValue(\n value: string,\n decimalSign: string,\n maximumFractionDigits: number\n): string {\n let rawValue = value.replace(new RegExp(`[^${decimalSign}\\\\d-]+`, 'gu'), '');\n if (decimalSign && decimalSign !== '.') rawValue = rawValue.replace(decimalSign, '.');\n if (rawValue.startsWith('.')) rawValue = `0${value}`;\n if (rawValue.startsWith('-.')) rawValue = `-0${value.substring(1)}`;\n const match = rawValue.match(new RegExp(`-?\\\\d*(\\\\.\\\\d{0,${maximumFractionDigits}})?`));\n if (match && match.length > 0) {\n rawValue = match[0];\n }\n return rawValue;\n}\n\nexport function getFormattedValue(\n value: string,\n locale: string,\n showGroupSeparators: boolean,\n maximumFractionDigits: number = 0\n): string {\n let valueNumber;\n const integer = getInteger(value);\n const decimal = getDecimal(locale);\n const fractionPart = getFraction(value).replace('.', decimal);\n if (value && !Number.isNaN(parseFloat(integer))) {\n valueNumber = BigInt(integer);\n return (\n new Intl.NumberFormat(locale, { useGrouping: showGroupSeparators })\n .format(valueNumber)\n .trim() + (maximumFractionDigits ? fractionPart : '')\n );\n }\n return value;\n}\n\nexport function isValueInRange(\n value: number,\n min: number | undefined,\n max: number | undefined\n): boolean {\n return !((min !== undefined && value < min) || (max !== undefined && value > max));\n}\n\nexport function getIncrementedValue(value: string, min: number, max: number, step: number): string {\n const numberValue = parseFloat(value) || 0;\n const newValue = new BigNumber(numberValue).plus(step);\n if (isValueInRange(newValue.toNumber(), min, max)) {\n return newValue.toFixed();\n }\n if (min !== undefined && newValue.toNumber() < min) {\n return min.toString();\n }\n return value;\n}\n\nexport function getDecrementedValue(value: string, min: number, max: number, step: number): string {\n const numberValue = parseFloat(value) || 0;\n const newValue = new BigNumber(numberValue).minus(step);\n if (isValueInRange(newValue.toNumber(), min, max)) {\n return newValue.toFixed();\n }\n if (max !== undefined && newValue.toNumber() > max) {\n return max.toString();\n }\n return value;\n}\n\ninterface NumberFormatOptions {\n locale: string;\n options?: Intl.NumberFormatOptions;\n}\n\nexport function formatNumber(value: number | bigint, { locale, options }: NumberFormatOptions) {\n const formatter = new Intl.NumberFormat(locale, options);\n\n return formatter.format(value);\n}\n"]}
|
|
@@ -14,12 +14,8 @@ export interface DashboardPageLayoutProps extends PageLayoutProps {
|
|
|
14
14
|
fitToViewport?: boolean;
|
|
15
15
|
regionFullWidth: ReactNode[];
|
|
16
16
|
}
|
|
17
|
-
export declare const StyledFilterRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
18
|
-
|
|
19
|
-
}, never>;
|
|
20
|
-
export declare const StyledDashboardRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
21
|
-
fillHeight?: boolean | undefined;
|
|
22
|
-
}, never>;
|
|
17
|
+
export declare const StyledFilterRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
18
|
+
export declare const StyledDashboardRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
23
19
|
export declare const StyledDashboardPageLayout: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
24
20
|
scrollContent: boolean | undefined;
|
|
25
21
|
minContentHeight?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardPage.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/DashboardPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,iBAAiB,EAAwB,SAAS,EAAE,MAAM,OAAO,CAAC;AAIhG,OAAO,EAAE,YAAY,EAAE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AAe,EAAE,SAAS,EAAE,CAAC;CAC9B;AAED,eAAO,MAAM,kBAAkB,yGAAyB,CAAC;AAIzD,eAAO,MAAM,qBAAqB,yGAEjC,CAAC;AAIF,eAAO,MAAM,yBAAyB;;;qDAYpC,CAAC;AA+LH,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAiBvE,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FunctionComponent, Ref, ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { BaseProps, ForwardProps, NoChildrenProp, AsProp } from '../../types';
|
|
3
|
-
import Tabs, { TabPanel, TabsProps } from '../Tabs';
|
|
2
|
+
import { BaseProps, ForwardProps, NoChildrenProp, AsProp, OmitStrict } from '../../types';
|
|
3
|
+
import Tabs, { TabPanel, TabsProps, Tab } from '../Tabs';
|
|
4
4
|
import { BreadcrumbsProps } from '../Breadcrumbs';
|
|
5
5
|
export interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {
|
|
6
6
|
title: string;
|
|
@@ -12,9 +12,14 @@ export interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {
|
|
|
12
12
|
scrollContent?: boolean;
|
|
13
13
|
ref?: Ref<HTMLDivElement>;
|
|
14
14
|
}
|
|
15
|
+
interface TabbedPageTab extends Tab {
|
|
16
|
+
content: ReactNode;
|
|
17
|
+
}
|
|
15
18
|
export interface TabbedPageProps extends PageTemplateProps {
|
|
16
|
-
tabs: TabsProps
|
|
17
|
-
|
|
19
|
+
tabs: OmitStrict<TabsProps, 'tabs' | 'currentTabId'> & {
|
|
20
|
+
tabs: TabbedPageTab[];
|
|
21
|
+
defaultTabId?: string;
|
|
22
|
+
};
|
|
18
23
|
}
|
|
19
24
|
export interface OneColumnPageProps extends PageTemplateProps {
|
|
20
25
|
a: ReactNode;
|
|
@@ -65,9 +70,7 @@ export interface PageLayoutProps extends PageTemplateProps {
|
|
|
65
70
|
}
|
|
66
71
|
export declare const StyledPageIcon: import("styled-components").StyledComponent<FunctionComponent<import("../Flex").FlexProps & ForwardProps>, import("styled-components").DefaultTheme, {}, never>;
|
|
67
72
|
export declare const StyledPageHeader: import("styled-components").StyledComponent<"header", import("styled-components").DefaultTheme, {}, never>;
|
|
68
|
-
export declare const StyledRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
69
|
-
fillHeight?: boolean | undefined;
|
|
70
|
-
}, never>;
|
|
73
|
+
export declare const StyledRegion: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
|
|
71
74
|
export declare const StyledRegions: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
|
|
72
75
|
pad: boolean;
|
|
73
76
|
}, never>;
|
|
@@ -87,4 +90,5 @@ export declare const NarrowWidePage: FunctionComponent<WideNarrowPageProps & For
|
|
|
87
90
|
export declare const WideWideNarrowPage: FunctionComponent<WideWideNarrowPageProps & ForwardProps>;
|
|
88
91
|
export declare const NarrowWideWidePage: FunctionComponent<NarrowWideWidePageProps & ForwardProps>;
|
|
89
92
|
export declare const NarrowWideNarrowPage: FunctionComponent<NarrowWideNarrowPageProps & ForwardProps>;
|
|
93
|
+
export {};
|
|
90
94
|
//# sourceMappingURL=PageTemplates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,GAAG,EACH,SAAS,EAET,YAAY,EAGb,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"PageTemplates.d.ts","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB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Aa,yGAAe,CAAC;AAG1C,eAAO,MAAM,wBAAwB,EAAE,OAAO,QAK5C,CAAC;AAIH,eAAO,MAAM,gBAAgB;mBACZ,eAAe,CAAC,eAAe,CAAC;;SAyB/C,CAAC;AA4KH,eAAO,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CAoCxE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAI9E,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,iBAAiB,CAAC,kBAAkB,GAAG,YAAY,CAM9E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,oBAAoB,GAAG,YAAY,CAMlF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAchF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAMhF,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CAMhF,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAetF,CAAC;AAEJ,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAAC,uBAAuB,GAAG,YAAY,CAetF,CAAC;AAEJ,eAAO,MAAM,oBAAoB,EAAE,iBAAiB,CAAC,yBAAyB,GAAG,YAAY,CAe1F,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useState, useRef, useContext, useEffect } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
4
|
import { readableColor } from 'polished';
|
|
@@ -40,16 +40,7 @@ export const StyledPageHeader = styled.header(({ theme }) => {
|
|
|
40
40
|
`;
|
|
41
41
|
});
|
|
42
42
|
StyledPageHeader.defaultProps = defaultThemeProp;
|
|
43
|
-
export const StyledRegion = styled.div
|
|
44
|
-
return css `
|
|
45
|
-
flex-grow: 1;
|
|
46
|
-
|
|
47
|
-
${fillHeight &&
|
|
48
|
-
css `
|
|
49
|
-
height: 100%;
|
|
50
|
-
`}
|
|
51
|
-
`;
|
|
52
|
-
});
|
|
43
|
+
export const StyledRegion = styled.div ``;
|
|
53
44
|
StyledRegion.defaultProps = defaultThemeProp;
|
|
54
45
|
export const StyledRegions = styled.div(({ pad, theme }) => {
|
|
55
46
|
const spacing = theme.base.spacing;
|
|
@@ -139,7 +130,7 @@ const PageLayout = forwardRef(({ regions, cols = `repeat(${regions.length}, minm
|
|
|
139
130
|
if (el) {
|
|
140
131
|
scrollStickOptions.current.elements[0] = el;
|
|
141
132
|
}
|
|
142
|
-
},
|
|
133
|
+
}, children: regions[0] }) })), !renderSingleRegion && (_jsx(Grid, { container: {
|
|
143
134
|
cols: 'minmax(0, 1fr)',
|
|
144
135
|
alignItems: 'start',
|
|
145
136
|
gap: 2,
|
|
@@ -155,14 +146,15 @@ const PageLayout = forwardRef(({ regions, cols = `repeat(${regions.length}, minm
|
|
|
155
146
|
}, children: colItems }, i));
|
|
156
147
|
}) }))] })] }));
|
|
157
148
|
});
|
|
158
|
-
export const TabbedPage = forwardRef(({ tabs,
|
|
159
|
-
const [tabId, setTabId] = useState(tabs.
|
|
149
|
+
export const TabbedPage = forwardRef(({ tabs, ...restProps }, ref) => {
|
|
150
|
+
const [tabId, setTabId] = useState(tabs.defaultTabId || tabs.tabs[0]?.id);
|
|
151
|
+
const tabPanels = tabs.tabs.map(tab => {
|
|
152
|
+
return (_jsx(Flex, { container: { direction: 'column', gap: 2 }, as: TabPanel, tabId: tab.id, currentTabId: tabId, children: tab.content }, tab.id));
|
|
153
|
+
});
|
|
160
154
|
return (_jsx(PageLayout, { ...restProps, tabs: _jsx(Tabs, { ...tabs, onTabClick: (id, e) => {
|
|
161
155
|
setTabId(id);
|
|
162
156
|
tabs.onTabClick?.(id, e);
|
|
163
|
-
} }), regions: [
|
|
164
|
-
_jsx(Flex, { container: { direction: 'column', gap: 2 }, as: TabPanel, tabId: tabId, children: a })
|
|
165
|
-
], ref: ref }));
|
|
157
|
+
}, currentTabId: tabId }), regions: [_jsx(_Fragment, { children: tabPanels })], ref: ref }));
|
|
166
158
|
});
|
|
167
159
|
export const OneColumnPage = forwardRef(({ a, ...restProps }, ref) => {
|
|
168
160
|
return _jsx(PageLayout, { regions: [a], ref: ref, ...restProps, cols: 'minmax(0, 1fr)' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAKR,MAAM,EAEN,UAAU,EACV,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAa,MAAM,SAAS,CAAC;AACpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE5F,OAAO,WAAW,EAAE,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACl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AClB,GAAG,EAAE,GAAG,KACJ,SAAS,EACb,IAAI,EAAC,0CAA0C,GAC/C,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,oBAAoB,GAC/B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA8C,EACrE,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,GAAG,EAAE,GAAG,KACJ,SAAS,EACb,IAAI,EAAC,8CAA8C,GACnD,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n ReactElement,\n useContext,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, AsProp } from '../../types';\nimport Grid from '../Grid';\nimport Text from '../Text';\nimport SummaryItem from '../SummaryItem';\nimport Icon from '../Icon';\nimport { tryCatch } from '../../utils';\nimport Tabs, { TabPanel, TabsProps } from '../Tabs';\nimport Flex from '../Flex';\nimport { useBreakpoint, useElement, useScrollStick, useConsolidatedRef } from '../../hooks';\nimport type { ScrollStickOptions } from '../../hooks/useScrollStick';\nimport Breadcrumbs, { BreadcrumbsProps, StyledBreadcrumbs } from '../Breadcrumbs';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { StyledBanner } from '../Banner/Banner';\nimport { StyledTabs } from '../Tabs/Tabs';\n\nexport interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {\n title: string;\n icon?: string;\n actions?: ReactNode;\n banners?: ReactNode;\n path?: BreadcrumbsProps['path'];\n header?: ReactNode;\n scrollContent?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\nexport interface TabbedPageProps extends PageTemplateProps {\n tabs: TabsProps;\n a: ReactNode;\n}\n\nexport interface OneColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n}\n\nexport interface TwoColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface ThreeColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface FourColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n d: ReactNode;\n}\n\nexport interface WideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface NarrowWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface WideWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface PageLayoutProps extends PageTemplateProps {\n tabs?: ReactElement<typeof Tabs>;\n regions: ReactNode[];\n regionsRef?: Ref<HTMLDivElement>;\n cols?: string;\n}\n\nexport const StyledPageIcon = styled(Flex)(({ theme }) => {\n const bgColor = theme.base.palette['brand-primary'];\n const color = tryCatch(() => readableColor(bgColor));\n return css`\n height: calc(4 * ${theme.base.spacing});\n width: calc(4 * ${theme.base.spacing});\n background: ${bgColor};\n color: ${color};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledPageIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPageHeader = styled.header(({ theme }) => {\n return css`\n ${StyledBreadcrumbs} {\n margin-block-end: ${theme.base.spacing};\n }\n\n ${StyledBanner},\n ${StyledTabs} {\n margin-block-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledPageHeader.defaultProps = defaultThemeProp;\n\nexport const StyledRegion = styled.div<{ fillHeight?: boolean }>(({ fillHeight }) => {\n return css`\n flex-grow: 1;\n\n ${fillHeight &&\n css`\n height: 100%;\n `}\n `;\n});\nStyledRegion.defaultProps = defaultThemeProp;\n\nexport const StyledRegions = styled.div<{ pad: boolean }>(({ pad, theme }) => {\n const spacing = theme.base.spacing;\n\n return css`\n flex-grow: 1;\n max-width: 100%;\n\n ${pad &&\n css`\n padding: 0 calc(2 * ${spacing}) calc(2 * ${spacing});\n `}\n `;\n});\nStyledRegions.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div``;\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledScrollableTabPanel: typeof TabPanel = styled(TabPanel)(() => {\n return css`\n height: 100%;\n overflow: auto;\n `;\n});\n\nStyledScrollableTabPanel.defaultProps = defaultThemeProp;\n\nexport const StyledPageLayout = styled.div<{\n scrollContent: PageLayoutProps['scrollContent'];\n minContentHeight?: number;\n}>(({ theme, scrollContent, minContentHeight }) => {\n const emptyContentHeight = minContentHeight ? `${minContentHeight}px` : undefined;\n\n return css`\n --content-height-in-view: ${emptyContentHeight};\n position: relative;\n min-height: inherit;\n background-color: ${theme.base.palette['app-background']};\n\n ${scrollContent &&\n css`\n ${StyledContent} {\n position: relative;\n }\n\n ${StyledRegions} {\n position: absolute;\n height: 100%;\n width: 100%;\n overflow: auto;\n }\n `}\n `;\n});\n\nStyledPageLayout.defaultProps = defaultThemeProp;\n\nconst PageLayout: FunctionComponent<PageLayoutProps & ForwardProps> = forwardRef(\n (\n {\n regions,\n cols = `repeat(${regions.length}, minmax(0, 1fr))`,\n title,\n icon,\n path,\n actions,\n banners,\n tabs,\n as,\n header,\n regionsRef,\n scrollContent = false,\n ...restProps\n }: PropsWithoutRef<PageLayoutProps>,\n ref: PageLayoutProps['ref']\n ) => {\n const [contentEl, setContentEl] = useElement<HTMLElement>();\n const isMediumOrAbove = useBreakpoint('md');\n const hasSideBySideColumns = regions.length > 1 && isMediumOrAbove;\n const { headerEl } = useContext(AppShellContext);\n\n const consolidatedRegionRef = useConsolidatedRef(regionsRef);\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;\n scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;\n\n useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);\n\n const renderSingleRegion = regions?.length === 1;\n\n const [minContentHeight, setMinContentHeight] = useState<number | undefined>();\n\n useEffect(() => {\n if (consolidatedRegionRef && consolidatedRegionRef.current) {\n const refElement = consolidatedRegionRef.current;\n const regionsPaddingBottomPixels = Number.parseInt(\n window.getComputedStyle(refElement).getPropertyValue('padding-bottom'),\n 10\n );\n\n const resizeObserver = new ResizeObserver(() => {\n const headerOffset = headerEl?.offsetHeight ?? 0;\n const emptyHeight =\n document.documentElement.offsetHeight -\n (headerOffset + refElement?.offsetTop) -\n regionsPaddingBottomPixels;\n\n setMinContentHeight(emptyHeight);\n });\n\n resizeObserver.observe(refElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n }, [consolidatedRegionRef, headerEl]);\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: 'column',\n alignItems: 'stretch',\n gap: 2\n }}\n scrollContent={scrollContent}\n as={StyledPageLayout}\n forwardedAs={as}\n ref={ref}\n minContentHeight={minContentHeight}\n >\n <Flex\n container={{ direction: 'column', pad: [2, 2, 0] }}\n item={{ grow: 0, shrink: 0 }}\n as={StyledPageHeader}\n >\n {path && path.length > 0 && <Breadcrumbs path={...path} />}\n\n {header || (\n <SummaryItem\n visual={\n icon && (\n <StyledPageIcon container={{ alignItems: 'center', justify: 'center' }}>\n <Icon name={icon} />\n </StyledPageIcon>\n )\n }\n primary={<Text variant='h1'>{title}</Text>}\n actions={actions}\n />\n )}\n\n {banners}\n {tabs}\n </Flex>\n\n <Flex\n container\n item={{ grow: 1 }}\n as={StyledContent}\n ref={scrollContent ? setContentEl : undefined}\n >\n {renderSingleRegion && (\n <StyledRegions ref={consolidatedRegionRef} pad>\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[0] = el;\n }\n }}\n fillHeight\n >\n {regions[0]}\n </Flex>\n </StyledRegions>\n )}\n\n {!renderSingleRegion && (\n <Grid\n container={{\n cols: 'minmax(0, 1fr)',\n alignItems: 'start',\n gap: 2,\n pad: [0, 2, 2]\n }}\n md={{ container: { cols } }}\n as={StyledRegions}\n ref={consolidatedRegionRef}\n >\n {regions.map((colItems, i) => {\n return (\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n // eslint-disable-next-line react/no-array-index-key\n key={i}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[i] = el;\n }\n }}\n >\n {colItems}\n </Flex>\n );\n })}\n </Grid>\n )}\n </Flex>\n </Flex>\n );\n }\n);\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, a, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n const [tabId, setTabId] = useState(tabs.currentTabId ?? tabs.tabs[0]?.id);\n\n return (\n <PageLayout\n {...restProps}\n tabs={\n <Tabs\n {...tabs}\n onTabClick={(id, e) => {\n setTabId(id);\n tabs.onTabClick?.(id, e);\n }}\n />\n }\n regions={[\n <Flex container={{ direction: 'column', gap: 2 }} as={TabPanel} tabId={tabId}>\n {a}\n </Flex>\n ]}\n ref={ref}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n ({ a, ...restProps }: PropsWithoutRef<OneColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a]} ref={ref} {...restProps} cols='minmax(0, 1fr)' />;\n }\n);\n\nexport const TwoColumnPage: FunctionComponent<TwoColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<TwoColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='repeat(2, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const ThreeColumnPage: FunctionComponent<ThreeColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, c, ...restProps }: PropsWithoutRef<ThreeColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b, c]} ref={ref} {...restProps} cols='repeat(3, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const FourColumnPage: FunctionComponent<FourColumnPageProps & ForwardProps> = forwardRef(\n (\n { a, b, c, d, ...restProps }: PropsWithoutRef<FourColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c, d]}\n ref={ref}\n {...restProps}\n cols='repeat(4, minmax(0, 1fr))'\n />\n );\n }\n);\n\nexport const WideNarrowPage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 2fr) minmax(0, 1fr)' />\n );\n }\n);\n\nexport const NarrowWidePage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 1fr) minmax(0, 2fr)' />\n );\n }\n);\n\nexport const WideWideNarrowPage: FunctionComponent<WideWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<WideWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='repeat(2, minmax(0, 2fr)) minmax(0, 1fr)'\n />\n );\n }\n );\n\nexport const NarrowWideWidePage: FunctionComponent<NarrowWideWidePageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideWidePageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) repeat(2, minmax(0, 2fr))'\n />\n );\n }\n );\n\nexport const NarrowWideNarrowPage: FunctionComponent<NarrowWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr)'\n />\n );\n }\n );\n"]}
|
|
1
|
+
{"version":3,"file":"PageTemplates.js","sourceRoot":"","sources":["../../../src/components/PageTemplates/PageTemplates.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EAKR,MAAM,EAEN,UAAU,EACV,SAAS,EACV,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,WAAW,MAAM,gBAAgB,CAAC;AACzC,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,IAAI,EAAE,EAAE,QAAQ,EAAkB,MAAM,SAAS,CAAC;AACzD,OAAO,IAAI,MAAM,SAAS,C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C/C,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAC7B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA4C,EACnE,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,GAAG,EAAE,GAAG,KACJ,SAAS,EACb,IAAI,EAAC,0CAA0C,GAC/C,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEJ,MAAM,CAAC,MAAM,oBAAoB,GAC/B,UAAU,CACR,CACE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,SAAS,EAA8C,EACrE,GAAwB,EACxB,EAAE;IACF,OAAO,CACL,KAAC,UAAU,IACT,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,GAAG,EAAE,GAAG,KACJ,SAAS,EACb,IAAI,EAAC,8CAA8C,GACnD,CACH,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n forwardRef,\n useState,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n ReactNode,\n useRef,\n ReactElement,\n useContext,\n useEffect\n} from 'react';\nimport styled, { css } from 'styled-components';\nimport { readableColor } from 'polished';\n\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, AsProp, OmitStrict } from '../../types';\nimport Grid from '../Grid';\nimport Text from '../Text';\nimport SummaryItem from '../SummaryItem';\nimport Icon from '../Icon';\nimport { tryCatch } from '../../utils';\nimport Tabs, { TabPanel, TabsProps, Tab } from '../Tabs';\nimport Flex from '../Flex';\nimport { useBreakpoint, useElement, useScrollStick, useConsolidatedRef } from '../../hooks';\nimport type { ScrollStickOptions } from '../../hooks/useScrollStick';\nimport Breadcrumbs, { BreadcrumbsProps, StyledBreadcrumbs } from '../Breadcrumbs';\nimport AppShellContext from '../AppShell/AppShellContext';\nimport { StyledBanner } from '../Banner/Banner';\nimport { StyledTabs } from '../Tabs/Tabs';\n\nexport interface PageTemplateProps extends BaseProps, AsProp, NoChildrenProp {\n title: string;\n icon?: string;\n actions?: ReactNode;\n banners?: ReactNode;\n path?: BreadcrumbsProps['path'];\n header?: ReactNode;\n scrollContent?: boolean;\n ref?: Ref<HTMLDivElement>;\n}\n\ninterface TabbedPageTab extends Tab {\n content: ReactNode;\n}\n\nexport interface TabbedPageProps extends PageTemplateProps {\n tabs: OmitStrict<TabsProps, 'tabs' | 'currentTabId'> & {\n tabs: TabbedPageTab[];\n defaultTabId?: string;\n };\n}\n\nexport interface OneColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n}\n\nexport interface TwoColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface ThreeColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface FourColumnPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n d: ReactNode;\n}\n\nexport interface WideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface NarrowWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n}\n\nexport interface WideWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideWidePageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface NarrowWideNarrowPageProps extends PageTemplateProps {\n a: ReactNode;\n b: ReactNode;\n c: ReactNode;\n}\n\nexport interface PageLayoutProps extends PageTemplateProps {\n tabs?: ReactElement<typeof Tabs>;\n regions: ReactNode[];\n regionsRef?: Ref<HTMLDivElement>;\n cols?: string;\n}\n\nexport const StyledPageIcon = styled(Flex)(({ theme }) => {\n const bgColor = theme.base.palette['brand-primary'];\n const color = tryCatch(() => readableColor(bgColor));\n return css`\n height: calc(4 * ${theme.base.spacing});\n width: calc(4 * ${theme.base.spacing});\n background: ${bgColor};\n color: ${color};\n border-radius: calc(0.5 * ${theme.base['border-radius']});\n `;\n});\n\nStyledPageIcon.defaultProps = defaultThemeProp;\n\nexport const StyledPageHeader = styled.header(({ theme }) => {\n return css`\n ${StyledBreadcrumbs} {\n margin-block-end: ${theme.base.spacing};\n }\n\n ${StyledBanner},\n ${StyledTabs} {\n margin-block-start: calc(2 * ${theme.base.spacing});\n }\n `;\n});\n\nStyledPageHeader.defaultProps = defaultThemeProp;\n\nexport const StyledRegion = styled.div``;\nStyledRegion.defaultProps = defaultThemeProp;\n\nexport const StyledRegions = styled.div<{ pad: boolean }>(({ pad, theme }) => {\n const spacing = theme.base.spacing;\n\n return css`\n flex-grow: 1;\n max-width: 100%;\n\n ${pad &&\n css`\n padding: 0 calc(2 * ${spacing}) calc(2 * ${spacing});\n `}\n `;\n});\nStyledRegions.defaultProps = defaultThemeProp;\n\nexport const StyledContent = styled.div``;\nStyledContent.defaultProps = defaultThemeProp;\n\nexport const StyledScrollableTabPanel: typeof TabPanel = styled(TabPanel)(() => {\n return css`\n height: 100%;\n overflow: auto;\n `;\n});\n\nStyledScrollableTabPanel.defaultProps = defaultThemeProp;\n\nexport const StyledPageLayout = styled.div<{\n scrollContent: PageLayoutProps['scrollContent'];\n minContentHeight?: number;\n}>(({ theme, scrollContent, minContentHeight }) => {\n const emptyContentHeight = minContentHeight ? `${minContentHeight}px` : undefined;\n\n return css`\n --content-height-in-view: ${emptyContentHeight};\n position: relative;\n min-height: inherit;\n background-color: ${theme.base.palette['app-background']};\n\n ${scrollContent &&\n css`\n ${StyledContent} {\n position: relative;\n }\n\n ${StyledRegions} {\n position: absolute;\n height: 100%;\n width: 100%;\n overflow: auto;\n }\n `}\n `;\n});\n\nStyledPageLayout.defaultProps = defaultThemeProp;\n\nconst PageLayout: FunctionComponent<PageLayoutProps & ForwardProps> = forwardRef(\n (\n {\n regions,\n cols = `repeat(${regions.length}, minmax(0, 1fr))`,\n title,\n icon,\n path,\n actions,\n banners,\n tabs,\n as,\n header,\n regionsRef,\n scrollContent = false,\n ...restProps\n }: PropsWithoutRef<PageLayoutProps>,\n ref: PageLayoutProps['ref']\n ) => {\n const [contentEl, setContentEl] = useElement<HTMLElement>();\n const isMediumOrAbove = useBreakpoint('md');\n const hasSideBySideColumns = regions.length > 1 && isMediumOrAbove;\n const { headerEl } = useContext(AppShellContext);\n\n const consolidatedRegionRef = useConsolidatedRef(regionsRef);\n const scrollStickOptions = useRef<ScrollStickOptions & { elements: HTMLElement[] }>({\n elements: []\n });\n\n scrollStickOptions.current.scrollContainer = scrollContent && contentEl ? contentEl : undefined;\n scrollStickOptions.current.offset = (headerEl?.offsetHeight ?? 0) + 16;\n\n useScrollStick(hasSideBySideColumns ? scrollStickOptions.current : undefined);\n\n const renderSingleRegion = regions?.length === 1;\n\n const [minContentHeight, setMinContentHeight] = useState<number | undefined>();\n\n useEffect(() => {\n if (consolidatedRegionRef && consolidatedRegionRef.current) {\n const refElement = consolidatedRegionRef.current;\n const regionsPaddingBottomPixels = Number.parseInt(\n window.getComputedStyle(refElement).getPropertyValue('padding-bottom'),\n 10\n );\n\n const resizeObserver = new ResizeObserver(() => {\n const headerOffset = headerEl?.offsetHeight ?? 0;\n const emptyHeight =\n document.documentElement.offsetHeight -\n (headerOffset + refElement?.offsetTop) -\n regionsPaddingBottomPixels;\n\n setMinContentHeight(emptyHeight);\n });\n\n resizeObserver.observe(refElement);\n\n return () => {\n resizeObserver.disconnect();\n };\n }\n }, [consolidatedRegionRef, headerEl]);\n\n return (\n <Flex\n {...restProps}\n container={{\n direction: 'column',\n alignItems: 'stretch',\n gap: 2\n }}\n scrollContent={scrollContent}\n as={StyledPageLayout}\n forwardedAs={as}\n ref={ref}\n minContentHeight={minContentHeight}\n >\n <Flex\n container={{ direction: 'column', pad: [2, 2, 0] }}\n item={{ grow: 0, shrink: 0 }}\n as={StyledPageHeader}\n >\n {path && path.length > 0 && <Breadcrumbs path={...path} />}\n\n {header || (\n <SummaryItem\n visual={\n icon && (\n <StyledPageIcon container={{ alignItems: 'center', justify: 'center' }}>\n <Icon name={icon} />\n </StyledPageIcon>\n )\n }\n primary={<Text variant='h1'>{title}</Text>}\n actions={actions}\n />\n )}\n\n {banners}\n {tabs}\n </Flex>\n\n <Flex\n container\n item={{ grow: 1 }}\n as={StyledContent}\n ref={scrollContent ? setContentEl : undefined}\n >\n {renderSingleRegion && (\n <StyledRegions ref={consolidatedRegionRef} pad>\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[0] = el;\n }\n }}\n >\n {regions[0]}\n </Flex>\n </StyledRegions>\n )}\n\n {!renderSingleRegion && (\n <Grid\n container={{\n cols: 'minmax(0, 1fr)',\n alignItems: 'start',\n gap: 2,\n pad: [0, 2, 2]\n }}\n md={{ container: { cols } }}\n as={StyledRegions}\n ref={consolidatedRegionRef}\n >\n {regions.map((colItems, i) => {\n return (\n <Flex\n container={{\n direction: 'column',\n gap: 2\n }}\n as={StyledRegion}\n // eslint-disable-next-line react/no-array-index-key\n key={i}\n ref={(el: HTMLDivElement | null) => {\n if (el) {\n scrollStickOptions.current.elements[i] = el;\n }\n }}\n >\n {colItems}\n </Flex>\n );\n })}\n </Grid>\n )}\n </Flex>\n </Flex>\n );\n }\n);\n\nexport const TabbedPage: FunctionComponent<TabbedPageProps & ForwardProps> = forwardRef(\n ({ tabs, ...restProps }: PropsWithoutRef<TabbedPageProps>, ref: Ref<HTMLDivElement>) => {\n const [tabId, setTabId] = useState(tabs.defaultTabId || tabs.tabs[0]?.id);\n\n const tabPanels = tabs.tabs.map(tab => {\n return (\n <Flex\n container={{ direction: 'column', gap: 2 }}\n as={TabPanel}\n tabId={tab.id}\n currentTabId={tabId}\n key={tab.id}\n >\n {tab.content}\n </Flex>\n );\n });\n\n return (\n <PageLayout\n {...restProps}\n tabs={\n <Tabs\n {...tabs}\n onTabClick={(id, e) => {\n setTabId(id);\n tabs.onTabClick?.(id, e);\n }}\n currentTabId={tabId}\n />\n }\n regions={[<>{tabPanels}</>]}\n ref={ref}\n />\n );\n }\n);\n\nexport const OneColumnPage: FunctionComponent<OneColumnPageProps & ForwardProps> = forwardRef(\n ({ a, ...restProps }: PropsWithoutRef<OneColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return <PageLayout regions={[a]} ref={ref} {...restProps} cols='minmax(0, 1fr)' />;\n }\n);\n\nexport const TwoColumnPage: FunctionComponent<TwoColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<TwoColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='repeat(2, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const ThreeColumnPage: FunctionComponent<ThreeColumnPageProps & ForwardProps> = forwardRef(\n ({ a, b, c, ...restProps }: PropsWithoutRef<ThreeColumnPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b, c]} ref={ref} {...restProps} cols='repeat(3, minmax(0, 1fr))' />\n );\n }\n);\n\nexport const FourColumnPage: FunctionComponent<FourColumnPageProps & ForwardProps> = forwardRef(\n (\n { a, b, c, d, ...restProps }: PropsWithoutRef<FourColumnPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c, d]}\n ref={ref}\n {...restProps}\n cols='repeat(4, minmax(0, 1fr))'\n />\n );\n }\n);\n\nexport const WideNarrowPage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 2fr) minmax(0, 1fr)' />\n );\n }\n);\n\nexport const NarrowWidePage: FunctionComponent<WideNarrowPageProps & ForwardProps> = forwardRef(\n ({ a, b, ...restProps }: PropsWithoutRef<WideNarrowPageProps>, ref: Ref<HTMLDivElement>) => {\n return (\n <PageLayout regions={[a, b]} ref={ref} {...restProps} cols='minmax(0, 1fr) minmax(0, 2fr)' />\n );\n }\n);\n\nexport const WideWideNarrowPage: FunctionComponent<WideWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<WideWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='repeat(2, minmax(0, 2fr)) minmax(0, 1fr)'\n />\n );\n }\n );\n\nexport const NarrowWideWidePage: FunctionComponent<NarrowWideWidePageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideWidePageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) repeat(2, minmax(0, 2fr))'\n />\n );\n }\n );\n\nexport const NarrowWideNarrowPage: FunctionComponent<NarrowWideNarrowPageProps & ForwardProps> =\n forwardRef(\n (\n { a, b, c, ...restProps }: PropsWithoutRef<NarrowWideNarrowPageProps>,\n ref: Ref<HTMLDivElement>\n ) => {\n return (\n <PageLayout\n regions={[a, b, c]}\n ref={ref}\n {...restProps}\n cols='minmax(0, 1fr) minmax(0, 3fr) minmax(0, 1fr)'\n />\n );\n }\n );\n"]}
|
|
@@ -16,7 +16,7 @@ export interface PhoneInputProps extends FormControlProps, BaseProps, NoChildren
|
|
|
16
16
|
/** CCallback fired when the component gets focus */
|
|
17
17
|
onFocus?: (value: string) => void;
|
|
18
18
|
/** Ref for the wrapping element. */
|
|
19
|
-
ref?: Ref<
|
|
19
|
+
ref?: Ref<HTMLInputElement>;
|
|
20
20
|
}
|
|
21
21
|
declare const PhoneInput: FunctionComponent<PhoneInputProps & ForwardProps>;
|
|
22
22
|
export default PhoneInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,GAAG,
|
|
1
|
+
{"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAEjB,GAAG,EAGJ,MAAM,OAAO,CAAC;AAKf,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAqB,MAAM,aAAa,CAAC;AAEzF,OAAO,EAAE,gBAAgB,EAAqB,MAAM,gBAAgB,CAAC;AAUrE,MAAM,WAAW,eAAgB,SAAQ,gBAAgB,EAAE,SAAS,EAAE,cAAc;IAClF;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,oDAAoD;IACpD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,oCAAoC;IACpC,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC7B;AAwBD,QAAA,MAAM,UAAU,EAAE,iBAAiB,CAAC,eAAe,GAAG,YAAY,CA+GjE,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef,
|
|
2
|
+
import { forwardRef, useCallback, useRef } from 'react';
|
|
3
3
|
import styled, { css } from 'styled-components';
|
|
4
|
-
import {
|
|
4
|
+
import { useConsolidatedRef, useDirection, useFocusWithin, useInputFormatter } from '../../hooks';
|
|
5
5
|
import { defaultThemeProp } from '../../theme';
|
|
6
6
|
import FormField from '../FormField';
|
|
7
7
|
import { StyledFormControl } from '../FormControl';
|
|
@@ -11,7 +11,7 @@ import Input from '../Input';
|
|
|
11
11
|
import { StyledSelect } from '../Select/Select';
|
|
12
12
|
import Flex from '../Flex';
|
|
13
13
|
import callingCodes from './callingCodes';
|
|
14
|
-
import {
|
|
14
|
+
import { convertToCallbackParameter, formatPhoneNumber, getPhoneNumberParts } from './utils';
|
|
15
15
|
const StyledPhoneInput = styled.div(() => {
|
|
16
16
|
const { start, end } = useDirection();
|
|
17
17
|
return css `
|
|
@@ -31,50 +31,33 @@ const StyledPhoneInput = styled.div(() => {
|
|
|
31
31
|
});
|
|
32
32
|
StyledPhoneInput.defaultProps = defaultThemeProp;
|
|
33
33
|
const PhoneInput = forwardRef((props, ref) => {
|
|
34
|
-
const {
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const [countryCode, setCountryCode] = useState(showCountryCode ? phoneNumberParts?.[0] || callingCodesList[0] : phoneNumberParts?.[0]);
|
|
39
|
-
const [phoneNumber, setPhoneNumber] = useState(phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : '');
|
|
40
|
-
useAfterInitialEffect(() => {
|
|
41
|
-
setCountryCode(phoneNumberParts?.[0]);
|
|
42
|
-
setPhoneNumber(phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : '');
|
|
43
|
-
}, [phoneNumberParts]);
|
|
44
|
-
const [cursor, setCursor] = useState(undefined);
|
|
45
|
-
const inputRef = useRef(null);
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
if (cursor !== undefined)
|
|
48
|
-
inputRef.current?.setSelectionRange(cursor, cursor);
|
|
49
|
-
}, [cursor, inputRef.current]);
|
|
34
|
+
const { value, id, label, labelHidden, info, status, required, readOnly, disabled, showCountryCode = false, callingCodesList = callingCodes, onChange, onBlur, onFocus, ...restProps } = props;
|
|
35
|
+
const [countryCode = callingCodesList[0], subscriberNumber = ''] = value
|
|
36
|
+
? getPhoneNumberParts(value, callingCodesList)
|
|
37
|
+
: [];
|
|
50
38
|
const onFocusChange = (focused) => {
|
|
51
|
-
const callbackParam = convertToCallbackParameter(countryCode,
|
|
39
|
+
const callbackParam = convertToCallbackParameter(countryCode, subscriberNumber);
|
|
52
40
|
if (focused)
|
|
53
41
|
onFocus?.(callbackParam);
|
|
54
42
|
else
|
|
55
43
|
onBlur?.(callbackParam);
|
|
56
44
|
};
|
|
57
|
-
const containerRef = useRef(null);
|
|
58
|
-
useFocusWithin([containerRef], onFocusChange);
|
|
59
45
|
const onInputChange = (e) => {
|
|
60
|
-
|
|
61
|
-
const selectionStart = e.target.selectionStart;
|
|
62
|
-
const formatted = formatPhoneNumber(inputValue, countryCode);
|
|
63
|
-
setPhoneNumber(formatted);
|
|
64
|
-
if (countryCode) {
|
|
65
|
-
setCursor(calculateCursorPosition(formatted, phoneNumber, countryCode, selectionStart));
|
|
66
|
-
}
|
|
67
|
-
onChange?.(convertToCallbackParameter(countryCode, formatted));
|
|
46
|
+
onChange?.(convertToCallbackParameter(countryCode, e.target.value));
|
|
68
47
|
};
|
|
69
48
|
const onSelectChange = (e) => {
|
|
70
|
-
|
|
71
|
-
setCountryCode(selectValue);
|
|
72
|
-
setPhoneNumber(formatPhoneNumber(phoneNumber, selectValue));
|
|
73
|
-
onChange?.(convertToCallbackParameter(selectValue, phoneNumber));
|
|
49
|
+
onChange?.(convertToCallbackParameter(e.target.value, subscriberNumber));
|
|
74
50
|
};
|
|
51
|
+
const inputRef = useConsolidatedRef(ref);
|
|
52
|
+
const containerRef = useRef(null);
|
|
53
|
+
useFocusWithin([containerRef], onFocusChange);
|
|
54
|
+
const formatter = useCallback(number => {
|
|
55
|
+
return formatPhoneNumber(number.replace(/\D+/g, ''), countryCode);
|
|
56
|
+
}, [countryCode]);
|
|
57
|
+
const formatted = useInputFormatter(inputRef, subscriberNumber, formatter);
|
|
75
58
|
const codesOptions = (_jsx(_Fragment, { children: callingCodesList.map(code => (_jsx(Option, { value: code, children: code }, code))) }));
|
|
76
|
-
const Comp = (_jsxs(StyledPhoneInput, { as: StyledFormControl, forwardedAs: Flex, container: { alignItems: 'center', wrap: 'nowrap' }, ref: containerRef, status: status, readOnly: readOnly, disabled: disabled, children: [showCountryCode && (_jsx(Select, { value: countryCode, onChange: onSelectChange, required: required, status: status, readOnly: readOnly, disabled: disabled, children: codesOptions })), _jsx(Input, { ...restProps, inputMode: 'tel', ref: inputRef, value:
|
|
77
|
-
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info,
|
|
59
|
+
const Comp = (_jsxs(StyledPhoneInput, { as: StyledFormControl, forwardedAs: Flex, container: { alignItems: 'center', wrap: 'nowrap' }, ref: containerRef, status: status, readOnly: readOnly, disabled: disabled, children: [showCountryCode && (_jsx(Select, { value: countryCode, onChange: onSelectChange, required: required, status: status, readOnly: readOnly, disabled: disabled, autocomplete: 'tel-country-code', children: codesOptions })), _jsx(Input, { ...restProps, inputMode: 'tel', ref: inputRef, value: formatted, onChange: onInputChange, required: required, status: status, readOnly: readOnly, disabled: disabled, autocomplete: 'tel-national' })] }));
|
|
60
|
+
return label ? (_jsx(FormField, { as: 'fieldset', labelAs: 'legend', ...{ label, labelHidden, id, info, status, required, disabled }, children: Comp })) : (Comp);
|
|
78
61
|
});
|
|
79
62
|
export default PhoneInput;
|
|
80
63
|
//# sourceMappingURL=PhoneInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PhoneInput.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,SAAS,EACT,OAAO,EACP,MAAM,EACN,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AAE,QAAQ,EAAE,YAEpE,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useAfterInitialEffect, useDirection, useFocusWithin } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, PropsWithDefaults } from '../../types';\nimport FormField from '../FormField';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport StyledInput from '../Input/Input.styles';\nimport Select, { Option } from '../Select';\nimport Input from '../Input';\nimport { StyledSelect } from '../Select/Select';\nimport Flex from '../Flex';\n\nimport callingCodes from './callingCodes';\nimport {\n calculateCursorPosition,\n convertToCallbackParameter,\n formatPhoneNumber,\n getPhoneNumberParts\n} from './utils';\n\nexport interface PhoneInputProps extends FormControlProps, BaseProps, NoChildrenProp {\n /**\n * Display select with countries calling codes\n * @default false\n */\n showCountryCode?: boolean;\n /** Changes lists of countries calling codes */\n callingCodesList?: string[];\n /** Callback fired on input value change */\n onChange?: (value: string) => void;\n /** Callback fired when the component loses focus */\n onBlur?: (value: string) => void;\n /** CCallback fired when the component gets focus */\n onFocus?: (value: string) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLDivElement>;\n}\n\ntype PhoneInputPropsWithDefaults = PropsWithDefaults<PhoneInputProps>;\n\nconst StyledPhoneInput = styled.div<PhoneInputPropsWithDefaults>(() => {\n const { start, end } = useDirection();\n return css`\n border: 0;\n > ${StyledSelect} {\n max-width: max-content;\n border-inline-end: none;\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n\n > ${StyledSelect} + ${StyledInput} {\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n }\n `;\n});\n\nStyledPhoneInput.defaultProps = defaultThemeProp;\n\nconst PhoneInput: FunctionComponent<PhoneInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<PhoneInputProps>, ref: PhoneInputProps['ref']) => {\n const {\n defaultValue,\n value = defaultValue,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n showCountryCode = false,\n callingCodesList = callingCodes,\n onChange,\n onBlur,\n onFocus,\n ...restProps\n } = props;\n\n const phoneNumberParts = useMemo(() => {\n return value ? getPhoneNumberParts(value, callingCodesList) : undefined;\n }, [callingCodesList, value]);\n\n const [countryCode, setCountryCode] = useState(\n showCountryCode ? phoneNumberParts?.[0] || callingCodesList[0] : phoneNumberParts?.[0]\n );\n\n const [phoneNumber, setPhoneNumber] = useState(\n phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : ''\n );\n\n useAfterInitialEffect(() => {\n setCountryCode(phoneNumberParts?.[0]);\n setPhoneNumber(phoneNumberParts ? formatPhoneNumber(phoneNumberParts[1], countryCode) : '');\n }, [phoneNumberParts]);\n\n const [cursor, setCursor] = useState<number | undefined>(undefined);\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (cursor !== undefined) inputRef.current?.setSelectionRange(cursor, cursor);\n }, [cursor, inputRef.current]);\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(countryCode, phoneNumber);\n if (focused) onFocus?.(callbackParam);\n else onBlur?.(callbackParam);\n };\n\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const inputValue = e.target.value;\n const selectionStart = e.target.selectionStart;\n const formatted = formatPhoneNumber(inputValue, countryCode);\n setPhoneNumber(formatted);\n if (countryCode) {\n setCursor(calculateCursorPosition(formatted, phoneNumber, countryCode, selectionStart));\n }\n onChange?.(convertToCallbackParameter(countryCode, formatted));\n };\n\n const onSelectChange = (e: ChangeEvent<HTMLSelectElement>) => {\n const selectValue = e.target.value;\n setCountryCode(selectValue);\n setPhoneNumber(formatPhoneNumber(phoneNumber, selectValue));\n onChange?.(convertToCallbackParameter(selectValue, phoneNumber));\n };\n\n const codesOptions = (\n <>\n {callingCodesList.map(code => (\n <Option key={code} value={code}>\n {code}\n </Option>\n ))}\n </>\n );\n\n const Comp = (\n <StyledPhoneInput\n as={StyledFormControl}\n forwardedAs={Flex as any}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n {showCountryCode && (\n <Select\n value={countryCode}\n onChange={onSelectChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n {codesOptions}\n </Select>\n )}\n <Input\n {...restProps}\n inputMode='tel'\n ref={inputRef}\n value={phoneNumber}\n onChange={onInputChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n />\n </StyledPhoneInput>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, ref, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default PhoneInput;\n"]}
|
|
1
|
+
{"version":3,"file":"PhoneInput.js","sourceRoot":"","sources":["../../../src/components/Phone/PhoneInput.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,UAAU,EAIV,WAAW,EACX,MAAM,EACP,MAAM,OAAO,CAAC;AACf,OAAO,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClG,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAoB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,WA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EF,MAAM,IAAI,GAAG,CACX,MAAC,gBAAgB,IACf,EAAE,EAAE,iBAAiB,EACrB,WAAW,EAAE,IAAW,EACxB,SAAS,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,EACnD,GAAG,EAAE,YAAY,EACjB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,aAEjB,eAAe,IAAI,CAClB,KAAC,MAAM,IACL,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,cAAc,EACxB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAC,kBAAkB,YAE9B,YAAY,GACN,CACV,EACD,KAAC,KAAK,OACA,SAAS,EACb,SAAS,EAAC,KAAK,EACf,GAAG,EAAE,QAAQ,EACb,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,aAAa,EACvB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAC,cAAc,GAC3B,IACe,CACpB,CAAC;IAEF,OAAO,KAAK,CAAC,CAAC,CAAC,CACb,KAAC,SAAS,IACR,EAAE,EAAC,UAAU,EACb,OAAO,EAAC,QAAQ,KACZ,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAE/D,IAAI,GACK,CACb,CAAC,CAAC,CAAC,CACF,IAAI,CACL,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,UAAU,CAAC","sourcesContent":["import {\n ChangeEvent,\n forwardRef,\n FunctionComponent,\n PropsWithoutRef,\n Ref,\n useCallback,\n useRef\n} from 'react';\nimport styled, { css } from 'styled-components';\n\nimport { useConsolidatedRef, useDirection, useFocusWithin, useInputFormatter } from '../../hooks';\nimport { defaultThemeProp } from '../../theme';\nimport { BaseProps, ForwardProps, NoChildrenProp, PropsWithDefaults } from '../../types';\nimport FormField from '../FormField';\nimport { FormControlProps, StyledFormControl } from '../FormControl';\nimport StyledInput from '../Input/Input.styles';\nimport Select, { Option } from '../Select';\nimport Input from '../Input';\nimport { StyledSelect } from '../Select/Select';\nimport Flex from '../Flex';\n\nimport callingCodes from './callingCodes';\nimport { convertToCallbackParameter, formatPhoneNumber, getPhoneNumberParts } from './utils';\n\nexport interface PhoneInputProps extends FormControlProps, BaseProps, NoChildrenProp {\n /**\n * Display select with countries calling codes\n * @default false\n */\n showCountryCode?: boolean;\n /** Changes lists of countries calling codes */\n callingCodesList?: string[];\n /** Callback fired on input value change */\n onChange?: (value: string) => void;\n /** Callback fired when the component loses focus */\n onBlur?: (value: string) => void;\n /** CCallback fired when the component gets focus */\n onFocus?: (value: string) => void;\n /** Ref for the wrapping element. */\n ref?: Ref<HTMLInputElement>;\n}\n\ntype PhoneInputPropsWithDefaults = PropsWithDefaults<PhoneInputProps>;\n\nconst StyledPhoneInput = styled.div<PhoneInputPropsWithDefaults>(() => {\n const { start, end } = useDirection();\n return css`\n border: 0;\n > ${StyledSelect} {\n max-width: max-content;\n border-inline-end: none;\n ${`border-top-${end}-radius`}: 0;\n ${`border-bottom-${end}-radius`}: 0;\n }\n\n > ${StyledSelect} + ${StyledInput} {\n ${`border-top-${start}-radius`}: 0;\n ${`border-bottom-${start}-radius`}: 0;\n }\n `;\n});\n\nStyledPhoneInput.defaultProps = defaultThemeProp;\n\nconst PhoneInput: FunctionComponent<PhoneInputProps & ForwardProps> = forwardRef(\n (props: PropsWithoutRef<PhoneInputProps>, ref: PhoneInputProps['ref']) => {\n const {\n value,\n id,\n label,\n labelHidden,\n info,\n status,\n required,\n readOnly,\n disabled,\n showCountryCode = false,\n callingCodesList = callingCodes,\n onChange,\n onBlur,\n onFocus,\n ...restProps\n } = props;\n\n const [countryCode = callingCodesList[0], subscriberNumber = ''] = value\n ? getPhoneNumberParts(value, callingCodesList)\n : [];\n\n const onFocusChange = (focused: boolean) => {\n const callbackParam = convertToCallbackParameter(countryCode, subscriberNumber);\n if (focused) onFocus?.(callbackParam);\n else onBlur?.(callbackParam);\n };\n\n const onInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n onChange?.(convertToCallbackParameter(countryCode, e.target.value));\n };\n\n const onSelectChange = (e: ChangeEvent<HTMLSelectElement>) => {\n onChange?.(convertToCallbackParameter(e.target.value, subscriberNumber));\n };\n\n const inputRef = useConsolidatedRef<HTMLInputElement>(ref);\n const containerRef = useRef<HTMLElement>(null);\n useFocusWithin([containerRef], onFocusChange);\n\n const formatter = useCallback(\n number => {\n return formatPhoneNumber(number.replace(/\\D+/g, ''), countryCode);\n },\n [countryCode]\n );\n\n const formatted = useInputFormatter(inputRef, subscriberNumber, formatter);\n\n const codesOptions = (\n <>\n {callingCodesList.map(code => (\n <Option key={code} value={code}>\n {code}\n </Option>\n ))}\n </>\n );\n\n const Comp = (\n <StyledPhoneInput\n as={StyledFormControl}\n forwardedAs={Flex as any}\n container={{ alignItems: 'center', wrap: 'nowrap' }}\n ref={containerRef}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n >\n {showCountryCode && (\n <Select\n value={countryCode}\n onChange={onSelectChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n autocomplete='tel-country-code'\n >\n {codesOptions}\n </Select>\n )}\n <Input\n {...restProps}\n inputMode='tel'\n ref={inputRef}\n value={formatted}\n onChange={onInputChange}\n required={required}\n status={status}\n readOnly={readOnly}\n disabled={disabled}\n autocomplete='tel-national'\n />\n </StyledPhoneInput>\n );\n\n return label ? (\n <FormField\n as='fieldset'\n labelAs='legend'\n {...{ label, labelHidden, id, info, status, required, disabled }}\n >\n {Comp}\n </FormField>\n ) : (\n Comp\n );\n }\n);\n\nexport default PhoneInput;\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
export declare const getPhoneNumberParts: (phoneNumber: string, codesList: string[]) => [string | undefined, string];
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const cleanSubscriberNumber: (phoneNumber: string) => string;
|
|
3
3
|
export declare const getCountry: (countryCode: string, number: string) => import("libphonenumber-js").CountryCode | undefined;
|
|
4
4
|
export declare const formatPhoneNumber: (numberToFormat: string, countryCode?: string) => string;
|
|
5
5
|
export declare const convertToCallbackParameter: (codePart: string | undefined, numberPart: string) => string;
|
|
6
|
-
export declare const calculateCursorPosition: (newValue: string, prevValue: string, countryCode: string, prevCursorPosition: number | null) => number | undefined;
|
|
7
6
|
export declare const formatPhone: (value: string) => string | undefined;
|
|
8
7
|
export default getPhoneNumberParts;
|
|
9
8
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Phone/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,gBACjB,MAAM,aACR,MAAM,EAAE,KAClB,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAK7B,CAAC;AAEF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/Phone/utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB,gBACjB,MAAM,aACR,MAAM,EAAE,KAClB,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,CAK7B,CAAC;AAEF,eAAO,MAAM,qBAAqB,gBAAiB,MAAM,WAExD,CAAC;AAEF,eAAO,MAAM,UAAU,gBAAiB,MAAM,UAAU,MAAM,wDAI7D,CAAC;AAEF,eAAO,MAAM,iBAAiB,mBAAoB,MAAM,gBAAe,MAAM,WAO5E,CAAC;AAEF,eAAO,MAAM,0BAA0B,aAAc,MAAM,GAAG,SAAS,cAAc,MAAM,WAE1F,CAAC;AAEF,eAAO,MAAM,WAAW,UAAW,MAAM,uBAExC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|