playbook_ui 17.1.0.pre.rc.4 → 17.1.0
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.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_container/_container.scss +3 -0
- data/app/pb_kits/playbook/pb_container/_container.tsx +47 -0
- data/app/pb_kits/playbook/pb_container/container.html.erb +3 -0
- data/app/pb_kits/playbook/pb_container/container.rb +15 -0
- data/app/pb_kits/playbook/pb_container/container.test.jsx +28 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_default.html.erb +3 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_default.jsx +12 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_global_props.html.erb +10 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_global_props.jsx +18 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_global_props.md +1 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_tag.html.erb +7 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_tag.jsx +25 -0
- data/app/pb_kits/playbook/pb_container/docs/_container_tag.md +5 -0
- data/app/pb_kits/playbook/pb_container/docs/_description.md +1 -0
- data/app/pb_kits/playbook/pb_container/docs/_playground.json +57 -0
- data/app/pb_kits/playbook/pb_container/docs/_playground.overrides.json +54 -0
- data/app/pb_kits/playbook/pb_container/docs/example.yml +12 -0
- data/app/pb_kits/playbook/pb_container/docs/index.js +3 -0
- data/app/pb_kits/playbook/pb_container/kit.schema.json +52 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +0 -1
- data/dist/chunks/_detail-CyTyC7gJ.js +5 -0
- data/dist/chunks/{_pb_line_graph-BGyCJjgG.js → _pb_line_graph-CUJ7NJIr.js} +1 -1
- data/dist/chunks/_table-DDKdCER5.js +1 -0
- data/dist/chunks/_typeahead-DdVBwRQT.js +1 -0
- data/dist/chunks/{globalProps-K1DCn3il.js → globalProps-DDcpyjvz.js} +1 -1
- data/dist/chunks/lib-D57mygNT.js +29 -0
- data/dist/chunks/{time_picker_helper-BZutIzB3.js → time_picker_helper-B_FN8E9Y.js} +1 -1
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +7 -0
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +28 -13
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.html.erb +0 -71
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible.jsx +0 -57
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_rails.md +0 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_overflow_visible_react.md +0 -1
- data/dist/chunks/_detail-B4-co8rv.js +0 -5
- data/dist/chunks/_table-SGw4kUye.js +0 -1
- data/dist/chunks/_typeahead-DeIqOMbJ.js +0 -1
- data/dist/chunks/lib-7vm9BMqp.js +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b282160685aeb7935309b54bddb2856ff20b4957a8ca3455a268ab52693bb8e7
|
|
4
|
+
data.tar.gz: 31b055f1c7c84e23d99b25cb980a5ad370f53088e265308ccd4e72a0b74500ba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ce34582a3e72b462fa81e781a464f4f1352aaad7a37ffbace981816b5ec899397a6c29d8aa487af44d0fe20bda2f2d8280574bbf5a0a31548eed4c8e576976d8
|
|
7
|
+
data.tar.gz: 41690ad445b535cab92bb9a8c7a1e3c23e382b2e3661def036d7b85b16b7d2f6ec5c4419b22cdabdfc96f289231be50a4241d583e716a038a19efd82dfd63b3d
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
@import 'pb_circle_icon_button/circle_icon_button';
|
|
13
13
|
@import 'pb_collapsible/collapsible';
|
|
14
14
|
@import 'pb_contact/contact';
|
|
15
|
+
@import 'pb_container/container';
|
|
15
16
|
@import 'pb_copy_button/copy_button';
|
|
16
17
|
@import 'pb_currency/currency';
|
|
17
18
|
@import 'pb_dashboard_value/dashboard_value';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import classnames from 'classnames'
|
|
3
|
+
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
|
4
|
+
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
|
5
|
+
|
|
6
|
+
type ContainerProps = {
|
|
7
|
+
aria?: { [key: string]: string },
|
|
8
|
+
children?: React.ReactNode,
|
|
9
|
+
className?: string,
|
|
10
|
+
data?: { [key: string]: string },
|
|
11
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) | ((event: any) => void) | any },
|
|
12
|
+
tag?: "div" | "span" | "a" | "button" | "option" | "table" | "tbody" | "thead" | "tfoot" | "tr" | "td" | "th" | "img" | "section" | "article" | "main" | "header" | "footer" | "nav" | "aside"
|
|
13
|
+
id?: string,
|
|
14
|
+
} & GlobalProps
|
|
15
|
+
|
|
16
|
+
const Container = (props: ContainerProps): React.ReactElement => {
|
|
17
|
+
const {
|
|
18
|
+
aria = {},
|
|
19
|
+
children,
|
|
20
|
+
className,
|
|
21
|
+
data = {},
|
|
22
|
+
htmlOptions = {},
|
|
23
|
+
tag = 'div',
|
|
24
|
+
id,
|
|
25
|
+
} = props
|
|
26
|
+
|
|
27
|
+
const ariaProps = buildAriaProps(aria)
|
|
28
|
+
const dataProps = buildDataProps(data)
|
|
29
|
+
const htmlProps = buildHtmlProps(htmlOptions)
|
|
30
|
+
const classes = classnames(buildCss('pb_container_kit'), globalProps(props), className)
|
|
31
|
+
|
|
32
|
+
const Tag = tag
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Tag
|
|
36
|
+
{...ariaProps}
|
|
37
|
+
{...dataProps}
|
|
38
|
+
{...htmlProps}
|
|
39
|
+
className={classes}
|
|
40
|
+
id={id}
|
|
41
|
+
>
|
|
42
|
+
{children}
|
|
43
|
+
</Tag>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default Container
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Playbook
|
|
4
|
+
module PbContainer
|
|
5
|
+
class Container < ::Playbook::KitBase
|
|
6
|
+
prop :tag, type: Playbook::Props::Enum,
|
|
7
|
+
values: %w[div span a button option table tbody thead tfoot tr td th img section article main header footer nav aside],
|
|
8
|
+
default: "div"
|
|
9
|
+
|
|
10
|
+
def classname
|
|
11
|
+
generate_classname("pb_container_kit")
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render, screen } from '../utilities/test-utils'
|
|
3
|
+
|
|
4
|
+
import { Container } from 'playbook-ui'
|
|
5
|
+
|
|
6
|
+
/* See these resources for more testing info:
|
|
7
|
+
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
|
8
|
+
- https://jestjs.io/docs/en/using-matchers
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
test('Container renders with default props', () => {
|
|
12
|
+
const props = {
|
|
13
|
+
children: 'Container Content'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
render(<Container {...props}>{props.children}</Container>)
|
|
17
|
+
expect(screen.getByText(props.children)).toBeInTheDocument()
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('Container renders with custom tag', () => {
|
|
21
|
+
const props = {
|
|
22
|
+
tag: 'span',
|
|
23
|
+
children: 'Container Content'
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
render(<Container {...props}>{props.children}</Container>)
|
|
27
|
+
expect(screen.getByText(props.children)).toBeInTheDocument()
|
|
28
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Container from '../../pb_container/_container'
|
|
3
|
+
|
|
4
|
+
const ContainerGlobalProps = (props) => (
|
|
5
|
+
<Container
|
|
6
|
+
border="default"
|
|
7
|
+
borderRadius="lg"
|
|
8
|
+
hover={{ shadow: "deepest" }}
|
|
9
|
+
maxWidth="sm"
|
|
10
|
+
padding="md"
|
|
11
|
+
shadow="deep"
|
|
12
|
+
{...props}
|
|
13
|
+
>
|
|
14
|
+
Hello, I am a styled container
|
|
15
|
+
</Container>
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
export default ContainerGlobalProps
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use Container with global props instead of using a `div` and and having to write a SCSS file. This example shows usage of padding, border, borderRadius, hover, shadow, and maxWidth as props. See our [global props page](https://playbook.powerapp.cloud/global_props) for the full list of available options.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<%= pb_rails("container", props: { tag: "span" }) do %>
|
|
2
|
+
Hello, I am a span container
|
|
3
|
+
<% end %>
|
|
4
|
+
<br />
|
|
5
|
+
<%= pb_rails("container", props: { html_options: { href: "https://playbook.powerapp.cloud/", target: "_blank" }, tag: "a" }) do %>
|
|
6
|
+
Hello, I am an a container
|
|
7
|
+
<% end %>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Container from '../../pb_container/_container'
|
|
3
|
+
|
|
4
|
+
const ContainerTag = (props) => {
|
|
5
|
+
return (
|
|
6
|
+
<>
|
|
7
|
+
<Container
|
|
8
|
+
tag="span"
|
|
9
|
+
{...props}
|
|
10
|
+
>
|
|
11
|
+
Hello, I am a span container
|
|
12
|
+
</Container>
|
|
13
|
+
<br />
|
|
14
|
+
<Container
|
|
15
|
+
htmlOptions={{ href: "https://playbook.powerapp.cloud/", target: "_blank" }}
|
|
16
|
+
tag="a"
|
|
17
|
+
{...props}
|
|
18
|
+
>
|
|
19
|
+
Hello, I am an a container
|
|
20
|
+
</Container>
|
|
21
|
+
</>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default ContainerTag
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Use the `tag` prop to change the HTML element rendered. Container uses `div` by default. Available tags are:
|
|
2
|
+
|
|
3
|
+
`div` `span` `a` `button` `option` `table` `tbody` `thead` `tfoot` `tr` `td` `th` `img` `section` `article` `main` `header` `footer` `nav` `aside`
|
|
4
|
+
|
|
5
|
+
Use `htmlOptions`/`html_options` to add any HTML attributes to the kit. For example, we add `href` here so the `a` tag is a working link.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Use Container in place of a custom `div` and SCSS file. Apply global props for spacing, border, radius, shadow, and more.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": "<Container{{props}}>\n {{children}}\n</Container>",
|
|
3
|
+
"propTargets": {},
|
|
4
|
+
"defaults": {
|
|
5
|
+
"tag": "div"
|
|
6
|
+
},
|
|
7
|
+
"groups": [
|
|
8
|
+
{
|
|
9
|
+
"name": "Layout",
|
|
10
|
+
"props": [
|
|
11
|
+
"tag"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"presets": [
|
|
16
|
+
{
|
|
17
|
+
"name": "Default",
|
|
18
|
+
"props": {},
|
|
19
|
+
"children": "Hello, I am a div container"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"name": "Span",
|
|
23
|
+
"props": {
|
|
24
|
+
"tag": "span"
|
|
25
|
+
},
|
|
26
|
+
"children": "Hello, I am a span container"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"name": "Global Props",
|
|
30
|
+
"props": {
|
|
31
|
+
"border": "default",
|
|
32
|
+
"borderRadius": "lg",
|
|
33
|
+
"hover": {
|
|
34
|
+
"shadow": "deepest"
|
|
35
|
+
},
|
|
36
|
+
"maxWidth": "sm",
|
|
37
|
+
"padding": "md",
|
|
38
|
+
"shadow": "deep"
|
|
39
|
+
},
|
|
40
|
+
"children": "Hello, I am a styled container"
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"conditionals": {},
|
|
44
|
+
"hints": {
|
|
45
|
+
"link_tag": {
|
|
46
|
+
"when": {
|
|
47
|
+
"tag": "a"
|
|
48
|
+
},
|
|
49
|
+
"message": "Use htmlOptions to add href and other HTML attributes when tag is a.",
|
|
50
|
+
"type": "info"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"children": {
|
|
54
|
+
"editable": true,
|
|
55
|
+
"default": "Hello, I am a div container"
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"template": "<Container{{props}}>\n {{children}}\n</Container>",
|
|
3
|
+
"children": {
|
|
4
|
+
"editable": true,
|
|
5
|
+
"default": "Hello, I am a div container"
|
|
6
|
+
},
|
|
7
|
+
"defaults": {
|
|
8
|
+
"tag": "div"
|
|
9
|
+
},
|
|
10
|
+
"groups": [
|
|
11
|
+
{
|
|
12
|
+
"name": "Layout",
|
|
13
|
+
"props": ["tag"]
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"presets": [
|
|
17
|
+
{
|
|
18
|
+
"name": "Default",
|
|
19
|
+
"props": {},
|
|
20
|
+
"children": "Hello, I am a div container"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "Span",
|
|
24
|
+
"props": {
|
|
25
|
+
"tag": "span"
|
|
26
|
+
},
|
|
27
|
+
"children": "Hello, I am a span container"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "Global Props",
|
|
31
|
+
"props": {
|
|
32
|
+
"border": "default",
|
|
33
|
+
"borderRadius": "lg",
|
|
34
|
+
"hover": {
|
|
35
|
+
"shadow": "deepest"
|
|
36
|
+
},
|
|
37
|
+
"maxWidth": "sm",
|
|
38
|
+
"padding": "md",
|
|
39
|
+
"shadow": "deep"
|
|
40
|
+
},
|
|
41
|
+
"children": "Hello, I am a styled container"
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"conditionals": {},
|
|
45
|
+
"hints": {
|
|
46
|
+
"link_tag": {
|
|
47
|
+
"when": {
|
|
48
|
+
"tag": "a"
|
|
49
|
+
},
|
|
50
|
+
"message": "Use htmlOptions to add href and other HTML attributes when tag is a.",
|
|
51
|
+
"type": "info"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://playbook.powerapp.cloud/schemas/kit-schema.json",
|
|
3
|
+
"name": "Container",
|
|
4
|
+
"description": "Container component",
|
|
5
|
+
"platforms": [
|
|
6
|
+
"react",
|
|
7
|
+
"rails"
|
|
8
|
+
],
|
|
9
|
+
"props": {
|
|
10
|
+
"tag": {
|
|
11
|
+
"type": "enum",
|
|
12
|
+
"platforms": [
|
|
13
|
+
"react",
|
|
14
|
+
"rails"
|
|
15
|
+
],
|
|
16
|
+
"values": [
|
|
17
|
+
"div",
|
|
18
|
+
"span",
|
|
19
|
+
"a",
|
|
20
|
+
"button",
|
|
21
|
+
"option",
|
|
22
|
+
"table",
|
|
23
|
+
"tbody",
|
|
24
|
+
"thead",
|
|
25
|
+
"tfoot",
|
|
26
|
+
"tr",
|
|
27
|
+
"td",
|
|
28
|
+
"th",
|
|
29
|
+
"img",
|
|
30
|
+
"section",
|
|
31
|
+
"article",
|
|
32
|
+
"main",
|
|
33
|
+
"header",
|
|
34
|
+
"footer",
|
|
35
|
+
"nav",
|
|
36
|
+
"aside"
|
|
37
|
+
],
|
|
38
|
+
"default": "div"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"globalProps": true,
|
|
42
|
+
"usage": {
|
|
43
|
+
"react": {
|
|
44
|
+
"import": "import { Container } from 'playbook-ui'",
|
|
45
|
+
"example": "<Container tag=\"div\"></Container>"
|
|
46
|
+
},
|
|
47
|
+
"rails": {
|
|
48
|
+
"import": null,
|
|
49
|
+
"example": "<%= pb_rails(\"container\", props: { tag: \"div\" }) %>"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -12,7 +12,6 @@ examples:
|
|
|
12
12
|
- dialog_full_height_placement: Full Height Placement
|
|
13
13
|
- dialog_loading: Loading
|
|
14
14
|
- dialog_turbo_frames: Within Turbo Frames
|
|
15
|
-
- dialog_overflow_visible: Overflow Visible
|
|
16
15
|
- dialog_closeable: Close Button in Header
|
|
17
16
|
|
|
18
17
|
|
|
@@ -27,7 +26,6 @@ examples:
|
|
|
27
26
|
- dialog_full_height: Full Height
|
|
28
27
|
- dialog_full_height_placement: Full Height Placement
|
|
29
28
|
- dialog_loading: Loading
|
|
30
|
-
- dialog_overflow_visible: Overflow Visible
|
|
31
29
|
- dialog_closeable: Close Button in Header
|
|
32
30
|
|
|
33
31
|
swift:
|
|
@@ -9,5 +9,4 @@ export { default as DialogStackedAlert } from './_dialog_stacked_alert.jsx'
|
|
|
9
9
|
export { default as DialogFullHeight } from './_dialog_full_height.jsx'
|
|
10
10
|
export { default as DialogFullHeightPlacement } from './_dialog_full_height_placement.jsx'
|
|
11
11
|
export { default as DialogLoading } from './_dialog_loading.jsx'
|
|
12
|
-
export { default as DialogOverflowVisible } from './_dialog_overflow_visible.jsx'
|
|
13
12
|
export { default as DialogCloseable } from './_dialog_closeable.jsx'
|