@cakejp/design-system 0.11.0 → 0.13.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +85 -1
  2. package/CLAUDE.md +22 -1
  3. package/README.md +48 -0
  4. package/UPDATING.md +9 -0
  5. package/bin/check-duplicates.mjs +256 -0
  6. package/bin/exports-parser.mjs +54 -0
  7. package/bin/init.js +11 -0
  8. package/contracts/components.json +395 -37
  9. package/contracts/composition.json +10 -7
  10. package/contracts/rules.json +21 -3
  11. package/dist/index.css +1 -1
  12. package/dist/index.js +6134 -3475
  13. package/dist/types/components/ec/admin-shell.d.ts +39 -2
  14. package/dist/types/components/ec/mypage-shell.d.ts +10 -1
  15. package/dist/types/components/ec/product-card.d.ts +3 -1
  16. package/dist/types/components/ec/product-list-item.d.ts +8 -1
  17. package/dist/types/components/foundations/alert.d.ts +5 -1
  18. package/dist/types/components/foundations/button.d.ts +1 -1
  19. package/dist/types/components/foundations/card.d.ts +36 -2
  20. package/dist/types/components/foundations/chip-variants.d.ts +17 -0
  21. package/dist/types/components/foundations/field.d.ts +81 -0
  22. package/dist/types/components/foundations/file-input.d.ts +75 -0
  23. package/dist/types/components/foundations/icon-badge.d.ts +2 -2
  24. package/dist/types/components/foundations/input.d.ts +11 -1
  25. package/dist/types/components/foundations/radio-group.d.ts +12 -2
  26. package/dist/types/components/foundations/skip-link.d.ts +39 -0
  27. package/dist/types/components/foundations/textarea.d.ts +11 -1
  28. package/dist/types/components/primitives/chat-composer.d.ts +87 -0
  29. package/dist/types/components/primitives/chip.d.ts +2 -7
  30. package/dist/types/components/primitives/content-carousel.d.ts +58 -0
  31. package/dist/types/components/primitives/date-picker.d.ts +44 -0
  32. package/dist/types/components/primitives/error-state.d.ts +43 -16
  33. package/dist/types/components/primitives/funnel-shell.d.ts +12 -1
  34. package/dist/types/components/primitives/header.d.ts +15 -1
  35. package/dist/types/components/primitives/image-input.d.ts +119 -0
  36. package/dist/types/components/primitives/section-header.d.ts +9 -2
  37. package/dist/types/components/primitives/section-nav.d.ts +28 -2
  38. package/dist/types/components/primitives/section.d.ts +35 -2
  39. package/dist/types/components/primitives/share-buttons.d.ts +8 -2
  40. package/dist/types/components/primitives/standard-page-shell.d.ts +11 -1
  41. package/dist/types/components/primitives/timeline.d.ts +23 -0
  42. package/dist/types/components/primitives/workspace-shell.d.ts +21 -1
  43. package/dist/types/index.d.ts +80 -4
  44. package/dist/types/lib/pagination-range.d.ts +16 -0
  45. package/dist/types/lib/use-value-length.d.ts +31 -0
  46. package/package.json +2 -1
  47. package/src/preset-standalone.css +322 -4
  48. package/src/preset.css +17 -0
  49. package/src/styles/semantic.css +7 -0
  50. package/src/styles/typography.css +15 -1
  51. package/templates/AGENTS.md +11 -0
  52. package/templates/CLAUDE.md +11 -0
  53. package/tokens.json +18 -2
@@ -1,5 +1,6 @@
1
1
  import "./index.css";
2
2
  export { cn } from "./lib/utils";
3
+ export { toast } from "sonner";
3
4
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "./components/foundations/accordion";
4
5
  export { Alert, AlertDescription, AlertTitle } from "./components/foundations/alert";
5
6
  export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from "./components/foundations/alert-dialog";
@@ -9,10 +10,12 @@ export { Badge, badgeVariants } from "./components/foundations/badge";
9
10
  export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./components/foundations/breadcrumb";
10
11
  export { Button, buttonVariants } from "./components/foundations/button";
11
12
  export { Calendar } from "./components/foundations/calendar";
12
- export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/foundations/card";
13
+ export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cardVariants } from "./components/foundations/card";
13
14
  export { Checkbox } from "./components/foundations/checkbox";
14
15
  export type { CheckboxProps } from "./components/foundations/checkbox";
15
16
  export { CheckboxCardGroup, CheckboxCardItem } from "./components/foundations/checkbox-card";
17
+ export { CheckboxGroup, CheckboxGroupItem } from "./components/foundations/checkbox-group";
18
+ export type { CheckboxGroupProps } from "./components/foundations/checkbox-group";
16
19
  export { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./components/foundations/collapsible";
17
20
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from "./components/foundations/command";
18
21
  export { ContextMenu, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuSeparator, ContextMenuShortcut, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger } from "./components/foundations/context-menu";
@@ -20,29 +23,40 @@ export { DataTable } from "./components/foundations/data-table";
20
23
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./components/foundations/dialog";
21
24
  export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger } from "./components/foundations/drawer";
22
25
  export { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger } from "./components/foundations/dropdown-menu";
26
+ export { Field, FieldLabel, FieldSet, FieldLegend, FieldGroup, FieldDescription, FieldError, FieldSeparator, fieldVariants } from "./components/foundations/field";
27
+ export type { FieldProps } from "./components/foundations/field";
28
+ export { FileInput, formatFileNames, validateFileSize } from "./components/foundations/file-input";
29
+ export type { FileInputProps, FileInputError } from "./components/foundations/file-input";
23
30
  export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField } from "./components/foundations/form";
24
31
  export { HoverCard, HoverCardContent, HoverCardTrigger } from "./components/foundations/hover-card";
25
32
  export { IconBadge, iconBadgeVariants } from "./components/foundations/icon-badge";
