playbook_ui 12.24.0 → 12.25.0.pre.alpha.PLAY818multilevelrebuild770

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_avatar/docs/_avatar_swift.md +82 -1
  3. data/app/pb_kits/playbook/pb_date/_date.tsx +96 -42
  4. data/app/pb_kits/playbook/pb_date/date.html.erb +22 -2
  5. data/app/pb_kits/playbook/pb_date/date.rb +2 -0
  6. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.html.erb +30 -0
  7. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +47 -0
  8. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.md +1 -0
  9. data/app/pb_kits/playbook/pb_date/docs/example.yml +4 -4
  10. data/app/pb_kits/playbook/pb_date/docs/index.js +1 -0
  11. data/app/pb_kits/playbook/pb_docs/kit_example.html.erb +14 -13
  12. data/app/pb_kits/playbook/pb_docs/kit_example.rb +0 -2
  13. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +3 -2
  14. data/app/pb_kits/playbook/pb_multi_level_select/_helper_functions.tsx +212 -0
  15. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +53 -98
  16. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +340 -86
  17. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_default.md +1 -1
  18. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_return_all_selected.html.erb +1 -0
  19. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +1 -1
  20. data/app/pb_kits/playbook/pb_time/_time.tsx +71 -35
  21. data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.html.erb +37 -0
  22. data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.jsx +58 -0
  23. data/app/pb_kits/playbook/pb_time/docs/_time_unstyled.md +1 -0
  24. data/app/pb_kits/playbook/pb_time/docs/example.yml +2 -0
  25. data/app/pb_kits/playbook/pb_time/docs/index.js +1 -0
  26. data/app/pb_kits/playbook/pb_time/time.html.erb +26 -7
  27. data/app/pb_kits/playbook/pb_time/time.rb +2 -0
  28. data/app/pb_kits/playbook/pb_title/_title.scss +2 -1
  29. data/app/pb_kits/playbook/pb_title/_title.tsx +3 -2
  30. data/app/pb_kits/playbook/pb_title/title.rb +10 -3
  31. data/app/pb_kits/playbook/pb_title/title.test.js +3 -3
  32. data/dist/playbook-rails.js +51 -0
  33. data/lib/playbook/version.rb +2 -2
  34. data/lib/playbook.rb +1 -2
  35. metadata +19 -43
  36. data/app/pb_kits/playbook/pb_docs/kit_api.html.erb +0 -311
  37. data/app/pb_kits/playbook/pb_docs/kit_api.rb +0 -149
  38. data/app/pb_kits/playbook/pb_multi_level_select/_multi_select_helper.tsx +0 -31
  39. data/app/pb_kits/playbook/pb_multi_level_select/helper_functions.ts +0 -87
  40. data/lib/playbook/markdown/helper.rb +0 -132
  41. data/lib/playbook/markdown.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f27b3e255fc8158201600b6221f2091e84ceb753c83d6d28a045ca256729ec05
4
- data.tar.gz: d2af8d464afa9225d3a3647dc83c2a241f208849978b39312d49f45b74415937
3
+ metadata.gz: a14e04b7668b97b0c9146aef7fa0b026c7a3aa5b1bacf8db93cdc415d75700b0
4
+ data.tar.gz: 54081e0902eca2e7cae249bbb4ec1b42d2a5d58aacb087de751ff559013c7571
5
5
  SHA512:
