@spaced-out/ui-design-system 0.0.39 → 0.0.41

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.
@@ -12,195 +12,371 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
14
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
15
- const JumboMedium = _ref => {
15
+ const HighlightText = _ref => {
16
+ let {
17
+ text,
18
+ highlight,
19
+ highlightClassName,
20
+ caseSensitiveHighlighting,
21
+ highlightWithBackground
22
+ } = _ref;
23
+ // Split text on highlight term, include term itself into parts, ignore case
24
+ const parts = text.split(new RegExp(`(${highlight})`, caseSensitiveHighlighting ? '' : 'gi'));
25
+ return /*#__PURE__*/React.createElement("span", null, parts.map(part => part.toLowerCase() === highlight.toLowerCase() ? /*#__PURE__*/React.createElement("span", {
26
+ className: (0, _classify.default)(_typographyModule.default.highlightText, {
27
+ [_typographyModule.default.bgHighlighting]: highlightWithBackground
28
+ }, highlightClassName)
29
+ }, part) : part));
30
+ };
31
+ const JumboMedium = _ref2 => {
16
32
  let {
17
33
  color = _typography.TEXT_COLORS.primary,
18
34
  children,
19
35
  className,
36
+ highlightedTextClassName,
37
+ highlightString,
38
+ caseSensitiveHighlighting,
39
+ highlightWithBackground,
20
40
  ...props
21
- } = _ref;
41
+ } = _ref2;
22
42
  return /*#__PURE__*/React.createElement("span", _extends({}, props, {
23
43
  className: (0, _classify.default)(_typographyModule.default.jumboMedium, _typographyModule.default[color], className)
24
- }), children);
44
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
45
+ text: children,
46
+ highlight: highlightString,
47
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
48
+ highlightClassName: highlightedTextClassName,
49
+ highlightWithBackground: highlightWithBackground
50
+ }) : children);
25
51
  };
26
52
  exports.JumboMedium = JumboMedium;
27
- const TitleMedium = _ref2 => {
53
+ const TitleMedium = _ref3 => {
28
54
  let {
29
55
  color = _typography.TEXT_COLORS.primary,
30
56
  children,
31
57
  className,
58
+ highlightedTextClassName,
59
+ highlightString,
60
+ caseSensitiveHighlighting,
61
+ highlightWithBackground,
32
62
  ...props
33
- } = _ref2;
63
+ } = _ref3;
34
64
  return /*#__PURE__*/React.createElement("h1", _extends({}, props, {
35
65
  className: (0, _classify.default)(_typographyModule.default.titleMedium, _typographyModule.default[color], className)
36
- }), children);
66
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
67
+ text: children,
68
+ highlight: highlightString,
69
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
70
+ highlightClassName: highlightedTextClassName,
71
+ highlightWithBackground: highlightWithBackground
72
+ }) : children);
37
73
  };
38
74
  exports.TitleMedium = TitleMedium;
39
- const SubTitleLarge = _ref3 => {
75
+ const SubTitleLarge = _ref4 => {
40
76
  let {
41
77
  color = _typography.TEXT_COLORS.primary,
42
78
  children,
43
79
  className,
80
+ highlightedTextClassName,
81
+ highlightString,
82
+ caseSensitiveHighlighting,
83
+ highlightWithBackground,
44
84
  ...props
45
- } = _ref3;
85
+ } = _ref4;
46
86
  return /*#__PURE__*/React.createElement("h2", _extends({}, props, {
47
87
  className: (0, _classify.default)(_typographyModule.default.subTitleLarge, _typographyModule.default[color], className)
48
- }), children);
88
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
89
+ text: children,
90
+ highlight: highlightString,
91
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
92
+ highlightClassName: highlightedTextClassName,
93
+ highlightWithBackground: highlightWithBackground
94
+ }) : children);
49
95
  };
50
96
  exports.SubTitleLarge = SubTitleLarge;
