@telus-uds/components-web 2.0.0 → 2.2.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/types/common.d.ts CHANGED
@@ -1,4 +1,22 @@
1
1
  import type { AriaRole, AriaAttributes } from 'react'
2
+ import type {
3
+ AccessibilityProps,
4
+ LayoutChangeEvent,
5
+ NativeSyntheticEvent,
6
+ TextLayoutEventData
7
+ } from './ReactNative'
8
+
9
+ export interface A11yProps extends AccessibilityProps {}
10
+
11
+ export interface InputSupportsProps {
12
+ copy?: CopyLang
13
+ label?: string
14
+ hint?: string
15
+ hintPosition?: 'inline' | 'below'
16
+ feedback?: string
17
+ tooltip?: string
18
+ validation?: 'error' | 'success'
19
+ }
2
20
 
3
21
  export interface HTMLAttrs extends AriaAttributes {
4
22
  dataSet?: Record<string, any>
@@ -11,4 +29,148 @@ export interface HTMLAttrs extends AriaAttributes {
11
29
  title?: string
12
30
  }
13
31
 
32
+ export interface TextInputHandlerProps {
33
+ // TODO: Typing RN synthetic event for web is going to be tricky...
34
+ // Come back to this and fix later.
35
+ onChange?: (text: string, event: any) => void
36
+ onChangeText?: (text: string) => void
37
+ onClear?: (event: any) => void
38
+ onSubmit?: (event: any) => void
39
+ onSubmitEditing?: (event: any) => void
40
+ onContentSizeChange?: ((w: number, h: number) => void) | undefined
41
+ onEndEditing?: (event: any) => void
42
+ onScroll?: (event: any) => void
43
+ onSelectionChange?: (event: any) => void
44
+ onKeyPress?: (event: any) => void
45
+ onKeyUp?: (event: any) => void
46
+ onKeyDown?: (event: any) => void
47
+ }
48
+
49
+ export interface CrossPlatformTextInputProps {
50
+ // Text props
51
+ maxFontSizeMultiplier?: number
52
+ nativeId?: string
53
+ onLayout?: (event: LayoutChangeEvent) => void
54
+ // Input value props
55
+ value?: string
56
+ initialValue?: string
57
+ readOnly?: boolean
58
+ inactive?: boolean
59
+ // Text input props
60
+ autoComplete?: string
61
+ autoCorrect?: boolean | 'on' | 'off'
62
+ autoFocus?: boolean
63
+ blurOnSubmit?: boolean
64
+ clearTextOnFocus?: boolean
65
+ editable?: boolean
66
+ keyboardType?: string
67
+ maxLength?: number
68
+ multiline?: boolean
69
+ numberOfLines?: number
70
+ placeholder?: string
71
+ placeholderTextColor?: string
72
+ returnKeyType?: string
73
+ secureTextEntry?: boolean
74
+ selectTextOnFocus?: boolean
75
+ spellCheck?: boolean
76
+ }
77
+
78
+ export interface NativeTextInputProps {
79
+ caretHidden?: boolean
80
+ clearButtonMode?: string
81
+ contextMenuHidden?: boolean
82
+ dataDetectorTypes?: string
83
+ disableFullscreenUI?: boolean
84
+ enablesReturnKeyAutomatically?: boolean
85
+ importantForAutofill?: string
86
+ inlineImageLeft?: string
87
+ keyboardAppearance?: string
88
+ returnKeyLabel?: string
89
+ rejectResponderTermination?: boolean
90
+ scrollEnabled?: boolean
91
+ selection?: any
92
+ selectionColor?: string
93
+ showSoftInputOnFocus?: boolean
94
+ textAlign?: string
95
+ textContentType?: string
96
+ passwordRules?: string
97
+ textBreakStrategy?: string
98
+ underlineColorAndroid?: string
99
+ }
100
+
101
+ export interface WebTextInputProps {
102
+ disabled?: boolean
103
+ dir?: 'auto' | 'ltr' | 'rtl'
104
+ lang?: string
105
+ pattern?: string
106
+ }
107
+
108
+ export interface TextInputProps
109
+ extends CrossPlatformTextInputProps,
110
+ NativeTextInputProps,
111
+ WebTextInputProps {}
112
+
113
+ export interface ViewProps {
114
+ pointerEvents?: 'all' | 'none' | 'box-only' | 'box-none'
115
+ onLayout?: (event: LayoutChangeEvent) => void
116
+ nativeID?: string
117
+ testID?: string
118
+ dataSet?: Record<string, any>
119
+ }
120
+
121
+ export interface CrossPlatformTextProps {
122
+ numberOfLines?: number
123
+ selectable?: boolean
124
+ }
125
+
126
+ export interface NativeTextProps {
127
+ ellipsizeMode?: string
128
+ maxFontSizeMultiplier?: number
129
+ minimumFontScale?: number
130
+ onTextLayout?: (event: NativeSyntheticEvent<TextLayoutEventData>) => void
131
+ suppressHighlighting?: boolean
132
+ textBreakStrategy?: string
133
+ }
134
+
135
+ export interface WebTextProps {
136
+ dir?: 'auto' | 'ltr' | 'rtl'
137
+ lang?: string
138
+ }
139
+
140
+ export interface TextProps extends CrossPlatformTextProps, NativeTextProps, WebTextProps {}
141
+
142
+ export type TextAlign = 'auto' | 'left' | 'right' | 'center' | 'justify'
143
+
144
+ export type Tokens = Record<string, any>
145
+
146
+ export type CopyLang = 'en' | 'fr'
147
+
14
148
  export type Variant = Record<string, string | number | boolean>
149
+
150
+ export interface PressableState {
151
+ pressed: boolean
152
+ hover: boolean
153
+ focus: boolean
154
+ }
155
+
156
+ // TODO: Make this more specific:
157
+ // https://telus.github.io/universal-design-system/components/allium/skeleton/#props
158
+ export type SkeletonProps = Record<string, any>
159
+
160
+ export type HeadingTag = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
161
+
162
+ export type LayoutTag =
163
+ | HeadingTag
164
+ | 'article'
165
+ | 'aside'
166
+ | 'blockquote'
167
+ | 'footer'
168
+ | 'figure'
169
+ | 'form'
170
+ | 'header'
171
+ | 'ul'
172
+ | 'li'
173
+ | 'main'
174
+ | 'nav'
175
+ | 'section'
176
+ | 'label'
@@ -0,0 +1,244 @@
1
+ import { ComponentType, ReactElement } from 'react'
2
+
3
+ type Props = { [key: string]: any }
4
+
5
+ export { default as Autocomplete } from './Autocomplete'
6
+ export type { AutocompleteProps, AutocompleteItem } from './Autocomplete'
7
+
8
+ export { default as Badge } from './Badge'
9
+ export type { BadgeProps } from './Badge'
10
+
11
+ export { default as BlockQuote } from './BlockQuote'
12
+ export type { BlockQuoteProps } from './BlockQuote'
13
+
14
+ export { default as Box } from './Box'
15
+ export type { BoxProps } from './Box'
16
+
17
+ export { default as Breadcrumbs } from './Breadcrumbs'
18
+ export type { BreadcrumbsProps, BreadcrumbRouteProps } from './Breadcrumbs'
19
+
20
+ export { default as MultiSelectFilter } from './MultiSelectFilter'
21
+ export type { MultiSelectFilterProps } from './MultiSelectFilter'
22
+
23
+ // Callout Exports
24
+ export { default as Callout } from './Callout'
25
+ export type { CalloutProps } from './Callout'
26
+
27
+ declare const Card: ComponentType<Props>
28
+
29
+ // DatePicker Exports
30
+ export { default as DatePicker } from './DatePicker'
31
+ export type { DatePickerProps } from './DatePicker'
32
+
33
+ declare const Disclaimer: ComponentType<Props>
34
+ declare const ExpandCollapseMini: ComponentType<Props>
35
+ declare const Footnote: ComponentType<Props> & {
36
+ Link: ComponentType<Props>
37
+ }
38
+ declare const Image: ComponentType<Props>
39
+ declare const List: ComponentType<Props> & {
40
+ Item: ComponentType<Props>
41
+ }
42
+ declare const Modal: ComponentType<Props>
43
+ declare const NavigationBar: ComponentType<Props>
44
+ declare const OptimizeImage: ComponentType<Props>
45
+ declare const OrderedList: ComponentType<Props> & {
46
+ Item: ComponentType<Props>
47
+ }
48
+ declare const Paragraph: ComponentType<Props>
49
+ declare const PreviewCard: ComponentType<Props>
50
+ declare const PriceLockup: ComponentType<Props>
51
+ declare const Progress: ComponentType<Props> & {
52
+ Bar: ComponentType<Props>
53
+ }
54
+ declare const ResponsiveImage: ComponentType<Props>
55
+ declare const Ribbon: ComponentType<Props>
56
+ declare const SkeletonProvider: ComponentType<Props>
57
+ declare const Span: ComponentType<Props>
58
+ declare const Spinner: ComponentType<Props>
59
+ declare const StoryCard: ComponentType<Props>
60
+ declare const Table: ComponentType<Props> & {
61
+ Header: ComponentType<Props>
62
+ Body: ComponentType<Props>
63
+ Row: ComponentType<Props>
64
+ SubHeading: ComponentType<Props>
65
+ Cell: ComponentType<Props>
66
+ }
67
+ declare const TermsAndConditions: ComponentType<Props>
68
+ declare const Testimonial: ComponentType<Props>
69
+ declare const Toast: ComponentType<Props>
70
+ declare const Video: ComponentType<Props>
71
+ declare const VideoPicker: ComponentType<Props>
72
+ declare const WaffleGrid: ComponentType<Props>
73
+
74
+ // WebVideo Exports
75
+ export { default as WebVideo } from './WebVideo'
76
+ export type { WebVideoProps } from './WebVideo'
77
+
78
+ declare const ssrStyles: (appName: string) => {
79
+ renderApp: (App: ComponentType<Props>, props: Props) => ReactElement<Props>
80
+ getStyles: (...existingStyles: any[]) => any[]
81
+ }
82
+
83
+ // Base Exports
84
+ declare const A11yText: ComponentType<Props>
85
+ declare const ActivityIndicator: ComponentType<Props>
86
+ declare const Button: ComponentType<Props>
87
+ declare const ButtonGroup: ComponentType<Props>
88
+ declare const ButtonLink: ComponentType<Props>
89
+ declare const Carousel: ComponentType<Props> & {
90
+ Item: ComponentType<Props>
91
+ }
92
+ declare const Checkbox: ComponentType<Props>
93
+ declare const CheckboxGroup: ComponentType<Props>
94
+ declare const ChevronLink: ComponentType<Props>
95
+ declare const Divider: ComponentType<Props>
96
+ declare const ExpandCollapse: ComponentType<Props> & {
97
+ Panel: ComponentType<Props>
98
+ }
99
+ declare const Feedback: ComponentType<Props>
100
+ declare const FlexGrid: ComponentType<Props> & {
101
+ Row: ComponentType<Props>
102
+ Col: ComponentType<Props>
103
+ }
104
+ declare const Icon: ComponentType<Props>
105
+ declare const InputLabel: ComponentType<Props>
106
+ declare const Link: ComponentType<Props>
107
+ declare const BaseModal: ComponentType<Props>
108
+ declare const Notification: ComponentType<Props>
109
+ declare const Pagination: ComponentType<Props> & {
110
+ PageButton: ComponentType<Props>
111
+ }
112
+
113
+ export { default as QuantitySelector } from './QuantitySelector'
114
+ export type { QuantitySelectorProps } from './QuantitySelector'
115
+
116
+ declare const QuickLinks: ComponentType<Props> & {
117
+ Item: ComponentType<Props>
118
+ }
119
+ declare const QuickLinksFeature: ComponentType<Props> & {
120
+ Item: ComponentType<Props>
121
+ }
122
+ declare const Radio: ComponentType<Props>
123
+ declare const RadioGroup: ComponentType<Props>
124
+ declare const RadioCard: ComponentType<Props>
125
+ declare const RadioCardGroup: ComponentType<Props>
126
+ declare const Search: ComponentType<Props>
127
+ declare const Select: ComponentType<Props> & {
128
+ Group: ComponentType<Props>
129
+ Item: ComponentType<Props>
130
+ }
131
+ declare const SideNav: ComponentType<Props> & {
132
+ ItemsGroup: ComponentType<Props>
133
+ Item: ComponentType<Props>
134
+ }
135
+ declare const Skeleton: ComponentType<Props>
136
+ declare const Spacer: ComponentType<Props>
137
+ declare const StackView: ComponentType<Props>
138
+ declare const StackWrap: ComponentType<Props>
139
+ declare const StepTracker: ComponentType<Props>
140
+ declare const Tabs: ComponentType<Props>
141
+ declare const Tags: ComponentType<Props>
142
+ declare const TextButton: ComponentType<Props>
143
+ declare const TextArea: ComponentType<Props>
144
+ declare const TextInput: ComponentType<Props>
145
+ declare const ToggleSwitch: ComponentType<Props>
146
+ declare const ToggleSwitchGroup: ComponentType<Props>
147
+ declare const Timeline: ComponentType<Props>
148
+
149
+ export { default as TooltipButton } from './TooltipButton'
150
+ export type { TooltipButtonProps } from './TooltipButton'
151
+
152
+ export { default as Tooltip } from './Tooltip'
153
+ export type { TooltipProps } from './Tooltip'
154
+
155
+ export { default as Typography } from './Typography'
156
+ export type { TypographyProps } from './Typography'
157
+
158
+ export interface ResponsivePropArgs<T> {
159
+ xs?: T | null
160
+ sm?: T | null
161
+ md?: T | null
162
+ lg?: T | null
163
+ xl?: T | null
164
+ }
165
+ declare const useResponsiveProp: <T>(prop: ResponsivePropArgs<T>, defaultValue?: T) => T
166
+ declare const useViewport: () => 'xs' | 'sm' | 'md' | 'lg' | 'xl'
167
+
168
+ // Cross Platform Exports
169
+ declare const IconButton: ComponentType<Props>
170
+
171
+ export {
172
+ Card,
173
+ Disclaimer,
174
+ ExpandCollapseMini,
175
+ Footnote,
176
+ Image,
177
+ List,
178
+ Modal,
179
+ NavigationBar,
180
+ OptimizeImage,
181
+ OrderedList,
182
+ Paragraph,
183
+ PreviewCard,
184
+ PriceLockup,
185
+ Progress,
186
+ ResponsiveImage,
187
+ Ribbon,
188
+ SkeletonProvider,
189
+ Span,
190
+ Spinner,
191
+ StoryCard,
192
+ Table,
193
+ TermsAndConditions,
194
+ Testimonial,
195
+ Toast,
196
+ Video,
197
+ VideoPicker,
198
+ WaffleGrid,
199
+ ssrStyles,
200
+ A11yText,
201
+ ActivityIndicator,
202
+ Button,
203
+ ButtonGroup,
204
+ ButtonLink,
205
+ Carousel,
206
+ Checkbox,
207
+ CheckboxGroup,
208
+ ChevronLink,
209
+ Divider,
210
+ ExpandCollapse,
211
+ Feedback,
212
+ FlexGrid,
213
+ Icon,
214
+ InputLabel,
215
+ Link,
216
+ BaseModal,
217
+ Notification,
218
+ Pagination,
219
+ QuickLinks,
220
+ QuickLinksFeature,
221
+ Radio,
222
+ RadioGroup,
223
+ RadioCard,
224
+ RadioCardGroup,
225
+ Search,
226
+ Select,
227
+ SideNav,
228
+ Skeleton,
229
+ Spacer,
230
+ StackView,
231
+ StackWrap,
232
+ StepTracker,
233
+ Tabs,
234
+ Tags,
235
+ TextButton,
236
+ TextArea,
237
+ TextInput,
238
+ ToggleSwitch,
239
+ ToggleSwitchGroup,
240
+ Timeline,
241
+ useResponsiveProp,
242
+ useViewport,
243
+ IconButton
244
+ }