@axzydev/axzy_ui_system 1.4.8 → 1.5.0
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 +77 -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 +1929 -0
- package/src/sandbox/icons.tsx +25 -0
- package/src/sandbox/locale.tsx +72 -0
- package/src/sandbox/ui.tsx +377 -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 +302 -214
- 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 +270 -216
- package/src/showcases/SizesShowcase.tsx +123 -64
- package/src/showcases/StructureShowcases.tsx +157 -131
- 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,54 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './checkbox.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITCheckbox
|
|
7
|
-
|
|
8
|
-
A checkbox input component with a custom visual style and a visually hidden native `<input>` for full accessibility. Supports checked, unchecked, and indeterminate states with an optional label. The disabled state reduces opacity and prevents interaction.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `checked` | `boolean` | `false` | Controlled checked state. |
|
|
15
|
-
| `onChange` | `(checked: boolean) => void` | — | Callback fired when the checkbox value changes. |
|
|
16
|
-
| `label` | `ReactNode` | — | Label text or element rendered next to the checkbox. |
|
|
17
|
-
| `disabled` | `boolean` | `false` | Disables interaction and applies reduced opacity. |
|
|
18
|
-
| `indeterminate` | `boolean` | `false` | Renders a dash indicator for partial selection. No effect when `checked` is `true`. |
|
|
19
|
-
| `className` | `string` | — | Additional CSS class names for the label wrapper. |
|
|
20
|
-
| `name` | `string` | — | HTML name attribute for the native `<input>` element. |
|
|
21
|
-
|
|
22
|
-
## Usage
|
|
23
|
-
|
|
24
|
-
```tsx
|
|
25
|
-
import { ITCheckbox } from '@axzydev/axzy_ui_system';
|
|
26
|
-
|
|
27
|
-
<ITCheckbox
|
|
28
|
-
checked={agreed}
|
|
29
|
-
onChange={setAgreed}
|
|
30
|
-
label="Acepto los términos y condiciones"
|
|
31
|
-
/>
|
|
32
|
-
|
|
33
|
-
<ITCheckbox
|
|
34
|
-
indeterminate={someChecked && !allChecked}
|
|
35
|
-
onChange={toggleAll}
|
|
36
|
-
label="Seleccionar todo"
|
|
37
|
-
/>
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
## Variants / Notes
|
|
41
|
-
|
|
42
|
-
- **Checked** — Blue filled square with a white checkmark SVG icon.
|
|
43
|
-
- **Unchecked** — White background with a slate gray border.
|
|
44
|
-
- **Indeterminate** — A horizontal dash line rendered when `indeterminate` is `true` and `checked` is `false`. Useful for "select all" parent checkboxes.
|
|
45
|
-
- The native `<input>` is visually hidden (`sr-only`) but remains interactive via the parent `<label>`, ensuring keyboard navigation and screen reader support.
|
|
46
|
-
- When disabled, the entire label wrapper gets `opacity-50` and `cursor-not-allowed`.
|
|
47
|
-
- Renders a focus ring (`ring-2 ring-primary-200`) on the custom visual element when the input is focused (unless disabled).
|
|
48
|
-
- Uses a `ref` callback to set `indeterminate` on the underlying DOM input for compliance with the HTML spec.
|
|
49
|
-
|
|
50
|
-
## Stories
|
|
51
|
-
|
|
52
|
-
<Primary />
|
|
53
|
-
<Controls />
|
|
54
|
-
<Stories />
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import ITCheckbox from "@/components/atoms/checkbox/checkbox";
|
|
4
|
-
import ITStack from "@/components/atoms/stack/stack";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof ITCheckbox> = {
|
|
7
|
-
title: "Components/Inputs/ITCheckbox",
|
|
8
|
-
component: ITCheckbox,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof ITCheckbox>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
render: () => {
|
|
16
|
-
const [val, setVal] = useState(false);
|
|
17
|
-
return <ITCheckbox checked={val} onChange={setVal} label="Acepto términos" />;
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export const Indeterminate: Story = {
|
|
22
|
-
args: { indeterminate: true, label: "Selección parcial" },
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const Disabled: Story = {
|
|
26
|
-
args: { checked: true, disabled: true, label: "Opción bloqueada" },
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const Group: Story = {
|
|
30
|
-
render: () => {
|
|
31
|
-
const [vals, setVals] = useState<Record<string, boolean>>({ a: true, b: false, c: false });
|
|
32
|
-
const all = Object.values(vals).every(Boolean);
|
|
33
|
-
const some = Object.values(vals).some(Boolean) && !all;
|
|
34
|
-
return (
|
|
35
|
-
<ITStack spacing={2}>
|
|
36
|
-
<ITCheckbox
|
|
37
|
-
checked={all}
|
|
38
|
-
indeterminate={some}
|
|
39
|
-
onChange={(v) => setVals({ a: v, b: v, c: v })}
|
|
40
|
-
label="Seleccionar todo"
|
|
41
|
-
/>
|
|
42
|
-
{Object.entries(vals).map(([k, v]) => (
|
|
43
|
-
<ITCheckbox
|
|
44
|
-
key={k}
|
|
45
|
-
checked={v}
|
|
46
|
-
onChange={(val) => setVals(p => ({ ...p, [k]: val }))}
|
|
47
|
-
label={`Opción ${k.toUpperCase()}`}
|
|
48
|
-
/>
|
|
49
|
-
))}
|
|
50
|
-
</ITStack>
|
|
51
|
-
);
|
|
52
|
-
},
|
|
53
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './chip.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITChip
|
|
7
|
-
|
|
8
|
-
Compact tag / pill for labels, active filters, and multi-value selections.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `label` | `string` | — | Text label. Overridden by `children`. |
|
|
15
|
-
| `children` | `ReactNode` | — | Custom content inside the chip. |
|
|
16
|
-
| `color` | semantic color key | `"secondary"` | Palette color. |
|
|
17
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Chip size. |
|
|
18
|
-
| `variant` | `"soft" \| "filled" \| "outlined"` | `"soft"` | Visual style. |
|
|
19
|
-
| `icon` | `ReactNode` | — | Icon before the label. |
|
|
20
|
-
| `removable` | `boolean` | `false` | Shows an (X) button. |
|
|
21
|
-
| `onRemove` | `() => void` | — | Fired when the remove button is pressed. |
|
|
22
|
-
| `onClick` | `() => void` | — | Makes the chip clickable (filter/toggle). |
|
|
23
|
-
| `selected` | `boolean` | `false` | Highlights the chip as selected. |
|
|
24
|
-
| `disabled` | `boolean` | `false` | Disables interactions. |
|
|
25
|
-
| `className` | `string` | — | Extra CSS classes. |
|
|
26
|
-
|
|
27
|
-
## Usage
|
|
28
|
-
|
|
29
|
-
```tsx
|
|
30
|
-
import { ITChip } from '@axzydev/axzy_ui_system';
|
|
31
|
-
|
|
32
|
-
<ITChip label="React" color="primary" />
|
|
33
|
-
<ITChip label="México" color="success" variant="outlined" removable onRemove={remove} />
|
|
34
|
-
<ITChip label="Activos" selected onClick={toggle} />
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Notes
|
|
38
|
-
|
|
39
|
-
- Colors come from `theme.colors`, so they follow the active theme/dark mode.
|
|
40
|
-
- Interactive chips (`onClick`) expose `role="button"` and keyboard support (Enter/Space).
|
|
41
|
-
- The remove button is a nested `<button>`; keep `onClick` on the chip for selection toggles.
|
|
42
|
-
|
|
43
|
-
## Stories
|
|
44
|
-
|
|
45
|
-
<Primary />
|
|
46
|
-
<Controls />
|
|
47
|
-
<Stories />
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import ITChip from "@/components/atoms/chip/chip";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof ITChip> = {
|
|
5
|
-
title: "Components/Data Display/ITChip",
|
|
6
|
-
component: ITChip,
|
|
7
|
-
parameters: { layout: "centered" },
|
|
8
|
-
argTypes: {
|
|
9
|
-
color: {
|
|
10
|
-
control: "select",
|
|
11
|
-
options: ["primary", "secondary", "success", "danger", "warning", "info", "purple"],
|
|
12
|
-
},
|
|
13
|
-
size: { control: "select", options: ["sm", "md", "lg"] },
|
|
14
|
-
variant: { control: "select", options: ["soft", "filled", "outlined"] },
|
|
15
|
-
selected: { control: "boolean" },
|
|
16
|
-
disabled: { control: "boolean" },
|
|
17
|
-
removable: { control: "boolean" },
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export default meta;
|
|
22
|
-
type Story = StoryObj<typeof ITChip>;
|
|
23
|
-
|
|
24
|
-
export const Default: Story = {
|
|
25
|
-
args: { label: "React", color: "primary" },
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const Variants: Story = {
|
|
29
|
-
render: () => (
|
|
30
|
-
<div className="flex flex-wrap items-center gap-3">
|
|
31
|
-
<ITChip label="Soft" variant="soft" color="primary" />
|
|
32
|
-
<ITChip label="Filled" variant="filled" color="primary" />
|
|
33
|
-
<ITChip label="Outlined" variant="outlined" color="primary" />
|
|
34
|
-
</div>
|
|
35
|
-
),
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const Colors: Story = {
|
|
39
|
-
render: () => (
|
|
40
|
-
<div className="flex flex-wrap items-center gap-3">
|
|
41
|
-
{["primary", "secondary", "success", "danger", "warning", "info", "purple"].map((c) => (
|
|
42
|
-
<ITChip key={c} label={c} color={c as never} />
|
|
43
|
-
))}
|
|
44
|
-
</div>
|
|
45
|
-
),
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export const Sizes: Story = {
|
|
49
|
-
render: () => (
|
|
50
|
-
<div className="flex flex-wrap items-center gap-3">
|
|
51
|
-
<ITChip label="Small" size="sm" />
|
|
52
|
-
<ITChip label="Medium" size="md" />
|
|
53
|
-
<ITChip label="Large" size="lg" />
|
|
54
|
-
</div>
|
|
55
|
-
),
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const Removable: Story = {
|
|
59
|
-
args: { label: "México", color: "success", removable: true },
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export const Selected: Story = {
|
|
63
|
-
args: { label: "Activos", color: "primary", selected: true, onClick: () => {} },
|
|
64
|
-
};
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './divider.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITDivider
|
|
7
|
-
|
|
8
|
-
A thin horizontal or vertical separator line for visually dividing content sections. Supports custom color and thickness via Tailwind utility classes.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Direction the divider flows. |
|
|
15
|
-
| `className` | `string` | — | Additional CSS classes. |
|
|
16
|
-
| `color` | `string` | `"bg-slate-200 dark:bg-slate-700"` | Tailwind background color class(es). |
|
|
17
|
-
| `thickness` | `string` | `"h-px"` (horizontal) / `"w-px"` (vertical) | Tailwind width/height utility. |
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```tsx
|
|
22
|
-
import { ITDivider } from '@axzydev/axzy_ui_system';
|
|
23
|
-
|
|
24
|
-
<ITDivider />
|
|
25
|
-
|
|
26
|
-
<ITDivider orientation="vertical" color="bg-red-500" thickness="w-1" />
|
|
27
|
-
|
|
28
|
-
<ITDivider color="bg-primary-300" thickness="h-0.5" />
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Notes
|
|
32
|
-
|
|
33
|
-
- Horizontal divider is full-width by default; vertical divider is full-height of its parent.
|
|
34
|
-
- Use in combination with ITStack or ITFlex for consistent layout spacing between sections.
|
|
35
|
-
- Auto-detects orientation for default thickness: `h-px` for horizontal, `w-px` for vertical.
|
|
36
|
-
- The `color` prop accepts any valid Tailwind background color class, including dark mode variants.
|
|
37
|
-
|
|
38
|
-
## Stories
|
|
39
|
-
|
|
40
|
-
<Primary />
|
|
41
|
-
<Controls />
|
|
42
|
-
<Stories />
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import ITDivider from "@/components/atoms/divider/divider";
|
|
3
|
-
import ITStack from "@/components/atoms/stack/stack";
|
|
4
|
-
import ITFlex from "@/components/atoms/flex/flex";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof ITDivider> = {
|
|
7
|
-
title: "Components/Layout/ITDivider",
|
|
8
|
-
component: ITDivider,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof ITDivider>;
|
|
13
|
-
|
|
14
|
-
export const Horizontal: Story = {
|
|
15
|
-
args: { orientation: "horizontal" },
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const Vertical: Story = {
|
|
19
|
-
decorators: [(Story) => <ITFlex gap={3} className="h-12"><span>Left</span><Story /><span>Right</span></ITFlex>],
|
|
20
|
-
args: { orientation: "vertical" },
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const InStack: Story = {
|
|
24
|
-
render: () => (
|
|
25
|
-
<ITStack spacing={3}>
|
|
26
|
-
<div className="p-3 bg-slate-50 rounded-lg text-sm">Sección 1</div>
|
|
27
|
-
<ITDivider />
|
|
28
|
-
<div className="p-3 bg-slate-50 rounded-lg text-sm">Sección 2</div>
|
|
29
|
-
<ITDivider />
|
|
30
|
-
<div className="p-3 bg-slate-50 rounded-lg text-sm">Sección 3</div>
|
|
31
|
-
</ITStack>
|
|
32
|
-
),
|
|
33
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './flex.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITFlex
|
|
7
|
-
|
|
8
|
-
A complete flexbox layout container exposing the full CSS Flexbox API through React props. Supports direction, wrap, alignment, justification, gap, grow, shrink, basis, and custom element rendering.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `children` | `ReactNode` | — | Child elements inside the flex container. |
|
|
15
|
-
| `direction` | `"row" \| "column" \| "row-reverse" \| "column-reverse"` | — | Main axis direction. |
|
|
16
|
-
| `align` | `"start" \| "end" \| "center" \| "stretch" \| "baseline"` | — | Cross-axis alignment. |
|
|
17
|
-
| `justify` | `"start" \| "end" \| "center" \| "between" \| "around" \| "evenly"` | — | Main-axis justification. |
|
|
18
|
-
| `wrap` | `"nowrap" \| "wrap" \| "wrap-reverse"` | — | Wrapping behavior. |
|
|
19
|
-
| `gap` | `number` | — | Gap between children in units of `0.25rem`. |
|
|
20
|
-
| `grow` | `boolean \| number` | — | Flex grow factor. `true` = 1, `false` = 0, or pass a number. |
|
|
21
|
-
| `shrink` | `boolean \| number` | — | Flex shrink factor. Works like `grow`. |
|
|
22
|
-
| `basis` | `string \| number` | — | Flex basis value. Numbers multiplied by `0.25rem`; strings used as-is. |
|
|
23
|
-
| `className` | `string` | — | Additional CSS classes. |
|
|
24
|
-
| `style` | `CSSProperties` | — | Inline styles. |
|
|
25
|
-
| `as` | `ElementType` | `"div"` | Custom HTML element type to render. |
|
|
26
|
-
| `onClick` | `(e: React.MouseEvent) => void` | — | Click handler. |
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
import { ITFlex } from '@axzydev/axzy_ui_system';
|
|
32
|
-
|
|
33
|
-
<ITFlex direction="row" gap={3} justify="between" align="center">
|
|
34
|
-
<div>Left</div>
|
|
35
|
-
<div>Center</div>
|
|
36
|
-
<div>Right</div>
|
|
37
|
-
</ITFlex>
|
|
38
|
-
|
|
39
|
-
<ITFlex direction="column" gap={2} className="h-60">
|
|
40
|
-
<ITFlex grow className="bg-primary-100 rounded-lg p-4">
|
|
41
|
-
<span>Grow (flex: 1)</span>
|
|
42
|
-
</ITFlex>
|
|
43
|
-
<div className="w-full">Fixed height</div>
|
|
44
|
-
</ITFlex>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Notes
|
|
48
|
-
|
|
49
|
-
- `gap` accepts an integer where `1` = `0.25rem` (4px), `4` = `1rem` (16px), etc., matching Tailwind's spacing scale.
|
|
50
|
-
- The `as` prop allows rendering as a `<section>`, `<nav>`, `<form>`, or any other semantic HTML element.
|
|
51
|
-
- `grow` and `shrink` accept `boolean` for quick on/off or `number` for precise flex factor control.
|
|
52
|
-
- Combine `basis`, `grow`, and `shrink` for complete flex item control on the container itself.
|
|
53
|
-
- All flex props are optional — the component renders as a standard `div` when no layout props are set.
|
|
54
|
-
|
|
55
|
-
## Stories
|
|
56
|
-
|
|
57
|
-
<Primary />
|
|
58
|
-
<Controls />
|
|
59
|
-
<Stories />
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import ITFlex from "@/components/atoms/flex/flex";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof ITFlex> = {
|
|
5
|
-
title: "Layout/ITFlex",
|
|
6
|
-
component: ITFlex,
|
|
7
|
-
argTypes: {
|
|
8
|
-
direction: {
|
|
9
|
-
control: "select",
|
|
10
|
-
options: ["row", "column", "row-reverse", "column-reverse"],
|
|
11
|
-
},
|
|
12
|
-
align: {
|
|
13
|
-
control: "select",
|
|
14
|
-
options: [undefined, "start", "end", "center", "stretch", "baseline"],
|
|
15
|
-
},
|
|
16
|
-
justify: {
|
|
17
|
-
control: "select",
|
|
18
|
-
options: [undefined, "start", "end", "center", "between", "around", "evenly"],
|
|
19
|
-
},
|
|
20
|
-
wrap: {
|
|
21
|
-
control: "select",
|
|
22
|
-
options: [undefined, "nowrap", "wrap", "wrap-reverse"],
|
|
23
|
-
},
|
|
24
|
-
gap: { control: { type: "range", min: 0, max: 16, step: 1 } },
|
|
25
|
-
grow: { control: "boolean" },
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default meta;
|
|
30
|
-
type Story = StoryObj<typeof ITFlex>;
|
|
31
|
-
|
|
32
|
-
const Box = ({ children, className = "" }: { children: string; className?: string }) => (
|
|
33
|
-
<div className={`bg-primary-100 text-primary-800 rounded-lg p-4 text-center font-medium ${className}`}>
|
|
34
|
-
{children}
|
|
35
|
-
</div>
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
export const Row: Story = {
|
|
39
|
-
args: { direction: "row", gap: 3 },
|
|
40
|
-
render: (args) => (
|
|
41
|
-
<ITFlex {...args}>
|
|
42
|
-
<Box>Flex 1</Box>
|
|
43
|
-
<Box>Flex 2</Box>
|
|
44
|
-
<Box>Flex 3</Box>
|
|
45
|
-
</ITFlex>
|
|
46
|
-
),
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const SpaceBetween: Story = {
|
|
50
|
-
args: { justify: "between", align: "center", className: "w-full" },
|
|
51
|
-
render: (args) => (
|
|
52
|
-
<ITFlex {...args}>
|
|
53
|
-
<Box>Left</Box>
|
|
54
|
-
<Box>Center</Box>
|
|
55
|
-
<Box>Right</Box>
|
|
56
|
-
</ITFlex>
|
|
57
|
-
),
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const ColumnGrow: Story = {
|
|
61
|
-
args: { direction: "column", gap: 2, className: "h-60" },
|
|
62
|
-
render: (args) => (
|
|
63
|
-
<ITFlex {...args}>
|
|
64
|
-
<ITFlex grow className="bg-primary-100 rounded-lg p-4">
|
|
65
|
-
<Box>Grow (flex: 1)</Box>
|
|
66
|
-
</ITFlex>
|
|
67
|
-
<Box className="w-full">Fixed height</Box>
|
|
68
|
-
</ITFlex>
|
|
69
|
-
),
|
|
70
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './grid.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITGrid
|
|
7
|
-
|
|
8
|
-
A responsive 12-column CSS grid system for building flexible layouts. Supports grid container and item modes, configurable column spans per breakpoint, and customizable gap spacing.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `children` | `ReactNode` | `undefined` | Child elements rendered inside the grid. |
|
|
15
|
-
| `container` | `boolean` | `false` | When true, renders as a CSS grid parent. |
|
|
16
|
-
| `item` | `boolean` | `false` | When true, renders as a CSS grid child with column span. |
|
|
17
|
-
| `spacing` | `number` | `undefined` | Gap between children in units of 0.25rem. Container only. |
|
|
18
|
-
| `columns` | `number` | `12` | Number of grid columns (1-12). Container only. |
|
|
19
|
-
| `xs` | `number` | `undefined` | Column span at base breakpoint (mobile). Falls back to `sm`. |
|
|
20
|
-
| `sm` | `number` | `undefined` | Column span at the `sm` breakpoint. |
|
|
21
|
-
| `md` | `number` | `undefined` | Column span at the `md` breakpoint. |
|
|
22
|
-
| `lg` | `number` | `undefined` | Column span at the `lg` breakpoint. |
|
|
23
|
-
| `xl` | `number` | `undefined` | Column span at the `xl` breakpoint. |
|
|
24
|
-
| `className` | `string` | `undefined` | Additional CSS classes. |
|
|
25
|
-
| `style` | `CSSProperties` | `undefined` | Inline styles. |
|
|
26
|
-
| `as` | `ElementType` | `'div'` | Custom HTML element type to render instead of div. |
|
|
27
|
-
|
|
28
|
-
## Usage
|
|
29
|
-
|
|
30
|
-
```tsx
|
|
31
|
-
import { ITGrid } from '@axzydev/axzy_ui_system';
|
|
32
|
-
|
|
33
|
-
<ITGrid container spacing={3}>
|
|
34
|
-
<ITGrid item xs={12} md={8}>
|
|
35
|
-
<div>Main content</div>
|
|
36
|
-
</ITGrid>
|
|
37
|
-
<ITGrid item xs={12} md={4}>
|
|
38
|
-
<div>Sidebar</div>
|
|
39
|
-
</ITGrid>
|
|
40
|
-
</ITGrid>
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Notes
|
|
44
|
-
|
|
45
|
-
- Uses CSS Grid under the hood with responsive breakpoint classes.
|
|
46
|
-
- Omitting both `container` and `item` renders a plain `div` with no grid behavior.
|
|
47
|
-
- Breakpoint spans cascade down: if `lg` is not set, it inherits `md`, then `sm`, then `xs`.
|
|
48
|
-
- `spacing` multiplies by 0.25rem internally (spacing={2} = 0.5rem gap).
|
|
49
|
-
|
|
50
|
-
## Stories
|
|
51
|
-
|
|
52
|
-
<Primary />
|
|
53
|
-
<Controls />
|
|
54
|
-
<Stories />
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import ITGrid from "@/components/atoms/grid/grid";
|
|
3
|
-
|
|
4
|
-
const meta: Meta<typeof ITGrid> = {
|
|
5
|
-
title: "Layout/ITGrid",
|
|
6
|
-
component: ITGrid,
|
|
7
|
-
argTypes: {
|
|
8
|
-
spacing: { control: { type: "range", min: 0, max: 8, step: 1 } },
|
|
9
|
-
columns: { control: { type: "number", min: 1, max: 12 } },
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export default meta;
|
|
14
|
-
type Story = StoryObj<typeof ITGrid>;
|
|
15
|
-
|
|
16
|
-
const Cell = ({ children }: { children: string }) => (
|
|
17
|
-
<div className="bg-primary-100 text-primary-800 rounded-lg p-4 text-center font-medium h-full flex items-center justify-center">
|
|
18
|
-
{children}
|
|
19
|
-
</div>
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
export const ThreeColumns: Story = {
|
|
23
|
-
args: { container: true, spacing: 2 },
|
|
24
|
-
render: (args) => (
|
|
25
|
-
<ITGrid {...args}>
|
|
26
|
-
<ITGrid item xs={4}>
|
|
27
|
-
<Cell>1/3</Cell>
|
|
28
|
-
</ITGrid>
|
|
29
|
-
<ITGrid item xs={4}>
|
|
30
|
-
<Cell>1/3</Cell>
|
|
31
|
-
</ITGrid>
|
|
32
|
-
<ITGrid item xs={4}>
|
|
33
|
-
<Cell>1/3</Cell>
|
|
34
|
-
</ITGrid>
|
|
35
|
-
</ITGrid>
|
|
36
|
-
),
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const Responsive: Story = {
|
|
40
|
-
args: { container: true, spacing: 3 },
|
|
41
|
-
render: (args) => (
|
|
42
|
-
<ITGrid {...args}>
|
|
43
|
-
<ITGrid item xs={12} sm={6} md={4} lg={3}>
|
|
44
|
-
<Cell>xs=12 sm=6 md=4 lg=3</Cell>
|
|
45
|
-
</ITGrid>
|
|
46
|
-
<ITGrid item xs={12} sm={6} md={4} lg={3}>
|
|
47
|
-
<Cell>xs=12 sm=6 md=4 lg=3</Cell>
|
|
48
|
-
</ITGrid>
|
|
49
|
-
<ITGrid item xs={12} sm={6} md={4} lg={3}>
|
|
50
|
-
<Cell>xs=12 sm=6 md=4 lg=3</Cell>
|
|
51
|
-
</ITGrid>
|
|
52
|
-
<ITGrid item xs={12} sm={6} md={4} lg={3}>
|
|
53
|
-
<Cell>xs=12 sm=6 md=4 lg=3</Cell>
|
|
54
|
-
</ITGrid>
|
|
55
|
-
</ITGrid>
|
|
56
|
-
),
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const SidebarContent: Story = {
|
|
60
|
-
args: { container: true, spacing: 4, columns: 12 },
|
|
61
|
-
render: (args) => (
|
|
62
|
-
<ITGrid {...args}>
|
|
63
|
-
<ITGrid item xs={12} md={3}>
|
|
64
|
-
<Cell>Sidebar (md: 3/12)</Cell>
|
|
65
|
-
</ITGrid>
|
|
66
|
-
<ITGrid item xs={12} md={9}>
|
|
67
|
-
<Cell>Main Content (md: 9/12)</Cell>
|
|
68
|
-
</ITGrid>
|
|
69
|
-
</ITGrid>
|
|
70
|
-
),
|
|
71
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Meta, Title, Description, Primary, Controls, Stories } from '@storybook/blocks';
|
|
2
|
-
import * as StoriesData from './image.stories';
|
|
3
|
-
|
|
4
|
-
<Meta of={StoriesData} />
|
|
5
|
-
|
|
6
|
-
# ITImage
|
|
7
|
-
|
|
8
|
-
An image component with automatic fallback on load error. Uses a native `<img>` element with an error boundary that swaps the source to a fallback URL when the primary image fails to load.
|
|
9
|
-
|
|
10
|
-
## Props
|
|
11
|
-
|
|
12
|
-
| Prop | Type | Default | Description |
|
|
13
|
-
|------|------|---------|-------------|
|
|
14
|
-
| `src` | `string` | required | Source URL of the image. |
|
|
15
|
-
| `alt` | `string` | `undefined` | Alt text for accessibility. |
|
|
16
|
-
| `className` | `string` | `undefined` | Additional CSS classes for the wrapper. |
|
|
17
|
-
| `fallback` | `string` | `undefined` | Fallback image URL shown when `src` fails to load. |
|
|
18
|
-
| `onClick` | `() => void` | `undefined` | Click handler on the image. |
|
|
19
|
-
|
|
20
|
-
## Usage
|
|
21
|
-
|
|
22
|
-
```tsx
|
|
23
|
-
import { ITImage } from '@axzydev/axzy_ui_system';
|
|
24
|
-
|
|
25
|
-
<ITImage
|
|
26
|
-
src="https://example.com/photo.jpg"
|
|
27
|
-
alt="Profile photo"
|
|
28
|
-
fallback="https://example.com/default-avatar.jpg"
|
|
29
|
-
/>
|
|
30
|
-
<ITImage src="https://example.com/logo.png" />
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Notes
|
|
34
|
-
|
|
35
|
-
- Handles `onerror` internally to swap to the `fallback` URL.
|
|
36
|
-
- The wrapper is an inline-block `div` with full width/height for responsive sizing within a sized parent.
|
|
37
|
-
- If no `fallback` is provided and the image errors, the broken image icon is shown.
|
|
38
|
-
- Uses `object-cover` to fill the container while maintaining aspect ratio.
|
|
39
|
-
|
|
40
|
-
## Stories
|
|
41
|
-
|
|
42
|
-
<Primary />
|
|
43
|
-
<Controls />
|
|
44
|
-
<Stories />
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import ITImage from '@/components/atoms/image/image';
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Components/Data Display/ITImage',
|
|
6
|
-
component: ITImage,
|
|
7
|
-
parameters: { layout: 'centered' },
|
|
8
|
-
argTypes: {
|
|
9
|
-
src: { control: 'text', description: 'Image source URL' },
|
|
10
|
-
alt: { control: 'text', description: 'Alternative text for accessibility' },
|
|
11
|
-
fallback: { control: 'text', description: 'Fallback image URL shown when the primary src fails to load' },
|
|
12
|
-
className: { control: 'text', description: 'Additional CSS classes for the wrapper' },
|
|
13
|
-
onClick: { control: false, description: 'Click handler' },
|
|
14
|
-
},
|
|
15
|
-
} satisfies Meta<typeof ITImage>;
|
|
16
|
-
|
|
17
|
-
export default meta;
|
|
18
|
-
type Story = StoryObj<typeof meta>;
|
|
19
|
-
|
|
20
|
-
const containerStyle = { width: 256, height: 192 };
|
|
21
|
-
|
|
22
|
-
export const Default: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
src: 'https://picsum.photos/256/192',
|
|
25
|
-
alt: 'Random image',
|
|
26
|
-
className: 'rounded-lg overflow-hidden',
|
|
27
|
-
},
|
|
28
|
-
render: (args) => <div style={containerStyle}><ITImage {...args} /></div>,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const WithFallbackError: Story = {
|
|
32
|
-
args: {
|
|
33
|
-
src: 'https://invalid-url/does-not-exist.jpg',
|
|
34
|
-
alt: 'Broken image',
|
|
35
|
-
fallback: 'https://picsum.photos/256/192?grayscale',
|
|
36
|
-
className: 'rounded-lg overflow-hidden',
|
|
37
|
-
},
|
|
38
|
-
render: (args) => <div style={containerStyle}><ITImage {...args} /></div>,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export const SquareAspectRatio: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
src: 'https://picsum.photos/200/200',
|
|
44
|
-
alt: 'Square image',
|
|
45
|
-
className: 'rounded-full overflow-hidden',
|
|
46
|
-
},
|
|
47
|
-
render: (args) => <div style={{ width: 128, height: 128 }}><ITImage {...args} /></div>,
|
|
48
|
-
};
|