@mriqbox/ui-kit 4.3.0 → 4.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/bin/cli.js +1 -1
- package/dist/components/atoms/MriIconToggleButton.d.ts +41 -0
- package/dist/components/atoms/MriIconToggleButton.stories.d.ts +10 -0
- package/dist/components/atoms/MriSwitch.d.ts +25 -0
- package/dist/components/atoms/MriSwitch.stories.d.ts +9 -0
- package/dist/components/atoms/MriTextarea.d.ts +25 -0
- package/dist/components/atoms/MriTextarea.stories.d.ts +10 -0
- package/dist/components/molecules/MriExpandableSearch.d.ts +28 -0
- package/dist/components/molecules/MriExpandableSearch.stories.d.ts +9 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +1562 -1366
- package/dist/index.umd.js +41 -41
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export type MriIconToggleButtonVariant = 'primary' | 'destructive';
|
|
4
|
+
export type MriIconToggleButtonSize = 'sm' | 'default';
|
|
5
|
+
export interface MriIconToggleButtonProps {
|
|
6
|
+
/** Estado on/off. */
|
|
7
|
+
active: boolean;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
/** Icone lucide (ou qualquer ElementType de svg). */
|
|
10
|
+
icon: ElementType;
|
|
11
|
+
/** Tooltip nativo via `title`. */
|
|
12
|
+
title?: string;
|
|
13
|
+
/** Cor do estado ativo. Default `primary`. `destructive` pra toggles "perigosos" (ex: muteCategory). */
|
|
14
|
+
variant?: MriIconToggleButtonVariant;
|
|
15
|
+
/** Tamanho. `sm` (28px) ou `default` (36px). */
|
|
16
|
+
size?: MriIconToggleButtonSize;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Botao toggle com icone — UI compacta pra ligar/desligar uma opcao.
|
|
22
|
+
* Diferente de `MriSwitch` (que e label+switch horizontal): este e um
|
|
23
|
+
* quadrado com icone que muda de cor quando ativo. Util em filtros, tabelas
|
|
24
|
+
* com colunas toggle, configuracoes densas.
|
|
25
|
+
*
|
|
26
|
+
* Estados:
|
|
27
|
+
* - active=true (variant=primary): fundo primary/15, icone primary
|
|
28
|
+
* - active=true (variant=destructive): fundo destructive/15, icone destructive
|
|
29
|
+
* - active=false: muted background no hover, icone esmaecido
|
|
30
|
+
* - disabled: opacidade 40%, sem hover
|
|
31
|
+
*
|
|
32
|
+
* ```tsx
|
|
33
|
+
* <MriIconToggleButton
|
|
34
|
+
* active={cat.enabled}
|
|
35
|
+
* onClick={() => toggle(cat.id)}
|
|
36
|
+
* icon={Database}
|
|
37
|
+
* title="Salvar no DB"
|
|
38
|
+
* />
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare const MriIconToggleButton: React.FC<MriIconToggleButtonProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MriIconToggleButton } from './MriIconToggleButton';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof MriIconToggleButton>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: StoryObj<typeof MriIconToggleButton>;
|
|
7
|
+
export declare const Variants: StoryObj<typeof MriIconToggleButton>;
|
|
8
|
+
export declare const Sizes: StoryObj<typeof MriIconToggleButton>;
|
|
9
|
+
export declare const Disabled: StoryObj<typeof MriIconToggleButton>;
|
|
10
|
+
export declare const InCategoryRow: StoryObj<typeof MriIconToggleButton>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface MriSwitchProps {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
onCheckedChange: (checked: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
/** Tamanho do switch — `sm` (w-7 h-4) ou `default` (w-9 h-5). */
|
|
7
|
+
size?: 'sm' | 'default';
|
|
8
|
+
/** Texto pra screen readers (recomendado quando o switch nao tem label visivel). */
|
|
9
|
+
'aria-label'?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Switch (toggle iOS-style). Wrapper sobre `<input type="checkbox">` com
|
|
15
|
+
* styling Tailwind via `peer`. Sem dep extra — funciona com a a11y nativa
|
|
16
|
+
* do checkbox HTML (screen readers anunciam estado via `aria-checked` que
|
|
17
|
+
* o navegador deriva do `checked`).
|
|
18
|
+
*
|
|
19
|
+
* Uso controlado:
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const [enabled, setEnabled] = useState(false)
|
|
22
|
+
* <MriSwitch checked={enabled} onCheckedChange={setEnabled} aria-label="Modo debug"/>
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const MriSwitch: React.ForwardRefExoticComponent<MriSwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MriSwitch } from './MriSwitch';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof MriSwitch>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: StoryObj<typeof MriSwitch>;
|
|
7
|
+
export declare const Small: StoryObj<typeof MriSwitch>;
|
|
8
|
+
export declare const Disabled: StoryObj<typeof MriSwitch>;
|
|
9
|
+
export declare const InForm: StoryObj<typeof MriSwitch>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface MriTextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
|
+
error?: boolean | string;
|
|
4
|
+
/** Hint visible abaixo do textarea (texto cinza, info contextual). */
|
|
5
|
+
hint?: string;
|
|
6
|
+
/**
|
|
7
|
+
* `auto` cresce com o conteudo (sem scrollbar interna). Default: `vertical`
|
|
8
|
+
* (user-resizable). `none` trava o tamanho.
|
|
9
|
+
*/
|
|
10
|
+
resize?: 'auto' | 'vertical' | 'none';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Textarea estilizado consistente com `MriInput`. Mesmo border/focus/disabled,
|
|
14
|
+
* apenas altura adaptavel. Pra single-line use `MriInput`.
|
|
15
|
+
*
|
|
16
|
+
* ```tsx
|
|
17
|
+
* <MriTextarea
|
|
18
|
+
* value={text}
|
|
19
|
+
* onChange={(e) => setText(e.target.value)}
|
|
20
|
+
* rows={4}
|
|
21
|
+
* placeholder="Descreva a acao..."
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const MriTextarea: React.ForwardRefExoticComponent<MriTextareaProps & React.RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MriTextarea } from './MriTextarea';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof MriTextarea>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: StoryObj<typeof MriTextarea>;
|
|
7
|
+
export declare const WithHint: StoryObj<typeof MriTextarea>;
|
|
8
|
+
export declare const WithError: StoryObj<typeof MriTextarea>;
|
|
9
|
+
export declare const AutoResize: StoryObj<typeof MriTextarea>;
|
|
10
|
+
export declare const NonResizable: StoryObj<typeof MriTextarea>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export interface MriExpandableSearchProps {
|
|
4
|
+
value: string;
|
|
5
|
+
onChange: (val: string) => void;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
/** Largura quando expandido. Default: `w-64` (256px). */
|
|
8
|
+
expandedWidth?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Search bar compacta — inicialmente colapsada como botao de icone (40x40),
|
|
13
|
+
* expande ao clicar e foca o input. Auto-colapsa no blur se o valor estiver
|
|
14
|
+
* vazio. ESC blura e colapsa.
|
|
15
|
+
*
|
|
16
|
+
* Util em headers de paginas admin onde a busca e secundaria — economiza
|
|
17
|
+
* espaco horizontal vs uma search bar sempre expandida.
|
|
18
|
+
*
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const [query, setQuery] = useState('')
|
|
21
|
+
* <MriExpandableSearch
|
|
22
|
+
* value={query}
|
|
23
|
+
* onChange={setQuery}
|
|
24
|
+
* placeholder="Buscar jogador..."
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const MriExpandableSearch: React.FC<MriExpandableSearchProps>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MriExpandableSearch } from './MriExpandableSearch';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof MriExpandableSearch>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const Default: StoryObj<typeof MriExpandableSearch>;
|
|
7
|
+
export declare const InsideHeader: StoryObj<typeof MriExpandableSearch>;
|
|
8
|
+
export declare const PreFilled_: StoryObj<typeof MriExpandableSearch>;
|
|
9
|
+
export declare const CustomExpandedWidth: StoryObj<typeof MriExpandableSearch>;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,14 @@ export * from './components/atoms/MriStatusBadge';
|
|
|
9
9
|
export * from './components/atoms/mri-badge-variants';
|
|
10
10
|
export * from './components/atoms/mri-button-variants';
|
|
11
11
|
export * from './components/atoms/MriSpinner';
|
|
12
|
+
export * from './components/atoms/MriSwitch';
|
|
13
|
+
export * from './components/atoms/MriTextarea';
|
|
14
|
+
export * from './components/atoms/MriIconToggleButton';
|
|
12
15
|
export * from './components/molecules/MriAccordion';
|
|
13
16
|
export * from './components/molecules/MriButtonGroup';
|
|
14
17
|
export * from './components/molecules/MriCard';
|
|
15
18
|
export * from './components/molecules/MriCompactSearch';
|
|
19
|
+
export * from './components/molecules/MriExpandableSearch';
|
|
16
20
|
export * from './components/molecules/MriDialog';
|
|
17
21
|
export * from './components/molecules/MriModal';
|
|
18
22
|
export * from './components/molecules/MriPopover';
|