@podoba/react 0.0.52 → 0.0.54

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 (35) 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/field-autofocus.ts +23 -0
  13. package/src/components/icon-button.examples.tsx +16 -0
  14. package/src/components/icon-button.tsx +20 -0
  15. package/src/components/input.tsx +37 -21
  16. package/src/components/island-toolbar.examples.tsx +27 -0
  17. package/src/components/island-toolbar.tsx +39 -0
  18. package/src/components/media-asset-panel.examples.tsx +44 -5
  19. package/src/components/media-asset-panel.tsx +339 -28
  20. package/src/components/media-collection.examples.tsx +18 -0
  21. package/src/components/media-collection.tsx +206 -0
  22. package/src/components/number-field.tsx +18 -9
  23. package/src/components/preview-error.examples.tsx +20 -0
  24. package/src/components/preview-error.tsx +29 -0
  25. package/src/components/preview-metadata-card.examples.tsx +32 -0
  26. package/src/components/preview-metadata-card.tsx +112 -0
  27. package/src/components/search-field.tsx +27 -7
  28. package/src/components/select.tsx +81 -50
  29. package/src/components/settings-dialog-surface.tsx +560 -114
  30. package/src/components/template-catalog-card.tsx +309 -78
  31. package/src/components/textarea.tsx +174 -23
  32. package/src/components/tile.tsx +30 -16
  33. package/src/components/zoomable-image.examples.tsx +33 -0
  34. package/src/components/zoomable-image.tsx +185 -0
  35. package/src/index.ts +96 -78
