@boyernick/standard-ui-react 0.1.1-canary.15 → 0.1.1-canary.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyernick/standard-ui-react",
3
- "version": "0.1.1-canary.15",
3
+ "version": "0.1.1-canary.17",
4
4
  "description": "React components for StandardUI",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,12 +21,14 @@
21
21
  "test": "node --test --experimental-strip-types \"src/**/*.test.ts\""
22
22
  },
23
23
  "peerDependencies": {
24
- "react": "^18.0.0 || ^19.0.0",
25
- "react-dom": "^18.0.0 || ^19.0.0"
24
+ "react": "^19.0.0",
25
+ "react-dom": "^19.0.0"
26
26
  },
27
27
  "dependencies": {
28
28
  "@base-ui/react": "^1.7.0",
29
+ "@central-icons-react/round-filled-radius-2-stroke-2": "^1.1.315",
29
30
  "@central-icons-react/round-outlined-radius-2-stroke-2": "^1.1.312",
31
+ "@shadcn/react": "^0.3.0",
30
32
  "class-variance-authority": "^0.7.1",
31
33
  "clsx": "^2.1.1",
32
34
  "date-fns": "^4.4.0",
package/src/brand.tsx CHANGED
@@ -45,13 +45,13 @@ export const BrandWordmark = ({
45
45
  compact = false,
46
46
  size = "md",
47
47
  }: BrandWordmarkProps) => {
48
- const resolvedMarkSize = markSize ?? (size === "sm" ? 16 : 28)
48
+ const resolvedMarkSize = markSize ?? (size === "sm" ? 16 : 32)
49
49
 
50
50
  return (
51
51
  <span
52
52
  className={cn(
53
53
  "inline-flex items-center",
54
- size === "sm" ? "gap-1" : "gap-1.5",
54
+ size === "sm" ? "gap-1" : "gap-2",
55
55
  className,
56
56
  )}
57
57
  aria-label="StandardUI"
package/src/command.tsx CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  type ReactNode,
16
16
  } from "react"
17
17
  import { IconCrossSmall, IconMagnifyingGlass } from "./icons"
18
+ import { filterGroupVariants, filterItemVariants } from "./filter-group"
18
19
  import { cn } from "./lib/cn"
19
20
  import { motion } from "./lib/motion"
20
21
 
@@ -51,7 +52,9 @@ export type CommandClearProps = ButtonHTMLAttributes<HTMLButtonElement>
51
52
  export type CommandCloseProps = ComponentProps<typeof BaseDialog.Close>
52
53
  export type CommandDividerProps = HTMLAttributes<HTMLDivElement>
53
54
  export type CommandContentProps = HTMLAttributes<HTMLDivElement>
55
+ /** @deprecated Use FilterGroup for new filter controls. */
54
56
  export type CommandFiltersProps = HTMLAttributes<HTMLUListElement>
57
+ /** @deprecated Use FilterItem for new filter controls. */
55
58
  export type CommandFilterProps = ButtonHTMLAttributes<HTMLButtonElement> & {
56
59
  selected?: boolean
57
60
  }
@@ -238,7 +241,8 @@ export const CommandFilters = ({
238
241
  <ul
239
242
  role="list"
240
243
  className={cn(
241
- "flex shrink-0 flex-wrap justify-start gap-1.5 py-1.5",
244
+ filterGroupVariants({ variant: "pill" }),
245
+ "w-full shrink-0 justify-start py-1.5",
242
246
  className,
243
247
  )}
244
248
  {...props}
@@ -256,11 +260,10 @@ export const CommandFilter = ({
256
260
  type="button"
257
261
  aria-pressed={selected}
258
262
  data-selected={selected || undefined}
263
+ data-pressed={selected || undefined}
259
264
  className={cn(
260
- "inline-flex h-9 cursor-pointer items-center rounded-full border border-transparent px-4 text-sm text-fg-quaternary outline-none",
265
+ filterItemVariants({ variant: "pill", size: "md" }),
261
266
  motion.colors,
262
- "hover:text-fg-primary focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20",
263
- "data-selected:bg-background-tertiary data-selected:text-fg-primary",
264
267
  className,
265
268
  )}
266
269
  {...props}
@@ -0,0 +1,139 @@
1
+ "use client"
2
+
3
+ import { Toggle as BaseToggle } from "@base-ui/react/toggle"
4
+ import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group"
5
+ import { cva, type VariantProps } from "class-variance-authority"
6
+ import { createContext, type ComponentProps, useContext } from "react"
7
+ import { cn } from "./lib/cn"
8
+ import { motion } from "./lib/motion"
9
+
10
+ const filterGroupVariants = cva("flex w-fit items-center", {
11
+ variants: {
12
+ variant: {
13
+ pill: "flex-wrap gap-1",
14
+ segmented: "gap-0.5 rounded-lg bg-background-tertiary p-0.5",
15
+ },
16
+ },
17
+ defaultVariants: {
18
+ variant: "pill",
19
+ },
20
+ })
21
+
22
+ const filterItemVariants = cva(
23
+ "group/filter-item inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border border-transparent text-fg-tertiary outline-none hover:text-fg-primary focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:text-fg-primary",
24
+ {
25
+ variants: {
26
+ variant: {
27
+ pill: "rounded-full hover:bg-background-tertiary data-pressed:bg-background-tertiary",
28
+ segmented:
29
+ "rounded-md hover:bg-background-quaternary data-pressed:bg-surface-raised data-pressed:shadow-hairline",
30
+ },
31
+ size: {
32
+ sm: "text-xs",
33
+ md: "text-sm",
34
+ lg: "text-sm",
35
+ },
36
+ },
37
+ compoundVariants: [
38
+ { variant: "pill", size: "sm", class: "h-8 px-3" },
39
+ { variant: "pill", size: "md", class: "h-9 px-4" },
40
+ { variant: "pill", size: "lg", class: "h-10 px-5" },
41
+ { variant: "segmented", size: "sm", class: "h-7 px-2.5" },
42
+ { variant: "segmented", size: "md", class: "h-8 px-3" },
43
+ { variant: "segmented", size: "lg", class: "h-9 px-3.5" },
44
+ ],
45
+ defaultVariants: {
46
+ variant: "pill",
47
+ size: "md",
48
+ },
49
+ },
50
+ )
51
+
52
+ export type FilterGroupVariant = NonNullable<
53
+ VariantProps<typeof filterGroupVariants>["variant"]
54
+ >
55
+ export type FilterGroupSize = NonNullable<
56
+ VariantProps<typeof filterItemVariants>["size"]
57
+ >
58
+
59
+ type FilterGroupStyleContextValue = {
60
+ variant: FilterGroupVariant
61
+ size: FilterGroupSize
62
+ }
63
+
64
+ const FilterGroupStyleContext = createContext<FilterGroupStyleContextValue>({
65
+ variant: "pill",
66
+ size: "md",
67
+ })
68
+
69
+ export type FilterGroupProps = ComponentProps<typeof BaseToggleGroup> &
70
+ VariantProps<typeof filterGroupVariants> & {
71
+ /** Whether pressing the active item can clear a single-select group. */
72
+ allowEmpty?: boolean
73
+ size?: FilterGroupSize
74
+ }
75
+ export type FilterItemProps = ComponentProps<typeof BaseToggle> &
76
+ VariantProps<typeof filterItemVariants>
77
+ export type FilterCountProps = ComponentProps<"span">
78
+
79
+ export const FilterGroup = ({
80
+ className,
81
+ variant = "pill",
82
+ size = "md",
83
+ allowEmpty = false,
84
+ multiple = false,
85
+ onValueChange,
86
+ ...props
87
+ }: FilterGroupProps) => (
88
+ <FilterGroupStyleContext.Provider value={{ variant: variant ?? "pill", size }}>
89
+ <BaseToggleGroup
90
+ className={cn(filterGroupVariants({ variant }), className)}
91
+ multiple={multiple}
92
+ onValueChange={(value, eventDetails) => {
93
+ if (!multiple && !allowEmpty && value.length === 0) {
94
+ eventDetails.cancel()
95
+ return
96
+ }
97
+ onValueChange?.(value, eventDetails)
98
+ }}
99
+ {...props}
100
+ />
101
+ </FilterGroupStyleContext.Provider>
102
+ )
103
+
104
+ export const FilterItem = ({
105
+ className,
106
+ variant,
107
+ size,
108
+ type = "button",
109
+ ...props
110
+ }: FilterItemProps) => {
111
+ const styles = useContext(FilterGroupStyleContext)
112
+
113
+ return (
114
+ <BaseToggle
115
+ type={type}
116
+ className={cn(
117
+ filterItemVariants({
118
+ variant: variant ?? styles.variant,
119
+ size: size ?? styles.size,
120
+ }),
121
+ motion.colors,
122
+ className,
123
+ )}
124
+ {...props}
125
+ />
126
+ )
127
+ }
128
+
129
+ export const FilterCount = ({ className, ...props }: FilterCountProps) => (
130
+ <span
131
+ className={cn(
132
+ "text-2xs-strong inline-flex min-w-4 items-center justify-center rounded-full bg-background-quaternary px-1 py-0.5 text-fg-secondary tabular-nums group-data-pressed/filter-item:bg-surface",
133
+ className,
134
+ )}
135
+ {...props}
136
+ />
137
+ )
138
+
139
+ export { filterGroupVariants, filterItemVariants }
package/src/index.ts CHANGED
@@ -364,6 +364,18 @@ export {
364
364
  type FieldsetProps,
365
365
  type FieldsetLegendProps,
366
366
  } from "./fieldset";
367
+ export {
368
+ FilterGroup,
369
+ FilterItem,
370
+ FilterCount,
371
+ filterGroupVariants,
372
+ filterItemVariants,
373
+ type FilterGroupProps,
374
+ type FilterItemProps,
375
+ type FilterCountProps,
376
+ type FilterGroupVariant,
377
+ type FilterGroupSize,
378
+ } from "./filter-group";
367
379
  export { Form, type FormProps } from "./form";
368
380
  export {
369
381
  Meter,
@@ -426,13 +438,26 @@ export {
426
438
  NumberFieldInput,
427
439
  NumberFieldIncrement,
428
440
  NumberFieldDecrement,
441
+ NumberFieldStepper,
442
+ NumberFieldPrefix,
443
+ NumberFieldSuffix,
429
444
  NumberFieldScrubArea,
430
445
  NumberFieldScrubAreaCursor,
446
+ numberFieldAffixVariants,
447
+ numberFieldControlVariants,
448
+ numberFieldGroupVariants,
449
+ numberFieldInputVariants,
450
+ numberFieldStepperVariants,
451
+ type NumberFieldSize,
452
+ type NumberFieldAlign,
431
453
  type NumberFieldProps,
432
454
  type NumberFieldGroupProps,
433
455
  type NumberFieldInputProps,
434
456
  type NumberFieldIncrementProps,
435
457
  type NumberFieldDecrementProps,
458
+ type NumberFieldStepperProps,
459
+ type NumberFieldPrefixProps,
460
+ type NumberFieldSuffixProps,
436
461
  type NumberFieldScrubAreaProps,
437
462
  type NumberFieldScrubAreaCursorProps,
438
463
  } from "./number-field";
@@ -449,8 +474,18 @@ export {
449
474
  NavigationMenuPopup,
450
475
  NavigationMenuArrow,
451
476
  NavigationMenuLink,
477
+ NavigationMenuBarLink,
478
+ NavigationMenuLinkIcon,
479
+ NavigationMenuLinkTitle,
480
+ NavigationMenuLinkDescription,
452
481
  NavigationMenuIcon,
482
+ navigationMenuBarItemVariants,
483
+ navigationMenuLinkVariants,
484
+ navigationMenuListVariants,
485
+ navigationMenuRootVariants,
453
486
  navigationMenuTriggerClassName,
487
+ type NavigationMenuVariant,
488
+ type NavigationMenuSize,
454
489
  type NavigationMenuProps,
455
490
  type NavigationMenuListProps,
456
491
  type NavigationMenuItemProps,
@@ -463,6 +498,10 @@ export {
463
498
  type NavigationMenuPopupProps,
464
499
  type NavigationMenuArrowProps,
465
500
  type NavigationMenuLinkProps,
501
+ type NavigationMenuBarLinkProps,
502
+ type NavigationMenuLinkIconProps,
503
+ type NavigationMenuLinkTitleProps,
504
+ type NavigationMenuLinkDescriptionProps,
466
505
  type NavigationMenuIconProps,
467
506
  } from "./navigation-menu";
468
507
  export {
@@ -524,6 +563,47 @@ export {
524
563
  type ProgressTrackProps,
525
564
  type ProgressIndicatorProps,
526
565
  } from "./progress";
566
+ export {
567
+ Questionnaire,
568
+ QuestionnaireProgress,
569
+ QuestionnaireItem,
570
+ QuestionnaireTitle,
571
+ QuestionnaireDescription,
572
+ QuestionnaireChoices,
573
+ QuestionnaireChoice,
574
+ QuestionnaireChoiceInput,
575
+ QuestionnaireChoiceLabel,
576
+ QuestionnaireChoiceShortcut,
577
+ QuestionnaireInput,
578
+ QuestionnaireError,
579
+ QuestionnaireActions,
580
+ QuestionnairePrevious,
581
+ QuestionnaireSkip,
582
+ QuestionnaireNext,
583
+ QuestionnaireSubmit,
584
+ type QuestionnaireProps,
585
+ type QuestionnaireProgressProps,
586
+ type QuestionnaireItemProps,
587
+ type QuestionnaireTitleProps,
588
+ type QuestionnaireDescriptionProps,
589
+ type QuestionnaireChoicesProps,
590
+ type QuestionnaireChoiceProps,
591
+ type QuestionnaireChoiceInputProps,
592
+ type QuestionnaireChoiceLabelProps,
593
+ type QuestionnaireChoiceShortcutProps,
594
+ type QuestionnaireInputProps,
595
+ type QuestionnaireErrorProps,
596
+ type QuestionnaireActionsProps,
597
+ type QuestionnairePreviousProps,
598
+ type QuestionnaireSkipProps,
599
+ type QuestionnaireNextProps,
600
+ type QuestionnaireSubmitProps,
601
+ type QuestionnaireChoiceDefinition,
602
+ type QuestionnaireInputType,
603
+ type QuestionnaireItemDefinition,
604
+ type QuestionnaireItemStatus,
605
+ type QuestionnaireShortcutMode,
606
+ } from "./questionnaire";
527
607
  export {
528
608
  RadioGroup,
529
609
  Radio,
@@ -581,11 +661,14 @@ export {
581
661
  SliderTrack,
582
662
  SliderIndicator,
583
663
  SliderThumb,
664
+ SliderTicks,
665
+ sliderVariants,
584
666
  type SliderProps,
585
667
  type SliderControlProps,
586
668
  type SliderTrackProps,
587
669
  type SliderIndicatorProps,
588
670
  type SliderThumbProps,
671
+ type SliderTicksProps,
589
672
  } from "./slider";
590
673
  export {
591
674
  Tabs,
@@ -593,7 +676,12 @@ export {
593
676
  TabsTab,
594
677
  TabsIndicator,
595
678
  TabsPanel,
679
+ tabsListVariants,
680
+ tabsTabVariants,
681
+ tabsIndicatorVariants,
596
682
  type TabsProps,
683
+ type TabsVariant,
684
+ type TabsSize,
597
685
  type TabsListProps,
598
686
  type TabsTabProps,
599
687
  type TabsIndicatorProps,
@@ -699,14 +787,27 @@ export {
699
787
  PaginationLink,
700
788
  PaginationPrevious,
701
789
  PaginationNext,
790
+ PaginationFirst,
791
+ PaginationLast,
702
792
  PaginationEllipsis,
793
+ PaginationStatus,
794
+ PaginationRange,
795
+ paginationLinkVariants,
796
+ paginationDirectionVariants,
703
797
  type PaginationProps,
704
798
  type PaginationContentProps,
705
799
  type PaginationItemProps,
706
800
  type PaginationLinkProps,
801
+ type PaginationButtonProps,
802
+ type PaginationAnchorProps,
707
803
  type PaginationPreviousProps,
708
804
  type PaginationNextProps,
805
+ type PaginationFirstProps,
806
+ type PaginationLastProps,
709
807
  type PaginationEllipsisProps,
808
+ type PaginationStatusProps,
809
+ type PaginationRangeProps,
810
+ type PaginationSize,
710
811
  } from "./pagination";
711
812
  export {
712
813
  Sidebar,
@@ -715,14 +816,20 @@ export {
715
816
  SidebarFooter,
716
817
  SidebarNav,
717
818
  SidebarNavItem,
819
+ SidebarNavItemLabel,
820
+ SidebarNavBadge,
718
821
  SidebarGroup,
719
822
  SidebarGroupLabel,
823
+ sidebarVariants,
824
+ sidebarNavItemVariants,
720
825
  type SidebarProps,
721
826
  type SidebarHeaderProps,
722
827
  type SidebarContentProps,
723
828
  type SidebarFooterProps,
724
829
  type SidebarNavProps,
725
830
  type SidebarNavItemProps,
831
+ type SidebarNavItemLabelProps,
832
+ type SidebarNavBadgeProps,
726
833
  type SidebarGroupProps,
727
834
  type SidebarGroupLabelProps,
728
835
  } from "./sidebar";
@@ -779,6 +886,8 @@ export {
779
886
  TableHead,
780
887
  TableCell,
781
888
  TableCaption,
889
+ tableHeaderVariants,
890
+ tableVariants,
782
891
  type TableProps,
783
892
  type TableHeaderProps,
784
893
  type TableBodyProps,