6
- metadata.gz: '018df9baaa8a9b1bc628873a71a2c1a5dde29e228be173511078a8f934cab375c7992f7bdd1b8e50523d401bd3554fb5f491f2fe98daf811c27e88c5ed6534a4'
7
- data.tar.gz: 30cf511832a2ce5021ed6658e76f89c5ecacd040538b67e169e41071eb6451969cc8e0fe71a6855e8a413ae1465837fd122ba26baa07a49788031c21e2c00744
6
+ metadata.gz: f8fe51a30d83dcff3111b4cebccdb4ca8e7202a9fea95d5ef3fe7352d7de1e93d14918ff324184d3f22c71d4b68888d826b1c228e77b221ca503bdebbc8549f4
7
+ data.tar.gz: a7d5e2f0f0e9ff53eda81f92d6236539e4e752b87d7bfdbe2c3edf2257590e99d7827857a85c521bae2e858a0e8a366cab0fffb78a16165852c7ce5f44bb4ec6
@@ -1 +1,82 @@
1
- ![image for avatar](https://images.unsplash.com/photo-1684237276530-a562fa8338b1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=580&q=80)
1
+ In the world of design, consistency is key. Whether you're designing a website, app, or product, having a consistent visual language can make all the difference. That's where design systems come in.
2
+
3
+ A design system is a collection of reusable components, guidelines, and assets that help ensure consistency across all of your design work. It's a way to standardize your design language, making it easier for your team to work together and for your users to navigate your products.
4
+
5
+ In this article, we'll explore the various elements of a design system and how they can be used to create a cohesive and effective design language.
6
+
7
+ ### Headings
8
+ Headings are an essential component of any design system. They help organize content, provide visual hierarchy, and make it easier for users to scan and find what they're looking for. A good design system will have headings of various sizes, ranging from H1 (the largest) to H6 (the smallest). Here's an example:
9
+
10
+ # H1: Main Title Headings
11
+ ## H2: Headings
12
+ ### H3: Subheadings
13
+ #### H4: Sub-Subheadings
14
+
15
+ ![image for avatar](https://images.unsplash.com/photo-1684237276530-a562fa8338b1?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=580&q=80)
16
+
17
+ ### Lists
18
+ Lists are another important component of a design system. They help organize content into easily digestible chunks, making it easier for users to read and understand. There are two types of lists: ordered and unordered.
19
+
20
+ Ordered lists are numbered, and each item is listed in a specific order. For example:
21
+
22
+ 1. Headings
23
+ 2. Lists
24
+ 3. Blockquotes
25
+ 4. Links
26
+ 5. Bold
27
+ 6. Underline
28
+ 7. Code Blocks
29
+ 8. Inline Code
30
+ 9. Example Tables
31
+ 10. Horizontal Rules
32
+
33
+ Unordered lists, on the other hand, use bullet points to separate each item. For example:
34
+
35
+ * Headings
36
+ * Lists
37
+ * Blockquotes
38
+ * Links
39
+ * Bold
40
+ * Underline
41
+ * Code Blocks
42
+ * Inline Code
43
+ * Example Tables
44
+ * Horizontal Rules
45
+
46
+ ### Blockquotes
47
+ Blockquotes are used to highlight a particular section of text or quote. They’re often used to emphasize an important point or to provide context. Here’s an example:
48
+
49
+ > “Design systems are a collection of reusable components, guidelines, and assets that help ensure consistency across all of your design work.” - ChatGPT
50
+
51
+
52
+ ### Links
53
+ Links are an important part of any design system. They allow users to navigate between different pages and sections of your product. When using links in your design system, it’s important to make sure they’re consistent in color, size, and style. Here’s an example:
54
+ Click here to learn more about design systems.
55
+
56
+ ### Bold, Underline, & Italics
57
+ **Bold** and _underline_ are used to *highlight specific words* or phrases within ~~a block of~~ text. They help draw the user’s attention to important information. Here’s an example: *Design systems are* a collection of **reusable components**, **guidelines**, and **assets** that help ensure _consistency across all of your design work_.
58
+
59
+ ### Code Blocks and Inline Code
60
+ Code blocks and `inline code` are used to display and highlight code within a block of text. This is especially useful for developers who need to reference code snippets in their work.
61
+
62
+ Here’s an example:
63
+
64
+ ```js
65
+ function greet() {
66
+ console.log(“Hello, world!”);
67
+ }
68
+ ```
69
+
70
+ ### Example Tables
71
+ Example tables are used to display data in a clear and organized way. They help users compare and analyze information quickly. Here’s an example:
72
+
73
+ | Tables | Are | Cool |
74
+ |----------|:-------------:|------:|
75
+ | col 1 is | left-aligned | $1600 |
76
+ | col 2 is | centered | $12 |
77
+ | col 3 is | right-aligned | $1 |
78
+
79
+ ---
80
+
81
+ ### Horizontal Rules
82
+ Horizontal rules are used to separate sections of content visually. They help break up long blocks of text and make it easier for users
@@ -19,6 +19,7 @@ type PbDateProps = {
19
19
  showDayOfWeek?: boolean;
20
20
  showIcon?: boolean;
21
21
  size?: "sm" | "md" | "lg";
22
+ unstyled?: boolean;
22
23
  value: string | Date;
23
24
  };
24
25
 
@@ -32,6 +33,7 @@ const PbDate = (props: PbDateProps) => {
32
33
  showDayOfWeek = false,
33
34
  showIcon = false,
34
35
  size = "md",
36
+ unstyled = false,
35
37
  value,
36
38
  } = props;
37
39
 
@@ -52,48 +54,100 @@ const PbDate = (props: PbDateProps) => {
52
54
  );
53
55
 
54
56
  return (
55
- <div {...ariaProps} {...dataProps} className={classes} id={id}>
56
- {size == "md" || size == "lg" ? (
57
- <Title size={4} tag="h4">
58
- {showIcon && (
59
- <Body className="pb_icon_kit_container" color="light" tag="span">
60
- <Icon fixedWidth icon="calendar-alt" />
61
- </Body>
62
- )}
63
-
64
- {showDayOfWeek && (
65
- <>
66
- {weekday}
67
- <Body color="light" tag="span" text=" • " />
68
- </>
69
- )}
70
-
71
- <span>
72
- {month} {day}
73
- </span>
74
- {currentYear != year && <span>{`, ${year}`}</span>}
75
- </Title>
76
- ) : (
77
- <>
78
- {showIcon && (
79
- <Caption className="pb_icon_kit_container" tag="span">
80
- <Icon fixedWidth icon="calendar-alt" size="sm" />
81
- </Caption>
82
- )}
83
-
84
- {showDayOfWeek && (
85
- <>
86
- <Caption tag="div">{weekday}</Caption>
87
- <Caption color="light" tag="div" text=" • " />
88
- </>
89
- )}
90
-
91
- <Caption tag="span">
92
- {month} {day}
93
- {currentYear != year && <>{`, ${year}`}</>}
94
- </Caption>
95
- </>
96
- )}
57
+ <div {...ariaProps}
58
+ {...dataProps}
59
+ className={classes}
60
+ id={id}
61
+ >
62
+ {unstyled
63
+ ? <>
64
+ {showIcon && (
65
+ <div>
66
+ <Icon fixedWidth
67
+ icon="calendar-alt"
68
+ />
69
+ </div>
70
+ )}
71
+
72
+ {showDayOfWeek && (
73
+ <>
74
+ <div>
75
+ {weekday}
76
+ </div>
77
+
78
+ <div>{"•"}</div>
79
+ </>
80
+ )}
81
+
82
+ <span>
83
+ <span>
84
+ {month} {day}
85
+ </span>
86
+
87
+ {currentYear != year && <span>{`, ${year}`}</span>}
88
+ </span>
89
+ </>
90
+ : size == "md" || size == "lg"
91
+ ? (
92
+ <Title size={4}
93
+ tag="h4"
94
+ >
95
+ {showIcon && (
96
+ <Body className="pb_icon_kit_container"
97
+ color="light"
98
+ tag="span"
99
+ >
100
+ <Icon fixedWidth
101
+ icon="calendar-alt"
102
+ />
103
+ </Body>
104
+ )}
105
+
106
+ {showDayOfWeek && (
107
+ <>
108
+ {weekday}
109
+ <Body color="light"
110
+ tag="span"
111
+ text=" • "
112
+ />
113
+ </>
114
+ )}
115
+
116
+ <span>
117
+ {month} {day}
118
+ </span>
119
+ {currentYear != year && <span>{`, ${year}`}</span>}
120
+ </Title>
121
+ )
122
+ : (
123
+ <>
124
+ {showIcon && (
125
+ <Caption className="pb_icon_kit_container"
126
+ tag="span"
127
+ >
128
+ <Icon fixedWidth
129
+ icon="calendar-alt"
130
+ size="sm"
131
+ />
132
+ </Caption>
133
+ )}
134
+
135
+ {showDayOfWeek && (
136
+ <>
137
+ <Caption tag="div">{weekday}</Caption>
138
+ <Caption color="light"
139
+ tag="div"
140
+ text=" • "
141
+ />
142
+ </>
143
+ )}
144
+
145
+ <Caption tag="span">
146
+ {month} {day}
147
+ {currentYear != year && <>{`, ${year}`}</>}
148
+ </Caption>
149
+ </>
150
+ )}
97
151
  </div>
98
152
  );
99
153
  };
@@ -4,7 +4,28 @@
4
4
  class: object.classname,
5
5
  aria: object.aria) do %>