51
- const SubTitleMedium = _ref4 => {
97
+ const SubTitleMedium = _ref5 => {
52
98
  let {
53
99
  color = _typography.TEXT_COLORS.primary,
54
100
  children,
55
101
  className,
102
+ highlightedTextClassName,
103
+ highlightString,
104
+ caseSensitiveHighlighting,
105
+ highlightWithBackground,
56
106
  ...props
57
- } = _ref4;
107
+ } = _ref5;
58
108
  return /*#__PURE__*/React.createElement("h3", _extends({}, props, {
59
109
  className: (0, _classify.default)(_typographyModule.default.subTitleMedium, _typographyModule.default[color], className)
60
- }), children);
110
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
111
+ text: children,
112
+ highlight: highlightString,
113
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
114
+ highlightClassName: highlightedTextClassName,
115
+ highlightWithBackground: highlightWithBackground
116
+ }) : children);
61
117
  };
62
118
  exports.SubTitleMedium = SubTitleMedium;
63
- const SubTitleSmall = _ref5 => {
119
+ const SubTitleSmall = _ref6 => {
64
120
  let {
65
121
  color = _typography.TEXT_COLORS.primary,
66
122
  children,
67
123
  className,
124
+ highlightedTextClassName,
125
+ highlightString,
126
+ caseSensitiveHighlighting,
127
+ highlightWithBackground,
68
128
  ...props
69
- } = _ref5;
129
+ } = _ref6;
70
130
  return /*#__PURE__*/React.createElement("h4", _extends({}, props, {
71
131
  className: (0, _classify.default)(_typographyModule.default.subTitleSmall, _typographyModule.default[color], className)
72
- }), children);
132
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
133
+ text: children,
134
+ highlight: highlightString,
135
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
136
+ highlightClassName: highlightedTextClassName,
137
+ highlightWithBackground: highlightWithBackground
138
+ }) : children);
73
139
  };
74
140
  exports.SubTitleSmall = SubTitleSmall;
75
- const SubTitleExtraSmall = _ref6 => {
141
+ const SubTitleExtraSmall = _ref7 => {
76
142
  let {
77
143
  color = _typography.TEXT_COLORS.primary,
78
144
  children,
79
145
  className,
146
+ highlightedTextClassName,
147
+ highlightString,
148
+ caseSensitiveHighlighting,
149
+ highlightWithBackground,
80
150
  ...props
81
- } = _ref6;
151
+ } = _ref7;
82
152
  return /*#__PURE__*/React.createElement("h5", _extends({}, props, {
83
153
  className: (0, _classify.default)(_typographyModule.default.subTitleExtraSmall, _typographyModule.default[color], className)
84
- }), children);
154
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
155
+ text: children,
156
+ highlight: highlightString,
157
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
158
+ highlightClassName: highlightedTextClassName,
159
+ highlightWithBackground: highlightWithBackground
160
+ }) : children);
85
161
  };
86
162
  exports.SubTitleExtraSmall = SubTitleExtraSmall;
87
- const ButtonTextMedium = _ref7 => {
163
+ const ButtonTextMedium = _ref8 => {
88
164
  let {
89
165
  color = _typography.TEXT_COLORS.primary,
90
166
  children,
91
167
  className,
168
+ highlightedTextClassName,
169
+ highlightString,
170
+ caseSensitiveHighlighting,
171
+ highlightWithBackground,
92
172
  ...props
93
- } = _ref7;
173
+ } = _ref8;
94
174
  return /*#__PURE__*/React.createElement("span", _extends({}, props, {
95
175
  className: (0, _classify.default)(_typographyModule.default.buttonTextMedium, _typographyModule.default[color], className)
96
- }), children);
176
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
177
+ text: children,
178
+ highlight: highlightString,
179
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
180
+ highlightClassName: highlightedTextClassName,
181
+ highlightWithBackground: highlightWithBackground
182
+ }) : children);
97
183
  };
98
184
  exports.ButtonTextMedium = ButtonTextMedium;
99
- const ButtonTextSmall = _ref8 => {
185
+ const ButtonTextSmall = _ref9 => {
100
186
  let {
101
187
  color = _typography.TEXT_COLORS.primary,
102
188
  children,
103
189
  className,
190
+ highlightedTextClassName,
191
+ highlightString,
192
+ caseSensitiveHighlighting,
193
+ highlightWithBackground,
104
194
  ...props
105
- } = _ref8;
195
+ } = _ref9;
106
196
  return /*#__PURE__*/React.createElement("span", _extends({}, props, {
107
197
  className: (0, _classify.default)(_typographyModule.default.buttonTextSmall, _typographyModule.default[color], className)
108
- }), children);
198
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
199
+ text: children,
200
+ highlight: highlightString,
201
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
202
+ highlightClassName: highlightedTextClassName,
203
+ highlightWithBackground: highlightWithBackground
204
+ }) : children);
109
205
  };
