@podoba/react 0.0.52 → 0.0.53

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 (34) hide show
  1. package/package.json +4 -4
  2. package/src/components/asset-selection-surface.tsx +264 -67
  3. package/src/components/citation.examples.tsx +14 -0
  4. package/src/components/citation.tsx +27 -0
  5. package/src/components/column-layout.examples.tsx +34 -0
  6. package/src/components/column-layout.tsx +36 -0
  7. package/src/components/combobox.tsx +9 -4
  8. package/src/components/compact-settings-dialog.tsx +80 -21
  9. package/src/components/date-picker.tsx +49 -8
  10. package/src/components/delivery/send-to-print-modal.tsx +191 -225
  11. package/src/components/field-appearance.ts +11 -1
  12. package/src/components/icon-button.examples.tsx +16 -0
  13. package/src/components/icon-button.tsx +20 -0
  14. package/src/components/input.tsx +25 -12
  15. package/src/components/island-toolbar.examples.tsx +27 -0
  16. package/src/components/island-toolbar.tsx +39 -0
  17. package/src/components/media-asset-panel.examples.tsx +44 -5
  18. package/src/components/media-asset-panel.tsx +339 -28
  19. package/src/components/media-collection.examples.tsx +18 -0
  20. package/src/components/media-collection.tsx +206 -0
  21. package/src/components/number-field.tsx +18 -9
  22. package/src/components/preview-error.examples.tsx +20 -0
  23. package/src/components/preview-error.tsx +29 -0
  24. package/src/components/preview-metadata-card.examples.tsx +32 -0
  25. package/src/components/preview-metadata-card.tsx +112 -0
  26. package/src/components/search-field.tsx +27 -7
  27. package/src/components/select.tsx +81 -50
  28. package/src/components/settings-dialog-surface.tsx +553 -114
  29. package/src/components/template-catalog-card.tsx +309 -78
  30. package/src/components/textarea.tsx +160 -12
  31. package/src/components/tile.tsx +30 -16
  32. package/src/components/zoomable-image.examples.tsx +33 -0
  33. package/src/components/zoomable-image.tsx +185 -0
  34. package/src/index.ts +96 -78
@@ -5,26 +5,55 @@ import { Heading } from './text'
5
5
  import { Button as AriaButton } from 'react-aria-components'
6
6
  import { uic } from '../utils/uic'
7
7
 
8
- export const MemberSelectionGrid = uic('ul', { displayName: 'MemberSelectionGrid', baseClass: 'm-0 mt-8 grid list-none grid-cols-1 gap-3 p-0 max-[767px]:gap-2 min-[640px]:grid-cols-2 min-[768px]:grid-cols-3 min-[1024px]:grid-cols-4' })
9
- export const TeamSelectionGrid = uic('ul', { displayName: 'TeamSelectionGrid', baseClass: 'm-0 mt-8 grid list-none grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-4 p-0' })
8
+ export const MemberSelectionGrid = uic('ul', {
9
+ displayName: 'MemberSelectionGrid',
10
+ baseClass:
11
+ 'm-0 mt-8 grid list-none grid-cols-1 gap-3 p-0 max-[767px]:gap-2 min-[640px]:grid-cols-2 min-[768px]:grid-cols-3 min-[1024px]:grid-cols-4',
12
+ })
13
+ export const TeamSelectionGrid = uic('ul', {
14
+ displayName: 'TeamSelectionGrid',
15
+ baseClass: 'm-0 mt-8 grid list-none grid-cols-[repeat(auto-fill,minmax(200px,1fr))] gap-4 p-0',
16
+ })
10
17
  export const MemberSelectionCard = uic(AriaButton, {
11
18
  displayName: 'MemberSelectionCard',
12
- baseClass: 'flex w-full cursor-pointer items-center gap-3 rounded-lg border border-border bg-surface-card p-4 text-start text-fg outline-none transition-all duration-200 data-[hovered]:-translate-y-0.5 data-[hovered]:border-brand-primary data-[hovered]:shadow-[0_4px_12px_rgba(0,0,0,0.1)] aria-pressed:border-brand-primary aria-pressed:bg-surface-muted data-[disabled]:cursor-default data-[disabled]:opacity-60 data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring',
19
+ baseClass:
20
+ 'flex w-full cursor-pointer items-center gap-3 rounded-lg border border-border bg-surface-card p-4 text-start text-fg outline-none transition-all duration-200 data-[hovered]:-translate-y-0.5 data-[hovered]:border-brand-primary data-[hovered]:shadow-[0_4px_12px_rgba(0,0,0,0.1)] aria-pressed:border-brand-primary aria-pressed:bg-surface-muted data-[disabled]:cursor-default data-[disabled]:opacity-60 data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring',
13
21
  })
