@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
|
@@ -23,21 +23,23 @@ import {
|
|
|
23
23
|
} from "../index";
|
|
24
24
|
import { ShowcaseLayout, CodeViewer } from "./ShowcaseLayout";
|
|
25
25
|
import ITFlex from "../components/atoms/flex/flex";
|
|
26
|
+
import { useITTranslation } from "@/i18n";
|
|
26
27
|
|
|
27
28
|
const CodeExampleBlock = ({ title, desc, code, children }: { title: string; desc: string; code: string; children: React.ReactNode }) => {
|
|
29
|
+
const { t } = useITTranslation();
|
|
28
30
|
const [showCode, setShowCode] = useState(false);
|
|
29
31
|
return (
|
|
30
32
|
<div className="bg-white dark:bg-slate-900 rounded-xl border border-slate-200 dark:border-slate-700 shadow-sm overflow-hidden">
|
|
31
33
|
<div className="px-6 py-4 border-b border-slate-200 dark:border-slate-700">
|
|
32
34
|
<ITFlex justify="between" align="center">
|
|
33
35
|
<div>
|
|
34
|
-
<h3 className="text-
|
|
36
|
+
<h3 className="w-fit border-l-2 border-primary-700 pl-2.5 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-700 dark:border-primary-500 dark:text-slate-200">{title}</h3>
|
|
35
37
|
<p className="text-xs text-slate-500 mt-1">{desc}</p>
|
|
36
38
|
</div>
|
|
37
39
|
<ITButton variant="outlined" color="gray" size="sm" onClick={() => setShowCode(!showCode)}>
|
|
38
40
|
<ITFlex align="center" gap={1}>
|
|
39
41
|
<FaCode size={9} />
|
|
40
|
-
{showCode ? "
|
|
42
|
+
{showCode ? t("showcase.common.hideCode") : t("showcase.common.showCode")}
|
|
41
43
|
</ITFlex>
|
|
42
44
|
</ITButton>
|
|
43
45
|
</ITFlex>
|
|
@@ -54,6 +56,7 @@ const CodeExampleBlock = ({ title, desc, code, children }: { title: string; desc
|
|
|
54
56
|
|
|
55
57
|
// 1. ITButton Showcase
|
|
56
58
|
export const ButtonShowcase = () => {
|
|
59
|
+
const { t } = useITTranslation();
|
|
57
60
|
const [color, setColor] = useState<any>("primary");
|
|
58
61
|
const [size, setSize] = useState<any>("medium");
|
|
59
62
|
const [variant, setVariant] = useState<any>("filled");
|
|
@@ -66,12 +69,12 @@ export const ButtonShowcase = () => {
|
|
|
66
69
|
return (
|
|
67
70
|
<ShowcaseLayout
|
|
68
71
|
title="ITButton"
|
|
69
|
-
description="
|
|
72
|
+
description={t("showcase.forms.buttonDesc")}
|
|
70
73
|
code={code}
|
|
71
74
|
demo={
|
|
72
75
|
<div className="flex flex-col items-center gap-3">
|
|
73
76
|
<ITButton
|
|
74
|
-
label="
|
|
77
|
+
label={t("showcase.forms.clickMe")}
|
|
75
78
|
color={color}
|
|
76
79
|
size={size}
|
|
77
80
|
variant={variant}
|
|
@@ -81,7 +84,7 @@ export const ButtonShowcase = () => {
|
|
|
81
84
|
/>
|
|
82
85
|
{clickCount > 0 && (
|
|
83
86
|
<span className="text-xs font-mono text-slate-500 animate-pulse">
|
|
84
|
-
|
|
87
|
+
{t("showcase.forms.clicksRegistered", { count: clickCount })}
|
|
85
88
|
</span>
|
|
86
89
|
)}
|
|
87
90
|
</div>
|
|
@@ -90,7 +93,7 @@ export const ButtonShowcase = () => {
|
|
|
90
93
|
<>
|
|
91
94
|
<ITSelect
|
|
92
95
|
name="color"
|
|
93
|
-
label="
|
|
96
|
+
label={t("showcase.common.color")}
|
|
94
97
|
value={color}
|
|
95
98
|
onChange={(e: any) => setColor(e.target.value)}
|
|
96
99
|
options={[
|
|
@@ -106,7 +109,7 @@ export const ButtonShowcase = () => {
|
|
|
106
109
|
/>
|
|
107
110
|
<ITSelect
|
|
108
111
|
name="size"
|
|
109
|
-
label="
|
|
112
|
+
label={t("showcase.common.size")}
|
|
110
113
|
value={size}
|
|
111
114
|
onChange={(e: any) => setSize(e.target.value)}
|
|
112
115
|
options={[
|
|
@@ -117,7 +120,7 @@ export const ButtonShowcase = () => {
|
|
|
117
120
|
/>
|
|
118
121
|
<ITSelect
|
|
119
122
|
name="variant"
|
|
120
|
-
label="
|
|
123
|
+
label={t("showcase.common.variant")}
|
|
121
124
|
value={variant}
|
|
122
125
|
onChange={(e: any) => setVariant(e.target.value)}
|
|
123
126
|
options={[
|
|
@@ -131,28 +134,32 @@ export const ButtonShowcase = () => {
|
|
|
131
134
|
]}
|
|
132
135
|
/>
|
|
133
136
|
<div className="flex items-center justify-between pt-2">
|
|
134
|
-
<span className="text-
|
|
135
|
-
<ITSlideToggle isOn={withIcon} onToggle={setWithIcon} size="sm"
|
|
137
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.withIcon")}</span>
|
|
138
|
+
<ITSlideToggle isOn={withIcon} onToggle={setWithIcon} size="sm"
|
|
139
|
+
ariaLabel={t("showcase.forms.withIcon")}
|
|
140
|
+
/>
|
|
136
141
|
</div>
|
|
137
142
|
<div className="flex items-center justify-between">
|
|
138
|
-
<span className="text-
|
|
139
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
143
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
144
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
145
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
146
|
+
/>
|
|
140
147
|
</div>
|
|
141
148
|
</>
|
|
142
149
|
}
|
|
143
150
|
gallery={
|
|
144
151
|
<div className="space-y-6">
|
|
145
152
|
<div>
|
|
146
|
-
<
|
|
153
|
+
<h3 className="mb-3 w-fit border-l-2 border-primary-700 pl-2.5 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-700 dark:border-primary-500 dark:text-slate-200">{t("showcase.forms.galleryWithIcon")}</h3>
|
|
147
154
|
<div className="flex flex-wrap gap-3">
|
|
148
|
-
<ITButton label="
|
|
149
|
-
<ITButton label="
|
|
150
|
-
<ITButton label="
|
|
151
|
-
<ITButton label="
|
|
155
|
+
<ITButton label={t("showcase.common.save")} icon={<FaSave />} color="success" />
|
|
156
|
+
<ITButton label={t("showcase.common.edit")} icon={<FaEdit />} color="info" />
|
|
157
|
+
<ITButton label={t("showcase.common.delete")} icon={<FaTrash />} color="danger" variant="outlined" />
|
|
158
|
+
<ITButton label={t("showcase.forms.sync")} icon={<FaSync />} variant="text" />
|
|
152
159
|
</div>
|
|
153
160
|
</div>
|
|
154
161
|
<div>
|
|
155
|
-
<
|
|
162
|
+
<h3 className="mb-3 w-fit border-l-2 border-primary-700 pl-2.5 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-700 dark:border-primary-500 dark:text-slate-200">{t("showcase.forms.galleryVariants")}</h3>
|
|
156
163
|
<div className="flex flex-wrap gap-3">
|
|
157
164
|
<ITButton label="Filled" variant="filled" />
|
|
158
165
|
<ITButton label="Outlined" variant="outlined" />
|
|
@@ -163,7 +170,7 @@ export const ButtonShowcase = () => {
|
|
|
163
170
|
</div>
|
|
164
171
|
</div>
|
|
165
172
|
<div>
|
|
166
|
-
<
|
|
173
|
+
<h3 className="mb-3 w-fit border-l-2 border-primary-700 pl-2.5 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-700 dark:border-primary-500 dark:text-slate-200">{t("showcase.forms.gallerySemanticColors")}</h3>
|
|
167
174
|
<div className="flex flex-wrap gap-3">
|
|
168
175
|
<ITButton label="Primary" color="primary" />
|
|
169
176
|
<ITButton label="Secondary" color="secondary" />
|
|
@@ -182,6 +189,7 @@ export const ButtonShowcase = () => {
|
|
|
182
189
|
|
|
183
190
|
// 2. ITInput Showcase
|
|
184
191
|
export const InputShowcase = () => {
|
|
192
|
+
const { t } = useITTranslation();
|
|
185
193
|
const [selectedInput, setSelectedInput] = useState<
|
|
186
194
|
"text" | "password" | "select" | "searchselect" | "datepicker" | "timepicker" | "toggle" | "dropfile" | "form"
|
|
187
195
|
>("text");
|
|
@@ -208,8 +216,8 @@ export const InputShowcase = () => {
|
|
|
208
216
|
});
|
|
209
217
|
const [submittedData, setSubmittedData] = useState<any>(null);
|
|
210
218
|
|
|
211
|
-
const [label, setLabel] = useState("
|
|
212
|
-
const [placeholder, setPlaceholder] = useState("
|
|
219
|
+
const [label, setLabel] = useState(t("showcase.forms.inputUserLabel"));
|
|
220
|
+
const [placeholder, setPlaceholder] = useState(t("showcase.forms.inputUserPlaceholder"));
|
|
213
221
|
const [variant, setVariant] = useState<any>("primary");
|
|
214
222
|
const [disabled, setDisabled] = useState(false);
|
|
215
223
|
const [required, setRequired] = useState(false);
|
|
@@ -220,27 +228,27 @@ export const InputShowcase = () => {
|
|
|
220
228
|
const [showFormErrors, setShowFormErrors] = useState(false);
|
|
221
229
|
|
|
222
230
|
const formErrors = showFormErrors ? {
|
|
223
|
-
name: "
|
|
224
|
-
email: "
|
|
225
|
-
password: "
|
|
226
|
-
role: "
|
|
227
|
-
country: "
|
|
228
|
-
birthday: "
|
|
229
|
-
meetingTime: "
|
|
230
|
-
file: "
|
|
231
|
+
name: t("showcase.forms.errName"),
|
|
232
|
+
email: t("showcase.forms.errEmail"),
|
|
233
|
+
password: t("showcase.forms.errPassword"),
|
|
234
|
+
role: t("showcase.forms.errRole"),
|
|
235
|
+
country: t("showcase.forms.errCountry"),
|
|
236
|
+
birthday: t("showcase.forms.errBirthday"),
|
|
237
|
+
meetingTime: t("showcase.forms.errTime"),
|
|
238
|
+
file: t("showcase.forms.errFile")
|
|
231
239
|
} : {} as any;
|
|
232
240
|
|
|
233
241
|
useEffect(() => {
|
|
234
242
|
if (selectedInput !== "form") {
|
|
235
243
|
const DEFAULT_PROPS: Record<string, { label: string; placeholder: string }> = {
|
|
236
|
-
text: { label: "
|
|
237
|
-
password: { label: "
|
|
238
|
-
select: { label: "
|
|
239
|
-
searchselect: { label: "
|
|
240
|
-
datepicker: { label: "
|
|
241
|
-
timepicker: { label: "
|
|
242
|
-
toggle: { label: "
|
|
243
|
-
dropfile: { label: "
|
|
244
|
+
text: { label: t("showcase.forms.inputUserLabel"), placeholder: t("showcase.forms.inputUserPlaceholder") },
|
|
245
|
+
password: { label: t("showcase.forms.inputPasswordLabel"), placeholder: t("showcase.forms.inputPasswordPlaceholder") },
|
|
246
|
+
select: { label: t("showcase.forms.inputSelectLabel"), placeholder: t("showcase.forms.inputSelectPlaceholder") },
|
|
247
|
+
searchselect: { label: t("showcase.forms.inputCountryLabel"), placeholder: t("showcase.forms.inputCountryPlaceholder") },
|
|
248
|
+
datepicker: { label: t("showcase.forms.inputDateLabel"), placeholder: t("showcase.forms.inputDatePlaceholder") },
|
|
249
|
+
timepicker: { label: t("showcase.forms.inputTimeLabel"), placeholder: t("showcase.forms.inputTimePlaceholder") },
|
|
250
|
+
toggle: { label: t("showcase.forms.inputToggleLabel"), placeholder: "" },
|
|
251
|
+
dropfile: { label: t("showcase.forms.inputFileLabel"), placeholder: "" }
|
|
244
252
|
};
|
|
245
253
|
const defaults = DEFAULT_PROPS[selectedInput];
|
|
246
254
|
if (defaults) {
|
|
@@ -248,7 +256,7 @@ export const InputShowcase = () => {
|
|
|
248
256
|
setPlaceholder(defaults.placeholder);
|
|
249
257
|
}
|
|
250
258
|
}
|
|
251
|
-
}, [selectedInput]);
|
|
259
|
+
}, [selectedInput, t]);
|
|
252
260
|
|
|
253
261
|
const code = useMemo(() => {
|
|
254
262
|
if (selectedInput === "text") {
|
|
@@ -279,15 +287,15 @@ export const InputShowcase = () => {
|
|
|
279
287
|
}, [selectedInput, label, placeholder, variant, disabled, required, errorInput, textVal, passVal, selectVal, searchSelectVal, timeVal, toggleVal, fileVal]);
|
|
280
288
|
|
|
281
289
|
const tabs = [
|
|
282
|
-
{ id: "text", label: "
|
|
283
|
-
{ id: "password", label: "
|
|
290
|
+
{ id: "text", label: t("showcase.forms.tabText") },
|
|
291
|
+
{ id: "password", label: t("showcase.forms.tabPassword") },
|
|
284
292
|
{ id: "select", label: "Select" },
|
|
285
293
|
{ id: "searchselect", label: "SearchSelect" },
|
|
286
294
|
{ id: "datepicker", label: "DatePicker" },
|
|
287
295
|
{ id: "timepicker", label: "TimePicker" },
|
|
288
296
|
{ id: "toggle", label: "SlideToggle" },
|
|
289
297
|
{ id: "dropfile", label: "Dropfile" },
|
|
290
|
-
{ id: "form", label: "
|
|
298
|
+
{ id: "form", label: t("showcase.forms.tabForm") }
|
|
291
299
|
];
|
|
292
300
|
|
|
293
301
|
const renderActiveInput = () => {
|
|
@@ -403,10 +411,11 @@ export const InputShowcase = () => {
|
|
|
403
411
|
case "toggle":
|
|
404
412
|
return (
|
|
405
413
|
<div className="w-full max-w-sm flex items-center justify-between p-4 bg-slate-50 dark:bg-slate-800/40 border border-slate-100 dark:border-slate-800 rounded-xl">
|
|
406
|
-
<span className="text-
|
|
414
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{label || t("showcase.forms.toggleSwitch")}</span>
|
|
407
415
|
<ITSlideToggle
|
|
408
416
|
isOn={toggleVal}
|
|
409
417
|
onToggle={setToggleVal}
|
|
418
|
+
ariaLabel={label || t("showcase.forms.toggleSwitch")}
|
|
410
419
|
disabled={disabled}
|
|
411
420
|
activeColor={variant === "primary" ? "success" : variant}
|
|
412
421
|
/>
|
|
@@ -434,7 +443,7 @@ export const InputShowcase = () => {
|
|
|
434
443
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
435
444
|
<ITInput
|
|
436
445
|
name="form_name"
|
|
437
|
-
label="
|
|
446
|
+
label={t("showcase.forms.fullName")}
|
|
438
447
|
placeholder="Juan Pérez"
|
|
439
448
|
value={formData.name}
|
|
440
449
|
onChange={(e: any) => setFormData(prev => ({ ...prev, name: e.target.value }))}
|
|
@@ -446,7 +455,7 @@ export const InputShowcase = () => {
|
|
|
446
455
|
/>
|
|
447
456
|
<ITInput
|
|
448
457
|
name="form_email"
|
|
449
|
-
label="
|
|
458
|
+
label={t("showcase.forms.email")}
|
|
450
459
|
placeholder="juan@ejemplo.com"
|
|
451
460
|
value={formData.email}
|
|
452
461
|
onChange={(e: any) => setFormData(prev => ({ ...prev, email: e.target.value }))}
|
|
@@ -461,7 +470,7 @@ export const InputShowcase = () => {
|
|
|
461
470
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
462
471
|
<ITInput
|
|
463
472
|
name="form_password"
|
|
464
|
-
label="
|
|
473
|
+
label={t("showcase.forms.password")}
|
|
465
474
|
type="password"
|
|
466
475
|
placeholder="••••••••"
|
|
467
476
|
value={formData.password}
|
|
@@ -474,7 +483,7 @@ export const InputShowcase = () => {
|
|
|
474
483
|
/>
|
|
475
484
|
<ITSelect
|
|
476
485
|
name="form_role"
|
|
477
|
-
label="
|
|
486
|
+
label={t("showcase.forms.userRole")}
|
|
478
487
|
value={formData.role}
|
|
479
488
|
onChange={(e: any) => setFormData(prev => ({ ...prev, role: e.target.value }))}
|
|
480
489
|
options={[
|
|
@@ -492,7 +501,7 @@ export const InputShowcase = () => {
|
|
|
492
501
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
|
493
502
|
<ITSearchSelect
|
|
494
503
|
name="form_country"
|
|
495
|
-
label="
|
|
504
|
+
label={t("showcase.forms.countryResidence")}
|
|
496
505
|
value={formData.country}
|
|
497
506
|
onChange={(val: string) => setFormData(prev => ({ ...prev, country: val }))}
|
|
498
507
|
options={[
|
|
@@ -509,7 +518,7 @@ export const InputShowcase = () => {
|
|
|
509
518
|
/>
|
|
510
519
|
<ITDatePicker
|
|
511
520
|
name="form_birthday"
|
|
512
|
-
label="
|
|
521
|
+
label={t("showcase.forms.birthDate")}
|
|
513
522
|
value={formData.birthday}
|
|
514
523
|
onChange={(e: any) => setFormData(prev => ({ ...prev, birthday: e.target.value }))}
|
|
515
524
|
variant={formVariant}
|
|
@@ -523,7 +532,7 @@ export const InputShowcase = () => {
|
|
|
523
532
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4 items-center">
|
|
524
533
|
<ITTimePicker
|
|
525
534
|
name="form_time"
|
|
526
|
-
label="
|
|
535
|
+
label={t("showcase.forms.entryTime")}
|
|
527
536
|
value={formData.meetingTime}
|
|
528
537
|
onChange={(e: any) => setFormData(prev => ({ ...prev, meetingTime: e.target.value }))}
|
|
529
538
|
variant={formVariant}
|
|
@@ -533,13 +542,14 @@ export const InputShowcase = () => {
|
|
|
533
542
|
touched={showFormErrors ? true : undefined}
|
|
534
543
|
/>
|
|
535
544
|
<div className="flex items-center justify-between p-3 bg-slate-50 dark:bg-slate-800/40 border border-slate-100 dark:border-slate-800 rounded-xl h-[64px]">
|
|
536
|
-
<span className="text-xs font-semibold text-slate-700 dark:text-slate-300">
|
|
545
|
+
<span className="text-xs font-semibold text-slate-700 dark:text-slate-300">{t("showcase.forms.newsletter")}</span>
|
|
537
546
|
<ITSlideToggle
|
|
538
547
|
isOn={formData.newsletter}
|
|
539
548
|
onToggle={(val) => setFormData(prev => ({ ...prev, newsletter: val }))}
|
|
540
549
|
disabled={formDisabled}
|
|
541
550
|
size="sm"
|
|
542
|
-
|
|
551
|
+
ariaLabel={t("showcase.forms.newsletter")}
|
|
552
|
+
/>
|
|
543
553
|
</div>
|
|
544
554
|
</div>
|
|
545
555
|
|
|
@@ -550,12 +560,12 @@ export const InputShowcase = () => {
|
|
|
550
560
|
{formErrors.file && <p className="text-xs text-red-500 mt-1">{formErrors.file}</p>}
|
|
551
561
|
|
|
552
562
|
<div className="flex justify-end pt-2">
|
|
553
|
-
<ITButton label="
|
|
563
|
+
<ITButton label={t("showcase.forms.submitForm")} color={formVariant} type="submit" disabled={formDisabled} />
|
|
554
564
|
</div>
|
|
555
565
|
|
|
556
566
|
{submittedData && (
|
|
557
567
|
<div className="mt-4 p-4 bg-slate-950 text-emerald-400 font-mono text-[10px] sm:text-xs rounded-xl border border-slate-800">
|
|
558
|
-
<p className="font-bold mb-2"
|
|
568
|
+
<p className="font-bold mb-2">{t("showcase.forms.submitData")}</p>
|
|
559
569
|
<pre className="whitespace-pre-wrap">
|
|
560
570
|
{JSON.stringify(
|
|
561
571
|
{
|
|
@@ -600,8 +610,8 @@ export const InputShowcase = () => {
|
|
|
600
610
|
title="ITInput Suite"
|
|
601
611
|
description={
|
|
602
612
|
selectedInput === "form"
|
|
603
|
-
? "
|
|
604
|
-
:
|
|
613
|
+
? t("showcase.forms.inputFormDesc")
|
|
614
|
+
: t("showcase.forms.inputSingleDesc", { type: selectedInput.toUpperCase() })
|
|
605
615
|
}
|
|
606
616
|
code={code}
|
|
607
617
|
demo={renderActiveInput()}
|
|
@@ -610,7 +620,7 @@ export const InputShowcase = () => {
|
|
|
610
620
|
<>
|
|
611
621
|
<ITSelect
|
|
612
622
|
name="form_variant_ctrl"
|
|
613
|
-
label="
|
|
623
|
+
label={t("showcase.forms.buttonColorVariant")}
|
|
614
624
|
value={formVariant}
|
|
615
625
|
onChange={(e: any) => setFormVariant(e.target.value)}
|
|
616
626
|
options={[
|
|
@@ -623,19 +633,23 @@ export const InputShowcase = () => {
|
|
|
623
633
|
]}
|
|
624
634
|
/>
|
|
625
635
|
<div className="flex items-center justify-between pt-2">
|
|
626
|
-
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">
|
|
627
|
-
<ITSlideToggle isOn={showFormErrors} onToggle={setShowFormErrors} size="sm"
|
|
636
|
+
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">{t("showcase.forms.simulateErrors")}</span>
|
|
637
|
+
<ITSlideToggle isOn={showFormErrors} onToggle={setShowFormErrors} size="sm"
|
|
638
|
+
ariaLabel={t("showcase.forms.simulateErrors")}
|
|
639
|
+
/>
|
|
628
640
|
</div>
|
|
629
641
|
<div className="flex items-center justify-between">
|
|
630
|
-
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">
|
|
631
|
-
<ITSlideToggle isOn={formDisabled} onToggle={setFormDisabled} activeColor="danger" size="sm"
|
|
642
|
+
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">{t("showcase.forms.disableAll")}</span>
|
|
643
|
+
<ITSlideToggle isOn={formDisabled} onToggle={setFormDisabled} activeColor="danger" size="sm"
|
|
644
|
+
ariaLabel={t("showcase.forms.disableAll")}
|
|
645
|
+
/>
|
|
632
646
|
</div>
|
|
633
647
|
</>
|
|
634
648
|
) : (
|
|
635
649
|
<>
|
|
636
650
|
<ITInput
|
|
637
651
|
name="label_ctrl"
|
|
638
|
-
label="
|
|
652
|
+
label={t("showcase.forms.labelProp")}
|
|
639
653
|
value={label}
|
|
640
654
|
onChange={(e: any) => setLabel(e.target.value)}
|
|
641
655
|
onBlur={() => { }}
|
|
@@ -643,7 +657,7 @@ export const InputShowcase = () => {
|
|
|
643
657
|
{["text", "password", "searchselect", "datepicker", "timepicker"].includes(selectedInput) && (
|
|
644
658
|
<ITInput
|
|
645
659
|
name="placeholder_ctrl"
|
|
646
|
-
label="
|
|
660
|
+
label={t("showcase.forms.placeholderLabel")}
|
|
647
661
|
value={placeholder}
|
|
648
662
|
onChange={(e: any) => setPlaceholder(e.target.value)}
|
|
649
663
|
onBlur={() => { }}
|
|
@@ -652,7 +666,7 @@ export const InputShowcase = () => {
|
|
|
652
666
|
{["text", "password", "datepicker", "timepicker", "toggle"].includes(selectedInput) && (
|
|
653
667
|
<ITSelect
|
|
654
668
|
name="variant_ctrl"
|
|
655
|
-
label="
|
|
669
|
+
label={t("showcase.forms.colorVariant")}
|
|
656
670
|
value={variant}
|
|
657
671
|
onChange={(e: any) => setVariant(e.target.value)}
|
|
658
672
|
options={[
|
|
@@ -667,19 +681,23 @@ export const InputShowcase = () => {
|
|
|
667
681
|
)}
|
|
668
682
|
<ITInput
|
|
669
683
|
name="error_ctrl"
|
|
670
|
-
label="
|
|
684
|
+
label={t("showcase.forms.errorMessage")}
|
|
671
685
|
value={errorInput}
|
|
672
686
|
onChange={(e: any) => setErrorInput(e.target.value)}
|
|
673
687
|
onBlur={() => { }}
|
|
674
|
-
placeholder="
|
|
688
|
+
placeholder={t("showcase.forms.invalidFormatPlaceholder")}
|
|
675
689
|
/>
|
|
676
690
|
<div className="flex items-center justify-between pt-2">
|
|
677
|
-
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">
|
|
678
|
-
<ITSlideToggle isOn={required} onToggle={setRequired} size="sm"
|
|
691
|
+
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">{t("showcase.common.required")}</span>
|
|
692
|
+
<ITSlideToggle isOn={required} onToggle={setRequired} size="sm"
|
|
693
|
+
ariaLabel={t("showcase.common.required")}
|
|
694
|
+
/>
|
|
679
695
|
</div>
|
|
680
696
|
<div className="flex items-center justify-between">
|
|
681
|
-
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">
|
|
682
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
697
|
+
<span className="text-sm font-semibold text-gray-700 dark:text-slate-300">{t("showcase.common.disabled")}</span>
|
|
698
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
699
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
700
|
+
/>
|
|
683
701
|
</div>
|
|
684
702
|
</>
|
|
685
703
|
)
|
|
@@ -687,10 +705,10 @@ export const InputShowcase = () => {
|
|
|
687
705
|
gallery={
|
|
688
706
|
selectedInput === "form" ? (
|
|
689
707
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
|
690
|
-
<ITInput name="g1" label="
|
|
691
|
-
<ITInput name="g2" label="
|
|
692
|
-
<ITInput name="g3" label="
|
|
693
|
-
<ITInput name="g4" label="
|
|
708
|
+
<ITInput name="g1" label={t("showcase.forms.inputStandard")} placeholder={t("showcase.forms.enterData")} onChange={() => { }} onBlur={() => { }} />
|
|
709
|
+
<ITInput name="g2" label={t("showcase.forms.inputWithError")} value="Email no válido" error={t("showcase.forms.emailFormatError")} onChange={() => { }} onBlur={() => { }} touched />
|
|
710
|
+
<ITInput name="g3" label={t("showcase.forms.inputDisabled")} placeholder={t("showcase.forms.readOnly")} disabled onChange={() => { }} onBlur={() => { }} />
|
|
711
|
+
<ITInput name="g4" label={t("showcase.forms.inputPassword")} type="password" value="secreto123" onChange={() => { }} onBlur={() => { }} />
|
|
694
712
|
</div>
|
|
695
713
|
) : undefined
|
|
696
714
|
}
|
|
@@ -701,8 +719,9 @@ export const InputShowcase = () => {
|
|
|
701
719
|
|
|
702
720
|
// 3. ITSelect Showcase
|
|
703
721
|
export const SelectShowcase = () => {
|
|
722
|
+
const { t } = useITTranslation();
|
|
704
723
|
const [val, setVal] = useState("");
|
|
705
|
-
const [label, setLabel] = useState("
|
|
724
|
+
const [label, setLabel] = useState(t("showcase.forms.inputSelectLabel"));
|
|
706
725
|
const [disabled, setDisabled] = useState(false);
|
|
707
726
|
const [error, setError] = useState("");
|
|
708
727
|
|
|
@@ -717,7 +736,7 @@ export const SelectShowcase = () => {
|
|
|
717
736
|
return (
|
|
718
737
|
<ShowcaseLayout
|
|
719
738
|
title="ITSelect"
|
|
720
|
-
description="
|
|
739
|
+
description={t("showcase.forms.selectDesc")}
|
|
721
740
|
code={code}
|
|
722
741
|
demo={
|
|
723
742
|
<div className="w-full max-w-sm">
|
|
@@ -731,24 +750,26 @@ export const SelectShowcase = () => {
|
|
|
731
750
|
onChange={(e: any) => setVal(e.target.value)}
|
|
732
751
|
/>
|
|
733
752
|
{val && (
|
|
734
|
-
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
753
|
+
<p className="mt-2 text-xs text-slate-500 font-mono">{t("showcase.forms.selection", { value: val })}</p>
|
|
735
754
|
)}
|
|
736
755
|
</div>
|
|
737
756
|
}
|
|
738
757
|
controls={
|
|
739
758
|
<>
|
|
740
|
-
<ITInput name="label_ctrl" label="
|
|
741
|
-
<ITInput name="err_ctrl" label="
|
|
759
|
+
<ITInput name="label_ctrl" label={t("showcase.common.label")} value={label} onChange={(e: any) => setLabel(e.target.value)} onBlur={() => { }} />
|
|
760
|
+
<ITInput name="err_ctrl" label={t("showcase.forms.errorMessage")} value={error} onChange={(e: any) => setError(e.target.value)} onBlur={() => { }} />
|
|
742
761
|
<div className="flex items-center justify-between pt-2">
|
|
743
|
-
<span className="text-
|
|
744
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
762
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
763
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
764
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
765
|
+
/>
|
|
745
766
|
</div>
|
|
746
767
|
</>
|
|
747
768
|
}
|
|
748
769
|
gallery={
|
|
749
770
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
|
|
750
|
-
<ITSelect name="s1" label="
|
|
751
|
-
<ITSelect name="s2" label="
|
|
771
|
+
<ITSelect name="s1" label={t("showcase.forms.simpleOption")} options={[{ label: "Chile", value: "cl" }]} onChange={() => { }} />
|
|
772
|
+
<ITSelect name="s2" label={t("showcase.forms.selectWithError")} options={[]} error={t("showcase.forms.requiredFieldError2")} touched onChange={() => { }} />
|
|
752
773
|
</div>
|
|
753
774
|
}
|
|
754
775
|
/>
|
|
@@ -757,6 +778,7 @@ export const SelectShowcase = () => {
|
|
|
757
778
|
|
|
758
779
|
// 4. ITSearchSelect Showcase
|
|
759
780
|
export const SearchSelectShowcase = () => {
|
|
781
|
+
const { t } = useITTranslation();
|
|
760
782
|
const [val, setVal] = useState<any>("");
|
|
761
783
|
const [customVal, setCustomVal] = useState<any>("MX");
|
|
762
784
|
const [clearVal, setClearVal] = useState<any>("ES");
|
|
@@ -779,13 +801,13 @@ export const SearchSelectShowcase = () => {
|
|
|
779
801
|
return (
|
|
780
802
|
<ShowcaseLayout
|
|
781
803
|
title="ITSearchSelect"
|
|
782
|
-
description="
|
|
804
|
+
description={t("showcase.forms.searchSelectDesc")}
|
|
783
805
|
code={`${code}\n\n${customCode}`}
|
|
784
806
|
demo={
|
|
785
807
|
<div className="w-full max-w-sm">
|
|
786
808
|
<ITSearchSelect
|
|
787
809
|
name="country"
|
|
788
|
-
label="
|
|
810
|
+
label={t("showcase.forms.selectCountry")}
|
|
789
811
|
value={val}
|
|
790
812
|
options={options}
|
|
791
813
|
isLoading={isLoading}
|
|
@@ -793,7 +815,7 @@ export const SearchSelectShowcase = () => {
|
|
|
793
815
|
onChange={(value) => setVal(value)}
|
|
794
816
|
/>
|
|
795
817
|
{val && (
|
|
796
|
-
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
818
|
+
<p className="mt-2 text-xs text-slate-500 font-mono">{t("showcase.forms.countrySelected", { value: val })}</p>
|
|
797
819
|
)}
|
|
798
820
|
</div>
|
|
799
821
|
}
|
|
@@ -801,11 +823,11 @@ export const SearchSelectShowcase = () => {
|
|
|
801
823
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
|
802
824
|
<div className="w-full max-w-sm">
|
|
803
825
|
<p className="mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-400">
|
|
804
|
-
|
|
826
|
+
{t("showcase.forms.customTemplate")}
|
|
805
827
|
</p>
|
|
806
828
|
<ITSearchSelect
|
|
807
829
|
name="country_custom"
|
|
808
|
-
label="
|
|
830
|
+
label={t("showcase.forms.countryCustomLabel")}
|
|
809
831
|
value={customVal}
|
|
810
832
|
options={options}
|
|
811
833
|
onChange={(value) => setCustomVal(value)}
|
|
@@ -819,24 +841,24 @@ export const SearchSelectShowcase = () => {
|
|
|
819
841
|
)}
|
|
820
842
|
/>
|
|
821
843
|
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
822
|
-
{customVal ?
|
|
844
|
+
{customVal ? t("showcase.forms.countrySelected", { value: customVal }) : t("showcase.common.noSelection")}
|
|
823
845
|
</p>
|
|
824
846
|
</div>
|
|
825
847
|
|
|
826
848
|
<div className="w-full max-w-sm">
|
|
827
849
|
<p className="mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-400">
|
|
828
|
-
|
|
850
|
+
{t("showcase.forms.clearButton")}
|
|
829
851
|
</p>
|
|
830
852
|
<ITSearchSelect
|
|
831
853
|
name="country_clear"
|
|
832
|
-
label="
|
|
854
|
+
label={t("showcase.forms.countryClearable")}
|
|
833
855
|
value={clearVal}
|
|
834
856
|
options={options}
|
|
835
857
|
onChange={(value) => setClearVal(value)}
|
|
836
858
|
onClear={() => setClearVal("")}
|
|
837
859
|
/>
|
|
838
860
|
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
839
|
-
{clearVal ?
|
|
861
|
+
{clearVal ? t("showcase.forms.countrySelected", { value: clearVal }) : t("showcase.common.noSelection")}
|
|
840
862
|
</p>
|
|
841
863
|
</div>
|
|
842
864
|
</div>
|
|
@@ -844,12 +866,16 @@ export const SearchSelectShowcase = () => {
|
|
|
844
866
|
controls={
|
|
845
867
|
<>
|
|
846
868
|
<div className="flex items-center justify-between">
|
|
847
|
-
<span className="text-
|
|
848
|
-
<ITSlideToggle isOn={isLoading} onToggle={setIsLoading} size="sm"
|
|
869
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.loadingState")}</span>
|
|
870
|
+
<ITSlideToggle isOn={isLoading} onToggle={setIsLoading} size="sm"
|
|
871
|
+
ariaLabel={t("showcase.forms.loadingState")}
|
|
872
|
+
/>
|
|
849
873
|
</div>
|
|
850
874
|
<div className="flex items-center justify-between">
|
|
851
|
-
<span className="text-
|
|
852
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
875
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
876
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
877
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
878
|
+
/>
|
|
853
879
|
</div>
|
|
854
880
|
</>
|
|
855
881
|
}
|
|
@@ -859,6 +885,7 @@ export const SearchSelectShowcase = () => {
|
|
|
859
885
|
|
|
860
886
|
// 5. ITDatePicker Showcase
|
|
861
887
|
export const DatePickerShowcase = () => {
|
|
888
|
+
const { t } = useITTranslation();
|
|
862
889
|
const [val, setVal] = useState<any>(new Date());
|
|
863
890
|
const [range, setRange] = useState(false);
|
|
864
891
|
const [disabled, setDisabled] = useState(false);
|
|
@@ -873,13 +900,13 @@ export const DatePickerShowcase = () => {
|
|
|
873
900
|
return (
|
|
874
901
|
<ShowcaseLayout
|
|
875
902
|
title="ITDatePicker"
|
|
876
|
-
description="
|
|
903
|
+
description={t("showcase.forms.datePickerDesc")}
|
|
877
904
|
code={code}
|
|
878
905
|
demo={
|
|
879
906
|
<div className="w-full max-w-sm">
|
|
880
907
|
<ITDatePicker
|
|
881
908
|
name="showcase_datepicker"
|
|
882
|
-
label="
|
|
909
|
+
label={t("showcase.forms.eventDate")}
|
|
883
910
|
value={val}
|
|
884
911
|
range={range}
|
|
885
912
|
variant={variant}
|
|
@@ -888,8 +915,8 @@ export const DatePickerShowcase = () => {
|
|
|
888
915
|
/>
|
|
889
916
|
{val && (
|
|
890
917
|
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
891
|
-
|
|
892
|
-
?
|
|
918
|
+
{t("showcase.forms.currentValue")} {range && Array.isArray(val)
|
|
919
|
+
? t("showcase.forms.rangeValue", { from: val[0]?.toLocaleDateString() || "?", to: val[1]?.toLocaleDateString() || "?" })
|
|
893
920
|
: val instanceof Date
|
|
894
921
|
? val.toLocaleDateString()
|
|
895
922
|
: String(val)
|
|
@@ -902,7 +929,7 @@ export const DatePickerShowcase = () => {
|
|
|
902
929
|
<>
|
|
903
930
|
<ITSelect
|
|
904
931
|
name="variant_ctrl"
|
|
905
|
-
label="
|
|
932
|
+
label={t("showcase.forms.colorTheme")}
|
|
906
933
|
value={variant}
|
|
907
934
|
onChange={(e: any) => setVariant(e.target.value)}
|
|
908
935
|
options={[
|
|
@@ -915,12 +942,16 @@ export const DatePickerShowcase = () => {
|
|
|
915
942
|
]}
|
|
916
943
|
/>
|
|
917
944
|
<div className="flex items-center justify-between pt-2">
|
|
918
|
-
<span className="text-
|
|
919
|
-
<ITSlideToggle isOn={range} onToggle={(r) => { setRange(r); setVal(r ? [new Date(), new Date()] : new Date()); }} size="sm"
|
|
945
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.rangeSelection")}</span>
|
|
946
|
+
<ITSlideToggle isOn={range} onToggle={(r) => { setRange(r); setVal(r ? [new Date(), new Date()] : new Date()); }} size="sm"
|
|
947
|
+
ariaLabel={t("showcase.forms.rangeSelection")}
|
|
948
|
+
/>
|
|
920
949
|
</div>
|
|
921
950
|
<div className="flex items-center justify-between">
|
|
922
|
-
<span className="text-
|
|
923
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
951
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
952
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
953
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
954
|
+
/>
|
|
924
955
|
</div>
|
|
925
956
|
</>
|
|
926
957
|
}
|
|
@@ -930,6 +961,7 @@ export const DatePickerShowcase = () => {
|
|
|
930
961
|
|
|
931
962
|
// 6. ITTimePicker Showcase
|
|
932
963
|
export const TimePickerShowcase = () => {
|
|
964
|
+
const { t } = useITTranslation();
|
|
933
965
|
const [val, setVal] = useState("09:30");
|
|
934
966
|
const [variant, setVariant] = useState<any>("primary");
|
|
935
967
|
const [disabled, setDisabled] = useState(false);
|
|
@@ -939,13 +971,13 @@ export const TimePickerShowcase = () => {
|
|
|
939
971
|
return (
|
|
940
972
|
<ShowcaseLayout
|
|
941
973
|
title="ITTimePicker"
|
|
942
|
-
description="
|
|
974
|
+
description={t("showcase.forms.timePickerDesc")}
|
|
943
975
|
code={code}
|
|
944
976
|
demo={
|
|
945
977
|
<div className="w-full max-w-sm">
|
|
946
978
|
<ITTimePicker
|
|
947
979
|
name="showcase_time"
|
|
948
|
-
label="
|
|
980
|
+
label={t("showcase.forms.startTime")}
|
|
949
981
|
value={val}
|
|
950
982
|
variant={variant}
|
|
951
983
|
disabled={disabled}
|
|
@@ -953,7 +985,7 @@ export const TimePickerShowcase = () => {
|
|
|
953
985
|
onBlur={() => { }}
|
|
954
986
|
/>
|
|
955
987
|
{val && (
|
|
956
|
-
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
988
|
+
<p className="mt-2 text-xs text-slate-500 font-mono">{t("showcase.forms.timeChosen", { value: val })}</p>
|
|
957
989
|
)}
|
|
958
990
|
</div>
|
|
959
991
|
}
|
|
@@ -961,7 +993,7 @@ export const TimePickerShowcase = () => {
|
|
|
961
993
|
<>
|
|
962
994
|
<ITSelect
|
|
963
995
|
name="variant_ctrl"
|
|
964
|
-
label="
|
|
996
|
+
label={t("showcase.common.variant")}
|
|
965
997
|
value={variant}
|
|
966
998
|
onChange={(e: any) => setVariant(e.target.value)}
|
|
967
999
|
options={[
|
|
@@ -975,8 +1007,10 @@ export const TimePickerShowcase = () => {
|
|
|
975
1007
|
]}
|
|
976
1008
|
/>
|
|
977
1009
|
<div className="flex items-center justify-between pt-2">
|
|
978
|
-
<span className="text-
|
|
979
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
1010
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
1011
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
1012
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
1013
|
+
/>
|
|
980
1014
|
</div>
|
|
981
1015
|
</>
|
|
982
1016
|
}
|
|
@@ -986,6 +1020,7 @@ export const TimePickerShowcase = () => {
|
|
|
986
1020
|
|
|
987
1021
|
// 7. ITCalendar Showcase
|
|
988
1022
|
export const CalendarShowcase = () => {
|
|
1023
|
+
const { t } = useITTranslation();
|
|
989
1024
|
const [mode, setMode] = useState<'month' | 'week' | 'day'>('month');
|
|
990
1025
|
const [selectionMode, setSelectionMode] = useState<'single' | 'range'>('single');
|
|
991
1026
|
const [calendarVariant, setCalendarVariant] = useState<any>("primary");
|
|
@@ -999,7 +1034,7 @@ export const CalendarShowcase = () => {
|
|
|
999
1034
|
return (
|
|
1000
1035
|
<ShowcaseLayout
|
|
1001
1036
|
title="ITCalendar"
|
|
1002
|
-
description="
|
|
1037
|
+
description={t("showcase.forms.calendarDesc")}
|
|
1003
1038
|
code={code}
|
|
1004
1039
|
demo={
|
|
1005
1040
|
<div className="w-full h-[450px]">
|
|
@@ -1008,8 +1043,8 @@ export const CalendarShowcase = () => {
|
|
|
1008
1043
|
selectionMode={selectionMode}
|
|
1009
1044
|
variant={calendarVariant}
|
|
1010
1045
|
events={events}
|
|
1011
|
-
onSlotClick={(date) => alert(
|
|
1012
|
-
onEventClick={(evt) => alert(
|
|
1046
|
+
onSlotClick={(date) => alert(t("showcase.forms.slotClick", { date: date.toLocaleString() }))}
|
|
1047
|
+
onEventClick={(evt) => alert(t("showcase.forms.eventDetail", { title: evt.title }))}
|
|
1013
1048
|
/>
|
|
1014
1049
|
</div>
|
|
1015
1050
|
}
|
|
@@ -1017,7 +1052,7 @@ export const CalendarShowcase = () => {
|
|
|
1017
1052
|
<>
|
|
1018
1053
|
<ITSelect
|
|
1019
1054
|
name="mode_ctrl"
|
|
1020
|
-
label="
|
|
1055
|
+
label={t("showcase.forms.viewMode")}
|
|
1021
1056
|
value={mode}
|
|
1022
1057
|
onChange={(e: any) => setMode(e.target.value)}
|
|
1023
1058
|
options={[
|
|
@@ -1028,7 +1063,7 @@ export const CalendarShowcase = () => {
|
|
|
1028
1063
|
/>
|
|
1029
1064
|
<ITSelect
|
|
1030
1065
|
name="sel_ctrl"
|
|
1031
|
-
label="
|
|
1066
|
+
label={t("showcase.forms.selectionMode")}
|
|
1032
1067
|
value={selectionMode}
|
|
1033
1068
|
onChange={(e: any) => setSelectionMode(e.target.value)}
|
|
1034
1069
|
options={[
|
|
@@ -1038,7 +1073,7 @@ export const CalendarShowcase = () => {
|
|
|
1038
1073
|
/>
|
|
1039
1074
|
<ITSelect
|
|
1040
1075
|
name="var_ctrl"
|
|
1041
|
-
label="
|
|
1076
|
+
label={t("showcase.forms.colorVariant")}
|
|
1042
1077
|
value={calendarVariant}
|
|
1043
1078
|
onChange={(e: any) => setCalendarVariant(e.target.value)}
|
|
1044
1079
|
options={[
|
|
@@ -1058,6 +1093,7 @@ export const CalendarShowcase = () => {
|
|
|
1058
1093
|
|
|
1059
1094
|
// 8. ITSlideToggle Showcase
|
|
1060
1095
|
export const SlideToggleShowcase = () => {
|
|
1096
|
+
const { t } = useITTranslation();
|
|
1061
1097
|
const [isOn, setIsOn] = useState(false);
|
|
1062
1098
|
const [activeColor, setActiveColor] = useState<any>("success");
|
|
1063
1099
|
const [size, setSize] = useState<any>("md");
|
|
@@ -1068,7 +1104,7 @@ export const SlideToggleShowcase = () => {
|
|
|
1068
1104
|
return (
|
|
1069
1105
|
<ShowcaseLayout
|
|
1070
1106
|
title="ITSlideToggle"
|
|
1071
|
-
description="
|
|
1107
|
+
description={t("showcase.forms.slideToggleDesc")}
|
|
1072
1108
|
code={code}
|
|
1073
1109
|
demo={
|
|
1074
1110
|
<div className="flex flex-col items-center gap-3">
|
|
@@ -1078,9 +1114,10 @@ export const SlideToggleShowcase = () => {
|
|
|
1078
1114
|
activeColor={activeColor}
|
|
1079
1115
|
size={size}
|
|
1080
1116
|
disabled={disabled}
|
|
1117
|
+
ariaLabel={t("showcase.forms.toggleSwitch")}
|
|
1081
1118
|
/>
|
|
1082
1119
|
<span className="text-xs font-mono text-slate-500">
|
|
1083
|
-
|
|
1120
|
+
{t("showcase.forms.stateLabel")} {isOn ? t("showcase.forms.stateOn") : t("showcase.forms.stateOff")}
|
|
1084
1121
|
</span>
|
|
1085
1122
|
</div>
|
|
1086
1123
|
}
|
|
@@ -1088,7 +1125,7 @@ export const SlideToggleShowcase = () => {
|
|
|
1088
1125
|
<>
|
|
1089
1126
|
<ITSelect
|
|
1090
1127
|
name="col_ctrl"
|
|
1091
|
-
label="
|
|
1128
|
+
label={t("showcase.forms.activeColor")}
|
|
1092
1129
|
value={activeColor}
|
|
1093
1130
|
onChange={(e: any) => setActiveColor(e.target.value)}
|
|
1094
1131
|
options={[
|
|
@@ -1101,7 +1138,7 @@ export const SlideToggleShowcase = () => {
|
|
|
1101
1138
|
/>
|
|
1102
1139
|
<ITSelect
|
|
1103
1140
|
name="sz_ctrl"
|
|
1104
|
-
label="
|
|
1141
|
+
label={t("showcase.common.size")}
|
|
1105
1142
|
value={size}
|
|
1106
1143
|
onChange={(e: any) => setSize(e.target.value)}
|
|
1107
1144
|
options={[
|
|
@@ -1111,17 +1148,38 @@ export const SlideToggleShowcase = () => {
|
|
|
1111
1148
|
]}
|
|
1112
1149
|
/>
|
|
1113
1150
|
<div className="flex items-center justify-between pt-2">
|
|
1114
|
-
<span className="text-
|
|
1115
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
1151
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.disableSwitch")}</span>
|
|
1152
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
1153
|
+
ariaLabel={t("showcase.forms.disableSwitch")}
|
|
1154
|
+
/>
|
|
1116
1155
|
</div>
|
|
1117
1156
|
</>
|
|
1118
1157
|
}
|
|
1119
1158
|
gallery={
|
|
1120
1159
|
<div className="flex flex-wrap items-center gap-6">
|
|
1121
|
-
<ITSlideToggle
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1160
|
+
<ITSlideToggle
|
|
1161
|
+
initialState={false}
|
|
1162
|
+
size="sm"
|
|
1163
|
+
ariaLabel={t("showcase.common.off")}
|
|
1164
|
+
/>
|
|
1165
|
+
<ITSlideToggle
|
|
1166
|
+
initialState={true}
|
|
1167
|
+
activeColor="primary"
|
|
1168
|
+
size="md"
|
|
1169
|
+
ariaLabel={`${t("showcase.common.on")} · md`}
|
|
1170
|
+
/>
|
|
1171
|
+
<ITSlideToggle
|
|
1172
|
+
initialState={true}
|
|
1173
|
+
activeColor="purple"
|
|
1174
|
+
size="lg"
|
|
1175
|
+
ariaLabel={`${t("showcase.common.on")} · purple · lg`}
|
|
1176
|
+
/>
|
|
1177
|
+
<ITSlideToggle
|
|
1178
|
+
initialState={true}
|
|
1179
|
+
disabled
|
|
1180
|
+
size="md"
|
|
1181
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
1182
|
+
/>
|
|
1125
1183
|
</div>
|
|
1126
1184
|
}
|
|
1127
1185
|
/>
|
|
@@ -1130,6 +1188,7 @@ export const SlideToggleShowcase = () => {
|
|
|
1130
1188
|
|
|
1131
1189
|
// 9. ITDropfile Showcase
|
|
1132
1190
|
export const DropfileShowcase = () => {
|
|
1191
|
+
const { t } = useITTranslation();
|
|
1133
1192
|
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
|
1134
1193
|
const [status, setStatus] = useState<any>("pendiente");
|
|
1135
1194
|
|
|
@@ -1138,7 +1197,7 @@ export const DropfileShowcase = () => {
|
|
|
1138
1197
|
return (
|
|
1139
1198
|
<ShowcaseLayout
|
|
1140
1199
|
title="ITDropfile"
|
|
1141
|
-
description="
|
|
1200
|
+
description={t("showcase.forms.dropfileDesc")}
|
|
1142
1201
|
code={code}
|
|
1143
1202
|
demo={
|
|
1144
1203
|
<div className="w-full max-w-md">
|
|
@@ -1149,9 +1208,9 @@ export const DropfileShowcase = () => {
|
|
|
1149
1208
|
/>
|
|
1150
1209
|
{selectedFile && (
|
|
1151
1210
|
<div className="mt-4 p-3 bg-slate-50 dark:bg-slate-900 border rounded-lg text-xs font-mono">
|
|
1152
|
-
<p>
|
|
1153
|
-
<p>
|
|
1154
|
-
<p>
|
|
1211
|
+
<p>{t("showcase.forms.fileName")} {selectedFile.name}</p>
|
|
1212
|
+
<p>{t("showcase.forms.fileSize")} {(selectedFile.size / 1024).toFixed(1)} KB</p>
|
|
1213
|
+
<p>{t("showcase.forms.fileType")} {selectedFile.type}</p>
|
|
1155
1214
|
</div>
|
|
1156
1215
|
)}
|
|
1157
1216
|
</div>
|
|
@@ -1160,7 +1219,7 @@ export const DropfileShowcase = () => {
|
|
|
1160
1219
|
<>
|
|
1161
1220
|
<ITSelect
|
|
1162
1221
|
name="status_ctrl"
|
|
1163
|
-
label="
|
|
1222
|
+
label={t("showcase.forms.forceUploadState")}
|
|
1164
1223
|
value={status}
|
|
1165
1224
|
onChange={(e: any) => setStatus(e.target.value)}
|
|
1166
1225
|
options={[
|
|
@@ -1178,6 +1237,7 @@ export const DropfileShowcase = () => {
|
|
|
1178
1237
|
|
|
1179
1238
|
// 10. ITWysiwyg Showcase
|
|
1180
1239
|
export const WysiwygShowcase = () => {
|
|
1240
|
+
const { t } = useITTranslation();
|
|
1181
1241
|
const [html, setHtml] = useState(
|
|
1182
1242
|
"<div>Edita este texto con la <strong>barra de herramientas</strong>.</div><ul><li>Negrita, <em>itálica</em> y <u>subrayado</u></li><li><mark style=\"background-color:#fde68a\">Marcador amarillo</mark></li></ul>"
|
|
1183
1243
|
);
|
|
@@ -1189,7 +1249,7 @@ export const WysiwygShowcase = () => {
|
|
|
1189
1249
|
return (
|
|
1190
1250
|
<ShowcaseLayout
|
|
1191
1251
|
title="ITWysiwyg"
|
|
1192
|
-
description="
|
|
1252
|
+
description={t("showcase.forms.wysiwygDesc")}
|
|
1193
1253
|
code={code}
|
|
1194
1254
|
doc={{
|
|
1195
1255
|
summary:
|
|
@@ -1222,16 +1282,16 @@ export const WysiwygShowcase = () => {
|
|
|
1222
1282
|
demo={
|
|
1223
1283
|
<div className="w-full max-w-2xl space-y-4">
|
|
1224
1284
|
<ITWysiwyg
|
|
1225
|
-
label="
|
|
1285
|
+
label={t("showcase.forms.articleContent")}
|
|
1226
1286
|
value={html}
|
|
1227
1287
|
onChange={setHtml}
|
|
1228
1288
|
size={size}
|
|
1229
1289
|
error={error}
|
|
1230
|
-
placeholder="
|
|
1290
|
+
placeholder={t("showcase.forms.wysiwygPlaceholder")}
|
|
1231
1291
|
/>
|
|
1232
1292
|
<div className="p-4 bg-slate-950 rounded-xl border border-slate-800">
|
|
1233
1293
|
<p className="text-[10px] font-bold uppercase tracking-wider text-slate-500 mb-2">
|
|
1234
|
-
|
|
1294
|
+
{t("showcase.forms.generatedHtml")}
|
|
1235
1295
|
</p>
|
|
1236
1296
|
<pre className="text-[11px] text-emerald-300 font-mono whitespace-pre-wrap break-words">
|
|
1237
1297
|
{html}
|
|
@@ -1243,7 +1303,7 @@ export const WysiwygShowcase = () => {
|
|
|
1243
1303
|
<>
|
|
1244
1304
|
<ITSelect
|
|
1245
1305
|
name="size_ctrl"
|
|
1246
|
-
label="
|
|
1306
|
+
label={t("showcase.common.size")}
|
|
1247
1307
|
value={size}
|
|
1248
1308
|
onChange={(e: any) => setSize(e.target.value)}
|
|
1249
1309
|
options={[
|
|
@@ -1253,12 +1313,13 @@ export const WysiwygShowcase = () => {
|
|
|
1253
1313
|
]}
|
|
1254
1314
|
/>
|
|
1255
1315
|
<div className="flex items-center justify-between pt-2">
|
|
1256
|
-
<span className="text-
|
|
1316
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.forceError")}</span>
|
|
1257
1317
|
<ITSlideToggle
|
|
1258
1318
|
isOn={!!error}
|
|
1259
|
-
onToggle={(v) => setError(v ? "
|
|
1319
|
+
onToggle={(v) => setError(v ? t("showcase.forms.requiredFieldError") : undefined)}
|
|
1260
1320
|
activeColor="danger"
|
|
1261
1321
|
size="sm"
|
|
1322
|
+
ariaLabel={t("showcase.forms.forceError")}
|
|
1262
1323
|
/>
|
|
1263
1324
|
</div>
|
|
1264
1325
|
</>
|
|
@@ -1269,6 +1330,7 @@ export const WysiwygShowcase = () => {
|
|
|
1269
1330
|
|
|
1270
1331
|
// 11. ITFormBuilder Showcase
|
|
1271
1332
|
export const FormBuilderShowcase = () => {
|
|
1333
|
+
const { t } = useITTranslation();
|
|
1272
1334
|
const [values, setValues] = useState({
|
|
1273
1335
|
name: "",
|
|
1274
1336
|
email: "",
|
|
@@ -1308,7 +1370,7 @@ export const FormBuilderShowcase = () => {
|
|
|
1308
1370
|
<div className="space-y-8">
|
|
1309
1371
|
<ShowcaseLayout
|
|
1310
1372
|
title="ITFormBuilder"
|
|
1311
|
-
description="
|
|
1373
|
+
description={t("showcase.forms.formBuilderDesc")}
|
|
1312
1374
|
doc={{
|
|
1313
1375
|
summary:
|
|
1314
1376
|
"Renderiza un grid responsive de inputs a partir de un arreglo de definiciones de campo. Totalmente controlado: delega el estado a Formik (o cualquier holder externo).",
|
|
@@ -1358,16 +1420,16 @@ export const FormBuilderShowcase = () => {
|
|
|
1358
1420
|
/>
|
|
1359
1421
|
<div className="pt-4 flex justify-end gap-3">
|
|
1360
1422
|
<ITButton variant="outlined" color="gray" size="sm" onClick={() => { setValues({ name: "", email: "", country: "MX", accept: false }); setSubmitted(null); }}>
|
|
1361
|
-
|
|
1423
|
+
{t("showcase.forms.clear")}
|
|
1362
1424
|
</ITButton>
|
|
1363
1425
|
<ITButton variant="filled" color="primary" size="sm" type="submit">
|
|
1364
|
-
|
|
1426
|
+
{t("showcase.forms.send")}
|
|
1365
1427
|
</ITButton>
|
|
1366
1428
|
</div>
|
|
1367
1429
|
</form>
|
|
1368
1430
|
{submitted && (
|
|
1369
1431
|
<div className="p-4 bg-slate-950 text-emerald-400 text-xs rounded-xl border border-slate-800 font-mono">
|
|
1370
|
-
<p className="font-bold text-emerald-300 mb-2"
|
|
1432
|
+
<p className="font-bold text-emerald-300 mb-2">{t("showcase.forms.payloadSent")}</p>
|
|
1371
1433
|
<pre>{JSON.stringify(submitted, null, 2)}</pre>
|
|
1372
1434
|
</div>
|
|
1373
1435
|
)}
|
|
@@ -1375,14 +1437,14 @@ export const FormBuilderShowcase = () => {
|
|
|
1375
1437
|
}
|
|
1376
1438
|
controls={
|
|
1377
1439
|
<div className="p-2 bg-slate-50 dark:bg-slate-900 rounded-lg text-xs">
|
|
1378
|
-
<p className="text-slate-500">
|
|
1440
|
+
<p className="text-slate-500">{t("showcase.forms.formBuilderHint")}</p>
|
|
1379
1441
|
</div>
|
|
1380
1442
|
}
|
|
1381
1443
|
/>
|
|
1382
1444
|
|
|
1383
1445
|
<CodeExampleBlock
|
|
1384
|
-
title="
|
|
1385
|
-
desc="
|
|
1446
|
+
title={t("showcase.forms.exampleFillTitle")}
|
|
1447
|
+
desc={t("showcase.forms.exampleFillDesc")}
|
|
1386
1448
|
code={`const FormFillFromApi = () => {
|
|
1387
1449
|
const [loading, setLoading] = useState(true);
|
|
1388
1450
|
const [values, setValues] = useState({ name: "", email: "", role: "" });
|
|
@@ -1423,8 +1485,8 @@ export const FormBuilderShowcase = () => {
|
|
|
1423
1485
|
</CodeExampleBlock>
|
|
1424
1486
|
|
|
1425
1487
|
<CodeExampleBlock
|
|
1426
|
-
title="
|
|
1427
|
-
desc="
|
|
1488
|
+
title={t("showcase.forms.exampleCascadeTitle")}
|
|
1489
|
+
desc={t("showcase.forms.exampleCascadeDesc")}
|
|
1428
1490
|
code={`const config = [
|
|
1429
1491
|
{
|
|
1430
1492
|
name: "country", label: "País", type: "select",
|
|
@@ -1467,8 +1529,8 @@ export const FormBuilderShowcase = () => {
|
|
|
1467
1529
|
</CodeExampleBlock>
|
|
1468
1530
|
|
|
1469
1531
|
<CodeExampleBlock
|
|
1470
|
-
title="
|
|
1471
|
-
desc="
|
|
1532
|
+
title={t("showcase.forms.exampleCurrencyTitle")}
|
|
1533
|
+
desc={t("showcase.forms.exampleCurrencyDesc")}
|
|
1472
1534
|
code={`const CurrencyConverterExample = () => {
|
|
1473
1535
|
const [values, setValues] = useState({ currency: "MXN", amount: 1000 });
|
|
1474
1536
|
const TC = 20.50;
|
|
@@ -1510,6 +1572,7 @@ export const FormBuilderShowcase = () => {
|
|
|
1510
1572
|
|
|
1511
1573
|
// ── Fill from API example ──
|
|
1512
1574
|
const FormFillFromApi = () => {
|
|
1575
|
+
const { t } = useITTranslation();
|
|
1513
1576
|
const [loading, setLoading] = useState(true);
|
|
1514
1577
|
const [values, setValues] = useState({ name: "", email: "", role: "" });
|
|
1515
1578
|
const [submitted, setSubmitted] = useState<any>(null);
|
|
@@ -1544,7 +1607,7 @@ const FormFillFromApi = () => {
|
|
|
1544
1607
|
return (
|
|
1545
1608
|
<div className="flex items-center gap-3 py-8 justify-center">
|
|
1546
1609
|
<FaSync className="animate-spin text-primary-500" />
|
|
1547
|
-
<span className="text-sm text-slate-500">
|
|
1610
|
+
<span className="text-sm text-slate-500">{t("showcase.forms.loadingUserData")}</span>
|
|
1548
1611
|
</div>
|
|
1549
1612
|
);
|
|
1550
1613
|
}
|
|
@@ -1562,12 +1625,12 @@ const FormFillFromApi = () => {
|
|
|
1562
1625
|
setFieldValue={(field, val) => { setValues(prev => ({ ...prev, [field]: val })); return Promise.resolve(); }}
|
|
1563
1626
|
/>
|
|
1564
1627
|
<div className="flex justify-end">
|
|
1565
|
-
<ITButton variant="filled" color="primary" size="sm" type="submit">
|
|
1628
|
+
<ITButton variant="filled" color="primary" size="sm" type="submit">{t("showcase.forms.saveChanges")}</ITButton>
|
|
1566
1629
|
</div>
|
|
1567
1630
|
</form>
|
|
1568
1631
|
{submitted && (
|
|
1569
1632
|
<div className="p-3 bg-slate-950 text-emerald-400 text-xs rounded-lg font-mono border border-slate-800">
|
|
1570
|
-
<p className="font-bold mb-1"
|
|
1633
|
+
<p className="font-bold mb-1">{t("showcase.forms.editedPayload")}</p>
|
|
1571
1634
|
<pre>{JSON.stringify(submitted, null, 2)}</pre>
|
|
1572
1635
|
</div>
|
|
1573
1636
|
)}
|
|
@@ -1577,6 +1640,7 @@ const FormFillFromApi = () => {
|
|
|
1577
1640
|
|
|
1578
1641
|
// ── Cascading Selects Example ──
|
|
1579
1642
|
const CascadingSelectsExample = () => {
|
|
1643
|
+
const { t } = useITTranslation();
|
|
1580
1644
|
const [values, setValues] = useState({ country: "", city: "" });
|
|
1581
1645
|
const [submitted, setSubmitted] = useState<any>(null);
|
|
1582
1646
|
|
|
@@ -1636,12 +1700,12 @@ const CascadingSelectsExample = () => {
|
|
|
1636
1700
|
setFieldValue={(field, val) => { setValues(prev => ({ ...prev, [field]: val })); return Promise.resolve(); }}
|
|
1637
1701
|
/>
|
|
1638
1702
|
<div className="flex justify-end">
|
|
1639
|
-
<ITButton variant="filled" color="primary" size="sm" type="submit">
|
|
1703
|
+
<ITButton variant="filled" color="primary" size="sm" type="submit">{t("showcase.forms.send")}</ITButton>
|
|
1640
1704
|
</div>
|
|
1641
1705
|
</form>
|
|
1642
1706
|
{submitted && (
|
|
1643
1707
|
<div className="p-3 bg-slate-950 text-emerald-400 text-xs rounded-lg font-mono border border-slate-800">
|
|
1644
|
-
<p className="font-bold mb-1"
|
|
1708
|
+
<p className="font-bold mb-1">{t("showcase.forms.dataPayload")}</p>
|
|
1645
1709
|
<pre>{JSON.stringify(submitted, null, 2)}</pre>
|
|
1646
1710
|
</div>
|
|
1647
1711
|
)}
|
|
@@ -1651,6 +1715,7 @@ const CascadingSelectsExample = () => {
|
|
|
1651
1715
|
|
|
1652
1716
|
// ── Currency Converter Example ──
|
|
1653
1717
|
const CurrencyConverterExample = () => {
|
|
1718
|
+
const { t } = useITTranslation();
|
|
1654
1719
|
const [values, setValues] = useState({ currency: "MXN", amount: 1000 });
|
|
1655
1720
|
const TC = 20.50;
|
|
1656
1721
|
|
|
@@ -1699,7 +1764,7 @@ const CurrencyConverterExample = () => {
|
|
|
1699
1764
|
</div>
|
|
1700
1765
|
{values.amount > 0 && (
|
|
1701
1766
|
<p className="text-[11px] text-slate-400 text-center">
|
|
1702
|
-
|
|
1767
|
+
{t("showcase.forms.exchangeRate", { rate: TC.toFixed(2) })}
|
|
1703
1768
|
</p>
|
|
1704
1769
|
)}
|
|
1705
1770
|
</div>
|
|
@@ -1708,6 +1773,7 @@ const CurrencyConverterExample = () => {
|
|
|
1708
1773
|
|
|
1709
1774
|
// 12. ITField Showcase
|
|
1710
1775
|
export const FieldShowcase = () => {
|
|
1776
|
+
const { t } = useITTranslation();
|
|
1711
1777
|
const [email, setEmail] = useState("");
|
|
1712
1778
|
const [showHelp, setShowHelp] = useState(true);
|
|
1713
1779
|
const invalid = email.length > 0 && !email.includes("@");
|
|
@@ -1717,16 +1783,16 @@ export const FieldShowcase = () => {
|
|
|
1717
1783
|
return (
|
|
1718
1784
|
<ShowcaseLayout
|
|
1719
1785
|
title="ITField"
|
|
1720
|
-
description="
|
|
1786
|
+
description={t("showcase.forms.fieldDesc")}
|
|
1721
1787
|
code={code}
|
|
1722
1788
|
demo={
|
|
1723
1789
|
<div className="w-full max-w-sm">
|
|
1724
1790
|
<ITField
|
|
1725
|
-
label="
|
|
1791
|
+
label={t("showcase.forms.emailSubject")}
|
|
1726
1792
|
htmlFor="email"
|
|
1727
1793
|
required
|
|
1728
|
-
error={invalid ? "
|
|
1729
|
-
helpText={showHelp ? "
|
|
1794
|
+
error={invalid ? t("showcase.forms.invalidEmail") : undefined}
|
|
1795
|
+
helpText={showHelp ? t("showcase.forms.emailHelp") : undefined}
|
|
1730
1796
|
>
|
|
1731
1797
|
<ITInput name="email" value={email} onChange={(e: any) => setEmail(e.target.value)} onBlur={() => {}} />
|
|
1732
1798
|
</ITField>
|
|
@@ -1734,8 +1800,10 @@ export const FieldShowcase = () => {
|
|
|
1734
1800
|
}
|
|
1735
1801
|
controls={
|
|
1736
1802
|
<div className="flex items-center justify-between">
|
|
1737
|
-
<span className="text-
|
|
1738
|
-
<ITSlideToggle isOn={showHelp} onToggle={setShowHelp} size="sm"
|
|
1803
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.showHelp")}</span>
|
|
1804
|
+
<ITSlideToggle isOn={showHelp} onToggle={setShowHelp} size="sm"
|
|
1805
|
+
ariaLabel={t("showcase.forms.showHelp")}
|
|
1806
|
+
/>
|
|
1739
1807
|
</div>
|
|
1740
1808
|
}
|
|
1741
1809
|
doc={{
|
|
@@ -1761,6 +1829,7 @@ export const FieldShowcase = () => {
|
|
|
1761
1829
|
|
|
1762
1830
|
// 13. ITMultiSelect Showcase
|
|
1763
1831
|
export const MultiSelectShowcase = () => {
|
|
1832
|
+
const { t } = useITTranslation();
|
|
1764
1833
|
const [value, setValue] = useState<(string | number)[]>(["mx", "es"]);
|
|
1765
1834
|
|
|
1766
1835
|
const options = [
|
|
@@ -1777,33 +1846,33 @@ export const MultiSelectShowcase = () => {
|
|
|
1777
1846
|
return (
|
|
1778
1847
|
<ShowcaseLayout
|
|
1779
1848
|
title="ITMultiSelect"
|
|
1780
|
-
description="
|
|
1849
|
+
description={t("showcase.forms.multiSelectDesc")}
|
|
1781
1850
|
code={code}
|
|
1782
1851
|
demo={
|
|
1783
1852
|
<div className="w-full max-w-sm">
|
|
1784
1853
|
<ITMultiSelect
|
|
1785
|
-
label="
|
|
1854
|
+
label={t("showcase.forms.countries")}
|
|
1786
1855
|
options={options}
|
|
1787
1856
|
value={value}
|
|
1788
1857
|
onChange={(values) => setValue(values)}
|
|
1789
1858
|
maxVisibleChips={3}
|
|
1790
1859
|
/>
|
|
1791
1860
|
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
1792
|
-
{value.length
|
|
1861
|
+
{t("showcase.forms.selectedCount", { count: value.length, values: JSON.stringify(value) })}
|
|
1793
1862
|
</p>
|
|
1794
1863
|
</div>
|
|
1795
1864
|
}
|
|
1796
1865
|
controls={
|
|
1797
1866
|
<div className="space-y-2">
|
|
1798
1867
|
<p className="text-xs text-slate-500">
|
|
1799
|
-
|
|
1868
|
+
{t("showcase.forms.multiSelectHint")}
|
|
1800
1869
|
</p>
|
|
1801
1870
|
</div>
|
|
1802
1871
|
}
|
|
1803
1872
|
gallery={
|
|
1804
1873
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
|
1805
1874
|
<div className="w-full max-w-sm">
|
|
1806
|
-
<p className="mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-400">
|
|
1875
|
+
<p className="mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-400">{t("showcase.forms.optionTemplate")}</p>
|
|
1807
1876
|
<ITMultiSelect
|
|
1808
1877
|
label="Skills (template)"
|
|
1809
1878
|
options={options}
|
|
@@ -1815,9 +1884,9 @@ export const MultiSelectShowcase = () => {
|
|
|
1815
1884
|
/>
|
|
1816
1885
|
</div>
|
|
1817
1886
|
<div className="w-full max-w-sm">
|
|
1818
|
-
<p className="mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-400">
|
|
1887
|
+
<p className="mb-3 text-[10px] font-bold uppercase tracking-wider text-slate-400">{t("showcase.forms.withError")}</p>
|
|
1819
1888
|
<ITMultiSelect
|
|
1820
|
-
label="
|
|
1889
|
+
label={t("showcase.common.required")}
|
|
1821
1890
|
options={options}
|
|
1822
1891
|
value={[]}
|
|
1823
1892
|
onChange={() => {}}
|
|
@@ -1858,6 +1927,7 @@ export const MultiSelectShowcase = () => {
|
|
|
1858
1927
|
|
|
1859
1928
|
// 14. ITChipInput Showcase
|
|
1860
1929
|
export const ChipInputShowcase = () => {
|
|
1930
|
+
const { t } = useITTranslation();
|
|
1861
1931
|
const [tags, setTags] = useState<string[]>(["react", "typescript"]);
|
|
1862
1932
|
const [maxTags, setMaxTags] = useState(5);
|
|
1863
1933
|
|
|
@@ -1866,17 +1936,17 @@ export const ChipInputShowcase = () => {
|
|
|
1866
1936
|
return (
|
|
1867
1937
|
<ShowcaseLayout
|
|
1868
1938
|
title="ITChipInput"
|
|
1869
|
-
description="
|
|
1939
|
+
description={t("showcase.forms.chipInputDesc")}
|
|
1870
1940
|
code={code}
|
|
1871
1941
|
demo={
|
|
1872
1942
|
<div className="w-full max-w-sm">
|
|
1873
1943
|
<ITChipInput
|
|
1874
|
-
label="
|
|
1944
|
+
label={t("showcase.forms.tags")}
|
|
1875
1945
|
value={tags}
|
|
1876
1946
|
onChange={setTags}
|
|
1877
1947
|
maxTags={maxTags}
|
|
1878
|
-
placeholder="
|
|
1879
|
-
helpText="
|
|
1948
|
+
placeholder={t("showcase.forms.addTagPlaceholder")}
|
|
1949
|
+
helpText={t("showcase.forms.chipInputHelp")}
|
|
1880
1950
|
/>
|
|
1881
1951
|
<div className="mt-3 flex flex-wrap gap-1">
|
|
1882
1952
|
{tags.map((t) => (
|
|
@@ -1888,7 +1958,7 @@ export const ChipInputShowcase = () => {
|
|
|
1888
1958
|
controls={
|
|
1889
1959
|
<ITInput
|
|
1890
1960
|
name="maxTags"
|
|
1891
|
-
label="
|
|
1961
|
+
label={t("showcase.forms.maxTags")}
|
|
1892
1962
|
type="number"
|
|
1893
1963
|
value={maxTags}
|
|
1894
1964
|
onChange={(e: any) => setMaxTags(Number(e.target.value) || 0)}
|
|
@@ -1931,11 +2001,12 @@ const MaskedDemo = ({
|
|
|
1931
2001
|
hint?: string;
|
|
1932
2002
|
initial?: string;
|
|
1933
2003
|
}) => {
|
|
2004
|
+
const { t } = useITTranslation();
|
|
1934
2005
|
const [raw, setRaw] = useState<string>(initial ?? "");
|
|
1935
2006
|
const [complete, setComplete] = useState<string | null>(null);
|
|
1936
2007
|
return (
|
|
1937
2008
|
<div>
|
|
1938
|
-
<
|
|
2009
|
+
<h3 className="mb-2 w-fit border-l-2 border-primary-700 pl-2.5 font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-700 dark:border-primary-500 dark:text-slate-200">{title}</h3>
|
|
1939
2010
|
<ITMaskedInput
|
|
1940
2011
|
name={title.toLowerCase().replace(/\s+/g, "_")}
|
|
1941
2012
|
label={mask}
|
|
@@ -1949,8 +2020,8 @@ const MaskedDemo = ({
|
|
|
1949
2020
|
onComplete={(v) => setComplete(v)}
|
|
1950
2021
|
/>
|
|
1951
2022
|
<p className="mt-1.5 text-xs font-mono text-slate-500">
|
|
1952
|
-
|
|
1953
|
-
{complete && <span className="text-emerald-600 ml-2"
|
|
2023
|
+
{t("showcase.forms.rawLabel")} {raw || t("showcase.forms.emptyValue")}
|
|
2024
|
+
{complete && <span className="text-emerald-600 ml-2">{t("showcase.forms.completeValue")}</span>}
|
|
1954
2025
|
{hint && <span className="text-slate-400 ml-2">· {hint}</span>}
|
|
1955
2026
|
</p>
|
|
1956
2027
|
</div>
|
|
@@ -1958,6 +2029,7 @@ const MaskedDemo = ({
|
|
|
1958
2029
|
};
|
|
1959
2030
|
|
|
1960
2031
|
export const MaskedInputShowcase = () => {
|
|
2032
|
+
const { t } = useITTranslation();
|
|
1961
2033
|
const [code, setCode] = useState<string>("");
|
|
1962
2034
|
const [variant, setVariant] = useState<any>("primary");
|
|
1963
2035
|
const [size, setSize] = useState<any>("md");
|
|
@@ -1969,13 +2041,13 @@ export const MaskedInputShowcase = () => {
|
|
|
1969
2041
|
return (
|
|
1970
2042
|
<ShowcaseLayout
|
|
1971
2043
|
title="ITMaskedInput"
|
|
1972
|
-
description="
|
|
2044
|
+
description={t("showcase.forms.maskedInputDesc")}
|
|
1973
2045
|
code={codeExample}
|
|
1974
2046
|
demo={
|
|
1975
2047
|
<div className="w-full max-w-sm">
|
|
1976
2048
|
<ITMaskedInput
|
|
1977
2049
|
name="showcase_masked"
|
|
1978
|
-
label="
|
|
2050
|
+
label={t("showcase.forms.activationCode")}
|
|
1979
2051
|
mask="xxxx-xxxx-xxxx"
|
|
1980
2052
|
value={code}
|
|
1981
2053
|
variant={variant}
|
|
@@ -1986,7 +2058,7 @@ export const MaskedInputShowcase = () => {
|
|
|
1986
2058
|
/>
|
|
1987
2059
|
{code && (
|
|
1988
2060
|
<p className="mt-2 text-xs text-slate-500 font-mono">
|
|
1989
|
-
|
|
2061
|
+
{t("showcase.forms.currentRawValue")} {code || "—"}
|
|
1990
2062
|
</p>
|
|
1991
2063
|
)}
|
|
1992
2064
|
</div>
|
|
@@ -1995,7 +2067,7 @@ export const MaskedInputShowcase = () => {
|
|
|
1995
2067
|
<>
|
|
1996
2068
|
<ITSelect
|
|
1997
2069
|
name="masked_variant_ctrl"
|
|
1998
|
-
label="
|
|
2070
|
+
label={t("showcase.forms.colorTheme")}
|
|
1999
2071
|
value={variant}
|
|
2000
2072
|
onChange={(e: any) => setVariant(e.target.value)}
|
|
2001
2073
|
options={[
|
|
@@ -2009,7 +2081,7 @@ export const MaskedInputShowcase = () => {
|
|
|
2009
2081
|
/>
|
|
2010
2082
|
<ITSelect
|
|
2011
2083
|
name="masked_size_ctrl"
|
|
2012
|
-
label="
|
|
2084
|
+
label={t("showcase.common.size")}
|
|
2013
2085
|
value={size}
|
|
2014
2086
|
onChange={(e: any) => setSize(e.target.value)}
|
|
2015
2087
|
options={[
|
|
@@ -2019,45 +2091,49 @@ export const MaskedInputShowcase = () => {
|
|
|
2019
2091
|
]}
|
|
2020
2092
|
/>
|
|
2021
2093
|
<div className="flex items-center justify-between pt-2">
|
|
2022
|
-
<span className="text-
|
|
2023
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
2094
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
2095
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
2096
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
2097
|
+
/>
|
|
2024
2098
|
</div>
|
|
2025
2099
|
<div className="flex items-center justify-between">
|
|
2026
|
-
<span className="text-
|
|
2027
|
-
<ITSlideToggle isOn={withError} onToggle={setWithError} activeColor="danger" size="sm"
|
|
2100
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.error")}</span>
|
|
2101
|
+
<ITSlideToggle isOn={withError} onToggle={setWithError} activeColor="danger" size="sm"
|
|
2102
|
+
ariaLabel={t("showcase.common.error")}
|
|
2103
|
+
/>
|
|
2028
2104
|
</div>
|
|
2029
2105
|
</>
|
|
2030
2106
|
}
|
|
2031
2107
|
gallery={
|
|
2032
2108
|
<div className="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-6">
|
|
2033
2109
|
<MaskedDemo
|
|
2034
|
-
title="
|
|
2110
|
+
title={t("showcase.forms.maskAlphanumeric")}
|
|
2035
2111
|
mask="xxxx-xxxx-xxxx"
|
|
2036
2112
|
hint="Escribe: ABC1-2345"
|
|
2037
2113
|
/>
|
|
2038
2114
|
<MaskedDemo
|
|
2039
|
-
title="
|
|
2115
|
+
title={t("showcase.forms.maskCardNumber")}
|
|
2040
2116
|
mask="9999-9999-9999-9999"
|
|
2041
2117
|
hint="Escribe 16 dígitos"
|
|
2042
2118
|
/>
|
|
2043
2119
|
<MaskedDemo
|
|
2044
|
-
title="
|
|
2120
|
+
title={t("showcase.forms.maskPhone")}
|
|
2045
2121
|
mask="(999) 999-9999"
|
|
2046
2122
|
pattern={/^\d{10}$/}
|
|
2047
2123
|
hint="Regex /^\\d{10}$/"
|
|
2048
2124
|
/>
|
|
2049
2125
|
<MaskedDemo
|
|
2050
|
-
title="
|
|
2126
|
+
title={t("showcase.forms.maskPostalCode")}
|
|
2051
2127
|
mask="99999"
|
|
2052
2128
|
hint="Ejemplo: 44100"
|
|
2053
2129
|
/>
|
|
2054
2130
|
<MaskedDemo
|
|
2055
|
-
title="
|
|
2131
|
+
title={t("showcase.forms.maskCvv")}
|
|
2056
2132
|
mask="999"
|
|
2057
2133
|
hint="3 dígitos, onComplete"
|
|
2058
2134
|
/>
|
|
2059
2135
|
<MaskedDemo
|
|
2060
|
-
title="
|
|
2136
|
+
title={t("showcase.forms.maskUppercase")}
|
|
2061
2137
|
mask="A-A-A-999"
|
|
2062
2138
|
hint="Token A auto-mayúscula"
|
|
2063
2139
|
initial="ABC123"
|
|
@@ -2096,6 +2172,7 @@ export const MaskedInputShowcase = () => {
|
|
|
2096
2172
|
|
|
2097
2173
|
// 17. ITSegmentedControl Showcase
|
|
2098
2174
|
export const SegmentedControlShowcase = () => {
|
|
2175
|
+
const { t } = useITTranslation();
|
|
2099
2176
|
const [view, setView] = useState("day");
|
|
2100
2177
|
const [size, setSize] = useState<any>("md");
|
|
2101
2178
|
const [disabled, setDisabled] = useState(false);
|
|
@@ -2118,7 +2195,7 @@ export const SegmentedControlShowcase = () => {
|
|
|
2118
2195
|
return (
|
|
2119
2196
|
<ShowcaseLayout
|
|
2120
2197
|
title="ITSegmentedControl"
|
|
2121
|
-
description="
|
|
2198
|
+
description={t("showcase.forms.segmentedDesc")}
|
|
2122
2199
|
code={code}
|
|
2123
2200
|
demo={
|
|
2124
2201
|
<div className="flex flex-col items-center gap-3">
|
|
@@ -2129,14 +2206,14 @@ export const SegmentedControlShowcase = () => {
|
|
|
2129
2206
|
size={size}
|
|
2130
2207
|
disabled={disabled}
|
|
2131
2208
|
/>
|
|
2132
|
-
<span className="text-xs font-mono text-slate-500">
|
|
2209
|
+
<span className="text-xs font-mono text-slate-500">{t("showcase.forms.selectedValue", { value: view })}</span>
|
|
2133
2210
|
</div>
|
|
2134
2211
|
}
|
|
2135
2212
|
controls={
|
|
2136
2213
|
<>
|
|
2137
2214
|
<ITSelect
|
|
2138
2215
|
name="seg_size_ctrl"
|
|
2139
|
-
label="
|
|
2216
|
+
label={t("showcase.common.size")}
|
|
2140
2217
|
value={size}
|
|
2141
2218
|
onChange={(e: any) => setSize(e.target.value)}
|
|
2142
2219
|
options={[
|
|
@@ -2145,12 +2222,16 @@ export const SegmentedControlShowcase = () => {
|
|
|
2145
2222
|
]}
|
|
2146
2223
|
/>
|
|
2147
2224
|
<div className="flex items-center justify-between">
|
|
2148
|
-
<span className="text-
|
|
2149
|
-
<ITSlideToggle isOn={withIcons} onToggle={setWithIcons} size="sm"
|
|
2225
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.withIcons")}</span>
|
|
2226
|
+
<ITSlideToggle isOn={withIcons} onToggle={setWithIcons} size="sm"
|
|
2227
|
+
ariaLabel={t("showcase.forms.withIcons")}
|
|
2228
|
+
/>
|
|
2150
2229
|
</div>
|
|
2151
2230
|
<div className="flex items-center justify-between">
|
|
2152
|
-
<span className="text-
|
|
2153
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
2231
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
2232
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
2233
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
2234
|
+
/>
|
|
2154
2235
|
</div>
|
|
2155
2236
|
</>
|
|
2156
2237
|
}
|
|
@@ -2215,6 +2296,7 @@ export const SegmentedControlShowcase = () => {
|
|
|
2215
2296
|
|
|
2216
2297
|
// 18. ITInputNumber Showcase
|
|
2217
2298
|
export const InputNumberShowcase = () => {
|
|
2299
|
+
const { t } = useITTranslation();
|
|
2218
2300
|
const [amount, setAmount] = useState<number | null>(1234.5);
|
|
2219
2301
|
const [quantity, setQuantity] = useState<number | null>(3);
|
|
2220
2302
|
const [decimals, setDecimals] = useState<any>("2");
|
|
@@ -2230,13 +2312,13 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2230
2312
|
return (
|
|
2231
2313
|
<ShowcaseLayout
|
|
2232
2314
|
title="ITInputNumber"
|
|
2233
|
-
description="
|
|
2315
|
+
description={t("showcase.forms.inputNumberDesc")}
|
|
2234
2316
|
code={code}
|
|
2235
2317
|
demo={
|
|
2236
2318
|
<div className="w-full max-w-sm space-y-3">
|
|
2237
2319
|
<ITInputNumber
|
|
2238
2320
|
name="amount"
|
|
2239
|
-
label="
|
|
2321
|
+
label={t("showcase.forms.amount")}
|
|
2240
2322
|
placeholder="0.00"
|
|
2241
2323
|
prefix="$"
|
|
2242
2324
|
value={amount}
|
|
@@ -2245,15 +2327,15 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2245
2327
|
disabled={disabled}
|
|
2246
2328
|
required={required}
|
|
2247
2329
|
touched={showError}
|
|
2248
|
-
error={showError ? "
|
|
2330
|
+
error={showError ? t("showcase.forms.amountRequired") : undefined}
|
|
2249
2331
|
/>
|
|
2250
2332
|
<p className="text-xs font-mono text-slate-500">
|
|
2251
|
-
|
|
2333
|
+
{t("showcase.forms.valueLabel")} {amount === null ? "null" : `${amount} (${typeof amount})`}
|
|
2252
2334
|
</p>
|
|
2253
2335
|
<div className="grid grid-cols-2 gap-3">
|
|
2254
2336
|
<ITInputNumber
|
|
2255
2337
|
name="quantity"
|
|
2256
|
-
label="
|
|
2338
|
+
label={t("showcase.forms.quantityIntegers")}
|
|
2257
2339
|
value={quantity}
|
|
2258
2340
|
decimals={0}
|
|
2259
2341
|
min={1}
|
|
@@ -2262,7 +2344,7 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2262
2344
|
/>
|
|
2263
2345
|
<ITInputNumber
|
|
2264
2346
|
name="bounded"
|
|
2265
|
-
label="
|
|
2347
|
+
label={t("showcase.forms.between10And500")}
|
|
2266
2348
|
min={10}
|
|
2267
2349
|
max={500}
|
|
2268
2350
|
value={null}
|
|
@@ -2275,7 +2357,7 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2275
2357
|
<>
|
|
2276
2358
|
<ITSelect
|
|
2277
2359
|
name="in_decimals"
|
|
2278
|
-
label="
|
|
2360
|
+
label={t("showcase.forms.decimals")}
|
|
2279
2361
|
value={decimals}
|
|
2280
2362
|
onChange={(e: any) => setDecimals(e.target.value)}
|
|
2281
2363
|
options={[
|
|
@@ -2285,16 +2367,22 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2285
2367
|
]}
|
|
2286
2368
|
/>
|
|
2287
2369
|
<div className="flex items-center justify-between">
|
|
2288
|
-
<span className="text-
|
|
2289
|
-
<ITSlideToggle isOn={required} onToggle={setRequired} size="sm"
|
|
2370
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.required")}</span>
|
|
2371
|
+
<ITSlideToggle isOn={required} onToggle={setRequired} size="sm"
|
|
2372
|
+
ariaLabel={t("showcase.common.required")}
|
|
2373
|
+
/>
|
|
2290
2374
|
</div>
|
|
2291
2375
|
<div className="flex items-center justify-between">
|
|
2292
|
-
<span className="text-
|
|
2293
|
-
<ITSlideToggle isOn={showError} onToggle={setShowError} activeColor="danger" size="sm"
|
|
2376
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.forms.simulateError")}</span>
|
|
2377
|
+
<ITSlideToggle isOn={showError} onToggle={setShowError} activeColor="danger" size="sm"
|
|
2378
|
+
ariaLabel={t("showcase.forms.simulateError")}
|
|
2379
|
+
/>
|
|
2294
2380
|
</div>
|
|
2295
2381
|
<div className="flex items-center justify-between">
|
|
2296
|
-
<span className="text-
|
|
2297
|
-
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
2382
|
+
<span className="font-mono text-[11px] font-medium uppercase tracking-[0.14em] text-slate-500 dark:text-slate-400">{t("showcase.common.disabled")}</span>
|
|
2383
|
+
<ITSlideToggle isOn={disabled} onToggle={setDisabled} activeColor="danger" size="sm"
|
|
2384
|
+
ariaLabel={t("showcase.common.disabled")}
|
|
2385
|
+
/>
|
|
2298
2386
|
</div>
|
|
2299
2387
|
</>
|
|
2300
2388
|
}
|
|
@@ -2303,7 +2391,7 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2303
2391
|
<div className="w-full max-w-sm">
|
|
2304
2392
|
<ITInputNumber
|
|
2305
2393
|
name="g_amount"
|
|
2306
|
-
label="
|
|
2394
|
+
label={t("showcase.forms.prefixDollar")}
|
|
2307
2395
|
prefix="$"
|
|
2308
2396
|
value={98765.43}
|
|
2309
2397
|
readOnly
|
|
@@ -2313,7 +2401,7 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2313
2401
|
<div className="w-full max-w-sm">
|
|
2314
2402
|
<ITInputNumber
|
|
2315
2403
|
name="g_price"
|
|
2316
|
-
label="
|
|
2404
|
+
label={t("showcase.forms.unitPrice")}
|
|
2317
2405
|
prefix="$"
|
|
2318
2406
|
value={null}
|
|
2319
2407
|
onChange={() => {}}
|
|
@@ -2322,7 +2410,7 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2322
2410
|
<div className="w-full max-w-sm">
|
|
2323
2411
|
<ITInputNumber
|
|
2324
2412
|
name="g_qty"
|
|
2325
|
-
label="
|
|
2413
|
+
label={t("showcase.forms.quantityDecimals0")}
|
|
2326
2414
|
decimals={0}
|
|
2327
2415
|
value={12}
|
|
2328
2416
|
onChange={() => {}}
|
|
@@ -2331,7 +2419,7 @@ onChange={(value) => console.log(value + 1)} // ${amount === null ? "undefined"
|
|
|
2331
2419
|
<div className="w-full max-w-sm">
|
|
2332
2420
|
<ITInputNumber
|
|
2333
2421
|
name="g_disabled"
|
|
2334
|
-
label="
|
|
2422
|
+
label={t("showcase.common.disabled")}
|
|
2335
2423
|
prefix="$"
|
|
2336
2424
|
value={1500}
|
|
2337
2425
|
disabled
|