playbook_ui 9.4.0.pre.alpha2 → 9.6.1.pre.deps1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/data/menu.yml +1 -0
  4. data/app/pb_kits/playbook/index.js +4 -3
  5. data/app/pb_kits/playbook/pb_checkbox/_checkbox.jsx +2 -1
  6. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +3 -2
  7. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.jsx +67 -9
  8. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +11 -45
  9. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +6 -17
  10. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +5 -12
  11. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +1 -3
  12. data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +0 -1
  13. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +16 -32
  14. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +4 -23
  15. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +8 -12
  16. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +2 -9
  17. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb +1 -8
  18. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx +1 -19
  19. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +1 -1
  20. data/app/pb_kits/playbook/pb_flex/_flex.jsx +1 -6
  21. data/app/pb_kits/playbook/pb_icon/_icon.jsx +20 -5
  22. data/app/pb_kits/playbook/pb_icon/icon.html.erb +4 -2
  23. data/app/pb_kits/playbook/pb_loading_inline/_loading_inline.jsx +1 -0
  24. data/app/pb_kits/playbook/pb_loading_inline/loading_inline.html.erb +1 -1
  25. data/app/pb_kits/playbook/pb_nav/_item.jsx +0 -2
  26. data/app/pb_kits/playbook/pb_nav/item.html.erb +2 -2
  27. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +205 -0
  28. data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +73 -0
  29. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_common.jsx +33 -0
  30. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.html.erb +3 -0
  31. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.jsx +31 -0
  32. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.md +1 -0
  33. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.html.erb +16 -0
  34. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.jsx +56 -0
  35. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.md +1 -0
  36. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.html.erb +10 -0
  37. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +68 -0
  38. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.md +9 -0
  39. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.jsx +33 -0
  40. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.md +3 -0
  41. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.html.erb +26 -0
  42. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.jsx +54 -0
  43. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.md +1 -0
  44. data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +15 -0
  45. data/app/pb_kits/playbook/pb_passphrase/docs/index.js +6 -0
  46. data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +1 -0
  47. data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +36 -0
  48. data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +123 -0
  49. data/app/pb_kits/playbook/pb_passphrase/passwordStrength.js +55 -0
  50. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +3 -7
  51. data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +2 -2
  52. data/app/pb_kits/playbook/react_rails_kits.js +1 -0
  53. data/lib/playbook/version.rb +1 -1
  54. metadata +35 -16
  55. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.html.erb +0 -5
  56. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.jsx +0 -38
  57. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +0 -35
