@petnow/ui 5.3.1 → 6.0.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/CHANGELOG.md +66 -0
- package/README.md +85 -5
- package/dist/Chip-Bu5q0mhe.js +53 -0
- package/dist/Chip-Bu5q0mhe.js.map +1 -0
- package/dist/chip.js +2 -52
- package/dist/combobox.js +166 -152
- package/dist/combobox.js.map +1 -1
- package/dist/{fieldStyles-DyZu__hI.js → fieldStyles-DXyDrzxD.js} +5 -6
- package/dist/fieldStyles-DXyDrzxD.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +18 -18
- package/dist/mergeRefs-CsNeQOZ6.js +39 -0
- package/dist/mergeRefs-CsNeQOZ6.js.map +1 -0
- package/dist/native/chip.js +134 -0
- package/dist/native/chip.js.map +1 -0
- package/dist/native/components/chip/Chip.native.d.ts +14 -0
- package/dist/native/components/chip/Chip.types.d.ts +11 -0
- package/dist/native/components/chip/Chip.variants.d.ts +12 -0
- package/dist/native/utils/TailwindUtil.d.ts +2 -0
- package/dist/native/utils/mergeRefs.d.ts +2 -0
- package/dist/select.js +86 -66
- package/dist/select.js.map +1 -1
- package/dist/src/components/chip/Chip.d.ts +2 -7
- package/dist/src/components/chip/Chip.types.d.ts +11 -0
- package/dist/src/components/chip/Chip.variants.d.ts +12 -0
- package/dist/src/components/combobox/Combobox.d.ts +1 -0
- package/dist/src/components/select/Select.d.ts +13 -6
- package/dist/src/components/text-field/TextField.d.ts +1 -20
- package/dist/src/components/ui/listbox.d.ts +1 -0
- package/dist/src/components/ui/listboxStyles.d.ts +8 -0
- package/dist/text-field.js +50 -114
- package/dist/text-field.js.map +1 -1
- package/dist/v1/text-field.js +1 -1
- package/docs/migration/v5-to-v6.md +59 -0
- package/package.json +34 -5
- package/petnow-design-system-v1.css +2 -0
- package/petnow-design-system-v1.uniwind.css +763 -0
- package/tailwind.css +2 -0
- package/dist/chip.js.map +0 -1
- package/dist/fieldStyles-DyZu__hI.js.map +0 -1
- package/dist/mergeRefs-BHwdBwNQ.js +0 -27
- package/dist/mergeRefs-BHwdBwNQ.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 6.0.0
|
|
4
|
+
|
|
5
|
+
### Breaking
|
|
6
|
+
|
|
7
|
+
- **`Select`** is no longer a native `<select>`. It is built on Radix Select, like the Select in
|
|
8
|
+
petify-admin-console: the trigger keeps the `TextField` look, and the options open in a panel below it
|
|
9
|
+
(portal to `body`, 8px radius, border, shadow) with a check in front of the picked option and the
|
|
10
|
+
picked option in the accent color. Keyboard (arrows, Enter, Escape, typeahead) and ARIA come from Radix.
|
|
11
|
+
- `ref` reaches the trigger `<button>` (`HTMLButtonElement`), and the rest props are button attributes,
|
|
12
|
+
not `<select>` attributes. `name`, `form` and `required` still work: inside a form, Radix renders a
|
|
13
|
+
hidden `<select>`, so the value reaches `FormData` and browser validation.
|
|
14
|
+
- Mobile browsers show this panel instead of the system picker.
|
|
15
|
+
- An option value cannot be `""`; `""` means nothing is picked and shows `placeholder`. Options with
|
|
16
|
+
`""` are left out. Once picked, the user cannot go back to "nothing picked"; the native `<select>`
|
|
17
|
+
let them pick the placeholder again. Set `value` to `""` in code if a form needs that.
|
|
18
|
+
- A form `reset` restores `defaultValue` (or nothing) on screen and in the hidden `<select>`; a
|
|
19
|
+
controlled `Select` gets it through `onChange`.
|
|
20
|
+
- **`TextFieldSelect`** is removed. It was only a button that called `onPress`, without a list. Use
|
|
21
|
+
`Select` (or `Combobox` to search). See [`docs/migration/v5-to-v6.md`](docs/migration/v5-to-v6.md).
|
|
22
|
+
|
|
23
|
+
### Changes
|
|
24
|
+
|
|
25
|
+
- `Combobox` opens its list in the same panel as `Select`, through a Radix Popover portal, so a parent with
|
|
26
|
+
`overflow: hidden` or a scroll container no longer clips it, and the list flips above the input when
|
|
27
|
+
there is no room below. Its options use the `Select` row (left check slot, accent color for the picked
|
|
28
|
+
option). The list is in the DOM only while it is open, so the input and toggle set `aria-controls` only
|
|
29
|
+
then. Escape on an open list closes only the list, not a surrounding dialog.
|
|
30
|
+
- TextField stories no longer show select-like fields: the `SelectField` and `SelectFieldSmallError`
|
|
31
|
+
stories are removed, and `NormalWithErrorAndCounter` no longer shows a dropdown chevron.
|
|
32
|
+
|
|
33
|
+
## 5.4.0
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- **React Native `Chip`**: Expo apps import it from the same path, `@petnow/ui/chip`. The export has a
|
|
38
|
+
`react-native` condition, which the React Native and Expo Metro default config (`getDefaultConfig`)
|
|
39
|
+
asserts for iOS and Android, so Metro resolves `dist/native/chip.js`
|
|
40
|
+
(`Pressable` + `Text`, styled by the app's Uniwind) while Next.js and Vite keep the web file. Its props
|
|
41
|
+
match the web Chip (`label`, `icon`, `selected`, `disabled`, `onPress`, `className`) plus `Pressable`
|
|
42
|
+
props. `icon` also receives `color`, `width` and `height` resolved from the icon token, so
|
|
43
|
+
`react-native-svg` icons drawn with `currentColor` follow the theme. Checked in petify-app (Expo 54,
|
|
44
|
+
React Native 0.81, Uniwind 1.13) on the iOS simulator and Android emulator.
|
|
45
|
+
- **`@petnow/ui/petnow-design-system-v1.uniwind.css`**: the v1 tokens as a Uniwind theme for Expo apps,
|
|
46
|
+
generated from `petnow-design-system-v1.css` by `pnpm generate:native-theme`. It defines the Uniwind
|
|
47
|
+
themes `light` (Petnow), `dark` (same values as light) and `petify` (switch with
|
|
48
|
+
`Uniwind.setTheme("petify")`; `extraThemes: ["petify"]` in `withUniwindConfig` is required, or the CSS
|
|
49
|
+
fails to compile), the
|
|
50
|
+
typography utilities with a Pretendard face per weight (`Pretendard-Regular`, `-Medium`, `-Bold`) and
|
|
51
|
+
without `line-height: normal`, and registers `dist/native` as a Tailwind source. Setup is in the README
|
|
52
|
+
(Expo 앱에서 사용).
|
|
53
|
+
- `react-native` (>= 0.81) and `uniwind` (^1.13) are optional peer dependencies.
|
|
54
|
+
|
|
55
|
+
### Changes
|
|
56
|
+
|
|
57
|
+
- `tailwind.css` skips `dist/native` (`@source not`), so web builds do not generate classes used only by
|
|
58
|
+
the native components.
|
|
59
|
+
- `Chip` keeps its web output (classes, snapshot). Its props are now `ChipBaseProps` (`Chip.types.ts`)
|
|
60
|
+
plus button attributes, with the classes shared with the native file in `Chip.variants.ts`.
|
|
61
|
+
|
|
62
|
+
### Fixes
|
|
63
|
+
|
|
64
|
+
- `bg-surface-base-neutral-1-alpha-1` now has a value: white at 60% (`#ffffff99`) in both themes, the
|
|
65
|
+
value petify-app already uses. `petnow-design-system-v1.css` mapped it in `@theme inline` but never
|
|
66
|
+
declared `--surface-base-neutral-1-alpha-1`, so the class drew nothing on the web and the Uniwind theme
|
|
67
|
+
left it out.
|
|
68
|
+
|
|
3
69
|
## 5.3.1
|
|
4
70
|
|
|
5
71
|
### Fixes
|
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @petnow/ui
|
|
2
2
|
|
|
3
|
-
사내 웹
|
|
3
|
+
사내 웹 프로젝트와 Expo 앱에서 쓰는 공용 컴포넌트 라이브러리다. 웹은 React 19와 Tailwind CSS v4, Expo 앱은
|
|
4
|
+
Uniwind 1.x(Tailwind CSS v4)를 쓰는 소비 레포를 전제로 한다.
|
|
4
5
|
|
|
5
6
|
- Storybook: https://components.petnow.co/
|
|
6
7
|
- 변경 내역: [CHANGELOG.md](CHANGELOG.md)
|
|
@@ -46,18 +47,93 @@
|
|
|
46
47
|
|
|
47
48
|
Petify 테마는 상위 요소에 `petify` 클래스를 붙이면 v1 시맨틱 컬러가 바뀐다.
|
|
48
49
|
|
|
50
|
+
## Expo 앱에서 사용
|
|
51
|
+
|
|
52
|
+
네이티브 구현(`<Component>.native.tsx`)이 있는 컴포넌트는 웹과 같은 경로로 import한다. 지금은 `Chip`
|
|
53
|
+
(`@petnow/ui/chip`)이다. Expo·React Native의 Metro 기본 설정(`getDefaultConfig`)은 iOS·Android 번들에서
|
|
54
|
+
`package.json` `exports`의 `react-native` 조건을 쓰므로 `dist/native/`의 네이티브 구현을 가져오고, Next.js·Vite는
|
|
55
|
+
이 조건을 쓰지 않아 웹 구현을 가져온다. 루트 경로(`@petnow/ui`)와 deprecated `@petnow/ui/v1/*` 경로는 웹 전용이다.
|
|
56
|
+
Expo web 번들은 확인하지 않았다. petify-app(Expo 54, React Native 0.81, Uniwind 1.13)의 iOS 시뮬레이터와
|
|
57
|
+
Android 에뮬레이터에서 확인했다.
|
|
58
|
+
|
|
59
|
+
1. 설치. `react-native`(0.81 이상)와 `uniwind`(1.13 이상)는 optional peer dependency다.
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
bun add @petnow/ui
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
2. Metro를 Uniwind로 감싼다. 패키지 테마 CSS가 `@variant petify`를 정의하므로 `extraThemes: ["petify"]`는
|
|
66
|
+
필수다. 빠지면 CSS 컴파일이 `Cannot use @variant with unknown variant: petify`로 실패한다.
|
|
67
|
+
|
|
68
|
+
```js
|
|
69
|
+
// metro.config.js
|
|
70
|
+
const { getDefaultConfig } = require("expo/metro-config");
|
|
71
|
+
const { withUniwindConfig } = require("uniwind/metro");
|
|
72
|
+
|
|
73
|
+
module.exports = withUniwindConfig(getDefaultConfig(__dirname), {
|
|
74
|
+
cssEntryFile: "./global.css",
|
|
75
|
+
extraThemes: ["petify"],
|
|
76
|
+
});
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
3. Uniwind CSS 엔트리에서 Tailwind와 Uniwind 다음에 패키지 테마를 import한다.
|
|
80
|
+
|
|
81
|
+
```css
|
|
82
|
+
/* global.css */
|
|
83
|
+
@import "tailwindcss";
|
|
84
|
+
@import "uniwind";
|
|
85
|
+
@import "@petnow/ui/petnow-design-system-v1.uniwind.css";
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`petnow-design-system-v1.uniwind.css`는 `petnow-design-system-v1.css`에서 생성한 파일이다. v1 참조색·시맨틱
|
|
89
|
+
컬러·타이포그래피 유틸리티와 Uniwind 테마 `light`(Petnow), `dark`(아직 light와 같은 값), `petify`를 정의하고,
|
|
90
|
+
패키지의 `dist/native`를 `@source`로 등록한다. 웹과 같이 `red`·`green` 등 Tailwind 기본 팔레트와 이름이 겹치는
|
|
91
|
+
참조색은 `--color-*`로 매핑하지 않는다. 네이티브에서는 `.petify` 클래스가 동작하지 않는다.
|
|
92
|
+
|
|
93
|
+
4. 테마는 앱 전체에 적용된다. Petify 테마로 바꾼다.
|
|
94
|
+
|
|
95
|
+
```ts
|
|
96
|
+
import { Uniwind } from "uniwind";
|
|
97
|
+
|
|
98
|
+
Uniwind.setTheme("petify");
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
5. 타이포그래피 유틸리티(`text-body-14-medium` 등)는 굵기별로 `font-family: Pretendard-Regular`,
|
|
102
|
+
`Pretendard-Medium`, `Pretendard-Bold`를 지정한다. 앱이 Pretendard를 이 이름으로 로드해야 한다.
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
const [fontsLoaded] = useFonts({
|
|
106
|
+
"Pretendard-Regular": require("./assets/fonts/Pretendard-Regular.otf"),
|
|
107
|
+
"Pretendard-Medium": require("./assets/fonts/Pretendard-Medium.otf"),
|
|
108
|
+
"Pretendard-Bold": require("./assets/fonts/Pretendard-Bold.otf"),
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
6. 컴포넌트를 쓴다. 타입은 `expo/tsconfig.base`의 `customConditions: ["react-native"]`로 네이티브 선언
|
|
113
|
+
파일에서 풀린다.
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { Chip } from "@petnow/ui/chip";
|
|
117
|
+
|
|
118
|
+
<Chip label="전체" selected={selected} onPress={() => setSelected(true)} icon={FilterIcon} />;
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
네이티브 `Chip`의 `icon`은 `className`과 함께 토큰에서 풀어 낸 `color`·`width`·`height`를 받는다.
|
|
122
|
+
`react-native-svg`의 `SvgProps`를 받는 아이콘(`fill="currentColor"`)이면 그대로 동작한다.
|
|
123
|
+
|
|
49
124
|
## 구조
|
|
50
125
|
|
|
51
126
|
```
|
|
52
127
|
@petnow/ui
|
|
53
128
|
├── tailwind.css - 소비 레포가 import하는 Tailwind 엔트리 (v0 토큰은 deprecated)
|
|
54
129
|
├── petnow-design-system-v1.css - v1 토큰(ref·시맨틱 컬러, 타이포그래피)
|
|
130
|
+
├── petnow-design-system-v1.uniwind.css - Expo 앱용 Uniwind 테마 (생성 파일, `pnpm generate:native-theme`)
|
|
55
131
|
├── index.ts - 패키지 엔트리
|
|
56
132
|
├── src
|
|
57
133
|
│ ├── components
|
|
58
134
|
│ │ ├── ui - 내부 전용 primitive (export하지 않음)
|
|
59
135
|
│ │ ├── icons - 아이콘 (action, static)
|
|
60
|
-
│ │ └── <컴포넌트> - 컴포넌트와 스토리 (badge, checkbox, cta-button, …)
|
|
136
|
+
│ │ └── <컴포넌트> - 컴포넌트와 스토리 (badge, checkbox, cta-button, …), 네이티브 구현은 *.native.tsx
|
|
61
137
|
│ ├── styles/components.css - dist/index.css로 복사되는 일반 CSS
|
|
62
138
|
│ ├── index.css - Storybook 엔트리
|
|
63
139
|
│ └── utils
|
|
@@ -76,9 +152,12 @@ Node 버전은 `mise.toml`로 고정한다. pnpm은 `package.json`의 `packageMa
|
|
|
76
152
|
```sh
|
|
77
153
|
mise install
|
|
78
154
|
pnpm i
|
|
79
|
-
pnpm storybook
|
|
155
|
+
pnpm storybook:native # http://localhost:6007, 네이티브 컴포넌트(react-native-web). 6006보다 먼저 띄운다
|
|
156
|
+
pnpm storybook # http://localhost:6006, 6007이 떠 있으면 "React Native"로 합성
|
|
80
157
|
pnpm jest
|
|
81
|
-
pnpm build # tsc + vite 라이브러리 빌드 + dist/index.css 복사
|
|
158
|
+
pnpm build # tsc + vite 라이브러리 빌드(웹, dist/native) + dist/index.css 복사
|
|
159
|
+
pnpm check:dist && pnpm check:dist:native
|
|
160
|
+
pnpm generate:native-theme # petnow-design-system-v1.css를 바꾼 뒤 Uniwind 테마 재생성
|
|
82
161
|
```
|
|
83
162
|
|
|
84
163
|
## 배포
|
|
@@ -88,5 +167,6 @@ npm Trusted Publishing(OIDC)으로 배포한다. GitHub Actions가 발급하는
|
|
|
88
167
|
|
|
89
168
|
1. PR을 만들어 main에 merge한다. PR에서는 테스트, 포맷 검사, 빌드, Storybook 빌드가 돈다.
|
|
90
169
|
2. semver에 맞춰 `v*` 태그를 push한다(예: `v5.0.0`). `.github/workflows/publish-npm.yaml`이 태그 버전으로
|
|
91
|
-
`package.json`을 맞춰 npm에 배포하고, 버전 커밋을 main에
|
|
170
|
+
`package.json`을 맞춰 npm에 배포하고, 버전 커밋을 main에 남긴 뒤 GitHub Release(본문은 CHANGELOG의
|
|
171
|
+
해당 버전 절과 PR 목록)를 만든다. 태그를 push하기 전에 CHANGELOG에 `## <버전>` 절을 적는다.
|
|
92
172
|
3. 하위 호환을 깨는 변경은 [CHANGELOG.md](CHANGELOG.md)와 `docs/migration/`에 적는다.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { t as e } from "./TailwindUtil-DiNvXuNl.js";
|
|
3
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
|
+
import "react";
|
|
5
|
+
import { cva as r } from "class-variance-authority";
|
|
6
|
+
//#region src/components/chip/Chip.variants.ts
|
|
7
|
+
var i = "items-center justify-center gap-1 rounded-full border px-[11px] py-[7px]", a = {
|
|
8
|
+
true: "bg-surface-base-accent-1 border-border-prominent-accent",
|
|
9
|
+
false: "bg-surface-base-neutral-1 border-border-base-neutral-2"
|
|
10
|
+
}, o = "opacity-40", s = r("text-body-14-medium", {
|
|
11
|
+
variants: { selected: {
|
|
12
|
+
true: "text-text-prominent-accent-1",
|
|
13
|
+
false: "text-text-base-neutral-3"
|
|
14
|
+
} },
|
|
15
|
+
defaultVariants: { selected: !1 }
|
|
16
|
+
}), c = r("size-[18px] shrink-0", {
|
|
17
|
+
variants: { selected: {
|
|
18
|
+
true: "text-icon-prominent-accent-1",
|
|
19
|
+
false: "text-icon-base-neutral-3"
|
|
20
|
+
} },
|
|
21
|
+
defaultVariants: { selected: !1 }
|
|
22
|
+
}), l = r(`inline-flex ${i} transition-colors duration-200`, {
|
|
23
|
+
variants: {
|
|
24
|
+
selected: a,
|
|
25
|
+
disabled: {
|
|
26
|
+
true: `${o} pointer-events-none`,
|
|
27
|
+
false: ""
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
selected: !1,
|
|
32
|
+
disabled: !1
|
|
33
|
+
}
|
|
34
|
+
}), u = ({ className: r, label: i, icon: a, selected: o = !1, disabled: u = !1, onPress: d, onClick: f, type: p = "button", ...m }) => /* @__PURE__ */ n("button", {
|
|
35
|
+
type: p,
|
|
36
|
+
className: e(l({
|
|
37
|
+
selected: o,
|
|
38
|
+
disabled: u
|
|
39
|
+
}), r),
|
|
40
|
+
onClick: (e) => {
|
|
41
|
+
f?.(e), e.defaultPrevented || d?.();
|
|
42
|
+
},
|
|
43
|
+
disabled: u,
|
|
44
|
+
...m,
|
|
45
|
+
children: [a && /* @__PURE__ */ t(a, { className: c({ selected: o }) }), /* @__PURE__ */ t("span", {
|
|
46
|
+
className: s({ selected: o }),
|
|
47
|
+
children: i
|
|
48
|
+
})]
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
export { u as t };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=Chip-Bu5q0mhe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip-Bu5q0mhe.js","names":[],"sources":["../src/components/chip/Chip.variants.ts","../src/components/chip/Chip.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\n\n// 웹·네이티브 공통 클래스. Uniwind(React Native)에서도 동작하는 유틸리티만 둔다.\n// 플랫폼 전용 클래스(inline-flex, transition, pointer-events 등)는 각 구현 파일에서 더한다.\nexport const chipBaseClassName = \"items-center justify-center gap-1 rounded-full border px-[11px] py-[7px]\";\n\nexport const chipSelectedClassNames = {\n true: \"bg-surface-base-accent-1 border-border-prominent-accent\",\n false: \"bg-surface-base-neutral-1 border-border-base-neutral-2\",\n};\n\nexport const chipDisabledClassName = \"opacity-40\";\n\nexport const chipTextVariants = cva(\"text-body-14-medium\", {\n variants: {\n selected: {\n true: \"text-text-prominent-accent-1\",\n false: \"text-text-base-neutral-3\",\n },\n },\n defaultVariants: {\n selected: false,\n },\n});\n\nexport const chipIconVariants = cva(\"size-[18px] shrink-0\", {\n variants: {\n selected: {\n true: \"text-icon-prominent-accent-1\",\n false: \"text-icon-base-neutral-3\",\n },\n },\n defaultVariants: {\n selected: false,\n },\n});\n","\"use client\";\n\nimport { cva } from \"class-variance-authority\";\nimport * as React from \"react\";\n\nimport {\n chipBaseClassName,\n chipDisabledClassName,\n chipIconVariants,\n chipSelectedClassNames,\n chipTextVariants,\n} from \"./Chip.variants\";\nimport { cn } from \"../../utils/TailwindUtil\";\n\nimport type { ChipBaseProps } from \"./Chip.types\";\n\nexport interface ChipProps\n extends ChipBaseProps,\n Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, \"children\" | keyof ChipBaseProps> {}\n\nconst chipVariants = cva(`inline-flex ${chipBaseClassName} transition-colors duration-200`, {\n variants: {\n selected: chipSelectedClassNames,\n disabled: {\n true: `${chipDisabledClassName} pointer-events-none`,\n false: \"\",\n },\n },\n defaultVariants: {\n selected: false,\n disabled: false,\n },\n});\n\nconst Chip = ({\n className,\n label,\n icon: Icon,\n selected = false,\n disabled = false,\n onPress,\n onClick,\n type = \"button\",\n ...props\n}: ChipProps) => {\n const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n\n if (!event.defaultPrevented) {\n onPress?.();\n }\n };\n\n return (\n <button\n type={type}\n className={cn(chipVariants({ selected, disabled }), className)}\n onClick={handleClick}\n disabled={disabled}\n {...props}\n >\n {Icon && <Icon className={chipIconVariants({ selected })} />}\n <span className={chipTextVariants({ selected })}>{label}</span>\n </button>\n );\n};\n\nexport { Chip };\n"],"mappings":";;;;;;AAIA,IAAa,IAAoB,4EAEpB,IAAyB;CACpC,MAAM;CACN,OAAO;AACT,GAEa,IAAwB,cAExB,IAAmB,EAAI,uBAAuB;CACzD,UAAU,EACR,UAAU;EACR,MAAM;EACN,OAAO;CACT,EACF;CACA,iBAAiB,EACf,UAAU,GACZ;AACF,CAAC,GAEY,IAAmB,EAAI,wBAAwB;CAC1D,UAAU,EACR,UAAU;EACR,MAAM;EACN,OAAO;CACT,EACF;CACA,iBAAiB,EACf,UAAU,GACZ;AACF,CAAC,GCfK,IAAe,EAAI,eAAe,EAAkB,kCAAkC;CAC1F,UAAU;EACR,UAAU;EACV,UAAU;GACR,MAAM,GAAG,EAAsB;GAC/B,OAAO;EACT;CACF;CACA,iBAAiB;EACf,UAAU;EACV,UAAU;CACZ;AACF,CAAC,GAEK,KAAQ,EACZ,cACA,UACA,MAAM,GACN,cAAW,IACX,cAAW,IACX,YACA,YACA,UAAO,UACP,GAAG,QAWD,kBAAC,UAAD;CACQ;CACN,WAAW,EAAG,EAAa;EAAE;EAAU;CAAS,CAAC,GAAG,CAAS;CAC7D,UAZiB,MAA+C;EAGlE,AAFA,IAAU,CAAK,GAEV,EAAM,oBACT,IAAU;CAEd;CAOc;CACV,GAAI;WALN,CAOG,KAAQ,kBAAC,GAAD,EAAM,WAAW,EAAiB,EAAE,YAAS,CAAC,EAAI,CAAA,GAC3D,kBAAC,QAAD;EAAM,WAAW,EAAiB,EAAE,YAAS,CAAC;YAAI;CAAY,CAAA,CACxD"}
|
package/dist/chip.js
CHANGED
|
@@ -1,53 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as e } from "./
|
|
3
|
-
|
|
4
|
-
import "react";
|
|
5
|
-
import { cva as r } from "class-variance-authority";
|
|
6
|
-
//#region src/components/chip/Chip.tsx
|
|
7
|
-
var i = r("inline-flex items-center justify-center gap-1 rounded-full border px-[11px] py-[7px] transition-colors duration-200", {
|
|
8
|
-
variants: {
|
|
9
|
-
selected: {
|
|
10
|
-
true: "bg-surface-base-accent-1 border-border-prominent-accent",
|
|
11
|
-
false: "bg-surface-base-neutral-1 border-border-base-neutral-2"
|
|
12
|
-
},
|
|
13
|
-
disabled: {
|
|
14
|
-
true: "opacity-40 pointer-events-none",
|
|
15
|
-
false: ""
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
defaultVariants: {
|
|
19
|
-
selected: !1,
|
|
20
|
-
disabled: !1
|
|
21
|
-
}
|
|
22
|
-
}), a = r("text-body-14-medium", {
|
|
23
|
-
variants: { selected: {
|
|
24
|
-
true: "text-text-prominent-accent-1",
|
|
25
|
-
false: "text-text-base-neutral-3"
|
|
26
|
-
} },
|
|
27
|
-
defaultVariants: { selected: !1 }
|
|
28
|
-
}), o = r("size-[18px] shrink-0", {
|
|
29
|
-
variants: { selected: {
|
|
30
|
-
true: "text-icon-prominent-accent-1",
|
|
31
|
-
false: "text-icon-base-neutral-3"
|
|
32
|
-
} },
|
|
33
|
-
defaultVariants: { selected: !1 }
|
|
34
|
-
}), s = ({ className: r, label: s, icon: c, selected: l = !1, disabled: u = !1, onPress: d, onClick: f, type: p = "button", ...m }) => /* @__PURE__ */ n("button", {
|
|
35
|
-
type: p,
|
|
36
|
-
className: e(i({
|
|
37
|
-
selected: l,
|
|
38
|
-
disabled: u
|
|
39
|
-
}), r),
|
|
40
|
-
onClick: (e) => {
|
|
41
|
-
f?.(e), e.defaultPrevented || d?.();
|
|
42
|
-
},
|
|
43
|
-
disabled: u,
|
|
44
|
-
...m,
|
|
45
|
-
children: [c && /* @__PURE__ */ t(c, { className: o({ selected: l }) }), /* @__PURE__ */ t("span", {
|
|
46
|
-
className: a({ selected: l }),
|
|
47
|
-
children: s
|
|
48
|
-
})]
|
|
49
|
-
});
|
|
50
|
-
//#endregion
|
|
51
|
-
export { s as Chip };
|
|
52
|
-
|
|
53
|
-
//# sourceMappingURL=chip.js.map
|
|
2
|
+
import { t as e } from "./Chip-Bu5q0mhe.js";
|
|
3
|
+
export { e as Chip };
|