Skip to content

Commit fbcc53b

Browse files
authored
fix(inline-loading): add or update live control args (#22189)
* fix(InlineLoading): update args * fix: update success callback and remove deprecated assistive text prop * fix: import action handler and revert 'assistive-text' property
1 parent d4acc50 commit fbcc53b

2 files changed

Lines changed: 39 additions & 21 deletions

File tree

packages/react/src/components/InlineLoading/InlineLoading.stories.js

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2026
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
@@ -9,6 +9,7 @@ import React, { useState } from 'react';
99
import Button from '../Button';
1010
import InlineLoading from '.';
1111
import mdx from './InlineLoading.mdx';
12+
import { action } from 'storybook/actions';
1213

1314
export default {
1415
title: 'Components/InlineLoading',
@@ -20,6 +21,38 @@ export default {
2021
},
2122
};
2223

24+
const sharedArgTypes = {
25+
description: {
26+
control: {
27+
type: 'text',
28+
},
29+
},
30+
iconDescription: {
31+
control: {
32+
type: 'text',
33+
},
34+
},
35+
successDelay: {
36+
control: {
37+
type: 'number',
38+
},
39+
},
40+
status: {
41+
options: ['inactive', 'active', 'error', 'finished'],
42+
control: {
43+
type: 'select',
44+
},
45+
},
46+
onSuccess: {
47+
action: 'onSuccess',
48+
},
49+
'aria-live': {
50+
control: {
51+
type: 'text',
52+
},
53+
},
54+
};
55+
2356
export const UxExample = () => {
2457
function MockSubmission({ children }) {
2558
const [isSubmitting, setIsSubmitting] = React.useState(false);
@@ -82,6 +115,9 @@ export const Default = (args) => <InlineLoading {...args} />;
82115
Default.args = {
83116
description: 'Loading',
84117
iconDescription: 'Loading data...',
118+
status: 'active',
119+
onSuccess: action('onSuccess'),
120+
'aria-live': 'assertive',
85121
};
86122

87123
Default.parameters = {
@@ -90,15 +126,4 @@ Default.parameters = {
90126
},
91127
};
92128

93-
Default.argTypes = {
94-
description: {
95-
control: {
96-
type: 'text',
97-
},
98-
},
99-
iconDescription: {
100-
control: {
101-
type: 'text',
102-
},
103-
},
104-
};
129+
Default.argTypes = { ...sharedArgTypes };

packages/web-components/src/components/inline-loading/inline-loading.stories.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,8 @@ const states = {
1818
const noop = () => {};
1919
const defaultArgs = {
2020
description: 'Loading data...',
21-
assistiveText: 'Loading',
2221
iconDescription: 'Loading',
2322
status: INLINE_LOADING_STATE.ACTIVE,
24-
successDelay: 2000,
2523
};
2624

2725
const getControls = ({ disableControl }) => {
@@ -40,22 +38,17 @@ const getControls = ({ disableControl }) => {
4038
description: 'Specify the loading status.',
4139
options: states,
4240
},
43-
successDelay: {
44-
control: disableControl,
45-
description: 'Provide a delay for the setTimeout for success',
46-
},
4741
};
4842
};
4943

5044
export const Default = {
5145
args: defaultArgs,
5246
argTypes: getControls({ disableControl: false }),
53-
render: ({ assistiveText, description, status, iconDescription }) => {
47+
render: ({ description, status, iconDescription }) => {
5448
return html`
5549
<cds-inline-loading
5650
status="${status}"
5751
success-delay=${2000}
58-
assistive-text=${assistiveText}
5952
icon-description=${iconDescription}
6053
}>
6154
${description}

0 commit comments

Comments
 (0)