14
22
  export const TeamSelectionCard = uic(AriaButton, {
15
23
  displayName: 'TeamSelectionCard',
16
- baseClass: 'block w-full cursor-pointer rounded-md border-2 border-border bg-transparent p-4 text-start text-fg outline-none transition-all duration-200 data-[hovered]:border-brand-primary aria-pressed:border-brand-primary aria-pressed:bg-surface-muted data-[disabled]:cursor-default data-[disabled]:opacity-60 data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring',
24
+ baseClass:
25
+ 'block w-full cursor-pointer rounded-md border-2 border-border bg-transparent p-4 text-start text-fg outline-none transition-all duration-200 data-[hovered]:border-brand-primary aria-pressed:border-brand-primary aria-pressed:bg-surface-muted data-[disabled]:cursor-default data-[disabled]:opacity-60 data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring',
17
26
  })
18
27
  export const MemberSelectionInfo = uic('span', { displayName: 'MemberSelectionInfo', baseClass: 'min-w-0 flex-1' })
19
- export const MemberSelectionName = uic('span', { displayName: 'MemberSelectionName', baseClass: 'mb-1 block text-heading5 font-medium text-fg' })
28
+ export const MemberSelectionName = uic('span', {
29
+ displayName: 'MemberSelectionName',
30
+ baseClass: 'mb-1 block text-heading5 font-medium text-fg',
31
+ })
20
32
  // #25: an email address and a team's meta line are CONTENT — `fg-muted` (5.98:1 on
21
33
  // surface, 5.53:1 on surface-card), never the ornamental `fg-subtle` (2.10 / 1.94:1).
22
- export const MemberSelectionEmail = uic('span', { displayName: 'MemberSelectionEmail', baseClass: 'block text-compact font-normal text-fg-muted' })
23
- export const TeamSelectionName = uic('span', { displayName: 'TeamSelectionName', baseClass: 'mb-1 block font-medium text-fg' })
24
- export const TeamSelectionMeta = uic('span', { displayName: 'TeamSelectionMeta', baseClass: 'block text-small font-normal text-fg-muted' })
34
+ export const MemberSelectionEmail = uic('span', {
35
+ displayName: 'MemberSelectionEmail',
36
+ baseClass: 'block text-compact font-normal text-fg-muted',
37
+ })
38
+ export const TeamSelectionName = uic('span', {
39
+ displayName: 'TeamSelectionName',
40
+ baseClass: 'mb-1 block font-medium text-fg',
41
+ })
42
+ export const TeamSelectionMeta = uic('span', {
43
+ displayName: 'TeamSelectionMeta',
44
+ baseClass: 'block text-small font-normal text-fg-muted',
45
+ })
25
46
 
26
47
  /** Intrinsic-height form surface. The tall settings and catalog surfaces remain separate. */
