playbook_ui 10.26.1 → 10.27.0.pre.datepicker1

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: d04863af3f16f0ff07920912ee6bee3917aa3102aa4a139ac6db374d33ecff3d
4
- data.tar.gz: 2f7285e07abdadd6d0ef5aa5b72190503509682c2ed627c8a38fee10cc556de7
3
+ metadata.gz: c517f7625c3f51b1f4cd966d4cf0ec2eab5dab7aed441ac0c74fa169ea293ab9
4
+ data.tar.gz: 16896c8a9467b0ef2fca85c7261a329485554a5d668967fdde99d992d8908184
5
5
  SHA512:
6
- metadata.gz: e122b9e9f7e17fdc19da23b248423b58953dc38d3af3069f1e4903f4d05fd1f34f098d93a7453d9a9530a1f6f0b044f30e51dd247d8004cceb72c043dc8436b4
7
- data.tar.gz: 3ec5a1f20a7814eca7781e4504543de8879f84fda9e67376ed300d82ab11380ceca3125324e7c19849e925873f4dd47a2c4ae999cd1ff4f90edfa6f59fd2068c
6
+ metadata.gz: c8aac77540457b3598a3717f2a1d310f1ee16ffd907a3185a97bfd05bcd4ac123009c125feea7331fd161ef5475de268a747e4461cbc12dbdce1adcdc364da66
7
+ data.tar.gz: '0815ddd5e47e45d9fd9f312a7b80e1b3015a06e09834a9212758ed43222790a801564162b56bb07ef0d6be6f41f761eca44a8cc2ba8fd006885a5e3f073bdcec'
@@ -83,10 +83,10 @@ const Card = (props: CardPropTypes) => {
83
83
  const borderCSS = borderNone == true ? 'border_none' : ''
84
84
  const selectedCSS = selected == true ? 'selected' : 'deselected'
85
85
  const backgroundCSS = background == 'none' ? '' : `background_${background}`
86
- const cardCss = buildCss('pb_card_kit', selectedCSS, borderCSS, `border_radius_${borderRadius}`, backgroundCSS, {
87
- [`highlight_${highlight.position}`]: highlight.position,
88
- [`highlight_${highlight.color}`]: highlight.color,
89
- })
86
+ const cardCss = buildCss('pb_card_kit', selectedCSS, borderCSS, `border_radius_${borderRadius}`, backgroundCSS,
87
+ `highlight_${highlight.position}`,
88
+ `highlight_${highlight.color}`,
89
+ )
90
90
  const ariaProps: {[key: string]: string} = buildAriaProps(aria)
91
91
  const dataProps: {[key: string]: string} = buildDataProps(data)
92
92
 
@@ -40,7 +40,7 @@ type DatePickerProps = {
40
40
  onChange: (String) => void,
41
41
  pickerId?: String,
42
42
  placeholder?: String,
43
- plugins?: Boolean,
43
+ plugins?: "ms" | "ws",
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 = false,
77
+ plugins = "",
78
78
  yearRange = [ 1900, 2100 ],
79
79
  } = props
80
80
 
@@ -5,6 +5,7 @@
5
5
  @import "./sass_partials/inline_styles";
6
6
  @import "./sass_partials/month_and_year_styles";
7
7
 
8
+
8
9
  [class^=pb_date_picker_kit] {
9
10
  .input_wrapper {
10
11
  margin-bottom: $space_sm;
@@ -41,8 +41,9 @@ 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::Boolean,
45
- default: false
44
+ prop :plugins, type: Playbook::Props::Enum,
45
+ values: %w[ws ms],
46
+ default: []
46
47
  prop :required, type: Playbook::Props::Boolean,
47
48
  default: false
48
49
  prop :year_range, type: Playbook::Props::Array,
@@ -1,5 +1,6 @@
1
1
  import flatpickr from 'flatpickr'
2
2
  import monthSelectPlugin from 'flatpickr/dist/plugins/monthSelect'
3
+ import weekSelect from "flatpickr/dist/plugins/weekSelect/weekSelect"
3
4
 
4
5
  const datePickerHelper = (config) => {
5
6
  const {
@@ -52,9 +53,15 @@ const datePickerHelper = (config) => {
52
53
  }
53
54
  }
54
55
 
55
- const setMonthAndYearPlugin = () => (
56
- plugins ? [ monthSelectPlugin({ shorthand: true, dateFormat: 'F Y', altFormat: 'F Y' }) ] : []
57
- )
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
+ }
58
65
 
59
66
  // ===========================================================
60
67
  // | Flatpickr initializer w/ config |
@@ -98,12 +105,12 @@ const datePickerHelper = (config) => {
98
105
  window.removeEventListener('resize', calendarResizer)
99
106
  }],
100
107
  onChange: [(selectedDates, dateStr) => {
101
- onChange(dateStr, selectedDates)
108
+ onChange(dateStr, selectedDates)
102
109
  }],
103
110
  onYearChange: [() => {
104
111
  yearChangeHook()
105
112
  }],
106
- plugins: setMonthAndYearPlugin(),
113
+ plugins: setPlugin(),
107
114
  prevArrow: '<i class="far fa-angle-left"></i>',
108
115
  static: true,
109
116
  })