@@ -17,7 +17,8 @@ import { useInFocusOverlay } from './focus-context'
17
17
  import {
18
18
  fieldDescriptionClass,
19
19
  fieldErrorClass,
20
- fieldLabelClass,
20
+ fieldLabelClasses,
21
+ type FieldLabelSize,
21
22
  fieldSizeClasses,
22
23
  fieldStackClass,
23
24
  outlinedFieldClasses,
@@ -51,7 +52,8 @@ const SelectTrigger = uic(RACButton, {
51
52
  'flex w-full cursor-pointer items-center justify-between gap-2.5 rounded-lg text-small text-fg outline-none transition-colors',
52
53
  variants: {
53
54
  appearance: {
54
- filled: 'min-h-control-tall border-0 bg-surface-card px-5 py-5 font-normal leading-4.5 duration-200 motion-reduce:transition-none ' +
55
+ filled:
56
+ 'h-10.5 border-0 bg-surface-card px-4 py-3 font-normal leading-4.5 duration-200 motion-reduce:transition-none ' +
55
57
  'data-[hovered]:bg-surface-muted group-data-[open]:bg-surface-card ' +
56
58
  'data-[focus-visible]:outline-solid data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring data-[focus-visible]:outline-offset-2 ' +
57
59
  'group-data-[invalid]:ring-1 group-data-[invalid]:ring-danger ' +
@@ -73,16 +75,18 @@ const StyledSelectItem = uic(ListBoxItem, {
73
75
  'flex cursor-pointer select-none items-center rounded-md text-small text-fg outline-none data-[disabled]:opacity-50 data-[disabled]:pointer-events-none',
74
76
  variants: {
75
77
  appearance: {
76
- filled: 'min-w-0 overflow-hidden px-5 py-0 font-normal leading-4.5 max-md:min-h-11 ' +
78
+ filled:
79
+ 'min-w-0 overflow-hidden px-5 py-0 font-normal leading-4.5 max-md:min-h-11 ' +
77
80
  'data-[hovered]:font-medium data-[focused]:font-medium data-[selected]:font-medium ' +
78
81
  'data-[focus-visible]:outline-solid data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring data-[focus-visible]:-outline-offset-2',
79
- outlined: 'px-3 py-2 ' +
80
- 'data-[hovered]:bg-surface-muted data-[focused]:bg-surface-muted data-[selected]:font-medium ' +
81
- 'data-[disabled]:opacity-50 data-[disabled]:pointer-events-none',
82
+ outlined:
83
+ 'px-3 py-2 ' +
84
+ 'data-[hovered]:bg-surface-muted data-[focused]:bg-surface-muted data-[selected]:font-medium ' +
85
+ 'data-[disabled]:opacity-50 data-[disabled]:pointer-events-none',
82
86
  },
83
87
  },
84
88
  defaultVariants: { appearance: 'outlined' },
85
- }) as (props: ListBoxItemProps & { appearance?: FieldAppearance }) => ReactNode
89
+ }) as (props: ListBoxItemProps & { labelSize?: FieldLabelSize; appearance?: FieldAppearance }) => ReactNode
86
90
 
87
91
  export const SelectItem = (props: ListBoxItemProps): ReactNode => {
88
92
  const appearance = useContext(SelectAppearanceContext)
@@ -90,9 +94,19 @@ export const SelectItem = (props: ListBoxItemProps): ReactNode => {
90
94
  // Manager's ItemText is a single ellipsized line. Keep the full value in the
91
95
  // label/textValue so keyboard search and assistive technology don't see a cut-off label.
92
96
  const { children, textValue, ...rest } = props
93
- return <StyledSelectItem {...rest} appearance={appearance} textValue={textValue ?? (typeof children === 'string' ? children : undefined)}>
94
- {state => <Text slot="label" className="min-w-0 truncate">{typeof children === 'function' ? children(state) : children}</Text>}
95
- </StyledSelectItem>
97
+ return (
98
+ <StyledSelectItem
99
+ {...rest}
100
+ appearance={appearance}
101
+ textValue={textValue ?? (typeof children === 'string' ? children : undefined)}
102
+ >
103
+ {(state) => (
104
+ <Text slot="label" className="min-w-0 truncate">
105
+ {typeof children === 'function' ? children(state) : children}
106
+ </Text>
107
+ )}
108
+ </StyledSelectItem>
109
+ )
96
110
  }
97
111
 
98
112
  const SelectListBox = uic(ListBox, {
@@ -104,14 +118,17 @@ const SelectListBox = uic(ListBox, {
104
118
  const SelectPopover = uic(Popover, {
105
119
  displayName: 'SelectPopover',
106
120
  baseClass: 'overflow-hidden rounded-lg bg-surface-card shadow-lg',
107
- variants: { appearance: {
108
- outlined: 'min-w-(--trigger-width)',
109
- filled: 'w-(--trigger-width) max-w-(--select-popup-max-width)',
110
- } },
121
+ variants: {
122
+ appearance: {
123
+ outlined: 'min-w-(--trigger-width)',
124
+ filled: 'w-(--trigger-width) max-w-(--select-popup-max-width)',
125
+ },
126
+ },
111
127
  defaultVariants: { appearance: 'outlined' },
112
128
  })
113
129
 
114
130
  export type SelectProps<T extends object> = RACSelectProps<T> & {
131
+ labelSize?: FieldLabelSize
115
132
  appearance?: FieldAppearance
116
133
  /** Outlined trigger height, matching `Input`'s `size`. Ignored when filled. */
117
134
  size?: FieldSize
@@ -126,7 +143,7 @@ export type SelectProps<T extends object> = RACSelectProps<T> & {
126
143
  * i18n, so the consumer passes a translated string (otherwise RAC would fall
127
144
  * back to its own hardcoded English "Select an item").
128
145
  */
129
- placeholder: string
146
+ placeholder?: string
130
147
  children: ReactNode
131
148
  /** Optional class for the Select root. */
132
149
  rootClassName?: string
@@ -136,6 +153,7 @@ export type SelectProps<T extends object> = RACSelectProps<T> & {
136
153
 
137
154
  export const Select = <T extends object>({
138
155
  label,
156
+ labelSize = 'default',
139
157
  description,
140
158
  errorMessage,
141
159
  placeholder,
@@ -163,42 +181,55 @@ export const Select = <T extends object>({
163
181
 
164
182
  return (
165
183
  <SelectAppearanceContext.Provider value={appearance}>
166
- <RACSelect {...props} placeholder={placeholder} className={`group ${fieldStackClass} ${rootClassName ?? ''}`}>
167
- <Label className={isLabelHidden ? 'sr-only' : fieldLabelClass}>{label}</Label>
168
- {inFocus ? (
169
- <>
170
- {listbox}
171
- {desc}
172
- {err}
173
- </>
174
- ) : (
175
- <>
176
- <SelectTrigger className={triggerClassName} appearance={appearance} fieldSize={appearance === 'outlined' ? size : undefined}>
177
- {/* One line: a long value must not wrap out of the fixed-height box. */}
178
- <SelectValue className="min-w-0 truncate data-[placeholder]:text-fg-muted" />
179
- {/* gs chevron: 9.5px caret, dark (neutral-400 → fg), non-interactive. */}
180
- <svg
181
- width="9.5"
182
- height="9.5"
183
- viewBox="0 0 12 12"
184
- fill="none"
185
- aria-hidden="true"
186
- className="pointer-events-none shrink-0 text-fg"
187
- >
188
- <path d="M3 4.5L6 7.5L9 4.5" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
189
- </svg>
190
- </SelectTrigger>
191
- {desc}
192
- {err}
193
- {/* Filled uses the trigger width and Manager's 4px popup offset. */}
194
- <SelectPopover appearance={appearance} offset={appearance === 'filled' ? 4 : undefined}
195
- containerPadding={appearance === 'filled' ? 12 : undefined}
196
- style={appearance === 'filled' ? filledPopoverStyle : undefined}>
184
+ <RACSelect {...props} placeholder={placeholder} className={`group ${fieldStackClass} ${rootClassName ?? ''}`}>
185
+ <Label className={isLabelHidden ? 'sr-only' : fieldLabelClasses[labelSize]}>{label}</Label>
186
+ {inFocus ? (
187
+ <>
197
188
  {listbox}
198
- </SelectPopover>
199
- </>
200
- )}
201
- </RACSelect>
189
+ {desc}
190
+ {err}
191
+ </>
192
+ ) : (
193
+ <>
194
+ <SelectTrigger
195
+ className={triggerClassName}
196
+ appearance={appearance}
197
+ fieldSize={appearance === 'outlined' ? size : undefined}
198
+ >
199
+ {/* One line: a long value must not wrap out of the fixed-height box. */}
200
+ <SelectValue className="min-w-0 truncate data-[placeholder]:text-fg-muted" />
201
+ {/* gs chevron: 9.5px caret, dark (neutral-400 → fg), non-interactive. */}
202
+ <svg
203
+ width="9.5"
204
+ height="9.5"
205
+ viewBox="0 0 12 12"
206
+ fill="none"
207
+ aria-hidden="true"
208
+ className="pointer-events-none shrink-0 text-fg"
209
+ >
210
+ <path
211
+ d="M3 4.5L6 7.5L9 4.5"
212
+ stroke="currentColor"
213
+ strokeWidth="1.5"
214
+ strokeLinecap="round"
215
+ strokeLinejoin="round"
216
+ />
217
+ </svg>
218
+ </SelectTrigger>
219
+ {desc}
220
+ {err}
221
+ {/* Filled uses the trigger width and Manager's 4px popup offset. */}
222
+ <SelectPopover
223
+ appearance={appearance}
224
+ offset={appearance === 'filled' ? 4 : undefined}
225
+ containerPadding={appearance === 'filled' ? 12 : undefined}
226
+ style={appearance === 'filled' ? filledPopoverStyle : undefined}
227
+ >
228
+ {listbox}
229
+ </SelectPopover>
230
+ </>
231
+ )}
232
+ </RACSelect>
202
233
  </SelectAppearanceContext.Provider>
203
234
  )
204
235
  }