@mirai/ui 1.1.16 → 2.0.1
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.
- package/build/components/Action/Action.js +2 -5
- package/build/components/Action/Action.js.map +1 -1
- package/build/components/Action/Action.stories.js +1 -1
- package/build/components/Action/Action.stories.js.map +1 -1
- package/build/components/Action/__tests__/__snapshots__/Action.test.js.snap +42 -30
- package/build/components/Button/Button.js +4 -6
- package/build/components/Button/Button.js.map +1 -1
- package/build/components/Button/__tests__/__snapshots__/Button.test.js.snap +38 -27
- package/build/components/Calendar/Calendar.js +1 -1
- package/build/components/Calendar/Calendar.js.map +1 -1
- package/build/components/Calendar/Calendar.module.css +5 -5
- package/build/components/Calendar/__tests__/__snapshots__/Calendar.test.jsx.snap +15576 -15544
- package/build/components/Form/Form.js +2 -5
- package/build/components/Form/Form.js.map +1 -1
- package/build/components/Form/__tests__/__snapshots__/Form.test.jsx.snap +14 -12
- package/build/components/InputDate/InputDate.js +1 -0
- package/build/components/InputDate/InputDate.js.map +1 -1
- package/build/components/InputDate/__tests__/__snapshots__/InputDate.test.js.snap +67 -42
- package/build/components/InputNumber/InputNumber.js +17 -4
- package/build/components/InputNumber/InputNumber.js.map +1 -1
- package/build/components/InputNumber/__tests__/__snapshots__/InputNumber.test.js.snap +198 -114
- package/build/components/InputOption/InputOption.js +6 -2
- package/build/components/InputOption/InputOption.js.map +1 -1
- package/build/components/InputOption/__tests__/__snapshots__/InputOption.test.js.snap +114 -75
- package/build/components/InputPhone/InputPhone.js +8 -1
- package/build/components/InputPhone/InputPhone.js.map +1 -1
- package/build/components/InputPhone/InputPhone.module.css +1 -1
- package/build/components/InputPhone/__tests__/__snapshots__/InputPhone.test.js.snap +448 -354
- package/build/components/InputSelect/InputSelect.js +10 -1
- package/build/components/InputSelect/InputSelect.js.map +1 -1
- package/build/components/InputSelect/__tests__/__snapshots__/InputSelect.test.js.snap +118 -112
- package/build/components/InputText/InputText.js +6 -2
- package/build/components/InputText/InputText.js.map +1 -1
- package/build/components/InputText/__tests__/__snapshots__/InputText.test.js.snap +160 -130
- package/build/components/InputText/partials/InputText.Label.js +1 -0
- package/build/components/InputText/partials/InputText.Label.js.map +1 -1
- package/build/components/Menu/Menu.js +1 -0
- package/build/components/Menu/Menu.js.map +1 -1
- package/build/components/Menu/__tests__/__snapshots__/Menu.test.jsx.snap +76 -55
- package/build/components/Modal/Modal.js +20 -6
- package/build/components/Modal/Modal.js.map +1 -1
- package/build/components/Modal/__tests__/__snapshots__/Modal.test.js.snap +106 -72
- package/build/components/Notification/Notification.js +1 -0
- package/build/components/Notification/Notification.js.map +1 -1
- package/build/components/Notification/__tests__/__snapshots__/Notification.test.js.snap +328 -288
- package/build/components/Progress/Progress.js +1 -0
- package/build/components/Progress/Progress.js.map +1 -1
- package/build/components/Progress/__tests__/__snapshots__/Progress.test.jsx.snap +31 -18
- package/build/components/Slider/Slider.js +3 -2
- package/build/components/Slider/Slider.js.map +1 -1
- package/build/components/Slider/Slider.module.css +1 -1
- package/build/components/Slider/__tests__/__snapshots__/Slider.test.js.snap +475 -339
- package/build/components/Table/Table.js +2 -4
- package/build/components/Table/Table.js.map +1 -1
- package/build/components/Table/__tests__/__snapshots__/Table.ColumnFilter.test.js.snap +222 -192
- package/build/components/Table/__tests__/__snapshots__/Table.test.js.snap +878 -432
- package/build/components/Tooltip/Tooltip.js +3 -4
- package/build/components/Tooltip/Tooltip.js.map +1 -1
- package/build/components/Tooltip/__tests__/__snapshots__/Tooltip.test.jsx.snap +38 -28
- package/build/primitives/Checkbox/Checkbox.js +1 -0
- package/build/primitives/Checkbox/Checkbox.js.map +1 -1
- package/build/primitives/Checkbox/__tests__/__snapshots__/Checkbox.test.js.snap +35 -20
- package/build/primitives/Icon/Icon.js +1 -1
- package/build/primitives/Icon/Icon.js.map +1 -1
- package/build/primitives/Icon/__tests__/__snapshots__/Icon.test.js.snap +108 -82
- package/build/primitives/Layer/Layer.js +2 -1
- package/build/primitives/Layer/Layer.js.map +1 -1
- package/build/primitives/Layer/__tests__/__snapshots__/Layer.test.js.snap +60 -42
- package/build/primitives/Pressable/Pressable.constants.js +1 -1
- package/build/primitives/Pressable/Pressable.constants.js.map +1 -1
- package/build/primitives/Pressable/Pressable.js +7 -6
- package/build/primitives/Pressable/Pressable.js.map +1 -1
- package/build/primitives/Pressable/__tests__/__snapshots__/Pressable.test.js.snap +16 -12
- package/build/primitives/Primitive/Primitive.constants.js +1 -1
- package/build/primitives/Primitive/Primitive.constants.js.map +1 -1
- package/build/primitives/Primitive/Primitive.js +2 -2
- package/build/primitives/Primitive/Primitive.js.map +1 -1
- package/build/primitives/Primitive/__tests__/__snapshots__/Primitive.test.js.snap +12 -12
- package/build/primitives/Primitive/helpers/getTag.js +35 -0
- package/build/primitives/Primitive/helpers/getTag.js.map +1 -0
- package/build/primitives/Primitive/helpers/index.js +11 -0
- package/build/primitives/Primitive/helpers/index.js.map +1 -1
- package/build/primitives/Radio/Radio.js +1 -1
- package/build/primitives/Radio/Radio.js.map +1 -1
- package/build/primitives/Radio/__tests__/__snapshots__/Radio.test.js.snap +39 -21
- package/build/primitives/ScrollView/ScrollView.js +2 -5
- package/build/primitives/ScrollView/ScrollView.js.map +1 -1
- package/build/primitives/ScrollView/ScrollView.stories.js +6 -5
- package/build/primitives/ScrollView/ScrollView.stories.js.map +1 -1
- package/build/primitives/ScrollView/__tests__/__snapshots__/ScrollView.test.js.snap +24 -24
- package/build/primitives/Select/Select.js +7 -4
- package/build/primitives/Select/Select.js.map +1 -1
- package/build/primitives/Select/__tests__/__snapshots__/Select.test.js.snap +35 -0
- package/build/primitives/Switch/Switch.js +1 -1
- package/build/primitives/Switch/Switch.js.map +1 -1
- package/build/primitives/Switch/__tests__/__snapshots__/Switch.test.js.snap +60 -40
- package/build/primitives/Text/Text.js +4 -3
- package/build/primitives/Text/Text.js.map +1 -1
- package/build/primitives/Text/__tests__/__snapshots__/Text.test.js.snap +68 -68
- package/build/primitives/Text/helpers/parseMarkdown.js +3 -1
- package/build/primitives/Text/helpers/parseMarkdown.js.map +1 -1
- package/build/primitives/View/View.js +2 -5
- package/build/primitives/View/View.js.map +1 -1
- package/build/primitives/View/__tests__/__snapshots__/View.test.js.snap +15 -15
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","propFixed","fixed","forceRender","forceLeft","left","forceRight","right","forceTop","top","timestamp","visible","onPosition","others","device","useDevice","componentRef","useRef","contentRef","useState","setFixed","position","setPosition","useLayoutEffect","content","current","ResizeObserver","observer","calcPosition","observe","unobserve","componentEl","firstChild","contentEl","componentLayout","getElementLayout","scrollTop","getScrollParent","contentLayout","modal","getModalParent","getLayerPosition","orientation","isComponentFixed","children","React","Children","map","child","className","contentStyle","style","createWrapper","role","container","testId","find","name","type","LayerContent","styles","layer","hidden","createElement","Fragment","undefined","displayName","propTypes","PropTypes","bool","node","number","func"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Primitive } from '../Primitive';\nimport { getElementLayout, getLayerPosition, getModalParent, getScrollParent, isComponentFixed } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n fixed: propFixed,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n timestamp,\n visible,\n onPosition = () => {},\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [fixed, setFixed] = useState();\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const content = contentRef?.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n const observer = new ResizeObserver(calcPosition);\n observer.observe(content);\n\n return () => observer.unobserve(content);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(\n () => calcPosition(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [centered, device, forceBottom, forceLeft, forceRight, forceTop, timestamp, visible],\n );\n\n const calcPosition = () => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = { ...getElementLayout(componentEl), scrollTop: getScrollParent(componentEl)?.scrollTop };\n const contentLayout = getElementLayout(contentEl);\n const modal = getModalParent(componentEl);\n const {\n left = 0,\n top = 0,\n orientation = {},\n } = getLayerPosition(componentLayout, contentLayout, device, modal, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setFixed(propFixed || isComponentFixed(componentEl));\n setPosition({ left: `${left}px`, top: `${top}px` });\n onPosition(orientation);\n };\n\n const children = React.Children.map(others.children || [], (child) => child);\n const { className, style: contentStyle } = others;\n const createWrapper = className || contentStyle;\n\n return (\n <>\n <Primitive\n ref={componentRef}\n role={others.role || 'layer'}\n tag
|
|
1
|
+
{"version":3,"file":"Layer.js","names":["Layer","forceBottom","bottom","centered","propFixed","fixed","forceRender","forceLeft","left","forceRight","right","forceTop","top","timestamp","visible","onPosition","others","device","useDevice","componentRef","useRef","contentRef","useState","setFixed","position","setPosition","useLayoutEffect","content","current","ResizeObserver","observer","calcPosition","observe","unobserve","componentEl","firstChild","contentEl","componentLayout","getElementLayout","scrollTop","getScrollParent","contentLayout","modal","getModalParent","getLayerPosition","orientation","isComponentFixed","children","React","Children","map","child","className","contentStyle","style","createWrapper","role","tag","container","testId","find","name","type","LayerContent","styles","layer","hidden","createElement","Fragment","undefined","displayName","propTypes","PropTypes","bool","node","number","func"],"sources":["../../../src/primitives/Layer/Layer.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React, { useLayoutEffect, useRef, useState } from 'react';\n\nimport { styles } from '../../helpers';\nimport { useDevice } from '../../hooks';\nimport { Primitive } from '../Primitive';\nimport { getElementLayout, getLayerPosition, getModalParent, getScrollParent, isComponentFixed } from './helpers';\nimport style from './Layer.module.css';\nimport { LayerContent } from './LayerContent';\n\nconst Layer = ({\n bottom: forceBottom,\n centered,\n fixed: propFixed,\n forceRender = true,\n left: forceLeft,\n right: forceRight,\n top: forceTop,\n timestamp,\n visible,\n onPosition = () => {},\n ...others\n}) => {\n const device = useDevice();\n const componentRef = useRef();\n const contentRef = useRef();\n\n const [fixed, setFixed] = useState();\n const [position, setPosition] = useState();\n\n useLayoutEffect(() => {\n const content = contentRef?.current;\n if (!content || typeof ResizeObserver === 'undefined') return;\n\n const observer = new ResizeObserver(calcPosition);\n observer.observe(content);\n\n return () => observer.unobserve(content);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useLayoutEffect(\n () => calcPosition(),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [centered, device, forceBottom, forceLeft, forceRight, forceTop, timestamp, visible],\n );\n\n const calcPosition = () => {\n const { current: { firstChild: componentEl } = {} } = componentRef;\n const { current: contentEl } = contentRef;\n\n if (!componentEl || !contentEl) return setPosition();\n\n const componentLayout = { ...getElementLayout(componentEl), scrollTop: getScrollParent(componentEl)?.scrollTop };\n const contentLayout = getElementLayout(contentEl);\n const modal = getModalParent(componentEl);\n const {\n left = 0,\n top = 0,\n orientation = {},\n } = getLayerPosition(componentLayout, contentLayout, device, modal, {\n centered,\n forceBottom,\n forceLeft,\n forceRight,\n forceTop,\n });\n\n setFixed(propFixed || isComponentFixed(componentEl));\n setPosition({ left: `${left}px`, top: `${top}px` });\n onPosition(orientation);\n };\n\n const children = React.Children.map(others.children || [], (child) => child);\n const { className, style: contentStyle } = others;\n const createWrapper = className || contentStyle;\n\n return (\n <>\n <Primitive\n ref={componentRef}\n role={others.role || 'layer'}\n tag={others.tag || 'layer'}\n className={style.container}\n testId={others.testId}\n >\n {children.find(({ type: { name } }) => name !== LayerContent.name)}\n </Primitive>\n\n {(forceRender || visible) && (\n <Primitive\n ref={contentRef}\n role={others.role ? `${others.role}-content` : 'layer-content'}\n tag={`${others.tag || 'layer'}_content`}\n className={styles(style.layer, fixed && style.fixed, !visible && style.hidden)}\n style={{ ...position }}\n >\n {React.createElement(\n createWrapper ? 'div' : React.Fragment,\n createWrapper ? { className, style: contentStyle } : undefined,\n children?.find(({ type: { name } }) => name === LayerContent.name),\n )}\n </Primitive>\n )}\n </>\n );\n};\n\nLayer.displayName = 'Primitive:Layer';\n\nLayer.propTypes = {\n bottom: PropTypes.bool,\n centered: PropTypes.bool,\n children: PropTypes.node,\n fixed: PropTypes.bool,\n forceRender: PropTypes.bool,\n left: PropTypes.bool,\n right: PropTypes.bool,\n timestamp: PropTypes.number,\n top: PropTypes.bool,\n visible: PropTypes.bool,\n onPosition: PropTypes.func,\n};\n\nexport { Layer };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAA8C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE9C,IAAMA,KAAK,GAAG,SAARA,KAAK,OAYL;EAAA,IAXIC,WAAW,QAAnBC,MAAM;IACNC,QAAQ,QAARA,QAAQ;IACDC,SAAS,QAAhBC,KAAK;IAAA,wBACLC,WAAW;IAAXA,WAAW,iCAAG,IAAI;IACZC,SAAS,QAAfC,IAAI;IACGC,UAAU,QAAjBC,KAAK;IACAC,QAAQ,QAAbC,GAAG;IACHC,SAAS,QAATA,SAAS;IACTC,OAAO,QAAPA,OAAO;IAAA,uBACPC,UAAU;IAAVA,UAAU,gCAAG,YAAM,CAAC,CAAC;IAClBC,MAAM;EAET,IAAMC,MAAM,GAAG,IAAAC,gBAAS,GAAE;EAC1B,IAAMC,YAAY,GAAG,IAAAC,aAAM,GAAE;EAC7B,IAAMC,UAAU,GAAG,IAAAD,aAAM,GAAE;EAE3B,gBAA0B,IAAAE,eAAQ,GAAE;IAAA;IAA7BjB,KAAK;IAAEkB,QAAQ;EACt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CAACC,IAAI;EACvB1D,UAAU,EAAEyD,kBAAS,CAACI;AACxB,CAAC"}
|
|
@@ -2,25 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`primitive:<Layer> inherit:className 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
5
|
+
<ui_layer
|
|
6
6
|
class="container"
|
|
7
7
|
/>
|
|
8
|
-
<
|
|
8
|
+
<ui_layer_content
|
|
9
9
|
class="layer hidden"
|
|
10
10
|
>
|
|
11
11
|
<div
|
|
12
12
|
class="mirai"
|
|
13
13
|
/>
|
|
14
|
-
</
|
|
14
|
+
</ui_layer_content>
|
|
15
15
|
</DocumentFragment>
|
|
16
16
|
`;
|
|
17
17
|
|
|
18
18
|
exports[`primitive:<Layer> renders 1`] = `
|
|
19
19
|
<DocumentFragment>
|
|
20
|
-
<
|
|
20
|
+
<ui_layer
|
|
21
21
|
class="container"
|
|
22
22
|
/>
|
|
23
|
-
<
|
|
23
|
+
<ui_layer_content
|
|
24
|
+
class="layer hidden"
|
|
25
|
+
/>
|
|
26
|
+
</DocumentFragment>
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
exports[`primitive:<Layer> tag 1`] = `
|
|
30
|
+
<DocumentFragment>
|
|
31
|
+
<ui_tag
|
|
32
|
+
class="container"
|
|
33
|
+
/>
|
|
34
|
+
<ui_tag_content
|
|
24
35
|
class="layer hidden"
|
|
25
36
|
/>
|
|
26
37
|
</DocumentFragment>
|
|
@@ -28,11 +39,11 @@ exports[`primitive:<Layer> renders 1`] = `
|
|
|
28
39
|
|
|
29
40
|
exports[`primitive:<Layer> testId 1`] = `
|
|
30
41
|
<DocumentFragment>
|
|
31
|
-
<
|
|
42
|
+
<ui_layer
|
|
32
43
|
class="container"
|
|
33
44
|
data-testid="mirai"
|
|
34
45
|
/>
|
|
35
|
-
<
|
|
46
|
+
<ui_layer_content
|
|
36
47
|
class="layer hidden"
|
|
37
48
|
/>
|
|
38
49
|
</DocumentFragment>
|
|
@@ -40,89 +51,93 @@ exports[`primitive:<Layer> testId 1`] = `
|
|
|
40
51
|
|
|
41
52
|
exports[`primitive:<Layer> w/ centered && visible 1`] = `
|
|
42
53
|
<DocumentFragment>
|
|
43
|
-
<
|
|
54
|
+
<ui_layer
|
|
44
55
|
class="container"
|
|
45
56
|
>
|
|
46
57
|
<button
|
|
47
58
|
class="pressable button"
|
|
59
|
+
tabindex="0"
|
|
48
60
|
>
|
|
49
61
|
Action
|
|
50
62
|
</button>
|
|
51
|
-
</
|
|
52
|
-
<
|
|
63
|
+
</ui_layer>
|
|
64
|
+
<ui_layer_content
|
|
53
65
|
class="layer"
|
|
54
66
|
style="left: 0px; top: 0px;"
|
|
55
67
|
>
|
|
56
|
-
<
|
|
68
|
+
<ui_text
|
|
57
69
|
class="text paragraph"
|
|
58
70
|
>
|
|
59
71
|
Mirai
|
|
60
|
-
</
|
|
61
|
-
</
|
|
72
|
+
</ui_text>
|
|
73
|
+
</ui_layer_content>
|
|
62
74
|
</DocumentFragment>
|
|
63
75
|
`;
|
|
64
76
|
|
|
65
77
|
exports[`primitive:<Layer> w/ child fixed 1`] = `
|
|
66
78
|
<DocumentFragment>
|
|
67
|
-
<
|
|
79
|
+
<ui_layer
|
|
68
80
|
class="container"
|
|
69
81
|
>
|
|
70
82
|
<button
|
|
71
83
|
class="pressable button"
|
|
72
84
|
style="position: fixed;"
|
|
85
|
+
tabindex="0"
|
|
73
86
|
>
|
|
74
87
|
Action
|
|
75
88
|
</button>
|
|
76
|
-
</
|
|
77
|
-
<
|
|
89
|
+
</ui_layer>
|
|
90
|
+
<ui_layer_content
|
|
78
91
|
class="layer fixed hidden"
|
|
79
92
|
style="left: 0px; top: 0px;"
|
|
80
93
|
>
|
|
81
|
-
<
|
|
94
|
+
<ui_text
|
|
82
95
|
class="text paragraph"
|
|
83
96
|
>
|
|
84
97
|
Mirai
|
|
85
|
-
</
|
|
86
|
-
</
|
|
98
|
+
</ui_text>
|
|
99
|
+
</ui_layer_content>
|
|
87
100
|
</DocumentFragment>
|
|
88
101
|
`;
|
|
89
102
|
|
|
90
103
|
exports[`primitive:<Layer> w/ component & <LayerContent> 1`] = `
|
|
91
104
|
<DocumentFragment>
|
|
92
|
-
<
|
|
105
|
+
<ui_layer
|
|
93
106
|
class="container"
|
|
94
107
|
>
|
|
95
108
|
<button
|
|
96
109
|
class="pressable button"
|
|
110
|
+
tabindex="0"
|
|
97
111
|
>
|
|
98
112
|
Action
|
|
99
113
|
</button>
|
|
100
|
-
</
|
|
101
|
-
<
|
|
114
|
+
</ui_layer>
|
|
115
|
+
<ui_layer_content
|
|
102
116
|
class="layer hidden"
|
|
103
117
|
style="left: 0px; top: 0px;"
|
|
104
118
|
>
|
|
105
|
-
<
|
|
119
|
+
<ui_text
|
|
106
120
|
class="text paragraph"
|
|
107
121
|
>
|
|
108
122
|
Mirai
|
|
109
|
-
</
|
|
110
|
-
</
|
|
123
|
+
</ui_text>
|
|
124
|
+
</ui_layer_content>
|
|
111
125
|
</DocumentFragment>
|
|
112
126
|
`;
|
|
113
127
|
|
|
114
128
|
exports[`primitive:<Layer> w/ component 1`] = `
|
|
115
129
|
<DocumentFragment>
|
|
116
|
-
<
|
|
130
|
+
<ui_layer
|
|
117
131
|
class="container"
|
|
118
132
|
>
|
|
119
133
|
<button
|
|
120
134
|
class="pressable button"
|
|
135
|
+
tabindex="0"
|
|
121
136
|
>
|
|
122
137
|
Action
|
|
123
138
|
</button>
|
|
124
|
-
</
|
|
125
|
-
<
|
|
139
|
+
</ui_layer>
|
|
140
|
+
<ui_layer_content
|
|
126
141
|
class="layer hidden"
|
|
127
142
|
style="left: 0px; top: 0px;"
|
|
128
143
|
/>
|
|
@@ -131,62 +146,65 @@ exports[`primitive:<Layer> w/ component 1`] = `
|
|
|
131
146
|
|
|
132
147
|
exports[`primitive:<Layer> w/ fixed 1`] = `
|
|
133
148
|
<DocumentFragment>
|
|
134
|
-
<
|
|
149
|
+
<ui_layer
|
|
135
150
|
class="container"
|
|
136
151
|
>
|
|
137
152
|
<button
|
|
138
153
|
class="pressable button"
|
|
154
|
+
tabindex="0"
|
|
139
155
|
>
|
|
140
156
|
Action
|
|
141
157
|
</button>
|
|
142
|
-
</
|
|
143
|
-
<
|
|
158
|
+
</ui_layer>
|
|
159
|
+
<ui_layer_content
|
|
144
160
|
class="layer fixed hidden"
|
|
145
161
|
style="left: 0px; top: 0px;"
|
|
146
162
|
>
|
|
147
|
-
<
|
|
163
|
+
<ui_text
|
|
148
164
|
class="text paragraph"
|
|
149
165
|
>
|
|
150
166
|
Mirai
|
|
151
|
-
</
|
|
152
|
-
</
|
|
167
|
+
</ui_text>
|
|
168
|
+
</ui_layer_content>
|
|
153
169
|
</DocumentFragment>
|
|
154
170
|
`;
|
|
155
171
|
|
|
156
172
|
exports[`primitive:<Layer> w/ forceRender={false} & <LayerContent> 1`] = `
|
|
157
173
|
<DocumentFragment>
|
|
158
|
-
<
|
|
174
|
+
<ui_layer
|
|
159
175
|
class="container"
|
|
160
176
|
>
|
|
161
177
|
<button
|
|
162
178
|
class="pressable button"
|
|
179
|
+
tabindex="0"
|
|
163
180
|
>
|
|
164
181
|
Action
|
|
165
182
|
</button>
|
|
166
|
-
</
|
|
183
|
+
</ui_layer>
|
|
167
184
|
</DocumentFragment>
|
|
168
185
|
`;
|
|
169
186
|
|
|
170
187
|
exports[`primitive:<Layer> w/ visible 1`] = `
|
|
171
188
|
<DocumentFragment>
|
|
172
|
-
<
|
|
189
|
+
<ui_layer
|
|
173
190
|
class="container"
|
|
174
191
|
>
|
|
175
192
|
<button
|
|
176
193
|
class="pressable button"
|
|
194
|
+
tabindex="0"
|
|
177
195
|
>
|
|
178
196
|
Action
|
|
179
197
|
</button>
|
|
180
|
-
</
|
|
181
|
-
<
|
|
198
|
+
</ui_layer>
|
|
199
|
+
<ui_layer_content
|
|
182
200
|
class="layer"
|
|
183
201
|
style="left: 0px; top: 0px;"
|
|
184
202
|
>
|
|
185
|
-
<
|
|
203
|
+
<ui_text
|
|
186
204
|
class="text paragraph"
|
|
187
205
|
>
|
|
188
206
|
Mirai
|
|
189
|
-
</
|
|
190
|
-
</
|
|
207
|
+
</ui_text>
|
|
208
|
+
</ui_layer_content>
|
|
191
209
|
</DocumentFragment>
|
|
192
210
|
`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.constants.js","names":["KEY_ENTER"],"sources":["../../../src/primitives/Pressable/Pressable.constants.js"],"sourcesContent":["const KEY_ENTER =
|
|
1
|
+
{"version":3,"file":"Pressable.constants.js","names":["KEY_ENTER"],"sources":["../../../src/primitives/Pressable/Pressable.constants.js"],"sourcesContent":["const KEY_ENTER = 'Enter';\n\nexport { KEY_ENTER };\n"],"mappings":";;;;;;AAAA,IAAMA,SAAS,GAAG,OAAO;AAAC"}
|
|
@@ -11,7 +11,7 @@ var _helpers = require("../../helpers");
|
|
|
11
11
|
var _Primitive = require("../Primitive");
|
|
12
12
|
var _Pressable = require("./Pressable.constants");
|
|
13
13
|
var _PressableModule = _interopRequireDefault(require("./Pressable.module.css"));
|
|
14
|
-
var _excluded = ["children", "disabled", "preventDefault", "
|
|
14
|
+
var _excluded = ["children", "disabled", "preventDefault", "tabIndex", "onEnter", "onLeave", "onPress"];
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -25,8 +25,8 @@ var Pressable = function Pressable(_ref) {
|
|
|
25
25
|
disabled = _ref.disabled,
|
|
26
26
|
_ref$preventDefault = _ref.preventDefault,
|
|
27
27
|
preventDefault = _ref$preventDefault === void 0 ? true : _ref$preventDefault,
|
|
28
|
-
_ref$
|
|
29
|
-
|
|
28
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
29
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
|
|
30
30
|
onEnter = _ref.onEnter,
|
|
31
31
|
onLeave = _ref.onLeave,
|
|
32
32
|
_ref$onPress = _ref.onPress,
|
|
@@ -35,8 +35,9 @@ var Pressable = function Pressable(_ref) {
|
|
|
35
35
|
return /*#__PURE__*/_react.default.createElement(_Primitive.Primitive, _objectSpread(_objectSpread(_objectSpread({}, others), {}, {
|
|
36
36
|
disabled: disabled,
|
|
37
37
|
role: others.role || 'pressable',
|
|
38
|
-
tag: tag
|
|
38
|
+
tag: others.tag || 'pressable'
|
|
39
39
|
}, !disabled ? {
|
|
40
|
+
tabIndex: tabIndex,
|
|
40
41
|
onClick: function onClick(event) {
|
|
41
42
|
if (preventDefault) {
|
|
42
43
|
event.preventDefault();
|
|
@@ -45,7 +46,7 @@ var Pressable = function Pressable(_ref) {
|
|
|
45
46
|
onPress(event);
|
|
46
47
|
},
|
|
47
48
|
onKeyPress: function onKeyPress(event) {
|
|
48
|
-
if (event.
|
|
49
|
+
if (event.key === _Pressable.KEY_ENTER) {
|
|
49
50
|
if (preventDefault) {
|
|
50
51
|
event.preventDefault();
|
|
51
52
|
event.stopPropagation();
|
|
@@ -65,7 +66,7 @@ Pressable.propTypes = {
|
|
|
65
66
|
children: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
66
67
|
disabled: _propTypes.default.bool,
|
|
67
68
|
preventDefault: _propTypes.default.bool,
|
|
68
|
-
|
|
69
|
+
tabIndex: _propTypes.default.number,
|
|
69
70
|
onEnter: _propTypes.default.func,
|
|
70
71
|
onLeave: _propTypes.default.func,
|
|
71
72
|
onPress: _propTypes.default.func
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pressable.js","names":["Pressable","children","disabled","preventDefault","
|
|
1
|
+
{"version":3,"file":"Pressable.js","names":["Pressable","children","disabled","preventDefault","tabIndex","onEnter","onLeave","onPress","others","React","createElement","Primitive","role","tag","onClick","event","stopPropagation","onKeyPress","key","KEY_ENTER","onMouseEnter","onMouseLeave","className","styles","style","pressable","displayName","propTypes","PropTypes","oneOfType","string","node","bool","number","func"],"sources":["../../../src/primitives/Pressable/Pressable.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { styles } from '../../helpers';\nimport { Primitive } from '../Primitive';\nimport { KEY_ENTER } from './Pressable.constants';\nimport style from './Pressable.module.css';\n\nconst Pressable = ({\n children,\n disabled,\n preventDefault = true,\n tabIndex = 0,\n onEnter,\n onLeave,\n onPress = () => {},\n ...others\n}) =>\n React.createElement(\n Primitive,\n {\n ...others,\n disabled,\n role: others.role || 'pressable',\n tag: others.tag || 'pressable',\n ...(!disabled\n ? {\n tabIndex,\n onClick: (event) => {\n if (preventDefault) {\n event.preventDefault();\n event.stopPropagation();\n }\n onPress(event);\n },\n onKeyPress: (event) => {\n if (event.key === KEY_ENTER) {\n if (preventDefault) {\n event.preventDefault();\n event.stopPropagation();\n }\n onPress(event);\n }\n },\n onMouseEnter: onEnter,\n onMouseLeave: onLeave,\n }\n : {}),\n className: styles(style.pressable, disabled && style.disabled, others.className),\n },\n children,\n );\n\nPressable.displayName = 'Primitive:Pressable';\n\nPressable.propTypes = {\n children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),\n disabled: PropTypes.bool,\n preventDefault: PropTypes.bool,\n tabIndex: PropTypes.number,\n onEnter: PropTypes.func,\n onLeave: PropTypes.func,\n onPress: PropTypes.func,\n};\n\nexport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B,wBAAK,CAACtB,QAAQ,EAAEM,MAAM,CAACc,SAAS;EAAC,IAElFrB,QAAQ,CACT;AAAA;AAAC;AAEJD,SAAS,CAAC0B,WAAW,GAAG,qBAAqB;AAE7C1B,SAAS,CAAC2B,SAAS,GAAG;EACpB1B,QAAQ,EAAE2B,kBAAS,CAACC,SAAS,CAAC,CAACD,kBAAS,CAACE,MAAM,EAAEF,kBAAS,CAACG,IAAI,CAAC,CAAC;EACjE7B,QAAQ,EAAE0B,kBAAS,CAACI,IAAI;EACxB7B,cAAc,EAAEyB,kBAAS,CAACI,IAAI;EAC9B5B,QAAQ,EAAEwB,kBAAS,CAACK,MAAM;EAC1B5B,OAAO,EAAEuB,kBAAS,CAACM,IAAI;EACvB5B,OAAO,EAAEsB,kBAAS,CAACM,IAAI;EACvB3B,OAAO,EAAEqB,kBAAS,CAACM;AACrB,CAAC"}
|
|
@@ -2,52 +2,56 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`primitive:<Pressable> inherit:className 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
5
|
+
<ui_pressable
|
|
6
6
|
class="pressable mirai"
|
|
7
|
+
tabindex="0"
|
|
7
8
|
>
|
|
8
9
|
children
|
|
9
|
-
</
|
|
10
|
+
</ui_pressable>
|
|
10
11
|
</DocumentFragment>
|
|
11
12
|
`;
|
|
12
13
|
|
|
13
14
|
exports[`primitive:<Pressable> prop:disabled 1`] = `
|
|
14
15
|
<DocumentFragment>
|
|
15
|
-
<
|
|
16
|
+
<ui_pressable
|
|
16
17
|
class="pressable disabled"
|
|
17
18
|
disabled=""
|
|
18
19
|
>
|
|
19
20
|
children
|
|
20
|
-
</
|
|
21
|
+
</ui_pressable>
|
|
21
22
|
</DocumentFragment>
|
|
22
23
|
`;
|
|
23
24
|
|
|
24
|
-
exports[`primitive:<Pressable>
|
|
25
|
+
exports[`primitive:<Pressable> renders 1`] = `
|
|
25
26
|
<DocumentFragment>
|
|
26
|
-
<
|
|
27
|
+
<ui_pressable
|
|
27
28
|
class="pressable"
|
|
29
|
+
tabindex="0"
|
|
28
30
|
>
|
|
29
31
|
children
|
|
30
|
-
</
|
|
32
|
+
</ui_pressable>
|
|
31
33
|
</DocumentFragment>
|
|
32
34
|
`;
|
|
33
35
|
|
|
34
|
-
exports[`primitive:<Pressable>
|
|
36
|
+
exports[`primitive:<Pressable> tag 1`] = `
|
|
35
37
|
<DocumentFragment>
|
|
36
|
-
<
|
|
38
|
+
<ui_tag
|
|
37
39
|
class="pressable"
|
|
40
|
+
tabindex="0"
|
|
38
41
|
>
|
|
39
42
|
children
|
|
40
|
-
</
|
|
43
|
+
</ui_tag>
|
|
41
44
|
</DocumentFragment>
|
|
42
45
|
`;
|
|
43
46
|
|
|
44
47
|
exports[`primitive:<Pressable> testId 1`] = `
|
|
45
48
|
<DocumentFragment>
|
|
46
|
-
<
|
|
49
|
+
<ui_pressable
|
|
47
50
|
class="pressable"
|
|
48
51
|
data-testid="mirai"
|
|
52
|
+
tabindex="0"
|
|
49
53
|
>
|
|
50
54
|
children
|
|
51
|
-
</
|
|
55
|
+
</ui_pressable>
|
|
52
56
|
</DocumentFragment>
|
|
53
57
|
`;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.COMMON_PROPS = exports.BANNED_JEST_PROPS = void 0;
|
|
7
|
-
var BANNED_JEST_PROPS = ['role'];
|
|
7
|
+
var BANNED_JEST_PROPS = ['role', 'aria-hidden', 'aria-label'];
|
|
8
8
|
exports.BANNED_JEST_PROPS = BANNED_JEST_PROPS;
|
|
9
9
|
var COMMON_PROPS = {
|
|
10
10
|
role: 'data-role',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Primitive.constants.js","names":["BANNED_JEST_PROPS","COMMON_PROPS","role","testId"],"sources":["../../../src/primitives/Primitive/Primitive.constants.js"],"sourcesContent":["const BANNED_JEST_PROPS = ['role'];\n\nconst COMMON_PROPS = {\n role: 'data-role',\n testId: 'data-testid',\n};\n\nexport { BANNED_JEST_PROPS, COMMON_PROPS };\n"],"mappings":";;;;;;AAAA,IAAMA,iBAAiB,GAAG,CAAC,MAAM,CAAC;AAAC;
|
|
1
|
+
{"version":3,"file":"Primitive.constants.js","names":["BANNED_JEST_PROPS","COMMON_PROPS","role","testId"],"sources":["../../../src/primitives/Primitive/Primitive.constants.js"],"sourcesContent":["const BANNED_JEST_PROPS = ['role', 'aria-hidden', 'aria-label'];\n\nconst COMMON_PROPS = {\n role: 'data-role',\n testId: 'data-testid',\n};\n\nexport { BANNED_JEST_PROPS, COMMON_PROPS };\n"],"mappings":";;;;;;AAAA,IAAMA,iBAAiB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,CAAC;AAAC;AAEhE,IAAMC,YAAY,GAAG;EACnBC,IAAI,EAAE,WAAW;EACjBC,MAAM,EAAE;AACV,CAAC;AAAC"}
|
|
@@ -20,9 +20,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
20
20
|
var Primitive = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
21
21
|
var children = _ref.children,
|
|
22
22
|
_ref$tag = _ref.tag,
|
|
23
|
-
tag = _ref$tag === void 0 ? '
|
|
23
|
+
tag = _ref$tag === void 0 ? 'primitive' : _ref$tag,
|
|
24
24
|
others = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
-
return /*#__PURE__*/_react.default.createElement(tag, _objectSpread(_objectSpread({}, (0, _helpers.getProps)(others)), {}, {
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement((0, _helpers.getTag)(tag, others), _objectSpread(_objectSpread({}, (0, _helpers.getProps)(others)), {}, {
|
|
26
26
|
ref: ref
|
|
27
27
|
}), children);
|
|
28
28
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Primitive.js","names":["Primitive","React","forwardRef","ref","children","tag","others","createElement","getProps","displayName","propTypes","PropTypes","any","role","string","testId"],"sources":["../../../src/primitives/Primitive/Primitive.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { getProps } from './helpers';\n\nconst Primitive = React.forwardRef(({ children, tag = '
|
|
1
|
+
{"version":3,"file":"Primitive.js","names":["Primitive","React","forwardRef","ref","children","tag","others","createElement","getTag","getProps","displayName","propTypes","PropTypes","any","role","string","testId"],"sources":["../../../src/primitives/Primitive/Primitive.jsx"],"sourcesContent":["import PropTypes from 'prop-types';\nimport React from 'react';\n\nimport { getProps, getTag } from './helpers';\n\nconst Primitive = React.forwardRef(({ children, tag = 'primitive', ...others }, ref) =>\n React.createElement(getTag(tag, others), { ...getProps(others), ref }, children),\n);\n\nPrimitive.displayName = 'Primitive';\n\nPrimitive.propTypes = {\n children: PropTypes.any,\n role: PropTypes.string,\n tag: PropTypes.string,\n testId: PropTypes.string,\n};\n\nexport { Primitive };\n"],"mappings":";;;;;;;AAAA;AACA;AAEA;AAA6C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAE7C,IAAMA,SAAS,gBAAGC,cAAK,CAACC,UAAU,CAAC,gBAA6CC,GAAG;EAAA,IAA7CC,QAAQ,QAARA,QAAQ;IAAA,gBAAEC,GAAG;IAAHA,GAAG,yBAAG,WAAW;IAAKC,MAAM;EAAA,oBAC1EL,cAAK,CAACM,aAAa,CAAC,IAAAC,eAAM,EAACH,GAAG,EAAEC,MAAM,CAAC,kCAAO,IAAAG,iBAAQ,EAACH,MAAM,CAAC;IAAEH,GAAG,EAAHA;EAAG,IAAIC,QAAQ,CAAC;AAAA,EACjF;AAAC;AAEFJ,SAAS,CAACU,WAAW,GAAG,WAAW;AAEnCV,SAAS,CAACW,SAAS,GAAG;EACpBP,QAAQ,EAAEQ,kBAAS,CAACC,GAAG;EACvBC,IAAI,EAAEF,kBAAS,CAACG,MAAM;EACtBV,GAAG,EAAEO,kBAAS,CAACG,MAAM;EACrBC,MAAM,EAAEJ,kBAAS,CAACG;AACpB,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`<Primitive> inherit:className 1`] = `
|
|
4
4
|
<DocumentFragment>
|
|
5
|
-
<
|
|
5
|
+
<ui_primitive
|
|
6
6
|
class="mirai"
|
|
7
7
|
/>
|
|
8
8
|
</DocumentFragment>
|
|
@@ -10,29 +10,23 @@ exports[`<Primitive> inherit:className 1`] = `
|
|
|
10
10
|
|
|
11
11
|
exports[`<Primitive> prop:children 1`] = `
|
|
12
12
|
<DocumentFragment>
|
|
13
|
-
<
|
|
13
|
+
<ui_primitive>
|
|
14
14
|
<span>
|
|
15
15
|
mirai
|
|
16
16
|
</span>
|
|
17
|
-
</
|
|
17
|
+
</ui_primitive>
|
|
18
18
|
</DocumentFragment>
|
|
19
19
|
`;
|
|
20
20
|
|
|
21
21
|
exports[`<Primitive> prop:role 1`] = `
|
|
22
22
|
<DocumentFragment>
|
|
23
|
-
<
|
|
24
|
-
</DocumentFragment>
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`<Primitive> prop:tag 1`] = `
|
|
28
|
-
<DocumentFragment>
|
|
29
|
-
<section />
|
|
23
|
+
<ui_primitive />
|
|
30
24
|
</DocumentFragment>
|
|
31
25
|
`;
|
|
32
26
|
|
|
33
27
|
exports[`<Primitive> prop:testId 1`] = `
|
|
34
28
|
<DocumentFragment>
|
|
35
|
-
<
|
|
29
|
+
<ui_primitive
|
|
36
30
|
data-testid="mirai"
|
|
37
31
|
/>
|
|
38
32
|
</DocumentFragment>
|
|
@@ -40,6 +34,12 @@ exports[`<Primitive> prop:testId 1`] = `
|
|
|
40
34
|
|
|
41
35
|
exports[`<Primitive> renders 1`] = `
|
|
42
36
|
<DocumentFragment>
|
|
43
|
-
<
|
|
37
|
+
<ui_primitive />
|
|
38
|
+
</DocumentFragment>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`<Primitive> tag 1`] = `
|
|
42
|
+
<DocumentFragment>
|
|
43
|
+
<ui_section />
|
|
44
44
|
</DocumentFragment>
|
|
45
45
|
`;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getTag = void 0;
|
|
7
|
+
var NATIVE_TAGS = [
|
|
8
|
+
// -- PRIMITIVES -------------------------------------------------------------
|
|
9
|
+
'iframe', 'img',
|
|
10
|
+
// <Input>
|
|
11
|
+
'input', 'label', 'textarea',
|
|
12
|
+
// <Select>
|
|
13
|
+
'select', 'option',
|
|
14
|
+
// <Text>
|
|
15
|
+
'h1', 'h2', 'h3', 'span',
|
|
16
|
+
// -- COMPONENTS -------------------------------------------------------------
|
|
17
|
+
// <Action>
|
|
18
|
+
'a',
|
|
19
|
+
// <Button>
|
|
20
|
+
'button',
|
|
21
|
+
// <Form>
|
|
22
|
+
'form',
|
|
23
|
+
// <Table>
|
|
24
|
+
'table', 'thead', 'tbody', 'tr', 'th', 'td'];
|
|
25
|
+
var getTag = function getTag() {
|
|
26
|
+
var tag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'primitive';
|
|
27
|
+
var isNative = NATIVE_TAGS.includes(tag);
|
|
28
|
+
|
|
29
|
+
// * Experimental
|
|
30
|
+
// if (tag === 'button' && props.type !== 'submit') isNative = false;
|
|
31
|
+
|
|
32
|
+
return isNative ? tag : "ui_".concat(tag);
|
|
33
|
+
};
|
|
34
|
+
exports.getTag = getTag;
|
|
35
|
+
//# sourceMappingURL=getTag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getTag.js","names":["NATIVE_TAGS","getTag","tag","isNative","includes"],"sources":["../../../../src/primitives/Primitive/helpers/getTag.js"],"sourcesContent":["const NATIVE_TAGS = [\n // -- PRIMITIVES -------------------------------------------------------------\n 'iframe',\n 'img',\n // <Input>\n 'input',\n 'label',\n 'textarea',\n // <Select>\n 'select',\n 'option',\n // <Text>\n 'h1',\n 'h2',\n 'h3',\n 'span',\n // -- COMPONENTS -------------------------------------------------------------\n // <Action>\n 'a',\n // <Button>\n 'button',\n // <Form>\n 'form',\n // <Table>\n 'table',\n 'thead',\n 'tbody',\n 'tr',\n 'th',\n 'td',\n];\n\nexport const getTag = (\n tag = 'primitive',\n // * experimental\n // props = {}\n) => {\n let isNative = NATIVE_TAGS.includes(tag);\n\n // * Experimental\n // if (tag === 'button' && props.type !== 'submit') isNative = false;\n\n return isNative ? tag : `ui_${tag}`;\n};\n"],"mappings":";;;;;;AAAA,IAAMA,WAAW,GAAG;AAClB;AACA,QAAQ,EACR,KAAK;AACL;AACA,OAAO,EACP,OAAO,EACP,UAAU;AACV;AACA,QAAQ,EACR,QAAQ;AACR;AACA,IAAI,EACJ,IAAI,EACJ,IAAI,EACJ,MAAM;AACN;AACA;AACA,GAAG;AACH;AACA,QAAQ;AACR;AACA,MAAM;AACN;AACA,OAAO,EACP,OAAO,EACP,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,IAAI,CACL;AAEM,IAAMC,MAAM,GAAG,SAATA,MAAM,GAId;EAAA,IAHHC,GAAG,uEAAG,WAAW;EAIjB,IAAIC,QAAQ,GAAGH,WAAW,CAACI,QAAQ,CAACF,GAAG,CAAC;;EAExC;EACA;;EAEA,OAAOC,QAAQ,GAAGD,GAAG,gBAASA,GAAG,CAAE;AACrC,CAAC;AAAC"}
|
|
@@ -14,4 +14,15 @@ Object.keys(_getProps).forEach(function (key) {
|
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
16
|
});
|
|
17
|
+
var _getTag = require("./getTag");
|
|
18
|
+
Object.keys(_getTag).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _getTag[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _getTag[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
17
28
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/primitives/Primitive/helpers/index.js"],"sourcesContent":["export * from './getProps';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../src/primitives/Primitive/helpers/index.js"],"sourcesContent":["export * from './getProps';\nexport * from './getTag';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -29,6 +29,7 @@ var Radio = function Radio(_ref) {
|
|
|
29
29
|
};
|
|
30
30
|
return /*#__PURE__*/_react.default.createElement(_Primitive.Primitive, {
|
|
31
31
|
role: others.role || 'radio',
|
|
32
|
+
tag: others.tag || 'radio',
|
|
32
33
|
className: (0, _helpers.styles)(_RadioModule.default.radio, others.className),
|
|
33
34
|
style: others.style
|
|
34
35
|
}, /*#__PURE__*/_react.default.createElement(_Primitive.Primitive, {
|
|
@@ -42,7 +43,6 @@ var Radio = function Radio(_ref) {
|
|
|
42
43
|
testId: others.testId,
|
|
43
44
|
className: _RadioModule.default.input
|
|
44
45
|
}), /*#__PURE__*/_react.default.createElement(_Primitive.Primitive, {
|
|
45
|
-
tag: "span",
|
|
46
46
|
className: _RadioModule.default.checkmark
|
|
47
47
|
}));
|
|
48
48
|
};
|