playbook_ui 12.38.0.pre.alpha.PBNTR78selectkitmultipleprop1094 → 12.38.0.pre.alpha.PLAY932removemomentqp1088

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db3404c038f74f5dc80f8ac748ec308d00cb5608d770d128a913c002779eff95
4
- data.tar.gz: 52184a80d6d7f1c60a26602b0df4c67add01871f8b2a68a96f486ab45f6bd356
3
+ metadata.gz: e1acc22a656ca63996a3b72d620ec59eb2fd323be9c3d6672449495c8c6781e3
4
+ data.tar.gz: 9029b42a09b0db1639360ae2addb2f6f35fd9ec488af53d829dd241e88cce167
5
5
  SHA512:
6
- metadata.gz: c94c56cb47932177e285f3d6f81778c6ce490f50f4a47d1efc51aa99c48f047f97dc6db289041cf5d6fedb5a815d7980bc530df015bede6bbc965c57fe0e8dfc
7
- data.tar.gz: 2fe8f9b14b8e5ac44cbab98f38625f71cce0fb8f580108cbb439c024b4dad0541a6662fb3e77df798fa88ff6a689ed68de89ddb4c95139d834f5da10a14b2ffb
6
+ metadata.gz: faf876a9e1a26091d6cc292382e99220ca51b8937616cf96d793dbf886572daff5dc7a65bb4ce9c8d2e4c53dc2674acc61dc6e03a2e41db70e1ee2868f9f2a39
7
+ data.tar.gz: a5c43e9e88c057548d4bc656352ae3a4fa92f6d8119ff6c339933d25e0baea9aa39e45888826a720489b1b3a38efb82823e01d94130301b09c27d7eb10c90013
@@ -1,16 +1,26 @@
1
1
  /* eslint-disable no-console */
2
2
  import React from 'react'
3
- import moment from 'moment'
4
3
  import { fireEvent, render, screen, waitFor, within } from '../utilities/test-utils'
5
4
 
6
5
  import DatePicker from './_date_picker'
6
+ import DateTime from "../pb_kit/dateTime.ts"
7
7
  import { getTimezoneText } from './plugins/timeSelect'
8
8
 
9
-
10
-
11
9
  jest.setSystemTime(new Date('01/01/2020'));
12
10
  const DEFAULT_DATE = new Date()
13
11
 
