@droplinked_inc/ui-kit 0.1.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/LICENSE +21 -0
- package/MIGRATION.md +129 -0
- package/README.md +62 -0
- package/dist/components/Button.d.ts +17 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +40 -0
- package/dist/components/Button.js.map +1 -0
- package/dist/components/Checkbox.d.ts +18 -0
- package/dist/components/Checkbox.d.ts.map +1 -0
- package/dist/components/Checkbox.js +13 -0
- package/dist/components/Checkbox.js.map +1 -0
- package/dist/components/CheckoutHeader.d.ts +13 -0
- package/dist/components/CheckoutHeader.d.ts.map +1 -0
- package/dist/components/CheckoutHeader.js +13 -0
- package/dist/components/CheckoutHeader.js.map +1 -0
- package/dist/components/Chips.d.ts +14 -0
- package/dist/components/Chips.d.ts.map +1 -0
- package/dist/components/Chips.js +30 -0
- package/dist/components/Chips.js.map +1 -0
- package/dist/components/DetailsItem.d.ts +28 -0
- package/dist/components/DetailsItem.d.ts.map +1 -0
- package/dist/components/DetailsItem.js +10 -0
- package/dist/components/DetailsItem.js.map +1 -0
- package/dist/components/Divider.d.ts +15 -0
- package/dist/components/Divider.d.ts.map +1 -0
- package/dist/components/Divider.js +11 -0
- package/dist/components/Divider.js.map +1 -0
- package/dist/components/Dropdown.d.ts +27 -0
- package/dist/components/Dropdown.d.ts.map +1 -0
- package/dist/components/Dropdown.js +15 -0
- package/dist/components/Dropdown.js.map +1 -0
- package/dist/components/IconContainer.d.ts +14 -0
- package/dist/components/IconContainer.d.ts.map +1 -0
- package/dist/components/IconContainer.js +20 -0
- package/dist/components/IconContainer.js.map +1 -0
- package/dist/components/Input.d.ts +25 -0
- package/dist/components/Input.d.ts.map +1 -0
- package/dist/components/Input.js +13 -0
- package/dist/components/Input.js.map +1 -0
- package/dist/components/ListItem.d.ts +8 -0
- package/dist/components/ListItem.d.ts.map +1 -0
- package/dist/components/ListItem.js +27 -0
- package/dist/components/ListItem.js.map +1 -0
- package/dist/components/Modal.d.ts +25 -0
- package/dist/components/Modal.d.ts.map +1 -0
- package/dist/components/Modal.js +9 -0
- package/dist/components/Modal.js.map +1 -0
- package/dist/components/ProductCard.d.ts +18 -0
- package/dist/components/ProductCard.d.ts.map +1 -0
- package/dist/components/ProductCard.js +17 -0
- package/dist/components/ProductCard.js.map +1 -0
- package/dist/components/RuledGrid.d.ts +9 -0
- package/dist/components/RuledGrid.d.ts.map +1 -0
- package/dist/components/RuledGrid.js +7 -0
- package/dist/components/RuledGrid.js.map +1 -0
- package/dist/components/SearchBar.d.ts +17 -0
- package/dist/components/SearchBar.d.ts.map +1 -0
- package/dist/components/SearchBar.js +24 -0
- package/dist/components/SearchBar.js.map +1 -0
- package/dist/components/SectionTitle.d.ts +12 -0
- package/dist/components/SectionTitle.d.ts.map +1 -0
- package/dist/components/SectionTitle.js +7 -0
- package/dist/components/SectionTitle.js.map +1 -0
- package/dist/components/SelectionCard.d.ts +14 -0
- package/dist/components/SelectionCard.d.ts.map +1 -0
- package/dist/components/SelectionCard.js +6 -0
- package/dist/components/SelectionCard.js.map +1 -0
- package/dist/components/SelectionTab.d.ts +12 -0
- package/dist/components/SelectionTab.d.ts.map +1 -0
- package/dist/components/SelectionTab.js +12 -0
- package/dist/components/SelectionTab.js.map +1 -0
- package/dist/components/SuccessBar.d.ts +9 -0
- package/dist/components/SuccessBar.d.ts.map +1 -0
- package/dist/components/SuccessBar.js +6 -0
- package/dist/components/SuccessBar.js.map +1 -0
- package/dist/components/TextArea.d.ts +17 -0
- package/dist/components/TextArea.d.ts.map +1 -0
- package/dist/components/TextArea.js +9 -0
- package/dist/components/TextArea.js.map +1 -0
- package/dist/components/Toast.d.ts +19 -0
- package/dist/components/Toast.d.ts.map +1 -0
- package/dist/components/Toast.js +19 -0
- package/dist/components/Toast.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/sanitize.d.ts +17 -0
- package/dist/internal/sanitize.d.ts.map +1 -0
- package/dist/internal/sanitize.js +46 -0
- package/dist/internal/sanitize.js.map +1 -0
- package/dist/theme/UIKitProvider.d.ts +16 -0
- package/dist/theme/UIKitProvider.d.ts.map +1 -0
- package/dist/theme/UIKitProvider.js +14 -0
- package/dist/theme/UIKitProvider.js.map +1 -0
- package/dist/theme/palette.d.ts +8 -0
- package/dist/theme/palette.d.ts.map +1 -0
- package/dist/theme/palette.js +62 -0
- package/dist/theme/palette.js.map +1 -0
- package/dist/theme/system.d.ts +12 -0
- package/dist/theme/system.d.ts.map +1 -0
- package/dist/theme/system.js +58 -0
- package/dist/theme/system.js.map +1 -0
- package/dist/types.d.ts +114 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Droplinked Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/MIGRATION.md
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# Migration: `droplinked-ui-kit@0.0.40` → `@droplinked_inc/ui-kit@0.1.0`
|
|
2
|
+
|
|
3
|
+
This document covers the upgrade path for the **39 consumer files** in
|
|
4
|
+
`droplinked-checkout` (and any other repo that imports
|
|
5
|
+
`droplinked-ui-kit`).
|
|
6
|
+
|
|
7
|
+
## TL;DR
|
|
8
|
+
|
|
9
|
+
- Package name changed: `droplinked-ui-kit` → `@droplinked_inc/ui-kit`.
|
|
10
|
+
- API surface is **largely identical** for the v0.1 shipped components.
|
|
11
|
+
- Implementation rebuilt on **Chakra UI v3** (same as the substrate) +
|
|
12
|
+
hardened URL/text rendering.
|
|
13
|
+
- 10 substrate exports are **deferred to v0.2** (see "Deferred" below).
|
|
14
|
+
|
|
15
|
+
## Codemod (search-and-replace)
|
|
16
|
+
|
|
17
|
+
For each `.ts` / `.tsx` file:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# 1. Swap the import specifier
|
|
21
|
+
find src -type f \( -name '*.ts' -o -name '*.tsx' \) -print0 \
|
|
22
|
+
| xargs -0 sed -i '' "s/from 'droplinked-ui-kit'/from '@droplinked_inc\/ui-kit'/g"
|
|
23
|
+
|
|
24
|
+
# 2. Swap the package in package.json
|
|
25
|
+
# (manual — replace "droplinked-ui-kit": "^0.0.40" with
|
|
26
|
+
# "@droplinked_inc/ui-kit": "^0.1.0" + reinstall)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
That should compile **out-of-the-box for every component in the v0.1
|
|
30
|
+
shipping set** (see below). Anything that does not compile is calling
|
|
31
|
+
into a deferred export — track those in the v0.2 backlog.
|
|
32
|
+
|
|
33
|
+
## v0.1 shipping set — confirmed compatible
|
|
34
|
+
|
|
35
|
+
These have a 1:1 prop-shape mapping (consumer code unchanged):
|
|
36
|
+
|
|
37
|
+
| Component | Consumer usage count | Notes |
|
|
38
|
+
| ----------------- | -------------------- | -------------------------------------------- |
|
|
39
|
+
| `Button` | 12 | `variant` enum identical; `leftIcon`/`rightIcon`/`buttonType` preserved. |
|
|
40
|
+
| `Input` | 7 | Forwarded ref preserved. |
|
|
41
|
+
| `Divider` | 7 | Adds `role="separator"` + `aria-orientation`. |
|
|
42
|
+
| `ProductCard` | 6 | URLs are now sanitised — `javascript:`/`data:` dropped. |
|
|
43
|
+
| `DetailsItem` | 5 | Re-exported with `DetailsData` too. |
|
|
44
|
+
| `SectionTitle` | 3 | |
|
|
45
|
+
| `SearchBar` | 3 | |
|
|
46
|
+
| `RuledGrid` | 3 | |
|
|
47
|
+
| `ListItem` | 3 | Discriminated union (`type: 'text' \| 'icon'`) unchanged. |
|
|
48
|
+
| `IconContainer` | 3 | `imageSrc` sanitised. |
|
|
49
|
+
| `Dropdown` | 3 | |
|
|
50
|
+
| `SelectionCard` | 2 | `actionMenuItems` accepted but renders compact "⋯" — full ActionMenu lands in v0.2. |
|
|
51
|
+
| `Modal` | 2 | Built on Chakra v3 `Dialog.*` — focus-trap is now native. |
|
|
52
|
+
| `UIKitProvider` | 1 | `system` prop type unchanged. |
|
|
53
|
+
| `defaultSystem` | 1 | |
|
|
54
|
+
| `Toast` | 1 | |
|
|
55
|
+
| `TextArea` | 1 | Forwarded ref preserved. |
|
|
56
|
+
| `SuccessBar` | 1 | Adds `role="status"`. |
|
|
57
|
+
| `SelectionTab` | 1 | Adds `role="tab"` + `aria-selected`. |
|
|
58
|
+
| `Chips` | 1 | |
|
|
59
|
+
| `CheckoutHeader` | 1 | `imageSrc` sanitised. |
|
|
60
|
+
| `Checkbox` | 1 | |
|
|
61
|
+
| `ActionMenuItem` | 1 | Type-only export. |
|
|
62
|
+
|
|
63
|
+
Type-only exports preserved: `Variant` (and lowercase alias `variants`),
|
|
64
|
+
`AlertBoxState`, `RadiiOption`, `RadiiConfigs`, `TypographyConfigs`,
|
|
65
|
+
`FullThemePalette`, `ActionMenuItem`, `ActionMenuItemVariant`,
|
|
66
|
+
`ListItemProps`, `TextListItemProps`, `IconListItemProps`.
|
|
67
|
+
|
|
68
|
+
Theme helpers preserved: `createThemeSystem`, `defaultLightTheme`,
|
|
69
|
+
`defaultRadii`, `defaultTypography`, `cornerRadiusOptions`.
|
|
70
|
+
|
|
71
|
+
## Breaking changes (small)
|
|
72
|
+
|
|
73
|
+
1. **Package name** — the only mandatory change.
|
|
74
|
+
2. **Provider**: substrate's `UIKitProvider` wrapped `next-themes`.
|
|
75
|
+
v0.1 wraps only `ChakraProvider`. Apps that relied on next-themes
|
|
76
|
+
dark-mode toggling should wire `next-themes` at the app shell. The
|
|
77
|
+
checkout consumer does not appear to do this — no action needed.
|
|
78
|
+
3. **`Modal`**: the close-button is now a `<button aria-label="Close
|
|
79
|
+
dialog">`. Apps that hide it via `showCloseButton={false}` still work
|
|
80
|
+
identically.
|
|
81
|
+
4. **URL props are sanitised** (`href`, `src` on `ProductCard`,
|
|
82
|
+
`IconContainer`, `CheckoutHeader`). `javascript:` / `data:` /
|
|
83
|
+
unknown-scheme URLs are dropped — the element renders without that
|
|
84
|
+
attribute. This is a security improvement; consumers should not have
|
|
85
|
+
been passing such URLs.
|
|
86
|
+
|
|
87
|
+
## Deferred to v0.2 (not exported in v0.1)
|
|
88
|
+
|
|
89
|
+
These substrate exports are not used anywhere in `droplinked-checkout`
|
|
90
|
+
today, per the consumer-import audit at the time of the rebuild:
|
|
91
|
+
|
|
92
|
+
- `ActionMenu` (component)
|
|
93
|
+
- `ActionOverlay`
|
|
94
|
+
- `AlertBox`
|
|
95
|
+
- `DetailsData` — **shipped** (re-exported alongside `DetailsItem`)
|
|
96
|
+
- `OnchainIconContainer`
|
|
97
|
+
- `TokenSelectionCard`
|
|
98
|
+
- `WalletSelectionCard`
|
|
99
|
+
- `WalletTransferStatus`
|
|
100
|
+
|
|
101
|
+
If a consumer file imports any of these, the build will fail with a
|
|
102
|
+
clear "has no exported member" error from TypeScript — file a v0.2
|
|
103
|
+
ticket and unblock locally by either (a) inlining the component, or
|
|
104
|
+
(b) keeping the old package side-by-side under a temporary alias:
|
|
105
|
+
|
|
106
|
+
```jsonc
|
|
107
|
+
// package.json (temporary, while v0.2 is being built)
|
|
108
|
+
{
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"@droplinked_inc/ui-kit": "^0.1.0",
|
|
111
|
+
"droplinked-ui-kit-legacy": "npm:droplinked-ui-kit@0.0.40"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
// only for deferred imports
|
|
118
|
+
import { ActionMenu } from 'droplinked-ui-kit-legacy';
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Recommended rollout
|
|
122
|
+
|
|
123
|
+
1. **Land this package** (no consumer change).
|
|
124
|
+
2. **Single PR in `droplinked-checkout`** that runs the codemod above
|
|
125
|
+
and bumps `package.json`. Should be a green CI pass; touches all 39
|
|
126
|
+
files but is a pure rename.
|
|
127
|
+
3. **Smoke-test the checkout flow** end-to-end on stage.
|
|
128
|
+
4. **Cut a v0.2** with the deferred components when one of them is
|
|
129
|
+
actually needed.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @droplinked_inc/ui-kit
|
|
2
|
+
|
|
3
|
+
Droplinked UI component kit. Built on **Chakra UI v3** + **Emotion**.
|
|
4
|
+
|
|
5
|
+
This is a clean-room rebuild of the previous `droplinked-ui-kit@0.0.40`
|
|
6
|
+
written against the recovered substrate. See
|
|
7
|
+
[`MIGRATION.md`](./MIGRATION.md) for the upgrade path from the old
|
|
8
|
+
package.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
pnpm add @droplinked_inc/ui-kit @chakra-ui/react @emotion/react react react-dom
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Use
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { UIKitProvider, defaultSystem, Button } from '@droplinked_inc/ui-kit';
|
|
20
|
+
|
|
21
|
+
export function App() {
|
|
22
|
+
return (
|
|
23
|
+
<UIKitProvider system={defaultSystem}>
|
|
24
|
+
<Button variant="primary">Pay now</Button>
|
|
25
|
+
</UIKitProvider>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## What's in v0.1
|
|
31
|
+
|
|
32
|
+
23 components covering the full surface used by `droplinked-checkout`:
|
|
33
|
+
|
|
34
|
+
- **Primitives** — `Button`, `Input`, `TextArea`, `Checkbox`, `Divider`
|
|
35
|
+
- **Layout** — `RuledGrid`, `SectionTitle`, `CheckoutHeader`
|
|
36
|
+
- **Overlays** — `Modal`, `Toast`, `SuccessBar`
|
|
37
|
+
- **Data display** — `Chips`, `IconContainer`, `ProductCard`,
|
|
38
|
+
`DetailsItem`, `DetailsData`, `ListItem`
|
|
39
|
+
- **Selection** — `SelectionCard`, `SelectionTab`, `Dropdown`, `SearchBar`
|
|
40
|
+
- **Theme** — `UIKitProvider`, `defaultSystem`, `createThemeSystem`,
|
|
41
|
+
`defaultLightTheme`, `defaultRadii`, `defaultTypography`,
|
|
42
|
+
`cornerRadiusOptions`
|
|
43
|
+
|
|
44
|
+
## Hardening
|
|
45
|
+
|
|
46
|
+
- URL props (`href`, `src`) pass through a strict allow-list (`http`,
|
|
47
|
+
`https`, `mailto`, relative paths). `javascript:` / `data:` URLs are
|
|
48
|
+
dropped.
|
|
49
|
+
- No `dangerouslySetInnerHTML` anywhere in the package.
|
|
50
|
+
- All string props render through React text nodes (no HTML
|
|
51
|
+
interpretation).
|
|
52
|
+
- Form callbacks are strictly typed — no `any`.
|
|
53
|
+
- Components forward refs where appropriate and accept `data-testid`.
|
|
54
|
+
|
|
55
|
+
## Test & lint
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
pnpm test # 67 tests, jsdom
|
|
59
|
+
pnpm test:coverage # ≥92% statements / ≥93% lines
|
|
60
|
+
pnpm typecheck
|
|
61
|
+
pnpm lint
|
|
62
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ElementType } from 'react';
|
|
2
|
+
import { type ButtonProps as ChakraButtonProps } from '@chakra-ui/react';
|
|
3
|
+
import type { Variant, TestableProps } from '../types';
|
|
4
|
+
export type ButtonType = 'text' | 'icon';
|
|
5
|
+
export interface ButtonProps extends Omit<ChakraButtonProps, 'variant'>, TestableProps {
|
|
6
|
+
leftIcon?: ElementType;
|
|
7
|
+
rightIcon?: ElementType;
|
|
8
|
+
icon?: ElementType;
|
|
9
|
+
variant?: Variant;
|
|
10
|
+
buttonType?: ButtonType;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Primary action component. Wraps Chakra Button with the Droplinked
|
|
14
|
+
* `variant` enum and optional `leftIcon` / `rightIcon` slots.
|
|
15
|
+
*/
|
|
16
|
+
export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
17
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAA0B,KAAK,WAAW,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC,MAAM,WAAW,WACf,SAAQ,IAAI,CAAC,iBAAiB,EAAE,SAAS,CAAC,EACxC,aAAa;IACf,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AA4BD;;;GAGG;AACH,eAAO,MAAM,MAAM,2GAqCjB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { Button as ChakraButton } from '@chakra-ui/react';
|
|
4
|
+
const variantToChakra = {
|
|
5
|
+
primary: 'solid',
|
|
6
|
+
outlined: 'outline',
|
|
7
|
+
filled: 'solid',
|
|
8
|
+
muted: 'subtle',
|
|
9
|
+
transparent: 'ghost',
|
|
10
|
+
information: 'subtle',
|
|
11
|
+
success: 'solid',
|
|
12
|
+
warning: 'solid',
|
|
13
|
+
error: 'solid',
|
|
14
|
+
disabled: 'ghost',
|
|
15
|
+
};
|
|
16
|
+
const variantToPalette = {
|
|
17
|
+
primary: 'dl.primary',
|
|
18
|
+
outlined: 'dl.primary',
|
|
19
|
+
filled: 'dl.primary',
|
|
20
|
+
muted: 'dl.neutral.30',
|
|
21
|
+
transparent: 'transparent',
|
|
22
|
+
information: 'dl.info',
|
|
23
|
+
success: 'dl.success',
|
|
24
|
+
warning: 'dl.warning',
|
|
25
|
+
error: 'dl.error',
|
|
26
|
+
disabled: 'dl.neutral.30',
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Primary action component. Wraps Chakra Button with the Droplinked
|
|
30
|
+
* `variant` enum and optional `leftIcon` / `rightIcon` slots.
|
|
31
|
+
*/
|
|
32
|
+
export const Button = forwardRef(function Button({ leftIcon: LeftIcon, rightIcon: RightIcon, icon: Icon, variant = 'primary', buttonType = 'text', children, ...rest }, ref) {
|
|
33
|
+
const chakraVariant = variantToChakra[variant];
|
|
34
|
+
const palette = variantToPalette[variant];
|
|
35
|
+
if (buttonType === 'icon' && Icon) {
|
|
36
|
+
return (_jsx(ChakraButton, { ref: ref, variant: chakraVariant, bg: variant === 'primary' || variant === 'filled' ? palette : undefined, color: variant === 'primary' || variant === 'filled' ? 'dl.text.inverse' : palette, "aria-label": rest['aria-label'] ?? 'button', disabled: variant === 'disabled' || rest.disabled, ...rest, children: _jsx(Icon, {}) }));
|
|
37
|
+
}
|
|
38
|
+
return (_jsxs(ChakraButton, { ref: ref, variant: chakraVariant, bg: variant === 'primary' || variant === 'filled' ? palette : undefined, color: variant === 'primary' || variant === 'filled' ? 'dl.text.inverse' : palette, disabled: variant === 'disabled' || rest.disabled, ...rest, children: [LeftIcon ? _jsx(LeftIcon, {}) : null, children, RightIcon ? _jsx(RightIcon, {}) : null] }));
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAoB,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,MAAM,IAAI,YAAY,EAAyC,MAAM,kBAAkB,CAAC;AAejG,MAAM,eAAe,GAA8D;IACjF,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,QAAQ;IACf,WAAW,EAAE,OAAO;IACpB,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,OAAO;IAChB,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,OAAO;CAClB,CAAC;AAEF,MAAM,gBAAgB,GAA4B;IAChD,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,eAAe;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,EACvE,KAAK,EAAE,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,EAClF,QAAQ,EAAE,OAAO,KAAK,UAAU,IAAI,IAAI,CAAC,QAAQ,KAC7C,IAAI,aAEP,QAAQ,CAAC,CAAC,CAAC,KAAC,QAAQ,KAAG,CAAC,CAAC,CAAC,IAAI,EAC9B,QAAQ,EACR,SAAS,CAAC,CAAC,CAAC,KAAC,SAAS,KAAG,CAAC,CAAC,CAAC,IAAI,IACpB,CAChB,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type ChangeEvent, type ElementType } from 'react';
|
|
2
|
+
import { type BoxProps } from '@chakra-ui/react';
|
|
3
|
+
import type { TestableProps } from '../types';
|
|
4
|
+
export interface CheckboxProps extends Omit<BoxProps, 'onChange'>, TestableProps {
|
|
5
|
+
id?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
isRequired?: boolean;
|
|
9
|
+
requiredText?: string;
|
|
10
|
+
chipsLabel?: string;
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
checked?: boolean;
|
|
13
|
+
defaultChecked?: boolean;
|
|
14
|
+
onChange?: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
|
|
15
|
+
icon?: ElementType;
|
|
16
|
+
}
|
|
17
|
+
export declare function Checkbox({ id, label, subtitle, isRequired, requiredText, chipsLabel, isDisabled, checked, defaultChecked, onChange, icon: Icon, ...rest }: CheckboxProps): JSX.Element;
|
|
18
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAmC,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,aAAa;IAC9E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IAC5E,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,wBAAgB,QAAQ,CAAC,EACvB,EAAE,EACF,KAAK,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,IAAI,EAAE,IAAI,EACV,GAAG,IAAI,EACR,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CA4C7B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Checkbox as ChakraCheckbox } from '@chakra-ui/react';
|
|
3
|
+
export function Checkbox({ id, label, subtitle, isRequired, requiredText, chipsLabel, isDisabled, checked, defaultChecked, onChange, icon: Icon, ...rest }) {
|
|
4
|
+
return (_jsxs(Box, { ...rest, children: [_jsxs(ChakraCheckbox.Root, { id: id, checked: checked, defaultChecked: defaultChecked, disabled: isDisabled, required: isRequired, onCheckedChange: (details) => {
|
|
5
|
+
if (!onChange)
|
|
6
|
+
return;
|
|
7
|
+
// Synthesise a ChangeEvent-shaped object for API parity.
|
|
8
|
+
const target = { checked: Boolean(details.checked) };
|
|
9
|
+
const evt = { target, currentTarget: target };
|
|
10
|
+
onChange(Boolean(details.checked), evt);
|
|
11
|
+
}, children: [_jsx(ChakraCheckbox.HiddenInput, {}), _jsx(ChakraCheckbox.Control, { children: Icon ? _jsx(Icon, {}) : _jsx(ChakraCheckbox.Indicator, {}) }), label ? (_jsxs(ChakraCheckbox.Label, { children: [label, isRequired && requiredText ? (_jsx(Box, { as: "span", color: "dl.error", ml: "1", children: requiredText })) : null, chipsLabel ? (_jsx(Box, { as: "span", ml: "2", px: "2", py: "0.5", bg: "dl.neutral.10", borderRadius: "dl.sm", fontSize: "xs", children: chipsLabel })) : null] })) : null] }), subtitle ? (_jsx(Box, { color: "dl.text.subtext", fontSize: "sm", mt: "1", children: subtitle })) : null] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../src/components/Checkbox.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,QAAQ,IAAI,cAAc,EAAiB,MAAM,kBAAkB,CAAC;AAiBlF,MAAM,UAAU,QAAQ,CAAC,EACvB,EAAE,EACF,KAAK,EACL,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,IAAI,EAAE,IAAI,EACV,GAAG,IAAI,EACO;IACd,OAAO,CACL,MAAC,GAAG,OAAK,IAAI,aACX,MAAC,cAAc,CAAC,IAAI,IAClB,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,UAAU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AAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TestableProps } from '../types';
|
|
2
|
+
export interface CheckoutHeaderProps extends TestableProps {
|
|
3
|
+
buttonLabel: string;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
imageSrc: string;
|
|
6
|
+
imageAlt: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Top header bar of the checkout flow.
|
|
10
|
+
* Sanitizes `imageSrc` (rejects javascript:/data: URLs).
|
|
11
|
+
*/
|
|
12
|
+
export declare function CheckoutHeader({ buttonLabel, onClick, imageSrc, imageAlt, ...rest }: CheckoutHeaderProps): JSX.Element;
|
|
13
|
+
//# sourceMappingURL=CheckoutHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutHeader.d.ts","sourceRoot":"","sources":["../../src/components/CheckoutHeader.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAwBnC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Flex } from '@chakra-ui/react';
|
|
3
|
+
import { Button } from './Button';
|
|
4
|
+
import { safeUrl } from '../internal/sanitize';
|
|
5
|
+
/**
|
|
6
|
+
* Top header bar of the checkout flow.
|
|
7
|
+
* Sanitizes `imageSrc` (rejects javascript:/data: URLs).
|
|
8
|
+
*/
|
|
9
|
+
export function CheckoutHeader({ buttonLabel, onClick, imageSrc, imageAlt, ...rest }) {
|
|
10
|
+
const safe = safeUrl(imageSrc);
|
|
11
|
+
return (_jsxs(Flex, { as: "header", align: "center", justify: "space-between", px: "6", py: "4", borderBottomWidth: "1px", borderColor: "dl.neutral.30", bg: "dl.bg", ...rest, children: [safe ? (_jsx("img", { src: safe, alt: imageAlt, height: 32, style: { height: '32px' } })) : (_jsx(Box, { height: "32px", "aria-label": imageAlt })), _jsx(Button, { variant: "outlined", onClick: onClick, children: buttonLabel })] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=CheckoutHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutHeader.js","sourceRoot":"","sources":["../../src/components/CheckoutHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAU/C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,EAC7B,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACa;IACpB,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,OAAO,CACL,MAAC,IAAI,IACH,EAAE,EAAC,QAAQ,EACX,KAAK,EAAC,QAAQ,EACd,OAAO,EAAC,eAAe,EACvB,EAAE,EAAC,GAAG,EACN,EAAE,EAAC,GAAG,EACN,iBAAiB,EAAC,KAAK,EACvB,WAAW,EAAC,eAAe,EAC3B,EAAE,EAAC,OAAO,KACN,IAAI,aAEP,IAAI,CAAC,CAAC,CAAC,CACN,cAAK,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,GAAI,CACzE,CAAC,CAAC,CAAC,CACF,KAAC,GAAG,IAAC,MAAM,EAAC,MAAM,gBAAa,QAAQ,GAAI,CAC5C,EACD,KAAC,MAAM,IAAC,OAAO,EAAC,UAAU,EAAC,OAAO,EAAE,OAAO,YACxC,WAAW,GACL,IACJ,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import { type BoxProps } from '@chakra-ui/react';
|
|
3
|
+
import type { Variant, TestableProps } from '../types';
|
|
4
|
+
export interface ChipsProps extends Omit<BoxProps, 'color' | 'direction'>, TestableProps {
|
|
5
|
+
label?: string;
|
|
6
|
+
showLeftIcon?: boolean;
|
|
7
|
+
showRightIcon?: boolean;
|
|
8
|
+
leftIcon?: ReactNode;
|
|
9
|
+
rightIcon?: ReactNode;
|
|
10
|
+
variant?: Variant;
|
|
11
|
+
onClick?: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function Chips({ label, showLeftIcon, showRightIcon, leftIcon, rightIcon, variant, onClick, ...rest }: ChipsProps): JSX.Element;
|
|
14
|
+
//# sourceMappingURL=Chips.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chips.d.ts","sourceRoot":"","sources":["../../src/components/Chips.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,CAAC,EAAE,aAAa;IACtF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AA4BD,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,YAAmB,EACnB,aAAoB,EACpB,QAAQ,EACR,SAAS,EACT,OAAiB,EACjB,OAAO,EACP,GAAG,IAAI,EACR,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAyB1B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
const variantToBg = {
|
|
4
|
+
primary: 'dl.primary.tint10',
|
|
5
|
+
outlined: 'transparent',
|
|
6
|
+
filled: 'dl.primary',
|
|
7
|
+
muted: 'dl.neutral.10',
|
|
8
|
+
transparent: 'transparent',
|
|
9
|
+
information: 'dl.info.tint10',
|
|
10
|
+
success: 'dl.success.tint10',
|
|
11
|
+
warning: 'dl.warning.tint10',
|
|
12
|
+
error: 'dl.error.tint10',
|
|
13
|
+
disabled: 'dl.neutral.10',
|
|
14
|
+
};
|
|
15
|
+
const variantToColor = {
|
|
16
|
+
primary: 'dl.primary',
|
|
17
|
+
outlined: 'dl.text',
|
|
18
|
+
filled: 'dl.text.inverse',
|
|
19
|
+
muted: 'dl.text',
|
|
20
|
+
transparent: 'dl.text',
|
|
21
|
+
information: 'dl.info',
|
|
22
|
+
success: 'dl.success',
|
|
23
|
+
warning: 'dl.warning',
|
|
24
|
+
error: 'dl.error',
|
|
25
|
+
disabled: 'dl.text.disabled',
|
|
26
|
+
};
|
|
27
|
+
export function Chips({ label, showLeftIcon = true, showRightIcon = true, leftIcon, rightIcon, variant = 'muted', onClick, ...rest }) {
|
|
28
|
+
return (_jsxs(Box, { display: "inline-flex", alignItems: "center", gap: "1", px: "2", py: "0.5", borderRadius: "dl.sm", bg: variantToBg[variant], color: variantToColor[variant], borderWidth: variant === 'outlined' ? '1px' : 0, borderColor: "dl.neutral.30", fontSize: "xs", cursor: onClick ? 'pointer' : 'default', onClick: onClick, role: onClick ? 'button' : undefined, tabIndex: onClick ? 0 : undefined, ...rest, children: [showLeftIcon && leftIcon, label, showRightIcon && rightIcon] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=Chips.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chips.js","sourceRoot":"","sources":["../../src/components/Chips.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAiB,MAAM,kBAAkB,CAAC;AAatD,MAAM,WAAW,GAA4B;IAC3C,OAAO,EAAE,mBAAmB;IAC5B,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,gBAAgB;IAC7B,OAAO,EAAE,mBAAmB;IAC5B,OAAO,EAAE,mBAAmB;IAC5B,KAAK,EAAE,iBAAiB;IACxB,QAAQ,EAAE,eAAe;CAC1B,CAAC;AAEF,MAAM,cAAc,GAA4B;IAC9C,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,iBAAiB;IACzB,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,SAAS;IACtB,WAAW,EAAE,SAAS;IACtB,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,UAAU;IACjB,QAAQ,EAAE,kBAAkB;CAC7B,CAAC;AAEF,MAAM,UAAU,KAAK,CAAC,EACpB,KAAK,EACL,YAAY,GAAG,IAAI,EACnB,aAAa,GAAG,IAAI,EACpB,QAAQ,EACR,SAAS,EACT,OAAO,GAAG,OAAO,EACjB,OAAO,EACP,GAAG,IAAI,EACI;IACX,OAAO,CACL,MAAC,GAAG,IACF,OAAO,EAAC,aAAa,EACrB,UAAU,EAAC,QAAQ,EACnB,GAAG,EAAC,GAAG,EACP,EAAE,EAAC,GAAG,EACN,EAAE,EAAC,KAAK,EACR,YAAY,EAAC,OAAO,EACpB,EAAE,EAAE,WAAW,CAAC,OAAO,CAAC,EACxB,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,EAC9B,WAAW,EAAE,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAC/C,WAAW,EAAC,eAAe,EAC3B,QAAQ,EAAC,IAAI,EACb,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACvC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,EACpC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,KAC7B,IAAI,aAEP,YAAY,IAAI,QAAQ,EACxB,KAAK,EACL,aAAa,IAAI,SAAS,IACvB,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ElementType } from 'react';
|
|
2
|
+
import { type BoxProps } from '@chakra-ui/react';
|
|
3
|
+
import type { Variant, TestableProps } from '../types';
|
|
4
|
+
export type DetailsDataVariant = 'text' | 'subtext' | 'icon' | 'chips';
|
|
5
|
+
export interface DetailsDataProps extends Omit<BoxProps, 'color'>, TestableProps {
|
|
6
|
+
variant?: DetailsDataVariant;
|
|
7
|
+
text?: string;
|
|
8
|
+
subtext?: string;
|
|
9
|
+
chipsLabel?: string;
|
|
10
|
+
chipsVariant?: Variant;
|
|
11
|
+
icon?: ElementType;
|
|
12
|
+
contentAlign?: 'start' | 'end';
|
|
13
|
+
}
|
|
14
|
+
export declare function DetailsData({ variant, text, subtext, chipsLabel, chipsVariant, icon: Icon, contentAlign, ...rest }: DetailsDataProps): JSX.Element;
|
|
15
|
+
export type DetailsItemVariant = 'compact' | 'full';
|
|
16
|
+
export interface DetailsItemProps extends Omit<BoxProps, 'label' | 'color'>, TestableProps {
|
|
17
|
+
label?: string;
|
|
18
|
+
variant?: DetailsItemVariant;
|
|
19
|
+
infoIcon?: ElementType;
|
|
20
|
+
text?: string;
|
|
21
|
+
dataVariant?: DetailsDataVariant;
|
|
22
|
+
subtext?: string;
|
|
23
|
+
chipsLabel?: string;
|
|
24
|
+
chipsVariant?: Variant;
|
|
25
|
+
dataIcon?: ElementType;
|
|
26
|
+
}
|
|
27
|
+
export declare function DetailsItem({ label, variant, infoIcon: InfoIcon, text, dataVariant, subtext, chipsLabel, chipsVariant, dataIcon, ...rest }: DetailsItemProps): JSX.Element;
|
|
28
|
+
//# sourceMappingURL=DetailsItem.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsItem.d.ts","sourceRoot":"","sources":["../../src/components/DetailsItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvE,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,aAAa;IAC9E,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CAChC;AAED,wBAAgB,WAAW,CAAC,EAC1B,OAAgB,EAChB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,YAAsB,EACtB,IAAI,EAAE,IAAI,EACV,YAAoB,EACpB,GAAG,IAAI,EACR,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAuBhC;AAED,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,MAAM,CAAC;AAEpD,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,EAAE,aAAa;IACxF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,WAAW,CAAC;CACxB;AAED,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,OAAgB,EAChB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EACJ,WAAoB,EACpB,OAAO,EACP,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAyBhC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { Chips } from './Chips';
|
|
4
|
+
export function DetailsData({ variant = 'text', text, subtext, chipsLabel, chipsVariant = 'muted', icon: Icon, contentAlign = 'end', ...rest }) {
|
|
5
|
+
return (_jsxs(Box, { display: "flex", justifyContent: contentAlign === 'end' ? 'flex-end' : 'flex-start', alignItems: "center", gap: "2", ...rest, children: [variant === 'icon' && Icon ? _jsx(Icon, {}) : null, variant === 'chips' && chipsLabel ? _jsx(Chips, { label: chipsLabel, variant: chipsVariant }) : null, (variant === 'text' || variant === 'subtext') && text ? (_jsx(Box, { color: variant === 'subtext' ? 'dl.text.subtext' : 'dl.text', fontSize: variant === 'subtext' ? 'sm' : 'md', children: text })) : null, subtext && variant === 'text' ? (_jsx(Box, { color: "dl.text.subtext", fontSize: "sm", children: subtext })) : null] }));
|
|
6
|
+
}
|
|
7
|
+
export function DetailsItem({ label, variant = 'full', infoIcon: InfoIcon, text, dataVariant = 'text', subtext, chipsLabel, chipsVariant, dataIcon, ...rest }) {
|
|
8
|
+
return (_jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "center", width: "100%", py: variant === 'compact' ? '1' : '2', gap: "3", ...rest, children: [_jsxs(Box, { display: "flex", alignItems: "center", gap: "1", color: "dl.text.subtext", children: [label ? _jsx(Box, { fontSize: "sm", children: label }) : null, InfoIcon ? _jsx(InfoIcon, {}) : null] }), _jsx(DetailsData, { variant: dataVariant, text: text, subtext: subtext, chipsLabel: chipsLabel, chipsVariant: chipsVariant, icon: dataIcon })] }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=DetailsItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DetailsItem.js","sourceRoot":"","sources":["../../src/components/DetailsItem.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAiB,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAehC,MAAM,UAAU,WAAW,CAAC,EAC1B,OAAO,GAAG,MAAM,EAChB,IAAI,EACJ,OAAO,EACP,UAAU,EACV,YAAY,GAAG,OAAO,EACtB,IAAI,EAAE,IAAI,EACV,YAAY,GAAG,KAAK,EACpB,GAAG,IAAI,EACU;IACjB,OAAO,CACL,MAAC,GAAG,I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,EACnB,KAAK,EAAC,MAAM,EACZ,EAAE,EAAE,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EACrC,GAAG,EAAC,GAAG,KACH,IAAI,aAER,MAAC,GAAG,IAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,GAAG,EAAC,KAAK,EAAC,iBAAiB,aACpE,KAAK,CAAC,CAAC,CAAC,KAAC,GAAG,IAAC,QAAQ,EAAC,IAAI,YAAE,KAAK,GAAO,CAAC,CAAC,CAAC,IAAI,EAC/C,QAAQ,CAAC,CAAC,CAAC,KAAC,QAAQ,KAAG,CAAC,CAAC,CAAC,IAAI,IAC3B,EACN,KAAC,WAAW,IACV,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,QAAQ,GACd,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type BoxProps } from '@chakra-ui/react';
|
|
2
|
+
import type { TestableProps } from '../types';
|
|
3
|
+
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
4
|
+
export interface DividerProps extends BoxProps, TestableProps {
|
|
5
|
+
orientation?: DividerOrientation;
|
|
6
|
+
length?: BoxProps['width'];
|
|
7
|
+
thickness?: BoxProps['height'];
|
|
8
|
+
colorToken?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Thin separator. Honours `orientation`, `length`, and `thickness`.
|
|
12
|
+
* `role="separator"` + correct `aria-orientation` for a11y.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Divider({ orientation, length, thickness, colorToken, ...rest }: DividerProps): JSX.Element;
|
|
15
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../src/components/Divider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,YAAa,SAAQ,QAAQ,EAAE,aAAa;IAC3D,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,MAAM,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC3B,SAAS,CAAC,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,EACtB,WAA0B,EAC1B,MAAM,EACN,SAAiB,EACjB,UAA4B,EAC5B,GAAG,IAAI,EACR,EAAE,YAAY,GAAG,GAAG,CAAC,OAAO,CAY5B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
/**
|
|
4
|
+
* Thin separator. Honours `orientation`, `length`, and `thickness`.
|
|
5
|
+
* `role="separator"` + correct `aria-orientation` for a11y.
|
|
6
|
+
*/
|
|
7
|
+
export function Divider({ orientation = 'horizontal', length, thickness = '1px', colorToken = 'dl.neutral.30', ...rest }) {
|
|
8
|
+
const isVertical = orientation === 'vertical';
|
|
9
|
+
return (_jsx(Box, { role: "separator", "aria-orientation": orientation, bg: colorToken, width: isVertical ? thickness : length ?? '100%', height: isVertical ? length ?? '100%' : thickness, ...rest }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.js","sourceRoot":"","sources":["../../src/components/Divider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAiB,MAAM,kBAAkB,CAAC;AAYtD;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,WAAW,GAAG,YAAY,EAC1B,MAAM,EACN,SAAS,GAAG,KAAK,EACjB,UAAU,GAAG,eAAe,EAC5B,GAAG,IAAI,EACM;IACb,MAAM,UAAU,GAAG,WAAW,KAAK,UAAU,CAAC;IAC9C,OAAO,CACL,KAAC,GAAG,IACF,IAAI,EAAC,WAAW,sBACE,WAAW,EAC7B,EAAE,EAAE,UAAU,EACd,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,EAChD,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,SAAS,KAC7C,IAAI,GACR,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ElementType, type ReactNode } from 'react';
|
|
2
|
+
import type { TestableProps } from '../types';
|
|
3
|
+
interface DropdownRenderHelpers {
|
|
4
|
+
open: boolean;
|
|
5
|
+
close: () => void;
|
|
6
|
+
}
|
|
7
|
+
export interface DropdownProps extends TestableProps {
|
|
8
|
+
triggerText?: string;
|
|
9
|
+
children?: ReactNode | ((helpers: DropdownRenderHelpers) => ReactNode);
|
|
10
|
+
open?: boolean;
|
|
11
|
+
defaultOpen?: boolean;
|
|
12
|
+
onOpenChange?: (open: boolean) => void;
|
|
13
|
+
leftIcon?: ElementType;
|
|
14
|
+
headerContent?: ReactNode;
|
|
15
|
+
title?: string;
|
|
16
|
+
subtitle?: string;
|
|
17
|
+
secondaryText?: string;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
chipsLabel?: string;
|
|
20
|
+
isDisabled?: boolean;
|
|
21
|
+
isError?: boolean;
|
|
22
|
+
isSuccess?: boolean;
|
|
23
|
+
message?: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function Dropdown({ triggerText, children, open, defaultOpen, onOpenChange, leftIcon, title, subtitle, isDisabled, isError, isSuccess, message, ...rest }: DropdownProps): JSX.Element;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=Dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../src/components/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,UAAU,qBAAqB;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,OAAO,EAAE,qBAAqB,KAAK,SAAS,CAAC,CAAC;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,WAAW,CAAC;IACvB,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,QAAQ,CAAC,EACvB,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,EACV,OAAO,EACP,SAAS,EACT,OAAO,EACP,GAAG,IAAI,EACR,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CA+C7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Menu, Portal, Box, Flex } from '@chakra-ui/react';
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
export function Dropdown({ triggerText, children, open, defaultOpen, onOpenChange, leftIcon, title, subtitle, isDisabled, isError, isSuccess, message, ...rest }) {
|
|
6
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);
|
|
7
|
+
const effectiveOpen = open ?? internalOpen;
|
|
8
|
+
const handleOpenChange = (next) => {
|
|
9
|
+
setInternalOpen(next);
|
|
10
|
+
onOpenChange?.(next);
|
|
11
|
+
};
|
|
12
|
+
const close = () => handleOpenChange(false);
|
|
13
|
+
return (_jsxs(Box, { ...rest, children: [title ? (_jsx(Box, { fontWeight: "500", color: "dl.text", mb: "1", children: title })) : null, subtitle ? (_jsx(Box, { color: "dl.text.subtext", fontSize: "sm", mb: "1", children: subtitle })) : null, _jsxs(Menu.Root, { open: effectiveOpen, onOpenChange: (details) => handleOpenChange(details.open), children: [_jsx(Menu.Trigger, { asChild: true, disabled: isDisabled, children: _jsx(Button, { variant: isError ? 'error' : isSuccess ? 'success' : 'outlined', leftIcon: leftIcon, children: triggerText ?? 'Select' }) }), _jsx(Portal, { children: _jsx(Menu.Positioner, { children: _jsx(Menu.Content, { children: typeof children === 'function' ? children({ open: effectiveOpen, close }) : children }) }) })] }), message ? (_jsx(Flex, { color: isError ? 'dl.error' : isSuccess ? 'dl.success' : 'dl.text.subtext', fontSize: "sm", mt: "1", children: message })) : null] }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL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IAAI,EACR,MAAC,IAAI,CAAC,IAAI,IACR,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,aAEzD,KAAC,IAAI,CAAC,OAAO,IAAC,OAAO,QAAC,QAAQ,EAAE,UAAU,YACxC,KAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,QAAQ,YACxF,WAAW,IAAI,QAAQ,GACjB,GACI,EACf,KAAC,MAAM,cACL,KAAC,IAAI,CAAC,UAAU,cACd,KAAC,IAAI,CAAC,OAAO,cACV,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,GACxE,GACC,GACX,IACC,EACX,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,EAAE,QAAQ,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,YACnG,OAAO,GACH,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ElementType } from 'react';
|
|
2
|
+
import type { TestableProps } from '../types';
|
|
3
|
+
export type IconContainerType = 'icon' | 'text' | 'image';
|
|
4
|
+
export type IconContainerVariant = 'outlined' | 'muted' | 'secondary' | 'information' | 'success' | 'warning' | 'error' | 'disabled' | 'image';
|
|
5
|
+
export interface IconContainerProps extends TestableProps {
|
|
6
|
+
type?: IconContainerType;
|
|
7
|
+
variant?: IconContainerVariant;
|
|
8
|
+
icon?: ElementType;
|
|
9
|
+
text?: string;
|
|
10
|
+
imageSrc?: string;
|
|
11
|
+
imageAlt?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function IconContainer({ type, variant, icon: Icon, text, imageSrc, imageAlt, ...rest }: IconContainerProps): JSX.Element;
|
|
14
|
+
//# sourceMappingURL=IconContainer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconContainer.d.ts","sourceRoot":"","sources":["../../src/components/IconContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1D,MAAM,MAAM,oBAAoB,GAC5B,UAAU,GACV,OAAO,GACP,WAAW,GACX,aAAa,GACb,SAAS,GACT,SAAS,GACT,OAAO,GACP,UAAU,GACV,OAAO,CAAC;AAEZ,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,IAAI,CAAC,EAAE,WAAW,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAcD,wBAAgB,aAAa,CAAC,EAC5B,IAAa,EACb,OAAiB,EACjB,IAAI,EAAE,IAAI,EACV,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA8BlC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { safeUrl } from '../internal/sanitize';
|
|
4
|
+
const variantToTheme = {
|
|
5
|
+
outlined: { bg: 'transparent', color: 'dl.text', border: 'dl.neutral.30' },
|
|
6
|
+
muted: { bg: 'dl.neutral.10', color: 'dl.text', border: 'transparent' },
|
|
7
|
+
secondary: { bg: 'dl.primary.tint10', color: 'dl.primary', border: 'transparent' },
|
|
8
|
+
information: { bg: 'dl.info.tint10', color: 'dl.info', border: 'transparent' },
|
|
9
|
+
success: { bg: 'dl.success.tint10', color: 'dl.success', border: 'transparent' },
|
|
10
|
+
warning: { bg: 'dl.warning.tint10', color: 'dl.warning', border: 'transparent' },
|
|
11
|
+
error: { bg: 'dl.error.tint10', color: 'dl.error', border: 'transparent' },
|
|
12
|
+
disabled: { bg: 'dl.neutral.10', color: 'dl.text.disabled', border: 'transparent' },
|
|
13
|
+
image: { bg: 'transparent', color: 'dl.text', border: 'dl.neutral.30' },
|
|
14
|
+
};
|
|
15
|
+
export function IconContainer({ type = 'icon', variant = 'muted', icon: Icon, text, imageSrc, imageAlt, ...rest }) {
|
|
16
|
+
const theme = variantToTheme[variant];
|
|
17
|
+
const safe = safeUrl(imageSrc);
|
|
18
|
+
return (_jsxs(Box, { display: "inline-flex", alignItems: "center", justifyContent: "center", width: "40px", height: "40px", borderRadius: "dl.md", bg: theme.bg, color: theme.color, borderWidth: variant === 'outlined' || variant === 'image' ? '1px' : 0, borderColor: theme.border, overflow: "hidden", ...rest, children: [type === 'icon' && Icon ? _jsx(Icon, {}) : null, type === 'text' && text ? _jsx(Box, { fontSize: "sm", children: text }) : null, type === 'image' && safe ? (_jsx("img", { src: safe, alt: imageAlt ?? '', style: { width: '100%', height: '100%', objectFit: 'cover' } })) : null] }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=IconContainer.js.map
|