@@ -0,0 +1,15 @@
1
+ examples:
2
+
3
+ rails:
4
+ - passphrase_default: Default
5
+ - passphrase_meter_settings: Meter Settings
6
+ - passphrase_input_props: Input Props
7
+ - passphrase_tips: Tips
8
+
9
+ react:
10
+ - passphrase_default: Default
11
+ - passphrase_meter_settings: Meter Settings
12
+ - passphrase_input_props: Input Props
13
+ - passphrase_tips: Tips
14
+ - passphrase_strength_change: Strength Change
15
+ - passphrase_common: Common Passphrases
@@ -0,0 +1,6 @@
1
+ export { default as PassphraseDefault } from './_passphrase_default.jsx'
2
+ export { default as PassphraseMeterSettings } from './_passphrase_meter_settings'
3
+ export { default as PassphraseInputProps } from './_passphrase_input_props'
4
+ export { default as PassphraseTips } from './_passphrase_tips'
5
+ export { default as PassphraseStrengthChange } from './_passphrase_strength_change'
6
+ export { default as PassphraseCommon } from './_passphrase_common'
@@ -0,0 +1 @@
1
+ <%= react_component('Passphrase', object.passphrase_options) %>
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module PbPassphrase
5
+ class Passphrase < Playbook::KitBase
6
+ prop :average_threshold
7
+ prop :confirmation, type: Playbook::Props::Boolean, default: false
8
+ prop :input_props, type: Playbook::Props::Hash, default: {}
9
+ prop :label
10
+ prop :min_length
11
+ prop :show_tips_below
12
+ prop :strong_threshold
13
+ prop :tips, type: Playbook::Props::Array, default: []
14
+
15
+ def classname
16
+ generate_classname("pb_passphrase")
17
+ end
18
+
19
+ def passphrase_options
20
+ {
21
+ dark: dark,
22
+ id: id,
23
+ averageThreshold: average_threshold,
24
+ confirmation: confirmation,
25
+ inputProps: input_props,
26
+ label: label,
27
+ minLength: min_length,
28
+ showTipsBelow: show_tips_below,
29
+ strongThreshold: strong_threshold,
30
+ tips: tips,
31
+ uncontrolled: true,
32
+ }.compact
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,123 @@
1
+ import React from 'react'
2
+ import { render, screen } from '../utilities/test-utils'
3
+ import { Passphrase } from '../'
4
+
5
+ const testId = 'text-input1',
6
+ kitClass = 'pb_passphrase'
7
+
8
+ /* See these resources for more testing info:
9
+ - https://github.com/testing-library/jest-dom#usage for useage and examples
10
+ - https://jestjs.io/docs/en/using-matchers
11
+ */
12
+
13
+ test('returns namespaced class name', () => {
14
+ render(
15
+ <Passphrase
16
+ data={{ testid: testId }}
17
+ />
18
+ )
19
+
20
+ const kit = screen.getByTestId(testId)
21
+ expect(kit).toHaveClass(kitClass)
22
+ })
23
+
24
+ test('returns additional class name', () => {
25
+ render(
26
+ <Passphrase
27
+ className="additional_class"
28
+ data={{ testid: testId }}
29
+ />
30
+ )
31
+
32
+ const kit = screen.getByTestId(testId)
33
+ expect(kit).toHaveClass(`${kitClass} additional_class`)
34
+ })
35
+
36
+ test('returns dark class name', () => {
37
+ render(
38
+ <Passphrase
39
+ dark
40
+ data={{ testid: testId }}
41
+ />
42
+ )
43
+
44
+ const kit = screen.getByTestId(testId)
45
+ expect(kit).toHaveClass(`${kitClass} dark`)
46
+ })
47
+
48
+ test('passes input props to input element', () => {
49
+ render(
50
+ <Passphrase
51
+ data={{ testid: testId }}
52
+ inputProps={{
53
+ name: 'test-name',
54
+ id: 'test-input-id',
55
+ disabled: true,
56
+ }}
57
+ />
58
+ )
59
+
60
+ const kit = screen.getByTestId(testId)
61
+ const input = kit.getElementsByTagName('input')[0]
62
+ expect(input).toHaveAttribute('name', 'test-name')
63
+ expect(input).toHaveAttribute('id', 'test-input-id')
64
+ expect(input).toBeDisabled()
65
+ })
66
+
67
+ test('progress bar is invisible when value is empty', () => {
68
+ render(
69
+ <Passphrase
70
+ data={{ testid: testId }}
71
+ />
72
+ )
73
+
74
+ const kit = screen.getByTestId(testId)
75
+ expect(kit.querySelector('[class^=pb_progress_simple_wrapper]')).toHaveClass('progress-empty-input')
76
+ })
77
+
78
+ test('progress bar is visible when value is not empty', () => {
79
+ render(
80
+ <Passphrase
81
+ data={{ testid: testId }}
82
+ value="test_password_input"
83
+ />
84
+ )
85
+
86
+ const kit = screen.getByTestId(testId)
87
+ expect(kit.querySelector('[class^=pb_progress_simple_wrapper]')).not.toHaveClass('progress-empty-input')
88
+ })
89
+
90
+ test('no progress bar is show when confirmation is true', () => {
91
+ render(
92
+ <Passphrase
93
+ confirmation
94
+ data={{ testid: testId }}
95
+ />
96
+ )
97
+
98
+ const kit = screen.getByTestId(testId)
99
+ expect(kit.querySelector('[class^=pb_progress_simple_wrapper]')).toBeNull()
100
+ })
101
+
102
+ test('popover target shows when tips are given', () => {
103
+ render(
104
+ <Passphrase
105
+ data={{ testid: testId }}
106
+ tips={['some helpful tips']}
107
+ />
108
+ )
109
+
110
+ const kit = screen.getByTestId(testId)
111
+ expect(kit.querySelector('[class^=pb_popover_reference_wrapper]')).toBeDefined()
112
+ })
113
+
114
+ test('popover target does not show when tips are not given', () => {
115
+ render(
116
+ <Passphrase
117
+ data={{ testid: testId }}
118
+ />
119
+ )
120
+
121
+ const kit = screen.getByTestId(testId)
122
+ expect(kit.querySelector('[class^=pb_popover_reference_wrapper]')).toBeNull()
123
+ })
@@ -0,0 +1,55 @@
1
+ import zxcvbn from 'zxcvbn'
2
+
3
+ export const zxcvbnPasswordScore = (options) => {
4
+ const {
5
+ calculate = zxcvbn,
6
+ averageThreshold = 2,
7
+ strongThreshold = 3,
8
+ minLength = 12,
9
+ } = options
10
+
11
+ return {
12
+ minLength,
13
+ averageThreshold,
14
+ strongThreshold,
15
+ test: function (password = '', common = false) {
16
+ const feedbackValues = (str) => {
17
+ let percent, variant, text
18
+
19
+ if (password.length <= 0) {
20
+ percent = '0'
21
+ variant = 'negative'
22
+ text = '\u00A0' //nbsp to keep form from jumping when typing beings
23
+ } else if (common) {
24
+ percent = '25'
25
+ variant = 'negative'
26
+ text = 'This passphrase is too common'
27
+ } else if (password.length < this.minLength || str < this.averageThreshold) {
28
+ percent = '25'
29
+ variant = 'negative'
30
+ text = 'Too weak'
31
+ } else if (str < this.strongThreshold){
32
+ percent = '50'
33
+ variant = 'warning'
34
+ text = 'Almost there, keep going!'
35
+ } else if (str >= this.strongThreshold) {
36
+ percent = '100'
37
+ variant = 'positive'
38
+ text = 'Success! Strong passphrase'
39
+ }
40
+ return { percent, variant, text }
41
+ }
42
+
43
+ const result = calculate(password)
44
+
45
+ return (
46
+ {
47
+ suggestions: result.feedback.suggestions,
48
+ warning: result.feedback.warning,
49
+ strength: result.score,
50
+ ...feedbackValues(result.score),
51
+ }
52
+ )
53
+ },
54
+ }
55
+ }
@@ -38,13 +38,9 @@ const SectionSeparator = (props: SectionSeparatorProps) => {
38
38
  className={classes}
39
39
  id={id}
40
40
  >
41
-
42
- <If condition={text}>
43
- <span>
44
- <Caption text={text} />
45
- </span>
46
- </If>
47
-
41
+ <span>
42
+ <Caption text={text} />
43
+ </span>
48
44
  </div>
49
45
  )
