playbook_ui 14.25.0.pre.alpha.PLAY2425textinputaccessibility9851 → 14.25.0.pre.alpha.PLAY2448datepickerhideLabelbugreact9924
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_date/date.test.js +506 -0
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +6 -4
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +3 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +6 -14
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.html.erb +4 -8
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +0 -5
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +1 -3
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +0 -6
- data/app/pb_kits/playbook/pb_user/docs/_user_props_table.md +14 -7
- data/dist/chunks/{_line_graph-D94iS5fa.js → _line_graph-CiVc-Cod.js} +1 -1
- data/dist/chunks/{_typeahead-Du4IsS-P.js → _typeahead-BQnvz-Ks.js} +1 -1
- data/dist/chunks/{_weekday_stacked-DEe6-ZrA.js → _weekday_stacked-B9vJT_Fw.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +2 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -6
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.md +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84d5cc641523d00d63997f981a3fc8c250d28c3186a84bb43d897d93c7758d2b
|
4
|
+
data.tar.gz: 408db4c5f5ee17a602562facef7ef532acd58f05303c72b8a5ecf487028bf1d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e790c59d1967e429f4612db5984396ac2c7113c06f716ed71c4a4b6d8e26123494b4ddfdf090ca38744227d410c22ce40ad8d7ed2b3cb4a2525707c8e3fc1d6
|
7
|
+
data.tar.gz: 366c92fdc41b21c0475acd059ac527a44101bd58676ca9917b3fd048a82e4cd935453cddddc1535d1487d3d5967d9ddbc433503ac094f49528df2d9a867fe7af
|
@@ -0,0 +1,506 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
3
|
+
import PbDate from './_date'
|
4
|
+
import DateTime from '../pb_kit/dateTime'
|
5
|
+
|
6
|
+
// Mock DateTime utility functions
|
7
|
+
jest.mock('../pb_kit/dateTime', () => ({
|
8
|
+
toWeekday: jest.fn(),
|
9
|
+
toMonth: jest.fn(),
|
10
|
+
toDay: jest.fn(),
|
11
|
+
toYear: jest.fn(),
|
12
|
+
}))
|
13
|
+
|
14
|
+
// Set test date
|
15
|
+
const TEST_DATE = new Date('2025-08-19T10:30:00Z') // Monday, August 19, 2025
|
16
|
+
const CURRENT_YEAR = new Date().getFullYear()
|
17
|
+
|
18
|
+
describe('PbDate Kit', () => {
|
19
|
+
beforeEach(() => {
|
20
|
+
// Reset mocks before each test
|
21
|
+
jest.clearAllMocks()
|
22
|
+
|
23
|
+
// Set up default mock returns
|
24
|
+
DateTime.toWeekday.mockReturnValue('Monday')
|
25
|
+
DateTime.toMonth.mockReturnValue('August')
|
26
|
+
DateTime.toDay.mockReturnValue('19')
|
27
|
+
DateTime.toYear.mockReturnValue(2025)
|
28
|
+
|
29
|
+
// Mock console.error to avoid noise in tests
|
30
|
+
jest.spyOn(console, 'error').mockImplementation(() => {})
|
31
|
+
})
|
32
|
+
|
33
|
+
afterEach(() => {
|
34
|
+
console.error.mockRestore()
|
35
|
+
})
|
36
|
+
|
37
|
+
// Default Props
|
38
|
+
describe('Default Props', () => {
|
39
|
+
test('renders with minimal required props', () => {
|
40
|
+
const testId = 'pb-date-default'
|
41
|
+
render(
|
42
|
+
<PbDate
|
43
|
+
data={{ testid: testId }}
|
44
|
+
value={TEST_DATE}
|
45
|
+
/>
|
46
|
+
)
|
47
|
+
|
48
|
+
const kit = screen.getByTestId(testId)
|
49
|
+
expect(kit).toBeInTheDocument()
|
50
|
+
expect(kit).toHaveClass('pb_date_kit_left')
|
51
|
+
})
|
52
|
+
|
53
|
+
test('displays date in default format without day of week', () => {
|
54
|
+
// Mock current year to test hiding logic
|
55
|
+
DateTime.toYear.mockReturnValue(CURRENT_YEAR)
|
56
|
+
|
57
|
+
const testId = 'pb-date-format'
|
58
|
+
render(
|
59
|
+
<PbDate
|
60
|
+
data={{ testid: testId }}
|
61
|
+
value={TEST_DATE}
|
62
|
+
/>
|
63
|
+
)
|
64
|
+
|
65
|
+
const kit = screen.getByTestId(testId)
|
66
|
+
expect(kit).toHaveTextContent('August 19')
|
67
|
+
expect(kit).not.toHaveTextContent('Monday')
|
68
|
+
expect(kit).not.toHaveTextContent(`, ${CURRENT_YEAR}`)
|
69
|
+
})
|
70
|
+
|
71
|
+
test('applies default CSS classes', () => {
|
72
|
+
const testId = 'pb-date-css'
|
73
|
+
render(
|
74
|
+
<PbDate
|
75
|
+
data={{ testid: testId }}
|
76
|
+
value={TEST_DATE}
|
77
|
+
/>
|
78
|
+
)
|
79
|
+
|
80
|
+
const kit = screen.getByTestId(testId)
|
81
|
+
expect(kit).toHaveClass('pb_date_kit_left')
|
82
|
+
})
|
83
|
+
})
|
84
|
+
|
85
|
+
// Prop Variations
|
86
|
+
describe('Prop Variations', () => {
|
87
|
+
test('renders with showDayOfWeek enabled', () => {
|
88
|
+
const testId = 'pb-date-weekday'
|
89
|
+
render(
|
90
|
+
<PbDate
|
91
|
+
data={{ testid: testId }}
|
92
|
+
showDayOfWeek
|
93
|
+
value={TEST_DATE}
|
94
|
+
/>
|
95
|
+
)
|
96
|
+
|
97
|
+
const kit = screen.getByTestId(testId)
|
98
|
+
expect(kit).toHaveTextContent('Monday')
|
99
|
+
expect(kit).toHaveTextContent('•')
|
100
|
+
expect(kit).toHaveTextContent('August 19')
|
101
|
+
})
|
102
|
+
|
103
|
+
test('renders with showCurrentYear enabled', () => {
|
104
|
+
const testId = 'pb-date-current-year'
|
105
|
+
render(
|
106
|
+
<PbDate
|
107
|
+
data={{ testid: testId }}
|
108
|
+
showCurrentYear
|
109
|
+
value={TEST_DATE}
|
110
|
+
/>
|
111
|
+
)
|
112
|
+
|
113
|
+
const kit = screen.getByTestId(testId)
|
114
|
+
expect(kit).toHaveTextContent(', 2025')
|
115
|
+
})
|
116
|
+
|
117
|
+
test('renders with showIcon enabled for medium size', () => {
|
118
|
+
const testId = 'pb-date-icon-md'
|
119
|
+
render(
|
120
|
+
<PbDate
|
121
|
+
data={{ testid: testId }}
|
122
|
+
showIcon
|
123
|
+
size="md"
|
124
|
+
value={TEST_DATE}
|
125
|
+
/>
|
126
|
+
)
|
127
|
+
|
128
|
+
const kit = screen.getByTestId(testId)
|
129
|
+
const iconContainer = kit.querySelector('.pb_icon_kit_container')
|
130
|
+
expect(iconContainer).toBeInTheDocument()
|
131
|
+
})
|
132
|
+
|
133
|
+
test('renders with showIcon enabled for small size', () => {
|
134
|
+
const testId = 'pb-date-icon-sm'
|
135
|
+
render(
|
136
|
+
<PbDate
|
137
|
+
data={{ testid: testId }}
|
138
|
+
showIcon
|
139
|
+
size="sm"
|
140
|
+
value={TEST_DATE}
|
141
|
+
/>
|
142
|
+
)
|
143
|
+
|
144
|
+
const kit = screen.getByTestId(testId)
|
145
|
+
const iconContainer = kit.querySelector('.pb_icon_kit_container')
|
146
|
+
expect(iconContainer).toBeInTheDocument()
|
147
|
+
})
|
148
|
+
|
149
|
+
test('renders different sizes correctly', () => {
|
150
|
+
const sizes = ['sm', 'md', 'lg']
|
151
|
+
|
152
|
+
sizes.forEach(size => {
|
153
|
+
const testId = `pb-date-size-${size}`
|
154
|
+
render(
|
155
|
+
<PbDate
|
156
|
+
data={{ testid: testId }}
|
157
|
+
size={size}
|
158
|
+
value={TEST_DATE}
|
159
|
+
/>
|
160
|
+
)
|
161
|
+
|
162
|
+
const kit = screen.getByTestId(testId)
|
163
|
+
expect(kit).toBeInTheDocument()
|
164
|
+
|
165
|
+
expect(kit).toHaveTextContent('August 19')
|
166
|
+
})
|
167
|
+
})
|
168
|
+
|
169
|
+
test('renders different alignments correctly', () => {
|
170
|
+
const alignments = ['left', 'center', 'right']
|
171
|
+
|
172
|
+
alignments.forEach(alignment => {
|
173
|
+
const testId = `pb-date-align-${alignment}`
|
174
|
+
render(
|
175
|
+
<PbDate
|
176
|
+
alignment={alignment}
|
177
|
+
data={{ testid: testId }}
|
178
|
+
value={TEST_DATE}
|
179
|
+
/>
|
180
|
+
)
|
181
|
+
|
182
|
+
const kit = screen.getByTestId(testId)
|
183
|
+
expect(kit).toHaveClass(`pb_date_kit_${alignment}`)
|
184
|
+
})
|
185
|
+
})
|
186
|
+
|
187
|
+
test('renders in dark mode', () => {
|
188
|
+
const testId = 'pb-date-dark'
|
189
|
+
render(
|
190
|
+
<PbDate
|
191
|
+
dark
|
192
|
+
data={{ testid: testId }}
|
193
|
+
value={TEST_DATE}
|
194
|
+
/>
|
195
|
+
)
|
196
|
+
|
197
|
+
const kit = screen.getByTestId(testId)
|
198
|
+
expect(kit).toBeInTheDocument()
|
199
|
+
})
|
200
|
+
|
201
|
+
test('renders in unstyled mode', () => {
|
202
|
+
const testId = 'pb-date-unstyled'
|
203
|
+
render(
|
204
|
+
<PbDate
|
205
|
+
data={{ testid: testId }}
|
206
|
+
showDayOfWeek
|
207
|
+
showIcon
|
208
|
+
unstyled
|
209
|
+
value={TEST_DATE}
|
210
|
+
/>
|
211
|
+
)
|
212
|
+
|
213
|
+
const kit = screen.getByTestId(testId)
|
214
|
+
expect(kit).toHaveTextContent('Monday')
|
215
|
+
expect(kit).toHaveTextContent('•')
|
216
|
+
expect(kit).toHaveTextContent('August 19')
|
217
|
+
|
218
|
+
expect(kit.querySelector('.pb_title_kit')).not.toBeInTheDocument()
|
219
|
+
expect(kit.querySelector('.pb_caption_kit')).not.toBeInTheDocument()
|
220
|
+
})
|
221
|
+
|
222
|
+
test('applies custom className', () => {
|
223
|
+
const testId = 'pb-date-custom-class'
|
224
|
+
const customClass = 'my-custom-date-class'
|
225
|
+
|
226
|
+
render(
|
227
|
+
<PbDate
|
228
|
+
className={customClass}
|
229
|
+
data={{ testid: testId }}
|
230
|
+
value={TEST_DATE}
|
231
|
+
/>
|
232
|
+
)
|
233
|
+
|
234
|
+
const kit = screen.getByTestId(testId)
|
235
|
+
expect(kit).toHaveClass(customClass)
|
236
|
+
})
|
237
|
+
|
238
|
+
test('applies custom id', () => {
|
239
|
+
const customId = 'my-custom-date-id'
|
240
|
+
|
241
|
+
render(
|
242
|
+
<PbDate
|
243
|
+
id={customId}
|
244
|
+
value={TEST_DATE}
|
245
|
+
/>
|
246
|
+
)
|
247
|
+
|
248
|
+
const kit = document.getElementById(customId)
|
249
|
+
expect(kit).toBeInTheDocument()
|
250
|
+
expect(kit).toHaveAttribute('id', customId)
|
251
|
+
})
|
252
|
+
})
|
253
|
+
|
254
|
+
// Year Display
|
255
|
+
describe('Year Display Logic', () => {
|
256
|
+
test('hides current year by default', () => {
|
257
|
+
DateTime.toYear.mockReturnValue(CURRENT_YEAR)
|
258
|
+
|
259
|
+
const testId = 'pb-date-current-year-hidden'
|
260
|
+
render(
|
261
|
+
<PbDate
|
262
|
+
data={{ testid: testId }}
|
263
|
+
value={TEST_DATE}
|
264
|
+
/>
|
265
|
+
)
|
266
|
+
|
267
|
+
const kit = screen.getByTestId(testId)
|
268
|
+
expect(kit).not.toHaveTextContent(`, ${CURRENT_YEAR}`)
|
269
|
+
})
|
270
|
+
|
271
|
+
test('shows current year when showCurrentYear is true', () => {
|
272
|
+
DateTime.toYear.mockReturnValue(CURRENT_YEAR)
|
273
|
+
|
274
|
+
const testId = 'pb-date-force-current-year'
|
275
|
+
render(
|
276
|
+
<PbDate
|
277
|
+
data={{ testid: testId }}
|
278
|
+
showCurrentYear
|
279
|
+
value={TEST_DATE}
|
280
|
+
/>
|
281
|
+
)
|
282
|
+
|
283
|
+
const kit = screen.getByTestId(testId)
|
284
|
+
expect(kit).toHaveTextContent(`, ${CURRENT_YEAR}`)
|
285
|
+
})
|
286
|
+
|
287
|
+
test('shows non-current year automatically', () => {
|
288
|
+
const pastYear = CURRENT_YEAR - 1
|
289
|
+
DateTime.toYear.mockReturnValue(pastYear)
|
290
|
+
|
291
|
+
const testId = 'pb-date-past-year'
|
292
|
+
render(
|
293
|
+
<PbDate
|
294
|
+
data={{ testid: testId }}
|
295
|
+
value={TEST_DATE}
|
296
|
+
/>
|
297
|
+
)
|
298
|
+
|
299
|
+
const kit = screen.getByTestId(testId)
|
300
|
+
expect(kit).toHaveTextContent(`, ${pastYear}`)
|
301
|
+
})
|
302
|
+
|
303
|
+
test('shows future year automatically', () => {
|
304
|
+
const futureYear = CURRENT_YEAR + 1
|
305
|
+
DateTime.toYear.mockReturnValue(futureYear)
|
306
|
+
|
307
|
+
const testId = 'pb-date-future-year'
|
308
|
+
render(
|
309
|
+
<PbDate
|
310
|
+
data={{ testid: testId }}
|
311
|
+
value={TEST_DATE}
|
312
|
+
/>
|
313
|
+
)
|
314
|
+
|
315
|
+
const kit = screen.getByTestId(testId)
|
316
|
+
expect(kit).toHaveTextContent(`, ${futureYear}`)
|
317
|
+
})
|
318
|
+
})
|
319
|
+
|
320
|
+
// Edge Cases
|
321
|
+
describe('Edge Cases', () => {
|
322
|
+
test('handles leap year date', () => {
|
323
|
+
const leapYearDate = new Date('2024-02-29T12:00:00Z')
|
324
|
+
DateTime.toMonth.mockReturnValue('February')
|
325
|
+
DateTime.toDay.mockReturnValue('29')
|
326
|
+
DateTime.toYear.mockReturnValue(2024)
|
327
|
+
DateTime.toWeekday.mockReturnValue('Thursday')
|
328
|
+
|
329
|
+
const testId = 'pb-date-leap-year'
|
330
|
+
render(
|
331
|
+
<PbDate
|
332
|
+
data={{ testid: testId }}
|
333
|
+
value={leapYearDate}
|
334
|
+
/>
|
335
|
+
)
|
336
|
+
|
337
|
+
const kit = screen.getByTestId(testId)
|
338
|
+
expect(kit).toHaveTextContent('February 29')
|
339
|
+
})
|
340
|
+
|
341
|
+
test('handles beginning of year', () => {
|
342
|
+
const newYearDate = new Date('2023-01-01T00:00:00Z')
|
343
|
+
DateTime.toMonth.mockReturnValue('January')
|
344
|
+
DateTime.toDay.mockReturnValue('1')
|
345
|
+
DateTime.toYear.mockReturnValue(2023)
|
346
|
+
DateTime.toWeekday.mockReturnValue('Sunday')
|
347
|
+
|
348
|
+
const testId = 'pb-date-new-year'
|
349
|
+
render(
|
350
|
+
<PbDate
|
351
|
+
data={{ testid: testId }}
|
352
|
+
value={newYearDate}
|
353
|
+
/>
|
354
|
+
)
|
355
|
+
|
356
|
+
const kit = screen.getByTestId(testId)
|
357
|
+
expect(kit).toHaveTextContent('January 1')
|
358
|
+
})
|
359
|
+
|
360
|
+
test('handles end of year', () => {
|
361
|
+
const endYearDate = new Date('2023-12-31T23:59:59Z')
|
362
|
+
DateTime.toMonth.mockReturnValue('December')
|
363
|
+
DateTime.toDay.mockReturnValue('31')
|
364
|
+
DateTime.toYear.mockReturnValue(2023)
|
365
|
+
DateTime.toWeekday.mockReturnValue('Sunday')
|
366
|
+
|
367
|
+
const testId = 'pb-date-end-year'
|
368
|
+
render(
|
369
|
+
<PbDate
|
370
|
+
data={{ testid: testId }}
|
371
|
+
value={endYearDate}
|
372
|
+
/>
|
373
|
+
)
|
374
|
+
|
375
|
+
const kit = screen.getByTestId(testId)
|
376
|
+
expect(kit).toHaveTextContent('December 31')
|
377
|
+
})
|
378
|
+
|
379
|
+
test('handles very old date', () => {
|
380
|
+
const oldDate = new Date('1900-01-01T00:00:00Z')
|
381
|
+
DateTime.toMonth.mockReturnValue('January')
|
382
|
+
DateTime.toDay.mockReturnValue('1')
|
383
|
+
DateTime.toYear.mockReturnValue(1900)
|
384
|
+
DateTime.toWeekday.mockReturnValue('Monday')
|
385
|
+
|
386
|
+
const testId = 'pb-date-old'
|
387
|
+
render(
|
388
|
+
<PbDate
|
389
|
+
data={{ testid: testId }}
|
390
|
+
value={oldDate}
|
391
|
+
/>
|
392
|
+
)
|
393
|
+
|
394
|
+
const kit = screen.getByTestId(testId)
|
395
|
+
expect(kit).toHaveTextContent('January 1')
|
396
|
+
expect(kit).toHaveTextContent(', 1900')
|
397
|
+
})
|
398
|
+
|
399
|
+
test('handles far future date', () => {
|
400
|
+
const futureDate = new Date('2099-12-31T23:59:59Z')
|
401
|
+
DateTime.toMonth.mockReturnValue('December')
|
402
|
+
DateTime.toDay.mockReturnValue('31')
|
403
|
+
DateTime.toYear.mockReturnValue(2099)
|
404
|
+
DateTime.toWeekday.mockReturnValue('Friday')
|
405
|
+
|
406
|
+
const testId = 'pb-date-future'
|
407
|
+
render(
|
408
|
+
<PbDate
|
409
|
+
data={{ testid: testId }}
|
410
|
+
value={futureDate}
|
411
|
+
/>
|
412
|
+
)
|
413
|
+
|
414
|
+
const kit = screen.getByTestId(testId)
|
415
|
+
expect(kit).toHaveTextContent('December 31')
|
416
|
+
expect(kit).toHaveTextContent(', 2099')
|
417
|
+
})
|
418
|
+
})
|
419
|
+
|
420
|
+
// Accessibility and HTML
|
421
|
+
describe('Accessibility and HTML Attributes', () => {
|
422
|
+
test('applies aria attributes correctly', () => {
|
423
|
+
const testId = 'pb-date-aria'
|
424
|
+
const ariaLabel = 'Custom date label'
|
425
|
+
|
426
|
+
render(
|
427
|
+
<PbDate
|
428
|
+
aria={{ label: ariaLabel }}
|
429
|
+
data={{ testid: testId }}
|
430
|
+
value={TEST_DATE}
|
431
|
+
/>
|
432
|
+
)
|
433
|
+
|
434
|
+
const kit = screen.getByTestId(testId)
|
435
|
+
expect(kit).toHaveAttribute('aria-label', ariaLabel)
|
436
|
+
})
|
437
|
+
|
438
|
+
test('applies data attributes correctly', () => {
|
439
|
+
const testId = 'pb-date-data'
|
440
|
+
const customData = 'custom-value'
|
441
|
+
|
442
|
+
render(
|
443
|
+
<PbDate
|
444
|
+
data={{ testid: testId, custom: customData }}
|
445
|
+
value={TEST_DATE}
|
446
|
+
/>
|
447
|
+
)
|
448
|
+
|
449
|
+
const kit = screen.getByTestId(testId)
|
450
|
+
expect(kit).toHaveAttribute('data-custom', customData)
|
451
|
+
})
|
452
|
+
|
453
|
+
test('applies HTML options correctly', () => {
|
454
|
+
const testId = 'pb-date-html'
|
455
|
+
const title = 'Custom title'
|
456
|
+
|
457
|
+
render(
|
458
|
+
<PbDate
|
459
|
+
data={{ testid: testId }}
|
460
|
+
htmlOptions={{ title }}
|
461
|
+
value={TEST_DATE}
|
462
|
+
/>
|
463
|
+
)
|
464
|
+
|
465
|
+
const kit = screen.getByTestId(testId)
|
466
|
+
expect(kit).toHaveAttribute('title', title)
|
467
|
+
})
|
468
|
+
})
|
469
|
+
|
470
|
+
// Componenet Integration
|
471
|
+
describe('Component Integration', () => {
|
472
|
+
test('calls DateTime utility functions correctly', () => {
|
473
|
+
render(
|
474
|
+
<PbDate value={TEST_DATE} />
|
475
|
+
)
|
476
|
+
|
477
|
+
expect(DateTime.toWeekday).toHaveBeenCalledWith(TEST_DATE)
|
478
|
+
expect(DateTime.toMonth).toHaveBeenCalledWith(TEST_DATE)
|
479
|
+
expect(DateTime.toDay).toHaveBeenCalledWith(TEST_DATE)
|
480
|
+
expect(DateTime.toYear).toHaveBeenCalledWith(TEST_DATE)
|
481
|
+
})
|
482
|
+
|
483
|
+
test('renders all components together correctly', () => {
|
484
|
+
const testId = 'pb-date-full-featured'
|
485
|
+
render(
|
486
|
+
<PbDate
|
487
|
+
alignment="center"
|
488
|
+
data={{ testid: testId }}
|
489
|
+
showDayOfWeek
|
490
|
+
showIcon
|
491
|
+
size="lg"
|
492
|
+
value={TEST_DATE}
|
493
|
+
/>
|
494
|
+
)
|
495
|
+
|
496
|
+
const kit = screen.getByTestId(testId)
|
497
|
+
expect(kit).toHaveClass('pb_date_kit_center')
|
498
|
+
expect(kit).toHaveTextContent('Monday')
|
499
|
+
expect(kit).toHaveTextContent('•')
|
500
|
+
expect(kit).toHaveTextContent('August 19')
|
501
|
+
|
502
|
+
const iconContainer = kit.querySelector('.pb_icon_kit_container')
|
503
|
+
expect(iconContainer).toBeInTheDocument()
|
504
|
+
})
|
505
|
+
})
|
506
|
+
})
|
@@ -210,10 +210,12 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
210
210
|
className="input_wrapper"
|
211
211
|
>
|
212
212
|
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
213
|
+
{!hideLabel && (
|
214
|
+
<Caption
|
215
|
+
className="pb_date_picker_kit_label"
|
216
|
+
text={label}
|
217
|
+
/>
|
218
|
+
)}
|
217
219
|
<>
|
218
220
|
<div className="date_picker_input_wrapper">
|
219
221
|
<input
|
data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
| Name | Type | Description | Default | Values |
|
3
3
|
| --- | ----------- | --------- | --------- | --------- |
|
4
4
|
| **text** | `String` |`Value for the toast message` | `nil` | |
|
5
|
-
| **
|
6
|
-
`
|
5
|
+
| **font** | `PBFont` |`Value for the toast message font style` | `.title4` | |
|
6
|
+
| **animatedIcon** | `AnyView` |`Value for the option to use an animated icon` | `nil` | |
|
7
|
+
| **variant** | `Variant` | `Determines the type pf toast message being displayed` | `.custom()` | `error` `success` `neutral` `custom()` |
|
7
8
|
| **actionView** | `dismissAction` | Dismisses the toast message | `.default` | `default` `custom()` `withTimer()` |
|
8
9
|
| **dismissAction** | `(() -> Void)` | `Triggers the dismiss action` | | |
|
@@ -138,14 +138,10 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
138
138
|
formattedValue = value
|
139
139
|
}
|
140
140
|
|
141
|
-
const errorId = error ? `${id}-error` : undefined
|
142
|
-
|
143
141
|
const textInput = (
|
144
142
|
childInput ? React.cloneElement(children, { className: "text_input" }) :
|
145
143
|
(<input
|
146
144
|
{...domSafeProps(props)}
|
147
|
-
aria-describedby={errorId}
|
148
|
-
aria-invalid={!!error}
|
149
145
|
className="text_input"
|
150
146
|
disabled={disabled}
|
151
147
|
id={id}
|
@@ -203,20 +199,16 @@ const TextInput = (props: TextInputProps, ref: React.LegacyRef<HTMLInputElement>
|
|
203
199
|
{...htmlProps}
|
204
200
|
className={css}
|
205
201
|
>
|
206
|
-
{label &&
|
207
|
-
<
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
)}
|
202
|
+
{label &&
|
203
|
+
<Caption
|
204
|
+
className="pb_text_input_kit_label"
|
205
|
+
text={label}
|
206
|
+
/>
|
207
|
+
}
|
213
208
|
<div className={`${addOnCss} text_input_wrapper`}>
|
214
209
|
{render}
|
215
210
|
|
216
211
|
{error && <Body
|
217
|
-
aria={{ atomic: "true", live: "polite" }}
|
218
|
-
htmlOptions={{ role: "alert" }}
|
219
|
-
id={errorId}
|
220
212
|
status="negative"
|
221
213
|
text={error}
|
222
214
|
variant={null}
|
@@ -9,27 +9,23 @@
|
|
9
9
|
|
10
10
|
<%= pb_rails("text_input", props: {
|
11
11
|
label: "Last Name",
|
12
|
-
placeholder: "Enter last name"
|
13
|
-
id: "last-name"
|
12
|
+
placeholder: "Enter last name"
|
14
13
|
}) %>
|
15
14
|
|
16
15
|
<%= pb_rails("text_input", props: {
|
17
16
|
label: "Phone Number",
|
18
17
|
type: "phone",
|
19
|
-
placeholder: "Enter phone number"
|
20
|
-
id: "phone"
|
18
|
+
placeholder: "Enter phone number"
|
21
19
|
}) %>
|
22
20
|
|
23
21
|
<%= pb_rails("text_input", props: {
|
24
22
|
label: "Email Address",
|
25
23
|
type: "email",
|
26
|
-
placeholder: "Enter email address"
|
27
|
-
id: "email"
|
24
|
+
placeholder: "Enter email address"
|
28
25
|
}) %>
|
29
26
|
|
30
27
|
<%= pb_rails("text_input", props: {
|
31
28
|
label: "Zip Code",
|
32
29
|
type: "number",
|
33
|
-
placeholder: "Enter zip code"
|
34
|
-
id: "zip"
|
30
|
+
placeholder: "Enter zip code"
|
35
31
|
}) %>
|
@@ -38,7 +38,6 @@ const TextInputDefault = (props) => {
|
|
38
38
|
{...props}
|
39
39
|
/>
|
40
40
|
<TextInput
|
41
|
-
id="last-name"
|
42
41
|
label="Last Name"
|
43
42
|
name="lastName"
|
44
43
|
onChange={handleOnChangeFormField}
|
@@ -47,7 +46,6 @@ const TextInputDefault = (props) => {
|
|
47
46
|
{...props}
|
48
47
|
/>
|
49
48
|
<TextInput
|
50
|
-
id="phone"
|
51
49
|
label="Phone Number"
|
52
50
|
name="phone"
|
53
51
|
onChange={handleOnChangeFormField}
|
@@ -57,7 +55,6 @@ const TextInputDefault = (props) => {
|
|
57
55
|
{...props}
|
58
56
|
/>
|
59
57
|
<TextInput
|
60
|
-
id="email"
|
61
58
|
label="Email Address"
|
62
59
|
name="email"
|
63
60
|
onChange={handleOnChangeFormField}
|
@@ -67,7 +64,6 @@ const TextInputDefault = (props) => {
|
|
67
64
|
{...props}
|
68
65
|
/>
|
69
66
|
<TextInput
|
70
|
-
id="zip"
|
71
67
|
label="Zip Code"
|
72
68
|
name="zip"
|
73
69
|
onChange={handleOnChangeFormField}
|
@@ -88,7 +84,6 @@ const TextInputDefault = (props) => {
|
|
88
84
|
<br />
|
89
85
|
|
90
86
|
<TextInput
|
91
|
-
id="first-name"
|
92
87
|
label="First Name"
|
93
88
|
onChange={handleOnChangeFirstName}
|
94
89
|
placeholder="Enter first name"
|
@@ -1,8 +1,6 @@
|
|
1
1
|
<%= pb_content_tag(:div, id: nil ) do %>
|
2
2
|
<% if object.label.present? %>
|
3
|
-
<label for="<%= object.input_options[:id] || object.id %>" >
|
4
3
|
<%= pb_rails("caption", props: { text: object.label, dark: object.dark, classname: "pb_text_input_kit_label" }) %>
|
5
|
-
</label>
|
6
4
|
<% end %>
|
7
5
|
<%= content_tag(:div, class: "#{add_on_class} text_input_wrapper") do %>
|
8
6
|
<% if content.present? %>
|
@@ -17,7 +15,7 @@
|
|
17
15
|
<% else %>
|
18
16
|
<%= input_tag %>
|
19
17
|
<% end %>
|
20
|
-
<%= pb_rails("body", props: {dark: object.dark, status: "negative", text: object.error
|
18
|
+
<%= pb_rails("body", props: {dark: object.dark, status: "negative", text: object.error}) if object.error %>
|
21
19
|
<% end %>
|
22
20
|
<% end %>
|
23
21
|
|
@@ -65,16 +65,10 @@ module Playbook
|
|
65
65
|
"#{object.id}-sanitized" if id.present?
|
66
66
|
end
|
67
67
|
|
68
|
-
def error_id
|
69
|
-
"#{id}-error" if error.present?
|
70
|
-
end
|
71
|
-
|
72
68
|
private
|
73
69
|
|
74
70
|
def all_input_options
|
75
71
|
{
|
76
|
-
'aria-describedby': error.present? ? error_id : nil,
|
77
|
-
'aria-invalid': error.present?,
|
78
72
|
autocomplete: autocomplete ? nil : "off",
|
79
73
|
class: "text_input #{input_options.dig(:classname) || ''}",
|
80
74
|
data: validation_data,
|