26
33
  export { Input } from "./components/foundations/input";
34
+ export type { InputProps } from "./components/foundations/input";
27
35
  export { Label } from "./components/foundations/label";
28
36
  export { Menubar, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarSeparator, MenubarShortcut, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger } from "./components/foundations/menubar";
29
37
  export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, navigationMenuTriggerStyle } from "./components/foundations/navigation-menu";
30
38
  export { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "./components/foundations/pagination";
31
- export { Popover, PopoverContent, PopoverTrigger } from "./components/foundations/popover";
39
+ export { getPaginationRange } from "./lib/pagination-range";
40
+ export type { GetPaginationRangeOptions, PaginationRangeItem } from "./lib/pagination-range";
41
+ export { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./components/foundations/popover";
32
42
  export { Progress } from "./components/foundations/progress";
33
43
  export { ResponsiveDialog, ResponsiveDialogClose, ResponsiveDialogContent, ResponsiveDialogDescription, ResponsiveDialogFooter, ResponsiveDialogHeader, ResponsiveDialogTitle, ResponsiveDialogTrigger, useIsMobile } from "./components/foundations/responsive-dialog";
34
44
  export { RadioGroup, RadioGroupItem } from "./components/foundations/radio-group";
45
+ export type { RadioGroupVariant } from "./components/foundations/radio-group";
35
46
  export { ScrollArea, ScrollBar } from "./components/foundations/scroll-area";
36
47
  export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue } from "./components/foundations/select";
37
48
  export { Separator } from "./components/foundations/separator";
38
49
  export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./components/foundations/sheet";
39
50
  export { Skeleton } from "./components/foundations/skeleton";
51
+ export { SkipLink } from "./components/foundations/skip-link";
52
+ export type { SkipLinkProps } from "./components/foundations/skip-link";
40
53
  export { Slider } from "./components/foundations/slider";
41
54
  export { Spinner } from "./components/foundations/spinner";
42
55
  export { Switch } from "./components/foundations/switch";
43
56
  export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "./components/foundations/table";
44
57
  export { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/foundations/tabs";
45
58
  export { Textarea } from "./components/foundations/textarea";
59
+ export type { TextareaProps } from "./components/foundations/textarea";
46
60
  export { Toaster } from "./components/foundations/sonner";
47
61
  export { Toggle, toggleVariants } from "./components/foundations/toggle";
48
62
  export { ToggleGroup, ToggleGroupItem } from "./components/foundations/toggle-group";
@@ -52,14 +66,22 @@ export type { AdminSideNavProps, AdminNavItem, AdminNavSubItem, AdminNavIconCont
52
66
  export { AdminHeader } from "./components/primitives/admin-header";
53
67
  export type { AdminHeaderProps } from "./components/primitives/admin-header";
54
68
  export { CoachMark } from "./components/primitives/coach-mark";
69
+ export type { CoachMarkProps, CoachMarkDirection } from "./components/primitives/coach-mark";
55
70
  export { BannerCarousel } from "./components/primitives/banner-carousel";
71
+ export type { BannerCarouselProps, BannerItem } from "./components/primitives/banner-carousel";
72
+ export { ContentCarousel } from "./components/primitives/content-carousel";
73
+ export type { ContentCarouselProps, ContentCarouselItemsPerView } from "./components/primitives/content-carousel";
56
74
  export { StickyActionBar } from "./components/primitives/sticky-action-bar";
57
75
  export { BottomTabBar } from "./components/primitives/bottom-tab-bar";
76
+ export type { BottomTabBarProps, BottomTabBarItem } from "./components/primitives/bottom-tab-bar";
58
77
  export { BulkActionBar } from "./components/primitives/bulk-action-bar";
78
+ export type { BulkActionBarProps } from "./components/primitives/bulk-action-bar";
59
79
  export { CategoryShortcuts } from "./components/primitives/category-shortcuts";
60
80
  export type { CategoryShortcutsProps, CategoryShortcutsItem } from "./components/primitives/category-shortcuts";
61
81
  export { CategoryScroll } from "./components/primitives/category-scroll";
62
82
  export type { CategoryScrollProps, CategoryItem } from "./components/primitives/category-scroll";
83
+ export { ChatComposer } from "./components/primitives/chat-composer";
84
+ export type { ChatComposerProps, ChatComposerAttachmentError } from "./components/primitives/chat-composer";
63
85
  export { Chip, chipVariants } from "./components/primitives/chip";
64
86
  export type { ChipProps } from "./components/primitives/chip";
65
87
  export { StandardPageShell } from "./components/primitives/standard-page-shell";
@@ -73,38 +95,70 @@ export { StandardPageShell as EcPageShell } from "./components/primitives/standa
73
95
  /** @deprecated 旧名。`StandardPageShellProps` を使うこと。次のメジャーで削除する。 */
74
96
  export type { StandardPageShellProps as EcPageShellProps } from "./components/primitives/standard-page-shell";
75
97
  export { EmptyState } from "./components/primitives/empty-state";
76
- export { ErrorState } from "./components/primitives/error-state";
98
+ export type { EmptyStateProps } from "./components/primitives/empty-state";
99
+ export { DatePicker, DateTimePicker } from "./components/primitives/date-picker";
100
+ export type { DatePickerProps, DateTimePickerProps } from "./components/primitives/date-picker";
101
+ export { ErrorState, NotFoundIllustration } from "./components/primitives/error-state";
102
+ export type { ErrorStateProps, ErrorStateKind, NotFoundIllustrationProps } from "./components/primitives/error-state";
77
103
  export { FilterBar } from "./components/primitives/filter-bar";
104
+ export type { FilterBarProps, FilterChip } from "./components/primitives/filter-bar";
78
105
  export { Footer } from "./components/primitives/footer";
106
+ export type { FooterProps, FooterLink, FooterLinkGroup, FooterPaymentMethod, FooterTrustBadge } from "./components/primitives/footer";
79
107
  export { FormField as CakeFormField } from "./components/primitives/form-field";
108
+ export type { FormFieldProps as CakeFormFieldProps } from "./components/primitives/form-field";
80
109
  export { FunnelShell } from "./components/primitives/funnel-shell";
81
110
  export type { FunnelShellProps, FunnelStep } from "./components/primitives/funnel-shell";
82
111
  export { Header } from "./components/primitives/header";
112
+ export type { HeaderProps, HeaderAction, HeaderNavItem } from "./components/primitives/header";
83
113
  export { ImageCarousel } from "./components/primitives/image-carousel";
114
+ export type { ImageCarouselProps } from "./components/primitives/image-carousel";
84
115
  export { ImageGallery } from "./components/primitives/image-gallery";
116
+ export type { ImageGalleryProps } from "./components/primitives/image-gallery";
117
+ export { ImageInput, imageInputPreviewVariants } from "./components/primitives/image-input";
118
+ export type { ImageInputProps, ImageInputValidationError } from "./components/primitives/image-input";
85
119
  export { ImageUploader } from "./components/primitives/image-uploader";
120
+ export type { ImageUploaderProps, ImageUploaderImage } from "./components/primitives/image-uploader";
86
121
  export { KebabMenu } from "./components/primitives/kebab-menu";
122
+ export type { KebabMenuProps, KebabMenuItem } from "./components/primitives/kebab-menu";
87
123
  export { ListItem } from "./components/primitives/list-item";
124
+ export type { ListItemProps } from "./components/primitives/list-item";
88
125
  export { MenuDrawer } from "./components/primitives/menu-drawer";
126
+ export type { MenuDrawerProps, MenuSection, MenuItem, MenuBanner } from "./components/primitives/menu-drawer";
89
127
  export { SubNav } from "./components/primitives/sub-nav";
128
+ export type { SubNavProps, SubNavItem } from "./components/primitives/sub-nav";
90
129
  export { NotificationBadge, notificationBadgeVariants } from "./components/primitives/notification-badge";
130
+ export type { NotificationBadgeProps } from "./components/primitives/notification-badge";
91
131
  export { NotificationList } from "./components/primitives/notification-list";
132
+ export type { NotificationListProps, NotificationItem } from "./components/primitives/notification-list";
92
133
  export { PriceDisplay, priceDisplayVariants } from "./components/primitives/price-display";
134
+ export type { PriceDisplayProps } from "./components/primitives/price-display";
93
135
  export { ProgressSteps } from "./components/primitives/progress-steps";
136
+ export type { ProgressStepsProps } from "./components/primitives/progress-steps";
137
+ export { Timeline } from "./components/primitives/timeline";
138
+ export type { TimelineItem, TimelineProps } from "./components/primitives/timeline";
94
139
  export { QuantitySelector } from "./components/primitives/quantity-selector";
140
+ export type { QuantitySelectorProps } from "./components/primitives/quantity-selector";
95
141
  export { SearchBar } from "./components/primitives/search-bar";
142
+ export type { SearchBarProps } from "./components/primitives/search-bar";
96
143
  export { SearchPanel } from "./components/primitives/search-panel";
144
+ export type { SearchPanelProps } from "./components/primitives/search-panel";
97
145
  export { Container, containerVariants } from "./components/primitives/container";
98
- export { Section, sectionVariants } from "./components/primitives/section";
146
+ export { Section, sectionVariants, sectionScrimVariants } from "./components/primitives/section";
147
+ export type { SectionProps, SectionScrim } from "./components/primitives/section";
99
148
  export { SectionHeader } from "./components/primitives/section-header";
149
+ export type { SectionHeaderDesktopSize, SectionHeaderProps, SectionHeaderSize, } from "./components/primitives/section-header";
100
150
  export { SectionNav } from "./components/primitives/section-nav";
101
151
  export type { SectionNavProps, SectionNavItem } from "./components/primitives/section-nav";
102
152
  export { ShareButtons } from "./components/primitives/share-buttons";
153
+ export type { ShareButtonsProps } from "./components/primitives/share-buttons";
103
154
  export { SideNav } from "./components/primitives/side-nav";
104
155
  export type { SideNavProps, SideNavGroup, SideNavItem } from "./components/primitives/side-nav";
105
156
  export { SocialLoginButton } from "./components/primitives/social-login-button";
157
+ export type { SocialLoginButtonProps, SocialProvider } from "./components/primitives/social-login-button";
106
158
  export { StatusCountTabs } from "./components/primitives/status-count-tabs";
159
+ export type { StatusCountTabsProps } from "./components/primitives/status-count-tabs";
107
160
  export { Tag, tagVariants } from "./components/primitives/tag";
161
+ export type { TagProps } from "./components/primitives/tag";
108
162
  export { WorkspaceShell } from "./components/primitives/workspace-shell";
109
163
  export type { WorkspaceShellProps } from "./components/primitives/workspace-shell";
110
164
  /**
@@ -126,27 +180,49 @@ export { AdminShell as AdminLayout } from "./components/ec/admin-shell";
126
180
  /** @deprecated 旧名。`AdminShellProps` を使うこと。次のメジャーで削除する。 */
127
181
  export type { AdminShellProps as AdminLayoutProps } from "./components/ec/admin-shell";
128
182
  export { AnniversaryCard } from "./components/ec/anniversary-card";
183
+ export type { AnniversaryCardProps } from "./components/ec/anniversary-card";
129
184
  export { CakeLogo } from "./components/ec/cake-logo";
185
+ export type { CakeLogoProps } from "./components/ec/cake-logo";
130
186
  export { ChartControls } from "./components/ec/chart-controls";
187
+ export type { ChartControlsProps, ChartGranularity, ChartPeriod } from "./components/ec/chart-controls";
131
188
  export { CountdownTimer } from "./components/ec/countdown-timer";
189
+ export type { CountdownTimerProps } from "./components/ec/countdown-timer";
132
190
  export { CouponCard } from "./components/ec/coupon-card";
191
+ export type { CouponCardProps } from "./components/ec/coupon-card";
133
192
  export { DeliveryCalendar } from "./components/ec/delivery-calendar";
193
+ export type { DeliveryCalendarProps, DayAvailability, CalendarDay } from "./components/ec/delivery-calendar";
134
194
  export { mypageMenuGroups } from "./components/ec/_mypage-menu-data";
135
195
  export { OrderSection } from "./components/ec/order-section";
196
+ export type { OrderSectionProps } from "./components/ec/order-section";
136
197
  export { OrderSummary } from "./components/ec/order-summary";
198
+ export type { OrderSummaryProps, OrderSummaryLineItem } from "./components/ec/order-summary";
137
199
  export { PaymentMethodDisplay, CreditCardIcon } from "./components/ec/payment-method";
200
+ export type { PaymentMethodDisplayProps, CreditCardIconProps, CreditCardBrand } from "./components/ec/payment-method";
138
201
  export { ProductCard } from "./components/ec/product-card";
202
+ export type { ProductCardProps } from "./components/ec/product-card";
139
203
  export { ProductCarousel } from "./components/ec/product-carousel";
204
+ export type { ProductCarouselProps } from "./components/ec/product-carousel";
140
205
  export { ProductCTA } from "./components/ec/product-cta";
206
+ export type { ProductCTAProps, ProductCTAVariant } from "./components/ec/product-cta";
141
207
  export { ProductDetailBar } from "./components/ec/product-detail-bar";
208
+ export type { ProductDetailBarProps, ProductDetailBarTab } from "./components/ec/product-detail-bar";
142
209
  export { ProductDetailSidebar } from "./components/ec/product-detail-sidebar";
210
+ export type { ProductDetailSidebarProps, SizeOption, CouponInfo, ProductTag, PromoBanner, PointInfo } from "./components/ec/product-detail-sidebar";
143
211
  export { ProductListItem } from "./components/ec/product-list-item";
212
+ export type { ProductListItemProps, ProductListItemTag } from "./components/ec/product-list-item";
144
213
  export { ProductOption, OptionQuantity, OptionSelect, OptionText, OptionImageUpload } from "./components/ec/product-option";
214
+ export type { ProductOptionProps, ProductOptionType, OptionQuantityProps, OptionSelectProps, OptionTextProps } from "./components/ec/product-option";
145
215
  export { RatingStars, SparkleIcon } from "./components/ec/rating-stars";
216
+ export type { RatingStarsProps } from "./components/ec/rating-stars";
146
217
  export { ReviewCard } from "./components/ec/review-card";
218
+ export type { ReviewCardProps } from "./components/ec/review-card";
147
219
  export { ReviewForm } from "./components/ec/review-form";
220
+ export type { ReviewFormProps } from "./components/ec/review-form";
148
221
  export { ReviewSummary, ReviewItem } from "./components/ec/review-summary";
222
+ export type { ReviewSummaryProps, ReviewGaugeItem, ReviewItemProps } from "./components/ec/review-summary";
149
223
  export { MypageShell } from "./components/ec/mypage-shell";
150
224
  export type { MypageShellProps, MypageShellBreadcrumb } from "./components/ec/mypage-shell";
151
225
  export { ShopCard } from "./components/ec/shop-card";
226
+ export type { ShopCardProps } from "./components/ec/shop-card";
152
227
  export { StatCard } from "./components/ec/stat-card";
228
+ export type { StatCardProps } from "./components/ec/stat-card";
@@ -0,0 +1,16 @@
1
+ export type PaginationRangeItem = number | "ellipsis";
2
+ export interface GetPaginationRangeOptions {
3
+ /** 現在ページ(1始まり)。範囲外は 1〜totalPages に丸める */
4
+ currentPage: number;
5
+ /** 総ページ数。0以下は空配列を返す */
6
+ totalPages: number;
7
+ /** 現在ページの左右に常時表示するページ数 */
8
+ siblingCount?: number;
9
+ }
10
+ /**
11
+ * ページネーションに表示するページ番号と省略記号の窓を返す。
12
+ *
13
+ * 先頭・末尾ページは常に残し、現在ページの前後を siblingCount 件ずつ表示する。
14
+ * 描画は既存の PaginationItem / PaginationLink / PaginationEllipsis を使う。
15
+ */
16
+ export declare function getPaginationRange({ currentPage, totalPages, siblingCount, }: GetPaginationRangeOptions): PaginationRangeItem[];
@@ -0,0 +1,31 @@
1
+ import * as React from "react";
2
+ type CountableElement = HTMLInputElement | HTMLTextAreaElement;
3
+ /**
4
+ * `showCount` 用の文字数を求めるための内部フック。
5
+ *
6
+ * 制御(`value` 指定)のときは `value` をそのまま数える。
7
+ * 非制御のときは **内部 state ではなく実際の DOM の `value`** を数える。
8
+ * react-hook-form の `register()` は `ref` 経由で DOM に直接初期値を書き込み
9
+ * (`reset()` / `defaultValues`)、その経路では `onChange` が発火しないため、
10
+ * 内部 state だけを見ていると初期表示のカウントが 0 のままになる。
11
+ *
12
+ * 初期表示は layout effect で DOM を読み、以後の programmatic な `.value` 代入は
13
+ * 要素自身の value descriptor を監視して拾う。MutationObserver は DOM property の
14
+ * 変更を観測できず、RHF の `setValue()` は再 render を伴わない場合があるため。
15
+ * 元 descriptor(React の value tracker を含む)へ処理を委譲し、detach 時に復元する。
16
+ *
17
+ * consumer の callback ref が返す cleanup は保持し、detach 時に実行する。
18
+ * cleanup を返さない従来の callback ref は detach 時に null を渡すため、
19
+ * React 18/19 どちらの ref 契約も維持する。
20
+ */
21
+ export declare function useValueLength<T extends CountableElement>({ enabled, value, defaultValue, forwardedRef, }: {
22
+ enabled: boolean;
23
+ value: string | number | readonly string[] | undefined;
24
+ defaultValue: string | number | readonly string[] | undefined;
25
+ forwardedRef: React.Ref<T> | undefined;
26
+ }): {
27
+ ref: React.RefCallback<T>;
28
+ length: number;
29
+ syncFromDom: () => void;
30
+ };
31
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cakejp/design-system",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "description": "Cake.jp Design System — UI コンポーネント・カラートークン・タイポグラフィ",
6
6
  "license": "UNLICENSED",
@@ -153,6 +153,7 @@
153
153
  "eslint-plugin-storybook": "^10.3.3",
154
154
  "globals": "^16.5.0",
155
155
  "iconsax-reactjs": "^0.0.8",
156
+ "jsdom": "^29.1.1",
156
157
  "lucide-react": "^0.577.0",
157
158
  "next-themes": "^0.4.6",
158
159
  "playwright": "^1.58.2",
@@ -26,11 +26,312 @@
26
26
  * 以下の「Typography Helper」セクションで提供する。
27
27
  * ============================================ */
28
28
 
29
- /* --- Layer 1: Primitive Colors --- */
30
- @import "./styles/primitive.css";
29
+ /* --- Layer 1: Primitive Colors ---
30
+ *
31
+ * 正本 src/styles/primitive.css のメインカラーファミリー(Orange/Gray/Forest/
32
+ * Sun/Teal/Sea/Wood/Berry/Black)は `@theme { ... }` ブロック内にあり、Tailwind CSS v4 の
33
+ * ビルド時変数解決に依存するため、Tailwind を通さない consumer(素の HTML + `<link>`)では
34
+ * ブロックごと無効な CSS として破棄され、`var(--Primitive-Gray-900)` 等が一切解決されない
35
+ * (`@import` するだけでは効かない。#113 と同根で、実機 Chromium で `getComputedStyle` を
36
+ * 検証して確認済み。primitive.css の alpha 変数は素の `:root` にあるので効いている)。
37
+ * そのため、primitive.css の全トークン(@theme のカラーファミリー全量 + :root の alpha 全量)を
38
+ * 素の `:root` として値ごと逐語展開している。
39
+ *
40
+ * primitive.css を変更した場合は、このブロックも合わせて更新すること
41
+ * (整合は __tests__/preset-standalone-coverage.test.ts でガードしている)。
42
+ */
43
+ :root {
44
+ /* Orange */
45
+ --Primitive-Orange-50: #FFECD9FF;
46
+ --Primitive-Orange-100: #FFD4B2FF;
47
+ --Primitive-Orange-200: #FFBA84FF;
48
+ --Primitive-Orange-300: #FFA66BFF;
49
+ --Primitive-Orange-400: #FF8E4CFF;
50
+ --Primitive-Orange-500: #F97732FF;
51
+ --Primitive-Orange-600: #F16311FF;
52
+ --Primitive-Orange-700: #E04B00FF; /* primary */
53
+ --Primitive-Orange-800: #BD3200FF;
54
+ --Primitive-Orange-900: #A62700FF;
55
+
56
+ /* Gray */
57
+ --Primitive-Gray-50: #FBF9F8FF;
58
+ --Primitive-Gray-100: #F4F2F1FF;
59
+ --Primitive-Gray-200: #EBE9E8FF;
60
+ --Primitive-Gray-300: #DBD9D8FF;
61
+ --Primitive-Gray-400: #B7B5B4FF;
62
+ --Primitive-Gray-500: #979594FF;
63
+ --Primitive-Gray-600: #787675FF;
64
+ --Primitive-Gray-700: #575352FF;
65
+ --Primitive-Gray-800: #3A3736FF;
66
+ --Primitive-Gray-900: #1C1A1AFF;
67
+
68
+ /* Forest */
69
+ --Primitive-Forest-50: #E6F5ECFF;
70
+ --Primitive-Forest-100: #C2E5D1FF;
71
+ --Primitive-Forest-200: #9BD4B5FF;
72
+ --Primitive-Forest-300: #71C598FF;
73
+ --Primitive-Forest-400: #51B883FF;
74
+ --Primitive-Forest-500: #2CAC6EFF;
75
+ --Primitive-Forest-600: #259D63FF;
76
+ --Primitive-Forest-700: #1D8B56FF;
77
+ --Primitive-Forest-800: #197A4BFF; /* primary */
78
+ --Primitive-Forest-900: #115A36FF;
79
+
80
+ /* Sun */
81
+ --Primitive-Sun-50: #FFE7E6FF;
82
+ --Primitive-Sun-100: #FFC8B8FF;
83
+ --Primitive-Sun-200: #FFA28BFF;
84
+ --Primitive-Sun-300: #FF7B5CFF;
85
+ --Primitive-Sun-400: #FF5838FF;
86
+ --Primitive-Sun-500: #FF4B36FF;
87
+ --Primitive-Sun-600: #FF220DFF;
88
+ --Primitive-Sun-700: #FA1606FF;
89
+ --Primitive-Sun-800: #EC0000FF; /* primary */
90
+ --Primitive-Sun-900: #D50000FF;
31
91
 
32
- /* --- Layer 2: Semantic Colors (+ dark mode) --- */
33
- @import "./styles/semantic.css";
92
+ /* Teal */
93
+ --Primitive-Teal-50: #F0FCF8FF;
94
+ --Primitive-Teal-100: #D0F6E9FF;
95
+ --Primitive-Teal-200: #ACEED8FF;
96
+ --Primitive-Teal-300: #81E6C4FF;
97
+ --Primitive-Teal-400: #59D9AEFF;
98
+ --Primitive-Teal-500: #51C79FFF;
99
+ --Primitive-Teal-600: #49B18EFF;
100
+ --Primitive-Teal-700: #3E987AFF;
101
+ --Primitive-Teal-800: #317860FF; /* primary */
102
+ --Primitive-Teal-900: #1D4739FF;
103
+
104
+ /* Sea */
105
+ --Primitive-Sea-50: #E8F1FEFF;
106
+ --Primitive-Sea-100: #C5D7FBFF;
107
+ --Primitive-Sea-200: #9DB7F9FF;
108
+ --Primitive-Sea-300: #7096F8FF;
109
+ --Primitive-Sea-400: #4979F5FF;
110
+ --Primitive-Sea-500: #295FF3FF;
111
+ --Primitive-Sea-600: #003EE5FF; /* primary */
112
+ --Primitive-Sea-700: #0031D8FF;
113
+ --Primitive-Sea-800: #0024CEFF;
114
+ --Primitive-Sea-900: #0017B6FF;
115
+
116
+ /* Wood */
117
+ --Primitive-Wood-50: #F8F1E0FF;
118
+ --Primitive-Wood-100: #EFDBB1FF;
119
+ --Primitive-Wood-200: #E5C47FFF;
120
+ --Primitive-Wood-300: #DCAC4DFF;
121
+ --Primitive-Wood-400: #D69C2BFF;
122
+ --Primitive-Wood-500: #D18D0FFF;
123
+ --Primitive-Wood-600: #CD820AFF;
124
+ --Primitive-Wood-700: #C87504FF;
125
+ --Primitive-Wood-800: #C16800FF; /* primary */
126
+ --Primitive-Wood-900: #B65200FF;
127
+
128
+ /* Berry */
129
+ --Primitive-Berry-50: #FBD4E0FF;
130
+ --Primitive-Berry-100: #F7B1C8FF;
131
+ --Primitive-Berry-200: #F491B2FF;
132
+ --Primitive-Berry-300: #F1749EFF;
133
+ --Primitive-Berry-400: #EE598BFF;
134
+ --Primitive-Berry-500: #EC407AFF;
135
+ --Primitive-Berry-600: #EA296AFF;
136
+ --Primitive-Berry-700: #E5175CFF; /* primary */
137
+ --Primitive-Berry-800: #B5175CFF;
138
+ --Primitive-Berry-900: #9E103FFF;
139
+
140
+ /* Black */
141
+ --Primitive-Black-2-1000: #000000FF;
142
+
143
+ /* Gray alpha */
144
+ --Primitive-Gray-alpha-50: #0000000D;
145
+ --Primitive-Gray-alpha-100: #0000001A;
146
+ --Primitive-Gray-alpha-200: #00000033;
147
+ --Primitive-Gray-alpha-300: #0000004D;
148
+ --Primitive-Gray-alpha-400: #00000066;
149
+ --Primitive-Gray-alpha-500: #00000080;
150
+ --Primitive-Gray-alpha-600: #00000099;
151
+ --Primitive-Gray-alpha-700: #000000B2;
152
+ --Primitive-Gray-alpha-800: #000000CC;
153
+ --Primitive-Gray-alpha-900: #000000E5;
154
+ --Primitive-Gray-alpha-1000: #000000FF;
155
+
156
+ /* White alpha */
157
+ --Primitive-White-alpha-50: #FFFFFF0D;
158
+ --Primitive-White-alpha-100: #FFFFFF1A;
159
+ --Primitive-White-alpha-200: #FFFFFF33;
160
+ --Primitive-White-alpha-300: #FFFFFF4D;
161
+ --Primitive-White-alpha-400: #FFFFFF66;
162
+ --Primitive-White-alpha-500: #FFFFFF80;
163
+ --Primitive-White-alpha-600: #FFFFFF99;
164
+ --Primitive-White-alpha-700: #FFFFFFB2;
165
+ --Primitive-White-alpha-800: #FFFFFFCC;
166
+ --Primitive-White-alpha-900: #FFFFFFE5;
167
+ --Primitive-White-alpha-1000: #FFFFFFFF;
168
+ }
169
+
170
+ /* --- Layer 2: Semantic Colors (+ dark mode) ---
171
+ *
172
+ * 正本 src/styles/semantic.css は `@theme inline` 構文(Tailwind CSS v4 の
173
+ * ビルド時変数解決に依存)のため、Tailwind を通さない consumer では
174
+ * ブロックごと無視され、CSS変数として一切展開されない(`@import` するだけでは効かない)。
175
+ * そのため、以下は semantic.css の light/dark 値を tokens.json の hex キャッシュ
176
+ * (および tokens.json 未収録グループは primitive 実値)まで解決し、
177
+ * 素の `:root` / `.dark` として展開したもの。
178
+ *
179
+ * 展開対象(全 76 semantic トークン名): Surface-* / Text-* / Object-* / Hover-* /
180
+ * Active-* / Border-* / Brand-* / Overlay-* / Surface-Glass-* / Caution-* /
181
+ * Focus-High-Emphasis / Third-Party-*。一覧・hex 整合は
182
+ * __tests__/preset-standalone-coverage.test.ts でガードしている。
183
+ *
184
+ * semantic.css を変更した場合は、この2ブロックも合わせて再生成すること
185
+ * (tokens.json の hex キャッシュ + src/styles/semantic.css の var() チェーンを
186
+ * 解決するスクリプトで手で写経せず生成し、貼り直す)。
187
+ */
188
+ :root {
189
+ --Surface-Primary: #FFFFFF;
190
+ --Surface-Secondary: #FBF9F8;
191
+ --Surface-Tertiary: #F4F2F1;
192
+ --Surface-Caution: #EC0000;
193
+ --Surface-Caution-Light: #FFE7E6;
194
+ --Surface-Accent-Primary: #E04B00;
195
+ --Surface-Accent-Primary-Light: #FFECD9;
196
+ --Surface-Success: #259D63;
197
+ --Surface-Warning: #F8F1E0;
198
+ --Surface-Info: #003EE5;
199
+ --Surface-Info-Light: #E8F1FE;
200
+ --Text-High-Emphasis: #1C1A1A;
201
+ --Text-Medium-Emphasis: #575352;
202
+ --Text-Low-Emphasis: #787675;
203
+ --Text-Disable: #B7B5B4;
204
+ --Text-Accent-Primary: #E04B00;
205
+ --Text-Accent-Secondary: #FFBA84;
206
+ --Text-on-Inverse: #FFFFFF;
207
+ --Text-Success: #259D63;
208
+ --Text-Caution: #EC0000;
209
+ --Text-Warning: #C16800;
210
+ --Text-Info: #003EE5;
211
+ --Object-Favorite: #E04B00;
212
+ --Object-Accent-Primary: #E04B00;
213
+ --Object-Accent-Primary-Light: #FFECD9;
214
+ --Object-High-Emphasis: #1C1A1A;
215
+ --Object-Medium-Emphasis: #575352;
216
+ --Object-Low-Emphasis: #787675;
217
+ --Object-Disable: #B7B5B4;
218
+ --Object-High-Emphasis-on-Inverse: #FFFFFF;
219
+ --Object-Caution: #EC0000;
220
+ --Object-Warning: #C16800;
221
+ --Object-Success: #259D63;
222
+ --Object-Info: #003EE5;
223
+ --Hover-Primary-Button: #BD3200;
224
+ --Hover-Secondary-Button: #FFD4B2;
225
+ --Hover-Tertiary-Button: #EBE9E8;
226
+ --Hover-Text-Button: #EBE9E8;
227
+ --Hover-Caution-Button: #FFC8B8;
228
+ --Active-Primary-Button: #BD3200;
229
+ --Active-Secondary-Button: #FFD4B2;
230
+ --Active-Tertiary-Button: #EBE9E8;
231
+ --Active-Text-Button: #F4F2F1;
232
+ --Active-Caution-Button: #FFC8B8;
233
+ --Border-High-Emphasis: #575352;
234
+ --Border-Medium-Emphasis: #DBD9D8;
235
+ --Border-Low-Emphasis: #FBF9F8;
236
+ --Border-Accent-Primary: #E04B00;
237
+ --Border-Favorite: #E04B00;
238
+ --Border-Caution: #EC0000;
239
+ --Border-Info: #003EE5;
240
+ --Brand-Cake-Orange: #E04B00;
241
+ --Brand-Cake-Orange-Light: #FFD4B2;
242
+ --Brand-Cake-Orange-Ultra-Light: #FFECD9;
243
+ --Overlay-Dark: #000000CC;
244
+ --Overlay-Medium: #00000099;
245
+ --Overlay-Light: #00000033;
246
+ --Overlay-Scrim: rgba(17, 17, 17, 0.28);
247
+ --Surface-Glass: #FFFFFFCC;
248
+ --Surface-Glass-Soft: rgba(255, 255, 255, 0.76);
249
+ --Surface-Glass-Faint: #FFFFFFB2;
250
+ --Surface-Brand-Ghost: rgba(255, 236, 217, 0.7);
251
+ --Surface-Overlay-Light: #FFFFFFCC;
252
+ --Surface-Overlay-Dark: #00000066;
253
+ --Border-Hairline: rgba(28, 26, 26, 0.08);
254
+ --Border-Brand-Subtle: rgba(224, 75, 0, 0.16);
255
+ --Caution-Base: #EC0000;
256
+ --Caution-Light: #FFA28B;
257
+ --Caution-Ultra-Light: #FFE7E6;
258
+ --Focus-High-Emphasis: #0C9E66;
259
+ --Third-Party-Youtube: #FF0000;
260
+ --Third-Party-Facebook: #1877F2;
261
+ --Third-Party-Twitter: #1DA1F2;
262
+ --Third-Party-Instagram-Pink: #F20076;
263
+ --Third-Party-Amazon: #FAD676;
264
+ --Third-Party-LINE: #06C755;
265
+ --Third-Party-Apple: #000000;
266
+ --Third-Party-X: #000000;
267
+ }
268
+
269
+ .dark {
270
+ --Surface-Primary: #000000E5;
271
+ --Surface-Secondary: #FFFFFF1A;
272
+ --Surface-Tertiary: #FFFFFF33;
273
+ --Surface-Caution: #EC0000;
274
+ --Surface-Caution-Light: #FFE7E6;
275
+ --Surface-Accent-Primary: #E04B00;
276
+ --Surface-Accent-Primary-Light: #E04B0026;
277
+ --Surface-Success: #259D63;
278
+ --Surface-Warning: #F8F1E0;
279
+ --Surface-Info: #003EE5;
280
+ --Surface-Info-Light: #E8F1FE;
281
+ --Text-High-Emphasis: #FFFFFF;
282
+ --Text-Medium-Emphasis: #FFFFFFCC;
283
+ --Text-Low-Emphasis: #FFFFFF99;
284
+ --Text-Disable: #FFFFFF4D;
285
+ --Text-Accent-Primary: #F16311;
286
+ --Text-Accent-Secondary: #FFD4B2;
287
+ --Text-on-Inverse: #FFFFFF;
288
+ --Text-Success: #259D63;
289
+ --Text-Caution: #FF5838;
290
+ --Text-Warning: #C16800;
291
+ --Text-Info: #4979F5;
292
+ --Object-Favorite: #F16311;
293
+ --Object-Accent-Primary: #F16311;
294
+ --Object-Accent-Primary-Light: #FFECD9;
295
+ --Object-High-Emphasis: #FFFFFF;
296
+ --Object-Medium-Emphasis: #FFFFFFCC;
297
+ --Object-Low-Emphasis: #FFFFFF99;
298
+ --Object-Disable: #FFFFFF66;
299
+ --Object-High-Emphasis-on-Inverse: #FFFFFF;
300
+ --Object-Caution: #FFA28B;
301
+ --Object-Warning: #C16800;
302
+ --Object-Success: #259D63;
303
+ --Object-Info: #4979F5;
304
+ --Hover-Primary-Button: #BD3200;
305
+ --Hover-Secondary-Button: #FFFFFF1A;
306
+ --Hover-Tertiary-Button: #FFFFFF0D;
307
+ --Hover-Text-Button: #FFFFFF33;
308
+ --Hover-Caution-Button: #FFE7E6;
309
+ --Active-Primary-Button: #BD3200;
310
+ --Active-Secondary-Button: #FFFFFF1A;
311
+ --Active-Tertiary-Button: #FFFFFF0D;
312
+ --Active-Text-Button: #FFFFFF1A;
313
+ --Active-Caution-Button: #FFE7E6;
314
+ --Border-High-Emphasis: #FFFFFF80;
315
+ --Border-Medium-Emphasis: #FFFFFF33;
316
+ --Border-Low-Emphasis: #FFFFFF0D;
317
+ --Border-Accent-Primary: #F16311;
318
+ --Border-Favorite: #F16311;
319
+ --Border-Caution: #EC0000;
320
+ --Border-Info: #4979F5;
321
+ --Brand-Cake-Orange: #E04B00;
322
+ --Brand-Cake-Orange-Light: #FFD4B2;
323
+ --Brand-Cake-Orange-Ultra-Light: #FFECD9;
324
+ --Overlay-Dark: #FFFFFF4D;
325
+ --Overlay-Medium: #FFFFFF33;
326
+ --Overlay-Light: #FFFFFF1A;
327
+ --Overlay-Scrim: rgba(0, 0, 0, 0.48);
328
+ --Surface-Glass: #FFFFFF1A;
329
+ --Surface-Glass-Soft: #FFFFFF1A;
330
+ --Surface-Glass-Faint: #FFFFFF0D;
331
+ --Surface-Brand-Ghost: rgba(224, 75, 0, 0.12);
332
+ --Border-Hairline: #FFFFFF1A;
333
+ --Border-Brand-Subtle: rgba(224, 75, 0, 0.24);
334
+ }
34
335
 
35
336
  /* --- Bridge: Semantic → shadcn tokens --- */
36
337
  :root {
@@ -104,6 +405,8 @@
104
405
  */
105
406
 
106
407
  /* Heading */
408
+ .typo-heading-5xl { font-size: 40px; line-height: 1.35; letter-spacing: 0.04em; font-weight: 700; }
409
+ .typo-heading-4xl { font-size: 32px; line-height: 1.4; letter-spacing: 0.04em; font-weight: 700; }
107
410
  .typo-heading-3xl { font-size: 28px; line-height: 1.5; letter-spacing: 0.04em; font-weight: 700; }
108
411
  .typo-heading-2xl { font-size: 24px; line-height: 1.5; letter-spacing: 0.04em; font-weight: 700; }
109
412
  .typo-heading-xl { font-size: 21px; line-height: 1.5; letter-spacing: 0.04em; font-weight: 700; }
@@ -122,3 +425,18 @@
122
425
  .typo-label-md { font-size: 14px; line-height: 1.5; letter-spacing: 0.04em; font-weight: 700; }
123
426
  .typo-label-sm { font-size: 12px; line-height: 1.5; font-weight: 500; }
124
427
  .typo-label-xs { font-size: 10px; line-height: 1.5; font-weight: 500; }
428
+
429
+ /* --- Touch target utility ---
430
+ * Tailwind を使わない consumer でも preset と同じ44px操作領域を利用できる。 */
431
+ .tap-target {
432
+ position: relative;
433
+ }
434
+ .tap-target::after {
435
+ content: "";
436
+ position: absolute;
437
+ top: 50%;
438
+ left: 50%;
439
+ width: max(100%, 2.75rem);
440
+ height: max(100%, 2.75rem);
441
+ transform: translate(-50%, -50%);
442
+ }
package/src/preset.css CHANGED
@@ -18,6 +18,7 @@
18
18
  * - Tailwind 標準色 → Cake.jp マッピング(bg-red-600 等)
19
19
  * - シャドウ・角丸トークン
20
20
  * - アニメーションユーティリティ
21
+ * - 見た目を変えず44pxの操作領域を確保する tap-target ユーティリティ
21
22
  * ============================================ */
22
23
 
23
24
  /* --- Layer 1: Primitive Colors --- */
@@ -302,6 +303,22 @@
302
303
  animation: slide-in-left 200ms ease-out;
303
304
  }
304
305
 
306
+ /* --- Touch target utility ---
307
+ * 見た目が44px未満の小型操作部品に付け、透明な疑似要素で実効操作領域だけを拡張する。
308
+ * 隣接ターゲットと重なる密度では使わず、親レイアウト側の gap も確保する。 */
309
+ .tap-target {
310
+ position: relative;
311
+ }
312
+ .tap-target::after {
313
+ content: "";
314
+ position: absolute;
315
+ top: 50%;
316
+ left: 50%;
317
+ width: max(100%, 2.75rem);
318
+ height: max(100%, 2.75rem);
319
+ transform: translate(-50%, -50%);
320
+ }
321
+
305
322
  /* --- Base layer --- */
306
323
  @layer base {
307
324
  * {