@vkzstudio/muza-ui 1.2.0 → 1.3.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/dist/components/Accordion/Accordion.d.ts +52 -2
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.js +111 -76
- package/dist/components/ArticleCard/ArticleCard.d.ts +178 -0
- package/dist/components/ArticleCard/ArticleCard.d.ts.map +1 -0
- package/dist/components/ArticleCard/ArticleCard.js +542 -0
- package/dist/components/ArticleCard/ArticleCard.stories.d.ts +14 -0
- package/dist/components/ArticleCard/ArticleCard.stories.d.ts.map +1 -0
- package/dist/components/ArticleCard/index.d.ts +2 -0
- package/dist/components/ArticleCard/index.d.ts.map +1 -0
- package/dist/components/ButtonArrow/ButtonArrow.js +1 -1
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +5 -5
- package/dist/components/Calendar/index.d.ts +1 -2
- package/dist/components/Calendar/index.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.d.ts +9 -0
- package/dist/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/components/Carousel/Carousel.js +135 -133
- package/dist/components/CarouselSection/CarouselSection.examples.d.ts +34 -0
- package/dist/components/CarouselSection/CarouselSection.examples.d.ts.map +1 -0
- package/dist/components/CarouselSection/CarouselSection.stories.d.ts +8 -0
- package/dist/components/CarouselSection/CarouselSection.stories.d.ts.map +1 -0
- package/dist/components/CategoryCard/CategoryCard.d.ts +97 -0
- package/dist/components/CategoryCard/CategoryCard.d.ts.map +1 -0
- package/dist/components/CategoryCard/CategoryCard.js +152 -0
- package/dist/components/CategoryCard/CategoryCard.stories.d.ts +14 -0
- package/dist/components/CategoryCard/CategoryCard.stories.d.ts.map +1 -0
- package/dist/components/CategoryCard/index.d.ts +2 -0
- package/dist/components/CategoryCard/index.d.ts.map +1 -0
- package/dist/components/CategoryIcon/CategoryIcon.d.ts +45 -0
- package/dist/components/CategoryIcon/CategoryIcon.d.ts.map +1 -0
- package/dist/components/CategoryIcon/CategoryIcon.js +54 -0
- package/dist/components/CategoryIcon/CategoryIcon.stories.d.ts +10 -0
- package/dist/components/CategoryIcon/CategoryIcon.stories.d.ts.map +1 -0
- package/dist/components/CategoryIcon/index.d.ts +2 -0
- package/dist/components/CategoryIcon/index.d.ts.map +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +5 -5
- package/dist/components/DotDivider/DotDivider.d.ts +35 -0
- package/dist/components/DotDivider/DotDivider.d.ts.map +1 -0
- package/dist/components/DotDivider/DotDivider.js +31 -0
- package/dist/components/DotDivider/DotDivider.stories.d.ts +10 -0
- package/dist/components/DotDivider/DotDivider.stories.d.ts.map +1 -0
- package/dist/components/DotDivider/index.d.ts +2 -0
- package/dist/components/DotDivider/index.d.ts.map +1 -0
- package/dist/components/HeartButton/HeartButton.d.ts +61 -0
- package/dist/components/HeartButton/HeartButton.d.ts.map +1 -0
- package/dist/components/HeartButton/HeartButton.js +88 -0
- package/dist/components/HeartButton/HeartButton.stories.d.ts +10 -0
- package/dist/components/HeartButton/HeartButton.stories.d.ts.map +1 -0
- package/dist/components/HeartButton/index.d.ts +2 -0
- package/dist/components/HeartButton/index.d.ts.map +1 -0
- package/dist/components/Icons/CustomBadges.d.ts +20 -0
- package/dist/components/Icons/CustomBadges.d.ts.map +1 -1
- package/dist/components/Icons/CustomBadges.js +176 -21
- package/dist/components/Icons/CustomIcons.d.ts +13 -0
- package/dist/components/Icons/CustomIcons.d.ts.map +1 -1
- package/dist/components/Icons/CustomIcons.js +50 -30
- package/dist/components/Icons/LogosAndBadges.stories.d.ts +2 -1
- package/dist/components/Icons/LogosAndBadges.stories.d.ts.map +1 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.d.ts.map +1 -1
- package/dist/components/LanguageSwitcher/LanguageSwitcher.js +65 -55
- package/dist/components/LoginScreen/LoginScreen.d.ts +10 -1
- package/dist/components/LoginScreen/LoginScreen.d.ts.map +1 -1
- package/dist/components/LoginScreen/LoginScreen.js +23 -17
- package/dist/components/MultiSelect/MultiSelect.js +1 -1
- package/dist/components/OfferCard/OfferCard.d.ts +206 -0
- package/dist/components/OfferCard/OfferCard.d.ts.map +1 -0
- package/dist/components/OfferCard/OfferCard.js +423 -0
- package/dist/components/OfferCard/OfferCard.stories.d.ts +15 -0
- package/dist/components/OfferCard/OfferCard.stories.d.ts.map +1 -0
- package/dist/components/OfferCard/index.d.ts +2 -0
- package/dist/components/OfferCard/index.d.ts.map +1 -0
- package/dist/components/PartnerCard/PartnerCard.d.ts +234 -0
- package/dist/components/PartnerCard/PartnerCard.d.ts.map +1 -0
- package/dist/components/PartnerCard/PartnerCard.js +591 -0
- package/dist/components/PartnerCard/PartnerCard.stories.d.ts +14 -0
- package/dist/components/PartnerCard/PartnerCard.stories.d.ts.map +1 -0
- package/dist/components/PartnerCard/index.d.ts +2 -0
- package/dist/components/PartnerCard/index.d.ts.map +1 -0
- package/dist/components/PaymentMethodSelect/PaymentMethodSelect.examples.d.ts +35 -0
- package/dist/components/PaymentMethodSelect/PaymentMethodSelect.examples.d.ts.map +1 -0
- package/dist/components/PaymentMethodSelect/PaymentMethodSelect.stories.d.ts +11 -0
- package/dist/components/PaymentMethodSelect/PaymentMethodSelect.stories.d.ts.map +1 -0
- package/dist/components/Rating/Rating.d.ts +62 -0
- package/dist/components/Rating/Rating.d.ts.map +1 -0
- package/dist/components/Rating/Rating.js +88 -0
- package/dist/components/Rating/Rating.stories.d.ts +12 -0
- package/dist/components/Rating/Rating.stories.d.ts.map +1 -0
- package/dist/components/Rating/index.d.ts +2 -0
- package/dist/components/Rating/index.d.ts.map +1 -0
- package/dist/components/RatingBlock/RatingBlock.d.ts +65 -0
- package/dist/components/RatingBlock/RatingBlock.d.ts.map +1 -0
- package/dist/components/RatingBlock/RatingBlock.js +92 -0
- package/dist/components/RatingBlock/RatingBlock.stories.d.ts +12 -0
- package/dist/components/RatingBlock/RatingBlock.stories.d.ts.map +1 -0
- package/dist/components/RatingBlock/index.d.ts +2 -0
- package/dist/components/RatingBlock/index.d.ts.map +1 -0
- package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.js +5 -5
- package/dist/components/SearchFilters/SearchFilters.d.ts +88 -0
- package/dist/components/SearchFilters/SearchFilters.d.ts.map +1 -0
- package/dist/components/SearchFilters/SearchFilters.js +176 -0
- package/dist/components/SearchFilters/SearchFilters.stories.d.ts +12 -0
- package/dist/components/SearchFilters/SearchFilters.stories.d.ts.map +1 -0
- package/dist/components/SearchFilters/index.d.ts +2 -0
- package/dist/components/SearchFilters/index.d.ts.map +1 -0
- package/dist/components/Tag/Tag.d.ts.map +1 -1
- package/dist/components/TransactionsListView/TransactionsListView.d.ts +152 -0
- package/dist/components/TransactionsListView/TransactionsListView.d.ts.map +1 -0
- package/dist/components/TransactionsListView/TransactionsListView.js +367 -0
- package/dist/components/TransactionsListView/TransactionsListView.stories.d.ts +12 -0
- package/dist/components/TransactionsListView/TransactionsListView.stories.d.ts.map +1 -0
- package/dist/components/TransactionsListView/index.d.ts +2 -0
- package/dist/components/TransactionsListView/index.d.ts.map +1 -0
- package/dist/components/VoucherCard/VoucherCard.d.ts +105 -0
- package/dist/components/VoucherCard/VoucherCard.d.ts.map +1 -0
- package/dist/components/VoucherCard/VoucherCard.js +167 -0
- package/dist/components/VoucherCard/VoucherCard.stories.d.ts +9 -0
- package/dist/components/VoucherCard/VoucherCard.stories.d.ts.map +1 -0
- package/dist/components/VoucherCard/index.d.ts +2 -0
- package/dist/components/VoucherCard/index.d.ts.map +1 -0
- package/dist/components/index.d.ts +12 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.js +405 -352
- package/dist/muza-ui.css +1 -1
- package/dist/styles/primitives.css +5 -0
- package/dist/styles/token-colors.css +105 -30
- package/dist/styles/token-sizes.css +24 -0
- package/dist/translations/index.d.ts +2 -1
- package/dist/translations/index.d.ts.map +1 -1
- package/dist/translations/locales/cs.d.ts.map +1 -1
- package/dist/translations/locales/cs.js +30 -2
- package/dist/translations/locales/en.d.ts.map +1 -1
- package/dist/translations/locales/en.js +26 -2
- package/dist/translations/locales/sk.d.ts.map +1 -1
- package/dist/translations/locales/sk.js +30 -2
- package/dist/translations/resolvePluralTemplate.d.ts +10 -0
- package/dist/translations/resolvePluralTemplate.d.ts.map +1 -0
- package/dist/translations/resolvePluralTemplate.js +20 -0
- package/dist/translations/types.d.ts +57 -0
- package/dist/translations/types.d.ts.map +1 -1
- package/dist/utils/cn.d.ts.map +1 -1
- package/dist/utils/cn.js +116 -24
- package/dist/utils/disabledLinkProps.d.ts +14 -0
- package/dist/utils/disabledLinkProps.d.ts.map +1 -0
- package/dist/utils/disabledLinkProps.js +9 -0
- package/dist/{components/Calendar/utils → utils}/formatDate.d.ts +1 -1
- package/dist/utils/formatDate.d.ts.map +1 -0
- package/dist/utils/formatDateRange.d.ts.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/components/Calendar/utils/formatDate.d.ts.map +0 -1
- package/dist/components/Calendar/utils/formatDateRange.d.ts.map +0 -1
- /package/dist/{components/Calendar/utils → utils}/formatDate.js +0 -0
- /package/dist/{components/Calendar/utils → utils}/formatDateRange.d.ts +0 -0
- /package/dist/{components/Calendar/utils → utils}/formatDateRange.js +0 -0
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { jsxs as l, Fragment as N, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { Slot as C } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as w } from "class-variance-authority";
|
|
5
|
+
import { Flex as x } from "../Flex/Flex.js";
|
|
6
|
+
import { cn as t } from "../../utils/cn.js";
|
|
7
|
+
import { Typography as f } from "../Typography/Typography.js";
|
|
8
|
+
import { Skeleton as n } from "../Skeleton/Skeleton.js";
|
|
9
|
+
const S = w([
|
|
10
|
+
"group inline-flex w-full items-center gap-md no-underline",
|
|
11
|
+
"py-sm pr-2xl pl-sm",
|
|
12
|
+
"rounded-lg border border-solid bg-surface-base-secondary",
|
|
13
|
+
"cursor-pointer transition-colors outline-none",
|
|
14
|
+
"border-stroke-base-primary",
|
|
15
|
+
"hover:border-stroke-brand-hover",
|
|
16
|
+
"focus-visible:border-stroke-brand-focused",
|
|
17
|
+
"active:border-stroke-brand-pressed",
|
|
18
|
+
"data-[disabled=true]:pointer-events-none",
|
|
19
|
+
"data-[disabled=true]:cursor-not-allowed",
|
|
20
|
+
"data-[disabled=true]:border-stroke-base-disabled"
|
|
21
|
+
]), z = i.forwardRef(
|
|
22
|
+
(o, r) => {
|
|
23
|
+
const {
|
|
24
|
+
title: s,
|
|
25
|
+
image: m,
|
|
26
|
+
imageAlt: g = "",
|
|
27
|
+
imageSlot: h,
|
|
28
|
+
count: d,
|
|
29
|
+
disabled: a = !1,
|
|
30
|
+
asChild: v = !1,
|
|
31
|
+
href: y,
|
|
32
|
+
className: k,
|
|
33
|
+
children: c,
|
|
34
|
+
...p
|
|
35
|
+
} = o, b = /* @__PURE__ */ l(N, { children: [
|
|
36
|
+
/* @__PURE__ */ l(
|
|
37
|
+
x,
|
|
38
|
+
{
|
|
39
|
+
component: "span",
|
|
40
|
+
align: "center",
|
|
41
|
+
gap: "md",
|
|
42
|
+
flex: 1,
|
|
43
|
+
className: "min-w-0",
|
|
44
|
+
children: [
|
|
45
|
+
h ?? (m && /* @__PURE__ */ e(
|
|
46
|
+
"img",
|
|
47
|
+
{
|
|
48
|
+
src: m,
|
|
49
|
+
alt: g,
|
|
50
|
+
className: t(
|
|
51
|
+
"size-comp-button-h-sm shrink-0 rounded-md object-cover",
|
|
52
|
+
"group-data-[disabled=true]:opacity-50"
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
)),
|
|
56
|
+
/* @__PURE__ */ e(
|
|
57
|
+
f,
|
|
58
|
+
{
|
|
59
|
+
component: "span",
|
|
60
|
+
variant: "body",
|
|
61
|
+
size: "sm",
|
|
62
|
+
weight: "medium",
|
|
63
|
+
fixY: !0,
|
|
64
|
+
className: t(
|
|
65
|
+
"line-clamp-3 min-w-0 flex-1 text-left text-text-dark-primary-def transition-colors",
|
|
66
|
+
"group-focus-visible:text-text-brand-focused",
|
|
67
|
+
"group-active:text-text-brand-pressed",
|
|
68
|
+
"group-data-[disabled=true]:text-text-dark-disabled"
|
|
69
|
+
),
|
|
70
|
+
children: s
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
d != null && /* @__PURE__ */ e(
|
|
77
|
+
f,
|
|
78
|
+
{
|
|
79
|
+
component: "span",
|
|
80
|
+
variant: "body",
|
|
81
|
+
size: "sm",
|
|
82
|
+
weight: "medium",
|
|
83
|
+
fixY: !0,
|
|
84
|
+
className: t(
|
|
85
|
+
"shrink-0 text-text-brand-def transition-colors",
|
|
86
|
+
"group-hover:text-text-brand-hover",
|
|
87
|
+
"group-focus-visible:text-text-brand-focused",
|
|
88
|
+
"group-active:text-text-brand-pressed",
|
|
89
|
+
"group-data-[disabled=true]:text-text-dark-disabled"
|
|
90
|
+
),
|
|
91
|
+
children: d
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }), u = t(S(), k);
|
|
95
|
+
return v && i.isValidElement(c) ? /* @__PURE__ */ e(
|
|
96
|
+
C,
|
|
97
|
+
{
|
|
98
|
+
ref: r,
|
|
99
|
+
className: u,
|
|
100
|
+
"data-disabled": a || void 0,
|
|
101
|
+
"aria-disabled": a || void 0,
|
|
102
|
+
...p,
|
|
103
|
+
children: i.cloneElement(c, void 0, b)
|
|
104
|
+
}
|
|
105
|
+
) : /* @__PURE__ */ e(
|
|
106
|
+
"a",
|
|
107
|
+
{
|
|
108
|
+
ref: r,
|
|
109
|
+
href: a ? void 0 : y,
|
|
110
|
+
className: u,
|
|
111
|
+
"data-disabled": a || void 0,
|
|
112
|
+
"aria-disabled": a || void 0,
|
|
113
|
+
...p,
|
|
114
|
+
children: b
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
z.displayName = "CategoryCard";
|
|
120
|
+
const j = ({
|
|
121
|
+
className: o,
|
|
122
|
+
color: r = "default",
|
|
123
|
+
...s
|
|
124
|
+
}) => /* @__PURE__ */ l(
|
|
125
|
+
x,
|
|
126
|
+
{
|
|
127
|
+
align: "center",
|
|
128
|
+
gap: "md",
|
|
129
|
+
className: t(
|
|
130
|
+
"w-full rounded-lg border border-solid border-stroke-base-primary bg-surface-base-secondary py-sm pr-2xl pl-sm",
|
|
131
|
+
o
|
|
132
|
+
),
|
|
133
|
+
...s,
|
|
134
|
+
children: [
|
|
135
|
+
/* @__PURE__ */ e(
|
|
136
|
+
n,
|
|
137
|
+
{
|
|
138
|
+
color: r,
|
|
139
|
+
className: "size-comp-button-h-sm shrink-0 rounded-md"
|
|
140
|
+
}
|
|
141
|
+
),
|
|
142
|
+
/* @__PURE__ */ e(n, { color: r, className: "h-[16px] min-w-0 flex-1" }),
|
|
143
|
+
/* @__PURE__ */ e(n, { color: r, className: "h-[16px] w-[28px] shrink-0" })
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
);
|
|
147
|
+
j.displayName = "CategoryCardSkeleton";
|
|
148
|
+
export {
|
|
149
|
+
z as CategoryCard,
|
|
150
|
+
j as CategoryCardSkeleton,
|
|
151
|
+
S as categoryCardVariants
|
|
152
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { CategoryCard } from './CategoryCard';
|
|
3
|
+
declare const meta: Meta<typeof CategoryCard>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof CategoryCard>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const AllStates: Story;
|
|
8
|
+
export declare const WithoutCount: Story;
|
|
9
|
+
export declare const LongTitle: Story;
|
|
10
|
+
export declare const AsChild: Story;
|
|
11
|
+
export declare const Grid: Story;
|
|
12
|
+
export declare const LoadingSkeleton: Story;
|
|
13
|
+
export declare const LoadingSkeletonGrid: Story;
|
|
14
|
+
//# sourceMappingURL=CategoryCard.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoryCard.stories.d.ts","sourceRoot":"","sources":["../../../src/components/CategoryCard/CategoryCard.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EAAE,YAAY,EAAwB,MAAM,gBAAgB,CAAA;AAInE,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAmCnC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAA;AAY1C,eAAO,MAAM,OAAO,EAAE,KAErB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAkCvB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAY1B,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAcvB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KA0BrB,CAAA;AAED,eAAO,MAAM,IAAI,EAAE,KA8BlB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAY7B,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,KAkBjC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CategoryCard/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* CVA variants for {@link CategoryIcon}. Exposes the `size` variant
|
|
5
|
+
* (`'sm' | 'md' | 'lg'`) that maps to the `--comp-market-category-ico-*` design tokens.
|
|
6
|
+
*/
|
|
7
|
+
declare const categoryIconVariants: (props?: ({
|
|
8
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
9
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
10
|
+
/** Props for the CategoryIcon component. */
|
|
11
|
+
export interface CategoryIconProps extends Omit<React.HTMLAttributes<HTMLSpanElement>, 'color'>, VariantProps<typeof categoryIconVariants> {
|
|
12
|
+
/**
|
|
13
|
+
* Main color of the category (any CSS color string).
|
|
14
|
+
* Drives the icon color (via `currentColor` on the container) and the
|
|
15
|
+
* derived background tint (`Color(color).alpha(0.2)`).
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <CategoryIcon color="#e3b42b" icon={<SuitcaseBold />} />
|
|
19
|
+
*/
|
|
20
|
+
color: string;
|
|
21
|
+
/**
|
|
22
|
+
* Icon node rendered inside the badge. Should use `currentColor` (Solar
|
|
23
|
+
* icons do by default) so it inherits the main color from the container.
|
|
24
|
+
*/
|
|
25
|
+
icon: React.ReactNode;
|
|
26
|
+
/** Visual size. @default 'sm' */
|
|
27
|
+
size?: 'sm' | 'md' | 'lg';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* A circular category badge: an icon over a softly tinted background derived
|
|
31
|
+
* from a single main color.
|
|
32
|
+
*
|
|
33
|
+
* Pass any CSS color string as `color` and any icon node as `icon`. The
|
|
34
|
+
* component sets `color` on the container so icons rendered with
|
|
35
|
+
* `currentColor` (the Solar icon default) inherit it automatically, and
|
|
36
|
+
* derives a 20% alpha background tint from the same color using the
|
|
37
|
+
* [color](https://www.npmjs.com/package/color) package.
|
|
38
|
+
*
|
|
39
|
+
* @component
|
|
40
|
+
* @example
|
|
41
|
+
* <CategoryIcon color="#e3b42b" icon={<SuitcaseBold />} size="lg" />
|
|
42
|
+
*/
|
|
43
|
+
declare const CategoryIcon: React.ForwardRefExoticComponent<CategoryIconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
44
|
+
export { CategoryIcon, categoryIconVariants };
|
|
45
|
+
//# sourceMappingURL=CategoryIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoryIcon.d.ts","sourceRoot":"","sources":["../../../src/components/CategoryIcon/CategoryIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAIjE;;;GAGG;AACH,QAAA,MAAM,oBAAoB;;8EAYzB,CAAA;AAED,4CAA4C;AAC5C,MAAM,WAAW,iBACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC,EAC1D,YAAY,CAAC,OAAO,oBAAoB,CAAC;IAC3C;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,iCAAiC;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CAC1B;AAYD;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,YAAY,2FAuCjB,CAAA;AAGD,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import * as g from "react";
|
|
3
|
+
import { cva as l } from "class-variance-authority";
|
|
4
|
+
import p from "color";
|
|
5
|
+
import { cn as y } from "../../utils/cn.js";
|
|
6
|
+
const d = l(
|
|
7
|
+
"inline-flex shrink-0 items-center justify-center rounded-full [&>svg]:pointer-events-none",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: "size-comp-market-category-ico-bg-size-sm [&>*]:size-comp-market-category-ico-ico-size-sm",
|
|
12
|
+
md: "size-comp-market-category-ico-bg-size-md [&>*]:size-comp-market-category-ico-ico-size-md",
|
|
13
|
+
lg: "size-comp-market-category-ico-bg-size-lg [&>*]:size-comp-market-category-ico-ico-size-lg"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
defaultVariants: { size: "sm" }
|
|
17
|
+
}
|
|
18
|
+
), f = (t) => {
|
|
19
|
+
try {
|
|
20
|
+
return p(t);
|
|
21
|
+
} catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}, a = /* @__PURE__ */ new Set(), z = g.forwardRef(
|
|
25
|
+
({ className: t, color: e, icon: c, size: i, style: r, ...n }, s) => {
|
|
26
|
+
const o = f(e);
|
|
27
|
+
return !o && process.env.NODE_ENV !== "production" && !a.has(e) && (a.add(e), console.warn(
|
|
28
|
+
`[CategoryIcon] Invalid color "${e}". Falling back to neutral styling.`
|
|
29
|
+
)), /* @__PURE__ */ m(
|
|
30
|
+
"span",
|
|
31
|
+
{
|
|
32
|
+
ref: s,
|
|
33
|
+
"data-slot": "category-icon",
|
|
34
|
+
className: y(
|
|
35
|
+
d({ size: i }),
|
|
36
|
+
o && "bg-(--category-icon-bg) text-(--category-icon-fg)",
|
|
37
|
+
t
|
|
38
|
+
),
|
|
39
|
+
style: o ? {
|
|
40
|
+
"--category-icon-bg": o.alpha(0.2).toString(),
|
|
41
|
+
"--category-icon-fg": o.toString(),
|
|
42
|
+
...r
|
|
43
|
+
} : r,
|
|
44
|
+
...n,
|
|
45
|
+
children: c
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
z.displayName = "CategoryIcon";
|
|
51
|
+
export {
|
|
52
|
+
z as CategoryIcon,
|
|
53
|
+
d as categoryIconVariants
|
|
54
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { CategoryIcon } from './CategoryIcon';
|
|
3
|
+
declare const meta: Meta<typeof CategoryIcon>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof CategoryIcon>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const AllCategories: Story;
|
|
8
|
+
export declare const AllSizes: Story;
|
|
9
|
+
export declare const CustomColor: Story;
|
|
10
|
+
//# sourceMappingURL=CategoryIcon.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CategoryIcon.stories.d.ts","sourceRoot":"","sources":["../../../src/components/CategoryIcon/CategoryIcon.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAW3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,YAAY,CAoCnC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,YAAY,CAAC,CAAA;AAY1C,eAAO,MAAM,OAAO,EAAE,KAerB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAqB3B,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAgBtB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAiBzB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/CategoryIcon/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAIjD,OAAO,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,OAAO,CAAA;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAIjD,OAAO,EAAY,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,KAAK,OAAO,EAAgB,MAAM,sBAAsB,CAAA;AAGjE;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC;IACzC,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAA;IACtB,sDAAsD;IACtD,cAAc,EAAE,MAAM,CAAA;IACtB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAA;IACb,6DAA6D;IAC7D,eAAe,EAAE,MAAM,CAAA;CACxB,CAAC,CAAA;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,4EAA4E;IAC5E,aAAa,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;IAC1C;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;KAAE,EAAE,CAAA;IACnE,qDAAqD;IACrD,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,iDAAiD;IACjD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC;;;OAGG;IACH,UAAU,CAAC,EAAE,oBAAoB,CAAA;IACjC,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0DAA0D;IAC1D,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,4CAA4C;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAA;IAC1C,+EAA+E;IAC/E,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;;;;OASG;IACH,mBAAmB,CAAC,EAAE,IAAI,CACxB,mBAAmB,EACnB,OAAO,GAAG,MAAM,GAAG,iBAAiB,GAAG,WAAW,CACnD,CAAA;IACD,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,MAAM,SAAS,CAAA;IACrC;;;;;;;OAOG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,+EAA+E;IAC/E,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,kFAAkF;IAClF,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAA;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,GAAG,IAAI,CACN,iBAAiB,EACf,gBAAgB,GAChB,WAAW,GACX,SAAS,GACT,YAAY,GACZ,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,GACf,oBAAoB,GACpB,UAAU,CACb,GACC,CAAC,oBAAoB,GAAG,qBAAqB,CAAC,CAAA;AAEhD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,6DAA6D;IAC7D,IAAI,EAAE,OAAO,CAAA;IACb,kDAAkD;IAClD,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC7B,iDAAiD;IACjD,YAAY,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IACpC,iGAAiG;IACjG,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,KAAK,IAAI,CAAA;IAChD,0EAA0E;IAC1E,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,MAAM,CAAA;CAC5C,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,qCAAqC;IACrC,IAAI,EAAE,QAAQ,CAAA;IACd,4CAA4C;IAC5C,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;IACxB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;IAC/B,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAA;IAC3C,oEAAoE;IACpE,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAA;CACvC,CAAA;AAED,eAAO,MAAM,UAAU,8GAmQtB,CAAA"}
|
|
@@ -6,11 +6,11 @@ import { Popover as pt, PopoverTrigger as nt, PopoverContent as dt } from "../Po
|
|
|
6
6
|
import { getDateRange as ut } from "./utils/getDateRange.js";
|
|
7
7
|
import { resolveOneDayRange as bt } from "./utils/resolveOneDayRange.js";
|
|
8
8
|
import { Input as st } from "../Input/Input.js";
|
|
9
|
-
import { formatDate as xt } from "../Calendar/utils/formatDate.js";
|
|
10
|
-
import { formatDateRange as lt } from "../Calendar/utils/formatDateRange.js";
|
|
11
9
|
import { Calendar as A } from "../Calendar/Calendar.js";
|
|
12
10
|
import { cn as l } from "../../utils/cn.js";
|
|
13
|
-
import { typographyVariants as
|
|
11
|
+
import { typographyVariants as xt } from "../Typography/Typography.js";
|
|
12
|
+
import { formatDate as lt } from "../../utils/formatDate.js";
|
|
13
|
+
import { formatDateRange as yt } from "../../utils/formatDateRange.js";
|
|
14
14
|
import { CalendarBold as mt } from "@solar-icons/react-perf";
|
|
15
15
|
const vt = et(
|
|
16
16
|
({
|
|
@@ -64,7 +64,7 @@ const vt = et(
|
|
|
64
64
|
"button",
|
|
65
65
|
{
|
|
66
66
|
className: l(
|
|
67
|
-
|
|
67
|
+
xt({
|
|
68
68
|
variant: "cta",
|
|
69
69
|
weight: "medium",
|
|
70
70
|
size: "sm",
|
|
@@ -83,7 +83,7 @@ const vt = et(
|
|
|
83
83
|
children: t.name
|
|
84
84
|
},
|
|
85
85
|
t.type
|
|
86
|
-
)), D = H ?? (y === "single" ?
|
|
86
|
+
)), D = H ?? (y === "single" ? lt : yt), F = f ? e !== void 0 ? e : i : j, E = {
|
|
87
87
|
...a,
|
|
88
88
|
numberOfMonths: Z ?? (h ? 2 : 1),
|
|
89
89
|
hideNavigation: _,
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
declare const dotDividerVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "invert" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
/** Props for the DotDivider component. */
|
|
7
|
+
export interface DotDividerProps extends React.HTMLAttributes<HTMLSpanElement>, VariantProps<typeof dotDividerVariants> {
|
|
8
|
+
/**
|
|
9
|
+
* Visual variant of the dot.
|
|
10
|
+
*
|
|
11
|
+
* - `default` — dark dot for use on light surfaces.
|
|
12
|
+
* - `invert` — light dot for use on dark surfaces.
|
|
13
|
+
*
|
|
14
|
+
* @default 'default'
|
|
15
|
+
*/
|
|
16
|
+
variant?: 'default' | 'invert';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A small decorative dot used as an inline separator between metadata pieces
|
|
20
|
+
* (e.g. `Author • Date • Category`).
|
|
21
|
+
*
|
|
22
|
+
* The dot is purely visual and is hidden from assistive technologies via
|
|
23
|
+
* `aria-hidden`. Use a comma or other punctuation in the underlying text if
|
|
24
|
+
* the separation needs to be conveyed semantically.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* <span className="inline-flex items-center gap-2">
|
|
28
|
+
* <span>Author</span>
|
|
29
|
+
* <DotDivider />
|
|
30
|
+
* <span>Date</span>
|
|
31
|
+
* </span>
|
|
32
|
+
*/
|
|
33
|
+
declare const DotDivider: React.ForwardRefExoticComponent<DotDividerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
34
|
+
export { DotDivider, dotDividerVariants };
|
|
35
|
+
//# sourceMappingURL=DotDivider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotDivider.d.ts","sourceRoot":"","sources":["../../../src/components/DotDivider/DotDivider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,KAAK,YAAY,EAAO,MAAM,0BAA0B,CAAA;AAGjE,QAAA,MAAM,kBAAkB;;8EAWvB,CAAA;AAED,0CAA0C;AAC1C,MAAM,WAAW,eACf,SAAQ,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC,EAC3C,YAAY,CAAC,OAAO,kBAAkB,CAAC;IACzC;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;CAC/B;AAED;;;;;;;;;;;;;;GAcG;AACH,QAAA,MAAM,UAAU,yFASf,CAAA;AAGD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import { cva as o } from "class-variance-authority";
|
|
4
|
+
import { cn as n } from "../../utils/cn.js";
|
|
5
|
+
const m = o(
|
|
6
|
+
"inline-block size-comp-dot-divider-default shrink-0 rounded-full",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "bg-comp-dot-divider-def",
|
|
11
|
+
invert: "bg-comp-dot-divider-invert"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
defaultVariants: { variant: "default" }
|
|
15
|
+
}
|
|
16
|
+
), s = e.forwardRef(
|
|
17
|
+
({ className: i, variant: r, ...t }, a) => /* @__PURE__ */ d(
|
|
18
|
+
"span",
|
|
19
|
+
{
|
|
20
|
+
ref: a,
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: n(m({ variant: r, className: i })),
|
|
23
|
+
...t
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
s.displayName = "DotDivider";
|
|
28
|
+
export {
|
|
29
|
+
s as DotDivider,
|
|
30
|
+
m as dotDividerVariants
|
|
31
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { DotDivider } from './DotDivider';
|
|
3
|
+
declare const meta: Meta<typeof DotDivider>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof DotDivider>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Invert: Story;
|
|
8
|
+
export declare const AllVariants: Story;
|
|
9
|
+
export declare const InContext: Story;
|
|
10
|
+
//# sourceMappingURL=DotDivider.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DotDivider.stories.d.ts","sourceRoot":"","sources":["../../../src/components/DotDivider/DotDivider.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAgCjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAExC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE,KAsBpB,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAmCzB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAmBvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/DotDivider/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const heartButtonVariants: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
3
|
+
/**
|
|
4
|
+
* Props for the HeartButton component.
|
|
5
|
+
*
|
|
6
|
+
* A 32×32 circular icon-only toggle that flips between an outlined and a
|
|
7
|
+
* filled heart. Supports controlled (`active`) and uncontrolled
|
|
8
|
+
* (`defaultActive`) usage.
|
|
9
|
+
*
|
|
10
|
+
* **Render mode is auto-detected.** When neither `onClick` nor
|
|
11
|
+
* `defaultActive` is provided, the component renders as a non-interactive
|
|
12
|
+
* `<span role="img">` instead of a `<button>` — useful for surfacing
|
|
13
|
+
* favorite status in read-only listings. As soon as either prop is set,
|
|
14
|
+
* the component renders as a `<button>` and behaves as a toggle.
|
|
15
|
+
*
|
|
16
|
+
* The ref's concrete element type depends on the render mode: it is
|
|
17
|
+
* `HTMLButtonElement` in interactive mode and `HTMLSpanElement` in
|
|
18
|
+
* display-only mode.
|
|
19
|
+
*/
|
|
20
|
+
export interface HeartButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onClick' | 'type'> {
|
|
21
|
+
/**
|
|
22
|
+
* Controlled active (favorited) state. When provided, the component does
|
|
23
|
+
* not manage its own state — pair with `onClick` to update. Used alone
|
|
24
|
+
* (without `onClick` or `defaultActive`), it drives the display-only
|
|
25
|
+
* render path.
|
|
26
|
+
*/
|
|
27
|
+
active?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Initial active state for uncontrolled usage. Ignored when `active` is
|
|
30
|
+
* provided. Passing this prop signals that the consumer wants the
|
|
31
|
+
* component to manage its own toggle state, so the component renders as
|
|
32
|
+
* an interactive `<button>` even when `onClick` is omitted.
|
|
33
|
+
*/
|
|
34
|
+
defaultActive?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Fires when the button is clicked. Receives the native mouse event and
|
|
37
|
+
* the **next** active value (post-toggle). When the component is
|
|
38
|
+
* uncontrolled, the internal state has already been updated to
|
|
39
|
+
* `nextActive` by the time this fires.
|
|
40
|
+
*
|
|
41
|
+
* Omitting `onClick` (and `defaultActive`) switches the component to the
|
|
42
|
+
* display-only `<span role="img">` render path.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* <HeartButton onClick={(_e, next) => saveFavorite(next)} />
|
|
46
|
+
*/
|
|
47
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>, nextActive: boolean) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Prevents interaction and applies disabled styling. Visual-only in
|
|
50
|
+
* display mode (no interaction to prevent). @default false
|
|
51
|
+
*/
|
|
52
|
+
disabled?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Accessible label for the icon-only control. Defaults to
|
|
55
|
+
* `translations.heartButton.toggleFavorite`.
|
|
56
|
+
*/
|
|
57
|
+
'aria-label'?: string;
|
|
58
|
+
}
|
|
59
|
+
declare const HeartButton: React.ForwardRefExoticComponent<HeartButtonProps & React.RefAttributes<HTMLButtonElement | HTMLSpanElement>>;
|
|
60
|
+
export { HeartButton, heartButtonVariants };
|
|
61
|
+
//# sourceMappingURL=HeartButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeartButton.d.ts","sourceRoot":"","sources":["../../../src/components/HeartButton/HeartButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,QAAA,MAAM,mBAAmB,oFAUvB,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,gBACf,SAAQ,IAAI,CACV,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAC7C,UAAU,GAAG,SAAS,GAAG,MAAM,CAChC;IACD;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,EAAE,CACR,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAC1C,UAAU,EAAE,OAAO,KAChB,IAAI,CAAA;IACT;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,QAAA,MAAM,WAAW,8GAqFhB,CAAA;AAGD,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as o, jsxs as N, Fragment as j } from "react/jsx-runtime";
|
|
2
|
+
import * as p from "react";
|
|
3
|
+
import { cva as y } from "class-variance-authority";
|
|
4
|
+
import { useMuzaTranslationContext as z } from "../../translations/TranslationContext.js";
|
|
5
|
+
import { cn as b } from "../../utils/cn.js";
|
|
6
|
+
import { HeartOutline as A, HeartBold as F } from "@solar-icons/react-perf";
|
|
7
|
+
const v = y([
|
|
8
|
+
"group inline-flex size-comp-button-h-xs shrink-0 items-center justify-center rounded-full",
|
|
9
|
+
"bg-transparent transition-colors",
|
|
10
|
+
"focus-visible-default",
|
|
11
|
+
"[&>svg]:size-icon-small [&>svg]:shrink-0",
|
|
12
|
+
"text-comp-button-invert-ghost-text-def",
|
|
13
|
+
"hover:text-comp-button-invert-ghost-text-hover",
|
|
14
|
+
"focus-visible:text-comp-button-invert-ghost-text-focused",
|
|
15
|
+
"disabled:pointer-events-none disabled:text-comp-button-invert-ghost-text-disabled",
|
|
16
|
+
"data-[disabled=true]:pointer-events-none data-[disabled=true]:text-comp-button-invert-ghost-text-disabled"
|
|
17
|
+
]), I = p.forwardRef(
|
|
18
|
+
({
|
|
19
|
+
active: n,
|
|
20
|
+
defaultActive: s,
|
|
21
|
+
onClick: t,
|
|
22
|
+
disabled: a = !1,
|
|
23
|
+
className: r,
|
|
24
|
+
"aria-label": h,
|
|
25
|
+
...i
|
|
26
|
+
}, d) => {
|
|
27
|
+
const { translations: f } = z(), x = t !== void 0 || s !== void 0, l = h ?? f.heartButton.toggleFavorite, [g, B] = p.useState(
|
|
28
|
+
s ?? !1
|
|
29
|
+
), c = n !== void 0, e = c ? n : g, u = /* @__PURE__ */ N(j, { children: [
|
|
30
|
+
/* @__PURE__ */ o(
|
|
31
|
+
A,
|
|
32
|
+
{
|
|
33
|
+
"aria-hidden": "true",
|
|
34
|
+
className: "group-data-[state=on]:hidden"
|
|
35
|
+
}
|
|
36
|
+
),
|
|
37
|
+
/* @__PURE__ */ o(
|
|
38
|
+
F,
|
|
39
|
+
{
|
|
40
|
+
"aria-hidden": "true",
|
|
41
|
+
className: "hidden group-data-[state=on]:block"
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
] });
|
|
45
|
+
return x ? /* @__PURE__ */ o(
|
|
46
|
+
"button",
|
|
47
|
+
{
|
|
48
|
+
ref: d,
|
|
49
|
+
type: "button",
|
|
50
|
+
"data-slot": "heart-button",
|
|
51
|
+
"data-state": e ? "on" : "off",
|
|
52
|
+
"data-disabled": a || void 0,
|
|
53
|
+
"aria-pressed": e,
|
|
54
|
+
"aria-label": l,
|
|
55
|
+
disabled: a,
|
|
56
|
+
onClick: (H) => {
|
|
57
|
+
const m = !e;
|
|
58
|
+
c || B(m), t == null || t(H, m);
|
|
59
|
+
},
|
|
60
|
+
className: b(v(), "cursor-pointer", r),
|
|
61
|
+
...i,
|
|
62
|
+
children: u
|
|
63
|
+
}
|
|
64
|
+
) : /* @__PURE__ */ o(
|
|
65
|
+
"span",
|
|
66
|
+
{
|
|
67
|
+
ref: d,
|
|
68
|
+
"data-slot": "heart-button",
|
|
69
|
+
"data-state": e ? "on" : "off",
|
|
70
|
+
"data-disabled": a || void 0,
|
|
71
|
+
role: "img",
|
|
72
|
+
"aria-label": l,
|
|
73
|
+
className: b(
|
|
74
|
+
v(),
|
|
75
|
+
"pointer-events-none",
|
|
76
|
+
r
|
|
77
|
+
),
|
|
78
|
+
...i,
|
|
79
|
+
children: u
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
);
|
|
84
|
+
I.displayName = "HeartButton";
|
|
85
|
+
export {
|
|
86
|
+
I as HeartButton,
|
|
87
|
+
v as heartButtonVariants
|
|
88
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { HeartButton } from './HeartButton';
|
|
3
|
+
declare const meta: Meta<typeof HeartButton>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof HeartButton>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const Uncontrolled: Story;
|
|
8
|
+
export declare const DisplayOnly: Story;
|
|
9
|
+
export declare const AllStates: Story;
|
|
10
|
+
//# sourceMappingURL=HeartButton.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeartButton.stories.d.ts","sourceRoot":"","sources":["../../../src/components/HeartButton/HeartButton.stories.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CAuClC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAA;AAEzC,eAAO,MAAM,OAAO,EAAE,KAqBrB,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAa1B,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,KAyBzB,CAAA;AAID,eAAO,MAAM,SAAS,EAAE,KA2EvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/HeartButton/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
|