@mriqbox/ui-kit 4.4.0 → 4.6.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/molecules/MriDrawer.d.ts +15 -1
- package/dist/components/molecules/MriDrawer.stories.d.ts +3 -0
- package/dist/components/molecules/MriExpandableSearch.d.ts +28 -0
- package/dist/components/molecules/MriExpandableSearch.stories.d.ts +9 -0
- package/dist/components/molecules/MriSegmentedTabs.d.ts +56 -0
- package/dist/components/molecules/MriSegmentedTabs.stories.d.ts +9 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +1594 -1432
- package/dist/index.umd.js +31 -31
- 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>;
|
|
@@ -5,7 +5,21 @@ declare const MriDrawerTrigger: React.ForwardRefExoticComponent<DialogPrimitive.
|
|
|
5
5
|
declare const MriDrawerPortal: React.FC<DialogPrimitive.DialogPortalProps>;
|
|
6
6
|
declare const MriDrawerClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
|
|
7
7
|
declare const MriDrawerOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
|
|
8
|
+
export type MriDrawerSide = "top" | "bottom" | "left" | "right";
|
|
9
|
+
interface MriDrawerContentProps extends React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content> {
|
|
10
|
+
/**
|
|
11
|
+
* Lado da tela de onde o drawer desliza. Default: `bottom` (mobile-style
|
|
12
|
+
* action sheet). Use `right` pra painel lateral de detalhes/formulario,
|
|
13
|
+
* `left` pra menu hamburger, `top` pra notificacoes.
|
|
14
|
+
*/
|
|
15
|
+
side?: MriDrawerSide;
|
|
16
|
+
/**
|
|
17
|
+
* Esconde o handle (barra horizontal) no topo do drawer bottom. Sem efeito
|
|
18
|
+
* em outros lados. Default: false.
|
|
19
|
+
*/
|
|
20
|
+
hideHandle?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare const MriDrawerContent: React.ForwardRefExoticComponent<MriDrawerContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
9
23
|
declare const MriDrawerHeader: {
|
|
10
24
|
({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
11
25
|
displayName: string;
|
|
@@ -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>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { LucideIcon } from 'lucide-react';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
export interface MriSegmentedTabsItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string | React.ReactNode;
|
|
6
|
+
icon?: LucideIcon | React.ElementType;
|
|
7
|
+
/** Classe extra so neste item. */
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
export type MriSegmentedTabsType = 'single' | 'multiple';
|
|
11
|
+
export type MriSegmentedTabsVariant = 'default' | 'premium';
|
|
12
|
+
type SingleProps = {
|
|
13
|
+
type?: 'single';
|
|
14
|
+
value: string;
|
|
15
|
+
onChange: (id: string) => void;
|
|
16
|
+
};
|
|
17
|
+
type MultipleProps = {
|
|
18
|
+
type: 'multiple';
|
|
19
|
+
value: string[];
|
|
20
|
+
onChange: (ids: string[]) => void;
|
|
21
|
+
};
|
|
22
|
+
type CommonProps = {
|
|
23
|
+
items: MriSegmentedTabsItem[];
|
|
24
|
+
/** `default` = rounded-lg; `premium` = rounded-xl com cantos mais arredondados. */
|
|
25
|
+
variant?: MriSegmentedTabsVariant;
|
|
26
|
+
className?: string;
|
|
27
|
+
itemClassName?: string;
|
|
28
|
+
};
|
|
29
|
+
export type MriSegmentedTabsProps = CommonProps & (SingleProps | MultipleProps);
|
|
30
|
+
/**
|
|
31
|
+
* Segmented control — grupo de botoes lado-a-lado dentro de uma caixinha
|
|
32
|
+
* compartilhada. Diferente de `MriTabs` (que e underline pra navegacao de
|
|
33
|
+
* pagina), este e mais compacto e bom pra:
|
|
34
|
+
* - Filtros chip-style (`type="multiple"`)
|
|
35
|
+
* - Toggles de view (lista/grid, all/online/offline)
|
|
36
|
+
* - Sub-categorias densas
|
|
37
|
+
*
|
|
38
|
+
* ```tsx
|
|
39
|
+
* // Single (default) — picker de view
|
|
40
|
+
* <MriSegmentedTabs
|
|
41
|
+
* items={[{ id: 'all', label: 'All' }, { id: 'online', label: 'Online' }]}
|
|
42
|
+
* value={view}
|
|
43
|
+
* onChange={setView}
|
|
44
|
+
* />
|
|
45
|
+
*
|
|
46
|
+
* // Multiple — filtros chip
|
|
47
|
+
* <MriSegmentedTabs
|
|
48
|
+
* type="multiple"
|
|
49
|
+
* items={categories}
|
|
50
|
+
* value={selectedIds}
|
|
51
|
+
* onChange={setSelectedIds}
|
|
52
|
+
* />
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function MriSegmentedTabs(props: MriSegmentedTabsProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { MriSegmentedTabs } from './MriSegmentedTabs';
|
|
3
|
+
|
|
4
|
+
declare const meta: Meta<typeof MriSegmentedTabs>;
|
|
5
|
+
export default meta;
|
|
6
|
+
export declare const SingleSelect: StoryObj<typeof MriSegmentedTabs>;
|
|
7
|
+
export declare const SingleWithIcons: StoryObj<typeof MriSegmentedTabs>;
|
|
8
|
+
export declare const MultipleSelect: StoryObj<typeof MriSegmentedTabs>;
|
|
9
|
+
export declare const PremiumVariant_: StoryObj<typeof MriSegmentedTabs>;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,13 +11,16 @@ export * from './components/atoms/mri-button-variants';
|
|
|
11
11
|
export * from './components/atoms/MriSpinner';
|
|
12
12
|
export * from './components/atoms/MriSwitch';
|
|
13
13
|
export * from './components/atoms/MriTextarea';
|
|
14
|
+
export * from './components/atoms/MriIconToggleButton';
|
|
14
15
|
export * from './components/molecules/MriAccordion';
|
|
15
16
|
export * from './components/molecules/MriButtonGroup';
|
|
16
17
|
export * from './components/molecules/MriCard';
|
|
17
18
|
export * from './components/molecules/MriCompactSearch';
|
|
19
|
+
export * from './components/molecules/MriExpandableSearch';
|
|
18
20
|
export * from './components/molecules/MriDialog';
|
|
19
21
|
export * from './components/molecules/MriModal';
|
|
20
22
|
export * from './components/molecules/MriPopover';
|
|
23
|
+
export * from './components/molecules/MriSegmentedTabs';
|
|
21
24
|
export * from './components/molecules/MriSelect';
|
|
22
25
|
export * from './components/molecules/MriThemeToggle';
|
|
23
26
|
export * from './components/molecules/MriTabs';
|