@@ -162,8 +169,10 @@ const datePickerHelper = (config) => {
162
169
  // Adding dropdown icons to year and month selects
163
170
  dropdown.insertAdjacentHTML('afterend', '<i class="far fa-angle-down year-dropdown-icon" id="test-id"></i>')
164
171
  if (picker.monthElements[0].parentElement) {
165
- return picker.monthElements[0].insertAdjacentHTML('afterend', '<i class="far fa-angle-down month-dropdown-icon"></i>')
166
- }
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
+ // }
167
176
 
168
177
  // Remove readonly attribute for validation and or text input
169
178
  if (allowInput){
@@ -1 +1 @@
1
- <%= pb_rails("date_picker", props: { picker_id: "date-picker-default" }) %>
1
+ <%= pb_rails("date_picker", props: { picker_id: "date-picker-default", plugins: "ws" }) %>
@@ -1,5 +1,5 @@
1
1
  <%= pb_rails("date_picker", props: {
2
2
  label: "Date Picker",
3
- plugins: true,
4
3
  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
11
+ plugins="ms"
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 `true`. If you're using React just pass a `plugins` prop to the kit.
1
+ By default month&year plugin is disabled. To activate it set `plugins` prop to `ms`.
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("date_picker", props: {
2
+ label: "Date Picker",
3
+ plugins: "ws",
4
+ picker_id: "week-date-picker"
5
+ }) %>
@@ -0,0 +1,18 @@
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
@@ -0,0 +1 @@
1
+ By default month&year plugin is disabled. To activate it set `plugins` prop to `ws`.
@@ -17,6 +17,7 @@ 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
20
21
 
21
22
 
22
23
  react:
@@ -36,3 +37,4 @@ examples:
36
37
  - date_picker_year_range: Year Range
37
38
  - date_picker_inline: Inline
38
39
  - date_picker_month_and_year: Month & Year Only
40
+ - date_picker_week: Week
@@ -14,3 +14,4 @@ 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'
@@ -0,0 +1,127 @@
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
+ }
@@ -22,7 +22,7 @@ const buildPrefixedProps = (prefix: string, data: {[key: string]: any}) =>
22
22
  *
23
23
  * @returns {() => {}} the noop function.
24
24
  */
25
- export const noop = (): void => { void 0 }
25
+ export const noop = () => {}
26
26
 
27
27
  /**
28
28
  * Maps a given aria object into HTML valid aria attribtues and their values.
@@ -47,5 +47,5 @@ export const buildDataProps = (data: {[key: string]: any}) => buildPrefixedProps
47
47
  * @param {Object} rules a 'classnames' compliant rules object, used to derive the root className.
48
48
  * @returns {String} the derived root className value.
49
49
  */
50
- export const buildCss = (...rules: (string | { [x: string]: string; })[]): string => classnames(rules).replace(/\s/g, '_')
50
+ export const buildCss = (...rules: string[]) => classnames(rules).replace(/\s/g, '_')
51
51
 
@@ -6,12 +6,7 @@ module Playbook
6
6
 
7
7
  def pb_rails(kit_name, props: {}, &block)
8
8
  kit = Playbook::KitResolver.resolve(kit_name.to_s)
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
9
+ render_component kit.new(props, &block), &block
15
10
  end
16
11
  end
17
12
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "10.26.0"
5
- VERSION = "10.26.1"
5
+ VERSION = "10.27.0.pre.datepicker1"
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.26.1
4
+ version: 10.27.0.pre.datepicker1
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-27 00:00:00.000000000 Z
12
+ date: 2022-05-16 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.55.0
104
+ version: 2.48.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.55.0
111
+ version: 2.48.0
112
112
  - !ruby/object:Gem::Dependency
113
113
  name: webpacker-react
114
114
  requirement: !ruby/object:Gem::Requirement
@@ -686,6 +686,9 @@ 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
689
692
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.html.erb
690
693
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.jsx
691
694
  - app/pb_kits/playbook/pb_date_picker/docs/_date_picker_year_range.md
@@ -699,6 +702,7 @@ files:
699
702
  - app/pb_kits/playbook/pb_date_picker/sass_partials/_inline_styles.scss
700
703
  - app/pb_kits/playbook/pb_date_picker/sass_partials/_month_and_year_styles.scss
701
704
  - app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss
705
+ - app/pb_kits/playbook/pb_date_picker/sass_partials/_week_styles.scss
702
706
  - app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx
703
707
  - app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss
704
708
  - app/pb_kits/playbook/pb_date_range_inline/date_range_inline.html.erb
@@ -2208,9 +2212,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2208
2212
  version: '0'
2209
2213
  required_rubygems_version: !ruby/object:Gem::Requirement
2210
2214
  requirements:
2211
- - - ">="
2215
+ - - ">"
2212
2216
  - !ruby/object:Gem::Version
2213
- version: '0'
2217
+ version: 1.3.1
2214
2218
  requirements: []
2215
2219
  rubygems_version: 3.1.6
2216
2220
  signing_key: