playbook_ui 9.16.0 → 9.17.0.pre.decouple.website2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +5 -9
  3. data/app/pb_kits/playbook/_reset.scss +42 -0
  4. data/app/pb_kits/playbook/index.js +97 -97
  5. data/app/pb_kits/playbook/pb_date_picker/sass_partials/_header_styles.scss +2 -1
  6. data/app/pb_kits/playbook/pb_enhanced_element/index.js +2 -1
  7. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +2 -2
  8. data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.jsx +10 -8
  9. data/app/pb_kits/playbook/pb_select/_select.scss +1 -1
  10. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
  11. data/app/pb_kits/playbook/pb_textarea/_textarea.scss +3 -3
  12. data/app/pb_kits/playbook/pb_title/_title.scss +1 -1
  13. data/app/pb_kits/playbook/pb_title/_title_mixin.scss +1 -40
  14. data/app/pb_kits/playbook/pb_typeahead/_typeahead.jsx +14 -15
  15. data/app/pb_kits/playbook/playbook-doc.js +195 -0
  16. data/app/pb_kits/playbook/playbook-rails-react-bindings.js +35 -0
  17. data/app/pb_kits/playbook/{vendor.js → playbook-rails.js} +1 -5
  18. data/app/pb_kits/playbook/tokens/_colors.scss +4 -0
  19. data/app/pb_kits/playbook/tokens/_titles.scss +38 -0
  20. data/app/pb_kits/playbook/utilities/_colors.scss +0 -4
  21. data/lib/playbook.rb +1 -15
  22. data/lib/playbook/engine.rb +11 -21
  23. data/lib/playbook/props/nested_props.rb +1 -1
  24. data/lib/playbook/version.rb +2 -2
  25. metadata +20 -135
  26. data/app/assets/images/clark.jpg +0 -0
  27. data/app/assets/images/full_page_samples.svg +0 -7
  28. data/app/assets/images/giant.jpg +0 -0
  29. data/app/assets/images/github-brands.svg +0 -1
  30. data/app/assets/images/landing-background.svg +0 -36
  31. data/app/assets/images/landing-image.svg +0 -203
  32. data/app/assets/images/pb-caret.svg +0 -1
  33. data/app/assets/images/pb-check.svg +0 -11
  34. data/app/assets/images/pb-logo.svg +0 -28
  35. data/app/assets/images/pb-white-logo.svg +0 -15
  36. data/app/assets/images/pb.logo.svg +0 -28
  37. data/app/pb_kits/playbook/react_rails_kits.js +0 -13
  38. data/app/pb_kits/playbook/utilities/accessibility.js +0 -22
@@ -4,7 +4,7 @@ import React from 'react'
4
4
  import Select from 'react-select'
5
5
  import AsyncSelect from 'react-select/async'
6
6
  import CreateableSelect from 'react-select/creatable'
7
- import { get } from 'lodash'
7
+ import { get, isString, uniqueId } from 'lodash'
8
8
  import { globalProps } from '../utilities/globalProps.js'
9
9
  import classnames from 'classnames'
10
10
 
@@ -26,23 +26,24 @@ import { noop } from '../utilities/props'
26
26
  * @prop {string} label - the text for the optional typeahead input label
27
27
  */
28
28
 
