playbook_ui 11.4.0.pre.alpha.rubytheme2 → 11.5.0.pre.alpha.datepicker1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/data/menu.yml +0 -13
  3. data/app/pb_kits/playbook/pb_badge/badge.test.js +80 -0
  4. data/app/pb_kits/playbook/pb_button/_button.tsx +7 -2
  5. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +7 -0
  6. data/app/pb_kits/playbook/pb_button/button.html.erb +11 -0
  7. data/app/pb_kits/playbook/pb_button/button.rb +3 -0
  8. data/app/pb_kits/playbook/pb_button/button.test.js +6 -8
  9. data/app/pb_kits/playbook/pb_button/docs/_button_block_content.html.erb +1 -1
  10. data/app/pb_kits/playbook/pb_button/docs/_button_block_content.jsx +12 -9
  11. data/app/pb_kits/playbook/pb_button/docs/_button_block_content.md +1 -0
  12. data/app/pb_kits/playbook/pb_button/docs/_button_icon_options.html.erb +2 -0
  13. data/app/pb_kits/playbook/pb_button/docs/_button_icon_options.jsx +23 -0
  14. data/app/pb_kits/playbook/pb_button/docs/_button_icon_options.md +1 -0
  15. data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
  16. data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
  17. data/app/pb_kits/playbook/pb_date_picker/_date_picker.jsx +13 -1
  18. data/app/pb_kits/playbook/pb_date_picker/_date_picker.scss +24 -19
  19. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +1 -1
  20. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +9 -0
  21. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.js +25 -3
  22. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions.html.erb +44 -0
  23. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions.jsx +60 -0
  24. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions.md +9 -0
  25. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions_element.html.erb +33 -0
  26. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_positions_element.jsx +67 -0
  27. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +4 -0
  28. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +2 -0
  29. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_flatpickr_styles.scss +0 -3
  30. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +4 -4
  31. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +142 -0
  32. data/app/pb_kits/playbook/pb_date_range_inline/date_range_inline.test.js +116 -0
  33. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default.jsx +1 -1
  34. data/app/pb_kits/playbook/pb_date_year_stacked/{_date_year_stacked.jsx → _date_year_stacked.tsx} +6 -6
  35. data/app/pb_kits/playbook/pb_date_year_stacked/date_year_stacked.test.js +67 -0
  36. data/app/pb_kits/playbook/pb_file_upload/{_file_upload.jsx → _file_upload.tsx} +6 -10
  37. data/app/pb_kits/playbook/pb_filter/Filter/FilterDouble.jsx +2 -0
  38. data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.jsx +2 -0
  39. data/app/pb_kits/playbook/pb_filter/Filter/FiltersPopover.jsx +2 -2
  40. data/app/pb_kits/playbook/pb_filter/docs/_filter_min_width.html.erb +1 -0
  41. data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.html.erb +34 -0
  42. data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.jsx +66 -0
  43. data/app/pb_kits/playbook/pb_filter/docs/_filter_placement.md +4 -0
  44. data/app/pb_kits/playbook/pb_filter/docs/example.yml +2 -0
  45. data/app/pb_kits/playbook/pb_filter/docs/index.js +1 -0
  46. data/app/pb_kits/playbook/pb_filter/filter.html.erb +2 -2
  47. data/app/pb_kits/playbook/pb_filter/filter.rb +3 -0
  48. data/app/pb_kits/playbook/pb_filter/filter.test.js +76 -0
  49. data/app/pb_kits/playbook/pb_form_group/{_form_group.jsx → _form_group.tsx} +1 -4
  50. data/app/pb_kits/playbook/pb_form_group/form_group.test.js +17 -0
  51. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +129 -0
  52. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.jsx +1 -1
  53. data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_emphasis.jsx +2 -2
  54. data/app/pb_kits/playbook/pb_home_address_street/home_adress_street.test.js +60 -0
  55. data/app/pb_kits/playbook/pb_icon_stat_value/{_icon_stat_value.jsx → _icon_stat_value.tsx} +2 -4
  56. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +154 -0
  57. data/app/pb_kits/playbook/pb_icon_value/{_icon_value.jsx → _icon_value.tsx} +2 -4
  58. data/app/pb_kits/playbook/pb_icon_value/icon_value.test.js +77 -0
  59. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +123 -0
  60. data/app/pb_kits/playbook/pb_label_value/label_value.test.js +109 -0
  61. data/app/pb_kits/playbook/pb_layout/{_layout.jsx → _layout.tsx} +13 -19
  62. data/app/pb_kits/playbook/pb_layout/layout.test.js +97 -0
  63. data/app/pb_kits/playbook/pb_lightbox/lightbox.test.jsx +23 -15
  64. data/app/pb_kits/playbook/pb_popover/popover.rb +1 -1
  65. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +0 -1
  66. data/app/pb_kits/playbook/pb_timestamp/_timestamp.jsx +5 -2
  67. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.html.erb +9 -0
  68. data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.jsx +10 -0
  69. data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +4 -1
  70. data/app/pb_kits/playbook/pb_timestamp/timestamp.test.js +164 -0
  71. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +0 -4
  72. data/app/pb_kits/playbook/pb_tooltip/tooltip.test.jsx +11 -8
  73. data/app/pb_kits/playbook/utilities/_flexbox.scss +11 -11
  74. data/app/pb_kits/playbook/utilities/{_align_content.scss → flexbox_global_props/_align_content.scss} +0 -0
  75. data/app/pb_kits/playbook/utilities/{_align_items.scss → flexbox_global_props/_align_items.scss} +0 -0
  76. data/app/pb_kits/playbook/utilities/{_align_self.scss → flexbox_global_props/_align_self.scss} +0 -0
  77. data/app/pb_kits/playbook/utilities/{_flex.scss → flexbox_global_props/_flex.scss} +0 -0
  78. data/app/pb_kits/playbook/utilities/{_flex_direction.scss → flexbox_global_props/_flex_direction.scss} +0 -0
  79. data/app/pb_kits/playbook/utilities/{_flex_grow.scss → flexbox_global_props/_flex_grow.scss} +0 -0
  80. data/app/pb_kits/playbook/utilities/{_flex_shrink.scss → flexbox_global_props/_flex_shrink.scss} +0 -0
  81. data/app/pb_kits/playbook/utilities/{_flex_wrap.scss → flexbox_global_props/_flex_wrap.scss} +0 -0
  82. data/app/pb_kits/playbook/utilities/{_justify_content.scss → flexbox_global_props/_justify_content.scss} +0 -0
  83. data/app/pb_kits/playbook/utilities/{_justify_self.scss → flexbox_global_props/_justify_self.scss} +0 -0
  84. data/app/pb_kits/playbook/utilities/{_order.scss → flexbox_global_props/_order.scss} +0 -0
  85. data/app/pb_kits/playbook/utilities/props.ts +1 -1
  86. data/app/pb_kits/playbook/utilities/test-utils.js +2 -3
  87. data/app/pb_kits/playbook/utilities/text.ts +1 -1
  88. data/lib/playbook/version.rb +2 -2
  89. metadata +46 -23
  90. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.jsx +0 -155
  91. data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.jsx +0 -127
  92. data/app/pb_kits/playbook/pb_label_value/_label_value.jsx +0 -155
