playbook_ui 10.27.0.pre.datepicker1 → 11.0.0.pre.alpha.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c517f7625c3f51b1f4cd966d4cf0ec2eab5dab7aed441ac0c74fa169ea293ab9
4
- data.tar.gz: 16896c8a9467b0ef2fca85c7261a329485554a5d668967fdde99d992d8908184
3
+ metadata.gz: 6d28e27927e8602f94b1e7899dc68b885a4d6e1c16d68a1fe9193f1906ac4612
4
+ data.tar.gz: d4e34b7ed0c56ef0115540018aa793a9916d1c7289262b7100e3096bb0c0b8ec
5
5
  SHA512:
6
- metadata.gz: c8aac77540457b3598a3717f2a1d310f1ee16ffd907a3185a97bfd05bcd4ac123009c125feea7331fd161ef5475de268a747e4461cbc12dbdce1adcdc364da66
7
- data.tar.gz: '0815ddd5e47e45d9fd9f312a7b80e1b3015a06e09834a9212758ed43222790a801564162b56bb07ef0d6be6f41f761eca44a8cc2ba8fd006885a5e3f073bdcec'
6
+ metadata.gz: c3e96e40585f37e05faecc618cff08a9c073c3e296aafe6044bbecf647c7011d6042008714d412f8844232a1b68d256060c7ab82a869c1553cb143ac8dfbef4c
7
+ data.tar.gz: 2b4b0344dcc62a9e841c41c88a7a8a027d6c442720d2ada777118ae1470fd1eb81e54ec458f3ff19cedb3877df52382ce8c87c03ed1cd926a8720ff46cc87c8b
@@ -40,7 +40,7 @@ type DatePickerProps = {
40
40
  onChange: (String) => void,
41
41
  pickerId?: String,
42
42
  placeholder?: String,
43
- plugins?: "ms" | "ws",
43
+ plugins?: Boolean,
44
44
  type?: String,
45
45
  yearRange?: Array,
46
46
  }
@@ -74,7 +74,7 @@ const DatePicker = (props: DatePickerProps) => {
74
74
  onChange = () => {},
75
75
  pickerId,
76
76
  placeholder = 'Select Date',
77
- plugins = "",
77
+ plugins = false,
78
78
  yearRange = [ 1900, 2100 ],
79
79
  } = props
80
80
 
@@ -5,7 +5,6 @@
5
5
  @import "./sass_partials/inline_styles";
6
6
  @import "./sass_partials/month_and_year_styles";
7
7
 
8
-
9
8
  [class^=pb_date_picker_kit] {
10
9
  .input_wrapper {
11
10
  margin-bottom: $space_sm;
@@ -41,9 +41,8 @@ module Playbook
41
41
  required: true
42
42
  prop :placeholder, type: Playbook::Props::String,
43
43
  default: "Select Date"
44
- prop :plugins, type: Playbook::Props::Enum,
45
- values: %w[ws ms],
46
- default: []
44
+ prop :plugins, type: Playbook::Props::Boolean,
45
+ default: false
47
46
  prop :required, type: Playbook::Props::Boolean,
48
47
  default: false
49
48
  prop :year_range, type: Playbook::Props::Array,
@@ -1,6 +1,5 @@
1
1
  import flatpickr from 'flatpickr'
2
2
  import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect'
3
- import weekSelect from "flatpickr/dist/plugins/weekSelect/weekSelect"
4
3
 
5
4
  const datePickerHelper = (config) => {
6
5
  const {
@@ -53,15 +52,9 @@ const datePickerHelper = (config) => {
53
52
  }
54
53
  }
55
54
 
56
- const setPlugin = () => {
57
- let p
58
- if (plugins === "ms") {
59
- p = [ monthSelectPlugin({ shorthand: true, dateFormat: 'F Y', altFormat: 'F Y' }) ]
60
- } else if ( plugins === "ws") {
61
- p = [ weekSelect({shorthand: true, dateFormat: 'F Y', altFormat: 'F Y' })]
62
- } else p = []
63
- return p
64
- }
55
+ const setMonthAndYearPlugin = () => (
56
+ plugins ? [ monthSelectPlugin({ shorthand: true, dateFormat: 'F Y', altFormat: 'F Y' }) ] : []
57
+ )
65
58
 
66
59
  // ===========================================================
67
60
  // | Flatpickr initializer w/ config |
@@ -105,12 +98,12 @@ const datePickerHelper = (config) => {
105
98
  window.removeEventListener('resize', calendarResizer)
106
99
  }],
107
100
  onChange: [(selectedDates, dateStr) => {
108
- onChange(dateStr, selectedDates)
101
+ onChange(dateStr, selectedDates)
109
102
  }],
110
103
  onYearChange: [() => {
111
104
  yearChangeHook()
112
105
  }],
113
- plugins: setPlugin(),
106
+ plugins: setMonthAndYearPlugin(),
114
107
  prevArrow: '<i class="far fa-angle-left"></i>',
115
108
  static: true,
116
109
  })