27
- export function CompactSettingsDialog({ isOpen, onOpenChange, isPending = false, title, description, closeLabel, children }: {
48
+ export function CompactSettingsDialog({
49
+ isOpen,
50
+ onOpenChange,
51
+ isPending = false,
52
+ title,
53
+ description,
54
+ closeLabel,
55
+ children,
56
+ }: {
28
57
  isOpen: boolean
29
58
  onOpenChange: (open: boolean) => void
30
59
  isPending?: boolean
@@ -35,16 +64,46 @@ export function CompactSettingsDialog({ isOpen, onOpenChange, isPending = false,
35
64
  }) {
36
65
  const titleId = useId()
37
66
  const descriptionId = useId()
38
- return <ModalOverlay className="p-0" isOpen={isOpen} onOpenChange={open => { if (!isPending) onOpenChange(open) }} isDismissable={!isPending} isKeyboardDismissDisabled={isPending}>
39
- <ModalSurface className="relative w-[90vw] max-w-180 max-h-[85vh] overflow-y-auto p-5 min-[768px]:max-[1023px]:w-[85vw] max-[767px]:w-[calc(100vw-6*var(--spacing))] max-[767px]:max-w-[calc(100vw-6*var(--spacing))] max-[767px]:max-h-[calc(100vh-6*var(--spacing))]">
40
- <ModalDialog aria-labelledby={titleId} aria-describedby={descriptionId} className="outline-none">
41
- <Heading id={titleId} level="1" className="m-0 mb-4 max-w-5/6 tracking-normal">{title}</Heading>
42
- <p id={descriptionId} className="m-0 mb-6 max-w-5/6 text-small font-normal text-fg-workflow-muted">{description}</p>
43
- <div className="mt-4">{children}</div>
44
- <Button variant="ghost" aria-label={closeLabel} isDisabled={isPending} onPress={() => onOpenChange(false)} className="absolute end-4 top-3.5 h-8 w-8 rounded-md p-0 text-fg-subtle max-[767px]:end-3">
45
- <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" aria-hidden="true"><path d="m6 6 12 12M18 6 6 18" /></svg>
46
- </Button>
47
- </ModalDialog>
48
- </ModalSurface>
49
- </ModalOverlay>
67
+ return (
68
+ <ModalOverlay
69
+ className="p-0"
70
+ isOpen={isOpen}
71
+ onOpenChange={(open) => {
72
+ if (!isPending) onOpenChange(open)
73
+ }}
74
+ isDismissable={!isPending}
75
+ isKeyboardDismissDisabled={isPending}
76
+ >
77
+ <ModalSurface className="relative w-[90vw] max-w-180 max-h-[85vh] overflow-y-auto p-5 min-[768px]:max-[1023px]:w-[85vw] max-[767px]:w-[calc(100vw-6*var(--spacing))] max-[767px]:max-w-[calc(100vw-6*var(--spacing))] max-[767px]:max-h-[calc(100vh-6*var(--spacing))]">
78
+ <ModalDialog aria-labelledby={titleId} aria-describedby={descriptionId} className="outline-none">
79
+ <Heading id={titleId} level="1" className="m-0 mb-4 max-w-5/6 tracking-normal">
80
+ {title}
81
+ </Heading>
82
+ <p id={descriptionId} className="m-0 mb-6 max-w-5/6 text-small font-normal text-fg-workflow-muted">
83
+ {description}
84
+ </p>
85
+ <div className="mt-4">{children}</div>
86
+ <Button
87
+ variant="ghost"
88
+ aria-label={closeLabel}
89
+ isDisabled={isPending}
90
+ onPress={() => onOpenChange(false)}
91
+ className="absolute end-4 top-3.5 h-9 w-9 rounded-md p-0 text-fg-subtle max-[767px]:end-3"
92
+ >
93
+ <svg
94
+ width="18"
95
+ height="18"
96
+ viewBox="0 0 24 24"
97
+ fill="none"
98
+ stroke="currentColor"
99
+ strokeWidth="2"
100
+ aria-hidden="true"
101
+ >
102
+ <path d="m6 6 12 12M18 6 6 18" />
103
+ </svg>
104
+ </Button>
105
+ </ModalDialog>
106
+ </ModalSurface>
107
+ </ModalOverlay>
108
+ )
50
109
  }
@@ -21,12 +21,15 @@ import {
21
21
  Text,
22
22
  } from 'react-aria-components'
23
23
  import { clsx } from 'clsx'
24
- import { dateInputClass, segmentClass } from './date-field'
24
+ import { segmentClass } from './date-field'
25
25
  import { useInFocusOverlay } from './focus-context'
26
26
  import {
27
27
  fieldDescriptionClass,
28
+ fieldControlClasses,
29
+ type FieldAppearance,
28
30
  fieldErrorClass,
29
- fieldLabelClass,
31
+ fieldLabelClasses,
32
+ type FieldLabelSize,
30
33
  fieldStackClass,
31
34
  type FieldSize,
32
35
  } from './field-appearance'
@@ -42,7 +45,17 @@ const navButton =
42
45
  'hover:bg-surface-muted hover:text-fg data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring data-[disabled]:cursor-not-allowed data-[disabled]:opacity-40'
43
46
 
44
47
  const Chevron = ({ dir }: { dir: 'left' | 'right' }) => (
45
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
48
+ <svg
49
+ width="16"
50
+ height="16"
51
+ viewBox="0 0 24 24"
52
+ fill="none"
53
+ stroke="currentColor"
54
+ strokeWidth="2"
55
+ strokeLinecap="round"
56
+ strokeLinejoin="round"
57
+ aria-hidden="true"
58
+ >
46
59
  <path d={dir === 'left' ? 'M15 6l-6 6 6 6' : 'M9 6l6 6-6 6'} />
47
60
  </svg>
48
61
  )
@@ -83,31 +96,59 @@ function CalendarBody() {
83
96
  }
84
97
 
85
98
  export type DatePickerProps<T extends DateValue> = RACDatePickerProps<T> & {
99
+ appearance?: FieldAppearance
100
+ labelSize?: FieldLabelSize
86
101
  label: ReactNode
87
102
  /** Field height, matching `Input`'s `size`. */
88
103
  size?: FieldSize
104
+ calendarLabel?: string
89
105
  description?: ReactNode
90
106
  errorMessage?: string
91
107
  }
92
108
 
93
- export const DatePicker = <T extends DateValue>({ label, description, errorMessage, size, ...props }: DatePickerProps<T>) => {
109
+ export const DatePicker = <T extends DateValue>({
110
+ label,
111
+ labelSize = 'default',
112
+ appearance = 'outlined',
113
+ description,
114
+ errorMessage,
115
+ size,
116
+ calendarLabel = 'Open calendar',
117
+ ...props
118
+ }: DatePickerProps<T>) => {
94
119
  // In a focus overlay, show the calendar inline (open) instead of a popover.
95
120
  const inFocus = useInFocusOverlay()
96
121
  return (
97
122
  <RACDatePicker {...props} className={`group ${fieldStackClass}`}>
98
- <Label className={fieldLabelClass}>{label}</Label>
123
+ <Label className={fieldLabelClasses[labelSize]}>{label}</Label>
99
124
  {/* In focus mode the field is bare + large and the calendar is borderless,
100
125
  so field + calendar read as one seamless editor rather than boxes. */}
101
- <Group className={inFocus ? 'flex w-full items-center' : `${dateInputClass(size)} pr-2`}>
126
+ <Group
127
+ className={
128
+ inFocus
129
+ ? 'flex w-full items-center'
130
+ : `flex w-full items-center gap-0.5 rounded-lg px-4 pr-2 ${fieldControlClasses(appearance, size, true)}`
131
+ }
132
+ >
102
133
  <DateInput className={clsx('flex flex-1 items-center gap-0.5', inFocus && 'text-display font-medium')}>
103
134
  {(segment) => <DateSegment segment={segment} className={segmentClass} />}
104
135
  </DateInput>
105
136
  {inFocus ? null : (
106
137
  <RACButton
107
- aria-label="Open calendar"
138
+ aria-label={calendarLabel}
108
139
  className="flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-md text-fg-muted outline-none data-[disabled]:cursor-not-allowed transition-colors hover:bg-surface-muted hover:text-fg data-[focus-visible]:ring-2 data-[focus-visible]:ring-ring"
109
140
  >
110
- <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
141
+ <svg
142
+ width="16"
143
+ height="16"
144
+ viewBox="0 0 24 24"
145
+ fill="none"
146
+ stroke="currentColor"
147
+ strokeWidth="2"
148
+ strokeLinecap="round"
149
+ strokeLinejoin="round"
150
+ aria-hidden="true"
151
+ >
111
152
  <rect x="3" y="4" width="18" height="18" rx="2" />
112
153
  <path d="M16 2v4M8 2v4M3 10h18" />
113
154
  </svg>