datastake-daf 0.6.101 → 0.6.102

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.
@@ -1,167 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Button, Space } from 'antd';
3
- import { CheckOutlined, ScanOutlined, FileTextOutlined, CheckCircleOutlined, LockOutlined } from '@ant-design/icons';
4
- import ProgressTabs from './index';
5
-
6
- const ProgressTabsDemo = () => {
7
- const [value, setValue] = useState('setup');
8
-
9
- const options = [
10
- { label: 'Set Up', value: 'setup' },
11
- { label: 'Project Scan', value: 'scan' },
12
- { label: 'Review & Submission', value: 'review' },
13
- { label: 'Submission Status', value: 'status' }
14
- ];
15
-
16
- const currentOption = options.find(option => option.value === value);
17
- const currentIndex = options.findIndex(option => option.value === value);
18
-
19
- const handleNext = () => {
20
- const nextIndex = Math.min(options.length - 1, currentIndex + 1);
21
- setValue(options[nextIndex].value);
22
- };
23
-
24
- const handlePrevious = () => {
25
- const prevIndex = Math.max(0, currentIndex - 1);
26
- setValue(options[prevIndex].value);
27
- };
28
-
29
- const handleValueChange = (newValue) => {
30
- setValue(newValue);
31
- };
32
-
33
- return (
34
- <div style={{ padding: '20px', maxWidth: '800px', margin: '0 auto' }}>
35
- <h2>ProgressTabs Component Demo</h2>
36
- <p>This component creates a horizontal progress bar with clickable segments, similar to the design you provided. It uses Ant Design&apos;s Segmented component as the base.</p>
37
-
38
- <div style={{ marginBottom: '20px' }}>
39
- <ProgressTabs
40
- value={value}
41
- options={options}
42
- onChange={handleValueChange}
43
- />
44
- </div>
45
-
46
- <div style={{ textAlign: 'center', marginBottom: '20px' }}>
47
- <p><strong>Current Step:</strong> {currentOption?.label}</p>
48
- <p><strong>Step Value:</strong> {value}</p>
49
- <p><strong>Step Index:</strong> {currentIndex}</p>
50
- </div>
51
-
52
- <Space>
53
- <Button
54
- onClick={handlePrevious}
55
- disabled={value === 'setup'}
56
- >
57
- Previous
58
- </Button>
59
- <Button
60
- type="primary"
61
- onClick={handleNext}
62
- disabled={value === 'status'}
63
- >
64
- Next
65
- </Button>
66
- </Space>
67
-
68
- <div style={{ marginTop: '30px' }}>
69
- <h3>Usage Example:</h3>
70
- <pre style={{
71
- background: '#f5f5f5',
72
- padding: '15px',
73
- borderRadius: '4px',
74
- overflow: 'auto'
75
- }}>
76
- {`import { ProgressTabs } from 'datastake-daf/dist/components';
77
- import { CheckOutlined, ScanOutlined, FileTextOutlined, CheckCircleOutlined } from '@ant-design/icons';
78
-
79
- const MyComponent = () => {
80
- const [value, setValue] = useState('setup');
81
-
82
- const options = [
83
- { label: 'Set Up', value: 'setup', icon: <CheckOutlined /> },
84
- { label: 'Project Scan', value: 'scan', icon: <ScanOutlined />, isDisabled: true },
85
- { label: 'Review & Submission', value: 'review', icon: <FileTextOutlined />, isDisabled: true },
86
- { label: 'Submission Status', value: 'status', icon: <CheckCircleOutlined />, isDisabled: true }
87
- ];
88
-
89
- return (
90
- <ProgressTabs
91
- value={value}
92
- options={options}
93
- onChange={setValue}
94
- width="100%" // Default is 100%, can be customized
95
- />
96
- );
97
- };`}
98
- </pre>
99
- </div>
100
-
101
- <div style={{ marginTop: '20px' }}>
102
- <h3>Advanced Examples:</h3>
103
-
104
- <div style={{ marginBottom: '20px' }}>
105
- <h4>With Icons:</h4>
106
- <ProgressTabs
107
- value="setup"
108
- options={[
109
- { label: 'Set Up', value: 'setup', icon: <CheckOutlined /> },
110
- { label: 'Project Scan', value: 'scan', icon: <ScanOutlined /> },
111
- { label: 'Review & Submission', value: 'review', icon: <FileTextOutlined /> },
112
- { label: 'Submission Status', value: 'status', icon: <CheckCircleOutlined /> }
113
- ]}
114
- />
115
- </div>
116
-
117
- <div style={{ marginBottom: '20px' }}>
118
- <h4>With Disabled States:</h4>
119
- <ProgressTabs
120
- value="setup"
121
- options={[
122
- { label: 'Set Up', value: 'setup' },
123
- { label: 'Project Scan', value: 'scan', isDisabled: true },
124
- { label: 'Review & Submission', value: 'review', isDisabled: true },
125
- { label: 'Submission Status', value: 'status', isDisabled: true }
126
- ]}
127
- />
128
- </div>
129
-
130
- <div style={{ marginBottom: '20px' }}>
131
- <h4>With Icons and Disabled States:</h4>
132
- <ProgressTabs
133
- value="setup"
134
- options={[
135
- { label: 'Set Up', value: 'setup', icon: <CheckOutlined /> },
136
- { label: 'Project Scan', value: 'scan', icon: <ScanOutlined />, isDisabled: true },
137
- { label: 'Review & Submission', value: 'review', icon: <FileTextOutlined />, isDisabled: true },
138
- { label: 'Submission Status', value: 'status', icon: <CheckCircleOutlined />, isDisabled: true }
139
- ]}
140
- />
141
- </div>
142
-
143
- <div style={{ marginBottom: '20px' }}>
144
- <h4>Custom Width (400px):</h4>
145
- <ProgressTabs
146
- value="scan"
147
- options={options}
148
- width="400px"
149
- />
150
- </div>
151
-
152
- <div style={{ marginBottom: '20px' }}>
153
- <h4>Small Width (300px):</h4>
154
- <ProgressTabs
155
- value="review"
156
- options={options}
157
- width="300px"
158
- />
159
- </div>
160
- </div>
161
-
162
-
163
- </div>
164
- );
165
- };
166
-
167
- export default ProgressTabsDemo;
@@ -1,69 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Segmented } from 'antd';
4
- import './_index.scss';
5
-
6
- const ProgressTabs = ({
7
- value = 'setup',
8
- options = [
9
- { label: 'Set Up', value: 'setup' },
10
- { label: 'Project Scan', value: 'scan' },
11
- { label: 'Review & Submission', value: 'review' },
12
- { label: 'Submission Status', value: 'status' }
13
- ],
14
- onChange = () => {},
15
- className = '',
16
- width = '100%',
17
- ...rest
18
- }) => {
19
- // Transform options to include icons and handle disabled state
20
- const transformedOptions = options.map(option => ({
21
- ...option,
22
- label: (
23
- <div className="progress-tabs__option-content">
24
-
25
- <span className="progress-tabs__label">
26
- {option.label}
27
- </span>
28
- {option.icon && (
29
- <span className="progress-tabs__icon">
30
- {option.icon}
31
- </span>
32
- )}
33
- </div>
34
- ),
35
- disabled: option.isDisabled || false,
36
- }));
37
-
38
- return (
39
- <div
40
- className={`progress-tabs ${className}`}
41
- style={{ width }}
42
- >
43
- <Segmented
44
- value={value}
45
- options={transformedOptions}
46
- onChange={onChange}
47
- className="progress-tabs__segmented"
48
- {...rest}
49
- />
50
- </div>
51
- );
52
- };
53
-
54
- ProgressTabs.propTypes = {
55
- value: PropTypes.string,
56
- options: PropTypes.arrayOf(
57
- PropTypes.shape({
58
- label: PropTypes.string.isRequired,
59
- value: PropTypes.string.isRequired,
60
- isDisabled: PropTypes.bool,
61
- icon: PropTypes.node,
62
- })
63
- ),
64
- onChange: PropTypes.func,
65
- className: PropTypes.string,
66
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
67
- };
68
-
69
- export default ProgressTabs;