playbook_ui 14.3.1.pre.alpha.dhhuynh2patch13743 → 14.3.2

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: c4d151e6976dc38aa5b9105255c252c776e2eb50b15858a7dff6ce3c2d7eeeb1
4
- data.tar.gz: c1b3c5d8a8565fcc9ed067b201d392422aa106384c11c0d85d31cc12fb936c83
3
+ metadata.gz: a71ebec22a46e5a072dae9a4ecfbc2582b8778b65f5b3ff612ad60f0c0ede4a1
4
+ data.tar.gz: c21a5e48cd1d2436fc3d2bd3bb5845fa9b5f8095ec79ef865fbc550e9e55a1c0
5
5
  SHA512:
6
- metadata.gz: 8034c25cd01b5c736ecad25b85e8ad8d5e8e522d578e2892077d4337667b1d20dca93d6126064517936b7c00d41f094342fc0a25ada253e2b98f2cbf026151d4
7
- data.tar.gz: b41862c830e4254db3ee6f82989d9619187bbc114278066e9e963dc49373d22245584d056de7291b0738349cb5daac552ac3ca3b62ffd5317ed565f44c9dc4b1
6
+ metadata.gz: 80e2f4a56c6ea0ed1decd054d326c129676e2183e5cf574cffd059e1009bf3e05b733f5b99c0753d449c2a3affc806db45b64684d5c109eb42ea8ff2330ad284
7
+ data.tar.gz: 0e22dea5792988151e1f06850a14373a710635169a092bdf4cacc9e05a23dfce61bd34c23334b42ab919c2085c9a32efe9af44a295acdbdf0301827ac85e3850
@@ -6,6 +6,10 @@ export const showElement = (elem: HTMLElement) => {
6
6
  elem.style.overflow = "hidden"
7
7
  // Once the transition is complete, remove the inline max-height so the content can scale responsively
8
8
  window.setTimeout(() => {
9
+ // If a user toggles multiple times quickly in a row, 'is-visible' can be removed by hideElement's timeout
10
+ if (!elem.classList.contains('is-visible')) {
11
+ elem.classList.add('is-visible')
12
+ }
9
13
  elem.style.height = '';
10
14
  elem.style.overflow = "visible"
11
15
  }, 300);
@@ -323,7 +323,7 @@
323
323
  }
324
324
  .flatpickr-current-month .numInputWrapper {
325
325
  width: 6ch;
326
- width: 7ch;
326
+ width: 7ch\0;
327
327
  display: inline-block;
328
328
  }
329
329
  .flatpickr-current-month .numInputWrapper span.arrowUp:after {
@@ -774,4 +774,4 @@ span.flatpickr-weekday {
774
774
  -webkit-transform: translate3d(0, 0, 0);
775
775
  transform: translate3d(0, 0, 0);
776
776
  }
777
- }
777
+ }
@@ -1,27 +1,28 @@
1
- import React, { forwardRef, isValidElement, useRef } from 'react'
1
+ /*eslint-disable react/no-multi-comp, flowtype/space-before-type-colon */
2
+
3
+ import React, { forwardRef } from 'react'
2
4
  import Body from '../pb_body/_body'
3
- import Flex from '../pb_flex/_flex'
4
5
  import classnames from 'classnames'
5
6
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
6
7
  import { globalProps, GlobalProps } from '../utilities/globalProps'
7
8
 
8
9
  type RadioProps = {
9
- aria?: { [key: string]: string },
10
+ aria?: {[key: string]: string},
10
11
  alignment?: string,
11
12
  checked?: boolean,
12
13
  children?: React.ReactChild[] | React.ReactChild,
13
14
  className?: string,
14
15
  dark?: boolean,
15
- data?: { [key: string]: string },
16
+ data?: {[key: string]: string},
16
17
  disabled?: boolean,
17
18
  error?: boolean,
18
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
19
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
20
  id?: string,
20
21
  label: string,
21
22
  name?: string,
22
23
  value?: string,
23
24
  text?: string,
24
- onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
25
+ onChange: (event: React.FormEvent<HTMLInputElement> | null)=>void,
25
26
  } & GlobalProps
26
27
 
