playbook_ui 9.3.0.pre.alpha.password.strength.1 → 9.4.0.pre.alpha2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -1
  3. data/app/pb_kits/playbook/data/menu.yml +0 -1
  4. data/app/pb_kits/playbook/index.js +3 -4
  5. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.jsx +45 -11
  6. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.html.erb +17 -6
  7. data/app/pb_kits/playbook/pb_date_stacked/date_stacked.rb +12 -5
  8. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.html.erb +5 -0
  9. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold.jsx +38 -0
  10. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +3 -1
  11. data/app/pb_kits/playbook/pb_date_stacked/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.jsx +32 -16
  13. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +23 -4
  14. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb +12 -8
  15. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.rb +9 -2
  16. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +35 -0
  17. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb +8 -1
  18. data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx +19 -1
  19. data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +1 -1
  20. data/app/pb_kits/playbook/pb_flex/_flex.jsx +6 -1
  21. data/app/pb_kits/playbook/pb_section_separator/_section_separator.jsx +7 -3
  22. data/app/pb_kits/playbook/pb_time_stacked/time_stacked.html.erb +2 -2
  23. data/app/pb_kits/playbook/react_rails_kits.js +0 -1
  24. data/lib/playbook/version.rb +1 -1
  25. metadata +5 -25
  26. data/app/pb_kits/playbook/pb_passphrase/_passphrase.jsx +0 -205
  27. data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +0 -63
  28. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_common.jsx +0 -33
  29. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.html.erb +0 -3
  30. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.jsx +0 -31
  31. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_default.md +0 -1
  32. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.html.erb +0 -16
  33. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.jsx +0 -56
  34. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_input_props.md +0 -1
  35. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.html.erb +0 -10
  36. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +0 -68
  37. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.md +0 -9
  38. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.jsx +0 -33
  39. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_strength_change.md +0 -3
  40. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.html.erb +0 -26
  41. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.jsx +0 -54
  42. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_tips.md +0 -1
  43. data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +0 -15
  44. data/app/pb_kits/playbook/pb_passphrase/docs/index.js +0 -6
  45. data/app/pb_kits/playbook/pb_passphrase/passphrase.html.erb +0 -1
  46. data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +0 -41
  47. data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +0 -123
  48. data/app/pb_kits/playbook/pb_passphrase/passwordStrength.js +0 -55
@@ -1 +1,8 @@
1
- <%= pb_rails("date_time_stacked") %>
1
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now }) %>
2
+ <br>
3
+ <%= pb_rails("date_time_stacked", props: { date_time: Date.new(2018, 03, 20) }) %>
4
+ <br>
5
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, timezone: "Asia/Tokyo" }) %>
6
+ <br>
7
+ <%= pb_rails("date_time_stacked", props: { date_time: DateTime.now, timezone: "America/Denver" }) %>
8
+
@@ -4,10 +4,28 @@ import { DateTimeStacked } from '../../'
4
4
  const DateTimeStackedDefault = (props) => (
5
5
  <div>
6
6
  <DateTimeStacked
7
- date={new Date()}
7
+ datetime={new Date()}
8
8
  {...props}
9
9
  />
10
+ <br />
11
+ <DateTimeStacked
12
+ datetime={new Date()}
13
+ timeZone="Asia/Tokyo"
14
+
15
+ {...props}
16
+ />
17
+ <br />
18
+ <DateTimeStacked
19
+ datetime={new Date()}
20
+ timeZone="America/Denver"
21
+
22
+ {...props}
23
+ />
24
+
10
25
  </div>
11
26
  )
12
27
 
13
28
  export default DateTimeStackedDefault
29
+
30
+ // *Development Note* - We are reviewing this kit for a potential name change due to naming collisions when `new Date()` is used.
31
+ // To avoid this bug, please use name spacing as shown in the code examples. ie `import { Date as AliasedComponentName } from '../../'
@@ -9,7 +9,7 @@ import { Dialog } from '../'
9
9
  - https://jestjs.io/docs/en/using-matchers
10
10
  */
11
11
 
