@telus-uds/components-base 1.12.0 → 1.12.1
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 +10 -2
- package/component-docs.json +67 -11
- package/lib/BaseProvider/index.js +7 -2
- package/lib/Button/ButtonBase.js +18 -14
- package/lib/Carousel/Carousel.js +19 -51
- package/lib/Carousel/CarouselContext.js +12 -4
- package/lib/Carousel/CarouselStepTracker/CarouselStepTracker.js +56 -0
- package/lib/Carousel/CarouselStepTracker/index.js +13 -0
- package/lib/Checkbox/Checkbox.js +7 -3
- package/lib/Checkbox/CheckboxGroup.js +1 -1
- package/lib/Feedback/Feedback.js +18 -10
- package/lib/Icon/IconText.js +5 -0
- package/lib/InputLabel/InputLabel.js +11 -5
- package/lib/Link/LinkBase.js +7 -3
- package/lib/List/ListItem.js +7 -3
- package/lib/Notification/Notification.js +7 -2
- package/lib/Pagination/Pagination.js +7 -3
- package/lib/RadioCard/RadioCard.js +6 -1
- package/lib/Select/Select.js +7 -3
- package/lib/StepTracker/Step.js +8 -4
- package/lib/StepTracker/StepTracker.js +7 -3
- package/lib/Tabs/TabsItem.js +4 -0
- package/lib/TextInput/TextInputBase.js +7 -3
- package/lib/ThemeProvider/ThemeProvider.js +20 -3
- package/lib/ThemeProvider/utils/styles.js +8 -1
- package/lib/ThemeProvider/utils/theme-tokens.js +1 -1
- package/lib/Typography/Typography.js +6 -2
- package/lib-module/BaseProvider/index.js +7 -2
- package/lib-module/Button/ButtonBase.js +7 -3
- package/lib-module/Carousel/Carousel.js +18 -50
- package/lib-module/Carousel/CarouselContext.js +11 -4
- package/lib-module/Carousel/CarouselStepTracker/CarouselStepTracker.js +42 -0
- package/lib-module/Carousel/CarouselStepTracker/index.js +2 -0
- package/lib-module/Checkbox/Checkbox.js +8 -4
- package/lib-module/Checkbox/CheckboxGroup.js +1 -1
- package/lib-module/Feedback/Feedback.js +19 -11
- package/lib-module/Icon/IconText.js +5 -0
- package/lib-module/InputLabel/InputLabel.js +12 -6
- package/lib-module/Link/LinkBase.js +8 -4
- package/lib-module/List/ListItem.js +8 -4
- package/lib-module/Notification/Notification.js +8 -3
- package/lib-module/Pagination/Pagination.js +8 -4
- package/lib-module/RadioCard/RadioCard.js +7 -2
- package/lib-module/Select/Select.js +8 -4
- package/lib-module/StepTracker/Step.js +9 -5
- package/lib-module/StepTracker/StepTracker.js +8 -4
- package/lib-module/Tabs/TabsItem.js +5 -1
- package/lib-module/TextInput/TextInputBase.js +8 -4
- package/lib-module/ThemeProvider/ThemeProvider.js +20 -3
- package/lib-module/ThemeProvider/utils/styles.js +8 -1
- package/lib-module/ThemeProvider/utils/theme-tokens.js +1 -1
- package/lib-module/Typography/Typography.js +7 -3
- package/package.json +1 -1
- package/src/BaseProvider/index.jsx +6 -3
- package/src/Button/ButtonBase.jsx +8 -3
- package/src/Carousel/Carousel.jsx +27 -58
- package/src/Carousel/CarouselContext.jsx +15 -4
- package/src/Carousel/CarouselStepTracker/CarouselStepTracker.jsx +36 -0
- package/src/Carousel/CarouselStepTracker/index.js +3 -0
- package/src/Checkbox/Checkbox.jsx +14 -11
- package/src/Checkbox/CheckboxGroup.jsx +1 -1
- package/src/Feedback/Feedback.jsx +14 -7
- package/src/Icon/IconText.jsx +2 -0
- package/src/InputLabel/InputLabel.jsx +13 -12
- package/src/Link/LinkBase.jsx +10 -4
- package/src/List/ListItem.jsx +9 -4
- package/src/Notification/Notification.jsx +5 -3
- package/src/Pagination/Pagination.jsx +6 -4
- package/src/RadioCard/RadioCard.jsx +3 -2
- package/src/Select/Select.jsx +12 -3
- package/src/StepTracker/Step.jsx +12 -4
- package/src/StepTracker/StepTracker.jsx +11 -10
- package/src/Tabs/TabsItem.jsx +3 -2
- package/src/TextInput/TextInputBase.jsx +11 -3
- package/src/ThemeProvider/ThemeProvider.jsx +16 -3
- package/src/ThemeProvider/utils/styles.js +9 -1
- package/src/ThemeProvider/utils/theme-tokens.js +1 -1
- package/src/Typography/Typography.jsx +11 -12
|
@@ -11,9 +11,8 @@ import { getTokensPropType, getA11yPropsFromHtmlTag, layoutTags, variantProp, se
|
|
|
11
11
|
import { useA11yInfo } from '../A11yInfoProvider';
|
|
12
12
|
import { CarouselProvider } from './CarouselContext';
|
|
13
13
|
import CarouselItem from './CarouselItem';
|
|
14
|
-
import StepTracker from '../StepTracker';
|
|
15
|
-
import StackView from '../StackView';
|
|
16
14
|
import IconButton from '../IconButton';
|
|
15
|
+
import CarouselStepTracker from './CarouselStepTracker/CarouselStepTracker';
|
|
17
16
|
import dictionary from './dictionary';
|
|
18
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -27,18 +26,6 @@ const staticStyles = StyleSheet.create({
|
|
|
27
26
|
left: 0
|
|
28
27
|
}
|
|
29
28
|
});
|
|
30
|
-
const staticTokens = {
|
|
31
|
-
stackView: {
|
|
32
|
-
justifyContent: 'center'
|
|
33
|
-
},
|
|
34
|
-
stepTracker: {
|
|
35
|
-
showStepLabel: false,
|
|
36
|
-
showStepTrackerLabel: true,
|
|
37
|
-
knobCompletedBackgroundColor: 'none',
|
|
38
|
-
connectorCompletedColor: 'none',
|
|
39
|
-
connectorColor: 'none'
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
29
|
|
|
43
30
|
const selectContainerStyles = width => ({
|
|
44
31
|
backgroundColor: 'transparent',
|
|
@@ -148,7 +135,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
148
135
|
onAnimationEnd,
|
|
149
136
|
onIndexChanged,
|
|
150
137
|
springConfig = undefined,
|
|
151
|
-
|
|
138
|
+
panelNavigation = /*#__PURE__*/_jsx(CarouselStepTracker, {}),
|
|
152
139
|
tag = 'ul',
|
|
153
140
|
accessibilityRole = 'adjustable',
|
|
154
141
|
accessibilityLabel = 'carousel',
|
|
@@ -156,16 +143,16 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
156
143
|
...rest
|
|
157
144
|
} = _ref;
|
|
158
145
|
const viewport = useViewport();
|
|
146
|
+
const themeTokens = useThemeTokens('Carousel', tokens, variant, {
|
|
147
|
+
viewport
|
|
148
|
+
});
|
|
159
149
|
const {
|
|
160
150
|
previousIcon,
|
|
161
151
|
nextIcon,
|
|
162
152
|
showPreviousNextNavigation,
|
|
163
153
|
showPanelNavigation,
|
|
164
|
-
spaceBetweenSlideAndPreviousNextNavigation
|
|
165
|
-
|
|
166
|
-
} = useThemeTokens('Carousel', tokens, variant, {
|
|
167
|
-
viewport
|
|
168
|
-
});
|
|
154
|
+
spaceBetweenSlideAndPreviousNextNavigation
|
|
155
|
+
} = themeTokens;
|
|
169
156
|
const [activeIndex, setActiveIndex] = React.useState(0);
|
|
170
157
|
const [isAnimating, setIsAnimating] = React.useState(false);
|
|
171
158
|
const handleAnimationStart = React.useCallback(function () {
|
|
@@ -204,9 +191,6 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
204
191
|
const animatedY = React.useRef(0);
|
|
205
192
|
const isFirstSlide = !activeIndex;
|
|
206
193
|
const isLastSlide = activeIndex + 1 >= children.length;
|
|
207
|
-
const panelNavigationTokens = { ...staticTokens.stepTracker,
|
|
208
|
-
containerPaddingTop: spaceBetweenSlideAndPanelNavigation
|
|
209
|
-
};
|
|
210
194
|
|
|
211
195
|
const onContainerLayout = _ref2 => {
|
|
212
196
|
let {
|
|
@@ -386,18 +370,18 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
386
370
|
size: previousNextIconSize,
|
|
387
371
|
raised: true
|
|
388
372
|
};
|
|
389
|
-
|
|
390
|
-
const getCopyWithPlaceholders = copyKey => {
|
|
373
|
+
const getCopyWithPlaceholders = React.useCallback(copyKey => {
|
|
391
374
|
const copyText = getCopy(copyKey).replace(/%\{itemLabel\}/g, itemLabel).replace(/%\{stepNumber\}/g, activeIndex + 1).replace(/%\{stepCount\}/g, childrenArray.length); // First word might be a lowercase placeholder: capitalize the first letter
|
|
392
375
|
|
|
393
376
|
return "".concat(copyText[0].toUpperCase()).concat(copyText.slice(1));
|
|
394
|
-
};
|
|
395
|
-
|
|
377
|
+
}, [activeIndex, childrenArray.length, itemLabel, getCopy]);
|
|
396
378
|
return /*#__PURE__*/_jsxs(CarouselProvider, {
|
|
397
379
|
activeIndex: activeIndex,
|
|
398
380
|
totalItems: childrenArray.length,
|
|
399
381
|
width: containerLayout.width,
|
|
400
382
|
goTo: goTo,
|
|
383
|
+
getCopyWithPlaceholders: getCopyWithPlaceholders,
|
|
384
|
+
themeTokens: themeTokens,
|
|
401
385
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
402
386
|
style: staticStyles.root,
|
|
403
387
|
onLayout: onContainerLayout,
|
|
@@ -447,23 +431,7 @@ const Carousel = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
447
431
|
accessibilityLabel: getCopyWithPlaceholders('iconButtonLabel').replace('%{targetStep}', activeIndex + 2)
|
|
448
432
|
})
|
|
449
433
|
})]
|
|
450
|
-
}), showPanelNavigation ?
|
|
451
|
-
direction: "row",
|
|
452
|
-
tokens: staticTokens.stackView,
|
|
453
|
-
children: onRenderPanelNavigation ? onRenderPanelNavigation({
|
|
454
|
-
activeIndex,
|
|
455
|
-
totalItems: childrenArray.length
|
|
456
|
-
}) : /*#__PURE__*/_jsx(StepTracker, {
|
|
457
|
-
current: activeIndex,
|
|
458
|
-
steps: childrenArray.map((_, index) => String(index)),
|
|
459
|
-
copy: {
|
|
460
|
-
// Give StepTracker copy from Carousel's language and dictionary
|
|
461
|
-
stepLabel: getCopyWithPlaceholders('stepLabel'),
|
|
462
|
-
stepTrackerLabel: getCopyWithPlaceholders('stepTrackerLabel')
|
|
463
|
-
},
|
|
464
|
-
tokens: panelNavigationTokens
|
|
465
|
-
})
|
|
466
|
-
}) : null]
|
|
434
|
+
}), showPanelNavigation ? panelNavigation : null]
|
|
467
435
|
});
|
|
468
436
|
});
|
|
469
437
|
Carousel.propTypes = { ...selectedSystemPropTypes,
|
|
@@ -530,20 +498,20 @@ Carousel.propTypes = { ...selectedSystemPropTypes,
|
|
|
530
498
|
onIndexChanged: PropTypes.func,
|
|
531
499
|
|
|
532
500
|
/**
|
|
533
|
-
* Use this to render a custom panel navigation element instead of
|
|
534
|
-
*
|
|
535
|
-
* activeIndex: index of current slide
|
|
536
|
-
* totalItems: total number of slides
|
|
501
|
+
* Use this to render a custom panel navigation element instead of the default StepTracker's based navigation
|
|
502
|
+
* You can make use of `useCarousel` within your custom panel navigation component to hook into various Carousel states such as:
|
|
503
|
+
* - activeIndex: index of current slide
|
|
504
|
+
* - totalItems: total number of slides
|
|
537
505
|
* Use it as follows:
|
|
538
506
|
* ```js
|
|
539
507
|
* <Carousel
|
|
540
|
-
*
|
|
508
|
+
* panelNavigation={<CustomPanelNavigation />}
|
|
541
509
|
* >
|
|
542
510
|
* <Carousel.Item>First Slide</Carousel.Item>
|
|
543
511
|
* </Carousel>
|
|
544
512
|
* ```
|
|
545
513
|
*/
|
|
546
|
-
|
|
514
|
+
panelNavigation: PropTypes.element,
|
|
547
515
|
|
|
548
516
|
/**
|
|
549
517
|
* When slide animation start
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { getTokensPropType } from '../utils';
|
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
const CarouselContext = /*#__PURE__*/React.createContext();
|
|
5
6
|
|
|
@@ -9,14 +10,18 @@ const CarouselProvider = _ref => {
|
|
|
9
10
|
activeIndex,
|
|
10
11
|
totalItems,
|
|
11
12
|
width,
|
|
12
|
-
goTo
|
|
13
|
+
goTo,
|
|
14
|
+
getCopyWithPlaceholders,
|
|
15
|
+
themeTokens
|
|
13
16
|
} = _ref;
|
|
14
17
|
const value = React.useMemo(() => ({
|
|
15
18
|
activeIndex,
|
|
16
19
|
totalItems,
|
|
17
20
|
width,
|
|
18
|
-
goTo
|
|
19
|
-
|
|
21
|
+
goTo,
|
|
22
|
+
getCopyWithPlaceholders,
|
|
23
|
+
themeTokens
|
|
24
|
+
}), [activeIndex, totalItems, width, goTo, getCopyWithPlaceholders, themeTokens]);
|
|
20
25
|
return /*#__PURE__*/_jsx(CarouselContext.Provider, {
|
|
21
26
|
value: value,
|
|
22
27
|
children: children
|
|
@@ -38,6 +43,8 @@ CarouselProvider.propTypes = {
|
|
|
38
43
|
activeIndex: PropTypes.number.isRequired,
|
|
39
44
|
totalItems: PropTypes.number.isRequired,
|
|
40
45
|
width: PropTypes.number.isRequired,
|
|
41
|
-
goTo: PropTypes.func.isRequired
|
|
46
|
+
goTo: PropTypes.func.isRequired,
|
|
47
|
+
getCopyWithPlaceholders: PropTypes.func.isRequired,
|
|
48
|
+
themeTokens: getTokensPropType('Carousel')
|
|
42
49
|
};
|
|
43
50
|
export { CarouselProvider, useCarousel };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useCarousel } from '../CarouselContext';
|
|
3
|
+
import StepTracker from '../../StepTracker';
|
|
4
|
+
import StackView from '../../StackView';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
|
|
7
|
+
const CarouselStepTracker = () => {
|
|
8
|
+
const {
|
|
9
|
+
activeIndex,
|
|
10
|
+
totalItems,
|
|
11
|
+
getCopyWithPlaceholders,
|
|
12
|
+
themeTokens
|
|
13
|
+
} = useCarousel();
|
|
14
|
+
const stackViewTokens = {
|
|
15
|
+
justifyContent: 'center'
|
|
16
|
+
};
|
|
17
|
+
const stepTrackerTokens = {
|
|
18
|
+
showStepLabel: false,
|
|
19
|
+
showStepTrackerLabel: true,
|
|
20
|
+
knobCompletedBackgroundColor: 'none',
|
|
21
|
+
connectorCompletedColor: 'none',
|
|
22
|
+
connectorColor: 'none',
|
|
23
|
+
containerPaddingTop: themeTokens.spaceBetweenSlideAndPanelNavigation
|
|
24
|
+
};
|
|
25
|
+
const steps = Array.from(Array(totalItems)).map((_, index) => String(index));
|
|
26
|
+
return /*#__PURE__*/_jsx(StackView, {
|
|
27
|
+
direction: "row",
|
|
28
|
+
tokens: stackViewTokens,
|
|
29
|
+
children: /*#__PURE__*/_jsx(StepTracker, {
|
|
30
|
+
current: activeIndex,
|
|
31
|
+
steps: steps,
|
|
32
|
+
copy: {
|
|
33
|
+
// Give StepTracker copy from Carousel's language and dictionary
|
|
34
|
+
stepLabel: getCopyWithPlaceholders('stepLabel'),
|
|
35
|
+
stepTrackerLabel: getCopyWithPlaceholders('stepTrackerLabel')
|
|
36
|
+
},
|
|
37
|
+
tokens: stepTrackerTokens
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export default CarouselStepTracker;
|
|
@@ -9,7 +9,7 @@ import CheckboxInput from './CheckboxInput';
|
|
|
9
9
|
import CheckboxLabel from '../InputLabel/LabelContent';
|
|
10
10
|
import Feedback from '../Feedback';
|
|
11
11
|
import StackView from '../StackView';
|
|
12
|
-
import { applyShadowToken, applyTextStyles, useThemeTokensCallback } from '../ThemeProvider';
|
|
12
|
+
import { applyShadowToken, applyTextStyles, useTheme, useThemeTokensCallback } from '../ThemeProvider';
|
|
13
13
|
import { a11yProps, focusHandlerProps, getTokensPropType, selectSystemProps, useInputValue, variantProp, viewProps } from '../utils';
|
|
14
14
|
import useUniqueId from '../utils/useUniqueId';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -47,7 +47,7 @@ const selectInputStyles = (_ref, isChecked) => {
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
const selectLabelStyles = _ref2 => {
|
|
50
|
+
const selectLabelStyles = (_ref2, themeOptions) => {
|
|
51
51
|
let {
|
|
52
52
|
labelColor,
|
|
53
53
|
labelFontName,
|
|
@@ -63,7 +63,8 @@ const selectLabelStyles = _ref2 => {
|
|
|
63
63
|
fontName: labelFontName,
|
|
64
64
|
fontWeight: labelFontWeight,
|
|
65
65
|
fontSize: labelFontSize,
|
|
66
|
-
lineHeight: labelLineHeight
|
|
66
|
+
lineHeight: labelLineHeight,
|
|
67
|
+
themeOptions
|
|
67
68
|
})
|
|
68
69
|
};
|
|
69
70
|
};
|
|
@@ -187,6 +188,9 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
187
188
|
|
|
188
189
|
const uniqueId = useUniqueId('checkbox');
|
|
189
190
|
const inputId = id !== null && id !== void 0 ? id : uniqueId;
|
|
191
|
+
const {
|
|
192
|
+
themeOptions
|
|
193
|
+
} = useTheme();
|
|
190
194
|
return /*#__PURE__*/_jsx(View, {
|
|
191
195
|
style: staticStyles.wrapper,
|
|
192
196
|
ref: ref,
|
|
@@ -218,7 +222,7 @@ const Checkbox = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
218
222
|
pressed
|
|
219
223
|
});
|
|
220
224
|
const iconTokens = selectIconTokens(stateTokens);
|
|
221
|
-
const labelStyles = selectLabelStyles(stateTokens);
|
|
225
|
+
const labelStyles = selectLabelStyles(stateTokens, themeOptions);
|
|
222
226
|
const alignWithLabel = label ? [staticStyles.alignWithLabel, {
|
|
223
227
|
height: labelStyles.lineHeight
|
|
224
228
|
}] : null;
|
|
@@ -46,7 +46,7 @@ const [selectItemProps, selectedItemPropTypes] = selectSystemProps([a11yProps, f
|
|
|
46
46
|
* @example
|
|
47
47
|
* ```jsx
|
|
48
48
|
* <CheckboxGroup
|
|
49
|
-
*
|
|
49
|
+
* initialCheckedIds="check1"
|
|
50
50
|
* items={[
|
|
51
51
|
* { label: 'Checkbox 1', id: 'check1' },
|
|
52
52
|
* { label: 'Checkbox 2', id: 'check2' },
|
|
@@ -3,7 +3,7 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
3
3
|
import Text from "react-native-web/dist/exports/Text";
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
6
|
+
import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
|
|
7
7
|
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps } from '../utils';
|
|
8
8
|
import StackView from '../StackView';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -12,24 +12,29 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
12
12
|
|
|
13
13
|
const selectStyles = tokens => selectTokens('Feedback', tokens);
|
|
14
14
|
|
|
15
|
-
const selectTitleTextStyles = _ref => {
|
|
15
|
+
const selectTitleTextStyles = (_ref, themeOptions) => {
|
|
16
16
|
let {
|
|
17
17
|
titleFontSize,
|
|
18
18
|
...tokens
|
|
19
19
|
} = _ref;
|
|
20
|
-
return applyTextStyles(selectTokens('Typography', { ...tokens,
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
return applyTextStyles({ ...selectTokens('Typography', { ...tokens,
|
|
21
|
+
fontSize: titleFontSize,
|
|
22
|
+
themeOptions
|
|
23
|
+
}),
|
|
24
|
+
themeOptions
|
|
25
|
+
});
|
|
23
26
|
};
|
|
24
27
|
|
|
25
|
-
const selectContentTextStyles = _ref2 => {
|
|
28
|
+
const selectContentTextStyles = (_ref2, themeOptions) => {
|
|
26
29
|
let {
|
|
27
30
|
contentFontSize,
|
|
28
31
|
...tokens
|
|
29
32
|
} = _ref2;
|
|
30
|
-
return applyTextStyles(selectTokens('Typography', { ...tokens,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
return applyTextStyles({ ...selectTokens('Typography', { ...tokens,
|
|
34
|
+
fontSize: contentFontSize
|
|
35
|
+
}),
|
|
36
|
+
themeOptions
|
|
37
|
+
});
|
|
33
38
|
};
|
|
34
39
|
|
|
35
40
|
const selectIconTokens = _ref3 => {
|
|
@@ -90,8 +95,11 @@ const Feedback = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
90
95
|
const {
|
|
91
96
|
icon: IconComponent
|
|
92
97
|
} = themeTokens;
|
|
93
|
-
const
|
|
94
|
-
|
|
98
|
+
const {
|
|
99
|
+
themeOptions
|
|
100
|
+
} = useTheme();
|
|
101
|
+
const titleTextStyles = selectTitleTextStyles(themeTokens, themeOptions);
|
|
102
|
+
const contentTextStyles = selectContentTextStyles(themeTokens, themeOptions);
|
|
95
103
|
const content = typeof children === 'string' ? /*#__PURE__*/_jsx(Text, {
|
|
96
104
|
style: contentTextStyles,
|
|
97
105
|
children: children
|
|
@@ -51,6 +51,9 @@ const IconText = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
51
51
|
});
|
|
52
52
|
IconText.displayName = 'IconText';
|
|
53
53
|
IconText.propTypes = {
|
|
54
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
55
|
+
// eslint is having hard time seeing these props through forwardRef
|
|
56
|
+
|
|
54
57
|
/**
|
|
55
58
|
* Amount of space to separate the text content and icon. Uses the themes's spacing scale
|
|
56
59
|
* (see useSpacingScale for more info).
|
|
@@ -79,5 +82,7 @@ IconText.propTypes = {
|
|
|
79
82
|
* `<Typography>` component, or a component that renders `<Text>`.
|
|
80
83
|
*/
|
|
81
84
|
children: PropTypes.node
|
|
85
|
+
/* eslint-enable react/no-unused-prop-types */
|
|
86
|
+
|
|
82
87
|
};
|
|
83
88
|
export default IconText;
|
|
@@ -3,7 +3,7 @@ import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
|
3
3
|
import Text from "react-native-web/dist/exports/Text";
|
|
4
4
|
import View from "react-native-web/dist/exports/View";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
6
|
+
import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
|
|
7
7
|
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps } from '../utils';
|
|
8
8
|
import LabelContent from './LabelContent';
|
|
9
9
|
import Tooltip from '../Tooltip';
|
|
@@ -12,9 +12,11 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
13
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
14
14
|
|
|
15
|
-
const selectLabelStyles = tokens => applyTextStyles(selectTokens('Typography', tokens)
|
|
15
|
+
const selectLabelStyles = (tokens, themeOptions) => applyTextStyles({ ...selectTokens('Typography', tokens),
|
|
16
|
+
themeOptions
|
|
17
|
+
});
|
|
16
18
|
|
|
17
|
-
const selectHintStyles = _ref => {
|
|
19
|
+
const selectHintStyles = (_ref, themeOptions) => {
|
|
18
20
|
let {
|
|
19
21
|
hintColor,
|
|
20
22
|
hintFontName,
|
|
@@ -27,7 +29,8 @@ const selectHintStyles = _ref => {
|
|
|
27
29
|
fontName: hintFontName,
|
|
28
30
|
fontSize: hintFontSize,
|
|
29
31
|
fontWeight: hintFontWeight,
|
|
30
|
-
lineHeight: hintLineHeight
|
|
32
|
+
lineHeight: hintLineHeight,
|
|
33
|
+
themeOptions
|
|
31
34
|
});
|
|
32
35
|
};
|
|
33
36
|
|
|
@@ -56,19 +59,22 @@ const InputLabel = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
56
59
|
const themeTokens = useThemeTokens('InputLabel', tokens, variant);
|
|
57
60
|
const hasTooltip = tooltip !== undefined;
|
|
58
61
|
const isHintInline = hintPosition === 'inline';
|
|
62
|
+
const {
|
|
63
|
+
themeOptions
|
|
64
|
+
} = useTheme();
|
|
59
65
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
60
66
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
61
67
|
ref: ref,
|
|
62
68
|
style: staticStyles.container,
|
|
63
69
|
...selectProps(rest),
|
|
64
70
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
65
|
-
style: [selectLabelStyles(themeTokens), selectGapStyles(themeTokens), staticStyles.label],
|
|
71
|
+
style: [selectLabelStyles(themeTokens, themeOptions), selectGapStyles(themeTokens), staticStyles.label],
|
|
66
72
|
children: /*#__PURE__*/_jsx(LabelContent, {
|
|
67
73
|
forId: forId,
|
|
68
74
|
children: label
|
|
69
75
|
})
|
|
70
76
|
}), hint && isHintInline && /*#__PURE__*/_jsx(Text, {
|
|
71
|
-
style: [selectHintStyles(themeTokens), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
|
|
77
|
+
style: [selectHintStyles(themeTokens, themeOptions), hasTooltip && selectGapStyles(themeTokens), staticStyles.label],
|
|
72
78
|
nativeID: hintId,
|
|
73
79
|
children: hint
|
|
74
80
|
}), hasTooltip && /*#__PURE__*/_jsx(View, {
|
|
@@ -7,7 +7,7 @@ import { a11yProps, clickProps, getTokensPropType, hrefAttrsProp, linkProps, sel
|
|
|
7
7
|
import { resolvePressableTokens } from '../utils/pressability';
|
|
8
8
|
import { withLinkRouter } from '../utils';
|
|
9
9
|
import InlinePressable from './InlinePressable';
|
|
10
|
-
import { applyTextStyles, applyOuterBorder } from '../ThemeProvider';
|
|
10
|
+
import { applyTextStyles, applyOuterBorder, useTheme } from '../ThemeProvider';
|
|
11
11
|
import { IconText, iconComponentPropTypes } from '../Icon';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, linkProps, viewProps]);
|
|
@@ -53,7 +53,7 @@ const selectTextStyles = _ref2 => {
|
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
55
|
|
|
56
|
-
const selectBlockStyles = _ref3 => {
|
|
56
|
+
const selectBlockStyles = (_ref3, themeOptions) => {
|
|
57
57
|
let {
|
|
58
58
|
blockFontWeight,
|
|
59
59
|
blockFontSize,
|
|
@@ -64,7 +64,8 @@ const selectBlockStyles = _ref3 => {
|
|
|
64
64
|
fontWeight: blockFontWeight,
|
|
65
65
|
fontSize: blockFontSize,
|
|
66
66
|
lineHeight: blockLineHeight,
|
|
67
|
-
fontName: blockFontName
|
|
67
|
+
fontName: blockFontName,
|
|
68
|
+
themeOptions
|
|
68
69
|
});
|
|
69
70
|
};
|
|
70
71
|
|
|
@@ -164,6 +165,9 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
164
165
|
const hasIcon = Boolean(icon || defaultThemeTokens.icon); // On web, this makes focus rings wrap only the link, not the entire block
|
|
165
166
|
|
|
166
167
|
const blockLeftStyle = Platform.OS === 'web' && staticStyles.blockLeft;
|
|
168
|
+
const {
|
|
169
|
+
themeOptions
|
|
170
|
+
} = useTheme();
|
|
167
171
|
return /*#__PURE__*/_jsx(InlinePressable, { ...selectedProps,
|
|
168
172
|
inline: hasIcon // assuming links without icons should be inline (even if they are long)
|
|
169
173
|
,
|
|
@@ -180,7 +184,7 @@ const LinkBase = /*#__PURE__*/forwardRef((_ref6, ref) => {
|
|
|
180
184
|
const iconTokens = selectIconTokens(themeTokens); // TODO: may need to apply some smarter text inheritance here if inline to avoid native
|
|
181
185
|
// issues like double-application of line heights breaking align-items: baseline
|
|
182
186
|
|
|
183
|
-
const blockTextStyles = selectBlockStyles(themeTokens);
|
|
187
|
+
const blockTextStyles = selectBlockStyles(themeTokens, themeOptions);
|
|
184
188
|
const IconComponent = icon || themeTokens.icon;
|
|
185
189
|
const {
|
|
186
190
|
iconSpace
|
|
@@ -3,7 +3,7 @@ import View from "react-native-web/dist/exports/View";
|
|
|
3
3
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useThemeTokens, applyTextStyles } from '../ThemeProvider';
|
|
6
|
+
import { useTheme, useThemeTokens, applyTextStyles } from '../ThemeProvider';
|
|
7
7
|
import { a11yProps, getTokensPropType, selectSystemProps, variantProp, viewProps, wrapStringsInText } from '../utils';
|
|
8
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
9
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -68,7 +68,7 @@ const selectBulletPositioningStyles = _ref5 => {
|
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
const selectItemStyles = _ref6 => {
|
|
71
|
+
const selectItemStyles = (_ref6, themeOptions) => {
|
|
72
72
|
let {
|
|
73
73
|
itemFontWeight,
|
|
74
74
|
itemFontSize,
|
|
@@ -79,7 +79,8 @@ const selectItemStyles = _ref6 => {
|
|
|
79
79
|
fontWeight: itemFontWeight,
|
|
80
80
|
fontSize: itemFontSize,
|
|
81
81
|
lineHeight: itemLineHeight,
|
|
82
|
-
fontName: itemFontName
|
|
82
|
+
fontName: itemFontName,
|
|
83
|
+
themeOptions
|
|
83
84
|
});
|
|
84
85
|
};
|
|
85
86
|
|
|
@@ -127,7 +128,10 @@ const ListItem = /*#__PURE__*/forwardRef((_ref9, ref) => {
|
|
|
127
128
|
...rest
|
|
128
129
|
} = _ref9;
|
|
129
130
|
const themeTokens = useThemeTokens('List', tokens, variant);
|
|
130
|
-
const
|
|
131
|
+
const {
|
|
132
|
+
themeOptions
|
|
133
|
+
} = useTheme();
|
|
134
|
+
const itemStyles = selectItemStyles(themeTokens, themeOptions);
|
|
131
135
|
const itemBlockStyles = selectItemBlockStyles(themeTokens);
|
|
132
136
|
const dividerStyles = selectDividerStyles(themeTokens);
|
|
133
137
|
const itemBulletContainerStyles = selectBulletContainerStyles(themeTokens);
|
|
@@ -2,7 +2,7 @@ import React, { forwardRef, useState } from 'react';
|
|
|
2
2
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
3
3
|
import View from "react-native-web/dist/exports/View";
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
5
|
+
import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
|
|
6
6
|
import { a11yProps, getTokensPropType, selectSystemProps, selectTokens, variantProp, viewProps, wrapStringsInText } from '../utils';
|
|
7
7
|
import ButtonBase from '../Button/ButtonBase';
|
|
8
8
|
import useCopy from '../utils/useCopy';
|
|
@@ -14,7 +14,9 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, vie
|
|
|
14
14
|
const selectContainerStyles = tokens => ({ ...tokens
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
const selectTextStyles = tokens => applyTextStyles(selectTokens('Typography', tokens)
|
|
17
|
+
const selectTextStyles = (tokens, themeOptions) => applyTextStyles({ ...selectTokens('Typography', tokens),
|
|
18
|
+
themeOptions
|
|
19
|
+
});
|
|
18
20
|
|
|
19
21
|
const selectIconProps = _ref => {
|
|
20
22
|
let {
|
|
@@ -126,12 +128,15 @@ const Notification = /*#__PURE__*/forwardRef((_ref5, ref) => {
|
|
|
126
128
|
dictionary,
|
|
127
129
|
copy
|
|
128
130
|
});
|
|
131
|
+
const {
|
|
132
|
+
themeOptions
|
|
133
|
+
} = useTheme();
|
|
129
134
|
|
|
130
135
|
if (isDismissed) {
|
|
131
136
|
return null;
|
|
132
137
|
}
|
|
133
138
|
|
|
134
|
-
const textStyles = selectTextStyles(themeTokens);
|
|
139
|
+
const textStyles = selectTextStyles(themeTokens, themeOptions);
|
|
135
140
|
const content = wrapStringsInText(typeof children === 'function' ? children({
|
|
136
141
|
textStyles
|
|
137
142
|
}) : children, {
|
|
@@ -3,7 +3,7 @@ import View from "react-native-web/dist/exports/View";
|
|
|
3
3
|
import Text from "react-native-web/dist/exports/Text";
|
|
4
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
5
|
import { a11yProps, componentPropType, copyPropTypes, getTokensPropType, selectSystemProps, variantProp, viewProps, withLinkRouter } from '../utils';
|
|
6
|
-
import { applyTextStyles, useThemeTokens } from '../ThemeProvider';
|
|
6
|
+
import { applyTextStyles, useTheme, useThemeTokens } from '../ThemeProvider';
|
|
7
7
|
import { useViewport } from '../ViewportProvider';
|
|
8
8
|
import Box from '../Box';
|
|
9
9
|
import usePagination from './usePagination';
|
|
@@ -12,7 +12,7 @@ import SideButton from './SideButton';
|
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
13
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, viewProps]);
|
|
14
14
|
|
|
15
|
-
const selectTextStyles = _ref => {
|
|
15
|
+
const selectTextStyles = (_ref, themeOptions) => {
|
|
16
16
|
let {
|
|
17
17
|
color,
|
|
18
18
|
fontName,
|
|
@@ -25,7 +25,8 @@ const selectTextStyles = _ref => {
|
|
|
25
25
|
fontName,
|
|
26
26
|
fontSize,
|
|
27
27
|
fontWeight,
|
|
28
|
-
lineHeight
|
|
28
|
+
lineHeight,
|
|
29
|
+
themeOptions
|
|
29
30
|
});
|
|
30
31
|
};
|
|
31
32
|
|
|
@@ -49,6 +50,9 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
49
50
|
} = useThemeTokens('Pagination', tokens, variant, {
|
|
50
51
|
viewport
|
|
51
52
|
});
|
|
53
|
+
const {
|
|
54
|
+
themeOptions
|
|
55
|
+
} = useTheme();
|
|
52
56
|
const items = React.Children.toArray(children);
|
|
53
57
|
const {
|
|
54
58
|
isItemActive,
|
|
@@ -63,7 +67,7 @@ const Pagination = /*#__PURE__*/forwardRef((_ref2, ref) => {
|
|
|
63
67
|
items,
|
|
64
68
|
truncateAbove
|
|
65
69
|
});
|
|
66
|
-
const ellipsisTextStyles = selectTextStyles(themeTokens);
|
|
70
|
+
const ellipsisTextStyles = selectTextStyles(themeTokens, themeOptions);
|
|
67
71
|
|
|
68
72
|
if (items.length === 0) {
|
|
69
73
|
return null;
|
|
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
4
4
|
import Text from "react-native-web/dist/exports/Text";
|
|
5
5
|
import View from "react-native-web/dist/exports/View";
|
|
6
|
-
import {
|
|
6
|
+
import { applyTextStyles, useTheme, useThemeTokensCallback } from '../ThemeProvider';
|
|
7
7
|
import { a11yProps, focusHandlerProps, getTokensPropType, selectSystemProps, selectTokens, useInputValue, useUniqueId, variantProp, viewProps } from '../utils';
|
|
8
8
|
import { PressableCardBase, selectPressableCardTokens } from '../Card';
|
|
9
9
|
import StackView from '../StackView';
|
|
@@ -84,6 +84,9 @@ const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
84
84
|
|
|
85
85
|
const getCardTokens = cardState => selectPressableCardTokens(getTokens(cardState));
|
|
86
86
|
|
|
87
|
+
const {
|
|
88
|
+
themeOptions
|
|
89
|
+
} = useTheme();
|
|
87
90
|
return /*#__PURE__*/_jsx(PressableCardBase, {
|
|
88
91
|
ref: ref,
|
|
89
92
|
inactive: inactive,
|
|
@@ -104,7 +107,9 @@ const RadioCard = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
104
107
|
} = getTokens(cardState);
|
|
105
108
|
const radioTokens = selectRadioButtonTokens(themeTokens, 'radio');
|
|
106
109
|
const titleTokens = selectTokens('Typography', themeTokens);
|
|
107
|
-
const textStyle = applyTextStyles(titleTokens
|
|
110
|
+
const textStyle = applyTextStyles({ ...titleTokens,
|
|
111
|
+
themeOptions
|
|
112
|
+
});
|
|
108
113
|
return /*#__PURE__*/_jsxs(StackView, {
|
|
109
114
|
direction: "row",
|
|
110
115
|
space: radioSpace,
|
|
@@ -3,7 +3,7 @@ import View from "react-native-web/dist/exports/View";
|
|
|
3
3
|
import Platform from "react-native-web/dist/exports/Platform";
|
|
4
4
|
import StyleSheet from "react-native-web/dist/exports/StyleSheet";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { applyTextStyles, useThemeTokens, applyOuterBorder } from '../ThemeProvider';
|
|
6
|
+
import { applyTextStyles, useThemeTokens, applyOuterBorder, useTheme } from '../ThemeProvider';
|
|
7
7
|
import { a11yProps, componentPropType, getTokensPropType, inputSupportsProps, selectSystemProps, useInputValue, variantProp, viewProps } from '../utils';
|
|
8
8
|
import Picker from './Picker';
|
|
9
9
|
import InputSupports from '../InputSupports';
|
|
@@ -11,7 +11,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([a11yProps, inputSupportsProps, viewProps]);
|
|
13
13
|
|
|
14
|
-
const selectInputStyles = (_ref, inactive) => {
|
|
14
|
+
const selectInputStyles = (_ref, themeOptions, inactive) => {
|
|
15
15
|
let {
|
|
16
16
|
backgroundColor,
|
|
17
17
|
color,
|
|
@@ -41,7 +41,8 @@ const selectInputStyles = (_ref, inactive) => {
|
|
|
41
41
|
fontName,
|
|
42
42
|
fontSize,
|
|
43
43
|
lineHeight,
|
|
44
|
-
fontWeight
|
|
44
|
+
fontWeight,
|
|
45
|
+
themeOptions
|
|
45
46
|
});
|
|
46
47
|
const webStyles = Platform.select({
|
|
47
48
|
web: {
|
|
@@ -228,6 +229,9 @@ const Select = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
228
229
|
icon: IconComponent,
|
|
229
230
|
validationIcon: ValidationIconComponent
|
|
230
231
|
} = themeTokens;
|
|
232
|
+
const {
|
|
233
|
+
themeOptions
|
|
234
|
+
} = useTheme();
|
|
231
235
|
return /*#__PURE__*/_jsx(InputSupports, { ...supportsProps,
|
|
232
236
|
...selectedProps,
|
|
233
237
|
children: _ref8 => {
|
|
@@ -239,7 +243,7 @@ const Select = /*#__PURE__*/forwardRef((_ref7, ref) => {
|
|
|
239
243
|
style: selectOuterBorderStyles(themeTokens),
|
|
240
244
|
children: [/*#__PURE__*/_jsx(Picker, {
|
|
241
245
|
ref: ref,
|
|
242
|
-
style: selectInputStyles(themeTokens, inactive),
|
|
246
|
+
style: selectInputStyles(themeTokens, themeOptions, inactive),
|
|
243
247
|
onFocus: handleFocus,
|
|
244
248
|
onBlur: handleBlur,
|
|
245
249
|
onMouseOver: handleMouseOver,
|