@medway-ui/core 1.47.0 → 1.49.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/COMPONENTS.md +41 -13
- package/COMPONENTS_SUMMARY.md +5 -3
- package/dist/COMPONENTS.md +41 -13
- package/dist/COMPONENTS_SUMMARY.md +5 -3
- package/dist/components/Alert.d.ts +3 -3
- package/dist/components/Alert.js +1 -1
- package/dist/components/Alert.mjs +1 -1
- package/dist/components/AlertDialog.mjs +1 -1
- package/dist/components/Autocomplete.js +1 -1
- package/dist/components/Autocomplete.mjs +1 -1
- package/dist/components/CardLesson.mjs +1 -1
- package/dist/components/CardModule.mjs +1 -1
- package/dist/components/CardTopic.mjs +1 -1
- package/dist/components/CardWeek.mjs +1 -1
- package/dist/components/Collapsible.d.ts +1 -1
- package/dist/components/Collapsible.js +1 -1
- package/dist/components/Collapsible.mjs +1 -1
- package/dist/components/ConnectorNode.d.ts +104 -14
- package/dist/components/ConnectorNode.js +1 -1
- package/dist/components/ConnectorNode.mjs +1 -1
- package/dist/components/Popover.d.ts +2 -1
- package/dist/components/Popover.js +1 -1
- package/dist/components/Popover.mjs +1 -1
- package/dist/components/Ranking.mjs +1 -1
- package/dist/components/Sidebar.d.ts +27 -3
- package/dist/components/Sidebar.js +1 -1
- package/dist/components/Sidebar.mjs +1 -1
- package/dist/components/Tag.d.ts +2 -2
- package/dist/components/Tag.js +1 -1
- package/dist/components/Tag.mjs +1 -1
- package/dist/components/TagPicker.js +1 -1
- package/dist/components/TagPicker.mjs +1 -1
- package/dist/components/TrailStep.d.ts +4 -6
- package/dist/components/TrailStep.js +1 -1
- package/dist/components/TrailStep.mjs +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/lib/sidebar-search.d.ts +2 -0
- package/dist/lib/sidebar-search.js +3 -0
- package/dist/lib/sidebar-search.mjs +3 -0
- package/dist/lib/utils.d.ts +5 -0
- package/dist/lib/utils.js +1 -1
- package/dist/lib/utils.mjs +1 -1
- package/package.json +1 -1
package/COMPONENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @medway-ui/core — Component Reference
|
|
2
2
|
|
|
3
3
|
> **Auto-generated — do not edit manually.**
|
|
4
|
-
> Package `@medway-ui/core` · v1.
|
|
4
|
+
> Package `@medway-ui/core` · v1.49.0 · Generated 2026-11-19
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
|
@@ -57,6 +57,7 @@ import type { ButtonProps } from "@medway-ui/core";
|
|
|
57
57
|
- [Offcanvas](#offcanvas)
|
|
58
58
|
- [CardOption](#cardoption)
|
|
59
59
|
- [Pagination](#pagination)
|
|
60
|
+
- [Popover](#popover)
|
|
60
61
|
- [Progress](#progress)
|
|
61
62
|
- [ProgressCircle](#progresscircle)
|
|
62
63
|
- [RadioGroup](#radiogroup)
|
|
@@ -100,7 +101,7 @@ import type { ButtonProps } from "@medway-ui/core";
|
|
|
100
101
|
|
|
101
102
|
**`variant`** *(default: `"regular"`)*:
|
|
102
103
|
|
|
103
|
-
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"`
|
|
104
|
+
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"` \| `"new"`
|
|
104
105
|
|
|
105
106
|
### `alertButtonVariants` — CVA Variants
|
|
106
107
|
|
|
@@ -110,13 +111,13 @@ import type { ButtonProps } from "@medway-ui/core";
|
|
|
110
111
|
|
|
111
112
|
**`alertVariant`** *(default: `"regular"`)*:
|
|
112
113
|
|
|
113
|
-
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"`
|
|
114
|
+
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"` \| `"new"`
|
|
114
115
|
|
|
115
116
|
### `AlertProps`
|
|
116
117
|
|
|
117
118
|
| Prop | Type | Required |
|
|
118
119
|
|------|------|:--------:|
|
|
119
|
-
| `variant` | `"regular" \| "emphasis" \| "success" \| "warning" \| "error"` | |
|
|
120
|
+
| `variant` | `"regular" \| "emphasis" \| "success" \| "warning" \| "error" \| "new"` | |
|
|
120
121
|
| `onClose` | `() => void` | |
|
|
121
122
|
| `closeLabel` | `string` | |
|
|
122
123
|
|
|
@@ -1108,7 +1109,7 @@ type ConnectorPosition = `${ConnectorAnchor}-to-${ConnectorAnchor}`
|
|
|
1108
1109
|
|
|
1109
1110
|
**Sub-components:** `ConnectorNode`
|
|
1110
1111
|
|
|
1111
|
-
**Exported types:** `ConnectorNodeProps`, `ConnectorNodeStatus`
|
|
1112
|
+
**Exported types:** `ConnectorNodeCard`, `ConnectorNodeProps`, `ConnectorNodeStatus`
|
|
1112
1113
|
|
|
1113
1114
|
### `ringVariants` — CVA Variants
|
|
1114
1115
|
|
|
@@ -1140,10 +1141,22 @@ type ConnectorPosition = `${ConnectorAnchor}-to-${ConnectorAnchor}`
|
|
|
1140
1141
|
type ConnectorNodeStatus = "done" | "current" | "upcoming"
|
|
1141
1142
|
```
|
|
1142
1143
|
|
|
1144
|
+
### `ConnectorNodeCard` *(type)*
|
|
1145
|
+
|
|
1146
|
+
```typescript
|
|
1147
|
+
type ConnectorNodeCard = {
|
|
1148
|
+
badge?: string;
|
|
1149
|
+
title: string;
|
|
1150
|
+
description: ReactNode;
|
|
1151
|
+
}
|
|
1152
|
+
```
|
|
1153
|
+
|
|
1143
1154
|
### `ConnectorNodeProps` *(type)*
|
|
1144
1155
|
|
|
1145
1156
|
```typescript
|
|
1146
|
-
type ConnectorNodeProps =
|
|
1157
|
+
type ConnectorNodeProps = | ConnectorNodeButtonProps
|
|
1158
|
+
| ConnectorNodeCardProps
|
|
1159
|
+
| ConnectorNodeStaticProps
|
|
1147
1160
|
```
|
|
1148
1161
|
|
|
1149
1162
|
---
|
|
@@ -1797,6 +1810,14 @@ type CardOptionGroupProps = | CardOptionGroupSingleProps
|
|
|
1797
1810
|
|
|
1798
1811
|
---
|
|
1799
1812
|
|
|
1813
|
+
## Popover
|
|
1814
|
+
|
|
1815
|
+
**Sub-components:** `Popover`, `PopoverAnchor`, `PopoverContent`, `PopoverTrigger`
|
|
1816
|
+
|
|
1817
|
+
> **Radix UI base:** `Popover` — sub-components forward all Radix UI props.
|
|
1818
|
+
|
|
1819
|
+
---
|
|
1820
|
+
|
|
1800
1821
|
## Progress
|
|
1801
1822
|
|
|
1802
1823
|
**Sub-components:** `Progress`
|
|
@@ -2207,7 +2228,7 @@ type SelectSize = "md" | "lg"
|
|
|
2207
2228
|
|
|
2208
2229
|
**Sub-components:** `Sidebar`, `SidebarContent`, `SidebarFooter`, `SidebarGroup`, `SidebarGroupAction`, `SidebarGroupContent`, `SidebarGroupLabel`, `SidebarHeader`, `SidebarInput`, `SidebarInset`, `SidebarMenu`, `SidebarMenuAction`, `SidebarMenuBadge`, `SidebarMenuButton`, `SidebarMenuItem`, `SidebarMenuItemCollapse`, `SidebarMenuItemTitle`, `SidebarMenuSkeleton`, `SidebarMenuSub`, `SidebarMenuSubButton`, `SidebarMenuSubItem`, `SidebarProvider`, `SidebarRail`, `SidebarSeparator`, `SidebarTrigger`
|
|
2209
2230
|
|
|
2210
|
-
**Functions / variant helpers:** `useSidebar`
|
|
2231
|
+
**Functions / variant helpers:** `useSidebar`, `useSidebarSearch`
|
|
2211
2232
|
|
|
2212
2233
|
### `sidebarMenuButtonVariants` — CVA Variants
|
|
2213
2234
|
|
|
@@ -2457,7 +2478,7 @@ type TabsSize = "md" | "lg"
|
|
|
2457
2478
|
|
|
2458
2479
|
**`variant`** *(default: `"regular"`)*:
|
|
2459
2480
|
|
|
2460
|
-
`"regular"` \| `"regular-soft"` \| `"regular-basic"` \| `"emphasis"` \| `"emphasis-soft"` \| `"emphasis-basic"` \| `"gray"` \| `"gray-soft"` \| `"gray-basic"` \| `"success"` \| `"success-soft"` \| `"success-basic"` \| `"error"` \| `"error-soft"` \| `"error-basic"` \| `"warning"` \| `"warning-soft"` \| `"warning-basic"` \| `"cm"` \| `"cm-soft"` \| `"cm-basic"` \| `"go"` \| `"go-soft"` \| `"go-basic"` \| `"cir"` \| `"cir-soft"` \| `"cir-basic"` \| `"ped"` \| `"ped-soft"` \| `"ped-basic"` \| `"prev"` \| `"prev-soft"` \| `"prev-basic"` \| `"ia"` \| `"ia-soft"` \| `"ia-basic"`
|
|
2481
|
+
`"regular"` \| `"regular-soft"` \| `"regular-basic"` \| `"emphasis"` \| `"emphasis-soft"` \| `"emphasis-basic"` \| `"gray"` \| `"gray-soft"` \| `"gray-basic"` \| `"success"` \| `"success-soft"` \| `"success-basic"` \| `"error"` \| `"error-soft"` \| `"error-basic"` \| `"warning"` \| `"warning-soft"` \| `"warning-basic"` \| `"cm"` \| `"cm-soft"` \| `"cm-basic"` \| `"go"` \| `"go-soft"` \| `"go-basic"` \| `"cir"` \| `"cir-soft"` \| `"cir-basic"` \| `"ped"` \| `"ped-soft"` \| `"ped-basic"` \| `"prev"` \| `"prev-soft"` \| `"prev-basic"` \| `"ia"` \| `"ia-soft"` \| `"ia-basic"` \| `"new"` \| `"new-inverse"`
|
|
2461
2482
|
|
|
2462
2483
|
### `TagProps`
|
|
2463
2484
|
|
|
@@ -2835,7 +2856,7 @@ type ToastActionElement = ReactElement<typeof ToastAction>
|
|
|
2835
2856
|
|
|
2836
2857
|
**Sub-components:** `TrailStep`
|
|
2837
2858
|
|
|
2838
|
-
**Exported types:** `TrailStepItem`, `TrailStepPosition`, `TrailStepProps`, `TrailStepStatus`
|
|
2859
|
+
**Exported types:** `TrailStepCard`, `TrailStepItem`, `TrailStepPosition`, `TrailStepProps`, `TrailStepStatus`
|
|
2839
2860
|
|
|
2840
2861
|
### `TrailStepStatus` *(type)*
|
|
2841
2862
|
|
|
@@ -2843,6 +2864,12 @@ type ToastActionElement = ReactElement<typeof ToastAction>
|
|
|
2843
2864
|
type TrailStepStatus = ConnectorNodeStatus
|
|
2844
2865
|
```
|
|
2845
2866
|
|
|
2867
|
+
### `TrailStepCard` *(type)*
|
|
2868
|
+
|
|
2869
|
+
```typescript
|
|
2870
|
+
type TrailStepCard = ConnectorNodeCard
|
|
2871
|
+
```
|
|
2872
|
+
|
|
2846
2873
|
### `TrailStepPosition` *(type)*
|
|
2847
2874
|
|
|
2848
2875
|
```typescript
|
|
@@ -2859,6 +2886,7 @@ type TrailStepItem = {
|
|
|
2859
2886
|
status: TrailStepStatus;
|
|
2860
2887
|
position?: TrailStepPosition;
|
|
2861
2888
|
disabled?: boolean;
|
|
2889
|
+
card?: TrailStepCard | null;
|
|
2862
2890
|
}
|
|
2863
2891
|
```
|
|
2864
2892
|
|
|
@@ -2867,10 +2895,6 @@ type TrailStepItem = {
|
|
|
2867
2895
|
```typescript
|
|
2868
2896
|
type TrailStepProps = Omit<ComponentProps<"ol">, "children" | "onClick"> & {
|
|
2869
2897
|
steps: readonly TrailStepItem[];
|
|
2870
|
-
/**
|
|
2871
|
-
* Torna as etapas botões. Mantenha estável: alternar entre função e
|
|
2872
|
-
* `undefined` troca o elemento de cada etapa e remonta a trilha.
|
|
2873
|
-
*/
|
|
2874
2898
|
onStepClick?: (step: TrailStepItem, index: number) => void;
|
|
2875
2899
|
}
|
|
2876
2900
|
```
|
|
@@ -2969,6 +2993,10 @@ Returns `{ open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }`.
|
|
|
2969
2993
|
|
|
2970
2994
|
Exported from `Carousel`. See component docs above for context.
|
|
2971
2995
|
|
|
2996
|
+
### `useSidebarSearch()`
|
|
2997
|
+
|
|
2998
|
+
Exported from `Sidebar`. See component docs above for context.
|
|
2999
|
+
|
|
2972
3000
|
---
|
|
2973
3001
|
|
|
2974
3002
|
## Design Tokens
|
package/COMPONENTS_SUMMARY.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @medway-ui/core — Component Summary
|
|
2
2
|
|
|
3
|
-
> v1.
|
|
3
|
+
> v1.49.0 · For the full prop/variant reference see `COMPONENTS.md`.
|
|
4
4
|
|
|
5
5
|
## Components
|
|
6
6
|
|
|
7
|
-
- **Alert** — variants: regular, emphasis, success, warning, error, basic | alertVariant: regular, emphasis, success, warning, error | sub: AlertActions, AlertButton, AlertContainer, AlertContent, AlertDescription, AlertIcon, AlertTitle
|
|
7
|
+
- **Alert** — variants: regular, emphasis, success, warning, error, new, basic | alertVariant: regular, emphasis, success, warning, error, new | sub: AlertActions, AlertButton, AlertContainer, AlertContent, AlertDescription, AlertIcon, AlertTitle
|
|
8
8
|
- **AlertDialog** — variants: regular, emphasis, warning, error, success | Radix: AlertDialog | sub: AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogIcon, AlertDialogOverlay, AlertDialogPortal, AlertDialogTag, AlertDialogTitle, AlertDialogTrigger
|
|
9
9
|
- **Autocomplete** — sizes: lg, md | sub: AutocompleteContent, AutocompleteContentFooter, AutocompleteGroup, AutocompleteItem, AutocompleteText, AutocompleteTrigger, AutocompleteWrapper
|
|
10
10
|
- **Avatar** — sizes: sm, md, lg, xl | Radix: Avatar | sub: AvatarFallback, AvatarImage
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
- **Offcanvas** — Radix: Dialog | sub: OffcanvasBody, OffcanvasClose, OffcanvasContent, OffcanvasDescription, OffcanvasFooter, OffcanvasHeader, OffcanvasOverlay, OffcanvasPortal, OffcanvasTitle, OffcanvasTrigger
|
|
42
42
|
- **CardOption** — sizes: md, lg | emphasis: true, false | interactive: true, false | disabled: true, false | Radix: RadioGroup | sub: CardOptionGroup
|
|
43
43
|
- **Pagination** — sub: PaginationContent, PaginationEllipsis, PaginationInfo, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PaginationRoot
|
|
44
|
+
- **Popover** — Radix: Popover | sub: PopoverAnchor, PopoverContent, PopoverTrigger
|
|
44
45
|
- **Progress** — Radix: Progress
|
|
45
46
|
- **ProgressCircle**
|
|
46
47
|
- **RadioGroup** — variants: regular | sizes: sm, md, lg | Radix: RadioGroup | sub: RadioGroupItem
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
- **Switch** — variants: regular | sizes: sm, md, lg | Radix: Switch
|
|
58
59
|
- **Switcher** — sub: SwitcherContent, SwitcherFooter, SwitcherGroup, SwitcherItem, SwitcherSeparator, SwitcherTrigger
|
|
59
60
|
- **Tabs** — variants: standalone, header | sizes: md, lg | side: left, right | Radix: Tabs | sub: TabsContent, TabsList, TabsTrigger
|
|
60
|
-
- **Tag** — sizes: sm, md | variants: regular, regular-soft, regular-basic, emphasis, emphasis-soft, emphasis-basic, gray, gray-soft, gray-basic, success, success-soft, success-basic, error, error-soft, error-basic, warning, warning-soft, warning-basic, cm, cm-soft, cm-basic, go, go-soft, go-basic, cir, cir-soft, cir-basic, ped, ped-soft, ped-basic, prev, prev-soft, prev-basic, ia, ia-soft, ia-basic
|
|
61
|
+
- **Tag** — sizes: sm, md | variants: regular, regular-soft, regular-basic, emphasis, emphasis-soft, emphasis-basic, gray, gray-soft, gray-basic, success, success-soft, success-basic, error, error-soft, error-basic, warning, warning-soft, warning-basic, cm, cm-soft, cm-basic, go, go-soft, go-basic, cir, cir-soft, cir-basic, ped, ped-soft, ped-basic, prev, prev-soft, prev-basic, ia, ia-soft, ia-basic, new, new-inverse
|
|
61
62
|
- **TagPicker** — sub: TAG_PICKER_PALETTE
|
|
62
63
|
- **CardTestimonial**
|
|
63
64
|
- **TextMarker** — color: none | strikethrough: true, false | underline: true, false | Radix: Popover, Toolbar | sub: TEXT_MARKER_COLORS
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
- `useIsMobile()` — returns boolean, breakpoint 768px
|
|
75
76
|
- `useSidebar()` — sidebar context (requires `<SidebarProvider>`)
|
|
76
77
|
- `useCarousel()` — from Carousel
|
|
78
|
+
- `useSidebarSearch()` — from Sidebar
|
|
77
79
|
|
|
78
80
|
## Tokens
|
|
79
81
|
|
package/dist/COMPONENTS.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @medway-ui/core — Component Reference
|
|
2
2
|
|
|
3
3
|
> **Auto-generated — do not edit manually.**
|
|
4
|
-
> Package `@medway-ui/core` · v1.
|
|
4
|
+
> Package `@medway-ui/core` · v1.49.0 · Generated 2026-11-19
|
|
5
5
|
|
|
6
6
|
All components require React 18+ and are client components (`"use client"`).
|
|
7
7
|
|
|
@@ -57,6 +57,7 @@ import type { ButtonProps } from "@medway-ui/core";
|
|
|
57
57
|
- [Offcanvas](#offcanvas)
|
|
58
58
|
- [CardOption](#cardoption)
|
|
59
59
|
- [Pagination](#pagination)
|
|
60
|
+
- [Popover](#popover)
|
|
60
61
|
- [Progress](#progress)
|
|
61
62
|
- [ProgressCircle](#progresscircle)
|
|
62
63
|
- [RadioGroup](#radiogroup)
|
|
@@ -100,7 +101,7 @@ import type { ButtonProps } from "@medway-ui/core";
|
|
|
100
101
|
|
|
101
102
|
**`variant`** *(default: `"regular"`)*:
|
|
102
103
|
|
|
103
|
-
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"`
|
|
104
|
+
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"` \| `"new"`
|
|
104
105
|
|
|
105
106
|
### `alertButtonVariants` — CVA Variants
|
|
106
107
|
|
|
@@ -110,13 +111,13 @@ import type { ButtonProps } from "@medway-ui/core";
|
|
|
110
111
|
|
|
111
112
|
**`alertVariant`** *(default: `"regular"`)*:
|
|
112
113
|
|
|
113
|
-
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"`
|
|
114
|
+
`"regular"` \| `"emphasis"` \| `"success"` \| `"warning"` \| `"error"` \| `"new"`
|
|
114
115
|
|
|
115
116
|
### `AlertProps`
|
|
116
117
|
|
|
117
118
|
| Prop | Type | Required |
|
|
118
119
|
|------|------|:--------:|
|
|
119
|
-
| `variant` | `"regular" \| "emphasis" \| "success" \| "warning" \| "error"` | |
|
|
120
|
+
| `variant` | `"regular" \| "emphasis" \| "success" \| "warning" \| "error" \| "new"` | |
|
|
120
121
|
| `onClose` | `() => void` | |
|
|
121
122
|
| `closeLabel` | `string` | |
|
|
122
123
|
|
|
@@ -1108,7 +1109,7 @@ type ConnectorPosition = `${ConnectorAnchor}-to-${ConnectorAnchor}`
|
|
|
1108
1109
|
|
|
1109
1110
|
**Sub-components:** `ConnectorNode`
|
|
1110
1111
|
|
|
1111
|
-
**Exported types:** `ConnectorNodeProps`, `ConnectorNodeStatus`
|
|
1112
|
+
**Exported types:** `ConnectorNodeCard`, `ConnectorNodeProps`, `ConnectorNodeStatus`
|
|
1112
1113
|
|
|
1113
1114
|
### `ringVariants` — CVA Variants
|
|
1114
1115
|
|
|
@@ -1140,10 +1141,22 @@ type ConnectorPosition = `${ConnectorAnchor}-to-${ConnectorAnchor}`
|
|
|
1140
1141
|
type ConnectorNodeStatus = "done" | "current" | "upcoming"
|
|
1141
1142
|
```
|
|
1142
1143
|
|
|
1144
|
+
### `ConnectorNodeCard` *(type)*
|
|
1145
|
+
|
|
1146
|
+
```typescript
|
|
1147
|
+
type ConnectorNodeCard = {
|
|
1148
|
+
badge?: string;
|
|
1149
|
+
title: string;
|
|
1150
|
+
description: ReactNode;
|
|
1151
|
+
}
|
|
1152
|
+
```
|
|
1153
|
+
|
|
1143
1154
|
### `ConnectorNodeProps` *(type)*
|
|
1144
1155
|
|
|
1145
1156
|
```typescript
|
|
1146
|
-
type ConnectorNodeProps =
|
|
1157
|
+
type ConnectorNodeProps = | ConnectorNodeButtonProps
|
|
1158
|
+
| ConnectorNodeCardProps
|
|
1159
|
+
| ConnectorNodeStaticProps
|
|
1147
1160
|
```
|
|
1148
1161
|
|
|
1149
1162
|
---
|
|
@@ -1797,6 +1810,14 @@ type CardOptionGroupProps = | CardOptionGroupSingleProps
|
|
|
1797
1810
|
|
|
1798
1811
|
---
|
|
1799
1812
|
|
|
1813
|
+
## Popover
|
|
1814
|
+
|
|
1815
|
+
**Sub-components:** `Popover`, `PopoverAnchor`, `PopoverContent`, `PopoverTrigger`
|
|
1816
|
+
|
|
1817
|
+
> **Radix UI base:** `Popover` — sub-components forward all Radix UI props.
|
|
1818
|
+
|
|
1819
|
+
---
|
|
1820
|
+
|
|
1800
1821
|
## Progress
|
|
1801
1822
|
|
|
1802
1823
|
**Sub-components:** `Progress`
|
|
@@ -2207,7 +2228,7 @@ type SelectSize = "md" | "lg"
|
|
|
2207
2228
|
|
|
2208
2229
|
**Sub-components:** `Sidebar`, `SidebarContent`, `SidebarFooter`, `SidebarGroup`, `SidebarGroupAction`, `SidebarGroupContent`, `SidebarGroupLabel`, `SidebarHeader`, `SidebarInput`, `SidebarInset`, `SidebarMenu`, `SidebarMenuAction`, `SidebarMenuBadge`, `SidebarMenuButton`, `SidebarMenuItem`, `SidebarMenuItemCollapse`, `SidebarMenuItemTitle`, `SidebarMenuSkeleton`, `SidebarMenuSub`, `SidebarMenuSubButton`, `SidebarMenuSubItem`, `SidebarProvider`, `SidebarRail`, `SidebarSeparator`, `SidebarTrigger`
|
|
2209
2230
|
|
|
2210
|
-
**Functions / variant helpers:** `useSidebar`
|
|
2231
|
+
**Functions / variant helpers:** `useSidebar`, `useSidebarSearch`
|
|
2211
2232
|
|
|
2212
2233
|
### `sidebarMenuButtonVariants` — CVA Variants
|
|
2213
2234
|
|
|
@@ -2457,7 +2478,7 @@ type TabsSize = "md" | "lg"
|
|
|
2457
2478
|
|
|
2458
2479
|
**`variant`** *(default: `"regular"`)*:
|
|
2459
2480
|
|
|
2460
|
-
`"regular"` \| `"regular-soft"` \| `"regular-basic"` \| `"emphasis"` \| `"emphasis-soft"` \| `"emphasis-basic"` \| `"gray"` \| `"gray-soft"` \| `"gray-basic"` \| `"success"` \| `"success-soft"` \| `"success-basic"` \| `"error"` \| `"error-soft"` \| `"error-basic"` \| `"warning"` \| `"warning-soft"` \| `"warning-basic"` \| `"cm"` \| `"cm-soft"` \| `"cm-basic"` \| `"go"` \| `"go-soft"` \| `"go-basic"` \| `"cir"` \| `"cir-soft"` \| `"cir-basic"` \| `"ped"` \| `"ped-soft"` \| `"ped-basic"` \| `"prev"` \| `"prev-soft"` \| `"prev-basic"` \| `"ia"` \| `"ia-soft"` \| `"ia-basic"`
|
|
2481
|
+
`"regular"` \| `"regular-soft"` \| `"regular-basic"` \| `"emphasis"` \| `"emphasis-soft"` \| `"emphasis-basic"` \| `"gray"` \| `"gray-soft"` \| `"gray-basic"` \| `"success"` \| `"success-soft"` \| `"success-basic"` \| `"error"` \| `"error-soft"` \| `"error-basic"` \| `"warning"` \| `"warning-soft"` \| `"warning-basic"` \| `"cm"` \| `"cm-soft"` \| `"cm-basic"` \| `"go"` \| `"go-soft"` \| `"go-basic"` \| `"cir"` \| `"cir-soft"` \| `"cir-basic"` \| `"ped"` \| `"ped-soft"` \| `"ped-basic"` \| `"prev"` \| `"prev-soft"` \| `"prev-basic"` \| `"ia"` \| `"ia-soft"` \| `"ia-basic"` \| `"new"` \| `"new-inverse"`
|
|
2461
2482
|
|
|
2462
2483
|
### `TagProps`
|
|
2463
2484
|
|
|
@@ -2835,7 +2856,7 @@ type ToastActionElement = ReactElement<typeof ToastAction>
|
|
|
2835
2856
|
|
|
2836
2857
|
**Sub-components:** `TrailStep`
|
|
2837
2858
|
|
|
2838
|
-
**Exported types:** `TrailStepItem`, `TrailStepPosition`, `TrailStepProps`, `TrailStepStatus`
|
|
2859
|
+
**Exported types:** `TrailStepCard`, `TrailStepItem`, `TrailStepPosition`, `TrailStepProps`, `TrailStepStatus`
|
|
2839
2860
|
|
|
2840
2861
|
### `TrailStepStatus` *(type)*
|
|
2841
2862
|
|
|
@@ -2843,6 +2864,12 @@ type ToastActionElement = ReactElement<typeof ToastAction>
|
|
|
2843
2864
|
type TrailStepStatus = ConnectorNodeStatus
|
|
2844
2865
|
```
|
|
2845
2866
|
|
|
2867
|
+
### `TrailStepCard` *(type)*
|
|
2868
|
+
|
|
2869
|
+
```typescript
|
|
2870
|
+
type TrailStepCard = ConnectorNodeCard
|
|
2871
|
+
```
|
|
2872
|
+
|
|
2846
2873
|
### `TrailStepPosition` *(type)*
|
|
2847
2874
|
|
|
2848
2875
|
```typescript
|
|
@@ -2859,6 +2886,7 @@ type TrailStepItem = {
|
|
|
2859
2886
|
status: TrailStepStatus;
|
|
2860
2887
|
position?: TrailStepPosition;
|
|
2861
2888
|
disabled?: boolean;
|
|
2889
|
+
card?: TrailStepCard | null;
|
|
2862
2890
|
}
|
|
2863
2891
|
```
|
|
2864
2892
|
|
|
@@ -2867,10 +2895,6 @@ type TrailStepItem = {
|
|
|
2867
2895
|
```typescript
|
|
2868
2896
|
type TrailStepProps = Omit<ComponentProps<"ol">, "children" | "onClick"> & {
|
|
2869
2897
|
steps: readonly TrailStepItem[];
|
|
2870
|
-
/**
|
|
2871
|
-
* Torna as etapas botões. Mantenha estável: alternar entre função e
|
|
2872
|
-
* `undefined` troca o elemento de cada etapa e remonta a trilha.
|
|
2873
|
-
*/
|
|
2874
2898
|
onStepClick?: (step: TrailStepItem, index: number) => void;
|
|
2875
2899
|
}
|
|
2876
2900
|
```
|
|
@@ -2969,6 +2993,10 @@ Returns `{ open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar }`.
|
|
|
2969
2993
|
|
|
2970
2994
|
Exported from `Carousel`. See component docs above for context.
|
|
2971
2995
|
|
|
2996
|
+
### `useSidebarSearch()`
|
|
2997
|
+
|
|
2998
|
+
Exported from `Sidebar`. See component docs above for context.
|
|
2999
|
+
|
|
2972
3000
|
---
|
|
2973
3001
|
|
|
2974
3002
|
## Design Tokens
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @medway-ui/core — Component Summary
|
|
2
2
|
|
|
3
|
-
> v1.
|
|
3
|
+
> v1.49.0 · For the full prop/variant reference see `COMPONENTS.md`.
|
|
4
4
|
|
|
5
5
|
## Components
|
|
6
6
|
|
|
7
|
-
- **Alert** — variants: regular, emphasis, success, warning, error, basic | alertVariant: regular, emphasis, success, warning, error | sub: AlertActions, AlertButton, AlertContainer, AlertContent, AlertDescription, AlertIcon, AlertTitle
|
|
7
|
+
- **Alert** — variants: regular, emphasis, success, warning, error, new, basic | alertVariant: regular, emphasis, success, warning, error, new | sub: AlertActions, AlertButton, AlertContainer, AlertContent, AlertDescription, AlertIcon, AlertTitle
|
|
8
8
|
- **AlertDialog** — variants: regular, emphasis, warning, error, success | Radix: AlertDialog | sub: AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogIcon, AlertDialogOverlay, AlertDialogPortal, AlertDialogTag, AlertDialogTitle, AlertDialogTrigger
|
|
9
9
|
- **Autocomplete** — sizes: lg, md | sub: AutocompleteContent, AutocompleteContentFooter, AutocompleteGroup, AutocompleteItem, AutocompleteText, AutocompleteTrigger, AutocompleteWrapper
|
|
10
10
|
- **Avatar** — sizes: sm, md, lg, xl | Radix: Avatar | sub: AvatarFallback, AvatarImage
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
- **Offcanvas** — Radix: Dialog | sub: OffcanvasBody, OffcanvasClose, OffcanvasContent, OffcanvasDescription, OffcanvasFooter, OffcanvasHeader, OffcanvasOverlay, OffcanvasPortal, OffcanvasTitle, OffcanvasTrigger
|
|
42
42
|
- **CardOption** — sizes: md, lg | emphasis: true, false | interactive: true, false | disabled: true, false | Radix: RadioGroup | sub: CardOptionGroup
|
|
43
43
|
- **Pagination** — sub: PaginationContent, PaginationEllipsis, PaginationInfo, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, PaginationRoot
|
|
44
|
+
- **Popover** — Radix: Popover | sub: PopoverAnchor, PopoverContent, PopoverTrigger
|
|
44
45
|
- **Progress** — Radix: Progress
|
|
45
46
|
- **ProgressCircle**
|
|
46
47
|
- **RadioGroup** — variants: regular | sizes: sm, md, lg | Radix: RadioGroup | sub: RadioGroupItem
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
- **Switch** — variants: regular | sizes: sm, md, lg | Radix: Switch
|
|
58
59
|
- **Switcher** — sub: SwitcherContent, SwitcherFooter, SwitcherGroup, SwitcherItem, SwitcherSeparator, SwitcherTrigger
|
|
59
60
|
- **Tabs** — variants: standalone, header | sizes: md, lg | side: left, right | Radix: Tabs | sub: TabsContent, TabsList, TabsTrigger
|
|
60
|
-
- **Tag** — sizes: sm, md | variants: regular, regular-soft, regular-basic, emphasis, emphasis-soft, emphasis-basic, gray, gray-soft, gray-basic, success, success-soft, success-basic, error, error-soft, error-basic, warning, warning-soft, warning-basic, cm, cm-soft, cm-basic, go, go-soft, go-basic, cir, cir-soft, cir-basic, ped, ped-soft, ped-basic, prev, prev-soft, prev-basic, ia, ia-soft, ia-basic
|
|
61
|
+
- **Tag** — sizes: sm, md | variants: regular, regular-soft, regular-basic, emphasis, emphasis-soft, emphasis-basic, gray, gray-soft, gray-basic, success, success-soft, success-basic, error, error-soft, error-basic, warning, warning-soft, warning-basic, cm, cm-soft, cm-basic, go, go-soft, go-basic, cir, cir-soft, cir-basic, ped, ped-soft, ped-basic, prev, prev-soft, prev-basic, ia, ia-soft, ia-basic, new, new-inverse
|
|
61
62
|
- **TagPicker** — sub: TAG_PICKER_PALETTE
|
|
62
63
|
- **CardTestimonial**
|
|
63
64
|
- **TextMarker** — color: none | strikethrough: true, false | underline: true, false | Radix: Popover, Toolbar | sub: TEXT_MARKER_COLORS
|
|
@@ -74,6 +75,7 @@
|
|
|
74
75
|
- `useIsMobile()` — returns boolean, breakpoint 768px
|
|
75
76
|
- `useSidebar()` — sidebar context (requires `<SidebarProvider>`)
|
|
76
77
|
- `useCarousel()` — from Carousel
|
|
78
|
+
- `useSidebarSearch()` — from Sidebar
|
|
77
79
|
|
|
78
80
|
## Tokens
|
|
79
81
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactNode } from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
interface AlertProps extends ComponentProps<"div"> {
|
|
4
|
-
variant?: "regular" | "emphasis" | "success" | "warning" | "error";
|
|
4
|
+
variant?: "regular" | "emphasis" | "success" | "warning" | "error" | "new";
|
|
5
5
|
onClose?: () => void;
|
|
6
6
|
closeLabel?: string;
|
|
7
7
|
}
|
|
8
8
|
declare const alertVariants: (props?: ({
|
|
9
|
-
variant?: "regular" | "error" | "warning" | "emphasis" | "success" | null | undefined;
|
|
9
|
+
variant?: "regular" | "error" | "warning" | "emphasis" | "success" | "new" | null | undefined;
|
|
10
10
|
} & ({ class: import("clsx").ClassValue; className?: never } | { class?: never; className: import("clsx").ClassValue } | { class?: never; className?: never })) | undefined) => string;
|
|
11
11
|
declare function Alert({ className, variant, onClose, closeLabel, role, children, ...props }: AlertProps): import("react/jsx-runtime").JSX.Element;
|
|
12
12
|
declare function AlertContainer({ className, ...props }: ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
@@ -19,7 +19,7 @@ declare function AlertDescription({ className, ...props }: ComponentProps<"div">
|
|
|
19
19
|
declare function AlertActions({ className, ...props }: ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
20
20
|
declare const alertButtonVariants: (props?: ({
|
|
21
21
|
variant?: "regular" | "basic" | null | undefined;
|
|
22
|
-
alertVariant?: "regular" | "error" | "warning" | "emphasis" | "success" | null | undefined;
|
|
22
|
+
alertVariant?: "regular" | "error" | "warning" | "emphasis" | "success" | "new" | null | undefined;
|
|
23
23
|
} & ({ class: import("clsx").ClassValue; className?: never } | { class?: never; className: import("clsx").ClassValue } | { class?: never; className?: never })) | undefined) => string;
|
|
24
24
|
interface AlertButtonProps extends ComponentProps<"button">, VariantProps<typeof alertButtonVariants> {
|
|
25
25
|
}
|
package/dist/components/Alert.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var
|
|
3
|
+
"use strict";var s=require("react/jsx-runtime"),i=require("react"),h=require("class-variance-authority"),O=require("./Button.js"),V=require("./Dismiss.js"),o=require("../lib/utils.js"),A=Object.defineProperty,C=Object.defineProperties,q=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,y=(e,r,a)=>r in e?A(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,l=(e,r)=>{for(var a in r||(r={}))w.call(r,a)&&y(e,a,r[a]);if(f)for(var a of f(r))_.call(r,a)&&y(e,a,r[a]);return e},p=(e,r)=>C(e,q(r)),c=(e,r)=>{var a={};for(var t in e)w.call(e,t)&&r.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&f)for(var t of f(e))r.indexOf(t)<0&&_.call(e,t)&&(a[t]=e[t]);return a};const b={regular:{regular:"regular-soft",basic:"regular-basic"},emphasis:{regular:"emphasis-soft",basic:"emphasis-basic"},success:{regular:"success-soft",basic:"success-basic"},warning:{regular:"warning-soft",basic:"warning-basic"},error:{regular:"error-soft",basic:"error-basic"},new:{regular:"regular-soft",basic:"regular-basic"}},u=i.createContext(null),P={regular:"text-primary-foreground-emphasis",emphasis:"text-secondary-foreground-emphasis",success:"text-feedback-success-foreground-emphasis",warning:"text-feedback-warning-foreground-emphasis",error:"text-feedback-error-foreground-emphasis",new:"text-cm-foreground-onfill text-xs leading-xs font-medium"},D={new:"text-sm leading-sm"},z={new:"flex-1 items-center gap-2.5"},B={new:"text-cm-foreground-onfill hover:bg-white-16 hover:text-cm-foreground-onfill focus-visible:ring-cm-foreground-onfill"},E={new:{regular:"bg-white-16 text-cm-foreground-onfill hover:bg-white-24 hover:text-cm-foreground-onfill focus-visible:ring-cm-foreground-onfill",basic:"bg-transparent text-cm-foreground-onfill hover:bg-white-16 hover:text-cm-foreground-onfill focus-visible:ring-cm-foreground-onfill"}},k=h.cva("relative flex flex-col items-center justify-between gap-5 w-full rounded-md px-4 py-3 text-sm has-[>svg]:gap-x-9 gap-y-1 [&>svg]:translate-y-0 [&>svg]:text-current lg:flex-row",{variants:{variant:{regular:"[background:linear-gradient(0deg,_var(--color-primary-background-soft)_0%,_var(--color-primary-background-soft)_100%),_var(--color-surface-card)] text-primary-foreground [&>svg]:text-primary-foreground",emphasis:"[background:linear-gradient(0deg,_var(--color-secondary-background-soft)_0%,_var(--color-secondary-background-soft)_100%),_var(--color-surface-card)] text-secondary-foreground [&>svg]:text-secondary-foreground",success:"[background:linear-gradient(0deg,_var(--color-feedback-success-background-soft)_0%,_var(--color-feedback-success-background-soft)_100%),_var(--color-surface-card)] text-feedback-success-foreground [&>svg]:text-feedback-success-foreground",warning:"[background:linear-gradient(0deg,_var(--color-feedback-warning-background-soft)_0%,_var(--color-feedback-warning-background-soft)_100%),_var(--color-surface-card)] text-feedback-warning-foreground [&>svg]:text-feedback-warning-foreground",error:"[background:linear-gradient(0deg,_var(--color-feedback-error-background-soft)_0%,_var(--color-feedback-error-background-soft)_100%),_var(--color-surface-card)] text-feedback-error-foreground [&>svg]:text-feedback-error-foreground",new:"flex-row flex-wrap items-center gap-2.5 has-[>svg]:gap-x-2.5 rounded-lg [background:linear-gradient(170deg,var(--color-cm)_0%,var(--color-secondary-lighten-1)_100%)] shadow-[inset_4px_0_8px_0_var(--color-secondary-24),inset_-4px_0_8px_0_var(--color-prev-16),inset_0_0_8px_0_var(--color-cm-16)] text-cm-foreground-onfill [&>svg]:text-cm-foreground-onfill [&>[data-slot=tag]]:shrink-0"}},defaultVariants:{variant:"regular"}});function I(e){var r=e,{className:a,variant:t="regular",onClose:n,closeLabel:m="Fechar alerta",role:v="alert",children:x}=r,d=c(r,["className","variant","onClose","closeLabel","role","children"]);const g=i.useMemo(()=>({variant:t}),[t]);return s.jsx(u.Provider,{value:g,children:s.jsxs("div",p(l({"data-slot":"alert",role:v,className:o.cn(k({variant:t}),n&&"pe-12",n&&t!=="new"&&"gap-x-9",a)},d),{children:[x,n&&s.jsx(V.Dismiss,{label:m,onClick:n,className:o.cn("absolute right-2.5 top-2.5",B[t])})]}))})}function L(e){var r=e,{className:a}=r,t=c(r,["className"]);const n=i.useContext(u);return s.jsx("div",l({"data-slot":"alert-container",className:o.cn("flex min-w-0 gap-3",n&&z[n.variant],a)},t))}function M(e){var r=e,{className:a}=r,t=c(r,["className"]);return s.jsx("div",l({"data-slot":"alert-content",className:o.cn("flex min-w-0 flex-col gap-1",a)},t))}function $(e){var r=e,{className:a,icon:t}=r,n=c(r,["className","icon"]);return s.jsx("div",p(l({"data-slot":"alert-icon",className:o.cn("size-6 max-[500px]:hidden",a)},n),{children:t}))}function F(e){var r=e,{className:a}=r,t=c(r,["className"]);const n=i.useContext(u);return s.jsx("div",l({"data-slot":"alert-title",className:o.cn("line-clamp-1 min-h-4 text-md font-semibold",n&&D[n.variant],a)},t))}function T(e){var r=e,{className:a}=r,t=c(r,["className"]);const n=i.useContext(u);return s.jsx("div",l({"data-slot":"alert-description",className:o.cn("!line-clamp-3 grid justify-items-start gap-1 text-sm leading-sm",n&&P[n.variant],a)},t))}function W(e){var r=e,{className:a}=r,t=c(r,["className"]);return s.jsx("div",l({"data-slot":"alert-actions",className:o.cn("relative mt-2 flex max-w-full shrink-0 flex-wrap items-center gap-x-2 max-[500px]:w-full max-[500px]:flex-col max-[500px]:flex-nowrap max-[500px]:items-stretch max-[500px]:gap-y-2 lg:mt-0 lg:flex-nowrap",a)},t))}function G(e){return e.split(" ").filter(r=>!r.startsWith("disabled:")).join(" ")}const N=h.cva("text-center max-[500px]:w-full max-[500px]:whitespace-normal disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{regular:"",basic:""},alertVariant:{regular:"",emphasis:"",success:"",warning:"",error:"",new:""}},compoundVariants:Object.keys(b).flatMap(e=>Object.keys(b[e]).map(r=>{var a;return{variant:r,alertVariant:e,class:o.cn(G(O.buttonVariants({variant:b[e][r],size:"md"})),(a=E[e])==null?void 0:a[r])}})),defaultVariants:{variant:"regular",alertVariant:"regular"}});function H(e){const r=[];let a=[];const t=()=>{a.length&&(r.push(s.jsx("span",{className:"min-w-0 truncate max-[500px]:whitespace-normal",children:a},`text-${r.length}`)),a=[])};return i.Children.toArray(e).forEach(n=>{if(typeof n=="string"||typeof n=="number"){a.push(n);return}t(),r.push(n)}),t(),r}function J(e){var r=e,{className:a,variant:t,alertVariant:n,type:m="button",children:v}=r,x=c(r,["className","variant","alertVariant","type","children"]),d;const g=i.useContext(u),j=(d=n!=null?n:g==null?void 0:g.variant)!=null?d:"regular";return s.jsx("button",p(l({type:m,"data-slot":"alert-button",className:o.cn(N({variant:t,alertVariant:j}),a)},x),{children:H(v)}))}exports.Alert=I,exports.AlertActions=W,exports.AlertButton=J,exports.AlertContainer=L,exports.AlertContent=M,exports.AlertDescription=T,exports.AlertIcon=$,exports.AlertTitle=F,exports.alertButtonVariants=N,exports.alertVariants=k;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as n,jsxs as j}from"react/jsx-runtime";import{createContext as V,useMemo as A,useContext as
|
|
3
|
+
import{jsx as n,jsxs as j}from"react/jsx-runtime";import{createContext as V,useMemo as A,useContext as f,Children as C}from"react";import{cva as h}from"class-variance-authority";import{buttonVariants as P}from"./Button.mjs";import{Dismiss as I}from"./Dismiss.mjs";import{cn as s}from"../lib/utils.mjs";var $=Object.defineProperty,z=Object.defineProperties,D=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,w=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,k=(e,r,a)=>r in e?$(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,l=(e,r)=>{for(var a in r||(r={}))w.call(r,a)&&k(e,a,r[a]);if(g)for(var a of g(r))_.call(r,a)&&k(e,a,r[a]);return e},x=(e,r)=>z(e,D(r)),c=(e,r)=>{var a={};for(var t in e)w.call(e,t)&&r.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&g)for(var t of g(e))r.indexOf(t)<0&&_.call(e,t)&&(a[t]=e[t]);return a};const b={regular:{regular:"regular-soft",basic:"regular-basic"},emphasis:{regular:"emphasis-soft",basic:"emphasis-basic"},success:{regular:"success-soft",basic:"success-basic"},warning:{regular:"warning-soft",basic:"warning-basic"},error:{regular:"error-soft",basic:"error-basic"},new:{regular:"regular-soft",basic:"regular-basic"}},i=V(null),E={regular:"text-primary-foreground-emphasis",emphasis:"text-secondary-foreground-emphasis",success:"text-feedback-success-foreground-emphasis",warning:"text-feedback-warning-foreground-emphasis",error:"text-feedback-error-foreground-emphasis",new:"text-cm-foreground-onfill text-xs leading-xs font-medium"},L={new:"text-sm leading-sm"},M={new:"flex-1 items-center gap-2.5"},B={new:"text-cm-foreground-onfill hover:bg-white-16 hover:text-cm-foreground-onfill focus-visible:ring-cm-foreground-onfill"},F={new:{regular:"bg-white-16 text-cm-foreground-onfill hover:bg-white-24 hover:text-cm-foreground-onfill focus-visible:ring-cm-foreground-onfill",basic:"bg-transparent text-cm-foreground-onfill hover:bg-white-16 hover:text-cm-foreground-onfill focus-visible:ring-cm-foreground-onfill"}},y=h("relative flex flex-col items-center justify-between gap-5 w-full rounded-md px-4 py-3 text-sm has-[>svg]:gap-x-9 gap-y-1 [&>svg]:translate-y-0 [&>svg]:text-current lg:flex-row",{variants:{variant:{regular:"[background:linear-gradient(0deg,_var(--color-primary-background-soft)_0%,_var(--color-primary-background-soft)_100%),_var(--color-surface-card)] text-primary-foreground [&>svg]:text-primary-foreground",emphasis:"[background:linear-gradient(0deg,_var(--color-secondary-background-soft)_0%,_var(--color-secondary-background-soft)_100%),_var(--color-surface-card)] text-secondary-foreground [&>svg]:text-secondary-foreground",success:"[background:linear-gradient(0deg,_var(--color-feedback-success-background-soft)_0%,_var(--color-feedback-success-background-soft)_100%),_var(--color-surface-card)] text-feedback-success-foreground [&>svg]:text-feedback-success-foreground",warning:"[background:linear-gradient(0deg,_var(--color-feedback-warning-background-soft)_0%,_var(--color-feedback-warning-background-soft)_100%),_var(--color-surface-card)] text-feedback-warning-foreground [&>svg]:text-feedback-warning-foreground",error:"[background:linear-gradient(0deg,_var(--color-feedback-error-background-soft)_0%,_var(--color-feedback-error-background-soft)_100%),_var(--color-surface-card)] text-feedback-error-foreground [&>svg]:text-feedback-error-foreground",new:"flex-row flex-wrap items-center gap-2.5 has-[>svg]:gap-x-2.5 rounded-lg [background:linear-gradient(170deg,var(--color-cm)_0%,var(--color-secondary-lighten-1)_100%)] shadow-[inset_4px_0_8px_0_var(--color-secondary-24),inset_-4px_0_8px_0_var(--color-prev-16),inset_0_0_8px_0_var(--color-cm-16)] text-cm-foreground-onfill [&>svg]:text-cm-foreground-onfill [&>[data-slot=tag]]:shrink-0"}},defaultVariants:{variant:"regular"}});function T(e){var r=e,{className:a,variant:t="regular",onClose:o,closeLabel:m="Fechar alerta",role:v="alert",children:p}=r,u=c(r,["className","variant","onClose","closeLabel","role","children"]);const d=A(()=>({variant:t}),[t]);return n(i.Provider,{value:d,children:j("div",x(l({"data-slot":"alert",role:v,className:s(y({variant:t}),o&&"pe-12",o&&t!=="new"&&"gap-x-9",a)},u),{children:[p,o&&n(I,{label:m,onClick:o,className:s("absolute right-2.5 top-2.5",B[t])})]}))})}function W(e){var r=e,{className:a}=r,t=c(r,["className"]);const o=f(i);return n("div",l({"data-slot":"alert-container",className:s("flex min-w-0 gap-3",o&&M[o.variant],a)},t))}function q(e){var r=e,{className:a}=r,t=c(r,["className"]);return n("div",l({"data-slot":"alert-content",className:s("flex min-w-0 flex-col gap-1",a)},t))}function G(e){var r=e,{className:a,icon:t}=r,o=c(r,["className","icon"]);return n("div",x(l({"data-slot":"alert-icon",className:s("size-6 max-[500px]:hidden",a)},o),{children:t}))}function H(e){var r=e,{className:a}=r,t=c(r,["className"]);const o=f(i);return n("div",l({"data-slot":"alert-title",className:s("line-clamp-1 min-h-4 text-md font-semibold",o&&L[o.variant],a)},t))}function J(e){var r=e,{className:a}=r,t=c(r,["className"]);const o=f(i);return n("div",l({"data-slot":"alert-description",className:s("!line-clamp-3 grid justify-items-start gap-1 text-sm leading-sm",o&&E[o.variant],a)},t))}function K(e){var r=e,{className:a}=r,t=c(r,["className"]);return n("div",l({"data-slot":"alert-actions",className:s("relative mt-2 flex max-w-full shrink-0 flex-wrap items-center gap-x-2 max-[500px]:w-full max-[500px]:flex-col max-[500px]:flex-nowrap max-[500px]:items-stretch max-[500px]:gap-y-2 lg:mt-0 lg:flex-nowrap",a)},t))}function S(e){return e.split(" ").filter(r=>!r.startsWith("disabled:")).join(" ")}const N=h("text-center max-[500px]:w-full max-[500px]:whitespace-normal disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{regular:"",basic:""},alertVariant:{regular:"",emphasis:"",success:"",warning:"",error:"",new:""}},compoundVariants:Object.keys(b).flatMap(e=>Object.keys(b[e]).map(r=>{var a;return{variant:r,alertVariant:e,class:s(S(P({variant:b[e][r],size:"md"})),(a=F[e])==null?void 0:a[r])}})),defaultVariants:{variant:"regular",alertVariant:"regular"}});function Q(e){const r=[];let a=[];const t=()=>{a.length&&(r.push(n("span",{className:"min-w-0 truncate max-[500px]:whitespace-normal",children:a},`text-${r.length}`)),a=[])};return C.toArray(e).forEach(o=>{if(typeof o=="string"||typeof o=="number"){a.push(o);return}t(),r.push(o)}),t(),r}function R(e){var r=e,{className:a,variant:t,alertVariant:o,type:m="button",children:v}=r,p=c(r,["className","variant","alertVariant","type","children"]),u;const d=f(i),O=(u=o!=null?o:d==null?void 0:d.variant)!=null?u:"regular";return n("button",x(l({type:m,"data-slot":"alert-button",className:s(N({variant:t,alertVariant:O}),a)},p),{children:Q(v)}))}export{T as Alert,K as AlertActions,R as AlertButton,W as AlertContainer,q as AlertContent,J as AlertDescription,G as AlertIcon,H as AlertTitle,N as alertButtonVariants,y as alertVariants};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
import{jsx as o,jsxs as y}from"react/jsx-runtime";import{createContext as w,forwardRef as _,useContext as p,useMemo as D,useState as L,useCallback as B,useLayoutEffect as E}from"react";import{cva as A}from"class-variance-authority";import{AlertDialog as c}from"radix-ui";import{cn as u}from"../lib/utils.mjs";import{buttonVariants as C}from"./Button.mjs";import{Dismiss as V,DISMISS_PANEL_POSITION as $}from"./Dismiss.mjs";import{Tag as R}from"./Tag.mjs";var F=Object.defineProperty,M=Object.defineProperties,q=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,
|
|
3
|
+
import{jsx as o,jsxs as y}from"react/jsx-runtime";import{createContext as w,forwardRef as _,useContext as p,useMemo as D,useState as L,useCallback as B,useLayoutEffect as E}from"react";import{cva as A}from"class-variance-authority";import{AlertDialog as c}from"radix-ui";import{cn as u}from"../lib/utils.mjs";import{buttonVariants as C}from"./Button.mjs";import{Dismiss as V,DISMISS_PANEL_POSITION as $}from"./Dismiss.mjs";import{Tag as R}from"./Tag.mjs";var F=Object.defineProperty,M=Object.defineProperties,q=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable,j=(e,a,t)=>a in e?F(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,n=(e,a)=>{for(var t in a||(a={}))O.call(a,t)&&j(e,t,a[t]);if(x)for(var t of x(a))P.call(a,t)&&j(e,t,a[t]);return e},z=(e,a)=>M(e,q(a)),i=(e,a)=>{var t={};for(var r in e)O.call(e,r)&&a.indexOf(r)<0&&(t[r]=e[r]);if(e!=null&&x)for(var r of x(e))a.indexOf(r)<0&&P.call(e,r)&&(t[r]=e[r]);return t};const v="regular",k=w(null),N=w(null),G=A("flex w-full items-center justify-center px-8 py-8",{variants:{variant:{regular:"[background-image:radial-gradient(50%_100%_at_50%_0%,var(--color-primary-background-soft)_0%,transparent_100%)]",emphasis:"[background-image:radial-gradient(50%_100%_at_50%_0%,var(--color-secondary-background-soft)_0%,transparent_100%)]",warning:"[background-image:radial-gradient(50%_100%_at_50%_0%,var(--color-feedback-warning-background-soft)_0%,transparent_100%)]",error:"[background-image:radial-gradient(50%_100%_at_50%_0%,var(--color-feedback-error-background-soft)_0%,transparent_100%)]",success:"[background-image:radial-gradient(50%_100%_at_50%_0%,var(--color-feedback-success-background-soft)_0%,transparent_100%)]"}},defaultVariants:{variant:v}}),H=A("flex items-center justify-center rounded-full p-4 [&_svg]:size-8",{variants:{variant:{regular:"bg-primary-background-fill text-primary-foreground-onfill",emphasis:"bg-secondary-background-fill text-secondary-foreground-onfill",warning:"bg-feedback-warning-background-fill text-feedback-warning-foreground-onfill",error:"bg-feedback-error-background-fill text-feedback-error-foreground-onfill",success:"bg-feedback-success-background-fill text-feedback-success-foreground-onfill"}},defaultVariants:{variant:v}}),J={regular:"regular-soft",emphasis:"emphasis-soft",warning:"warning-soft",error:"error-soft",success:"success-soft"},K={regular:"regular",emphasis:"emphasis",warning:"warning",error:"error",success:"success"};function Q(e){var a=e,{variant:t=v}=a,r=i(a,["variant"]);const l=D(()=>({variant:t}),[t]);return o(N.Provider,{value:l,children:o(c.Root,n({"data-slot":"alert-dialog"},r))})}const U=_(function(e,a){return o(c.Trigger,n({ref:a,"data-slot":"alert-dialog-trigger"},e))});function I(e){var a=i(e,[]);return o(c.Portal,n({"data-slot":"alert-dialog-portal"},a))}function S(e){var a=e,{className:t}=a,r=i(a,["className"]);return o(c.Overlay,n({"data-slot":"alert-dialog-overlay",className:u("fixed inset-0 z-50 bg-backdrop data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 motion-reduce:!animate-none",t)},r))}function X(e){var a=e,{className:t,overlayClassName:r,showCloseButton:l=!1,closeLabel:s="Fechar",children:f}=a,g=i(a,["className","overlayClassName","showCloseButton","closeLabel","children"]);const[d,m]=L(0),b=B(()=>(m(h=>h+1),()=>m(h=>h-1)),[]),T=D(()=>({hasCloseButton:l,hasIcon:d>0,registerIcon:b}),[l,d,b]);return y(I,{children:[o(S,{className:r}),y(c.Content,z(n({"data-slot":"alert-dialog-content",className:u("fixed left-1/2 top-1/2 z-50 flex w-[calc(100%-2rem)] max-w-[400px] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-lg bg-surface-elevated shadow-level-5 duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-1/2 data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-1/2 motion-reduce:!animate-none",t)},g),{children:[o(k.Provider,{value:T,children:f}),l&&o(c.Cancel,{"data-slot":"alert-dialog-close",asChild:!0,children:o(V,{label:s,className:$})})]}))]})}function Y(e){var a=e,{className:t}=a,r=i(a,["className"]);const l=p(k),s=(l==null?void 0:l.hasCloseButton)&&!l.hasIcon;return o("div",n({"data-slot":"alert-dialog-header",className:u("flex flex-col items-center gap-3 px-8 pt-8 text-center",s&&"px-14","[[data-slot=alert-dialog-content]:has([data-slot=alert-dialog-icon])_&]:pt-0","[&>[data-slot=alert-dialog-title]+[data-slot=alert-dialog-description]]:-mt-1.5",t)},r))}function Z(e){var a=e,{className:t,icon:r}=a,l=i(a,["className","icon"]),s,f;const g=p(N),d=(s=p(k))==null?void 0:s.registerIcon;E(()=>d==null?void 0:d(),[d]);const m=(f=g==null?void 0:g.variant)!=null?f:v;return o("div",z(n({"data-slot":"alert-dialog-icon",className:u(G({variant:m}),t)},l),{children:o("div",{className:H({variant:m}),children:r})}))}function W({className:e,variant:a,children:t}){var r;const l=p(N),s=(r=a!=null?a:l==null?void 0:l.variant)!=null?r:v;return o("div",{"data-slot":"alert-dialog-tag",className:"flex justify-center",children:o(R,{variant:J[s],className:e,children:t})})}function aa(e){var a=e,{className:t}=a,r=i(a,["className"]);return o(c.Title,n({"data-slot":"alert-dialog-title",className:u("text-title-sm font-semibold leading-title-sm text-content-title",t)},r))}function ea(e){var a=e,{className:t}=a,r=i(a,["className"]);return o(c.Description,n({"data-slot":"alert-dialog-description",className:u("text-md leading-md text-content-paragraph",t)},r))}function ta(e){var a=e,{className:t}=a,r=i(a,["className"]);return o("div",n({"data-slot":"alert-dialog-footer",className:u("flex flex-row items-center justify-center gap-4 px-8 pb-8 pt-6 max-[500px]:flex-col max-[500px]:items-stretch",t)},r))}const ra=_(function(e,a){var t=e,{className:r,variant:l,size:s="lg",full:f}=t,g=i(t,["className","variant","size","full"]),d;const m=p(N),b=l!=null?l:K[(d=m==null?void 0:m.variant)!=null?d:v];return o(c.Action,n({ref:a,className:u(C({variant:b,size:s,full:f}),"max-[500px]:w-full",r)},g))}),la=_(function(e,a){var t=e,{className:r,variant:l="regular-soft",size:s="lg",full:f}=t,g=i(t,["className","variant","size","full"]);return o(c.Cancel,n({ref:a,className:u(C({variant:l,size:s,full:f}),"max-[500px]:w-full",r)},g))});export{Q as AlertDialog,ra as AlertDialogAction,la as AlertDialogCancel,X as AlertDialogContent,ea as AlertDialogDescription,ta as AlertDialogFooter,Y as AlertDialogHeader,Z as AlertDialogIcon,S as AlertDialogOverlay,I as AlertDialogPortal,W as AlertDialogTag,aa as AlertDialogTitle,U as AlertDialogTrigger};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
"use strict";var s=require("react/jsx-runtime"),A=require("@medway-ui/icons"),o=require("react"),H=require("class-variance-authority"),B=require("../hooks/use-id.js"),K=require("../lib/floating-label.js"),p=require("../lib/utils.js"),h=require("./Command.js"),P=require("./Popover.js"),W=require("./Button.js"),Q=Object.defineProperty,U=Object.defineProperties,X=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,R=(e,r,a)=>r in e?Q(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,k=(e,r)=>{for(var a in r||(r={}))T.call(r,a)&&R(e,a,r[a]);if(y)for(var a of y(r))_.call(r,a)&&R(e,a,r[a]);return e},Z=(e,r)=>U(e,X(r)),C=(e,r)=>{var a={};for(var t in e)T.call(e,t)&&r.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&y)for(var t of y(e))r.indexOf(t)<0&&_.call(e,t)&&(a[t]=e[t]);return a};const J={md:20,lg:24},Y={lg:{item:"gap-2.5 px-3.5 py-2.5 text-sm leading-sm",box:"size-5",check:16},md:{item:"gap-2 px-3 py-2 text-xs leading-xs",box:"size-4",check:12}},ee=H.cva("flex w-full items-center justify-between rounded-md border-2 border-gray-stroke-muted bg-surface-card text-left text-gray-foreground outline-none transition-[color,box-shadow] hover:border-gray-stroke hover:ring-4 hover:ring-state-hover focus-visible:border-gray-stroke-emphasis focus-visible:ring-4 focus-visible:ring-state-focus disabled:cursor-default disabled:bg-gray-background-soft-muted disabled:hover:border-gray-stroke-muted disabled:hover:ring-0 aria-[invalid=true]:border-feedback-error-stroke aria-[invalid=true]:hover:ring-state-error aria-[invalid=true]:focus-visible:border-feedback-error-stroke aria-[invalid=true]:focus-visible:ring-state-error [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{size:{lg:"h-12 max-h-12 gap-3 px-3.5 py-2.5 text-md",md:"h-10 max-h-10 gap-2.5 px-3 py-2 text-sm leading-sm"}},defaultVariants:{size:"lg"}}),b=o.createContext({invalid:!1,disabled:!1,size:"lg",open:!1,setOpen:()=>{},values:[],toggleValue:()=>{},onCancelSelection:()=>{},listId:""});function re({children:e,invalid:r=!1,disabled:a=!1,size:t="lg",values:l,onValuesChange:n,open:c,onOpenChange:d,defaultValues:i=[]}){const[g,x]=o.useState(i),[j,N]=o.useState(!1),u=l!==void 0,O=c!==void 0,m=u?l:g,f=O?c:j,[w,F]=o.useState(m),[G,M]=o.useState(f);f!==G&&(M(f),f&&F(m));const q=o.useCallback(v=>{const L=m.includes(v)?m.filter($=>$!==v):[...m,v];u||x(L),n==null||n(L)},[m,u,n]),z=o.useCallback(v=>{a||(O||N(v),d==null||d(v))},[a,O,d]),V=o.useCallback(()=>{u||x(w),n==null||n(w)},[u,w,n]),E=B.useId(),D=o.useMemo(()=>({invalid:r,disabled:a,size:t,open:f,setOpen:z,values:m,toggleValue:q,onCancelSelection:V,listId:E}),[r,a,t,f,z,m,q,V,E]);return s.jsx(b.Provider,{value:D,children:s.jsx(P.Popover,{open:f,onOpenChange:z,children:e})})}function ae(e){var r=e,{className:a}=r,t=C(r,["className"]);return s.jsx("div",k({className:p.cn(K.FLOATING_LABEL_WRAPPER,a),"data-slot":"autocomplete-wrapper"},t))}function te(e){var r=e,{className:a,placeholder:t="Selecione uma op\xE7\xE3o",children:l}=r,n=C(r,["className","placeholder","children"]);const{invalid:c,disabled:d,size:i,open:g,values:x,listId:j}=o.useContext(b),N=B.useId(),u=x.length>0;return s.jsx(P.PopoverTrigger,{asChild:!0,children:s.jsxs("button",Z(k({"aria-controls":j,"aria-expanded":g,"aria-invalid":c||void 0,className:p.cn(ee({size:i}),u&&!c&&"border-gray-stroke-emphasis hover:border-gray-stroke-emphasis",a),"data-slot":"autocomplete-trigger","data-size":i,"data-placeholder":u?void 0:"",disabled:d,id:N,role:"combobox",type:"button"},n),{children:[s.jsx("span",{className:p.cn("min-w-0 truncate",l!=null?"text-gray-foreground-emphasis":d?"text-gray-foreground-muted":"text-gray-foreground-placeholder"),children:l!=null?l:t}),s.jsx(A.ChevronDown,{"aria-hidden":"true",className:"shrink-0 text-gray-foreground",size:J[i],strokeWidth:1.6})]}))})}function I({className:e,cancelLabel:r="Cancelar",confirmLabel:a="Concluir",onCancel:t,onConfirm:l}){const{setOpen:n,onCancelSelection:c,values:d}=o.useContext(b);return s.jsxs("div",{className:p.cn("flex items-center justify-between border-t border-gray-stroke-muted px-4 py-3",e),"data-slot":"autocomplete-content-footer",children:[s.jsx(W.Button,{size:"sm",variant:"regular-soft",onClick:()=>{c(),t==null||t(),n(!1)},children:r}),s.jsx(W.Button,{size:"sm",variant:"emphasis",iconLeft:s.jsx(A.Check,{strokeWidth:2.6}),onClick:()=>{l==null||l(d),n(!1)},children:a})]})}function S(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(S).join(""):o.isValidElement(e)?S(e.props.children):""}function se({children:e,className:r,searchPlaceholder:a="Buscar...",emptyMessage:t="Nenhum resultado encontrado"}){const{listId:l}=o.useContext(b),n=o.Children.toArray(e),c=n.filter(i=>o.isValidElement(i)&&i.type===I),d=n.filter(i=>!(o.isValidElement(i)&&i.type===I));return s.jsxs(P.PopoverContent,{id:l,align:"start",className:p.cn("w-full min-w-[var(--radix-popper-anchor-width)] bg-surface-elevated p-0",r),children:[s.jsxs(h.Command,{className:"bg-surface-elevated",children:[s.jsx(h.CommandInput,{placeholder:a}),s.jsxs(h.CommandList,{children:[s.jsx(h.CommandEmpty,{children:t}),d]})]}),c]})}function oe({children:e,value:r,name:a,className:t,disabled:l=!1}){const{values:n,toggleValue:c,size:d}=o.useContext(b),i=Y[d],g=n.includes(r);return s.jsxs(h.CommandItem,{className:p.cn("relative flex w-full cursor-default select-none items-center rounded-md font-medium text-gray-foreground outline-none hover:cursor-pointer hover:bg-primary-background-soft-muted hover:text-gray-foreground-emphasis data-[selected=true]:bg-primary-background-soft-muted data-[selected=true]:text-gray-foreground-emphasis",i.item,t),disabled:l,"aria-checked":g,onSelect:()=>{c(r)},value:r,keywords:[a!=null?a:S(e)].filter(Boolean),children:[s.jsx("span",{"aria-hidden":"true",className:p.cn("inline-flex shrink-0 items-center justify-center rounded-sm border-2 transition-colors",i.box,g?"border-primary-background-fill bg-primary-background-fill":"border-gray-stroke-muted bg-surface-card"),children:g&&s.jsx(A.Check,{size:i.check,strokeWidth:2.6,className:"text-primary-foreground-onfill"})}),e]})}function ne(e){var r=e,{className:a}=r,t=C(r,["className"]);return s.jsx(h.CommandGroup,k({className:a},t))}function le(e){var r=e,{className:a}=r,t=C(r,["className"]);const{invalid:l}=o.useContext(b);return s.jsx("span",k({className:p.cn("-mt-1 text-xs",l?"text-feedback-error-foreground":"text-gray-foreground",a),"data-slot":"autocomplete-text"},t))}exports.Autocomplete=re,exports.AutocompleteContent=se,exports.AutocompleteContentFooter=I,exports.AutocompleteGroup=ne,exports.AutocompleteItem=oe,exports.AutocompleteText=le,exports.AutocompleteTrigger=te,exports.AutocompleteWrapper=ae;
|
|
3
|
+
"use strict";var s=require("react/jsx-runtime"),A=require("@medway-ui/icons"),o=require("react"),H=require("class-variance-authority"),B=require("../hooks/use-id.js"),K=require("../lib/floating-label.js"),p=require("../lib/utils.js"),h=require("./Command.js"),P=require("./Popover.js"),W=require("./Button.js"),Q=Object.defineProperty,U=Object.defineProperties,X=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,T=Object.prototype.hasOwnProperty,_=Object.prototype.propertyIsEnumerable,R=(e,r,a)=>r in e?Q(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,k=(e,r)=>{for(var a in r||(r={}))T.call(r,a)&&R(e,a,r[a]);if(y)for(var a of y(r))_.call(r,a)&&R(e,a,r[a]);return e},Z=(e,r)=>U(e,X(r)),C=(e,r)=>{var a={};for(var t in e)T.call(e,t)&&r.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&y)for(var t of y(e))r.indexOf(t)<0&&_.call(e,t)&&(a[t]=e[t]);return a};const J={md:20,lg:24},Y={lg:{item:"gap-2.5 px-3.5 py-2.5 text-sm leading-sm",box:"size-5",check:16},md:{item:"gap-2 px-3 py-2 text-xs leading-xs",box:"size-4",check:12}},ee=H.cva("flex w-full items-center justify-between rounded-md border-2 border-gray-stroke-muted bg-surface-card text-left text-gray-foreground outline-none transition-[color,box-shadow] hover:border-gray-stroke hover:ring-4 hover:ring-state-hover focus-visible:border-gray-stroke-emphasis focus-visible:ring-4 focus-visible:ring-state-focus disabled:cursor-default disabled:bg-gray-background-soft-muted disabled:hover:border-gray-stroke-muted disabled:hover:ring-0 aria-[invalid=true]:border-feedback-error-stroke aria-[invalid=true]:hover:ring-state-error aria-[invalid=true]:focus-visible:border-feedback-error-stroke aria-[invalid=true]:focus-visible:ring-state-error [&_svg]:pointer-events-none [&_svg]:shrink-0",{variants:{size:{lg:"h-12 max-h-12 gap-3 px-3.5 py-2.5 text-md",md:"h-10 max-h-10 gap-2.5 px-3 py-2 text-sm leading-sm"}},defaultVariants:{size:"lg"}}),b=o.createContext({invalid:!1,disabled:!1,size:"lg",open:!1,setOpen:()=>{},values:[],toggleValue:()=>{},onCancelSelection:()=>{},listId:""});function re({children:e,invalid:r=!1,disabled:a=!1,size:t="lg",values:l,onValuesChange:n,open:c,onOpenChange:d,defaultValues:i=[]}){const[g,x]=o.useState(i),[j,N]=o.useState(!1),u=l!==void 0,O=c!==void 0,m=u?l:g,f=O?c:j,[w,F]=o.useState(m),[G,M]=o.useState(f);f!==G&&(M(f),f&&F(m));const q=o.useCallback(v=>{const L=m.includes(v)?m.filter($=>$!==v):[...m,v];u||x(L),n==null||n(L)},[m,u,n]),z=o.useCallback(v=>{a||(O||N(v),d==null||d(v))},[a,O,d]),V=o.useCallback(()=>{u||x(w),n==null||n(w)},[u,w,n]),E=B.useId(),D=o.useMemo(()=>({invalid:r,disabled:a,size:t,open:f,setOpen:z,values:m,toggleValue:q,onCancelSelection:V,listId:E}),[r,a,t,f,z,m,q,V,E]);return s.jsx(b.Provider,{value:D,children:s.jsx(P.Popover,{open:f,onOpenChange:z,children:e})})}function ae(e){var r=e,{className:a}=r,t=C(r,["className"]);return s.jsx("div",k({className:p.cn(K.FLOATING_LABEL_WRAPPER,a),"data-slot":"autocomplete-wrapper"},t))}function te(e){var r=e,{className:a,placeholder:t="Selecione uma op\xE7\xE3o",children:l}=r,n=C(r,["className","placeholder","children"]);const{invalid:c,disabled:d,size:i,open:g,values:x,listId:j}=o.useContext(b),N=B.useId(),u=x.length>0;return s.jsx(P.PopoverTrigger,{asChild:!0,children:s.jsxs("button",Z(k({"aria-controls":j,"aria-expanded":g,"aria-invalid":c||void 0,className:p.cn(ee({size:i}),u&&!c&&"border-gray-stroke-emphasis hover:border-gray-stroke-emphasis",a),"data-slot":"autocomplete-trigger","data-size":i,"data-placeholder":u?void 0:"",disabled:d,id:N,role:"combobox",type:"button"},n),{children:[s.jsx("span",{className:p.cn("min-w-0 truncate",l!=null?"text-gray-foreground-emphasis":d?"text-gray-foreground-muted":"text-gray-foreground-placeholder"),children:l!=null?l:t}),s.jsx(A.ChevronDown,{"aria-hidden":"true",className:"shrink-0 text-gray-foreground",size:J[i],strokeWidth:1.6})]}))})}function I({className:e,cancelLabel:r="Cancelar",confirmLabel:a="Concluir",onCancel:t,onConfirm:l}){const{setOpen:n,onCancelSelection:c,values:d}=o.useContext(b);return s.jsxs("div",{className:p.cn("flex items-center justify-between border-t border-gray-stroke-muted px-4 py-3",e),"data-slot":"autocomplete-content-footer",children:[s.jsx(W.Button,{size:"sm",variant:"regular-soft",onClick:()=>{c(),t==null||t(),n(!1)},children:r}),s.jsx(W.Button,{size:"sm",variant:"emphasis",iconLeft:s.jsx(A.Check,{strokeWidth:2.6}),onClick:()=>{l==null||l(d),n(!1)},children:a})]})}function S(e){return typeof e=="string"||typeof e=="number"?String(e):Array.isArray(e)?e.map(S).join(""):o.isValidElement(e)?S(e.props.children):""}function se({children:e,className:r,searchPlaceholder:a="Buscar...",emptyMessage:t="Nenhum resultado encontrado"}){const{listId:l}=o.useContext(b),n=o.Children.toArray(e),c=n.filter(i=>o.isValidElement(i)&&i.type===I),d=n.filter(i=>!(o.isValidElement(i)&&i.type===I));return s.jsxs(P.PopoverContent,{id:l,align:"start",sideOffset:4,className:p.cn("w-full min-w-[var(--radix-popper-anchor-width)] border border-gray-stroke-muted bg-surface-elevated p-0",r),children:[s.jsxs(h.Command,{className:"bg-surface-elevated",children:[s.jsx(h.CommandInput,{placeholder:a}),s.jsxs(h.CommandList,{children:[s.jsx(h.CommandEmpty,{children:t}),d]})]}),c]})}function oe({children:e,value:r,name:a,className:t,disabled:l=!1}){const{values:n,toggleValue:c,size:d}=o.useContext(b),i=Y[d],g=n.includes(r);return s.jsxs(h.CommandItem,{className:p.cn("relative flex w-full cursor-default select-none items-center rounded-md font-medium text-gray-foreground outline-none hover:cursor-pointer hover:bg-primary-background-soft-muted hover:text-gray-foreground-emphasis data-[selected=true]:bg-primary-background-soft-muted data-[selected=true]:text-gray-foreground-emphasis",i.item,t),disabled:l,"aria-checked":g,onSelect:()=>{c(r)},value:r,keywords:[a!=null?a:S(e)].filter(Boolean),children:[s.jsx("span",{"aria-hidden":"true",className:p.cn("inline-flex shrink-0 items-center justify-center rounded-sm border-2 transition-colors",i.box,g?"border-primary-background-fill bg-primary-background-fill":"border-gray-stroke-muted bg-surface-card"),children:g&&s.jsx(A.Check,{size:i.check,strokeWidth:2.6,className:"text-primary-foreground-onfill"})}),e]})}function ne(e){var r=e,{className:a}=r,t=C(r,["className"]);return s.jsx(h.CommandGroup,k({className:a},t))}function le(e){var r=e,{className:a}=r,t=C(r,["className"]);const{invalid:l}=o.useContext(b);return s.jsx("span",k({className:p.cn("-mt-1 text-xs",l?"text-feedback-error-foreground":"text-gray-foreground",a),"data-slot":"autocomplete-text"},t))}exports.Autocomplete=re,exports.AutocompleteContent=se,exports.AutocompleteContentFooter=I,exports.AutocompleteGroup=ne,exports.AutocompleteItem=oe,exports.AutocompleteText=le,exports.AutocompleteTrigger=te,exports.AutocompleteWrapper=ae;
|