playbook_ui 13.15.0.pre.alpha.PLAY10831873 → 13.15.0.pre.alpha.PLAY11311893

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: 5c792af7baba55e98e5f05e45c33104f369267fa1acfa30556f96fb650e21ce4
4
- data.tar.gz: e05765a5b49f1c379dcf111ad9085ecaf012083f673776103489d6eef8674842
3
+ metadata.gz: 18291ca0456980f9a06e2b9c3a910f801022cdf274409cb2cab0934aa8be8776
4
+ data.tar.gz: 2f0d3114f36aadb7baf289ff5409a338128892a719a3fa5181e1ad4930c9df1a
5
5
  SHA512:
6
- metadata.gz: fe584e4c6307e81a122a08406fc7451e6edbd546e4d83677d0521ebe0b4a7b324b632971ecf1818a9a8886e56aeeaea8bb9ca89efc17079907fa4d3e64f4564e
7
- data.tar.gz: f2552261c54ec7d511e0f007ef7067d681eb65345cc2cc442ba3b191067dfba335eabeede5d8cb42e83203c513b491aa3baa62469c40e695ae3a4cc7724b9c42
6
+ metadata.gz: 122b812d9296134396d95761119769934f705cc2ccff6c4fbaddfdda3b62b2b9b1dc4dda5961113c4cfa9c2e388c1ed63b0973d7c55fc8383ea021693d9c0ea0
7
+ data.tar.gz: 0f2977528ef40e2169bdb398a5e47aa9d3afafb0356eb8543dec4bbed9d8f8e038985bfe749835da77ff3db799ffaa2a0047496ac1a7c3a05855394e8cab1e36
@@ -122,9 +122,11 @@ const highchartsDarkTheme: ThemeProps = {
122
122
  // specific to gauge
123
123
  // unfilled gauge color
124
124
  pane: {
125
- background: [{
125
+ background: {
126
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
127
+ // @ts-ignore
126
128
  borderColor: colors.border_dark,
127
- }],
129
+ },
128
130
  },
129
131
 
130
132
  plotOptions: {
@@ -122,9 +122,11 @@ const highchartsTheme: ThemeProps = {
122
122
  // specific to gauge
123
123
  // unfilled gauge color
124
124
  pane: {
125
- background: [{
126
- borderColor: colors.border_light,
127
- }],
125
+ background: {
126
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
127
+ // @ts-ignore
128
+ borderColor: colors.border_light,
129
+ },
128
130
  },
129
131
 
130
132
  plotOptions: {
@@ -2,8 +2,7 @@ import React, { useEffect, useState } from "react";
2
2
  import classnames from "classnames";
3
3
 
4
4
  import { globalProps } from "../utilities/globalProps";
5
- import { buildHtmlProps } from "../utilities/props";
6
- import { VoidCallback } from "../types";
5
+ import { buildHtmlProps } from '../utilities/props'
7
6
 
8
7
  import Icon from "../pb_icon/_icon";
9
8
  import Title from "../pb_title/_title";
@@ -16,23 +15,23 @@ const iconMap = {
16
15
  };
17
16
 
18
17
  type FixedConfirmationToastProps = {
19
- autoClose?: number;
20
- children?: React.ReactChild[] | React.ReactChild;
21
- className?: string;
22
- closeable?: boolean;
23
- data?: string;
24
- horizontal?: "right" | "left" | "center";
25
- htmlOptions?: { [key: string]: string | number | boolean | (VoidCallback) };
26
- id?: string;
27
- multiLine?: boolean;
28
- onClose?: VoidCallback;
29
- open?: boolean;
30
- status?: "success" | "error" | "neutral" | "tip";
31
- text?: string;
32
- vertical?: "top" | "bottom";
33
- };
18
+ autoClose?: number,
19
+ children?: React.ReactChild[] | React.ReactChild,
20
+ className?: string,
21
+ closeable?: boolean,
22
+ data?: string,
23
+ horizontal?: "right" | "left" | "center",
24
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
25
+ id?: string,
26
+ multiLine?: boolean,
27
+ onClose?: () => void,
28
+ open?: boolean,
29
+ status?: "success" | "error" | "neutral" | "tip",
30
+ text?: string,
31
+ vertical?: "top" | "bottom",
32
+ }
34
33
 
35
- const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.ReactElement => {
34
+ const FixedConfirmationToast = (props: FixedConfirmationToastProps) => {
36
35
  const [showToast, toggleToast] = useState(true);
37
36
  const {
38
37
  autoClose = 0,
@@ -42,7 +41,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
42
41
  horizontal,
43
42
  htmlOptions = {},
44
43
  multiLine = false,
45
- onClose = () => undefined,
44
+ onClose = () => { },
46
45
  open = true,
47
46
  status = "neutral",
48
47
  text,
@@ -66,7 +65,7 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
66
65
  onClose();
67
66
  }, autoClose);
68
67
  }
69
- };
68
+ }
70
69
 
71
70
  useEffect(() => {
72
71
  toggleToast(open);
@@ -81,35 +80,22 @@ const FixedConfirmationToast = (props: FixedConfirmationToastProps): React.React
81
80
  return (
82
81
  <>
83
82
  {showToast && (
84
- <div
85
- className={css}
86
- onClick={handleClick}
87
- {...htmlProps}
88
- >
89
- {icon && (
90
- <Icon
91
- className="pb_icon"
92
- fixedWidth
93
- icon={icon}
94
- />
95
- )}
83
+ <div className={css} onClick={handleClick} {...htmlProps}>
84
+ {icon && <Icon className="pb_icon" fixedWidth icon={icon} />}
96
85
 
97
- {(children && children) ||
98
- (text && (
86
+ {
87
+ children && children ||
88
+ text && (
99
89
  <Title
100
- className="pb_fixed_confirmation_toast_text"
101
- size={4}
102
- text={text}
90
+ className="pb_fixed_confirmation_toast_text"
91
+ size={4}
92
+ text={text}
103
93
  />
104
- ))}
94
+ )
95
+ }
105
96
 
106
97
  {closeable && (
107
- <Icon
108
- className="pb_icon"
109
- cursor="pointer"
110
- fixedWidth={false}
111
- icon="times"
112
- />
98
+ <Icon className="pb_icon" cursor="pointer" fixedWidth={false} icon="times" />
113
99
  )}
114
100
  </div>
115
101
  )}
@@ -2,12 +2,12 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { GlobalProps, globalProps } from '../utilities/globalProps'
5
- import { GenericObject, Sizes } from '../types'
5
+ import { Sizes } from '../types'
6
6
 
7
7
  type FlexProps = {
8
8
  children: React.ReactChild[] | React.ReactNode,
9
9
  className?: string,
10
- data?: GenericObject,
10
+ data?: object,
11
11
  horizontal?: "left" | "center" | "right" | "stretch" | "none",
12
12
  justify?: "start" | "center" | "end" | "around" | "between" | "evenly" | "none",
13
13
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -25,7 +25,7 @@ type FlexProps = {
25
25
  alignSelf?: "start" | "end" | "center" | "stretch" | "none"
26
26
  } & GlobalProps
27
27
 
28
- const Flex = (props: FlexProps): React.ReactElement => {
28
+ const Flex = (props: FlexProps) => {
29
29
  const {
30
30
  align = 'none',
31
31
  children,
@@ -45,7 +45,7 @@ const Flex = (props: FlexProps): React.ReactElement => {
45
45
  wrap = false,
46
46
  alignSelf = 'none',
47
47
  } = props
48
-
48
+
49
49
  const orientationClass =
50
50
  orientation !== undefined ? `orientation_${orientation}` : ''
51
51
  const justifyClass =
@@ -2,19 +2,18 @@ import React from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
4
  import { globalProps } from '../utilities/globalProps'
5
- import { GenericObject } from '../types'
6
5
 
7
6
  type FormGroupProps = {
8
7
  aria?: {[key: string]: string},
9
8
  children?: Node,
10
9
  className?: string,
11
- data?: GenericObject,
10
+ data?: object,
12
11
  fullWidth?: boolean,
13
12
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
14
13
  id?: string,
15
14
  }
16
15
 
17
- const FormGroup = (props: FormGroupProps): React.ReactElement => {
16
+ const FormGroup = (props: FormGroupProps) => {
18
17
  const {
19
18
  aria = {},
20
19
  className,
@@ -22,16 +22,16 @@ type FormPillProps = {
22
22
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
23
23
  onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
24
24
  onTouchEnd?: React.TouchEventHandler<HTMLSpanElement>,
25
- },
25
+ },
26
26
  } & GlobalProps
27
- const FormPill = (props: FormPillProps): React.ReactElement => {
27
+ const FormPill = (props: FormPillProps) => {
28
28
  const {
29
29
  className,
30
30
  htmlOptions = {},
31
31
  id,
32
32
  text,
33
33
  name,
34
- onClick = () => undefined,
34
+ onClick = () => {},
35
35
  avatarUrl,
36
36
  closeProps = {},
37
37
  size = '',
@@ -48,10 +48,7 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
48
48
  const htmlProps = buildHtmlProps(htmlOptions)
49
49
 
50
50
  return (
51
- <div className={css}
52
- id={id}
53
- {...htmlProps}
54
- >
51
+ <div className={css} id={id} {...htmlProps}>
55
52
  {name &&
56
53
  <>
57
54
  <Avatar
@@ -12,13 +12,12 @@ import typography from "../tokens/exports/_typography.scss";
12
12
 
13
13
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
14
14
  import { globalProps } from "../utilities/globalProps";
15
- import { GenericObject } from "../types";
16
15
 
17
16
  type GaugeProps = {
18
17
  aria: { [key: string]: string };
19
18
  className?: string;
20
19
  chartData?: { name: string; value: number[] | number }[];
21
- dark?: boolean;
20
+ dark?: Boolean;
22
21
  data?: { [key: string]: string };
23
22
  disableAnimation?: boolean;
24
23
  fullCircle?: boolean;
@@ -34,12 +33,13 @@ type GaugeProps = {
34
33
  title?: string;
35
34
  tooltipHtml?: string;
36
35
  colors: string[];
37
- minorTickInterval?: number;
36
+ minorTickInterval: any;
38
37
  circumference: number[];
39
38
  };
40
39
 
41
40
  const Gauge = ({
42
41
  aria = {},
42
+ className,
43
43
  chartData,
44
44
  dark = false,
45
45
  data = {},
@@ -61,9 +61,9 @@ const Gauge = ({
61
61
  minorTickInterval = null,
62
62
  circumference = fullCircle ? [0, 360] : [-100, 100],
63
63
  ...props
64
- }: GaugeProps): React.ReactElement => {
64
+ }: GaugeProps) => {
65
65
  const ariaProps = buildAriaProps(aria);
66
- const dataProps = buildDataProps(data)
66
+ const dataProps = buildDataProps(data)
67
67
  const htmlProps = buildHtmlProps(htmlOptions);
68
68
  highchartsMore(Highcharts);
69
69
  solidGauge(Highcharts);
@@ -89,7 +89,7 @@ const Gauge = ({
89
89
  const [options, setOptions] = useState({});
90
90
 
91
91
  useEffect(() => {
92
- const formattedChartData = chartData.map((obj: GenericObject) => {
92
+ const formattedChartData = chartData.map((obj: any) => {
93
93
  obj.y = obj.value;
94
94
  delete obj.value;
95
95
  return obj;
@@ -185,20 +185,20 @@ const Gauge = ({
185
185
  .querySelectorAll(".fix")
186
186
  .forEach((fix) => fix.setAttribute("y", "38"));
187
187
  }
188
- // eslint-disable-next-line react-hooks/exhaustive-deps
188
+
189
189
  }, [chartData]);
190
190
 
191
191
  return (
192
192
  <HighchartsReact
193
- containerProps={{
193
+ containerProps={{
194
194
  className: classnames(css, globalProps(props)),
195
195
  id: id,
196
196
  ...ariaProps,
197
197
  ...dataProps,
198
198
  ...htmlProps,
199
199
  }}
200
- highcharts={Highcharts}
201
- options={options}
200
+ highcharts={Highcharts}
201
+ options={options}
202
202
  />
203
203
  );
204
204
  };
@@ -8,7 +8,6 @@ import Body from '../pb_body/_body'
8
8
  import Hashtag from '../pb_hashtag/_hashtag'
9
9
  import Title from '../pb_title/_title'
10
10
  import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
11
- import { GenericObject } from '../types'
12
11
 
13
12
  type HomeAddressStreetProps = {
14
13
  aria?: { [key: string]: string },
@@ -29,7 +28,7 @@ type HomeAddressStreetProps = {
29
28
  territory: string,
30
29
  }
31
30
 
32
- const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement => {
31
+ const HomeAddressStreet = (props: HomeAddressStreetProps) => {
33
32
  const {
34
33
  address,
35
34
  addressCont,
@@ -59,17 +58,17 @@ const HomeAddressStreet = (props: HomeAddressStreetProps): React.ReactElement =>
59
58
  className
60
59
  )
61
60
 
62
- const dataProps: GenericObject = buildDataProps(data)
63
- const ariaProps: GenericObject = buildAriaProps(aria)
61
+ const dataProps: { [key: string]: any } = buildDataProps(data)
62
+ const ariaProps: { [key: string]: any } = buildAriaProps(aria)
64
63
  const htmlProps = buildHtmlProps(htmlOptions)
65
64
  return (
66
- <div
67
- className={classes(className, dark)}
68
- {...ariaProps}
69
- {...dataProps}
70
- {...htmlProps}
65
+ <div
66
+ className={classes(className, dark)}
67
+ {...ariaProps}
68
+ {...dataProps}
69
+ {...htmlProps}
71
70
  >
72
- {emphasis == 'street' &&
71
+ {emphasis == 'street' &&
73
72
  <div>
74
73
  <Title
75
74
  className="pb_home_address_street_address"
@@ -9,12 +9,11 @@ import Caption from '../pb_caption/_caption'
9
9
  import Flex from '../pb_flex/_flex'
10
10
  import IconCircle from '../pb_icon_circle/_icon_circle'
11
11
  import Title from '../pb_title/_title'
12
- import { GenericObject } from '../types'
13
12
 
14
13
  type IconStatValueProps = {
15
14
  aria?: { [key: string]: string },
16
15
  className?: string,
17
- data?: GenericObject,
16
+ data?: object,
18
17
  dark?: boolean,
19
18
  icon: string,
20
19
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
@@ -35,7 +34,7 @@ type IconStatValueProps = {
35
34
  | "green",
36
35
  }
37
36
 
38
- const IconStatValue = (props: IconStatValueProps): React.ReactElement => {
37
+ const IconStatValue = (props: IconStatValueProps) => {
39
38
  const {
40
39
  aria = {},
41
40
  className,
@@ -6,21 +6,20 @@ import { globalProps } from '../utilities/globalProps'
6
6
 
7
7
  import Body from '../pb_body/_body'
8
8
  import Icon from '../pb_icon/_icon'
9
- import { GenericObject } from '../types'
10
9
 
11
10
  type IconValueProps = {
12
11
  align?: "left" | "center" | "right",
13
12
  aria?: { [key: string]: string; },
14
13
  className?: string,
15
14
  dark?: boolean,
16
- data?: GenericObject,
15
+ data?: object,
17
16
  icon: string,
18
17
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
19
18
  id?: string,
20
19
  text: string,
21
20
  }
22
21
 
23
- const IconValue = (props: IconValueProps): React.ReactElement => {
22
+ const IconValue = (props: IconValueProps) => {
24
23
  const {
25
24
  align = 'left',
26
25
  aria = {},
@@ -102,20 +102,29 @@
102
102
  pointer-events: none;
103
103
  }
104
104
  &.inline {
105
+ @mixin active_arrow_style {
106
+ svg {
107
+ color: $primary !important;
108
+ font-size: 16px;
109
+ }
110
+ }
105
111
  &:not(:hover) {
106
112
  svg {
107
113
  display: none;
108
114
  }
109
115
  }
116
+ &.show_arrow:not(:hover) {
117
+ svg {
118
+ display: block;
119
+ }
120
+ @include active_arrow_style();
121
+ }
110
122
  &:hover {
123
+ @include active_arrow_style();
111
124
  select {
112
125
  color: $primary !important;
113
126
  background: rgba(0,130,255,0.1);
114
127
  }
115
- svg {
116
- color: $primary !important;
117
- font-size: 16px;
118
- }
119
128
  }
120
129
  select {
121
130
  box-shadow: none;
@@ -36,6 +36,7 @@ type SelectProps = {
36
36
  onChange: InputCallback<HTMLSelectElement>,
37
37
  options: SelectOption[],
38
38
  required?: boolean,
39
+ showArrow?: boolean,
39
40
  value?: string,
40
41
  } & GlobalProps
41
42
 
@@ -63,9 +64,10 @@ const Select = ({
63
64
  inline = false,
64
65
  multiple = false,
65
66
  name,
66
- onChange = () => {},
67
+ onChange = () => undefined,
67
68
  options = [],
68
69
  required = false,
70
+ showArrow = false,
69
71
  value,
70
72
  ...props
71
73
  }: SelectProps, ref: React.LegacyRef<HTMLSelectElement>) => {
@@ -77,15 +79,16 @@ const Select = ({
77
79
  const inlineClass = inline ? 'inline' : null
78
80
  const compactClass = compact ? 'compact' : null
79
81
  const classes = classnames(
80
- buildCss('pb_select'),
82
+ buildCss("pb_select"),
81
83
  globalProps({
82
84
  ...props,
83
- marginBottom: props.marginBottom || props.margin || 'sm',
85
+ marginBottom: props.marginBottom || props.margin || "sm",
84
86
  }),
85
87
  className,
86
88
  inlineClass,
89
+ { show_arrow: showArrow },
87
90
  compactClass
88
- )
91
+ );
89
92
 
90
93
  const selectWrapperClass = classnames(buildCss('pb_select_kit_wrapper'), { error }, className)
91
94
  const selectBody =(() =>{
@@ -0,0 +1,24 @@
1
+ <%= pb_rails("select", props: {
2
+ label: "Favorite Food",
3
+ name: "food",
4
+ inline: true,
5
+ options: [
6
+ {
7
+ value: "1",
8
+ value_text: "Burgers",
9
+ },
10
+ {
11
+ value: "2",
12
+ value_text: "Pizza",
13
+ },
14
+ {
15
+ value: "3",
16
+ value_text: "Tacos",
17
+ },
18
+ {
19
+ value: "4",
20
+ value_text: "BBQ",
21
+ },
22
+ ],
23
+ show_arrow: true
24
+ }) %>
@@ -0,0 +1,38 @@
1
+ import React from 'react'
2
+ import { Body, Select } from '../..'
3
+
4
+ const SelectInlineShowArrow = (props) => {
5
+ const options = [
6
+ {
7
+ value: '1',
8
+ text: 'Burgers',
9
+ },
10
+ {
11
+ value: '2',
12
+ text: 'Pizza',
13
+ },
14
+ {
15
+ value: '3',
16
+ text: 'Tacos',
17
+ },
18
+ ]
19
+
20
+ return (
21
+ <div>
22
+ <Select
23
+ inline
24
+ label="Favorite Food"
25
+ name="food"
26
+ options={options}
27
+ showArrow
28
+ {...props}
29
+ />
30
+ <Body
31
+ status="negative"
32
+ {...props}
33
+ />
34
+ </div>
35
+ )
36
+ }
37
+
38
+ export default SelectInlineShowArrow
@@ -10,6 +10,7 @@ examples:
10
10
  - select_custom_select: Custom Select
11
11
  - select_error: Select w/ Error
12
12
  - select_inline: Select Inline
13
+ - select_inline_show_arrow: Select Inline (Always Show Arrow)
13
14
  - select_inline_compact: Select Inline Compact
14
15
  - select_attributes: Select W/ Attributes
15
16
  - select_multiple: Select Multiple
@@ -26,6 +27,7 @@ examples:
26
27
  - select_custom_select: Custom Select
27
28
  - select_error: Select w/ Error
28
29
  - select_inline: Select Inline
30
+ - select_inline_show_arrow: Select Inline (Always Show Arrow)
29
31
  - select_inline_compact: Select Inline Compact
30
32
  - select_multiple: Select Multiple
31
33
 
@@ -7,5 +7,6 @@ export { default as SelectCustomSelect } from './_select_custom_select.jsx'
7
7
  export { default as SelectValueTextSame } from './_select_value_text_same.jsx'
8
8
  export { default as SelectError } from './_select_error.jsx'
9
9
  export { default as SelectInline } from './_select_inline.jsx'
10
+ export { default as SelectInlineShowArrow } from './_select_inline_show_arrow.jsx'
10
11
  export { default as SelectInlineCompact } from './_select_inline_compact.jsx'
11
12
  export { default as SelectMultiple } from './_select_multiple.jsx'
@@ -19,10 +19,11 @@ module Playbook
19
19
  prop :name
20
20
  prop :onchange
21
21
  prop :options, type: Playbook::Props::HashArray, required: false, default: []
22
+ prop :show_arrow, type: Playbook::Props::Boolean, default: false
22
23
  prop :required, type: Playbook::Props::Boolean, default: false
23
24
 
24
25
  def classnames
25
- classname + inline_class + compact_class
26
+ classname + inline_class + compact_class + show_arrow_class
26
27
  end
27
28
 
28
29
  def all_attributes
@@ -49,6 +50,10 @@ module Playbook
49
50
  compact ? "compact" : ""
50
51
  end
51
52
 
53
+ def show_arrow_class
54
+ show_arrow ? "show_arrow" : ""
55
+ end
56
+
52
57
  def select_wrapper_class
53
58
  "pb_select_kit_wrapper" + error_class
54
59
  end