29
- type Props = {
29
+ type TypeaheadProps = {
30
+ id?: string,
30
31
  async?: boolean,
31
32
  createable?: boolean,
32
33
  dark?: boolean,
33
34
  label?: string,
34
- loadOptions?: noop | string,
35
- getOptionLabel?: () => any,
36
- getOptionValue?: () => any,
35
+ loadOptions?: string,
36
+ getOptionLabel?: string | (() => any),
37
+ getOptionValue?: string | (() => any),
37
38
  name?: string,
38
39
  }
39
40
 
40
41
  /**
41
42
  * @constant {React.ReactComponent} Typeahead
42
- * @param {Props} props - props as described at https://react-select.com/props
43
+ * @param {TypeaheadProps} props - props as described at https://react-select.com/props
43
44
  */
44
45
 
45
- const Typeahead = (props: Props) => {
46
+ const Typeahead = ({ loadOptions = noop, getOptionLabel, id, getOptionValue, createable, async, ...props }: TypeaheadProps) => {
46
47
  const selectProps = {
47
48
  cacheOptions: true,
48
49
  components: {
@@ -56,8 +57,11 @@ const Typeahead = (props: Props) => {
56
57
  Placeholder,
57
58
  ValueContainer,
58
59
  },
60
+ loadOptions: isString(loadOptions) ? get(window, loadOptions) : loadOptions,
61
+ getOptionLabel: isString(getOptionLabel) ? get(window, getOptionLabel) : getOptionLabel,
62
+ getOptionValue: isString(getOptionValue) ? get(window, getOptionValue) : getOptionValue,
59
63
  defaultOptions: true,
60
- id: 'react-select-input',
64
+ id: id || uniqueId(),
61
65
  inline: false,
62
66
  isClearable: true,
63
67
  isSearchable: true,
@@ -68,14 +72,9 @@ const Typeahead = (props: Props) => {
68
72
  ...props,
69
73
  }
70
74
 
71
- if (typeof(props.loadOptions) === 'string') selectProps.loadOptions = get(window, props.loadOptions)
72
- if (typeof(props.getOptionLabel) === 'string') selectProps.getOptionLabel = get(window, props.getOptionLabel)
73
- if (typeof(props.getOptionValue) === 'string') selectProps.getOptionValue = get(window, props.getOptionValue)
75
+ const Tag = createable ? CreateableSelect : (async ? AsyncSelect : Select)
74
76
 
75
- let Tag = props.async ? AsyncSelect : Select
76
- if (props.createable) Tag = CreateableSelect
77
-
78
- const handleOnChange = (data, { action, option, removedValue }) => {
77
+ const handleOnChange = (_data, { action, option, removedValue }) => {
79
78
  if (action === 'select-option') {
80
79
  if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
81
80
  const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option })
@@ -0,0 +1,195 @@
1
+ // !!! IMPORTANT: This file is autogenerated. Please do not edit.!!!
2
+ import WebpackerReact from 'webpacker-react'
3
+ import ujs from 'webpacker-react/ujs'
4
+
5
+ // KIT EXAMPLES
6
+ import 'pb_form/pb_form_validation'
7
+ import * as Avatar from 'pb_avatar/docs'
8
+ import * as AvatarActionButton from 'pb_avatar_action_button/docs'
9
+ import * as Background from 'pb_background/docs'
10
+ import * as Badge from 'pb_badge/docs'
11
+ import * as BarGraphDocs from 'pb_bar_graph/docs'
12
+ import * as Body from 'pb_body/docs'
13
+ import * as BreadCrumbs from 'pb_bread_crumbs/docs'
14
+ import * as Button from 'pb_button/docs'
15
+ import * as ButtonToolbar from 'pb_button_toolbar/docs'
16
+ import * as Caption from 'pb_caption/docs'
17
+ import * as Card from 'pb_card/docs'
18
+ import * as Checkbox from 'pb_checkbox/docs'
19
+ import * as CircleChart from 'pb_circle_chart/docs'
20
+ import * as CircleIconButton from 'pb_circle_icon_button/docs'
21
+ import * as Collapsible from 'pb_collapsible/docs'
22
+ import * as Contact from 'pb_contact/docs'
23
+ import * as Currency from 'pb_currency/docs'
24
+ import * as DashboardValue from 'pb_dashboard_value/docs'
25
+ import * as Date from 'pb_date/docs'
26
+ import * as DatePicker from 'pb_date_picker/docs'
27
+ import * as DateRangeInline from 'pb_date_range_inline/docs'
28
+ import * as DateRangeStacked from 'pb_date_range_stacked/docs'
29
+ import * as DateStacked from 'pb_date_stacked/docs'
30
+ import * as DateTime from 'pb_date_time/docs'
31
+ import * as DateTimeStacked from 'pb_date_time_stacked/docs'
32
+ import * as DateYearStacked from 'pb_date_year_stacked/docs'
33
+ import * as Dialog from 'pb_dialog/docs'
34
+ import * as DistributionBarDocs from 'pb_distribution_bar/docs'
35
+ import * as FileUpload from 'pb_file_upload/docs'
36
+ import * as Filter from 'pb_filter/docs'
37
+ import * as FixedConfirmationToast from 'pb_fixed_confirmation_toast/docs'
38
+ import * as Flex from 'pb_flex/docs'
39
+ import * as FormGroup from 'pb_form_group/docs'
40
+ import * as FormPill from 'pb_form_pill/docs'
41
+ import * as Gauge from 'pb_gauge/docs'
42
+ import * as Hashtag from 'pb_hashtag/docs'
43
+ import * as Highlight from 'pb_highlight/docs'
44
+ import * as HomeAddressStreet from 'pb_home_address_street/docs'
45
+ import * as Icon from 'pb_icon/docs'
46
+ import * as IconCircle from 'pb_icon_circle/docs'
47
+ import * as IconStatValue from 'pb_icon_stat_value/docs'
48
+ import * as IconValue from 'pb_icon_value/docs'
49
+ import * as Image from 'pb_image/docs'
50
+ import * as LabelPill from 'pb_label_pill/docs'
51
+ import * as LabelValue from 'pb_label_value/docs'
52
+ import * as Layout from 'pb_layout/docs'
53
+ import * as LegendDocs from 'pb_legend/docs'
54
+ import * as LineGraphDocs from 'pb_line_graph/docs'
55
+ import * as List from 'pb_list/docs'
56
+ import * as LoadingInline from 'pb_loading_inline/docs'
57
+ import * as Message from 'pb_message/docs'
58
+ import * as MultipleUsers from 'pb_multiple_users/docs'
59
+ import * as MultipleUsersStacked from 'pb_multiple_users_stacked/docs'
60
+ import * as Nav from 'pb_nav/docs'
61
+ import * as OnlineStatus from 'pb_online_status/docs'
62
+ import * as Passphrase from 'pb_passphrase/docs'
63
+ import * as PbReactPopover from 'pb_popover/docs'
64
+ import * as Person from 'pb_person/docs'
65
+ import * as PersonContact from 'pb_person_contact/docs'
66
+ import * as Pill from 'pb_pill/docs'
67
+ import * as ProgressPills from 'pb_progress_pills/docs'
68
+ import * as ProgressSimple from 'pb_progress_simple/docs'
69
+ import * as ProgressStep from 'pb_progress_step/docs'
70
+ import * as Radio from 'pb_radio/docs'
71
+ import * as RichTextEditor from 'pb_rich_text_editor/docs'
72
+ import * as SectionSeparator from 'pb_section_separator/docs'
73
+ import * as Select from 'pb_select/docs'
74
+ import * as SelectableCard from 'pb_selectable_card/docs'
75
+ import * as SelectableCardIcon from 'pb_selectable_card_icon/docs'
76
+ import * as SelectableIcon from 'pb_selectable_icon/docs'
77
+ import * as SelectableList from 'pb_selectable_list/docs'
78
+ import * as Source from 'pb_source/docs'
79
+ import * as StarRating from 'pb_star_rating/docs'
80
+ import * as StatChange from 'pb_stat_change/docs'
81
+ import * as StatValue from 'pb_stat_value/docs'
82
+ import * as Table from 'pb_table/docs'
83
+ import * as TextInput from 'pb_text_input/docs'
84
+ import * as Textarea from 'pb_textarea/docs'
85
+ import * as Time from 'pb_time/docs'
86
+ import * as TimeRangeInline from 'pb_time_range_inline/docs'
87
+ import * as TimeStacked from 'pb_time_stacked/docs'
88
+ import * as Timeline from 'pb_timeline/docs'
89
+ import * as Timestamp from 'pb_timestamp/docs'
90
+ import * as Title from 'pb_title/docs'
91
+ import * as TitleCount from 'pb_title_count/docs'
92
+ import * as TitleDetail from 'pb_title_detail/docs'
93
+ import * as Toggle from 'pb_toggle/docs'
94
+ import * as Typeahead from 'pb_typeahead/docs'
95
+ import * as User from 'pb_user/docs'
96
+ import * as UserBadge from 'pb_user_badge/docs'
97
+ import * as WeekdayStacked from 'pb_weekday_stacked/docs'
98
+
99
+ WebpackerReact.registerComponents({
100
+ ...Avatar,
101
+ ...AvatarActionButton,
102
+ ...Background,
103
+ ...Badge,
104
+ ...BarGraphDocs,
105
+ ...Body,
106
+ ...BreadCrumbs,
107
+ ...Button,
108
+ ...ButtonToolbar,
109
+ ...Caption,
110
+ ...Card,
111
+ ...Checkbox,
112
+ ...CircleChart,
113
+ ...CircleIconButton,
114
+ ...Collapsible,
115
+ ...Contact,
116
+ ...Currency,
117
+ ...DashboardValue,
118
+ ...Date,
119
+ ...DatePicker,
120
+ ...DateRangeInline,
121
+ ...DateRangeStacked,
122
+ ...DateStacked,
123
+ ...DateTime,
124
+ ...DateTimeStacked,
125
+ ...DateYearStacked,
126
+ ...Dialog,
127
+ ...DistributionBarDocs,
128
+ ...FileUpload,
129
+ ...Filter,
130
+ ...FixedConfirmationToast,
131
+ ...Flex,
132
+ ...FormGroup,
133
+ ...FormPill,
134
+ ...Gauge,
135
+ ...Hashtag,
136
+ ...Highlight,
137
+ ...HomeAddressStreet,
138
+ ...Icon,
139
+ ...IconCircle,
140
+ ...IconStatValue,
141
+ ...IconValue,
142
+ ...Image,
143
+ ...LabelPill,
144
+ ...LabelValue,
145
+ ...Layout,
146
+ ...LegendDocs,
147
+ ...LineGraphDocs,
148
+ ...List,
149
+ ...LoadingInline,
150
+ ...Message,
151
+ ...MultipleUsers,
152
+ ...MultipleUsersStacked,
153
+ ...Nav,
154
+ ...OnlineStatus,
155
+ ...Passphrase,
156
+ ...PbReactPopover,
157
+ ...Person,
158
+ ...PersonContact,
159
+ ...Pill,
160
+ ...ProgressPills,
161
+ ...ProgressSimple,
162
+ ...ProgressStep,
163
+ ...Radio,
164
+ ...RichTextEditor,
165
+ ...SectionSeparator,
166
+ ...Select,
167
+ ...SelectableCard,
168
+ ...SelectableCardIcon,
169
+ ...SelectableIcon,
170
+ ...SelectableList,
171
+ ...Source,
172
+ ...StarRating,
173
+ ...StatChange,
174
+ ...StatValue,
175
+ ...Table,
176
+ ...TextInput,
177
+ ...Textarea,
178
+ ...Time,
179
+ ...TimeRangeInline,
180
+ ...TimeStacked,
181
+ ...Timeline,
182
+ ...Timestamp,
183
+ ...Title,
184
+ ...TitleCount,
185
+ ...TitleDetail,
186
+ ...Toggle,
187
+ ...Typeahead,
188
+ ...User,
189
+ ...UserBadge,
190
+ ...WeekdayStacked,
191
+ })
192
+ ujs.setup(
193
+ () => WebpackerReact.mountComponents(),
194
+ () => WebpackerReact.unmountComponents()
195
+ )
@@ -0,0 +1,35 @@
1
+ // React-Rendered Rails Kit Exports =====
2
+
3
+ import WebpackerReact from 'webpacker-react'
4
+ import ujs from 'webpacker-react/ujs'
5
+
6
+ import BarGraph from './pb_bar_graph/_bar_graph'
7
+ import Dialog from './pb_dialog/_dialog'
8
+ import DialogBody from './pb_dialog/child_kits/_dialog_body'
9
+ import DialogFooter from './pb_dialog/child_kits/_dialog_footer'
10
+ import DialogHeader from './pb_dialog/child_kits/_dialog_header'
11
+ import DistributionBar from './pb_distribution_bar/_distribution_bar'
12
+ import Legend from './pb_legend/_legend'
13
+ import LineGraph from './pb_line_graph/_line_graph'
14
+ import Passphrase from './pb_passphrase/_passphrase'
15
+ import RichTextEditor from './pb_rich_text_editor/_rich_text_editor'
16
+ import Typeahead from './pb_typeahead/_typeahead'
17
+
18
+ WebpackerReact.registerComponents({
19
+ BarGraph,
20
+ Dialog,
21
+ DialogBody,
22
+ DialogFooter,
23
+ DialogHeader,
24
+ DistributionBar,
25
+ Legend,
26
+ LineGraph,
27
+ Passphrase,
28
+ RichTextEditor,
29
+ Typeahead,
30
+ })
31
+
32
+ ujs.setup(
33
+ () => WebpackerReact.mountComponents(),
34
+ () => WebpackerReact.unmountComponents()
35
+ )
@@ -35,9 +35,5 @@ PbTextarea.start()
35
35
 
36
36
  import 'flatpickr'
37
37
 
38
- import 'trix'
39
-
40
38
  // React-Rendered Rails Kits =====
41
- import WebpackerReact from 'webpacker-react'
42
- import * as ReactRailsPBKits from './react_rails_kits.js'
43
- WebpackerReact.setup({ ...ReactRailsPBKits })
39
+ import './playbook-rails-react-bindings'
@@ -243,6 +243,10 @@ $category_colors: (
243
243
 
244
244
  $transparent: transparent;
245
245
 
246
+ @function tint($color, $percentage) {
247
+ @return mix($white, $color, $percentage);
248
+ }
249
+
246
250
  @mixin gradient($start: $gradient_start, $end: $gradient_end) {
247
251
  background: $start;
248
252
  background: -moz-linear-gradient(-45deg, $start 0%, $end 100%);
@@ -0,0 +1,38 @@
1
+ @import "./colors";
2
+ @import "./typography";
3
+ @import "./line_height";
4
+
5
+ @mixin pb_title(
6
+ $fontSize: $heading_1,
7
+ $fontWeight: $lighter,
8
+ $lineHeight: $lh_tighter
9
+ ){
10
+ font-size: $fontSize;
11
+ letter-spacing: $lspace_tight;
12
+ font-weight: $fontWeight;
13
+ color: $text_lt_default;
14
+ margin: 0;
15
+ line-height: $lineHeight;
16
+ font-family: $font_family_base;
17
+ }
18
+
19
+ @mixin pb_title_1 {
20
+ @include pb_title($heading_1);
21
+ letter-spacing: -0.03em;
22
+ }
23
+
24
+ @mixin pb_title_2 {
25
+ @include pb_title($heading_2, $lighter, 0.96);
26
+ }
27
+
28
+ @mixin pb_title_3 {
29
+ @include pb_title($heading_3);
30
+ }
31
+
32
+ @mixin pb_title_4 {
33
+ @include pb_title($heading_4, $bolder);
34
+ }
35
+
36
+ @mixin pb_title_dark {
37
+ color: $text_dk_default;
38
+ }
@@ -1,7 +1,3 @@
1
- @function tint($color, $percentage) {
2
- @return mix($white, $color, $percentage);
3
- }
4
-
5
1
  @function shade($color, $percentage) {
6
2
  @return mix($charcoal, $color, $percentage);
7
3
  }
data/lib/playbook.rb CHANGED
@@ -1,13 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "sassc-rails"
4
- require "slim-rails"
5
- require "webpacker"
6
- require "webpacker/react"
7
- require "view_component/engine"
8
-
9
3
  require "playbook/version"
10
-
4
+ require "playbook/engine"
11
5
  require "playbook/props"
12
6
  require "playbook/forms"
13
7
  require "playbook/pb_forms_helper"
@@ -16,7 +10,6 @@ require "playbook/pb_doc_helper"
16
10
  require "playbook/kit_base"
17
11
  require "playbook/kit_resolver"
18
12
  require "playbook/markdown"
19
- require "playbook/engine" if defined?(Rails)
20
13
 
21
14
  module Playbook
22
15
  ROOT_PATH = Pathname.new(File.join(__dir__, ".."))
@@ -26,13 +19,6 @@ module Playbook
26
19
 
27
20
  module_function
28
21
 
29
- def webpacker
30
- @webpacker ||= ::Webpacker::Instance.new(
31
- root_path: ROOT_PATH,
32
- config_path: ROOT_PATH.join("config/webpacker.yml")
33
- )
34
- end
35
-
36
22
  def kit_path(kit, *args)
37
23
  Playbook::Engine.root.join("app/pb_kits/playbook/pb_#{kit}", *args)
38
24
  end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "sassc-rails"
4
- require "slim-rails"
3
+ require "action_view/railtie"
4
+ require "view_component/engine"
5
+ require "webpacker/react"
5
6
 
6
7
  module Playbook
7
8
  class Engine < ::Rails::Engine
@@ -13,26 +14,15 @@ module Playbook
13
14
 
14
15
  config.view_component.render_monkey_patch_enabled = false
15
16
 
16
- config.assets.paths ||= []
17
- config.assets.paths << Playbook::Engine.root.join("fonts")
18
- config.assets.paths << Playbook::Engine.root.join("app/pb_kits/playbook/pb_*")
19
-
20
- config.sass.load_paths ||= []
21
- config.sass.load_paths << Playbook::Engine.root.join("app/pb_kits/playbook")
22
-
23
- initializer "webpacker.proxy" do |app|
24
- insert_middleware = begin
25
- Playbook.webpacker.config.dev_server.present?
26
- rescue
27
- nil
28
- end
29
- next unless insert_middleware
17
+ if config.respond_to?(:assets)
18
+ config.assets.paths ||= []
19
+ config.assets.paths << Playbook::Engine.root.join("fonts")
20
+ config.assets.paths << Playbook::Engine.root.join("app/pb_kits/playbook/pb_*")
21
+ end
30
22
 
31
- app.middleware.insert_before(
32
- 0, Webpacker::DevServerProxy,
33
- ssl_verify_none: true,
34
- webpacker: Playbook.webpacker
35
- )
23
+ if config.respond_to?(:sass)
24
+ config.sass.load_paths ||= []
25
+ config.sass.load_paths << Playbook::Engine.root.join("app/pb_kits/playbook")
36
26
  end
37
27
  end
38
28
  end