@@ -169,10 +162,8 @@ const datePickerHelper = (config) => {
169
162
  // Adding dropdown icons to year and month selects
170
163
  dropdown.insertAdjacentHTML('afterend', '<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>')
171
164
  if (picker.monthElements[0].parentElement) {
172
- return picker.monthElements[0].insertAdjacentHTML('afterend', '<i class="far fa-angle-down month-dropdown-icon"></i>')}
173
- // if (picker.weekElements[0].parentElement){
174
- // return picker.weekElements[0].insertAdjacentHTML('afterend', '<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>')
175
- // }
165
+ return picker.monthElements[0].insertAdjacentHTML('afterend', '<i class="far fa-angle-down month-dropdown-icon"></i>')
166
+ }
176
167
 
177
168
  // Remove readonly attribute for validation and or text input
178
169
  if (allowInput){
@@ -1 +1 @@
1
- <%= pb_rails("date_picker", props: { picker_id: "date-picker-default", plugins: "ws" }) %>
1
+ <%= pb_rails("date_picker", props: { picker_id: "date-picker-default" }) %>
@@ -1,5 +1,5 @@
1
1
  <%= pb_rails("date_picker", props: {
2
2
  label: "Date Picker",
3
+ plugins: true,
3
4
  picker_id: "disabled_date"
4
- plugins: "ms",
5
5
  }) %>
@@ -8,7 +8,7 @@ const DatePickerMonthAndYear = (props) => {
8
8
  <DatePicker
9
9
  label="Date Picker"
10
10
  pickerId="disabled-date"
11
- plugins="ms"
11
+ plugins
12
12
  {...props}
13
13
  />
14
14
  </div>
@@ -1 +1 @@
1
- By default month&year plugin is disabled. To activate it set `plugins` prop to `ms`.
1
+ By default month&year plugin is disabled. To activate it set `plugins` prop to `true`. If you're using React just pass a `plugins` prop to the kit.
@@ -17,7 +17,6 @@ examples:
17
17
  - date_picker_anti_patterns: Anti-Patterns
18
18
  - date_picker_inline: Inline
19
19
  - date_picker_month_and_year: Month & Year Only
20
- - date_picker_week: Week
21
20
 
22
21
 
23
22
  react:
@@ -37,4 +36,3 @@ examples:
37
36
  - date_picker_year_range: Year Range
38
37
  - date_picker_inline: Inline
39
38
  - date_picker_month_and_year: Month & Year Only
40
- - date_picker_week: Week
@@ -14,4 +14,3 @@ export { default as DatePickerFlatpickrMethods } from './_date_picker_flatpickr_
14
14
  export { default as DatePickerYearRange } from './_date_picker_year_range.jsx'
15
15
  export { default as DatePickerInline } from './_date_picker_inline.jsx'
16
16
  export { default as DatePickerMonthAndYear } from './_date_picker_month_and_year.jsx'
17
- export { default as DatePickerWeek } from './_date_picker_week.jsx'
@@ -11,7 +11,7 @@ module Playbook
11
11
  prop :validate, type: Playbook::Props::Boolean, default: false
12
12
 
13
13
  def render_in(view_context, &block)
14
- view_context.pb_form_with(form_options, &block)
14
+ view_context.pb_form_with(**form_options, &block)
15
15
  end
16
16
 
17
17
  private
@@ -60,9 +60,12 @@ module Playbook
60
60
  plusIcon: plus_icon,
61
61
  }
62
62
 
63
- base_options.merge!({ getOptionLabel: get_option_label }) if get_option_label.present?
64
- base_options.merge!({ getOptionValue: get_option_value }) if get_option_value.present?
65
- base_options.merge!({ async: true, loadOptions: load_options }) if async
63
+ base_options[:getOptionLabel] = get_option_label if get_option_label.present?
64
+ base_options[:getOptionValue] = get_option_value if get_option_value.present?
65
+ if async
66
+ base_options[:async] = true
67
+ base_options[:loadOptions] = load_options
68
+ end
66
69
  base_options
67
70
  end
68
71
  end
@@ -6,7 +6,12 @@ module Playbook
6
6
 
7
7
  def pb_rails(kit_name, props: {}, &block)
8
8
  kit = Playbook::KitResolver.resolve(kit_name.to_s)
9
- render_component kit.new(props, &block), &block
9
+
10
+ if respond_to? :render_component
11
+ render_component kit.new(props, &block), &block
12
+ else
13
+ render kit.new(props, &block), &block
14
+ end
10
15
  end
11
16
  end
12
17
  end
@@ -48,7 +48,7 @@ module Playbook
48
48
  end
49
49
 
50
50
  def prop(name, type: Playbook::Props::String, **options)
51
- self.props = props.merge(name => type.new(options.merge(name: name, kit: self)))
51
+ self.props = props.merge(name => type.new(**options.merge(name: name, kit: self)))
52
52
 
53
53
  define_method(name) { prop(name) }
54
54
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "10.26.0"
5
- VERSION = "10.27.0.pre.datepicker1"
5
+ VERSION = "11.0.0.pre.alpha.2"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.27.0.pre.datepicker1
4
+ version: 11.0.0.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-05-16 00:00:00.000000000 Z
12
+ date: 2022-06-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -101,14 +101,14 @@ dependencies:
101
101
  requirements:
102
102
  - - '='
103
103
  - !ruby/object:Gem::Version
104
- version: 2.48.0
104
+ version: 2.55.0
105
105
  type: :runtime
106
106
  prerelease: false
107
107
  version_requirements: !ruby/object:Gem::Requirement
108
108
  requirements:
109
109
  - - '='
110
110
  - !ruby/object:Gem::Version
111
- version: 2.48.0
111
+ version: 2.55.0
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: webpacker-react
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -205,14 +205,14 @@ dependencies:
205
205
  requirements:
206
206
  - - '='
207
207
  - !ruby/object:Gem::Version
208
- version: 1.20.0
208
+ version: 1.23.0
209
209
  type: :development
210
210
  prerelease: false
211
211
  version_requirements: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - '='
214
214
  - !ruby/object:Gem::Version
215
- version: 1.20.0
215
+ version: 1.23.0
216
216
  - !ruby/object:Gem::Dependency
217
217
  name: rubocop-performance
218
218
  requirement: !ruby/object:Gem::Requirement
@@ -686,9 +686,6 @@ files:
686
686
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.md
687
687
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.html.erb
688
688
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_range.jsx
689
- - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_week.html.erb
690
- - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_week.jsx
691
- - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_week.md
692
689
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.html.erb
693
690
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.jsx
694
691
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.md
@@ -702,7 +699,6 @@ files:
702
699
  - app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss
703
700
  - app/pb_kits/playbook/pb_date_picker/sass_partials/_month_and_year_styles.scss
704
701
  - app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss
705
- - app/pb_kits/playbook/pb_date_picker/sass_partials/_week_styles.scss
706
702
  - app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx
707
703
  - app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss
708
704
  - app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb
@@ -2216,7 +2212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2216
2212
  - !ruby/object:Gem::Version
2217
2213
  version: 1.3.1
2218
2214
  requirements: []
2219
- rubygems_version: 3.1.6
2215
+ rubygems_version: 3.3.7
2220
2216
  signing_key:
2221
2217
  specification_version: 4
2222
2218
  summary: Playbook Design System
@@ -1,5 +0,0 @@
1
- <%= pb_rails("date_picker", props: {
2
- label: "Date Picker",
3
- plugins: "ws",
4
- picker_id: "week-date-picker"
5
- }) %>
@@ -1,18 +0,0 @@
1
- import React from 'react'
2
-
3
- import DatePicker from '../_date_picker'
4
-
5
- const DatePickerWeek = (props) => {
6
- return (
7
- <div>
8
- <DatePicker
9
- label="Date Picker"
10
- pickerId="week-date-picker"
11
- plugins="ws"
12
- {...props}
13
- />
14
- </div>
15
- )
16
- }
17
-
18
- export default DatePickerWeek
@@ -1 +0,0 @@
1
- By default month&year plugin is disabled. To activate it set `plugins` prop to `ws`.
@@ -1,127 +0,0 @@
1
- @import "../../tokens/colors";
2
-
3
-
4
- .numInput {
5
- border-left: none !important;
6
- }
7
-
8
- // Manual Import
9
- .flatpickr-monthSelect-months {
10
- margin: 10px 1px 3px 1px;
11
- flex-wrap: wrap;
12
- }
13
-
14
- .flatpickr-monthSelect-month {
15
- background: none;
16
- border: 1px solid transparent;
17
- border-radius: 4px;
18
- -webkit-box-sizing: border-box;
19
- box-sizing: border-box;
20
- color: $text_lt_default;
21
- cursor: pointer;
22
- display: inline-block;
23
- font-weight: 400;
24
- margin: 0.5px;
25
- justify-content: center;
26
- padding: 10px;
27
- position: relative;
28
- -webkit-box-pack: center;
29
- -webkit-justify-content: center;
30
- -ms-flex-pack: center;
31
- text-align: center;
32
- width: 33%;
33
- }
34
-
35
- .flatpickr-monthSelect-month.flatpickr-disabled {
36
- color: #eee;
37
- }
38
-
39
- .flatpickr-monthSelect-month.flatpickr-disabled:hover,
40
- .flatpickr-monthSelect-month.flatpickr-disabled:focus {
41
- cursor: not-allowed;
42
- background: none !important;
43
- }
44
-
45
- .flatpickr-monthSelect-theme-dark {
46
- background: #3f4458;
47
- }
48
-
49
- .flatpickr-monthSelect-theme-dark .flatpickr-current-month input.cur-year {
50
- color: #fff;
51
- }
52
-
53
- .flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-prev-month,
54
- .flatpickr-monthSelect-theme-dark .flatpickr-months .flatpickr-next-month {
55
- color: #fff;
56
- fill: #fff;
57
- }
58
-
59
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month {
60
- color: rgba(255, 255, 255, 0.95);
61
- }
62
-
63
- .flatpickr-monthSelect-month.today {
64
- border-color: #959ea9;
65
- }
66
-
67
- .flatpickr-monthSelect-month.inRange,
68
- .flatpickr-monthSelect-month.inRange.today,
69
- .flatpickr-monthSelect-month:hover,
70
- .flatpickr-monthSelect-month:focus {
71
- background: $active_light;
72
- font-weight: $bold;
73
- color: $text_lt_default;
74
- cursor: pointer;
75
- outline: 0;
76
- }
77
-
78
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.inRange,
79
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:hover,
80
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month:focus {
81
- background: #646c8c;
82
- border-color: #646c8c;
83
- }
84
-
85
- .flatpickr-monthSelect-month.today:hover,
86
- .flatpickr-monthSelect-month.today:focus {
87
- background: #959ea9;
88
- border-color: #959ea9;
89
- color: #fff;
90
- }
91
-
92
- .flatpickr-monthSelect-month.selected,
93
- .flatpickr-monthSelect-month.startRange,
94
- .flatpickr-monthSelect-month.endRange {
95
- background-color: $primary;
96
- font-weight: $bold;
97
- box-shadow: none;
98
- color: #fff;
99
- border-color: $primary;
100
- }
101
-
102
- .flatpickr-monthSelect-month.startRange {
103
- border-radius: 50px 0 0 50px;
104
- }
105
-
106
- .flatpickr-monthSelect-month.endRange {
107
- border-radius: 0 50px 50px 0;
108
- }
109
-
110
- .flatpickr-monthSelect-month.startRange.endRange {
111
- border-radius: 50px;
112
- }
113
-
114
- .flatpickr-monthSelect-month.inRange {
115
- border-radius: 0;
116
- box-shadow: -5px 0 0 #e6e6e6, 5px 0 0 #e6e6e6;
117
- }
118
-
119
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.selected,
120
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.startRange,
121
- .flatpickr-monthSelect-theme-dark .flatpickr-monthSelect-month.endRange {
122
- background: #80cbc4;
123
- -webkit-box-shadow: none;
124
- box-shadow: none;
125
- color: #fff;
126
- border-color: #80cbc4;
127
- }