27
28
  const Radio = ({
@@ -30,9 +31,9 @@ const Radio = ({
30
31
  children,
31
32
  className,
32
33
  dark = false,
34
+ data = {},
33
35
  disabled = false,
34
36
  error = false,
35
- data = {},
36
37
  htmlOptions = {},
37
38
  id,
38
39
  label,
@@ -41,103 +42,52 @@ const Radio = ({
41
42
  value = 'radio_text',
42
43
  onChange = () => { void 0 },
43
44
  ...props
44
- }: RadioProps ) => {
45
- const radioRef = useRef(null);
46
-
47
- const ariaProps = buildAriaProps(aria);
48
- const dataProps = buildDataProps(data);
49
- const htmlProps = buildHtmlProps(htmlOptions);
45
+ }: RadioProps, ref: any) => {
46
+ const ariaProps = buildAriaProps(aria)
47
+ const dataProps = buildDataProps(data)
48
+ const htmlProps = buildHtmlProps(htmlOptions)
50
49
  const classes = classnames(
51
- buildCss('pb_radio_kit', alignment),
52
- dark ? 'dark' : null,
53
- error ? 'error' : null,
50
+ buildCss('pb_radio_kit', alignment ),
51
+ dark ? 'dark': null, error ? 'error': null,
54
52
  globalProps(props),
55
- className
56
- );
57
-
58
- const classesCustom = classnames(
59
- dark ? 'dark' : null,
60
- error ? 'error' : null,
61
- globalProps(props),
62
- className
63
- );
64
-
65
- const isCustomChild = children && isValidElement(children) && children.type !== 'input';
53
+ className)
66
54
 
67
55
  const displayRadio = (props: RadioProps & any) => {
68
- if (isValidElement(children) && children.type === 'input') {
69
- return children;
70
- } else if (isCustomChild || !children) {
71
- return (
72
- <input
73
- disabled={disabled}
74
- id={id}
75
- name={name}
76
- onChange={onChange}
77
- ref={radioRef}
78
- text={text}
79
- type="radio"
80
- value={value}
81
- {...props}
82
- />
83
- );
84
- }
85
- };
86
-
87
- const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
88
- if (event) {
89
- const target = event.target as HTMLElement;
90
- if (
91
- target.id === 'pb-radio-children-wrapper' ||
92
- target.closest('#pb-radio-children-wrapper')
93
- ) {
94
- radioRef.current?.click();
95
- }
96
- }
97
- };
56
+ if (children)
57
+ return (children)
58
+ else
59
+ return (
60
+ <input
61
+ disabled={disabled}
62
+ id={id}
63
+ name={name}
64
+ onChange={onChange}
65
+ ref={ref}
66
+ text={text}
67
+ type="radio"
68
+ value={value}
69
+ {...props}
70
+ />
71
+ )}
98
72
 
99
73
  return (
100
- isCustomChild ? (
101
- <Flex
102
- {...ariaProps}
103
- {...dataProps}
104
- {...htmlProps}
105
- align='center'
106
- className={classesCustom}
107
- cursor='pointer'
108
- htmlFor={id}
109
- htmlOptions={{
110
- onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
111
- handleContainerClick(event);
112
- }) as unknown as () => void
113
- }}
114
- id="radio-container"
115
- >
116
- <label className={buildCss('pb_radio_kit', alignment)}>
117
- <>{displayRadio(props)}</>
118
- <span className="pb_radio_button" />
119
- </label>
120
- <div id="pb-radio-children-wrapper"> {children} </div>
121
- </Flex>
122
- ) : (
123
- <label
124
- {...ariaProps}
125
- {...dataProps}
126
- {...htmlProps}
127
- className={classes}
128
- htmlFor={id}
129
- >
130
- <>{displayRadio(props)}</>
131
- <span className="pb_radio_button" />
132
- <Body
133
- dark={dark}
134
- status={error ? 'negative' : null}
135
- text={label}
136
- variant={null}
137
- />
138
- </label>
139
- )
140
- );
141
- };
74
+ <label
75
+ {...ariaProps}
76
+ {...dataProps}
77
+ {...htmlProps}
78
+ className={classes}
79
+ htmlFor={id}
80
+ >
81
+ <>{displayRadio(props)}</>
82
+ <span className="pb_radio_button" />
83
+ <Body
84
+ dark={dark}
85
+ status={error ? 'negative' : null}
86
+ text={label}
87
+ variant={null}
88
+ />
89
+ </label>
90
+ )
91
+ }
142
92
 
143
- export default forwardRef(Radio);
93
+ export default forwardRef(Radio)
@@ -14,7 +14,6 @@ examples:
14
14
  - radio_error: With Error
15
15
  - radio_alignment: Alignment
16
16
  - radio_disabled: Disabled
17
- - radio_children: Children
18
17
 
19
18
  swift:
20
19
  - radio_default_swift: Default
@@ -3,4 +3,3 @@ export { default as RadioCustom } from './_radio_custom.jsx'
3
3
  export { default as RadioError } from './_radio_error.jsx'
4
4
  export { default as RadioAlignment } from './_radio_alignment.jsx'
5
5
  export { default as RadioDisabled } from './_radio_disabled.jsx'
6
- export { default as RadioChildren } from './_radio_children.jsx'
@@ -92,7 +92,6 @@ const Textarea = ({
92
92
  <Caption text={label} />
93
93
  {children || (
94
94
  <textarea
95
- className="pb_textarea_kit"
96
95
  disabled={disabled}
97
96
  name={name}
98
97
  onChange={onChange}
@@ -15,7 +15,6 @@
15
15
  <%= text_area(
16
16
  :object,
17
17
  :method,
18
- :class => "#{object.classname}",
19
18
  :max_characters => object.max_characters,
20
19
  :name => object.name,
21
20
  :onkeyup => object.onkeyup,