50
46
  }
@@ -3,10 +3,10 @@
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
5
 
6
- <%= pb_rails("body", props: { color: "light", dark: object.dark, classname: "pb_time_stacked time-spacing" }) do %>
6
+ <%= pb_rails("body", props: { color: "light", classname: "pb_time_stacked time-spacing" }) do %>
7
7
  <time>
8
8
  <%= object.format_time_string %>
9
- <%= pb_rails("caption", props: { color: "light", tag: "span", text: object.pb_date_time.to_timezone.upcase, dark: object.dark, classname: "pb_time_stacked" }) %>
9
+ <%= pb_rails("caption", props: { color: "light", tag: "span", text: object.pb_date_time.to_timezone.upcase, classname: "pb_time_stacked" }) %>
10
10
  </time>
11
11
  <% end %>
12
12
  <% end %>
@@ -3,6 +3,7 @@ export { default as BarGraph } from './pb_bar_graph/_bar_graph.jsx'
3
3
  export { default as DistributionBar } from './pb_distribution_bar/_distribution_bar.jsx'
4
4
  export { default as Legend } from './pb_legend/_legend.jsx'
5
5
  export { default as LineGraph } from './pb_line_graph/_line_graph.jsx'
6
+ export { default as Passphrase } from './pb_passphrase/_passphrase.jsx'
6
7
  export { default as Typeahead } from './pb_typeahead/_typeahead.jsx'
7
8
  export { default as RichTextEditor } from './pb_rich_text_editor/_rich_text_editor.jsx'
8
9
  export { default as Dialog } from './pb_dialog/_dialog.jsx'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- VERSION = "9.4.0.pre.alpha2"
4
+ VERSION = "9.6.1.pre.deps1"
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.4.0.pre.alpha2
4
+ version: 9.6.1.pre.deps1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
8
8
  - Power Devs
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-04-12 00:00:00.000000000 Z
12
+ date: 2021-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -285,22 +285,22 @@ dependencies:
285
285
  name: rspec-rails
286
286
  requirement: !ruby/object:Gem::Requirement
287
287
  requirements:
288
- - - "~>"
289
- - !ruby/object:Gem::Version
290
- version: '3.8'
291
288
  - - ">="
292
289
  - !ruby/object:Gem::Version
293
290
  version: 3.8.0
291
+ - - "~>"
292
+ - !ruby/object:Gem::Version
293
+ version: '3.8'
294
294
  type: :development
295
295
  prerelease: false
296
296
  version_requirements: !ruby/object:Gem::Requirement
297
297
  requirements:
