@telus-uds/components-web 1.0.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 +15 -0
- package/README.md +1 -0
- package/lib/Badge/Badge.js +124 -0
- package/lib/Badge/index.js +13 -0
- package/lib/baseExports.js +367 -0
- package/lib/index.js +41 -0
- package/lib/utils/htmlAttrs.js +33 -0
- package/lib/utils/index.js +23 -0
- package/lib/utils/transforms.js +14 -0
- package/lib-module/Badge/Badge.js +107 -0
- package/lib-module/Badge/index.js +2 -0
- package/lib-module/baseExports.js +15 -0
- package/lib-module/index.js +3 -0
- package/lib-module/utils/htmlAttrs.js +22 -0
- package/lib-module/utils/index.js +3 -0
- package/lib-module/utils/transforms.js +4 -0
- package/package.json +57 -0
- package/src/Badge/Badge.jsx +88 -0
- package/src/Badge/index.js +3 -0
- package/src/baseExports.js +73 -0
- package/src/index.js +4 -0
- package/src/utils/htmlAttrs.js +29 -0
- package/src/utils/index.js +4 -0
- package/src/utils/transforms.js +6 -0
- package/types/Badge.d.ts +11 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Change Log - @telus-uds/components-web
|
|
2
|
+
|
|
3
|
+
This log was last generated on Thu, 23 Mar 2023 20:46:10 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
<!-- Start content -->
|
|
6
|
+
|
|
7
|
+
## 1.0.0
|
|
8
|
+
|
|
9
|
+
Thu, 23 Mar 2023 20:46:10 GMT
|
|
10
|
+
|
|
11
|
+
### Major changes
|
|
12
|
+
|
|
13
|
+
- Multi-brand badge component (srikanthkhari@gmail.com)
|
|
14
|
+
- Bump @telus-uds/components-base to v1.30.1
|
|
15
|
+
- Bump @telus-uds/system-theme-tokens to v2.14.0
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Web Components
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _componentsBase = require("@telus-uds/components-base");
|
|
13
|
+
|
|
14
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
15
|
+
|
|
16
|
+
var _utils = require("../utils");
|
|
17
|
+
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
|
|
20
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
+
|
|
22
|
+
const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
|
|
23
|
+
|
|
24
|
+
const BadgeContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
|
|
25
|
+
displayName: "Badge__BadgeContainer",
|
|
26
|
+
componentId: "components-web__sc-tsiuo2-0"
|
|
27
|
+
})(["background:", ";border:", ";display:inline-flex;justify-content:center;padding:", ";border-radius:", ";width:fit-content;", ""], _ref => {
|
|
28
|
+
let {
|
|
29
|
+
background
|
|
30
|
+
} = _ref;
|
|
31
|
+
return background;
|
|
32
|
+
}, _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
border
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return border;
|
|
37
|
+
}, _ref3 => {
|
|
38
|
+
let {
|
|
39
|
+
padding
|
|
40
|
+
} = _ref3;
|
|
41
|
+
return padding;
|
|
42
|
+
}, _ref4 => {
|
|
43
|
+
let {
|
|
44
|
+
radius
|
|
45
|
+
} = _ref4;
|
|
46
|
+
return radius;
|
|
47
|
+
}, _ref5 => {
|
|
48
|
+
let {
|
|
49
|
+
isOutlineOffer,
|
|
50
|
+
isAlternative,
|
|
51
|
+
gradient
|
|
52
|
+
} = _ref5;
|
|
53
|
+
return (isOutlineOffer || isAlternative) && "\n > div {\n background: ".concat(gradient, ";\n\t -webkit-background-clip: text;\n\t ").concat(gradient && '-webkit-text-fill-color: transparent;', "\n }");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const Badge = _ref6 => {
|
|
57
|
+
let {
|
|
58
|
+
children,
|
|
59
|
+
tokens,
|
|
60
|
+
variant = {},
|
|
61
|
+
...rest
|
|
62
|
+
} = _ref6;
|
|
63
|
+
const {
|
|
64
|
+
backgroundColor,
|
|
65
|
+
gradient,
|
|
66
|
+
borderColor,
|
|
67
|
+
borderRadius,
|
|
68
|
+
borderWidth,
|
|
69
|
+
color,
|
|
70
|
+
paddingLeft,
|
|
71
|
+
paddingRight,
|
|
72
|
+
paddingTop,
|
|
73
|
+
paddingBottom,
|
|
74
|
+
fontName,
|
|
75
|
+
fontWeight
|
|
76
|
+
} = (0, _componentsBase.useThemeTokens)('Badge', tokens, variant);
|
|
77
|
+
const semanticGradient = gradient && (0, _utils.transformGradient)(gradient);
|
|
78
|
+
const {
|
|
79
|
+
outline,
|
|
80
|
+
purpose,
|
|
81
|
+
alternative
|
|
82
|
+
} = variant;
|
|
83
|
+
let background = backgroundColor;
|
|
84
|
+
const isOutlineOffer = purpose === 'offer' && outline;
|
|
85
|
+
|
|
86
|
+
if ((isOutlineOffer || alternative) && gradient) {
|
|
87
|
+
background = "linear-gradient(#fff 0 0) padding-box, ".concat(semanticGradient, " border-box");
|
|
88
|
+
} else if (purpose === 'offer' && gradient) {
|
|
89
|
+
background = semanticGradient;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BadgeContainer, {
|
|
93
|
+
isOutlineOffer: isOutlineOffer,
|
|
94
|
+
isAlternative: alternative,
|
|
95
|
+
padding: "".concat(paddingTop, "px ").concat(paddingRight, "px ").concat(paddingBottom, "px ").concat(paddingLeft, "px"),
|
|
96
|
+
radius: "".concat(borderRadius, "px"),
|
|
97
|
+
background: background,
|
|
98
|
+
fontName: fontName,
|
|
99
|
+
fontWeight: fontWeight,
|
|
100
|
+
gradient: semanticGradient,
|
|
101
|
+
border: "".concat(borderWidth, "px solid ").concat(borderColor),
|
|
102
|
+
...selectProps(rest),
|
|
103
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Typography, {
|
|
104
|
+
tokens: {
|
|
105
|
+
fontName,
|
|
106
|
+
fontWeight,
|
|
107
|
+
color
|
|
108
|
+
},
|
|
109
|
+
children: children
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
Badge.propTypes = { ...selectedSystemPropTypes,
|
|
115
|
+
children: _propTypes.default.node,
|
|
116
|
+
tokens: (0, _componentsBase.getTokensPropType)('Badge'),
|
|
117
|
+
variant: _propTypes.default.exact({
|
|
118
|
+
outline: _propTypes.default.bool,
|
|
119
|
+
purpose: _propTypes.default.oneOf(['offer', 'editorial']),
|
|
120
|
+
alternative: _propTypes.default.bool
|
|
121
|
+
})
|
|
122
|
+
};
|
|
123
|
+
var _default = Badge;
|
|
124
|
+
exports.default = _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _Badge = _interopRequireDefault(require("./Badge"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
var _default = _Badge.default;
|
|
13
|
+
exports.default = _default;
|
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "A11yInfoProvider", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _componentsBase.A11yInfoProvider;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "A11yText", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _componentsBase.A11yText;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "ActivityIndicator", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _componentsBase.ActivityIndicator;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "BaseProvider", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _componentsBase.BaseProvider;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "Box", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _componentsBase.Box;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "Button", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _componentsBase.Button;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "ButtonDropdown", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _componentsBase.ButtonDropdown;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
Object.defineProperty(exports, "ButtonGroup", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function () {
|
|
51
|
+
return _componentsBase.ButtonGroup;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "ButtonLink", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () {
|
|
57
|
+
return _componentsBase.ButtonLink;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
Object.defineProperty(exports, "Card", {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () {
|
|
63
|
+
return _componentsBase.Card;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "Carousel", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: function () {
|
|
69
|
+
return _componentsBase.Carousel;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
Object.defineProperty(exports, "CarouselTabs", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
get: function () {
|
|
75
|
+
return _componentsBase.CarouselTabs;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "Checkbox", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: function () {
|
|
81
|
+
return _componentsBase.Checkbox;
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
Object.defineProperty(exports, "CheckboxGroup", {
|
|
85
|
+
enumerable: true,
|
|
86
|
+
get: function () {
|
|
87
|
+
return _componentsBase.CheckboxGroup;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "ChevronLink", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function () {
|
|
93
|
+
return _componentsBase.ChevronLink;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
Object.defineProperty(exports, "Divider", {
|
|
97
|
+
enumerable: true,
|
|
98
|
+
get: function () {
|
|
99
|
+
return _componentsBase.Divider;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "ExpandCollapse", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: function () {
|
|
105
|
+
return _componentsBase.ExpandCollapse;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
Object.defineProperty(exports, "Feedback", {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
get: function () {
|
|
111
|
+
return _componentsBase.Feedback;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "FlexGrid", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function () {
|
|
117
|
+
return _componentsBase.FlexGrid;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "Icon", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function () {
|
|
123
|
+
return _componentsBase.Icon;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "IconButton", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function () {
|
|
129
|
+
return _componentsBase.IconButton;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "InputLabel", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function () {
|
|
135
|
+
return _componentsBase.InputLabel;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "InputSupports", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function () {
|
|
141
|
+
return _componentsBase.InputSupports;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "Link", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function () {
|
|
147
|
+
return _componentsBase.Link;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "Modal", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function () {
|
|
153
|
+
return _componentsBase.Modal;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
Object.defineProperty(exports, "MultiSelectFilter", {
|
|
157
|
+
enumerable: true,
|
|
158
|
+
get: function () {
|
|
159
|
+
return _componentsBase.MultiSelectFilter;
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "Notification", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: function () {
|
|
165
|
+
return _componentsBase.Notification;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
Object.defineProperty(exports, "Pagination", {
|
|
169
|
+
enumerable: true,
|
|
170
|
+
get: function () {
|
|
171
|
+
return _componentsBase.Pagination;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "QuickLinks", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: function () {
|
|
177
|
+
return _componentsBase.QuickLinks;
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
Object.defineProperty(exports, "QuickLinksFeature", {
|
|
181
|
+
enumerable: true,
|
|
182
|
+
get: function () {
|
|
183
|
+
return _componentsBase.QuickLinksFeature;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "Radio", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: function () {
|
|
189
|
+
return _componentsBase.Radio;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
Object.defineProperty(exports, "RadioCard", {
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get: function () {
|
|
195
|
+
return _componentsBase.RadioCard;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
Object.defineProperty(exports, "RadioCardGroup", {
|
|
199
|
+
enumerable: true,
|
|
200
|
+
get: function () {
|
|
201
|
+
return _componentsBase.RadioCardGroup;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
Object.defineProperty(exports, "RadioGroup", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function () {
|
|
207
|
+
return _componentsBase.RadioGroup;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
Object.defineProperty(exports, "Responsive", {
|
|
211
|
+
enumerable: true,
|
|
212
|
+
get: function () {
|
|
213
|
+
return _componentsBase.Responsive;
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
Object.defineProperty(exports, "Search", {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return _componentsBase.Search;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, "Select", {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () {
|
|
225
|
+
return _componentsBase.Select;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
Object.defineProperty(exports, "SideNav", {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
get: function () {
|
|
231
|
+
return _componentsBase.SideNav;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
Object.defineProperty(exports, "Skeleton", {
|
|
235
|
+
enumerable: true,
|
|
236
|
+
get: function () {
|
|
237
|
+
return _componentsBase.Skeleton;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
Object.defineProperty(exports, "SkipLink", {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
get: function () {
|
|
243
|
+
return _componentsBase.SkipLink;
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
Object.defineProperty(exports, "Spacer", {
|
|
247
|
+
enumerable: true,
|
|
248
|
+
get: function () {
|
|
249
|
+
return _componentsBase.Spacer;
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
Object.defineProperty(exports, "StackView", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function () {
|
|
255
|
+
return _componentsBase.StackView;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
Object.defineProperty(exports, "StackWrap", {
|
|
259
|
+
enumerable: true,
|
|
260
|
+
get: function () {
|
|
261
|
+
return _componentsBase.StackWrap;
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
Object.defineProperty(exports, "StepTracker", {
|
|
265
|
+
enumerable: true,
|
|
266
|
+
get: function () {
|
|
267
|
+
return _componentsBase.StepTracker;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
Object.defineProperty(exports, "Tabs", {
|
|
271
|
+
enumerable: true,
|
|
272
|
+
get: function () {
|
|
273
|
+
return _componentsBase.Tabs;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
Object.defineProperty(exports, "Tags", {
|
|
277
|
+
enumerable: true,
|
|
278
|
+
get: function () {
|
|
279
|
+
return _componentsBase.Tags;
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
Object.defineProperty(exports, "TextArea", {
|
|
283
|
+
enumerable: true,
|
|
284
|
+
get: function () {
|
|
285
|
+
return _componentsBase.TextArea;
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
Object.defineProperty(exports, "TextButton", {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function () {
|
|
291
|
+
return _componentsBase.TextButton;
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
Object.defineProperty(exports, "TextInput", {
|
|
295
|
+
enumerable: true,
|
|
296
|
+
get: function () {
|
|
297
|
+
return _componentsBase.TextInput;
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
Object.defineProperty(exports, "ThemeProvider", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _componentsBase.ThemeProvider;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
Object.defineProperty(exports, "Timeline", {
|
|
307
|
+
enumerable: true,
|
|
308
|
+
get: function () {
|
|
309
|
+
return _componentsBase.Timeline;
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
Object.defineProperty(exports, "ToggleSwitch", {
|
|
313
|
+
enumerable: true,
|
|
314
|
+
get: function () {
|
|
315
|
+
return _componentsBase.ToggleSwitch;
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
Object.defineProperty(exports, "ToggleSwitchGroup", {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function () {
|
|
321
|
+
return _componentsBase.ToggleSwitchGroup;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
Object.defineProperty(exports, "Tooltip", {
|
|
325
|
+
enumerable: true,
|
|
326
|
+
get: function () {
|
|
327
|
+
return _componentsBase.Tooltip;
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
Object.defineProperty(exports, "TooltipButton", {
|
|
331
|
+
enumerable: true,
|
|
332
|
+
get: function () {
|
|
333
|
+
return _componentsBase.TooltipButton;
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
Object.defineProperty(exports, "Typography", {
|
|
337
|
+
enumerable: true,
|
|
338
|
+
get: function () {
|
|
339
|
+
return _componentsBase.Typography;
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
Object.defineProperty(exports, "ViewportProvider", {
|
|
343
|
+
enumerable: true,
|
|
344
|
+
get: function () {
|
|
345
|
+
return _componentsBase.ViewportProvider;
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
Object.defineProperty(exports, "useCarousel", {
|
|
349
|
+
enumerable: true,
|
|
350
|
+
get: function () {
|
|
351
|
+
return _componentsBase.useCarousel;
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
Object.defineProperty(exports, "useResponsiveProp", {
|
|
355
|
+
enumerable: true,
|
|
356
|
+
get: function () {
|
|
357
|
+
return _componentsBase.useResponsiveProp;
|
|
358
|
+
}
|
|
359
|
+
});
|
|
360
|
+
Object.defineProperty(exports, "useViewport", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function () {
|
|
363
|
+
return _componentsBase.useViewport;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
var _componentsBase = require("@telus-uds/components-base");
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
Badge: true,
|
|
8
|
+
transformGradient: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "Badge", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _Badge.default;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "transformGradient", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _utils.transformGradient;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
var _Badge = _interopRequireDefault(require("./Badge"));
|
|
24
|
+
|
|
25
|
+
var _utils = require("./utils");
|
|
26
|
+
|
|
27
|
+
var _baseExports = require("./baseExports");
|
|
28
|
+
|
|
29
|
+
Object.keys(_baseExports).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
32
|
+
if (key in exports && exports[key] === _baseExports[key]) return;
|
|
33
|
+
Object.defineProperty(exports, key, {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return _baseExports[key];
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const htmlAttrTypes = {
|
|
13
|
+
dataSet: _propTypes.default.object,
|
|
14
|
+
id: _propTypes.default.string,
|
|
15
|
+
loading: _propTypes.default.oneOf(['eager', 'lazy']),
|
|
16
|
+
// @todo figure out if we need to enum all the possible roles or maybe use
|
|
17
|
+
// an npm package
|
|
18
|
+
role: _propTypes.default.string,
|
|
19
|
+
src: _propTypes.default.string,
|
|
20
|
+
tabIndex: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
21
|
+
testID: _propTypes.default.string,
|
|
22
|
+
title: _propTypes.default.string
|
|
23
|
+
};
|
|
24
|
+
var _default = {
|
|
25
|
+
types: htmlAttrTypes,
|
|
26
|
+
select: props => Object.entries(props).reduce((items, _ref) => {
|
|
27
|
+
let [key, value] = _ref;
|
|
28
|
+
return Object.keys(htmlAttrTypes).includes(key) || /^(data|aria)-/.test(key) ? { ...items,
|
|
29
|
+
[key]: value
|
|
30
|
+
} : items;
|
|
31
|
+
}, {})
|
|
32
|
+
};
|
|
33
|
+
exports.default = _default;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "htmlAttrs", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _htmlAttrs.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "transformGradient", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _transforms.transformGradient;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _transforms = require("./transforms");
|
|
20
|
+
|
|
21
|
+
var _htmlAttrs = _interopRequireDefault(require("./htmlAttrs"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.transformGradient = exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
const transformGradient = gradient => "".concat(gradient.type, "-gradient(").concat(gradient.angle, "deg, ").concat(gradient.stops[0].color, " ").concat(gradient.stops[0].stop * 100, "%, ").concat(gradient.stops[1].color, " ").concat(gradient.stops[1].stop * 100, "%)");
|
|
9
|
+
|
|
10
|
+
exports.transformGradient = transformGradient;
|
|
11
|
+
var _default = {
|
|
12
|
+
transformGradient
|
|
13
|
+
};
|
|
14
|
+
exports.default = _default;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { selectSystemProps, Typography, getTokensPropType, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
+
import styled from 'styled-components';
|
|
5
|
+
import { htmlAttrs, transformGradient } from '../utils';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
8
|
+
const BadgeContainer = /*#__PURE__*/styled.div.withConfig({
|
|
9
|
+
displayName: "Badge__BadgeContainer",
|
|
10
|
+
componentId: "components-web__sc-tsiuo2-0"
|
|
11
|
+
})(["background:", ";border:", ";display:inline-flex;justify-content:center;padding:", ";border-radius:", ";width:fit-content;", ""], _ref => {
|
|
12
|
+
let {
|
|
13
|
+
background
|
|
14
|
+
} = _ref;
|
|
15
|
+
return background;
|
|
16
|
+
}, _ref2 => {
|
|
17
|
+
let {
|
|
18
|
+
border
|
|
19
|
+
} = _ref2;
|
|
20
|
+
return border;
|
|
21
|
+
}, _ref3 => {
|
|
22
|
+
let {
|
|
23
|
+
padding
|
|
24
|
+
} = _ref3;
|
|
25
|
+
return padding;
|
|
26
|
+
}, _ref4 => {
|
|
27
|
+
let {
|
|
28
|
+
radius
|
|
29
|
+
} = _ref4;
|
|
30
|
+
return radius;
|
|
31
|
+
}, _ref5 => {
|
|
32
|
+
let {
|
|
33
|
+
isOutlineOffer,
|
|
34
|
+
isAlternative,
|
|
35
|
+
gradient
|
|
36
|
+
} = _ref5;
|
|
37
|
+
return (isOutlineOffer || isAlternative) && "\n > div {\n background: ".concat(gradient, ";\n\t -webkit-background-clip: text;\n\t ").concat(gradient && '-webkit-text-fill-color: transparent;', "\n }");
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const Badge = _ref6 => {
|
|
41
|
+
let {
|
|
42
|
+
children,
|
|
43
|
+
tokens,
|
|
44
|
+
variant = {},
|
|
45
|
+
...rest
|
|
46
|
+
} = _ref6;
|
|
47
|
+
const {
|
|
48
|
+
backgroundColor,
|
|
49
|
+
gradient,
|
|
50
|
+
borderColor,
|
|
51
|
+
borderRadius,
|
|
52
|
+
borderWidth,
|
|
53
|
+
color,
|
|
54
|
+
paddingLeft,
|
|
55
|
+
paddingRight,
|
|
56
|
+
paddingTop,
|
|
57
|
+
paddingBottom,
|
|
58
|
+
fontName,
|
|
59
|
+
fontWeight
|
|
60
|
+
} = useThemeTokens('Badge', tokens, variant);
|
|
61
|
+
const semanticGradient = gradient && transformGradient(gradient);
|
|
62
|
+
const {
|
|
63
|
+
outline,
|
|
64
|
+
purpose,
|
|
65
|
+
alternative
|
|
66
|
+
} = variant;
|
|
67
|
+
let background = backgroundColor;
|
|
68
|
+
const isOutlineOffer = purpose === 'offer' && outline;
|
|
69
|
+
|
|
70
|
+
if ((isOutlineOffer || alternative) && gradient) {
|
|
71
|
+
background = "linear-gradient(#fff 0 0) padding-box, ".concat(semanticGradient, " border-box");
|
|
72
|
+
} else if (purpose === 'offer' && gradient) {
|
|
73
|
+
background = semanticGradient;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return /*#__PURE__*/_jsx(BadgeContainer, {
|
|
77
|
+
isOutlineOffer: isOutlineOffer,
|
|
78
|
+
isAlternative: alternative,
|
|
79
|
+
padding: "".concat(paddingTop, "px ").concat(paddingRight, "px ").concat(paddingBottom, "px ").concat(paddingLeft, "px"),
|
|
80
|
+
radius: "".concat(borderRadius, "px"),
|
|
81
|
+
background: background,
|
|
82
|
+
fontName: fontName,
|
|
83
|
+
fontWeight: fontWeight,
|
|
84
|
+
gradient: semanticGradient,
|
|
85
|
+
border: "".concat(borderWidth, "px solid ").concat(borderColor),
|
|
86
|
+
...selectProps(rest),
|
|
87
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
88
|
+
tokens: {
|
|
89
|
+
fontName,
|
|
90
|
+
fontWeight,
|
|
91
|
+
color
|
|
92
|
+
},
|
|
93
|
+
children: children
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
Badge.propTypes = { ...selectedSystemPropTypes,
|
|
99
|
+
children: PropTypes.node,
|
|
100
|
+
tokens: getTokensPropType('Badge'),
|
|
101
|
+
variant: PropTypes.exact({
|
|
102
|
+
outline: PropTypes.bool,
|
|
103
|
+
purpose: PropTypes.oneOf(['offer', 'editorial']),
|
|
104
|
+
alternative: PropTypes.bool
|
|
105
|
+
})
|
|
106
|
+
};
|
|
107
|
+
export default Badge;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following are re-exported unchanged from components-base.
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
/**
|
|
6
|
+
* Most base components should be re-exported as-is.
|
|
7
|
+
*/
|
|
8
|
+
A11yText, ActivityIndicator, Box, Button, BaseProvider, A11yInfoProvider, ViewportProvider, ThemeProvider, ButtonDropdown, ButtonGroup, ButtonLink, Carousel, Card, CarouselTabs, Checkbox, CheckboxGroup, ChevronLink, Divider, ExpandCollapse, Feedback, FlexGrid, Icon, IconButton, InputLabel, InputSupports, Link, Modal, MultiSelectFilter, Notification, Pagination, QuickLinks, QuickLinksFeature, Radio, RadioGroup, RadioCard, RadioCardGroup, Responsive, Search, Select, SideNav, Skeleton, SkipLink, Spacer, StackView, StackWrap, StepTracker, Tabs, Tags, TextButton, TextArea, TextInput, Timeline, ToggleSwitch, ToggleSwitchGroup, TooltipButton, Tooltip, Typography,
|
|
9
|
+
/*
|
|
10
|
+
* Most utilities exported from @telus-uds/components-base are for building systems, not apps.
|
|
11
|
+
* Re-export only those utilities with a stable API and known use cases within apps / pages.
|
|
12
|
+
*/
|
|
13
|
+
// Enable access to the viewports system for app-specific responsive layouts and features
|
|
14
|
+
useResponsiveProp, useViewport, // TODO reenable ViewportContext once published from base // enable localised viewport overrides e.g. in tests, narrow columns, etc
|
|
15
|
+
useCarousel } from '@telus-uds/components-base';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import PropTypes from 'prop-types';
|
|
2
|
+
const htmlAttrTypes = {
|
|
3
|
+
dataSet: PropTypes.object,
|
|
4
|
+
id: PropTypes.string,
|
|
5
|
+
loading: PropTypes.oneOf(['eager', 'lazy']),
|
|
6
|
+
// @todo figure out if we need to enum all the possible roles or maybe use
|
|
7
|
+
// an npm package
|
|
8
|
+
role: PropTypes.string,
|
|
9
|
+
src: PropTypes.string,
|
|
10
|
+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
11
|
+
testID: PropTypes.string,
|
|
12
|
+
title: PropTypes.string
|
|
13
|
+
};
|
|
14
|
+
export default {
|
|
15
|
+
types: htmlAttrTypes,
|
|
16
|
+
select: props => Object.entries(props).reduce((items, _ref) => {
|
|
17
|
+
let [key, value] = _ref;
|
|
18
|
+
return Object.keys(htmlAttrTypes).includes(key) || /^(data|aria)-/.test(key) ? { ...items,
|
|
19
|
+
[key]: value
|
|
20
|
+
} : items;
|
|
21
|
+
}, {})
|
|
22
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export const transformGradient = gradient => "".concat(gradient.type, "-gradient(").concat(gradient.angle, "deg, ").concat(gradient.stops[0].color, " ").concat(gradient.stops[0].stop * 100, "%, ").concat(gradient.stops[1].color, " ").concat(gradient.stops[1].stop * 100, "%)");
|
|
2
|
+
export default {
|
|
3
|
+
transformGradient
|
|
4
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"author": "TELUS Digital",
|
|
3
|
+
"browserslist": [
|
|
4
|
+
"extends @telus-uds/browserslist-config"
|
|
5
|
+
],
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@telus-uds/components-base": "1.30.1",
|
|
8
|
+
"@telus-uds/system-constants": "^1.2.0",
|
|
9
|
+
"@telus-uds/system-theme-tokens": "^2.14.0",
|
|
10
|
+
"prop-types": "^15.7.2"
|
|
11
|
+
},
|
|
12
|
+
"description": "UDS mult-brand web components",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@telus-uds/browserslist-config": "^1.0.4",
|
|
15
|
+
"@testing-library/jest-dom": "^5.16.1",
|
|
16
|
+
"@testing-library/react": "^13.3.0",
|
|
17
|
+
"@types/react": "^18.0.0",
|
|
18
|
+
"assert": "^2.0.0",
|
|
19
|
+
"babel-plugin-react-native-web": "^0.18.7",
|
|
20
|
+
"babel-plugin-styled-components": "^2.0.6",
|
|
21
|
+
"jest-axe": "^6.0.0",
|
|
22
|
+
"jest-styled-components": "^7.0.8",
|
|
23
|
+
"react-test-renderer": "~18.0.0",
|
|
24
|
+
"webpack": "5.x"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://github.com/telus/universal-design-system#readme",
|
|
27
|
+
"license": "UNLICENSED",
|
|
28
|
+
"main": "lib/index.js",
|
|
29
|
+
"module": "lib-module/index.js",
|
|
30
|
+
"name": "@telus-uds/components-web",
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": "^17.0.2 || ^18.0.0",
|
|
33
|
+
"react-dom": "^17.0.2 || ^18.0.0",
|
|
34
|
+
"react-native-web": "~0.17.7 || ~0.18.7",
|
|
35
|
+
"styled-components": "^5.3.0"
|
|
36
|
+
},
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "git+https://github.com/telus/universal-design-system.git"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "npm run build:code",
|
|
43
|
+
"build:main": "babel src -d lib",
|
|
44
|
+
"build:module": "babel src -d lib-module --env-name module",
|
|
45
|
+
"build:code": "npm run build:main && npm run build:module",
|
|
46
|
+
"format": "prettier --write .",
|
|
47
|
+
"lint": "telus-standard",
|
|
48
|
+
"lint:fix": "telus-standard --fix",
|
|
49
|
+
"test": "jest"
|
|
50
|
+
},
|
|
51
|
+
"sideEffects": false,
|
|
52
|
+
"standard-engine": {
|
|
53
|
+
"skip": true
|
|
54
|
+
},
|
|
55
|
+
"types": "types/index.d.ts",
|
|
56
|
+
"version": "1.0.0"
|
|
57
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import {
|
|
4
|
+
selectSystemProps,
|
|
5
|
+
Typography,
|
|
6
|
+
getTokensPropType,
|
|
7
|
+
useThemeTokens
|
|
8
|
+
} from '@telus-uds/components-base'
|
|
9
|
+
import styled from 'styled-components'
|
|
10
|
+
import { htmlAttrs, transformGradient } from '../utils'
|
|
11
|
+
|
|
12
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
13
|
+
|
|
14
|
+
const BadgeContainer = styled.div`
|
|
15
|
+
background: ${({ background }) => background};
|
|
16
|
+
border: ${({ border }) => border};
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
justify-content: center;
|
|
19
|
+
padding: ${({ padding }) => padding};
|
|
20
|
+
border-radius: ${({ radius }) => radius};
|
|
21
|
+
width: fit-content;
|
|
22
|
+
${({ isOutlineOffer, isAlternative, gradient }) =>
|
|
23
|
+
(isOutlineOffer || isAlternative) &&
|
|
24
|
+
`
|
|
25
|
+
> div {
|
|
26
|
+
background: ${gradient};
|
|
27
|
+
-webkit-background-clip: text;
|
|
28
|
+
${gradient && '-webkit-text-fill-color: transparent;'}
|
|
29
|
+
}`}
|
|
30
|
+
`
|
|
31
|
+
|
|
32
|
+
const Badge = ({ children, tokens, variant = {}, ...rest }) => {
|
|
33
|
+
const {
|
|
34
|
+
backgroundColor,
|
|
35
|
+
gradient,
|
|
36
|
+
borderColor,
|
|
37
|
+
borderRadius,
|
|
38
|
+
borderWidth,
|
|
39
|
+
color,
|
|
40
|
+
paddingLeft,
|
|
41
|
+
paddingRight,
|
|
42
|
+
paddingTop,
|
|
43
|
+
paddingBottom,
|
|
44
|
+
fontName,
|
|
45
|
+
fontWeight
|
|
46
|
+
} = useThemeTokens('Badge', tokens, variant)
|
|
47
|
+
|
|
48
|
+
const semanticGradient = gradient && transformGradient(gradient)
|
|
49
|
+
|
|
50
|
+
const { outline, purpose, alternative } = variant
|
|
51
|
+
let background = backgroundColor
|
|
52
|
+
const isOutlineOffer = purpose === 'offer' && outline
|
|
53
|
+
if ((isOutlineOffer || alternative) && gradient) {
|
|
54
|
+
background = `linear-gradient(#fff 0 0) padding-box, ${semanticGradient} border-box`
|
|
55
|
+
} else if (purpose === 'offer' && gradient) {
|
|
56
|
+
background = semanticGradient
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<BadgeContainer
|
|
61
|
+
isOutlineOffer={isOutlineOffer}
|
|
62
|
+
isAlternative={alternative}
|
|
63
|
+
padding={`${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`}
|
|
64
|
+
radius={`${borderRadius}px`}
|
|
65
|
+
background={background}
|
|
66
|
+
fontName={fontName}
|
|
67
|
+
fontWeight={fontWeight}
|
|
68
|
+
gradient={semanticGradient}
|
|
69
|
+
border={`${borderWidth}px solid ${borderColor}`}
|
|
70
|
+
{...selectProps(rest)}
|
|
71
|
+
>
|
|
72
|
+
<Typography tokens={{ fontName, fontWeight, color }}>{children}</Typography>
|
|
73
|
+
</BadgeContainer>
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
Badge.propTypes = {
|
|
78
|
+
...selectedSystemPropTypes,
|
|
79
|
+
children: PropTypes.node,
|
|
80
|
+
tokens: getTokensPropType('Badge'),
|
|
81
|
+
variant: PropTypes.exact({
|
|
82
|
+
outline: PropTypes.bool,
|
|
83
|
+
purpose: PropTypes.oneOf(['offer', 'editorial']),
|
|
84
|
+
alternative: PropTypes.bool
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default Badge
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The following are re-exported unchanged from components-base.
|
|
3
|
+
*/
|
|
4
|
+
export {
|
|
5
|
+
/**
|
|
6
|
+
* Most base components should be re-exported as-is.
|
|
7
|
+
*/
|
|
8
|
+
A11yText,
|
|
9
|
+
ActivityIndicator,
|
|
10
|
+
Box,
|
|
11
|
+
Button,
|
|
12
|
+
BaseProvider,
|
|
13
|
+
A11yInfoProvider,
|
|
14
|
+
ViewportProvider,
|
|
15
|
+
ThemeProvider,
|
|
16
|
+
ButtonDropdown,
|
|
17
|
+
ButtonGroup,
|
|
18
|
+
ButtonLink,
|
|
19
|
+
Carousel,
|
|
20
|
+
Card,
|
|
21
|
+
CarouselTabs,
|
|
22
|
+
Checkbox,
|
|
23
|
+
CheckboxGroup,
|
|
24
|
+
ChevronLink,
|
|
25
|
+
Divider,
|
|
26
|
+
ExpandCollapse,
|
|
27
|
+
Feedback,
|
|
28
|
+
FlexGrid,
|
|
29
|
+
Icon,
|
|
30
|
+
IconButton,
|
|
31
|
+
InputLabel,
|
|
32
|
+
InputSupports,
|
|
33
|
+
Link,
|
|
34
|
+
Modal,
|
|
35
|
+
MultiSelectFilter,
|
|
36
|
+
Notification,
|
|
37
|
+
Pagination,
|
|
38
|
+
QuickLinks,
|
|
39
|
+
QuickLinksFeature,
|
|
40
|
+
Radio,
|
|
41
|
+
RadioGroup,
|
|
42
|
+
RadioCard,
|
|
43
|
+
RadioCardGroup,
|
|
44
|
+
Responsive,
|
|
45
|
+
Search,
|
|
46
|
+
Select,
|
|
47
|
+
SideNav,
|
|
48
|
+
Skeleton,
|
|
49
|
+
SkipLink,
|
|
50
|
+
Spacer,
|
|
51
|
+
StackView,
|
|
52
|
+
StackWrap,
|
|
53
|
+
StepTracker,
|
|
54
|
+
Tabs,
|
|
55
|
+
Tags,
|
|
56
|
+
TextButton,
|
|
57
|
+
TextArea,
|
|
58
|
+
TextInput,
|
|
59
|
+
Timeline,
|
|
60
|
+
ToggleSwitch,
|
|
61
|
+
ToggleSwitchGroup,
|
|
62
|
+
TooltipButton,
|
|
63
|
+
Tooltip,
|
|
64
|
+
Typography,
|
|
65
|
+
/*
|
|
66
|
+
* Most utilities exported from @telus-uds/components-base are for building systems, not apps.
|
|
67
|
+
* Re-export only those utilities with a stable API and known use cases within apps / pages.
|
|
68
|
+
*/
|
|
69
|
+
// Enable access to the viewports system for app-specific responsive layouts and features
|
|
70
|
+
useResponsiveProp,
|
|
71
|
+
useViewport, // TODO reenable ViewportContext once published from base // enable localised viewport overrides e.g. in tests, narrow columns, etc
|
|
72
|
+
useCarousel
|
|
73
|
+
} from '@telus-uds/components-base'
|
package/src/index.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import PropTypes from 'prop-types'
|
|
2
|
+
|
|
3
|
+
const htmlAttrTypes = {
|
|
4
|
+
dataSet: PropTypes.object,
|
|
5
|
+
id: PropTypes.string,
|
|
6
|
+
loading: PropTypes.oneOf(['eager', 'lazy']),
|
|
7
|
+
// @todo figure out if we need to enum all the possible roles or maybe use
|
|
8
|
+
// an npm package
|
|
9
|
+
role: PropTypes.string,
|
|
10
|
+
src: PropTypes.string,
|
|
11
|
+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
12
|
+
testID: PropTypes.string,
|
|
13
|
+
title: PropTypes.string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default {
|
|
17
|
+
types: htmlAttrTypes,
|
|
18
|
+
select: (props) =>
|
|
19
|
+
Object.entries(props).reduce(
|
|
20
|
+
(items, [key, value]) =>
|
|
21
|
+
Object.keys(htmlAttrTypes).includes(key) || /^(data|aria)-/.test(key)
|
|
22
|
+
? {
|
|
23
|
+
...items,
|
|
24
|
+
[key]: value
|
|
25
|
+
}
|
|
26
|
+
: items,
|
|
27
|
+
{}
|
|
28
|
+
)
|
|
29
|
+
}
|
package/types/Badge.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react'
|
|
2
|
+
import type { HTMLAttrs, Variant } from './common'
|
|
3
|
+
|
|
4
|
+
export interface BadgeProps extends HTMLAttrs {
|
|
5
|
+
children?: ReactNode
|
|
6
|
+
variant?: Variant
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare const Badge: ComponentType<BadgeProps>
|
|
10
|
+
|
|
11
|
+
export default Badge
|