@axzydev/axzy_ui_system 1.4.8 → 1.5.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/README.md +2 -11
- package/dist/index.cjs +1826 -1351
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +115 -14
- package/dist/index.d.ts +115 -14
- package/dist/index.js +1481 -1010
- package/dist/index.js.map +1 -1
- package/dist/layered.css +1 -1
- package/package.json +3 -16
- package/src/App.tsx +90 -73
- package/src/components/atoms/badget/badget.tsx +23 -5
- package/src/components/atoms/chip/chip.tsx +3 -1
- package/src/components/atoms/image/image.tsx +3 -1
- package/src/components/atoms/input/input.tsx +8 -5
- package/src/components/atoms/loader/loader.tsx +3 -1
- package/src/components/atoms/slide/slide.props.ts +12 -0
- package/src/components/atoms/slide/slide.tsx +3 -0
- package/src/components/molecules/alert/alert.tsx +3 -1
- package/src/components/molecules/breadcrumbs/breadcrumbs.tsx +3 -1
- package/src/components/molecules/calendar/calendar.tsx +9 -6
- package/src/components/molecules/card/card.tsx +5 -2
- package/src/components/molecules/chip-input/chip-input.tsx +9 -7
- package/src/components/molecules/date-picker/datePicker.tsx +9 -9
- package/src/components/molecules/dropdown-menu/dropdown-menu.props.ts +1 -1
- package/src/components/molecules/dropdown-menu/dropdown-menu.tsx +6 -3
- package/src/components/molecules/field/field.tsx +3 -1
- package/src/components/molecules/form-header/form-header.tsx +3 -1
- package/src/components/molecules/line-bar-chart/line-bar-chart.props.ts +2 -2
- package/src/components/molecules/line-bar-chart/line-bar-chart.tsx +20 -15
- package/src/components/molecules/masked-input/masked-input.tsx +3 -1
- package/src/components/molecules/multi-select/multi-select.tsx +12 -9
- package/src/components/molecules/pagination/pagination.tsx +11 -5
- package/src/components/molecules/search-select/search-select.tsx +11 -9
- package/src/components/molecules/select/select.tsx +6 -4
- package/src/components/molecules/stepper/stepper.tsx +6 -4
- package/src/components/molecules/table/table.tsx +30 -28
- package/src/components/molecules/time-picker/timePicker.tsx +8 -6
- package/src/components/molecules/wysiwyg/wysiwyg.tsx +23 -12
- package/src/components/organisms/confirm-dialog/confirm-dialog.props.ts +4 -4
- package/src/components/organisms/confirm-dialog/confirm-dialog.tsx +16 -8
- package/src/components/organisms/data-table/dataTable.tsx +31 -25
- package/src/components/organisms/dialog/dialog.tsx +3 -0
- package/src/components/organisms/drawer/drawer.tsx +3 -0
- package/src/components/organisms/dropfile/dropfile.tsx +19 -17
- package/src/components/organisms/form-builder/fieldRenderer.tsx +4 -2
- package/src/components/organisms/navbar/navbar.tsx +4 -2
- package/src/components/organisms/page-header/page-header.tsx +3 -1
- package/src/components/organisms/searchTable/components/PaginationControls.tsx +8 -6
- package/src/components/organisms/searchTable/components/PaginationInfo.tsx +3 -1
- package/src/components/organisms/searchTable/components/SearchAndSortBar.tsx +7 -5
- package/src/components/organisms/searchTable/components/SearchInput.tsx +4 -2
- package/src/components/organisms/searchTable/components/SortButton.tsx +13 -11
- package/src/components/organisms/searchTable/components/TableEmptyState.tsx +4 -2
- package/src/components/organisms/searchTable/components/TableRow.tsx +6 -4
- package/src/components/organisms/searchTable/searchTable.tsx +4 -2
- package/src/components/organisms/sidebar/sidebar.props.ts +1 -1
- package/src/components/organisms/sidebar/sidebar.tsx +9 -4
- package/src/components/organisms/toast/toast.tsx +3 -1
- package/src/components/organisms/topbar/topbar.tsx +4 -2
- package/src/components/templates/page/page.props.ts +4 -4
- package/src/components/templates/page/page.tsx +6 -4
- package/src/components/theme-provider/themeProvider.tsx +28 -17
- package/src/dev.css +61 -2
- package/src/global.d.ts +10 -0
- package/src/i18n/context.ts +9 -0
- package/src/i18n/index.ts +22 -0
- package/src/i18n/locales/en.ts +163 -0
- package/src/i18n/locales/es.ts +165 -0
- package/src/i18n/provider.tsx +44 -0
- package/src/i18n/translator.ts +82 -0
- package/src/i18n/types.ts +54 -0
- package/src/i18n/useITTranslation.ts +20 -0
- package/src/index.css +0 -1
- package/src/index.ts +7 -1
- package/src/sandbox/LandingShowcase.tsx +224 -580
- package/src/sandbox/NotFoundShowcase.tsx +51 -36
- package/src/sandbox/TopbarSearch.tsx +6 -4
- package/src/sandbox/controls.tsx +180 -0
- package/src/sandbox/i18n.ts +1939 -0
- package/src/sandbox/icons.tsx +25 -0
- package/src/sandbox/locale.tsx +72 -0
- package/src/sandbox/ui.tsx +474 -0
- package/src/sandbox/useHashRoute.ts +46 -10
- package/src/showcases/DataShowcases.tsx +103 -87
- package/src/showcases/FeedbackShowcases.tsx +37 -30
- package/src/showcases/FormShowcases.tsx +303 -215
- package/src/showcases/GettingStartedShowcase.tsx +151 -145
- package/src/showcases/HelpShowcase.tsx +126 -128
- package/src/showcases/HomeShowcase.tsx +678 -482
- package/src/showcases/LayoutPrimitivesShowcases.tsx +129 -114
- package/src/showcases/NavigationShowcases.tsx +45 -37
- package/src/showcases/PageShowcases.tsx +171 -152
- package/src/showcases/ProductoDetalle.tsx +272 -129
- package/src/showcases/ShowcaseLayout.tsx +256 -219
- package/src/showcases/SizesShowcase.tsx +123 -64
- package/src/showcases/StructureShowcases.tsx +203 -138
- package/src/showcases/portfolioUi.tsx +153 -0
- package/src/showcases/techIcons.ts +3 -0
- package/src/utils/table.utils.ts +10 -2
- package/src/components/atoms/avatar/avatar.doc.mdx +0 -48
- package/src/components/atoms/avatar/avatar.stories.tsx +0 -64
- package/src/components/atoms/badget/badget.doc.mdx +0 -46
- package/src/components/atoms/badget/badget.stories.tsx +0 -75
- package/src/components/atoms/button/button.doc.mdx +0 -59
- package/src/components/atoms/button/button.stories.tsx +0 -173
- package/src/components/atoms/checkbox/checkbox.doc.mdx +0 -54
- package/src/components/atoms/checkbox/checkbox.stories.tsx +0 -53
- package/src/components/atoms/chip/chip.doc.mdx +0 -47
- package/src/components/atoms/chip/chip.stories.tsx +0 -64
- package/src/components/atoms/divider/divider.doc.mdx +0 -42
- package/src/components/atoms/divider/divider.stories.tsx +0 -33
- package/src/components/atoms/flex/flex.doc.mdx +0 -59
- package/src/components/atoms/flex/flex.stories.tsx +0 -70
- package/src/components/atoms/grid/grid.doc.mdx +0 -54
- package/src/components/atoms/grid/grid.stories.tsx +0 -71
- package/src/components/atoms/image/image.doc.mdx +0 -44
- package/src/components/atoms/image/image.stories.tsx +0 -48
- package/src/components/atoms/input/input.doc.mdx +0 -70
- package/src/components/atoms/input/input.stories.tsx +0 -113
- package/src/components/atoms/input-number/input-number.doc.mdx +0 -74
- package/src/components/atoms/input-number/input-number.stories.tsx +0 -111
- package/src/components/atoms/loader/loader.doc.mdx +0 -43
- package/src/components/atoms/loader/loader.stories.tsx +0 -104
- package/src/components/atoms/popover/popover.doc.mdx +0 -53
- package/src/components/atoms/popover/popover.stories.tsx +0 -24
- package/src/components/atoms/progress/progress.doc.mdx +0 -48
- package/src/components/atoms/progress/progress.stories.tsx +0 -39
- package/src/components/atoms/radio/radio.doc.mdx +0 -62
- package/src/components/atoms/radio/radio.stories.tsx +0 -48
- package/src/components/atoms/segmented-control/segmented-control.doc.mdx +0 -60
- package/src/components/atoms/segmented-control/segmented-control.stories.tsx +0 -62
- package/src/components/atoms/skeleton/skeleton.doc.mdx +0 -43
- package/src/components/atoms/skeleton/skeleton.stories.tsx +0 -29
- package/src/components/atoms/slide/slide.doc.mdx +0 -46
- package/src/components/atoms/slide/slide.stories.tsx +0 -120
- package/src/components/atoms/slider/slider.doc.mdx +0 -49
- package/src/components/atoms/slider/slider.stories.tsx +0 -29
- package/src/components/atoms/stack/stack.doc.mdx +0 -126
- package/src/components/atoms/stack/stack.stories.tsx +0 -283
- package/src/components/atoms/text/text.doc.mdx +0 -41
- package/src/components/atoms/text/text.stories.tsx +0 -66
- package/src/components/atoms/textarea/textarea.doc.mdx +0 -64
- package/src/components/atoms/textarea/textarea.stories.tsx +0 -26
- package/src/components/atoms/tooltip/tooltip.doc.mdx +0 -47
- package/src/components/atoms/tooltip/tooltip.stories.tsx +0 -19
- package/src/components/isolation/isolation.stories.tsx +0 -202
- package/src/components/molecules/accordion/accordion.doc.mdx +0 -47
- package/src/components/molecules/accordion/accordion.stories.tsx +0 -68
- package/src/components/molecules/alert/alert.doc.mdx +0 -48
- package/src/components/molecules/alert/alert.stories.tsx +0 -40
- package/src/components/molecules/breadcrumbs/breadcrumbs.doc.mdx +0 -57
- package/src/components/molecules/breadcrumbs/breadcrumbs.stories.tsx +0 -20
- package/src/components/molecules/calendar/calendar.doc.mdx +0 -76
- package/src/components/molecules/calendar/calendar.stories.tsx +0 -90
- package/src/components/molecules/card/card.doc.mdx +0 -54
- package/src/components/molecules/card/card.stories.tsx +0 -57
- package/src/components/molecules/chip-input/chip-input.doc.mdx +0 -44
- package/src/components/molecules/chip-input/chip-input.stories.tsx +0 -52
- package/src/components/molecules/date-picker/date-picker.doc.mdx +0 -65
- package/src/components/molecules/date-picker/date-picker.stories.tsx +0 -88
- package/src/components/molecules/dropdown-menu/dropdown-menu.doc.mdx +0 -46
- package/src/components/molecules/dropdown-menu/dropdown-menu.stories.tsx +0 -41
- package/src/components/molecules/empty-state/empty-state.doc.mdx +0 -50
- package/src/components/molecules/empty-state/empty-state.stories.tsx +0 -19
- package/src/components/molecules/field/field.doc.mdx +0 -43
- package/src/components/molecules/field/field.stories.tsx +0 -42
- package/src/components/molecules/form-header/form-header.doc.mdx +0 -38
- package/src/components/molecules/form-header/form-header.stories.tsx +0 -52
- package/src/components/molecules/masked-input/masked-input.doc.mdx +0 -78
- package/src/components/molecules/masked-input/masked-input.stories.tsx +0 -126
- package/src/components/molecules/multi-select/multi-select.doc.mdx +0 -55
- package/src/components/molecules/multi-select/multi-select.stories.tsx +0 -59
- package/src/components/molecules/pagination/pagination.doc.mdx +0 -62
- package/src/components/molecules/pagination/pagination.stories.tsx +0 -110
- package/src/components/molecules/search-select/search-select.doc.mdx +0 -77
- package/src/components/molecules/search-select/search-select.stories.tsx +0 -146
- package/src/components/molecules/select/select.doc.mdx +0 -75
- package/src/components/molecules/select/select.stories.tsx +0 -85
- package/src/components/molecules/stat-card/stat-card.doc.mdx +0 -48
- package/src/components/molecules/stat-card/stat-card.stories.tsx +0 -40
- package/src/components/molecules/stepper/stepper.doc.mdx +0 -54
- package/src/components/molecules/stepper/stepper.stories.tsx +0 -154
- package/src/components/molecules/table/table.doc.mdx +0 -140
- package/src/components/molecules/table/table.stories.tsx +0 -402
- package/src/components/molecules/tabs/tabs.doc.mdx +0 -52
- package/src/components/molecules/tabs/tabs.stories.tsx +0 -31
- package/src/components/molecules/time-picker/timePicker.doc.mdx +0 -68
- package/src/components/molecules/time-picker/timePicker.stories.tsx +0 -130
- package/src/components/molecules/wysiwyg/wysiwyg.stories.tsx +0 -95
- package/src/components/organisms/confirm-dialog/confirm-dialog.doc.mdx +0 -60
- package/src/components/organisms/confirm-dialog/confirm-dialog.stories.tsx +0 -32
- package/src/components/organisms/data-table/ITDataTable.doc.mdx +0 -132
- package/src/components/organisms/data-table/ITDataTable.stories.tsx +0 -353
- package/src/components/organisms/dialog/dialog.doc.mdx +0 -54
- package/src/components/organisms/dialog/dialog.stories.tsx +0 -126
- package/src/components/organisms/drawer/drawer.doc.mdx +0 -59
- package/src/components/organisms/drawer/drawer.stories.tsx +0 -40
- package/src/components/organisms/dropfile/dropfile.doc.mdx +0 -74
- package/src/components/organisms/dropfile/dropfile.stories.tsx +0 -93
- package/src/components/organisms/form-builder/formBuilder.doc.mdx +0 -251
- package/src/components/organisms/form-builder/formBuilder.stories.tsx +0 -914
- package/src/components/organisms/navbar/navbar.doc.mdx +0 -77
- package/src/components/organisms/navbar/navbar.stories.tsx +0 -83
- package/src/components/organisms/page-header/page-header.doc.mdx +0 -54
- package/src/components/organisms/page-header/page-header.stories.tsx +0 -74
- package/src/components/organisms/searchTable/searchTable.doc.mdx +0 -79
- package/src/components/organisms/searchTable/searchTable.stories.tsx +0 -73
- package/src/components/organisms/sidebar/sidebar.doc.mdx +0 -176
- package/src/components/organisms/sidebar/sidebar.stories.tsx +0 -234
- package/src/components/organisms/toast/toast.doc.mdx +0 -50
- package/src/components/organisms/toast/toast.stories.tsx +0 -137
- package/src/components/organisms/topbar/topbar.doc.mdx +0 -72
- package/src/components/organisms/topbar/topbar.stories.tsx +0 -79
- package/src/components/organisms/triple-filter/tripleFilter.doc.mdx +0 -62
- package/src/components/organisms/triple-filter/tripleFilter.stories.tsx +0 -31
- package/src/components/templates/layout/layout.doc.mdx +0 -53
- package/src/components/templates/layout/layout.stories.tsx +0 -113
- package/src/components/templates/page/page.doc.mdx +0 -86
- package/src/components/templates/page/page.stories.tsx +0 -97
- package/src/components/theme-provider/themeProvider.doc.mdx +0 -85
- package/src/components/theme-provider/themeProvider.stories.tsx +0 -58
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './input.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITInput
|
|
7
|
-
|
|
8
|
-
A versatile form input component supporting text, password, email, number, textarea, checkbox, and radio types. Features labels, validation errors, left/right icons, helper text with character count, currency formatting, and configurable sizes.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `name` | `string` | required | Field name used for form identification. |
|
|
15
|
-
| `type` | `'text' \| 'password' \| 'number' \| 'email' \| 'checkbox' \| 'radio' \| 'textarea'` | `'text'` | Input type. |
|
|
16
|
-
| `label` | `string` | `undefined` | Label displayed above the input. |
|
|
17
|
-
| `placeholder` | `string` | `undefined` | Placeholder text. |
|
|
18
|
-
| `value` | `any` | `undefined` | Current input value. |
|
|
19
|
-
| `onChange` | `(event: any) => void` | required | Change event handler. |
|
|
20
|
-
| `onBlur` | `(event) => void` | `undefined` | Blur event handler. |
|
|
21
|
-
| `onKeyDown` | `(event) => void` | `undefined` | Keydown event handler. |
|
|
22
|
-
| `error` | `string \| boolean` | `undefined` | Validation error message. Pass `true` for generic error styling. |
|
|
23
|
-
| `touched` | `boolean` | `undefined` | Whether the field has been touched by the user. |
|
|
24
|
-
| `required` | `boolean` | `false` | Mark the field as required (adds asterisk to label). |
|
|
25
|
-
| `disabled` | `boolean` | `false` | Disable the input. |
|
|
26
|
-
| `size` | `SizesTypes` | `'md'` | Size preset: `"sm"`, `"md"`, `"lg"`. |
|
|
27
|
-
| `variant` | `ColorsTypes` | `undefined` | Color variant from the theme palette. |
|
|
28
|
-
| `iconLeft` | `ReactNode` | `undefined` | Icon element rendered on the left side. |
|
|
29
|
-
| `iconRight` | `ReactNode` | `undefined` | Icon element rendered on the right side. |
|
|
30
|
-
| `maxLength` | `number` | `undefined` | Maximum allowed character length. |
|
|
31
|
-
| `minLength` | `number` | `undefined` | Minimum allowed character length. |
|
|
32
|
-
| `showHintLength` | `boolean` | `false` | Show character count hint below the input. |
|
|
33
|
-
| `currencyFormat` | `boolean` | `false` | Enable currency formatting for number inputs (MX locale). |
|
|
34
|
-
| `formatNumber` | `boolean` | `false` | Enable number formatting on blur. |
|
|
35
|
-
| `autoFocus` | `boolean` | `false` | Auto-focus the input on mount. |
|
|
36
|
-
| `focusContent` | `boolean` | `false` | Select all content on click/focus. |
|
|
37
|
-
| `readOnly` | `boolean` | `false` | Render the input in read-only mode. |
|
|
38
|
-
| `min` | `number` | `undefined` | Minimum numeric value for number inputs. |
|
|
39
|
-
| `max` | `number` | `undefined` | Maximum numeric value for number inputs. |
|
|
40
|
-
| `rows` | `number` | `undefined` | Number of visible rows for textarea. |
|
|
41
|
-
| `checked` | `boolean` | `undefined` | Checked state for checkbox and radio types. |
|
|
42
|
-
| `containerClassName` | `string` | `undefined` | Additional CSS classes for the outer container. |
|
|
43
|
-
| `labelClassName` | `string` | `undefined` | Additional CSS classes for the label. |
|
|
44
|
-
| `className` | `string` | `undefined` | Additional CSS classes for the input element. |
|
|
45
|
-
| `onClick` | `() => void` | `undefined` | Click handler for the input. |
|
|
46
|
-
|
|
47
|
-
## Usage
|
|
48
|
-
|
|
49
|
-
```tsx
|
|
50
|
-
import { ITInput } from '@axzydev/axzy_ui_system';
|
|
51
|
-
|
|
52
|
-
<ITInput name="email" label="Email" type="email" placeholder="example@mail.com" />
|
|
53
|
-
<ITInput name="password" label="Password" type="password" iconLeft={<FaLock />} />
|
|
54
|
-
<ITInput name="bio" label="Bio" type="textarea" rows={4} />
|
|
55
|
-
<ITInput name="qty" label="Quantity" type="number" min={0} max={100} />
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Notes
|
|
59
|
-
|
|
60
|
-
- Error message only displays when both `error` and `touched` are truthy.
|
|
61
|
-
- `showHintLength` with `maxLength` displays a counter (e.g. "45/200").
|
|
62
|
-
- Currency formatting uses MX locale by default when `currencyFormat` is true.
|
|
63
|
-
- Icons rendered via `iconLeft`/`iconRight` can be clickable React nodes (e.g. a toggle visibility button).
|
|
64
|
-
- Checkbox and radio types render inline labels instead of stacked layout.
|
|
65
|
-
|
|
66
|
-
## Stories
|
|
67
|
-
|
|
68
|
-
<Primary />
|
|
69
|
-
<Controls />
|
|
70
|
-
<Stories />
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import type { Meta } from '@storybook/react';
|
|
2
|
-
import ITInput from '@/components/atoms/input/input';
|
|
3
|
-
import { FaUser, FaLock, FaEnvelope } from 'react-icons/fa';
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'Components/Form Elements/ITInput',
|
|
7
|
-
component: ITInput,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered',
|
|
10
|
-
},
|
|
11
|
-
argTypes: {
|
|
12
|
-
type: {
|
|
13
|
-
control: 'select',
|
|
14
|
-
options: ['text', 'password', 'number', 'email', 'textarea'],
|
|
15
|
-
},
|
|
16
|
-
disabled: { control: 'boolean' },
|
|
17
|
-
error: { control: 'text' },
|
|
18
|
-
},
|
|
19
|
-
} satisfies Meta<typeof ITInput>;
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
|
|
23
|
-
export const Default: any = {
|
|
24
|
-
args: {
|
|
25
|
-
name: 'default-input',
|
|
26
|
-
placeholder: 'Type something...',
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const WithLabel: any = {
|
|
31
|
-
args: {
|
|
32
|
-
name: 'labeled-input',
|
|
33
|
-
label: 'Username',
|
|
34
|
-
placeholder: 'Enter your username',
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const WithIcons: any = {
|
|
39
|
-
args: {
|
|
40
|
-
name: 'icon-input',
|
|
41
|
-
label: 'Email',
|
|
42
|
-
type: 'email',
|
|
43
|
-
placeholder: 'example@mail.com',
|
|
44
|
-
iconLeft: <FaEnvelope className="text-gray-400" />,
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const ClickableIcons: any = {
|
|
49
|
-
args: {
|
|
50
|
-
name: 'search-input',
|
|
51
|
-
label: 'Search',
|
|
52
|
-
placeholder: 'Search...',
|
|
53
|
-
iconRight: (
|
|
54
|
-
<button
|
|
55
|
-
onClick={() => alert('Search clicked!')}
|
|
56
|
-
className="text-gray-500 hover:text-blue-500 transition-colors"
|
|
57
|
-
>
|
|
58
|
-
<FaUser />
|
|
59
|
-
</button>
|
|
60
|
-
),
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const Password: any = {
|
|
65
|
-
args: {
|
|
66
|
-
name: 'password-input',
|
|
67
|
-
label: 'Password',
|
|
68
|
-
type: 'password',
|
|
69
|
-
placeholder: '••••••••',
|
|
70
|
-
iconLeft: <FaLock className="text-gray-400" />,
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
export const WithError: any = {
|
|
75
|
-
args: {
|
|
76
|
-
name: 'error-input',
|
|
77
|
-
label: 'Email',
|
|
78
|
-
value: 'invalid-email',
|
|
79
|
-
touched: true,
|
|
80
|
-
error: 'Please enter a valid email address',
|
|
81
|
-
iconLeft: <FaEnvelope className="text-gray-400" />,
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const Disabled: any = {
|
|
86
|
-
args: {
|
|
87
|
-
name: 'disabled-input',
|
|
88
|
-
label: 'Disabled Input',
|
|
89
|
-
value: 'Cannot edit this',
|
|
90
|
-
disabled: true,
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
export const TextArea: any = {
|
|
95
|
-
args: {
|
|
96
|
-
name: 'textarea',
|
|
97
|
-
label: 'Description',
|
|
98
|
-
type: 'textarea',
|
|
99
|
-
placeholder: 'Write a detailed description...',
|
|
100
|
-
rows: 4,
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
export const NumberInput: any = {
|
|
105
|
-
args: {
|
|
106
|
-
name: 'number-input',
|
|
107
|
-
label: 'Quantity',
|
|
108
|
-
type: 'number',
|
|
109
|
-
placeholder: '0',
|
|
110
|
-
min: 0,
|
|
111
|
-
max: 100,
|
|
112
|
-
},
|
|
113
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './input-number.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITInputNumber
|
|
7
|
-
|
|
8
|
-
Numeric field that always renders currency-style formatting (thousand separators + fixed decimals) and emits a real `number` through `onChange` / `onBlur`. Built on top of `ITInput`, so it inherits label, validation, sizes, icons and theming.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `name` | `string` | required | Field name used for form identification. |
|
|
15
|
-
| `value` | `number \| null` | `undefined` | Current numeric value. |
|
|
16
|
-
| `onChange` | `(value: number \| undefined, event) => void` | required | Called with the parsed value on every change. |
|
|
17
|
-
| `onBlur` | `(value: number \| undefined, event) => void` | `undefined` | Called on blur with the parsed (and clamped) value. |
|
|
18
|
-
| `decimals` | `number` | `2` | Decimal places allowed. `0` restricts to integers. |
|
|
19
|
-
| `prefix` | `string` | `undefined` | Text prefix rendered inside the field (e.g. `"$"`). Ignored when `iconLeft` is set. |
|
|
20
|
-
| `label` | `string` | `undefined` | Label displayed above the input. |
|
|
21
|
-
| `placeholder` | `string` | `undefined` | Placeholder text. |
|
|
22
|
-
| `min` | `number` | `undefined` | Minimum value; lower values are clamped on blur. |
|
|
23
|
-
| `max` | `number` | `undefined` | Maximum value; higher values are clamped on blur. |
|
|
24
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Size preset. |
|
|
25
|
-
| `disabled` | `boolean` | `false` | Disable the input. |
|
|
26
|
-
| `readOnly` | `boolean` | `false` | Render the input in read-only mode. |
|
|
27
|
-
| `required` | `boolean` | `false` | Mark the field as required. |
|
|
28
|
-
| `touched` | `boolean` | `undefined` | Whether the field has been touched by the user. |
|
|
29
|
-
| `error` | `string \| boolean` | `undefined` | Validation error (`true` = generic message). |
|
|
30
|
-
| `iconLeft` / `iconRight` | `ReactNode` | `undefined` | Icons rendered inside the field. |
|
|
31
|
-
| `containerClassName` | `string` | `undefined` | Additional classes for the outer container. |
|
|
32
|
-
| `labelClassName` | `string` | `undefined` | Additional classes for the label. |
|
|
33
|
-
| `className` | `string` | `undefined` | Additional classes for the input element. |
|
|
34
|
-
| `autoFocus` | `boolean` | `false` | Auto-focus on mount. |
|
|
35
|
-
| `focusContent` | `boolean` | `false` | Select all content on click. |
|
|
36
|
-
| `onKeyDown` | `(event) => void` | `undefined` | Keydown handler for the underlying input. |
|
|
37
|
-
|
|
38
|
-
## Usage
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
import { ITInputNumber } from '@axzydev/axzy_ui_system';
|
|
42
|
-
|
|
43
|
-
<ITInputNumber
|
|
44
|
-
name="amount"
|
|
45
|
-
label="Monto"
|
|
46
|
-
value={amount}
|
|
47
|
-
prefix="$"
|
|
48
|
-
onChange={(value) => setAmount(value)}
|
|
49
|
-
/>
|
|
50
|
-
|
|
51
|
-
<ITInputNumber
|
|
52
|
-
name="qty"
|
|
53
|
-
label="Cantidad"
|
|
54
|
-
decimals={0}
|
|
55
|
-
min={1}
|
|
56
|
-
max={99}
|
|
57
|
-
value={qty}
|
|
58
|
-
onChange={(value) => setQty(value)}
|
|
59
|
-
/>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## Notes
|
|
63
|
-
|
|
64
|
-
- The emitted value is a `number` (or `undefined` when the field is empty) — no `parseFloat` needed by the consumer.
|
|
65
|
-
- Formatting is always on: thousand separators while blurred, raw digits while typing.
|
|
66
|
-
- Use `decimals={0}` for integers only.
|
|
67
|
-
- Values are clamped to `min`/`max` on blur.
|
|
68
|
-
- `prefix` is a convenience over `iconLeft`; pass `iconLeft` directly for any custom node.
|
|
69
|
-
|
|
70
|
-
## Stories
|
|
71
|
-
|
|
72
|
-
<Primary />
|
|
73
|
-
<Controls />
|
|
74
|
-
<Stories />
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
3
|
-
import { FaDollarSign } from 'react-icons/fa';
|
|
4
|
-
import ITInputNumber from '@/components/atoms/input-number/input-number';
|
|
5
|
-
import { ITInputNumberProps } from './input-number.props';
|
|
6
|
-
|
|
7
|
-
const meta: Meta<typeof ITInputNumber> = {
|
|
8
|
-
title: 'Components/Form Elements/ITInputNumber',
|
|
9
|
-
component: ITInputNumber,
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: 'centered',
|
|
12
|
-
},
|
|
13
|
-
argTypes: {
|
|
14
|
-
decimals: { control: 'number' },
|
|
15
|
-
disabled: { control: 'boolean' },
|
|
16
|
-
error: { control: 'text' },
|
|
17
|
-
min: { control: 'number' },
|
|
18
|
-
max: { control: 'number' },
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export default meta;
|
|
23
|
-
|
|
24
|
-
type Story = StoryObj<typeof ITInputNumber>;
|
|
25
|
-
|
|
26
|
-
/** Wrapper that keeps the value in state so the story reflects real usage. */
|
|
27
|
-
const Interactive = (props: Partial<ITInputNumberProps> & Pick<ITInputNumberProps, 'name'>) => {
|
|
28
|
-
const [value, setValue] = useState<number | null>(null);
|
|
29
|
-
return (
|
|
30
|
-
<div className="w-80">
|
|
31
|
-
<ITInputNumber
|
|
32
|
-
label="Monto"
|
|
33
|
-
placeholder="0.00"
|
|
34
|
-
{...props}
|
|
35
|
-
value={value}
|
|
36
|
-
onChange={(next) => setValue(next ?? null)}
|
|
37
|
-
/>
|
|
38
|
-
<p className="mt-2 text-xs font-mono text-slate-500">
|
|
39
|
-
value: {value === null ? 'null' : `${value} (${typeof value})`}
|
|
40
|
-
</p>
|
|
41
|
-
</div>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const Default: Story = {
|
|
46
|
-
render: () => <Interactive name="amount" />,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const WithPrefix: Story = {
|
|
50
|
-
render: () => <Interactive name="amount-prefix" prefix="$" />,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
export const WithIcon: Story = {
|
|
54
|
-
render: () => (
|
|
55
|
-
<Interactive name="amount-icon" iconLeft={<FaDollarSign className="text-slate-400" />} />
|
|
56
|
-
),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const InitialValue: Story = {
|
|
60
|
-
render: () => {
|
|
61
|
-
const [value, setValue] = useState<number | null>(1234.5);
|
|
62
|
-
return (
|
|
63
|
-
<div className="w-80">
|
|
64
|
-
<ITInputNumber
|
|
65
|
-
name="amount-initial"
|
|
66
|
-
label="Monto inicial"
|
|
67
|
-
prefix="$"
|
|
68
|
-
value={value}
|
|
69
|
-
onChange={(next) => setValue(next ?? null)}
|
|
70
|
-
/>
|
|
71
|
-
<p className="mt-2 text-xs font-mono text-slate-500">value: {value === null ? 'null' : value}</p>
|
|
72
|
-
</div>
|
|
73
|
-
);
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
export const IntegersOnly: Story = {
|
|
78
|
-
render: () => <Interactive name="quantity" label="Cantidad" decimals={0} />,
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const WithBounds: Story = {
|
|
82
|
-
render: () => <Interactive name="bounded" label="Entre 10 y 500" min={10} max={500} />,
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export const WithError: Story = {
|
|
86
|
-
render: () => (
|
|
87
|
-
<Interactive
|
|
88
|
-
name="amount-error"
|
|
89
|
-
label="Monto"
|
|
90
|
-
prefix="$"
|
|
91
|
-
touched
|
|
92
|
-
error="El monto es obligatorio"
|
|
93
|
-
/>
|
|
94
|
-
),
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const Disabled: Story = {
|
|
98
|
-
render: () => (
|
|
99
|
-
<div className="w-80">
|
|
100
|
-
<ITInputNumber name="amount-disabled" label="Monto" value={1234.5} disabled onChange={() => {}} />
|
|
101
|
-
</div>
|
|
102
|
-
),
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
export const ReadOnly: Story = {
|
|
106
|
-
render: () => (
|
|
107
|
-
<div className="w-80">
|
|
108
|
-
<ITInputNumber name="amount-readonly" label="Monto" prefix="$" value={98765.43} readOnly onChange={() => {}} />
|
|
109
|
-
</div>
|
|
110
|
-
),
|
|
111
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './loader.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITLoader
|
|
7
|
-
|
|
8
|
-
A loading indicator with four animation variants and customizable sizing and color. Useful for async operations, data fetching states, and any in-progress feedback.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `variant` | `'spinner' \| 'dots' \| 'bar' \| 'pulse'` | `'spinner'` | Animation style. |
|
|
15
|
-
| `size` | `'sm' \| 'md' \| 'lg' \| 'xl'` | `'md'` | Size preset. |
|
|
16
|
-
| `color` | `string` | `'primary'` | Color value. Accepts theme semantic keys (`primary`, `secondary`, `success`, `danger`, `warning`, `info`, `purple`), hex, rgb, or CSS class. |
|
|
17
|
-
| `className` | `string` | `undefined` | Additional CSS classes. |
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
import { ITLoader } from '@axzydev/axzy_ui_system';
|
|
23
|
-
|
|
24
|
-
<ITLoader />
|
|
25
|
-
<ITLoader variant="dots" color="secondary" size="lg" />
|
|
26
|
-
<ITLoader variant="bar" color="success" />
|
|
27
|
-
<ITLoader variant="pulse" color="danger" size="xl" />
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Notes
|
|
31
|
-
|
|
32
|
-
- `spinner` — rotating circular indicator.
|
|
33
|
-
- `dots` — bouncing dots sequence.
|
|
34
|
-
- `pulse` — pulsing circle with scaling animation.
|
|
35
|
-
- `bar` — horizontal indeterminate progress bar (intended for use in a container with explicit width).
|
|
36
|
-
- Color mapping is handled through the theme system; semantic keys resolve to CSS custom properties.
|
|
37
|
-
- All animations use CSS keyframes with GPU-accelerated transforms where possible.
|
|
38
|
-
|
|
39
|
-
## Stories
|
|
40
|
-
|
|
41
|
-
<Primary />
|
|
42
|
-
<Controls />
|
|
43
|
-
<Stories />
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import ITLoader from "@/components/atoms/loader/loader";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof ITLoader> = {
|
|
5
|
-
title: "Components/Feedback/ITLoader",
|
|
6
|
-
component: ITLoader,
|
|
7
|
-
parameters: {
|
|
8
|
-
layout: "centered",
|
|
9
|
-
},
|
|
10
|
-
argTypes: {
|
|
11
|
-
size: {
|
|
12
|
-
control: "select",
|
|
13
|
-
options: ["sm", "md", "lg", "xl"],
|
|
14
|
-
description: "Size of the loader",
|
|
15
|
-
},
|
|
16
|
-
variant: {
|
|
17
|
-
control: "select",
|
|
18
|
-
options: ["spinner", "dots", "bar", "pulse"],
|
|
19
|
-
description: "Visual style of the loader",
|
|
20
|
-
},
|
|
21
|
-
color: {
|
|
22
|
-
control: "select",
|
|
23
|
-
options: ["primary", "secondary", "success", "danger", "warning", "info", "purple"],
|
|
24
|
-
description: "Semantic color from theme",
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default meta;
|
|
30
|
-
type Story = StoryObj<typeof ITLoader>;
|
|
31
|
-
|
|
32
|
-
export const Spinner: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
variant: "spinner",
|
|
35
|
-
color: "primary",
|
|
36
|
-
size: "md",
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export const Dots: Story = {
|
|
41
|
-
args: {
|
|
42
|
-
variant: "dots",
|
|
43
|
-
color: "secondary",
|
|
44
|
-
size: "md",
|
|
45
|
-
},
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Pulse: Story = {
|
|
49
|
-
args: {
|
|
50
|
-
variant: "pulse",
|
|
51
|
-
color: "danger",
|
|
52
|
-
size: "lg",
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const Bar: Story = {
|
|
57
|
-
render: (args) => (
|
|
58
|
-
<div className="w-[300px]">
|
|
59
|
-
<ITLoader {...args} />
|
|
60
|
-
</div>
|
|
61
|
-
),
|
|
62
|
-
args: {
|
|
63
|
-
variant: "bar",
|
|
64
|
-
color: "success",
|
|
65
|
-
size: "md",
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const AllColors: Story = {
|
|
70
|
-
render: (args) => (
|
|
71
|
-
<div className="flex gap-4 items-center">
|
|
72
|
-
{(['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'purple'] as const).map((color) => (
|
|
73
|
-
<ITLoader key={color} {...args} color={color} />
|
|
74
|
-
))}
|
|
75
|
-
</div>
|
|
76
|
-
),
|
|
77
|
-
args: {
|
|
78
|
-
variant: "spinner",
|
|
79
|
-
size: "md",
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
export const AllVariants: Story = {
|
|
84
|
-
render: () => (
|
|
85
|
-
<div className="flex flex-col gap-8 items-center">
|
|
86
|
-
<div className="flex gap-4 items-center">
|
|
87
|
-
<span className="w-20 text-sm font-bold text-gray-500">Spinner</span>
|
|
88
|
-
<ITLoader variant="spinner" color="primary" />
|
|
89
|
-
</div>
|
|
90
|
-
<div className="flex gap-4 items-center">
|
|
91
|
-
<span className="w-20 text-sm font-bold text-gray-500">Dots</span>
|
|
92
|
-
<ITLoader variant="dots" color="primary" />
|
|
93
|
-
</div>
|
|
94
|
-
<div className="flex gap-4 items-center">
|
|
95
|
-
<span className="w-20 text-sm font-bold text-gray-500">Pulse</span>
|
|
96
|
-
<ITLoader variant="pulse" color="primary" />
|
|
97
|
-
</div>
|
|
98
|
-
<div className="flex gap-4 items-center w-[300px]">
|
|
99
|
-
<span className="w-20 text-sm font-bold text-gray-500">Bar</span>
|
|
100
|
-
<ITLoader variant="bar" color="primary" />
|
|
101
|
-
</div>
|
|
102
|
-
</div>
|
|
103
|
-
),
|
|
104
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './popover.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITPopover
|
|
7
|
-
|
|
8
|
-
Floating content panel triggered by click on a trigger element. Supports four position placements and offers both uncontrolled (click toggle) and controlled (`isOpen`/`onClose`) modes.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `trigger` | `ReactNode` | — | Element that triggers the popover when clicked. |
|
|
15
|
-
| `children` | `ReactNode` | — | Content rendered inside the popover panel. |
|
|
16
|
-
| `position` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | Position of the popover relative to the trigger element. |
|
|
17
|
-
| `isOpen` | `boolean` | — | Controlled open state. When provided, the component acts in controlled mode. |
|
|
18
|
-
| `onClose` | `() => void` | — | Callback fired when the popover is closed in controlled mode. |
|
|
19
|
-
| `className` | `string` | — | Additional CSS classes for the container. |
|
|
20
|
-
|
|
21
|
-
## Usage
|
|
22
|
-
|
|
23
|
-
```tsx
|
|
24
|
-
import { ITPopover } from '@axzydev/axzy_ui_system';
|
|
25
|
-
|
|
26
|
-
<ITPopover trigger={<ITButton label="Abrir" />}>
|
|
27
|
-
<button>Editar</button>
|
|
28
|
-
<button>Eliminar</button>
|
|
29
|
-
</ITPopover>
|
|
30
|
-
|
|
31
|
-
<ITPopover
|
|
32
|
-
trigger={<ITButton label="Controlled" />}
|
|
33
|
-
position="top"
|
|
34
|
-
isOpen={open}
|
|
35
|
-
onClose={() => setOpen(false)}
|
|
36
|
-
>
|
|
37
|
-
<p>Contenido controlado</p>
|
|
38
|
-
</ITPopover>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Notes
|
|
42
|
-
|
|
43
|
-
- Default mode is uncontrolled: clicking the trigger toggles the popover open/closed.
|
|
44
|
-
- Controlled mode via `isOpen` and `onClose` allows external state management.
|
|
45
|
-
- Four positions available: `top`, `bottom`, `left`, `right` relative to the trigger element.
|
|
46
|
-
- Popover is dismissed automatically when clicking outside the panel.
|
|
47
|
-
- Ideal for dropdown menus, action lists, and contextual tool panels.
|
|
48
|
-
|
|
49
|
-
## Stories
|
|
50
|
-
|
|
51
|
-
<Primary />
|
|
52
|
-
<Controls />
|
|
53
|
-
<Stories />
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import ITPopover from "@/components/atoms/popover/popover";
|
|
3
|
-
import ITButton from "@/components/atoms/button/button";
|
|
4
|
-
import ITStack from "@/components/atoms/stack/stack";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof ITPopover> = {
|
|
7
|
-
title: "Components/Overlay/ITPopover",
|
|
8
|
-
component: ITPopover,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof ITPopover>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
render: () => (
|
|
16
|
-
<ITPopover trigger={<ITButton label="Abrir Popover" />}>
|
|
17
|
-
<ITStack spacing={2}>
|
|
18
|
-
<p className="text-sm font-semibold">Opciones</p>
|
|
19
|
-
<button className="text-sm text-left text-slate-600 hover:text-slate-800">Editar</button>
|
|
20
|
-
<button className="text-sm text-left text-slate-600 hover:text-slate-800">Eliminar</button>
|
|
21
|
-
</ITStack>
|
|
22
|
-
</ITPopover>
|
|
23
|
-
),
|
|
24
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './progress.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITProgress
|
|
7
|
-
|
|
8
|
-
Progress indicator with determinate and indeterminate variants. Supports multiple semantic colors and three sizes for indicating completion or loading states.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `value` | `number` | `0` | Current progress value. |
|
|
15
|
-
| `max` | `number` | `100` | Maximum progress value. |
|
|
16
|
-
| `variant` | `"determinate" \| "indeterminate"` | `"determinate"` | Progress variant. `"determinate"` shows a fixed-width fill, `"indeterminate"` shows an animated pulsing bar. |
|
|
17
|
-
| `color` | `"primary" \| "secondary" \| "success" \| "danger" \| "warning" \| "info" \| "purple" \| "error" \| "gray"` | `"primary"` | Semantic color for the progress fill. |
|
|
18
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height and visual scale of the progress bar. |
|
|
19
|
-
| `className` | `string` | — | Additional CSS classes for the container. |
|
|
20
|
-
| `style` | `CSSProperties` | — | Inline styles applied to the container. |
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```tsx
|
|
25
|
-
import { ITProgress } from '@axzydev/axzy_ui_system';
|
|
26
|
-
|
|
27
|
-
<ITProgress value={70} />
|
|
28
|
-
|
|
29
|
-
<ITProgress value={45} color="success" size="lg" />
|
|
30
|
-
|
|
31
|
-
<ITProgress variant="indeterminate" />
|
|
32
|
-
|
|
33
|
-
<ITProgress value={90} color="danger" size="sm" />
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## Notes
|
|
37
|
-
|
|
38
|
-
- `determinate` mode shows a solid fill proportional to `value / max`.
|
|
39
|
-
- `indeterminate` mode renders a continuous animated bar for loading states where progress is unknown.
|
|
40
|
-
- All nine semantic colors are available for the fill.
|
|
41
|
-
- Sizes `sm`, `md`, and `lg` control bar height and overall scale.
|
|
42
|
-
- Use `style` for custom width or container-level overrides.
|
|
43
|
-
|
|
44
|
-
## Stories
|
|
45
|
-
|
|
46
|
-
<Primary />
|
|
47
|
-
<Controls />
|
|
48
|
-
<Stories />
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import ITProgress from "@/components/atoms/progress/progress";
|
|
4
|
-
import ITButton from "@/components/atoms/button/button";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof ITProgress> = {
|
|
7
|
-
title: "Components/Feedback/ITProgress",
|
|
8
|
-
component: ITProgress,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof ITProgress>;
|
|
13
|
-
|
|
14
|
-
export const Determinate: Story = {
|
|
15
|
-
render: () => {
|
|
16
|
-
const [val, setVal] = useState(0);
|
|
17
|
-
return (
|
|
18
|
-
<div className="space-y-3">
|
|
19
|
-
<ITProgress value={val} />
|
|
20
|
-
<ITButton label="+10%" onClick={() => setVal(v => Math.min(v + 10, 100))} />
|
|
21
|
-
</div>
|
|
22
|
-
);
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const Indeterminate: Story = {
|
|
27
|
-
args: { variant: "indeterminate" },
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export const Colors: Story = {
|
|
31
|
-
render: () => (
|
|
32
|
-
<div className="space-y-3">
|
|
33
|
-
<ITProgress value={70} color="primary" />
|
|
34
|
-
<ITProgress value={70} color="success" />
|
|
35
|
-
<ITProgress value={70} color="danger" />
|
|
36
|
-
<ITProgress value={70} color="warning" />
|
|
37
|
-
</div>
|
|
38
|
-
),
|
|
39
|
-
};
|