@@ -1,155 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import classnames from 'classnames'
5
-
6
- import { globalProps } from '../utilities/globalProps'
7
- import { buildCss } from '../utilities/props'
8
- import DateTime from '../pb_kit/dateTime'
9
-
10
- import Body from '../pb_body/_body'
11
- import Caption from '../pb_caption/_caption'
12
- import Icon from '../pb_icon/_icon'
13
-
14
- type DateRangeInlineProps = {
15
- className?: string,
16
- id?: string,
17
- data?: string,
18
- align?: "left" | "center" | "vertical",
19
- size?: "sm" | "xs",
20
- dark?: boolean,
21
- icon?: boolean,
22
- startDate?: date,
23
- endDate?: date
24
- }
25
-
26
- const dateTimestamp = (dateValue, includeYear) => {
27
- const date = new DateTime({ value: dateValue })
28
- if (includeYear) {
29
- return `${date.toMonth()} ${date.toDay()}, ${date.toYear()}`
30
- } else {
31
- return `${date.toMonth()} ${date.toDay()}`
32
- }
33
- }
34
-
35
- const dateTimeIso = (dateValue) => {
36
- const date = new DateTime({ value: dateValue })
37
- return date.toIso()
38
- }
39
-
40
- const DateRangeInline = (props: DateRangeInlineProps) => {
41
- const {
42
- icon = false,
43
- dark = false,
44
- size = 'sm',
45
- align = 'left',
46
- startDate,
47
- endDate,
48
- className,
49
- } = props
50
-
51
- const iconContent = () => {
52
- return (
53
- <If condition={icon}>
54
- <Body
55
- color="light"
56
- key={Math.random()}
57
- tag="span"
58
- >
59
- <Icon
60
- className="pb_date_range_inline_icon"
61
- dark={dark}
62
- fixedWidth
63
- icon="calendar-alt"
64
- size={size}
65
- tag="span"
66
- />
67
- </Body>
68
- </If>
69
- )
70
- }
71
-
72
- const dateInCurrentYear = () => {
73
- const currentDate = new Date()
74
- return startDate.getFullYear() == endDate.getFullYear() && startDate.getFullYear() == currentDate.getFullYear()
75
- }
76
-
77
- const dateRangeClasses = buildCss('pb_date_range_inline_kit', align)
78
-
79
- const renderTime = (date) => {
80
- return (
81
- <time dateTime={dateTimeIso(date)}>
82
- <Choose>
83
- <When condition={dateInCurrentYear()}>
84
- {` ${dateTimestamp(date, false)} `}
85
- </When>
86
- <Otherwise>
87
- {` ${dateTimestamp(date, true)} `}
88
- </Otherwise>
89
- </Choose>
90
- </time>
91
- )
92
- }
93
-
94
- return (
95
- <div className={classnames(dateRangeClasses, globalProps(props), className)}>
96
- <div className="pb_date_range_inline_wrapper">
97
- <If condition={size == 'xs'}>
98
- {iconContent()}
99
- <Caption
100
- dark={dark}
101
- tag="span"
102
- >
103
- {renderTime(startDate)}
104
- </Caption>
105
- <Caption
106
- dark={dark}
107
- tag="span"
108
- >
109
- <Icon
110
- className="pb_date_range_inline_arrow"
111
- fixedWidth
112
- icon="long-arrow-right"
113
- />
114
- </Caption>
115
- <Caption
116
- dark={dark}
117
- tag="span"
118
- >
119
- {renderTime(endDate)}
120
- </Caption>
121
- </If>
122
-
123
- <If condition={size == 'sm'}>
124
- {iconContent()}
125
- <Body
126
- dark={dark}
127
- tag="span"
128
- >
129
- {renderTime(startDate)}
130
- </Body>
131
- <Body
132
- color="light"
133
- dark={dark}
134
- tag="span"
135
- >
136
- <Icon
137
- className="pb_date_range_inline_arrow"
138
- dark={dark}
139
- fixedWidth
140
- icon="long-arrow-right"
141
- />
142
- </Body>
143
- <Body
144
- dark={dark}
145
- tag="span"
146
- >
147
- {renderTime(endDate)}
148
- </Body>
149
- </If>
150
- </div>
151
- </div>
152
- )
153
- }
154
-
155
- export default DateRangeInline
@@ -1,127 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import classnames from 'classnames'
5
-
6
- import { joinPresent, titleize } from '../utilities/text'
7
- import { globalProps } from '../utilities/globalProps'
8
-
9
- import Body from '../pb_body/_body'
10
- import Hashtag from '../pb_hashtag/_hashtag'
11
- import Title from '../pb_title/_title'
12
-
13
- type HomeAddressStreetProps = {
14
- address: string,
15
- addressCont: string,
16
- city: string,
17
- className?: string,
18
- dark?: boolean,
19
- emphasis: "street" | "city",
20
- homeId: number,
21
- houseStyle: string,
22
- homeUrl: string,
23
- newWindow: Boolean,
24
- state: string,
25
- zipcode: string,
26
- territory: string,
27
- }
28
-
29
- const HomeAddressStreet = (props: HomeAddressStreetProps) => {
30
- const {
31
- address,
32
- addressCont,
33
- city,
34
- className,
35
- dark = false,
36
- emphasis = 'street',
37
- homeId,
38
- homeUrl,
39
- newWindow,
40
- houseStyle,
41
- state,
42
- zipcode,
43
- territory,
44
- } = props
45
-
46
- const classes = (className, dark) =>
47
- classnames(
48
- {
49
- 'pb_home_address_street': !dark,
50
- 'pb_home_address_street_dark': dark,
51
- },
52
- globalProps(props),
53
- className
54
- )
55
- return (
56
- <div className={classes(className, dark)}>
57
- {
58
- <Choose>
59
- <When condition={emphasis == 'street'}>
60
- <div>
61
- <Title
62
- className="pb_home_address_street_address"
63
- dark={dark}
64
- size={4}
65
- >
66
- {joinPresent([titleize(address), houseStyle], ' · ')}
67
- </Title>
68
- <Title
69
- className="pb_home_address_street_address"
70
- dark={dark}
71
- size={4}
72
- >
73
- {titleize(addressCont)}
74
- </Title>
75
- <Body color="light">
76
- {`${titleize(city)}, ${state} ${zipcode}`}
77
- </Body>
78
- </div>
79
- </When>
80
- <When condition={emphasis == 'city'}>
81
- <div>
82
- <Body color="light">
83
- {joinPresent([titleize(address), houseStyle], ' · ')}
84
- </Body>
85
- <Body color="light">{titleize(addressCont)}</Body>
86
- <div>
87
- <Title
88
- className="pb_home_address_street_address"
89
- dark={dark}
90
- size={4}
91
- tag="span"
92
- >
93
- {`${titleize(city)}, ${state}`}
94
- </Title>
95
- <Body
96
- color="light"
97
- tag="span"
98
- >
99
- {` ${zipcode}`}
100
- </Body>
101
- </div>
102
- </div>
103
- </When>
104
- </Choose>
105
- }
106
-
107
- <If condition={homeId}>
108
- <Hashtag
109
- classname="home-hashtag"
110
- dark={dark}
111
- newWindow={newWindow}
112
- text={homeId}
113
- type="home"
114
- url={homeUrl || '#'}
115
- />
116
- </If>
117
- <Body
118
- color="light"
119
- tag="span"
120
- >
121
- <small>{territory}</small>
122
- </Body>
123
- </div>
124
- )
125
- }
126
-
127
- export default HomeAddressStreet
@@ -1,155 +0,0 @@
1
- /* @flow */
2
-
3
- import React from 'react'
4
- import classnames from 'classnames'
5
- import DateTime from '../pb_kit/dateTime'
6
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
7
- import { globalProps } from '../utilities/globalProps'
8
-
9
- import Body from '../pb_body/_body'
10
- import Caption from '../pb_caption/_caption'
11
- import Flex from '../pb_flex/_flex'
12
- import Icon from '../pb_icon/_icon'
13
- import Title from '../pb_title/_title'
14
-
15
- type LabelValueProps = {
16
- active?: boolean,
17
- aria?: object,
18
- className?: string,
19
- dark?: boolean,
20
- data?: object,
21
- date?: date,
22
- id?: string,
23
- label: string,
24
- value?: string,
25
- variant?: "default" | "details",
26
- icon?: string,
27
- description?: string,
28
- title?: string,
29
- }
30
-
31
- const dateString = (value: DateTime) => {
32
- const month = value.toMonthNum()
33
- const day = value.toDay()
34
-
35
- return ` · ${month}/${day}`
36
- }
37
-
38
- const LabelValue = (props: LabelValueProps) => {
39
- const {
40
- active = false,
41
- aria = {},
42
- className,
43
- dark = false,
44
- data = {},
45
- date,
46
- description,
47
- icon,
48
- id,
49
- label,
50
- title,
51
- value,
52
- variant = 'default',
53
- } = props
54
-
55
- const ariaProps = buildAriaProps(aria)
56
- const dataProps = buildDataProps(data)
57
- const formattedDate = new DateTime({ value: date })
58
- const variantClass = variant === 'details' ? 'details' : ''
59
- const classes = classnames(buildCss('pb_label_value_kit', variantClass), globalProps(props), className)
60
-
61
- return (
62
- <div
63
- {...ariaProps}
64
- {...dataProps}
65
- className={classes}
66
- description={description}
67
- icon={icon}
68
- id={id}
69
- title={title}
70
- >
71
- <Caption
72
- dark={dark}
73
- text={label}
74
- />
75
- <If condition={variant === 'details'}>
76
- <Flex
77
- inline
78
- vertical="center"
79
- >
80
- <If condition={icon}>
81
- <Body
82
- color="light"
83
- dark={dark}
84
- marginRight="xs"
85
- >
86
- <Icon
87
- dark={dark}
88
- fixedWidth
89
- icon={icon}
90
- />
91
- </Body>
92
- </If>
93
- <If condition={description}>
94
- <Body
95
- color="light"
96
- dark={dark}
97
- marginRight="xs"
98
- text={description}
99
- />
100
- </If>
101
- <Choose>
102
- <When condition={active === true}>
103
- <Flex
104
- inline
105
- vertical="center"
106
- >
107
- <If condition={title}>
108
- <Title
109
- dark={dark}
110
- size={4}
111
- text={title}
112
- variant="link"
113
- />
114
- </If>
115
- <If condition={date}>
116
- <Title
117
- dark={dark}
118
- marginLeft="xs"
119
- size={4}
120
- text={' ' + dateString(formattedDate)}
121
- variant="link"
122
- />
123
- </If>
124
- </Flex>
125
- </When>
126
- <Otherwise>
127
- <If condition={title}>
128
- <Title
129
- dark={dark}
130
- size={4}
131
- text={title}
132
- />
133
- </If>
134
- <If condition={date}>
135
- <Title
136
- dark={dark}
137
- marginLeft="xs"
138
- size={4}
139
- text={' ' + dateString(formattedDate)}
140
- />
141
- </If>
142
- </Otherwise>
143
- </Choose>
144
- </Flex>
145
- <Else />
146
- <Body
147
- dark={dark}
148
- text={value}
149
- />
150
- </If>
151
- </div>
152
- )
153
- }
154
-
155
- export default LabelValue