playbook_ui_docs 12.27.0.pre.alpha.expandednotworking853 → 12.28.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown869

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 (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.html.erb +12 -0
  3. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_rails.md +3 -0
  4. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.html.erb +12 -0
  5. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.jsx +18 -0
  6. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_range_limit.md +1 -0
  7. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.jsx +17 -0
  8. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_quick_pick_react.md +1 -0
  9. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +4 -0
  10. data/app/pb_kits/playbook/pb_date_picker/docs/index.js +3 -1
  11. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.jsx +26 -0
  12. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_access_input_element.md +3 -0
  13. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_clear_field.jsx +30 -0
  14. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_clear_field.md +3 -0
  15. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
  16. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +2 -0
  17. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_selectable_card_icon_custom.html.erb +11 -0
  18. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_selectable_card_icon_custom.jsx +36 -0
  19. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/_selectable_card_icon_custom.md +19 -0
  20. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/example.yml +2 -2
  21. data/app/pb_kits/playbook/pb_selectable_card_icon/docs/index.js +1 -0
  22. data/dist/playbook-doc.js +199 -199
  23. metadata +16 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd6c4463b1d105dd23ca16535f94acbce3bd7984a40939060c5bee736a6df7b7
4
- data.tar.gz: 989367d7fc387521be5458382c91ef22794b169032a1df5c5605c4dfb00f0010
3
+ metadata.gz: 516454ff3dab526d31eea1a1cb32966d6c1887b64855e5e1fb11c56feef8b166
4
+ data.tar.gz: 07c4ec387616e09f4e52f94daf2dcd3396b065c42ef9601de0d0397043252692
5
5
  SHA512:
6
- metadata.gz: 0524b78ca67a91baf1aa7388d120ff4ba57a37965196446f6974d938ed6af081215388f7db97308d01cf71a8ed132baf270c235d0c8958a80736e548a78123de
7
- data.tar.gz: ce812010bfc1b5ffa90ba46b230979740b5b5be474fe92871126f3aea90f66c25acad6521552b7faa7221e16256ea91c5eae945422f8c632ea29914805e6801e
6
+ metadata.gz: a22526e9815cb7a1fccb80e549f417c7712d6b60925590146172cbbc2bd25a238eb03024b822e8e8b59935eb0fcaf18a8a4d5d649532e751bd64310e0028fdc4
7
+ data.tar.gz: 4576681d112c222df5939fd57e6f6e158251f48b91b9dc047ca2b60f23fc9f5ad9bf7e2c66fcb373f549411dec60bc00dd68ee9f8af6d38b720967d32b9742cc
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("date_picker", props: {
2
+ allow_input: true,
3
+ end_date_id: "quick-pick-end-date",
4
+ end_date_name: "quick-pick-end-date",
5
+ mode: "range",
6
+ picker_id: "date-picker-quick-pick",
7
+ placeholder: "mm/dd/yyyy to mm/dd/yyyy",
8
+ selection_type: "quickpick",
9
+ start_date_id: "quick-pick-start-date",
10
+ start_date_name: "quick-pick-start-date"
11
+ }) %>
12
+
@@ -0,0 +1,3 @@
1
+ This date range variant uses hidden inputs to handle start and end dates. While they are not required props, it is advisable to specify a unique `start_date_id`, `start_date_name`, `end_date_id`, and `end_date_name` for each quick pick instance you place in a form and/or on a page.
2
+
3
+ Like all other date pickers, the quick pick does require a `picker_id`.
@@ -0,0 +1,12 @@
1
+ <%= pb_rails("date_picker", props: {
2
+ allow_input: true,
3
+ end_date_id: "range-limit-end-date",
4
+ end_date_name: "range-limit-end-date",
5
+ mode: "range",
6
+ picker_id: "thisRangesEndToday",
7
+ placeholder: "mm/dd/yyyy to mm/dd/yyyy",
8
+ selection_type: "quickpick",
9
+ start_date_id: "range-limit-start-date",
10
+ start_date_name: "range-limit-start-date",
11
+ this_ranges_end_today: true
12
+ }) %>
@@ -0,0 +1,18 @@
1
+ import React from 'react'
2
+ import DatePicker from '../_date_picker'
3
+
4
+ const DatePickerQuickPickRangeLimit = (props) => (
5
+ <>
6
+ <DatePicker
7
+ allowInput
8
+ mode="range"
9
+ pickerId="thisRangesEndToday"
10
+ placeholder="mm/dd/yyyy to mm/dd/yyyy"
11
+ selectionType="quickpick"
12
+ thisRangesEndToday
13
+ {...props}
14
+ />
15
+ </>
16
+ )
17
+
18
+ export default DatePickerQuickPickRangeLimit
@@ -0,0 +1 @@
1
+ Applying `this_ranges_end_today` (Rails) or `thisRangesEndToday` (React) causes all “This” preset ranges (i.e., this week, this month, this quarter, this year) to use an endDate of today, instead of their natural end date in the future.
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import DatePicker from '../_date_picker'
3
+
4
+ const DatePickerQuickPickReact = (props) => (
5
+ <>
6
+ <DatePicker
7
+ allowInput
8
+ mode="range"
9
+ pickerId="date-picker-quick-pick"
10
+ placeholder="mm/dd/yyyy to mm/dd/yyyy"
11
+ selectionType="quickpick"
12
+ {...props}
13
+ />
14
+ </>
15
+ )
16
+
17
+ export default DatePickerQuickPickReact
@@ -0,0 +1 @@
1
+ Use the `onChange` handler function to access the startDate and endDate values. Check the [`onChange` example](https://playbook.powerapp.cloud/kits/date_picker/react#onchange) for more information.
@@ -8,6 +8,8 @@ examples:
8
8
  - date_picker_input: Input Field
9
9
  - date_picker_label: Label
10
10
  - date_picker_range: Range
11
+ - date_picker_quick_pick_rails: Range (Quick Pick)
12
+ - date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
11
13
  - date_picker_format: Format
12
14
  - date_picker_disabled: Disabled Dates
13
15
  - date_picker_min_max: Min Max
@@ -33,6 +35,8 @@ examples:
33
35
  - date_picker_on_change: onChange
34
36
  - date_picker_on_close: onClose
35
37
  - date_picker_range: Range
38
+ - date_picker_quick_pick_react: Range (Quick Pick)
39
+ - date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
36
40
  - date_picker_format: Format
37
41
  - date_picker_disabled: Disabled Dates
38
42
  - date_picker_min_max: Min Max
@@ -19,4 +19,6 @@ export { default as DatePickerWeek } from './_date_picker_week.jsx'
19
19
  export { default as DatePickerPositions } from './_date_picker_positions.jsx'
20
20
  export { default as DatePickerPositionsElement } from './_date_picker_positions_element.jsx'
21
21
  export { default as DatePickerAllowInput } from './_date_picker_allow_input'
22
- export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
22
+ export { default as DatePickerQuickPickReact } from './_date_picker_quick_pick_react'
23
+ export { default as DatePickerQuickPickRangeLimit } from './_date_picker_quick_pick_range_limit'
24
+ export { default as DatePickerOnClose } from './_date_picker_on_close.jsx'
@@ -0,0 +1,26 @@
1
+ import React, { useEffect, useRef } from 'react'
2
+ import { Body, PhoneNumberInput } from '../..'
3
+
4
+ const PhoneNumberInputAccessInputElement = (props) => {
5
+ // 1. Create a ref - this accesses the kit's input element.
6
+ const ref = useRef()
7
+
8
+ // 2. Add any event listener to ref.current.inputNode() inside a useEffect hook and trigger it once.
9
+ useEffect(() => {
10
+ ref.current.inputNode().addEventListener("click", () => alert("Clicked!"))
11
+ }, [])
12
+
13
+ // 3. Pass the ref to the ref prop.
14
+ return (
15
+ <>
16
+ <Body text="Click the input field below:" />
17
+ <PhoneNumberInput
18
+ id="access-input-element"
19
+ ref={ref}
20
+ {...props}
21
+ />
22
+ </>
23
+ )
24
+ }
25
+
26
+ export default PhoneNumberInputAccessInputElement
@@ -0,0 +1,3 @@
1
+ To access the kit's input element attributes or add event listeners, create a `ref` inside your parent component, pass it to the kit's `ref` prop, and use `ref.current.inputNode()` with your desired attribute or event listener inside a `useEffect` hook. `useEffect` is necessary because the `ref` will be initially `undefined`. Calling `useEffect` with an empty dependency array ensures your event listeners won't be added twice.
2
+
3
+ `inputNode()` is a custom function inside the kit that returns the input DOM element and its attributes. For example, to get the `name` attribute, use `ref.current.inputNode().name`
@@ -0,0 +1,30 @@
1
+ import React, { useRef } from 'react'
2
+ import { Button, PhoneNumberInput } from '../..'
3
+
4
+ const PhoneNumberInputClearField = (props) => {
5
+ // 1. Create a ref - this accesses the kit's input element.
6
+ const ref = useRef()
7
+
8
+ // 2. Use clearField() to clear the field.
9
+ const handleClick = () => {
10
+ ref.current.clearField()
11
+ }
12
+
13
+ // 3. Pass the ref to the ref prop.
14
+ return (
15
+ <>
16
+ <PhoneNumberInput
17
+ id="clear-field"
18
+ ref={ref}
19
+ {...props}
20
+ />
21
+
22
+ <Button
23
+ onClick={handleClick}
24
+ text="Clear the Input Field"
25
+ />
26
+ </>
27
+ )
28
+ }
29
+
30
+ export default PhoneNumberInputClearField
@@ -0,0 +1,3 @@
1
+ To clear a number inside the input element, create a `ref` inside your parent component, pass it to the kit's `ref` prop, and use `ref.current.clearField()`.
2
+
3
+ `clearField()` is a custom function inside the kit to clear numbers and the error message while still providing validation.
@@ -6,6 +6,8 @@ examples:
6
6
  - phone_number_input_initial_country: Initial Country
7
7
  - phone_number_input_only_countries: Limited Countries
8
8
  - phone_number_input_validation: Form Validation
9
+ - phone_number_input_clear_field: Clearing the Input Field
10
+ - phone_number_input_access_input_element: Accessing the Input Element
9
11
 
10
12
  rails:
11
13
  - phone_number_input_default: Default
@@ -3,3 +3,5 @@ export { default as PhoneNumberInputPreferredCountries } from './_phone_number_i
3
3
  export { default as PhoneNumberInputInitialCountry } from './_phone_number_input_initial_country'
4
4
  export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_only_countries'
5
5
  export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
6
+ export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
7
+ export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
@@ -0,0 +1,11 @@
1
+ <div class="pb--doc-demo-row">
2
+ <% svg_url = "https://upload.wikimedia.org/wikipedia/commons/3/3b/Wrench_font_awesome.svg" %>
3
+
4
+ <%= pb_rails("selectable_card_icon", props: {
5
+ custom_icon: svg_url,
6
+ title_text: "Customization",
7
+ body_text: "Personalize everything",
8
+ input_id: 1,
9
+ checked: true,
10
+ }) %>
11
+ </div>
@@ -0,0 +1,36 @@
1
+ import React from 'react'
2
+ import SelectableCardIcon from '../_selectable_card_icon'
3
+
4
+ const svg = {
5
+ newChat: (
6
+ <svg
7
+ ariaHidden="true"
8
+ focusable="false"
9
+ role="img"
10
+ viewBox="0 0 512 512"
11
+ xmlns="http://www.w3.org/2000/svg"
12
+ >
13
+ <path
14
+ d="M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm16 352c0 8.8-7.2 16-16 16H288l-12.8 9.6L208 428v-60H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16h384c8.8 0 16 7.2 16 16v288zM336 184h-56v-56c0-8.8-7.2-16-16-16h-16c-8.8 0-16 7.2-16 16v56h-56c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16h56v56c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16v-56h56c8.8 0 16-7.2 16-16v-16c0-8.8-7.2-16-16-16z"
15
+ fill="currentColor"
16
+ />
17
+ </svg>
18
+ ),
19
+ }
20
+
21
+ const SelectableCardIconCustom = (props) => {
22
+ return (
23
+ <div className="pb--doc-demo-row">
24
+ <SelectableCardIcon
25
+ bodyText="Talk to someone you love"
26
+ checked
27
+ customIcon={svg.newChat}
28
+ inputId={1}
29
+ titleText="New Chat"
30
+ {...props}
31
+ />
32
+ </div>
33
+ )
34
+ }
35
+
36
+ export default SelectableCardIconCustom
@@ -0,0 +1,19 @@
1
+ # Tips for Custom Icons
2
+
3
+ When using custom icons it is important to introduce a "clean" SVG. In order to ensure these custom icons perform as intended within your kit(s), ensure these things have been modified from the original SVG markup:
4
+
5
+ Attributes must be React compatible e.g. <code>xmlns:xlink</code> should be <code>xmlnsXlink</code> and so on. <strong>There should be no hyphenated attributes and no semi-colons!.</strong>
6
+
7
+ Fill colors with regards to <code>g</code> or <code>path</code> nodes, e.g. <code>fill="black"</code>, should be replaced with <code>currentColor</code> ala <code>fill="currentColor"</code>. Your mileage may vary depending on the complexity of your SVG.
8
+
9
+ Pay attention to your custom icon's dimensions and `viewBox` attribute. It is best to use a `viewBox="0 0 512 512"` starting point __when designing instead of trying to retrofit the viewbox afterwards__!
10
+
11
+ You must source *your own SVG into component/view* you are working on. This can easily be done in programmatic and maintainable ways.
12
+
13
+ ### React
14
+
15
+ So long as you have a valid React `<SVG>` node, you can send it as the `customIcon` prop and the kit will take care of the rest.
16
+
17
+ ### Rails
18
+
19
+ Some Rails applications use only webpack(er) which means using `image_url` will be successful over `image_path` in most cases especially development where Webpack Dev Server is serving assets over HTTP. Rails applications still using Asset Pipeline may use `image_path` or `image_url`. Of course, YMMV depending on any custom configurations in your Rails application.
@@ -5,10 +5,10 @@ examples:
5
5
  - selectable_card_icon_checkmark: Checkmark
6
6
  - selectable_card_icon_single_select: Single Select
7
7
  - selectable_card_icon_options: With Options
8
-
9
-
8
+ - selectable_card_icon_custom: Custom Icon
10
9
 
11
10
  react:
12
11
  - selectable_card_icon_default: Default
13
12
  - selectable_card_icon_checkmark: Checkmark
14
13
  - selectable_card_icon_single_select: Single Select
14
+ - selectable_card_icon_custom: Custom Icon
@@ -1,3 +1,4 @@
1
1
  export { default as SelectableCardIconDefault } from './_selectable_card_icon_default.jsx'
2
2
  export { default as SelectableCardIconCheckmark } from './_selectable_card_icon_checkmark.jsx'
3
3
  export { default as SelectableCardIconSingleSelect } from './_selectable_card_icon_single_select.jsx'
4
+ export { default as SelectableCardIconCustom } from './_selectable_card_icon_custom.jsx'