@westpac/ui 0.17.0 → 0.18.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/CHANGELOG.md +6 -0
- package/dist/component-type.json +1 -1
- package/dist/components/accordion/accordion.component.d.ts +2 -1
- package/dist/components/autocomplete/autocomplete.component.js +4 -2
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.d.ts +1 -1
- package/dist/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.js +1 -1
- package/dist/components/autocomplete/components/autocomplete-popover/autocomplete-popover.component.js +2 -1
- package/dist/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.js +2 -2
- package/dist/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.js +2 -1
- package/dist/components/button-group/button-group.component.js +58 -11
- package/dist/components/button-group/button-group.types.d.ts +9 -1
- package/dist/components/button-group/components/button-group-button/button-group-button.component.js +1 -2
- package/dist/components/checkbox-group/checkbox-group.component.js +61 -10
- package/dist/components/checkbox-group/checkbox-group.types.d.ts +5 -1
- package/dist/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.js +1 -2
- package/dist/components/date-picker/date-picker.types.d.ts +1 -0
- package/dist/components/error-message/error-message.types.d.ts +3 -2
- package/dist/components/list/components/list-item/list-item.component.d.ts +1 -1
- package/dist/components/list/list.utils.d.ts +1 -1
- package/dist/components/modal/components/modal-backdrop/modal-backdrop.component.js +2 -1
- package/dist/components/modal/components/modal-dialog/modal-dialog.styles.js +2 -2
- package/dist/components/popover/components/panel/panel.styles.js +2 -2
- package/dist/components/radio-group/components/radio-group-radio/radio-group-radio.component.js +1 -2
- package/dist/components/radio-group/radio-group.component.js +58 -11
- package/dist/components/radio-group/radio-group.types.d.ts +5 -1
- package/dist/components/selector/components/selector-button-group/selector-button-group.component.js +9 -7
- package/dist/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.js +50 -1
- package/dist/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.js +1 -1
- package/dist/components/selector/components/selector-radio-group/selector-radio-group.component.js +58 -11
- package/dist/components/selector/components/selector-radio-group/selector-radio-group.types.d.ts +5 -1
- package/dist/components/tabs/components/tabs-tab/tabs-tab.component.js +1 -1
- package/dist/components/tabs/tabs.component.d.ts +6 -2
- package/dist/components/tabs/tabs.component.js +7 -1
- package/dist/constants/message.d.ts +1 -0
- package/dist/constants/message.js +1 -0
- package/package.json +10 -10
- package/src/components/accordion/accordion.component.tsx +3 -3
- package/src/components/accordion/components/accordion-item/accordion-item.component.tsx +2 -2
- package/src/components/autocomplete/autocomplete.component.tsx +5 -1
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.component.tsx +1 -1
- package/src/components/autocomplete/components/autocomplete-list-box/components/autocomplete-list-box-option/autocomplete-list-box-option.styles.ts +1 -1
- package/src/components/autocomplete/components/autocomplete-popover/autocomplete-popover.component.tsx +4 -1
- package/src/components/bottom-sheet/components/bottom-sheet-dialog/bottom-sheet-dialog.styles.ts +2 -2
- package/src/components/bottom-sheet/components/bottom-sheet-modal/bottom-sheet-modal.component.tsx +4 -1
- package/src/components/button-group/button-group.component.tsx +58 -11
- package/src/components/button-group/button-group.types.ts +9 -2
- package/src/components/button-group/components/button-group-button/button-group-button.component.tsx +1 -2
- package/src/components/checkbox-group/checkbox-group.component.tsx +62 -10
- package/src/components/checkbox-group/checkbox-group.types.ts +5 -1
- package/src/components/checkbox-group/components/checkbox-group-checkbox/checkbox-group-checkbox.component.tsx +1 -2
- package/src/components/date-picker/date-picker.types.ts +4 -0
- package/src/components/error-message/error-message.component.tsx +2 -2
- package/src/components/error-message/error-message.types.ts +2 -1
- package/src/components/modal/components/modal-backdrop/modal-backdrop.component.tsx +4 -1
- package/src/components/modal/components/modal-dialog/modal-dialog.styles.ts +2 -2
- package/src/components/pagination/pagination.component.tsx +6 -6
- package/src/components/popover/components/panel/panel.styles.ts +2 -2
- package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx +1 -2
- package/src/components/radio-group/radio-group.component.tsx +57 -13
- package/src/components/radio-group/radio-group.types.ts +5 -1
- package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx +10 -7
- package/src/components/selector/components/selector-checkbox-group/selector-checkbox-group.component.tsx +49 -0
- package/src/components/selector/components/selector-radio-group/components/selector-radio-group-option/selector-radio-group-option.component.tsx +1 -1
- package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx +58 -11
- package/src/components/selector/components/selector-radio-group/selector-radio-group.types.ts +5 -1
- package/src/components/tabs/components/tabs-tab/tabs-tab.component.tsx +1 -1
- package/src/components/tabs/tabs.component.tsx +26 -5
- package/src/constants/message.ts +1 -0
- package/src/tailwind/utils/create-font-sizes.ts +11 -8
- package/src/tailwind/utils/generate-font-components.ts +18 -15
- package/src/tailwind/utils/generate-form-control.ts +11 -8
package/src/components/radio-group/components/radio-group-radio/radio-group-radio.component.tsx
CHANGED
|
@@ -9,8 +9,7 @@ import { styles as radioStyles } from './radio-group-radio.styles.js';
|
|
|
9
9
|
import { type RadioGroupRadioProps } from './radio-group-radio.types.js';
|
|
10
10
|
|
|
11
11
|
function BaseRadioGroupRadio({ className, hint, label, ...props }: RadioGroupRadioProps, ref: any) {
|
|
12
|
-
const state = useContext(RadioGroupContext);
|
|
13
|
-
const { size, orientation } = state;
|
|
12
|
+
const { state, size, orientation } = useContext(RadioGroupContext);
|
|
14
13
|
const localRef = useRef(null);
|
|
15
14
|
const { inputProps, isSelected, isDisabled } = useRadio({ ...props, children: label }, state, localRef);
|
|
16
15
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
@@ -4,6 +4,7 @@ import React, { createContext, useEffect, useId, useMemo, useRef, useState } fro
|
|
|
4
4
|
import { useFocusRing, useRadioGroup } from 'react-aria';
|
|
5
5
|
import { useRadioGroupState } from 'react-stately';
|
|
6
6
|
|
|
7
|
+
import { FUNCTION_NOT_IMPLEMENTED } from '../../constants/message.js';
|
|
7
8
|
import { Button } from '../button/index.js';
|
|
8
9
|
import { ExpandMoreIcon } from '../icon/index.js';
|
|
9
10
|
import { ErrorMessage, Hint, Label, RadioGroupRadio } from '../index.js';
|
|
@@ -12,18 +13,63 @@ import { styles as radioGroupStyles } from './radio-group.styles.js';
|
|
|
12
13
|
import { type RadioGroupContextState, type RadioGroupProps } from './radio-group.types.js';
|
|
13
14
|
|
|
14
15
|
export const RadioGroupContext = createContext<RadioGroupContextState>({
|
|
15
|
-
// TODO: Remove deprecated name prop once React Aria removes it from RadioGroupState
|
|
16
|
-
name: '',
|
|
17
|
-
isDisabled: false,
|
|
18
|
-
isReadOnly: false,
|
|
19
|
-
isRequired: false,
|
|
20
|
-
validationState: null,
|
|
21
|
-
selectedValue: null,
|
|
22
|
-
setSelectedValue: () => null,
|
|
23
|
-
lastFocusedValue: null,
|
|
24
|
-
setLastFocusedValue: () => null,
|
|
25
16
|
orientation: 'vertical',
|
|
26
17
|
size: 'medium',
|
|
18
|
+
state: {
|
|
19
|
+
name: '',
|
|
20
|
+
isDisabled: false,
|
|
21
|
+
isReadOnly: false,
|
|
22
|
+
isRequired: false,
|
|
23
|
+
validationState: null,
|
|
24
|
+
selectedValue: null,
|
|
25
|
+
setSelectedValue: () => null,
|
|
26
|
+
lastFocusedValue: null,
|
|
27
|
+
setLastFocusedValue: () => null,
|
|
28
|
+
isInvalid: false,
|
|
29
|
+
realtimeValidation: {
|
|
30
|
+
isInvalid: false,
|
|
31
|
+
validationErrors: [],
|
|
32
|
+
validationDetails: {
|
|
33
|
+
badInput: false,
|
|
34
|
+
customError: false,
|
|
35
|
+
patternMismatch: false,
|
|
36
|
+
rangeOverflow: false,
|
|
37
|
+
rangeUnderflow: false,
|
|
38
|
+
stepMismatch: false,
|
|
39
|
+
tooLong: false,
|
|
40
|
+
tooShort: false,
|
|
41
|
+
typeMismatch: false,
|
|
42
|
+
valid: false,
|
|
43
|
+
valueMissing: false,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
displayValidation: {
|
|
47
|
+
isInvalid: false,
|
|
48
|
+
validationErrors: [],
|
|
49
|
+
validationDetails: {
|
|
50
|
+
badInput: false,
|
|
51
|
+
customError: false,
|
|
52
|
+
patternMismatch: false,
|
|
53
|
+
rangeOverflow: false,
|
|
54
|
+
rangeUnderflow: false,
|
|
55
|
+
stepMismatch: false,
|
|
56
|
+
tooLong: false,
|
|
57
|
+
tooShort: false,
|
|
58
|
+
typeMismatch: false,
|
|
59
|
+
valid: false,
|
|
60
|
+
valueMissing: false,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
updateValidation: function (): void {
|
|
64
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
65
|
+
},
|
|
66
|
+
resetValidation: function (): void {
|
|
67
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
68
|
+
},
|
|
69
|
+
commitValidation: function (): void {
|
|
70
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
71
|
+
},
|
|
72
|
+
},
|
|
27
73
|
});
|
|
28
74
|
|
|
29
75
|
export function RadioGroup({
|
|
@@ -70,9 +116,7 @@ export function RadioGroup({
|
|
|
70
116
|
<ErrorMessage {...errorMessageProps} message={errorMessage} />
|
|
71
117
|
)}
|
|
72
118
|
<div className={styles.radioWrapper()} id={panelId}>
|
|
73
|
-
<RadioGroupContext.Provider value={{
|
|
74
|
-
{childrenToRender}
|
|
75
|
-
</RadioGroupContext.Provider>
|
|
119
|
+
<RadioGroupContext.Provider value={{ state, orientation, size }}>{childrenToRender}</RadioGroupContext.Provider>
|
|
76
120
|
{hiddenOptions && (
|
|
77
121
|
<Button
|
|
78
122
|
onClick={() => setHiddenOptions(false)}
|
package/src/components/selector/components/selector-button-group/selector-button-group.component.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { createContext, useCallback, useState } from 'react';
|
|
3
|
+
import { createContext, useCallback, useMemo, useState } from 'react';
|
|
4
4
|
import { useField } from 'react-aria';
|
|
5
5
|
|
|
6
6
|
import { ErrorMessage, Hint, Label } from '../../../index.js';
|
|
@@ -35,12 +35,15 @@ export function SelectorButtonGroup({
|
|
|
35
35
|
[selected, setSelected],
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
const state: SelectorButtonGroupContextState =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
const state: SelectorButtonGroupContextState = useMemo(
|
|
39
|
+
() => ({
|
|
40
|
+
value: selected,
|
|
41
|
+
onClick: (id: string) => handleChange(id),
|
|
42
|
+
validationState: errorMessage ? 'invalid' : 'valid',
|
|
43
|
+
isDisabled,
|
|
44
|
+
}),
|
|
45
|
+
[selected],
|
|
46
|
+
);
|
|
44
47
|
|
|
45
48
|
const { labelProps, fieldProps, descriptionProps, errorMessageProps } = useField({
|
|
46
49
|
validationState: state.validationState,
|
|
@@ -4,6 +4,7 @@ import React, { createContext } from 'react';
|
|
|
4
4
|
import { useCheckboxGroup } from 'react-aria';
|
|
5
5
|
import { useCheckboxGroupState } from 'react-stately';
|
|
6
6
|
|
|
7
|
+
import { FUNCTION_NOT_IMPLEMENTED } from '../../../../constants/message.js';
|
|
7
8
|
import { ErrorMessage, Hint, Label } from '../../../index.js';
|
|
8
9
|
|
|
9
10
|
import { styles } from './selector-checkbox-group.styles.js';
|
|
@@ -22,6 +23,54 @@ export const SelectorCheckboxGroupContext = createContext<SelectorCheckboxGroupC
|
|
|
22
23
|
removeValue: () => null,
|
|
23
24
|
toggleValue: () => null,
|
|
24
25
|
validationState: 'valid',
|
|
26
|
+
isInvalid: false,
|
|
27
|
+
isRequired: false,
|
|
28
|
+
setInvalid: function (): void {
|
|
29
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
30
|
+
},
|
|
31
|
+
realtimeValidation: {
|
|
32
|
+
isInvalid: false,
|
|
33
|
+
validationErrors: [],
|
|
34
|
+
validationDetails: {
|
|
35
|
+
badInput: false,
|
|
36
|
+
customError: false,
|
|
37
|
+
patternMismatch: false,
|
|
38
|
+
rangeOverflow: false,
|
|
39
|
+
rangeUnderflow: false,
|
|
40
|
+
stepMismatch: false,
|
|
41
|
+
tooLong: false,
|
|
42
|
+
tooShort: false,
|
|
43
|
+
typeMismatch: false,
|
|
44
|
+
valid: false,
|
|
45
|
+
valueMissing: false,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
displayValidation: {
|
|
49
|
+
isInvalid: false,
|
|
50
|
+
validationErrors: [],
|
|
51
|
+
validationDetails: {
|
|
52
|
+
badInput: false,
|
|
53
|
+
customError: false,
|
|
54
|
+
patternMismatch: false,
|
|
55
|
+
rangeOverflow: false,
|
|
56
|
+
rangeUnderflow: false,
|
|
57
|
+
stepMismatch: false,
|
|
58
|
+
tooLong: false,
|
|
59
|
+
tooShort: false,
|
|
60
|
+
typeMismatch: false,
|
|
61
|
+
valid: false,
|
|
62
|
+
valueMissing: false,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
updateValidation: function (): void {
|
|
66
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
67
|
+
},
|
|
68
|
+
resetValidation: function (): void {
|
|
69
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
70
|
+
},
|
|
71
|
+
commitValidation: function (): void {
|
|
72
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
73
|
+
},
|
|
25
74
|
});
|
|
26
75
|
|
|
27
76
|
export function SelectorCheckboxGroup(props: SelectorCheckboxGroupProps) {
|
|
@@ -24,7 +24,7 @@ function BaseSelectorRadioGroupOption(
|
|
|
24
24
|
}: SelectorRadioGroupOptionProps,
|
|
25
25
|
ref: any,
|
|
26
26
|
) {
|
|
27
|
-
const state = useContext(SelectorRadioGroupContext);
|
|
27
|
+
const { state } = useContext(SelectorRadioGroupContext);
|
|
28
28
|
const localRef = useRef(null);
|
|
29
29
|
const { inputProps, isSelected, isDisabled } = useRadio({ ...props, value, children }, state, localRef);
|
|
30
30
|
const { isFocusVisible, focusProps } = useFocusRing();
|
package/src/components/selector/components/selector-radio-group/selector-radio-group.component.tsx
CHANGED
|
@@ -4,23 +4,70 @@ import React, { createContext } from 'react';
|
|
|
4
4
|
import { useRadioGroup } from 'react-aria';
|
|
5
5
|
import { useRadioGroupState } from 'react-stately';
|
|
6
6
|
|
|
7
|
+
import { FUNCTION_NOT_IMPLEMENTED } from '../../../../constants/message.js';
|
|
7
8
|
import { ErrorMessage, Hint, Label } from '../../../index.js';
|
|
8
9
|
|
|
9
10
|
import { styles } from './selector-radio-group.styles.js';
|
|
10
11
|
import { type SelectorRadioGroupContextState, type SelectorRadioGroupProps } from './selector-radio-group.types.js';
|
|
11
12
|
|
|
12
13
|
export const SelectorRadioGroupContext = createContext<SelectorRadioGroupContextState>({
|
|
13
|
-
// TODO: Remove deprecated name prop once React Aria removes it from RadioGroupState
|
|
14
|
-
name: '',
|
|
15
|
-
isDisabled: false,
|
|
16
|
-
isReadOnly: false,
|
|
17
|
-
isRequired: false,
|
|
18
|
-
validationState: null,
|
|
19
|
-
selectedValue: null,
|
|
20
|
-
setSelectedValue: () => null,
|
|
21
|
-
lastFocusedValue: null,
|
|
22
|
-
setLastFocusedValue: () => null,
|
|
23
14
|
orientation: 'vertical',
|
|
15
|
+
state: {
|
|
16
|
+
// TODO: Remove deprecated name prop once React Aria removes it from RadioGroupState
|
|
17
|
+
name: '',
|
|
18
|
+
isDisabled: false,
|
|
19
|
+
isReadOnly: false,
|
|
20
|
+
isRequired: false,
|
|
21
|
+
validationState: null,
|
|
22
|
+
selectedValue: null,
|
|
23
|
+
setSelectedValue: () => null,
|
|
24
|
+
lastFocusedValue: null,
|
|
25
|
+
setLastFocusedValue: () => null,
|
|
26
|
+
isInvalid: false,
|
|
27
|
+
realtimeValidation: {
|
|
28
|
+
isInvalid: false,
|
|
29
|
+
validationErrors: [],
|
|
30
|
+
validationDetails: {
|
|
31
|
+
badInput: false,
|
|
32
|
+
customError: false,
|
|
33
|
+
patternMismatch: false,
|
|
34
|
+
rangeOverflow: false,
|
|
35
|
+
rangeUnderflow: false,
|
|
36
|
+
stepMismatch: false,
|
|
37
|
+
tooLong: false,
|
|
38
|
+
tooShort: false,
|
|
39
|
+
typeMismatch: false,
|
|
40
|
+
valid: false,
|
|
41
|
+
valueMissing: false,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
displayValidation: {
|
|
45
|
+
isInvalid: false,
|
|
46
|
+
validationErrors: [],
|
|
47
|
+
validationDetails: {
|
|
48
|
+
badInput: false,
|
|
49
|
+
customError: false,
|
|
50
|
+
patternMismatch: false,
|
|
51
|
+
rangeOverflow: false,
|
|
52
|
+
rangeUnderflow: false,
|
|
53
|
+
stepMismatch: false,
|
|
54
|
+
tooLong: false,
|
|
55
|
+
tooShort: false,
|
|
56
|
+
typeMismatch: false,
|
|
57
|
+
valid: false,
|
|
58
|
+
valueMissing: false,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
updateValidation: function (): void {
|
|
62
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
63
|
+
},
|
|
64
|
+
resetValidation: function (): void {
|
|
65
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
66
|
+
},
|
|
67
|
+
commitValidation: function (): void {
|
|
68
|
+
throw new Error(FUNCTION_NOT_IMPLEMENTED);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
24
71
|
});
|
|
25
72
|
|
|
26
73
|
export function SelectorRadioGroup({
|
|
@@ -46,7 +93,7 @@ export function SelectorRadioGroup({
|
|
|
46
93
|
<ErrorMessage {...errorMessageProps} message={errorMessage} />
|
|
47
94
|
)}
|
|
48
95
|
<div className={styles({ className, orientation })} {...radioGroupProps}>
|
|
49
|
-
<SelectorRadioGroupContext.Provider value={{
|
|
96
|
+
<SelectorRadioGroupContext.Provider value={{ state, orientation }}>
|
|
50
97
|
{children}
|
|
51
98
|
</SelectorRadioGroupContext.Provider>
|
|
52
99
|
</div>
|
package/src/components/selector/components/selector-radio-group/selector-radio-group.types.ts
CHANGED
|
@@ -24,4 +24,8 @@ export type SelectorRadioGroupContextState = {
|
|
|
24
24
|
* Controls orientation of `Radio` components, can't be applied directly on `Radio`
|
|
25
25
|
*/
|
|
26
26
|
orientation: 'vertical' | 'horizontal';
|
|
27
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Radio group state
|
|
29
|
+
*/
|
|
30
|
+
state: RadioGroupState;
|
|
31
|
+
};
|
|
@@ -6,7 +6,7 @@ import { type TabsTabProps } from './tabs-tab.types.js';
|
|
|
6
6
|
|
|
7
7
|
export function TabsTab({ item: { key, rendered }, state, orientation, justify, color, look }: TabsTabProps) {
|
|
8
8
|
const ref = useRef(null);
|
|
9
|
-
const { tabProps } = useTab({ key }, state, ref);
|
|
9
|
+
const { tabProps } = useTab({ key: key as any }, state, ref);
|
|
10
10
|
const { isFocusVisible, focusProps } = useFocusRing();
|
|
11
11
|
return (
|
|
12
12
|
<div
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import React, { useRef } from 'react';
|
|
4
|
-
import { useTabList } from 'react-aria';
|
|
5
|
-
import { Item, useTabListState } from 'react-stately';
|
|
4
|
+
import { AriaLinkOptions, useTabList } from 'react-aria';
|
|
5
|
+
import { Item, ItemProps, useTabListState } from 'react-stately';
|
|
6
6
|
|
|
7
7
|
import { TabsTab, TabsTabPanel } from './components/index.js';
|
|
8
8
|
import { styles as tabStyles } from './tabs.styles.js';
|
|
@@ -17,13 +17,32 @@ export function Tabs({
|
|
|
17
17
|
look = 'default',
|
|
18
18
|
sticky = false,
|
|
19
19
|
stickyOffset = {},
|
|
20
|
+
disabledKeys,
|
|
21
|
+
selectedKey,
|
|
22
|
+
defaultSelectedKey,
|
|
20
23
|
...props
|
|
21
24
|
}: TabsProps) {
|
|
22
|
-
const state = useTabListState({
|
|
25
|
+
const state = useTabListState({
|
|
26
|
+
...props,
|
|
27
|
+
disabledKeys: disabledKeys as any,
|
|
28
|
+
selectedKey: selectedKey as any,
|
|
29
|
+
defaultSelectedKey: defaultSelectedKey as any,
|
|
30
|
+
children,
|
|
31
|
+
});
|
|
23
32
|
const styles = tabStyles({ orientation, look, sticky });
|
|
24
33
|
|
|
25
34
|
const ref = useRef(null);
|
|
26
|
-
const { tabListProps } = useTabList(
|
|
35
|
+
const { tabListProps } = useTabList(
|
|
36
|
+
{
|
|
37
|
+
...props,
|
|
38
|
+
disabledKeys: disabledKeys as any,
|
|
39
|
+
selectedKey: selectedKey as any,
|
|
40
|
+
defaultSelectedKey: defaultSelectedKey as any,
|
|
41
|
+
orientation,
|
|
42
|
+
},
|
|
43
|
+
state,
|
|
44
|
+
ref,
|
|
45
|
+
);
|
|
27
46
|
return (
|
|
28
47
|
<div className={styles.base({ className })}>
|
|
29
48
|
<div style={{ ...tabListProps.style, ...stickyOffset }} {...tabListProps} className={styles.tabList()} ref={ref}>
|
|
@@ -44,4 +63,6 @@ export function Tabs({
|
|
|
44
63
|
);
|
|
45
64
|
}
|
|
46
65
|
|
|
47
|
-
export const TabsPanel = Item
|
|
66
|
+
export const TabsPanel = Item as (
|
|
67
|
+
props: ItemProps<AriaLinkOptions> & AriaLinkOptions & { href?: string },
|
|
68
|
+
) => JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const FUNCTION_NOT_IMPLEMENTED = 'Function not implemented';
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { FONT_SIZES } from '../constants/typography.js';
|
|
2
2
|
|
|
3
3
|
export const createFontSizes = (fontTypes: string[]) => {
|
|
4
|
-
return fontTypes.reduce(
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
return fontTypes.reduce(
|
|
5
|
+
(acc, fontType) => {
|
|
6
|
+
return Object.entries(FONT_SIZES).reduce((acc2, [fontSize, value]) => {
|
|
7
|
+
return {
|
|
8
|
+
...acc2,
|
|
9
|
+
[`${fontType}-${fontSize}`]: value.fontSize,
|
|
10
|
+
};
|
|
11
|
+
}, acc);
|
|
12
|
+
},
|
|
13
|
+
{} as Record<string, any>,
|
|
14
|
+
);
|
|
12
15
|
};
|
|
@@ -4,19 +4,22 @@ export const generateFontComponents = (
|
|
|
4
4
|
typographySizes: Record<string, { fontSize: string; lineHeight: string }>,
|
|
5
5
|
theme: PluginAPI['theme'],
|
|
6
6
|
) => {
|
|
7
|
-
return Object.entries(typographySizes).reduce(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
return Object.entries(typographySizes).reduce(
|
|
8
|
+
(acc, [size, value]) => {
|
|
9
|
+
return {
|
|
10
|
+
...acc,
|
|
11
|
+
[`.typography-body-${size}`]: {
|
|
12
|
+
fontSize: theme(`fontSize.body-${size}`),
|
|
13
|
+
lineHeight: theme(`lineHeight.${value.lineHeight}`),
|
|
14
|
+
fontFamily: theme(`fontFamily.sans`),
|
|
15
|
+
},
|
|
16
|
+
[`.typography-brand-${size}`]: {
|
|
17
|
+
fontSize: theme(`fontSize.brand-${size}`),
|
|
18
|
+
lineHeight: theme(`lineHeight.${value.lineHeight}`),
|
|
19
|
+
fontFamily: theme(`fontFamily.brand`),
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
},
|
|
23
|
+
{} as Record<string, any>,
|
|
24
|
+
);
|
|
22
25
|
};
|
|
@@ -3,14 +3,17 @@ export const generateFormControlComponents = (formControlProps: {
|
|
|
3
3
|
disabled: string;
|
|
4
4
|
sizes: Record<string, string>;
|
|
5
5
|
}) => {
|
|
6
|
-
const sizes = Object.entries(formControlProps.sizes).reduce(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const sizes = Object.entries(formControlProps.sizes).reduce(
|
|
7
|
+
(acc, [size, value]) => {
|
|
8
|
+
return {
|
|
9
|
+
...acc,
|
|
10
|
+
[`.form-control-${size}`]: {
|
|
11
|
+
[`@apply ${value}`]: {},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
},
|
|
15
|
+
{} as Record<string, any>,
|
|
16
|
+
);
|
|
14
17
|
return {
|
|
15
18
|
'.form-control': {
|
|
16
19
|
[`@apply ${formControlProps.base}`]: {},
|