|
| 1 | +import { Meta, Story, Canvas, ArgsTable } from '@storybook/addon-docs/blocks'; |
| 2 | +import { BusyIndicator } from '@ui5/webcomponents-react/lib/BusyIndicator'; |
| 3 | +import { BusyIndicatorSize } from '@ui5/webcomponents-react/lib/BusyIndicatorSize'; |
| 4 | +import { Select } from '@ui5/webcomponents-react/lib/Select'; |
| 5 | +import { Text } from '@ui5/webcomponents-react/lib/Text'; |
| 6 | +import { CSSProperties } from 'react'; |
| 7 | +import { createSelectArgTypes } from '@shared/stories/createSelectArgTypes'; |
| 8 | +import { DocsHeader } from '@shared/stories/DocsHeader'; |
| 9 | + |
| 10 | +<Meta |
| 11 | + title="UI5 Web Components / BusyIndicator" |
| 12 | + component={BusyIndicator} |
| 13 | + argTypes={{ |
| 14 | + ...createSelectArgTypes({ size: BusyIndicatorSize }), |
| 15 | + children: { control: { disable: true } }, |
| 16 | + slot: { control: { disable: true } }, |
| 17 | + ref: { control: { disable: true } }, |
| 18 | + style: { |
| 19 | + type: CSSProperties, |
| 20 | + description: |
| 21 | + 'Element style which will be appended to the most outer element of a component. Use this prop carefully, some css properties might break the component.' |
| 22 | + }, |
| 23 | + className: { |
| 24 | + type: 'string', |
| 25 | + description: |
| 26 | + 'CSS Class Name which will be appended to the most outer element of a component. Use this prop carefully, overwriting CSS rules might break the component.' |
| 27 | + }, |
| 28 | + tooltip: { type: 'string', description: 'A tooltip which will be shown on hover' } |
| 29 | + }} |
| 30 | + args={{ |
| 31 | + size: BusyIndicatorSize.Medium, |
| 32 | + style: {}, |
| 33 | + className: '', |
| 34 | + tooltip: '', |
| 35 | + slot: '', |
| 36 | + active: true, |
| 37 | + ref: null |
| 38 | + }} |
| 39 | +/> |
| 40 | + |
| 41 | +<DocsHeader /> |
| 42 | + |
| 43 | +<Canvas> |
| 44 | + <Story name="Default"> |
| 45 | + {(args) => { |
| 46 | + return <BusyIndicator {...args} />; |
| 47 | + }} |
| 48 | + </Story> |
| 49 | +</Canvas> |
| 50 | + |
| 51 | +<ArgsTable story="." /> |
| 52 | +<div style={{ fontFamily: 'var(--sapFontFamily)', fontSize: 'var(--sapFontSize)', color: 'var(--sapTextColor)' }}> |
| 53 | + <h3>Usage</h3> |
| 54 | + For the <code>BusyIndicator</code> you can define the size of the indicator, as well as whether it is shown or hidden. |
| 55 | + In order to hide it, use the html attribute <code>hidden</code> or <code>display: none;</code> <br /> |
| 56 | + <br /> |
| 57 | + In order to show busy state for an HTML element, simply nest the HTML element in a <code>BusyIndicator</code> instance. |
| 58 | + <br /> |
| 59 | + <b>Note:</b> Since <code>BusyIndicator</code> has <code>display: inline-block;</code> by default and no width of its own, |
| 60 | + whenever you need to wrap a block-level element, you should set <code>display: block</code> to the busy indicator as well. |
| 61 | +</div> |
| 62 | + |
| 63 | +<br /> |
| 64 | +<br /> |
| 65 | + |
| 66 | +# Stories |
| 67 | + |
| 68 | +<br /> |
| 69 | + |
| 70 | +## BusyIndicator with children |
| 71 | + |
| 72 | +<Canvas> |
| 73 | + <Story name="With children" args={{ active: true }}> |
| 74 | + {(args) => { |
| 75 | + return ( |
| 76 | + <BusyIndicator {...args}> |
| 77 | + <Select /> |
| 78 | + </BusyIndicator> |
| 79 | + ); |
| 80 | + }} |
| 81 | + </Story> |
| 82 | +</Canvas> |
| 83 | + |
| 84 | +<Canvas> |
| 85 | + <BusyIndicator active> |
| 86 | + <Text> |
| 87 | + Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et |
| 88 | + dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita |
| 89 | + kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur |
| 90 | + sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam |
| 91 | + voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata |
| 92 | + sanctus est Lorem ipsum dolor sit amet. |
| 93 | + </Text> |
| 94 | + </BusyIndicator> |
| 95 | +</Canvas> |
0 commit comments