@dhis2-ui/card 10.16.2 → 10.16.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/card",
|
|
3
|
-
"version": "10.16.
|
|
3
|
+
"version": "10.16.3",
|
|
4
4
|
"description": "UI Card",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,13 +33,14 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@dhis2/prop-types": "^3.1.2",
|
|
36
|
-
"@dhis2/ui-constants": "10.16.
|
|
36
|
+
"@dhis2/ui-constants": "10.16.3",
|
|
37
37
|
"classnames": "^2.3.1",
|
|
38
38
|
"prop-types": "^15.7.2"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"build",
|
|
42
|
-
"types"
|
|
42
|
+
"types",
|
|
43
|
+
"src"
|
|
43
44
|
],
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"react": "^18.3.1",
|
package/src/card.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { colors, elevations } from '@dhis2/ui-constants'
|
|
2
|
+
import cx from 'classnames'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import React from 'react'
|
|
5
|
+
|
|
6
|
+
const Card = ({ className, children, dataTest = 'dhis2-uicore-card' }) => (
|
|
7
|
+
<div className={cx(className)} data-test={dataTest}>
|
|
8
|
+
{children}
|
|
9
|
+
|
|
10
|
+
<style jsx>{`
|
|
11
|
+
div {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
width: 100%;
|
|
16
|
+
height: 100%;
|
|
17
|
+
|
|
18
|
+
border-radius: 3px;
|
|
19
|
+
background: ${colors.white};
|
|
20
|
+
box-shadow: ${elevations.e100};
|
|
21
|
+
}
|
|
22
|
+
`}</style>
|
|
23
|
+
</div>
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
Card.propTypes = {
|
|
27
|
+
children: PropTypes.node,
|
|
28
|
+
className: PropTypes.string,
|
|
29
|
+
dataTest: PropTypes.string,
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { Card }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Box } from '@dhis2-ui/box'
|
|
2
|
+
import React from 'react'
|
|
3
|
+
import { Card } from './card.js'
|
|
4
|
+
|
|
5
|
+
const subtitle = `
|
|
6
|
+
A card is a container element for grouping together
|
|
7
|
+
and separating blocks of content.
|
|
8
|
+
`
|
|
9
|
+
|
|
10
|
+
const description = `
|
|
11
|
+
Use a card where there is content that can be grouped together.
|
|
12
|
+
Cards are most often useful when this grouped content may be repeated,
|
|
13
|
+
for example with items on a dashboard, or different sections of patient
|
|
14
|
+
information displayed in a profile.
|
|
15
|
+
|
|
16
|
+
Note that it requires a parent, like [Box](../?path=/docs/layout-box--default), to define its size.
|
|
17
|
+
|
|
18
|
+
\`\`\`js
|
|
19
|
+
import { Card } from '@dhis2/ui'
|
|
20
|
+
\`\`\`
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
title: 'Card',
|
|
25
|
+
component: Card,
|
|
26
|
+
parameters: {
|
|
27
|
+
componentSubtitle: subtitle,
|
|
28
|
+
docs: { description: { component: description } },
|
|
29
|
+
},
|
|
30
|
+
argTypes: {
|
|
31
|
+
children: { control: { type: 'text' } },
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Default = (args) => (
|
|
36
|
+
<Box width="200px" height="75px">
|
|
37
|
+
<Card {...args} />
|
|
38
|
+
</Box>
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
Default.args = {
|
|
42
|
+
children: 'Card content',
|
|
43
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Given, Then } from '@badeball/cypress-cucumber-preprocessor'
|
|
2
|
+
|
|
3
|
+
Given('a Card with children is rendered', () => {
|
|
4
|
+
cy.visitStory('Card', 'With children')
|
|
5
|
+
cy.get('[data-test="dhis2-uicore-card"]').should('be.visible')
|
|
6
|
+
})
|
|
7
|
+
|
|
8
|
+
Then('the children are visible', () => {
|
|
9
|
+
cy.contains('I am a child').should('be.visible')
|
|
10
|
+
})
|
package/src/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Card } from './card.js'
|