12
+ const formatDate = (date) => {
13
+ const month = (date.getMonth() + 1).toString().padStart(2, "0")
14
+ const day = (date.getDate()).toString().padStart(2, "0")
15
+ const year = date.getFullYear()
16
+
17
+ return `${month}/${day}/${year}`
18
+ }
19
+
20
+ Date.prototype.formatDate = function () {
21
+ return formatDate(this)
22
+ }
23
+
14
24
  describe('DatePicker Kit', () => {
15
25
  beforeEach(() => {
16
26
  jest.spyOn(console, 'error').mockImplementation(() => { });
@@ -158,6 +168,7 @@ describe('DatePicker Kit', () => {
158
168
  expect(input).toHaveValue('01/01/2020 at 12:00 PM')
159
169
  })
160
170
  })
171
+
161
172
  test('shows DatePicker QuickPick dropdown and adds correct date to input', async () => {
162
173
  const testId = 'datepicker-quick-pick'
163
174
  render(
@@ -197,10 +208,10 @@ describe('DatePicker Kit', () => {
197
208
  )
198
209
 
199
210
  await waitFor(() => {
200
- expect(input).toHaveValue(moment().startOf('year').format('MM/DD/YYYY') + " to " + moment().endOf('year').format('MM/DD/YYYY'))
211
+ expect(input).toHaveValue(DateTime.getYearStartDate(new Date()).formatDate() + " to " + DateTime.getYearEndDate(new Date()).formatDate())
201
212
  })
202
-
203
213
  })
214
+
204
215
  test('shows DatePicker QuickPick ranges ending today', async () => {
205
216
  const testId = 'datepicker-quick-pick-ends-today'
206
217
  render(
@@ -225,7 +236,7 @@ describe('DatePicker Kit', () => {
225
236
  cancelable: true,
226
237
  }),
227
238
  )
228
-
239
+
229
240
  const thisYear = within(kit).getByText('This year')
230
241
 
231
242
  fireEvent(
@@ -237,8 +248,7 @@ describe('DatePicker Kit', () => {
237
248
  )
238
249
 
239
250
  await waitFor(() => {
240
- expect(input).toHaveValue(moment().startOf('year').format('MM/DD/YYYY') + " to " + moment().format('MM/DD/YYYY'))
251
+ expect(input).toHaveValue(DateTime.getYearStartDate(new Date()).formatDate() + " to " + new Date().formatDate())
241
252
  })
242
-
243
253
  })
244
254
  })
@@ -1,4 +1,4 @@
1
- import moment from 'moment'
1
+ import DateTime from '../../pb_kit/dateTime';
2
2
 
3
3
  type FpTypes = {
4
4
  setDate: (arg0: any, arg1: boolean) => void,
@@ -23,37 +23,44 @@ let activeLabel = ""
23
23
 
24
24
  const quickPickPlugin = (thisRangesEndToday: boolean) => {
25
25
  return function (fp: FpTypes & any): any {
26
- const thisWeekEndDate = thisRangesEndToday ? new Date() : moment().endOf('isoWeek').toDate()
27
- const thisMonthEndDate = thisRangesEndToday ? new Date() : moment().endOf('month').toDate()
28
- const thisQuarterEndDate = thisRangesEndToday ? new Date() : moment().endOf('quarter').toDate()
29
- const thisYearEndDate = thisRangesEndToday ? new Date() : moment().endOf('year').toDate()
26
+ const today = new Date()
27
+ const yesterday = DateTime.getYesterdayDate(new Date())
28
+
29
+ const thisWeekStartDate = DateTime.getFirstDayOfWeek(new Date())
30
+ const thisWeekEndDate = thisRangesEndToday ? new Date() : DateTime.getLastDayOfWeek(new Date())
31
+ const lastWeekStartDate = DateTime.getPreviousWeekStartDate(new Date())
32
+ const lastWeekEndDate = DateTime.getPreviousWeekEndDate(new Date())
33
+
34
+ const thisMonthStartDate = DateTime.getMonthStartDate(new Date())
35
+ const thisMonthEndDate = thisRangesEndToday ? new Date() : DateTime.getMonthEndDate(new Date())
36
+ const lastMonthStartDate = DateTime.getPreviousMonthStartDate(new Date())
37
+ const lastMonthEndDate = DateTime.getPreviousMonthEndDate(new Date())
38
+
39
+ const thisQuarterStartDate = DateTime.getQuarterStartDate(new Date())
40
+ const thisQuarterEndDate = thisRangesEndToday ? new Date() : DateTime.getQuarterEndDate(new Date())
41
+ const lastQuarterStartDate = DateTime.getPreviousQuarterStartDate(new Date())
42
+ const lastQuarterEndDate = DateTime.getPreviousQuarterEndDate(new Date())
43
+
44
+ const thisYearStartDate = DateTime.getYearStartDate(new Date())
45
+ const thisYearEndDate = thisRangesEndToday ? new Date() : DateTime.getYearEndDate(new Date())
46
+ const lastYearStartDate = DateTime.getPreviousYearStartDate(new Date())
47
+ const lastYearEndDate = DateTime.getPreviousYearEndDate(new Date())
30
48
 
31
49
  // variable that holds the ranges available
32
50
  const ranges = {
33
- 'Today': [new Date(), new Date()],
34
- 'Yesterday': [moment().subtract(1, 'days').toDate(), moment().subtract(1, 'days').toDate()],
35
- 'This week': [moment().startOf('isoWeek').toDate(), thisWeekEndDate],
36
- 'This month': [moment().startOf('month').toDate(), thisMonthEndDate],
37
- 'This quarter': [moment().startOf('quarter').toDate(), thisQuarterEndDate],
38
- 'This year': [moment().startOf('year').toDate(), thisYearEndDate],
39
- 'Last week': [
40
- moment().subtract(1, 'week').startOf('isoWeek').toDate(),
41
- moment().subtract(1, 'week').endOf('isoWeek').toDate()
42
- ],
43
- 'Last month': [
44
- moment().subtract(1, 'month').startOf('month').toDate(),
45
- moment().subtract(1, 'month').endOf('month').toDate()
46
- ],
47
- 'Last quarter': [
48
- moment().subtract(1, 'quarter').startOf('quarter').toDate(),
49
- moment().subtract(1, 'quarter').endOf('quarter').toDate()
50
- ],
51
- 'Last year': [
52
- moment().subtract(1, 'year').startOf('year').toDate(),
53
- moment().subtract(1, 'year').endOf('year').toDate()
54
- ]
51
+ 'Today': [today, today],
52
+ 'Yesterday': [yesterday, yesterday],
53
+ 'This week': [thisWeekStartDate, thisWeekEndDate],
54
+ 'This month': [thisMonthStartDate, thisMonthEndDate],
55
+ 'This quarter': [thisQuarterStartDate, thisQuarterEndDate],
56
+ 'This year': [thisYearStartDate, thisYearEndDate],
57
+ 'Last week': [lastWeekStartDate, lastWeekEndDate],
58
+ 'Last month': [lastMonthStartDate, lastMonthEndDate],
59
+ 'Last quarter': [lastQuarterStartDate, lastQuarterEndDate],
60
+ 'Last year': [lastYearStartDate, lastYearEndDate]
55
61
  }
56
- //creating the ul element for the nav dropdown and giving it classnames
62
+
63
+ // creating the ul element for the nav dropdown and giving it classnames
57
64
  const rangesNav = document.createElement('ul');
58
65
 
59
66
  // creating the pluginData object that will hold the properties of this plugin
@@ -64,11 +71,11 @@ const quickPickPlugin = (thisRangesEndToday: boolean) => {
64
71
  };
65
72
 
66
73
  /**
67
- * @param {string} label
68
- * @returns HTML Element
69
- */
74
+ * @param {string} label
75
+ * @returns HTML Element
76
+ */
70
77
 
71
- //function for creating the range buttons in the nav
78
+ // function for creating the range buttons in the nav
72
79
  const addRangeButton = (label: string) => {
73
80
 
74
81
  // creating new elements to mimick selectable card component
@@ -88,7 +95,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean) => {
88
95
  // append the li item to the ul rangeNav prop
89
96
  pluginData.rangesNav.appendChild(item);
90
97
 
91
- // return the ranges buton prop
98
+ // return the ranges button prop
92
99
  return pluginData.rangesButtons[label];
93
100
  };
94
101
 
@@ -98,7 +105,7 @@ const quickPickPlugin = (thisRangesEndToday: boolean) => {
98
105
  if (current) {
99
106
  current.classList.remove('active');
100
107
  }
101
-
108
+
102
109
  if (selectedDates.length > 0 && activeLabel) {
103
110
  pluginData.rangesButtons[activeLabel].classList.add('active');
104
111
  }
@@ -109,16 +116,15 @@ const quickPickPlugin = (thisRangesEndToday: boolean) => {
109
116
  selectedDates[1].toDateString() === pluginData.ranges[activeLabel][1].toDateString()
110
117
  }
111
118
 
112
-
113
119
  return {
114
- // onReady is a hook from flatpickr that runs when calender is in a ready state
120
+ // onReady is a hook from flatpickr that runs when calendar is in a ready state
115
121
  onReady(selectedDates: Array<Date>) {
116
122
  // loop through the ranges and create an anchor tag for each range and add an event listener to set the date when user clicks on a date range
117
123
  for (const [label, range] of Object.entries(pluginData.ranges)) {
118
124
  addRangeButton(label).addEventListener('click', function () {
119
125
 
120
- const start = moment(range[0]).toDate();
121
- const end = moment(range[1]).toDate();
126
+ const start = new Date(range[0]);
127
+ const end = new Date(range[1]);
122
128
 
123
129
  if (!start) {
124
130
  fp.clear();
@@ -170,4 +176,4 @@ const quickPickPlugin = (thisRangesEndToday: boolean) => {
170
176
  };
171
177
  }
172
178
 
173
- export default quickPickPlugin;
179
+ export default quickPickPlugin;
@@ -116,7 +116,6 @@ export const toIso = (newDate: Date | string): string => {
116
116
  }
117
117
 
118
118
  export const fromNow = (newDate: Date | string): string => {
119
-
120
119
  const startDate = formatDate(newDate).getTime()
121
120
  const endDate = new Date().getTime()
122
121
  const elapsedTime = endDate - startDate
@@ -154,6 +153,193 @@ export const toCustomFormat = (newDate: Date | string, format = 'month_day'): st
154
153
  }
155
154
  }
156
155
 
156
+ // For quickPick.tsx
157
+ // Yesterday
158
+ export const getYesterdayDate = (newDate: Date | string): Date => {
159
+ const today = formatDate(newDate)
160
+ const yesterday = new Date()
161
+ yesterday.setDate(today.getDate() - 1)
162
+
163
+ return yesterday
164
+ }
165
+
166
+ // Weeks
167
+ export const getFirstDayOfWeek = (newDate: Date | string): Date => {
168
+ const today = formatDate(newDate)
169
+ const dayOfWeek = today.getDay()
170
+ // Replicate Moment.js: Start of week (Monday) has a time of 00:00:00
171
+ const firstDayOfWeek = new Date(today.setHours(0, 0, 0))
172
+ const isSunday = dayOfWeek === 0
173
+
174
+ const daysToSubtract = isSunday ? 6 : (dayOfWeek - 1)
175
+ firstDayOfWeek.setDate(today.getDate() - daysToSubtract)
176
+
177
+ return firstDayOfWeek
178
+ }
179
+
180
+ export const getLastDayOfWeek = (newDate: Date | string): Date => {
181
+ const today = formatDate(newDate)
182
+ const dayOfWeek = today.getDay()
183
+ // Replicate Moment.js: End of week (Sunday) has a time of 23:59:59
184
+ const lastDayOfWeek = new Date(today.setHours(23, 59, 59, 0))
185
+ const isSunday = dayOfWeek === 0
186
+
187
+ const daysToAdd = isSunday ? 0 : (7 - dayOfWeek)
188
+ lastDayOfWeek.setDate(today.getDate() + daysToAdd)
189
+
190
+ return lastDayOfWeek
191
+ }
192
+
193
+ export const getPreviousWeekStartDate = (newDate: Date | string): Date => {
194
+ const firstDayOfWeek = getFirstDayOfWeek(newDate)
195
+ const firstDayOfPreviousWeek = new Date(
196
+ firstDayOfWeek.getFullYear(),
197
+ firstDayOfWeek.getMonth(),
198
+ firstDayOfWeek.getDate() - 7
199
+ )
200
+
201
+ return firstDayOfPreviousWeek
202
+ }
203
+
204
+ export const getPreviousWeekEndDate = (newDate: Date | string): Date => {
205
+ const lastDayOfWeek = getLastDayOfWeek(newDate)
206
+ const lastDayOfPreviousWeek = new Date(
207
+ lastDayOfWeek.getFullYear(),
208
+ lastDayOfWeek.getMonth(),
209
+ lastDayOfWeek.getDate() - 7,
210
+ lastDayOfWeek.getHours(),
211
+ lastDayOfWeek.getMinutes(),
212
+ lastDayOfWeek.getSeconds()
213
+ )
214
+
215
+ return lastDayOfPreviousWeek
216
+ }
217
+
218
+ // Months
219
+ export const getMonthStartDate = (newDate: Date | string): Date => {
220
+ const date = formatDate(newDate)
221
+ const firstDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1)
222
+
223
+ return firstDayOfMonth
224
+ }
225
+
226
+ export const getMonthEndDate = (newDate: Date | string): Date => {
227
+ const date = formatDate(newDate)
228
+ // Replicate Moment.js: End of month has a time of 23:59:59
229
+ const lastDayOfMonth = new Date(date.getFullYear(), date.getMonth() + 1, 0, 23, 59, 59)
230
+
231
+ return lastDayOfMonth
232
+ }
233
+
234
+ export const getPreviousMonthStartDate = (newDate: Date | string): Date => {
235
+ const firstDayOfMonth = getMonthStartDate(newDate)
236
+ const firstDayOfPreviousMonth = new Date(
237
+ firstDayOfMonth.getFullYear(),
238
+ firstDayOfMonth.getMonth() - 1,
239
+ firstDayOfMonth.getDate()
240
+ )
241
+
242
+ return firstDayOfPreviousMonth
243
+ }
244
+
245
+ export const getPreviousMonthEndDate = (newDate: Date | string): Date => {
246
+ const lastDayOfMonth = getMonthEndDate(newDate)
247
+ const lastDayOfPreviousMonth = new Date(
248
+ lastDayOfMonth.getFullYear(),
249
+ lastDayOfMonth.getMonth() - 1,
250
+ lastDayOfMonth.getDate(),
251
+ lastDayOfMonth.getHours(),
252
+ lastDayOfMonth.getMinutes(),
253
+ lastDayOfMonth.getSeconds()
254
+ )
255
+
256
+ return lastDayOfPreviousMonth
257
+ }
258
+
259
+ // Quarters
260
+ export const getQuarterStartDate = (newDate: Date | string): Date => {
261
+ const date = formatDate(newDate)
262
+ const quarter = Math.floor(date.getMonth() / 3)
263
+ const startOfQuarter = new Date(date.getFullYear(), quarter * 3, 1)
264
+
265
+ return startOfQuarter
266
+ }
267
+
268
+ export const getQuarterEndDate = (newDate: Date | string): Date => {
269
+ const date = formatDate(newDate)
270
+ const quarter = Math.floor(date.getMonth() / 3)
271
+ const startOfNextQuarter = new Date(date.getFullYear(), (quarter + 1) * 3, 1)
272
+ // Replicate Moment.js: End of quarter has a time of 23:59:59
273
+ const endOfQuarter = new Date(startOfNextQuarter.getTime() - 1)
274
+
275
+ return endOfQuarter
276
+ }
277
+
278
+ export const getPreviousQuarterStartDate = (newDate: Date | string): Date => {
279
+ const startOfQuarter = getQuarterStartDate(newDate)
280
+ const firstDayOfPreviousQuarter = new Date(
281
+ startOfQuarter.getFullYear(),
282
+ startOfQuarter.getMonth() - 3,
283
+ startOfQuarter.getDate()
284
+ )
285
+
286
+ return firstDayOfPreviousQuarter
287
+ }
288
+
289
+ export const getPreviousQuarterEndDate = (newDate: Date | string): Date => {
290
+ const endOfQuarter = getQuarterEndDate(newDate)
291
+ const lastDayOfPreviousQuarter = new Date(
292
+ endOfQuarter.getFullYear(),
293
+ endOfQuarter.getMonth() - 3,
294
+ endOfQuarter.getDate(),
295
+ endOfQuarter.getHours(),
296
+ endOfQuarter.getMinutes(),
297
+ endOfQuarter.getSeconds()
298
+ )
299
+
300
+ return lastDayOfPreviousQuarter
301
+ }
302
+
303
+ // Years
304
+ export const getYearStartDate = (newDate: Date | string): Date => {
305
+ const date = formatDate(newDate)
306
+ const startOfYear = new Date(date.getFullYear(), 0, 1)
307
+
308
+ return startOfYear
309
+ }
310
+
311
+ export const getYearEndDate = (newDate: Date | string): Date => {
312
+ const date = formatDate(newDate)
313
+ const endOfYear = new Date(date.getFullYear(), 11, 31, 23, 59, 59)
314
+
315
+ return endOfYear
316
+ }
317
+
318
+ export const getPreviousYearStartDate = (newDate: Date | string): Date => {
319
+ const startOfYear = getYearStartDate(newDate)
320
+ const firstDayOfPreviousYear = new Date(
321
+ startOfYear.getFullYear() - 1,
322
+ startOfYear.getMonth(),
323
+ startOfYear.getDate()
324
+ )
325
+
326
+ return firstDayOfPreviousYear
327
+ }
328
+
329
+ export const getPreviousYearEndDate = (newDate: Date | string): Date => {
330
+ const endOfYear = getYearEndDate(newDate)
331
+ const lastDayOfPreviousYear = new Date(
332
+ endOfYear.getFullYear() - 1,
333
+ endOfYear.getMonth(),
334
+ endOfYear.getDate(),
335
+ endOfYear.getHours(),
336
+ endOfYear.getMinutes(),
337
+ endOfYear.getSeconds()
338
+ )
339
+
340
+ return lastDayOfPreviousYear
341
+ }
342
+
157
343
  export default {
158
344
  toMinute,
159
345
  toHour,
@@ -170,4 +356,21 @@ export default {
170
356
  toIso,
171
357
  fromNow,
172
358
  toCustomFormat,
359
+ getYesterdayDate,
360
+ getFirstDayOfWeek,
361
+ getLastDayOfWeek,
362
+ getPreviousWeekStartDate,
363
+ getPreviousWeekEndDate,
364
+ getMonthStartDate,
365
+ getMonthEndDate,
366
+ getPreviousMonthStartDate,
367
+ getPreviousMonthEndDate,
368
+ getQuarterStartDate,
369
+ getQuarterEndDate,
370
+ getPreviousQuarterStartDate,
371
+ getPreviousQuarterEndDate,
372
+ getYearStartDate,
373
+ getYearEndDate,
374
+ getPreviousYearStartDate,
375
+ getPreviousYearEndDate
173
376
  }
@@ -2,7 +2,6 @@
2
2
  @import "../pb_textarea/textarea_mixin";
3
3
  @import "../tokens/titles";
4
4
  @import "../tokens/colors";
5
- @import "../tokens/spacing";
6
5
 
7
6
  [class^=pb_select] {
8
7
  select {
@@ -33,42 +32,6 @@
33
32
  opacity: 0.5;
34
33
  }
35
34
  }
36
- select[multiple] {
37
- @include pb_textarea_light;
38
- @include pb_body_light;
39
- background: none;
40
- background-color: $white;
41
- appearance: none;
42
- cursor: pointer;
43
- box-shadow: inset 0 -11px 20px rgba($primary, 0.05);
44
- padding-right: 0px !important;
45
- color: transparent !important;
46
- text-shadow: 0 0 0 $text_lt_default;
47
- white-space: nowrap;
48
- text-overflow: ellipsis;
49
- padding: $space_xs 0px !important;
50
- max-height: unset !important;
51
- @media (hover:hover) {
52
- &:hover, &:active, &:focus {
53
- background-color: rgba($focus_input_light, $opacity_5);
54
- }
55
- }
56
- &:focus{
57
- border-color: $primary;
58
- @include transition_default;
59
- }
60
- option {
61
- padding-left: $space_sm;
62
- padding-top: $space_xxs;
63
- padding-bottom: $space_xxs;
64
- }
65
- option:checked {
66
- background-color: $hover_light;
67
- }
68
- option:hover {
69
- background-color: $hover_light;
70
- }
71
- }
72
35
  option {
73
36
  color: $text_lt_default;
74
37
  }
@@ -124,15 +124,11 @@ const Select = ({
124
124
  htmlFor={name}
125
125
  >
126
126
  {selectBody}
127
- { multiple !== true ?
128
- <Icon
129
- className="pb_select_kit_caret"
130
- fixedWidth
131
- icon="angle-down"
132
- />
133
- :
134
- null
135
- }
127
+ <Icon
128
+ className="pb_select_kit_caret"
129
+ fixedWidth
130
+ icon="angle-down"
131
+ />
136
132
  {error &&
137
133
  <Body
138
134
  status="negative"
@@ -11,8 +11,6 @@ examples:
11
11
  - select_error: Select w/ Error
12
12
  - select_inline: Select Inline
13
13
  - select_inline_compact: Select Inline Compact
14
- - select_attributes: Select W/ Attributes
15
- - select_multiple: Select Multiple
16
14
 
17
15
 
18
16
 
@@ -27,4 +25,3 @@ examples:
27
25
  - select_error: Select w/ Error
28
26
  - select_inline: Select Inline
29
27
  - select_inline_compact: Select Inline Compact
30
- - select_multiple: Select Multiple
@@ -8,4 +8,3 @@ export { default as SelectValueTextSame } from './_select_value_text_same.jsx'
8
8
  export { default as SelectError } from './_select_error.jsx'
9
9
  export { default as SelectInline } from './_select_inline.jsx'
10
10
  export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
11
- export { default as SelectMultiple } from './_select_multiple.jsx'
@@ -1,6 +1,6 @@
1
1
  <%= content_tag(:div,
2
- aria: object.aria,
3
2
  data: object.data,
3
+ aria: object.aria,
4
4
  class: object.classnames) do %>
5
5
  <% if object.label %>
6
6
  <label class="pb_select_kit_label" for="<%= object.name %>">
@@ -19,13 +19,17 @@
19
19
  selected: object.selected,
20
20
  disabled: object.disabled_options,
21
21
  ),
22
- object.all_attributes
22
+ id: object.id,
23
+ prompt: object.blank_selection,
24
+ disabled: object.disabled,
25
+ required: object.required,
26
+ multiple: object.multiple,
27
+ onchange: object.onchange,
28
+ include_blank: object.include_blank,
23
29
  )
24
30
  %>
25
31
  <%= pb_rails("body", props: { status: "negative", text: object.error }) %>
26
32
  <% end %>
27
- <% if object.multiple != true %>
28
- <%= pb_rails("icon", props: { icon: "angle-down", fixed_width: true, classname: "pb_select_kit_caret"}) %>
29
- <% end %>
33
+ <%= pb_rails("icon", props: { icon: "angle-down", fixed_width: true, classname: "pb_select_kit_caret"}) %>
30
34
  </label>
31
35
  <% end %>
@@ -6,8 +6,6 @@ require "action_view"
6
6
  module Playbook
7
7
  module PbSelect
8
8
  class Select < Playbook::KitBase
9
- prop :attributes, type: Playbook::Props::Hash,
10
- default: {}
11
9
  prop :blank_selection
12
10
  prop :compact, type: Playbook::Props::Boolean, default: false
13
11
  prop :disabled, type: Playbook::Props::Boolean, default: false
@@ -25,18 +23,6 @@ module Playbook
25
23
  classname + inline_class + compact_class
26
24
  end
27
25
 
28
- def all_attributes
29
- {
30
- id: id,
31
- prompt: blank_selection,
32
- disabled: disabled,
33
- required: required,
34
- multiple: multiple,
35
- onchange: onchange,
36
- include_blank: include_blank,
37
- }.merge(attributes)
38
- end
39
-
40
26
  def classname
41
27
  generate_classname("pb_select", select_margin_bottom, separator: " ")
42
28
  end
@@ -49,20 +49,3 @@ test('returns dark class name', () => {
49
49
  const kit = screen.getByTestId(testId)
50
50
  expect(kit).toHaveClass(`${kitClass} dark`)
51
51
  })
52
-
53
- test('returns multiple variant', () => {
54
- render(
55
- <Select
56
- data={{ testid: "selectMultiple" }}
57
- label="Favorite Food"
58
- multiple
59
- name="food"
60
- options={options}
61
- />
62
- )
63
-
64
- const kit = screen.getByTestId("selectMultiple");
65
- const selectElement = kit.querySelector('select');
66
-
67
- expect(selectElement).toHaveAttribute('multiple', '');
68
- });