110
206
  exports.ButtonTextSmall = ButtonTextSmall;
111
- const ButtonTextExtraSmall = _ref9 => {
207
+ const ButtonTextExtraSmall = _ref10 => {
112
208
  let {
113
209
  color = _typography.TEXT_COLORS.primary,
114
210
  children,
115
211
  className,
212
+ highlightedTextClassName,
213
+ highlightString,
214
+ caseSensitiveHighlighting,
215
+ highlightWithBackground,
116
216
  ...props
117
- } = _ref9;
217
+ } = _ref10;
118
218
  return /*#__PURE__*/React.createElement("span", _extends({}, props, {
119
219
  className: (0, _classify.default)(_typographyModule.default.buttonTextExtraSmall, _typographyModule.default[color], className)
120
- }), children);
220
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
221
+ text: children,
222
+ highlight: highlightString,
223
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
224
+ highlightClassName: highlightedTextClassName,
225
+ highlightWithBackground: highlightWithBackground
226
+ }) : children);
121
227
  };
122
228
  exports.ButtonTextExtraSmall = ButtonTextExtraSmall;
123
- const FormInputMedium = _ref10 => {
229
+ const FormInputMedium = _ref11 => {
124
230
  let {
125
231
  color = _typography.TEXT_COLORS.primary,
126
232
  children,
127
233
  className,
234
+ highlightedTextClassName,
235
+ highlightString,
236
+ caseSensitiveHighlighting,
237
+ highlightWithBackground,
128
238
  ...props
129
- } = _ref10;
239
+ } = _ref11;
130
240
  return /*#__PURE__*/React.createElement("p", _extends({}, props, {
131
241
  className: (0, _classify.default)(_typographyModule.default.formInputMedium, _typographyModule.default[color], className)
132
- }), children);
242
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
243
+ text: children,
244
+ highlight: highlightString,
245
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
246
+ highlightClassName: highlightedTextClassName,
247
+ highlightWithBackground: highlightWithBackground
248
+ }) : children);
133
249
  };
134
250
  exports.FormInputMedium = FormInputMedium;
135
- const FormInputSmall = _ref11 => {
251
+ const FormInputSmall = _ref12 => {
136
252
  let {
137
253
  color = _typography.TEXT_COLORS.primary,
138
254
  children,
139
255
  className,
256
+ highlightedTextClassName,
257
+ highlightString,
258
+ caseSensitiveHighlighting,
259
+ highlightWithBackground,
140
260
  ...props
141
- } = _ref11;
261
+ } = _ref12;
142
262
  return /*#__PURE__*/React.createElement("p", _extends({}, props, {
143
263
  className: (0, _classify.default)(_typographyModule.default.formInputSmall, _typographyModule.default[color], className)
144
- }), children);
264
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
265
+ text: children,
266
+ highlight: highlightString,
267
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
268
+ highlightClassName: highlightedTextClassName,
269
+ highlightWithBackground: highlightWithBackground
270
+ }) : children);
145
271
  };
146
272
  exports.FormInputSmall = FormInputSmall;
147
- const BodyLarge = _ref12 => {
273
+ const BodyLarge = _ref13 => {
148
274
  let {
149
275
  color = _typography.TEXT_COLORS.primary,
150
276
  children,
151
277
  className,
278
+ highlightedTextClassName,
279
+ highlightString,
280
+ caseSensitiveHighlighting,
281
+ highlightWithBackground,
152
282
  ...props
153
- } = _ref12;
283
+ } = _ref13;
154
284
  return /*#__PURE__*/React.createElement("p", _extends({}, props, {
155
285
  className: (0, _classify.default)(_typographyModule.default.bodyLarge, _typographyModule.default[color], className)
156
- }), children);
286
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
287
+ text: children,
288
+ highlight: highlightString,
289
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
290
+ highlightClassName: highlightedTextClassName,
291
+ highlightWithBackground: highlightWithBackground
292
+ }) : children);
157
293
  };
