@telus-uds/components-base 1.19.0 → 1.21.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 +34 -2
- package/__tests17__/ThemeProvider/ThemeProvider.test.jsx +3 -1
- package/component-docs.json +838 -125
- package/lib/BaseProvider/index.js +2 -1
- package/lib/Box/Box.js +14 -1
- package/lib/Button/ButtonDropdown.js +207 -0
- package/lib/Button/index.js +8 -0
- package/lib/Carousel/Carousel.js +2 -2
- package/lib/Carousel/CarouselItem/CarouselItem.js +7 -1
- package/lib/Carousel/CarouselTabs/CarouselTabsPanel.js +21 -4
- package/lib/FlexGrid/Col/Col.js +1 -3
- package/lib/FlexGrid/FlexGrid.js +3 -5
- package/lib/FlexGrid/Row/Row.js +3 -3
- package/lib/IconButton/IconButton.js +12 -4
- package/lib/MultiSelectFilter/MultiSelectFilter.js +276 -0
- package/lib/MultiSelectFilter/dictionary.js +19 -0
- package/lib/MultiSelectFilter/index.js +13 -0
- package/lib/Search/Search.js +4 -1
- package/lib/Select/Picker.native.js +16 -13
- package/lib/Select/Select.js +7 -1
- package/lib/Select/constants.js +15 -0
- package/lib/StepTracker/Step.js +2 -1
- package/lib/TextInput/TextInput.js +9 -2
- package/lib/TextInput/TextInputBase.js +52 -8
- package/lib/TextInput/dictionary.js +15 -0
- package/lib/ThemeProvider/ThemeProvider.js +24 -7
- package/lib/ThemeProvider/utils/styles.js +3 -1
- package/lib/index.js +18 -0
- package/lib/utils/BaseView/BaseView.js +64 -0
- package/lib/utils/BaseView/BaseView.native.js +16 -0
- package/lib/utils/BaseView/index.js +13 -0
- package/lib/utils/index.js +10 -1
- package/lib/utils/input.js +11 -3
- package/lib/utils/props/handlerProps.js +5 -0
- package/lib-module/BaseProvider/index.js +2 -1
- package/lib-module/Box/Box.js +14 -1
- package/lib-module/Button/ButtonDropdown.js +181 -0
- package/lib-module/Button/index.js +2 -1
- package/lib-module/Carousel/Carousel.js +2 -2
- package/lib-module/Carousel/CarouselItem/CarouselItem.js +8 -2
- package/lib-module/Carousel/CarouselTabs/CarouselTabsPanel.js +23 -6
- package/lib-module/FlexGrid/Col/Col.js +2 -3
- package/lib-module/FlexGrid/FlexGrid.js +2 -3
- package/lib-module/FlexGrid/Row/Row.js +2 -2
- package/lib-module/IconButton/IconButton.js +14 -4
- package/lib-module/MultiSelectFilter/MultiSelectFilter.js +248 -0
- package/lib-module/MultiSelectFilter/dictionary.js +12 -0
- package/lib-module/MultiSelectFilter/index.js +2 -0
- package/lib-module/Search/Search.js +4 -1
- package/lib-module/Select/Picker.native.js +15 -13
- package/lib-module/Select/Select.js +6 -1
- package/lib-module/Select/constants.js +5 -0
- package/lib-module/StepTracker/Step.js +2 -1
- package/lib-module/TextInput/TextInput.js +6 -0
- package/lib-module/TextInput/TextInputBase.js +52 -10
- package/lib-module/TextInput/dictionary.js +8 -0
- package/lib-module/ThemeProvider/ThemeProvider.js +24 -7
- package/lib-module/ThemeProvider/utils/styles.js +3 -1
- package/lib-module/index.js +2 -0
- package/lib-module/utils/BaseView/BaseView.js +43 -0
- package/lib-module/utils/BaseView/BaseView.native.js +6 -0
- package/lib-module/utils/BaseView/index.js +2 -0
- package/lib-module/utils/index.js +2 -1
- package/lib-module/utils/input.js +11 -3
- package/lib-module/utils/props/handlerProps.js +5 -0
- package/package.json +3 -3
- package/src/BaseProvider/index.jsx +4 -1
- package/src/Box/Box.jsx +14 -1
- package/src/Button/ButtonDropdown.jsx +179 -0
- package/src/Button/index.js +2 -1
- package/src/Carousel/Carousel.jsx +6 -3
- package/src/Carousel/CarouselItem/CarouselItem.jsx +9 -2
- package/src/Carousel/CarouselTabs/CarouselTabsPanel.jsx +19 -5
- package/src/FlexGrid/Col/Col.jsx +4 -4
- package/src/FlexGrid/FlexGrid.jsx +11 -10
- package/src/FlexGrid/Row/Row.jsx +4 -3
- package/src/IconButton/IconButton.jsx +3 -1
- package/src/MultiSelectFilter/MultiSelectFilter.jsx +227 -0
- package/src/MultiSelectFilter/dictionary.js +12 -0
- package/src/MultiSelectFilter/index.js +3 -0
- package/src/Search/Search.jsx +2 -1
- package/src/Select/Picker.native.jsx +29 -14
- package/src/Select/Select.jsx +7 -1
- package/src/Select/constants.js +5 -0
- package/src/StepTracker/Step.jsx +5 -1
- package/src/TextInput/TextInput.jsx +5 -0
- package/src/TextInput/TextInputBase.jsx +43 -8
- package/src/TextInput/dictionary.js +8 -0
- package/src/ThemeProvider/ThemeProvider.jsx +23 -6
- package/src/ThemeProvider/utils/styles.js +3 -1
- package/src/index.js +2 -0
- package/src/utils/BaseView/BaseView.jsx +38 -0
- package/src/utils/BaseView/BaseView.native.jsx +6 -0
- package/src/utils/BaseView/index.js +3 -0
- package/src/utils/index.js +1 -0
- package/src/utils/input.js +9 -4
- package/src/utils/props/handlerProps.js +4 -0
package/src/utils/input.js
CHANGED
|
@@ -66,7 +66,7 @@ export const useInputValue = (props = {}, hookName = 'useInputValue') => {
|
|
|
66
66
|
const [isControlled] = useState(isCurrentlyControlled)
|
|
67
67
|
validateProps(props, { isControlled, isCurrentlyControlled }, hookName)
|
|
68
68
|
|
|
69
|
-
const { value, initialValue, onChange, readOnly = false } = props
|
|
69
|
+
const { value, initialValue, inputRef, onChange, readOnly = false } = props
|
|
70
70
|
const [ownValue, setOwnValue] = useState(!isControlled && initialValue)
|
|
71
71
|
const currentValue = isControlled ? value : ownValue
|
|
72
72
|
|
|
@@ -76,19 +76,24 @@ export const useInputValue = (props = {}, hookName = 'useInputValue') => {
|
|
|
76
76
|
// Make current value accessible inside useCallback without rememoizing every time the value changes
|
|
77
77
|
valueRef.current.value = currentValue
|
|
78
78
|
|
|
79
|
+
const isDirty = currentValue !== valueRef.current.initial
|
|
80
|
+
|
|
79
81
|
const setValue = useCallback(
|
|
80
82
|
(arg, event) => {
|
|
81
83
|
if (readOnly) return
|
|
82
84
|
const newValue = typeof arg === 'function' ? arg(valueRef.current.value) : arg
|
|
83
|
-
if (!isControlled)
|
|
85
|
+
if (!isControlled) {
|
|
86
|
+
setOwnValue(newValue)
|
|
87
|
+
if (inputRef?.current) inputRef.current.value = newValue ?? ''
|
|
88
|
+
}
|
|
84
89
|
// Call onChange handler if there's something for it to handle (event or a changed value)
|
|
85
90
|
if (onChange && (event || valueRef.current.value !== newValue)) onChange(newValue, event)
|
|
86
91
|
},
|
|
87
|
-
[isControlled, onChange, readOnly]
|
|
92
|
+
[inputRef, isControlled, onChange, readOnly]
|
|
88
93
|
)
|
|
89
94
|
const resetValue = useCallback((event) => setValue(valueRef.current.initial, event), [setValue])
|
|
90
95
|
|
|
91
|
-
return { currentValue, setValue, resetValue, isControlled }
|
|
96
|
+
return { currentValue, setValue, resetValue, isControlled, isDirty }
|
|
92
97
|
}
|
|
93
98
|
|
|
94
99
|
/**
|