298
- - - "~>"
299
- - !ruby/object:Gem::Version
300
- version: '3.8'
301
298
  - - ">="
302
299
  - !ruby/object:Gem::Version
303
300
  version: 3.8.0
301
+ - - "~>"
302
+ - !ruby/object:Gem::Version
303
+ version: '3.8'
304
304
  - !ruby/object:Gem::Dependency
305
305
  name: rspec-html-matchers
306
306
  requirement: !ruby/object:Gem::Requirement
@@ -809,8 +809,6 @@ files:
809
809
  - app/pb_kits/playbook/pb_date_stacked/date_stacked.rb
810
810
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_align.html.erb
811
811
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_align.jsx
812
- - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.html.erb
813
- - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.jsx
814
812
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.html.erb
815
813
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx
816
814
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.html.erb
@@ -840,7 +838,6 @@ files:
840
838
  - app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss
841
839
  - app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb
842
840
  - app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb
843
- - app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js
844
841
  - app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb
845
842
  - app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx
846
843
  - app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml
@@ -1381,6 +1378,29 @@ files:
1381
1378
  - app/pb_kits/playbook/pb_online_status/docs/index.js
1382
1379
  - app/pb_kits/playbook/pb_online_status/online_status.html.erb
1383
1380
  - app/pb_kits/playbook/pb_online_status/online_status.rb
1381
+ - app/pb_kits/playbook/pb_passphrase/_passphrase.jsx
1382
+ - app/pb_kits/playbook/pb_passphrase/_passphrase.scss
1383
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_common.jsx
1384
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.html.erb
1385
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.jsx
1386
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.md
1387
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.html.erb
1388
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.jsx
1389
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.md
1390
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.html.erb
1391
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx
1392
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.md
1393
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.jsx
1394
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.md
1395
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.html.erb
1396
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.jsx
1397
+ - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.md
1398
+ - app/pb_kits/playbook/pb_passphrase/docs/example.yml
1399
+ - app/pb_kits/playbook/pb_passphrase/docs/index.js
1400
+ - app/pb_kits/playbook/pb_passphrase/passphrase.html.erb
1401
+ - app/pb_kits/playbook/pb_passphrase/passphrase.rb
1402
+ - app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx
1403
+ - app/pb_kits/playbook/pb_passphrase/passwordStrength.js
1384
1404
  - app/pb_kits/playbook/pb_person/_person.jsx
1385
1405
  - app/pb_kits/playbook/pb_person/_person.scss
1386
1406
  - app/pb_kits/playbook/pb_person/docs/_description.md
@@ -2095,7 +2115,7 @@ homepage: http://playbook.powerapp.cloud
2095
2115
  licenses:
2096
2116
  - MIT
2097
2117
  metadata: {}
2098
- post_install_message:
2118
+ post_install_message:
2099
2119
  rdoc_options: []
2100
2120
  require_paths:
2101
2121
  - lib
@@ -2110,9 +2130,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2110
2130
  - !ruby/object:Gem::Version
2111
2131
  version: 1.3.1
2112
2132
  requirements: []
2113
- rubyforge_project:
2114
- rubygems_version: 2.7.3
2115
- signing_key:
2133
+ rubygems_version: 3.0.3
2134
+ signing_key:
2116
2135
  specification_version: 4
2117
2136
  summary: Playbook Design System
2118
2137
  test_files: []
@@ -1,5 +0,0 @@
1
- <%= pb_rails("date_stacked", props: { date: DateTime.now, align: "left", bold: true }) %>
2
- <br>
3
- <%= pb_rails("date_stacked", props: { date: Date.new(2018, 03, 20), align: "center", bold: true }) %>
4
- <br>
5
- <%= pb_rails("date_stacked", props: { date: DateTime.now, align: "right", bold: true }) %>
@@ -1,38 +0,0 @@
1
- import React from 'react'
2
- import DateStacked from '../_date_stacked.jsx'
3
-
4
- const DateStackedBold = (props) => {
5
- return (
6
- <div>
7
- <DateStacked
8
- align="left"
9
- bold
10
- date={new Date()}
11
- {...props}
12
- />
13
-
14
- <br />
15
-
16
- <DateStacked
17
- align="center"
18
- bold
19
- date={new Date('20 Mar 2018')}
20
- {...props}
21
- />
22
-
23
- <br />
24
-
25
- <DateStacked
26
- align="right"
27
- bold
28
- date={new Date()}
29
- {...props}
30
- />
31
-
32
- <br />
33
-
34
- </div>
35
- )
36
- }
37
-
38
- export default DateStackedBold