158
294
  exports.BodyLarge = BodyLarge;
159
- const BodyMedium = _ref13 => {
295
+ const BodyMedium = _ref14 => {
160
296
  let {
161
297
  color = _typography.TEXT_COLORS.primary,
162
298
  children,
163
299
  className,
300
+ highlightedTextClassName,
301
+ highlightString,
302
+ caseSensitiveHighlighting,
303
+ highlightWithBackground,
164
304
  ...props
165
- } = _ref13;
305
+ } = _ref14;
166
306
  return /*#__PURE__*/React.createElement("p", _extends({}, props, {
167
307
  className: (0, _classify.default)(_typographyModule.default.bodyMedium, _typographyModule.default[color], className)
168
- }), children);
308
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
309
+ text: children,
310
+ highlight: highlightString,
311
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
312
+ highlightClassName: highlightedTextClassName,
313
+ highlightWithBackground: highlightWithBackground
314
+ }) : children);
169
315
  };
170
316
  exports.BodyMedium = BodyMedium;
171
- const BodySmall = _ref14 => {
317
+ const BodySmall = _ref15 => {
172
318
  let {
173
319
  color = _typography.TEXT_COLORS.primary,
174
320
  children,
175
321
  className,
322
+ highlightedTextClassName,
323
+ highlightString,
324
+ caseSensitiveHighlighting,
325
+ highlightWithBackground,
176
326
  ...props
177
- } = _ref14;
327
+ } = _ref15;
178
328
  return /*#__PURE__*/React.createElement("p", _extends({}, props, {
179
329
  className: (0, _classify.default)(_typographyModule.default.bodySmall, _typographyModule.default[color], className)
180
- }), children);
330
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
331
+ text: children,
332
+ highlight: highlightString,
333
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
334
+ highlightClassName: highlightedTextClassName,
335
+ highlightWithBackground: highlightWithBackground
336
+ }) : children);
181
337
  };
182
338
  exports.BodySmall = BodySmall;
183
- const FormLabelMedium = _ref15 => {
339
+ const FormLabelMedium = _ref16 => {
184
340
  let {
185
341
  color = _typography.TEXT_COLORS.primary,
186
342
  children,
187
343
  className,
344
+ highlightedTextClassName,
345
+ highlightString,
346
+ caseSensitiveHighlighting,
347
+ highlightWithBackground,
188
348
  ...props
189
- } = _ref15;
349
+ } = _ref16;
190
350
  return /*#__PURE__*/React.createElement("span", _extends({}, props, {
191
351
  className: (0, _classify.default)(_typographyModule.default.formLabelMedium, _typographyModule.default[color], className)
192
- }), children);
352
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
353
+ text: children,
354
+ highlight: highlightString,
355
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
356
+ highlightClassName: highlightedTextClassName,
357
+ highlightWithBackground: highlightWithBackground
358
+ }) : children);
193
359
  };
194
360
  exports.FormLabelMedium = FormLabelMedium;
195
- const FormLabelSmall = _ref16 => {
361
+ const FormLabelSmall = _ref17 => {
196
362
  let {
197
363
  color = _typography.TEXT_COLORS.primary,
198
364
  children,
199
365
  className,
366
+ highlightedTextClassName,
367
+ highlightString,
368
+ caseSensitiveHighlighting,
369
+ highlightWithBackground,
200
370
  ...props
201
- } = _ref16;
371
+ } = _ref17;
202
372
  return /*#__PURE__*/React.createElement("span", _extends({}, props, {
203
373
  className: (0, _classify.default)(_typographyModule.default.formLabelSmall, _typographyModule.default[color], className)
204
- }), children);
374
+ }), !!highlightString?.length && typeof children === 'string' ? /*#__PURE__*/React.createElement(HighlightText, {
375
+ text: children,
376
+ highlight: highlightString,
377
+ caseSensitiveHighlighting: caseSensitiveHighlighting,
378
+ highlightClassName: highlightedTextClassName,
379
+ highlightWithBackground: highlightWithBackground
380
+ }) : children);
205
381
  };
206
382
  exports.FormLabelSmall = FormLabelSmall;