6
6
 
7
- <% if object.size == "md" %>
7
+ <% if object.unstyled %>
8
+ <!-- icon -->
9
+ <% if object.show_icon %>
10
+ <div><%= pb_rails("icon", props: { icon: "calendar-alt", fixed_width: true }) %></div>
11
+ <% end %>
12
+
13
+ <!-- day_of_week -->
14
+ <% if object.show_day_of_week %>
15
+ <div><%= object.day_of_week %></div>
16
+ <div>•</div>
17
+ <% end %>
18
+
19
+ <!-- month day, year -->
20
+ <%# if not current year %>
21
+ <% if object.year.to_s == DateTime.now.year.to_s %>
22
+ <span><%= "#{object.month} #{object.day}" %></span>
23
+ <%# if is current year %>
24
+ <% else %>
25
+ <span><%= "#{object.month} #{object.day}, #{object.year}" %></span>
26
+ <% end %>
27
+
28
+ <% elsif object.size == "md" || object.size == "lg" %>
8
29
  <!-- icon -->
9
30
  <% if object.show_icon %>
10
31
  <%= pb_rails("body", props: {
@@ -36,7 +57,6 @@
36
57
  <% end %>
37
58
 
38
59
  <% else %>
39
-
40
60
  <!-- icon -->
41
61
  <% if object.show_icon %>
42
62
  <%= pb_rails("caption", props: {
@@ -15,6 +15,8 @@ module Playbook
15
15
  values: %w[lg md sm xs],
16
16
  default: "md"
17
17
  prop :timezone, default: "America/New_York"
18
+ prop :unstyled, type: Playbook::Props::Boolean,
19
+ default: false
18
20
 
19
21
  def classname
20
22
  generate_classname("pb_date_kit", alignment)
@@ -0,0 +1,30 @@
1
+ <%= pb_rails("caption", props: { size: "xs", text: "Example with no year" }) %>
2
+
3
+ <%= pb_rails("date", props: {
4
+ date: Date.today,
5
+ unstyled: true
6
+ }) %>
7
+
8
+ <br />
9
+
10
+ <%= pb_rails("caption", props: { size: "xs", text: "Example with wrapping typography kit" }) %>
11
+
12
+ <%= pb_rails("title", props: { size: 1 }) do %>
13
+ <%= pb_rails("date", props: {
14
+ date: "2012-08-02T15:49:29Z",
15
+ unstyled: true
16
+ }) %>
17
+ <% end %>
18
+
19
+ <br />
20
+
21
+ <%= pb_rails("caption", props: { size: "xs", text: "Example with icon + subcaption" }) %>
22
+
23
+ <%= pb_rails("caption", props: { size: "xs" }) do %>
24
+ <%= pb_rails("date", props: {
25
+ date: "2012-08-02T15:49:29Z",
26
+ show_icon: true,
27
+ unstyled: true,
28
+ show_day_of_week: true
29
+ }) %>
30
+ <% end %>
@@ -0,0 +1,47 @@
1
+ import React from 'react'
2
+ import { Caption, Date as FormattedDate, Title } from '../../'
3
+
4
+ const DateUnstyled = (props) => {
5
+ return (
6
+ <>
7
+ <Caption size="xs"
8
+ text="Basic unstyled example"
9
+ />
10
+ <FormattedDate
11
+ unstyled
12
+ value={new Date()}
13
+ {...props}
14
+ />
15
+
16
+ <br />
17
+
18
+ <Caption size="xs"
19
+ text="Example with wrapping typography kit"
20
+ />
21
+ <Title size={1}>
22
+ <FormattedDate
23
+ unstyled
24
+ value="1995-12-25"
25
+ {...props}
26
+ />
27
+ </Title>
28
+
29
+ <br />
30
+
31
+ <Caption size="xs"
32
+ text="Example with icon + subcaption"
33
+ />
34
+ <Caption size="xs">
35
+ <FormattedDate
36
+ showDayOfWeek
37
+ showIcon
38
+ unstyled
39
+ value="1995-12-25"
40
+ {...props}
41
+ />
42
+ </Caption>
43
+ </>
44
+ )
45
+ }
46
+
47
+ export default DateUnstyled
@@ -0,0 +1 @@
1
+ For alternative typography styles, you can pass a boolean prop called `unstyled` to the `Date` kit and wrap it in any of our typography kits (`Title`, `Body`, `Caption`, etc.). This will allow the `Date` kit to inherit any of our typography styles.
@@ -1,14 +1,14 @@
1
1
  examples:
2
-
2
+
3
3
  rails:
4
4
  - date_default: Default
5
5
  - date_variants: Variants
6
6
  - date_alignment: Alignment
7
7
  - date_timezone: Timezones
8
-
9
-
8
+ - date_unstyled: Unstyled
9
+
10
10
  react:
11
11
  - date_default: Default
12
12
  - date_variants: Variants
13
13
  - date_alignment: Alignment
14
-
14
+ - date_unstyled: Unstyled
@@ -1,3 +1,4 @@
1
1
  export { default as DateDefault } from './_date_default.jsx'
2
2
  export { default as DateVariants } from './_date_variants.jsx'
3
3
  export { default as DateAlignment } from './_date_alignment.jsx'
4
+ export { default as DateUnstyled } from './_date_unstyled.jsx'
@@ -1,20 +1,21 @@
1
1
  <% example_html = ERB.new(example).result %>
2
2
 
3
3
  <%= pb_rails("card", props: { classname: "pb--doc", padding: "none", dark: dark }) do %>
4
- <div class="pb--kit-example">
5
- <%= pb_rails("caption", props: { text: example_title, dark: dark }) %>
6
- <br />
7
- <%= example %>
8
- <br>
9
- </div>
10
-
11
- <% if (action_name == "kit_show_swift") %>
12
- <div class="pb--kit-example-markdown pt_none <%= dark ? "dark" : "" %>">
4
+ <% unless (action_name == "kit_show_swift") %>
5
+ <div class="pb--kit-example">
6
+ <%= pb_rails("caption", props: { text: example_title, dark: dark }) %>
7
+ <br />
8
+ <%= example %>
9
+ <br>
10
+ </div>
11
+ <% else %>
12
+ <div class="pb--kit-example-markdown pt_none markdown <%= dark ? "dark" : "" %>">
13
+ <%= pb_rails("caption", props: { text: example_title, dark: dark, margin_top: "md" }) %>
13
14
  <%= render_markdown(description) %>
14
15
  </div>
15
16
  <% end %>
16
17
  <% if show_code %>
17
- <div class="markdown pb--kit-example-markdown <%= dark ? "dark" : "" %>">
18
+ <div class="markdown pb--kit-example-markdown markdown <%= dark ? "dark" : "" %>">
18
19
  <%= render_markdown(description) %>
19
20
  </div>
20
21
  <div id="code-wrapper">
@@ -32,10 +33,10 @@
32
33
  </div>
33
34
  <div class="pb--codeCopy" data-action="toggle" data-togglable="code_example" style="display: none" >
34
35
  <%= pb_rails("section_separator", props: { dark: dark })%>
35
- <a href="#" style="padding: 16px 0px 22px 0px;" id="copy-code-<%= example_key %>" class="pb--copy-code" onclick="copyOnClick(`<%= source %>`, `copy-code-<%= example_key %>`)">
36
- <%= pb_rails("button", props: { id: "copy-button-#{example_key}", text: "Copy Code", size: "sm", icon: "copy" }) %>
36
+ <a href="#" id="copy-code-<%= example_key %>" class="pb--copy-code" onclick="copyOnClick(`<%= source %>`, `copy-code-<%= example_key %>`)">
37
+ <%= pb_rails("button", props: { id: "copy-button-#{example_key}", text: "Copy Code", size: "sm", icon: "copy", padding_x: "xs" }) %>
37
38
  </a>
38
- <pre class="highlight"><%= raw rouge(source, highlighter) %></pre>
39
+ <pre class="highlight"><%= raw render_code(source, highlighter) %></pre>
39
40
  </div>
40
41
  <%= pb_rails("popover", props: {
41
42
  trigger_element_id: "copy-button-#{example_key}",
@@ -5,8 +5,6 @@
5
5
  module Playbook
6
6
  module PbDocs
7
7
  class KitExample < Playbook::KitBase
8
- include Playbook::Markdown::Helper
9
-
10
8
  prop :kit, type: Playbook::Props::String, required: true
11
9
  prop :example_title, type: Playbook::Props::String, required: true
12
10
  prop :example_key, type: Playbook::Props::String, required: true
@@ -10,7 +10,7 @@ type FormPillProps = {
10
10
  className?: string,
11
11
  id?: string,
12
12
  text: string,
13
- name: string,
13
+ name?: string,
14
14
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
15
15
  avatar?: boolean,
16
16
  avatarUrl?: string,
@@ -25,6 +25,7 @@ type FormPillProps = {
25
25
  const FormPill = (props: FormPillProps) => {
26
26
  const {
27
27
  className,
28
+ id,
28
29
  text,
29
30
  name,
30
31
  onClick = () => {},
@@ -41,7 +42,7 @@ const FormPill = (props: FormPillProps) => {
41
42
  textTransform,
42
43
  )
43
44
  return (
44
- <div className={css}>
45
+ <div className={css} id={id}>
45
46
  {name &&
46
47
  <>
47
48
  <Avatar