12
- test('generated scaffold test - update me', () => {
12
+ test('Kit renders Dialog', () => {
13
13
  const testId = 'test1'
14
14
 
15
15
  render(
@@ -2,11 +2,12 @@
2
2
 
3
3
  import React from 'react'
4
4
  import classnames from 'classnames'
5
- import { buildCss } from '../utilities/props'
5
+ import { buildCss, buildDataProps } from '../utilities/props'
6
6
  import { globalProps } from '../utilities/globalProps.js'
7
7
  type FlexProps = {
8
8
  children: array<React.ReactNode> | React.ReactNode,
9
9
  className?: string,
10
+ data?: object,
10
11
  horizontal?: "left" | "center" | "right" | "stretch" | "none",
11
12
  justify?: "start" | "center" | "end" | "around" | "between" | "evenly" | "none",
12
13
  id?: string,
@@ -27,6 +28,7 @@ const Flex = (props: FlexProps) => {
27
28
  align = 'none',
28
29
  children,
29
30
  className,
31
+ data = {},
30
32
  inline = false,
31
33
  horizontal = 'left',
32
34
  justify = 'none',
@@ -51,6 +53,8 @@ const Flex = (props: FlexProps) => {
51
53
  const columnGapClass = columnGap !== 'none' ? `columnGap_${columnGap}` : ''
52
54
  const wrapClass = wrap === true ? 'wrap' : ''
53
55
  const reverseClass = reverse === true ? 'reverse' : ''
56
+ const dataProps = buildDataProps(data)
57
+
54
58
  return (
55
59
  <div
56
60
  className={classnames(
@@ -70,6 +74,7 @@ const Flex = (props: FlexProps) => {
70
74
  globalProps(props),
71
75
  className
72
76
  )}
77
+ {...dataProps}
73
78
  >
74
79
  {children}
75
80
  </div>
@@ -38,9 +38,13 @@ const SectionSeparator = (props: SectionSeparatorProps) => {
38
38
  className={classes}
39
39
  id={id}
40
40
  >
41
- <span>
42
- <Caption text={text} />
43
- </span>
41
+
42
+ <If condition={text}>
43
+ <span>
44
+ <Caption text={text} />
45
+ </span>
46
+ </If>
47
+
44
48
  </div>
45
49
  )
46
50
  }
@@ -3,10 +3,10 @@
3
3
  data: object.data,
4
4
  class: object.classname) do %>
5
5
 
6
- <%= pb_rails("body", props: { color: "light", classname: "pb_time_stacked time-spacing" }) do %>
6
+ <%= pb_rails("body", props: { color: "light", dark: object.dark, 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, classname: "pb_time_stacked" }) %>
9
+ <%= pb_rails("caption", props: { color: "light", tag: "span", text: object.pb_date_time.to_timezone.upcase, dark: object.dark, classname: "pb_time_stacked" }) %>
10
10
  </time>
11
11
  <% end %>
12
12
  <% end %>
@@ -3,7 +3,6 @@ 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'
7
6
  export { default as Typeahead } from './pb_typeahead/_typeahead.jsx'
8
7
  export { default as RichTextEditor } from './pb_rich_text_editor/_rich_text_editor.jsx'
9
8
  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.3.0.pre.alpha.password.strength.1"
4
+ VERSION = "9.4.0.pre.alpha2"
5
5
  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: 9.3.0.pre.alpha.password.strength.1
4
+ version: 9.4.0.pre.alpha2
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: 2021-04-09 00:00:00.000000000 Z
12
+ date: 2021-04-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -809,6 +809,8 @@ 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
812
814
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.html.erb
813
815
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default.jsx
814
816
  - app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year.html.erb
@@ -838,6 +840,7 @@ files:
838
840
  - app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss
839
841
  - app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.html.erb
840
842
  - 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
841
844
  - app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.html.erb
842
845
  - app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default.jsx
843
846
  - app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml
@@ -1378,29 +1381,6 @@ files:
1378
1381
  - app/pb_kits/playbook/pb_online_status/docs/index.js
1379
1382
  - app/pb_kits/playbook/pb_online_status/online_status.html.erb
1380
1383
  - 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
1404
1384
  - app/pb_kits/playbook/pb_person/_person.jsx
1405
1385
  - app/pb_kits/playbook/pb_person/_person.scss
1406
1386
  - app/pb_kits/playbook/pb_person/docs/_description.md
@@ -1,205 +0,0 @@
1
-
2
- /* @flow */
3
-
4
- import React, { useCallback, useEffect, useMemo, useState } from 'react'
5
- import classnames from 'classnames'
6
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
- import { globalProps } from '../utilities/globalProps.js'
8
- import { Body, Caption, Flex, Icon, PbReactPopover, ProgressSimple, TextInput } from '../'
9
- import { zxcvbnPasswordScore } from './passwordStrength.js'
10
-
11
- type PassphraseProps = {
12
- aria?: object,
13
- averageThreshold?: number,
14
- common?: boolean,
15
- confirmation?: boolean,
16
- className?: string,
17
- data?: object,
18
- dark?: boolean,
19
- id?: string,
20
- inputProps?: {},
21
- label?: string,
22
- minLength?: number,
23
- onChange: (String) => void,
24
- showTipsBelow?: 'always' | 'xs' | 'sm' | 'md' | 'lg' | 'xl',
25
- onStrengthChange?: (number) => void,
26
- strongThreshold?: number,
27
- tips?: Array<string>,
28
- uncontrolled?: boolean,
29
- value: string,
30
- }
31
-
32
- const Passphrase = (props: PassphraseProps) => {
33
- const {
34
- aria = {},
35
- averageThreshold = 2,
36
- className,
37
- common = false,
38
- confirmation = false,
39
- dark = false,
40
- data = {},
41
- id,
42
- inputProps = {},
43
- label = confirmation ? 'Confirm Passphrase' : 'Passphrase',
44
- minLength,
45
- onChange = () => {},
46
- showTipsBelow = 'always',
47
- onStrengthChange,
48
- strongThreshold = 3,
49
- tips = [],
50
- uncontrolled = false,
51
- value = '',
52
- } = props
53
-
54
- const [uncontrolledValue, setUncontrolledValue] = useState('')
55
-
56
- const handleChange = useCallback(
57
- (e) => uncontrolled ? setUncontrolledValue(e.target.value) : onChange(e),
58
- [uncontrolled, onChange]
59
- )
60
-
61
- const displayValue = useMemo(
62
- () => (uncontrolled ? uncontrolledValue : value),
63
- [value, uncontrolledValue, uncontrolled],
64
- )
65
-
66
- const [showPopover, setShowPopover] = useState(false)
67
- const toggleShowPopover = () => setShowPopover(!showPopover)
68
- const [showPassphrase, setShowPassphrase] = useState(false)
69
- const toggleShowPassphrase = () => setShowPassphrase(!showPassphrase)
70
-
71
- const ariaProps = buildAriaProps(aria)
72
- const dataProps = buildDataProps(data)
73
- const classes = classnames(buildCss('pb_passphrase'), globalProps(props), className)
74
-
75
- const calculator = useMemo(
76
- () => confirmation ? { test: () => ({}) } : zxcvbnPasswordScore({ averageThreshold, strongThreshold, minLength }),
77
- [averageThreshold, confirmation, strongThreshold, minLength]
78
- )
79
-
80
- const { percent: progressPercent, variant: progressVariant, text: strengthLabel, strength } = calculator.test(displayValue, common)
81
-
82
- useEffect(() => {
83
- if (typeof onStrengthChange === 'function') {
84
- onStrengthChange(strength)
85
- }
86
- }, [strength])
87
-
88
- const tipClass = classnames(
89
- (dark ? 'dark' : null),
90
- (showTipsBelow === 'always' ? null : `show-below-${showTipsBelow}`),
91
- )
92
-
93
- const popoverReference = (
94
- <a
95
- className={tipClass}
96
- onClick={toggleShowPopover}
97
- >
98
- <Icon
99
- dark={dark}
100
- icon="info-circle"
101
- size="xs"
102
- variant="link"
103
- />
104
- </a>
105
- )
106
-
107
- return (
108
- <div
109
- {...ariaProps}
110
- {...dataProps}
111
- className={classes}
112
- id={id}
113
- >
114
- <label>
115
- <Flex align="baseline">
116
- <Caption
117
- className="passphrase-label"
118
- text={label}
119
- />
120
- <If condition={tips.length > 0 && !confirmation}>
121
- <PbReactPopover
122
- placement="right"
123
- reference={popoverReference}
124
- show={showPopover}
125
- >
126
- <Flex
127
- align="center"
128
- orientation="column"
129
- >
130
- <Caption
131
- marginBottom="xs"
132
- text="Tips for a good passphrase"
133
- />
134
- <div>
135
- {
136
- tips.map((tip, i) => (
137
- <Caption
138
- key={i}
139
- marginBottom="xs"
140
- size="xs"
141
- >
142
- <Icon
143
- icon="shield-check"
144
- marginRight="xs"
145
- />
146
- {tip}
147
- </Caption>
148
- ))
149
- }
150
- </div>
151
- </Flex>
152
- </PbReactPopover>
153
- </If>
154
- </Flex>
155
- <div className="passphrase-text-input-wrapper">
156
- <TextInput
157
- className="passphrase-text-input"
158
- dark={dark}
159
- marginBottom="xs"
160
- onChange={handleChange}
161
- placeholder="Enter a passphrase..."
162
- type={showPassphrase ? 'text' : 'password'}
163
- value={displayValue}
164
- {...inputProps}
165
- />
166
- <span
167
- className="show-passphrase-icon"
168
- dark={dark}
169
- onClick={toggleShowPassphrase}
170
- >
171
- <Body
172
- className={showPassphrase ? 'hide-icon' : ''}
173
- color="light"
174
- dark={dark}
175
- >
176
- <Icon icon="eye-slash" />
177
- </Body>
178
- <Body
179
- className={showPassphrase ? '' : 'hide-icon'}
180
- color="light"
181
- dark={dark}
182
- >
183
- <Icon icon="eye" />
184
- </Body>
185
- </span>
186
- </div>
187
- </label>
188
- <If condition={!confirmation}>
189
- <ProgressSimple
190
- className={displayValue.length === 0 ? 'progress-empty-input' : null}
191
- dark={dark}
192
- percent={progressPercent}
193
- variant={progressVariant}
194
- />
195
- <Caption
196
- dark={dark}
197
- size="xs"
198
- text={strengthLabel}
199
- />
200
- </If>
201
- </div>
202
- )
203
- }
204
-
205
- export default Passphrase
@@ -1,63 +0,0 @@
1
- @import "../tokens/colors";
2
- @import "../tokens/spacing";
3
- @import "../tokens/screen_sizes";
4
-
5
- .pb_passphrase {
6
- margin-bottom: $space_sm;
7
-
8
- a.dark {
9
- color: $white;
10
- }
11
-
12
- a {
13
-
14
- &[class*=show-below-] {
15
- display: none;
16
- }
17
- @each $breakpoint_name, $breakpoint in $breakpoints {
18
- &.show-below-#{$breakpoint_name} {
19
- @include break_at($breakpoint) {
20
- display: inline;
21
- }
22
- }
23
- }
24
- }
25
-
26
- .passphrase-label{
27
- margin-right: 4px;
28
- }
29
-
30
- .passphrase-text-input-wrapper {
31
- position: relative;
32
-
33
- .pb_text_input_kit_label {
34
- margin-bottom: 4px;
35
- }
36
-
37
- .passphrase-text-input input{
38
- padding-right: 42px;
39
- }
40
-
41
- .passphrase-text-input .text_input_wrapper {
42
- margin-bottom: 0;
43
- }
44
-
45
- .show-passphrase-icon {
46
- position: absolute;
47
- right: 11px;
48
- top: 11px;
49
-
50
- .hide-icon {
51
- display: none;
52
- }
53
- }
54
- }
55
-
56
- .pb_progress_simple_wrapper, .pb_progress_simple_wrapper_dark {
57
- margin-bottom: 4px;
58
-
59
- &.progress-empty-input {
60
- visibility: hidden;
61
- }
62
- }
63
- }