@djangocfg/ui-core 2.1.433 → 2.1.435
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": "@djangocfg/ui-core",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.435",
|
|
4
4
|
"description": "Pure React UI component library without Next.js dependencies - for Electron, Vite, CRA apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-components",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"check": "tsc --noEmit"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
|
-
"@djangocfg/i18n": "^2.1.
|
|
109
|
+
"@djangocfg/i18n": "^2.1.435",
|
|
110
110
|
"consola": "^3.4.2",
|
|
111
111
|
"lucide-react": "^0.545.0",
|
|
112
112
|
"moment": "^2.30.1",
|
|
@@ -180,8 +180,8 @@
|
|
|
180
180
|
"@chenglou/pretext": "*"
|
|
181
181
|
},
|
|
182
182
|
"devDependencies": {
|
|
183
|
-
"@djangocfg/i18n": "^2.1.
|
|
184
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
183
|
+
"@djangocfg/i18n": "^2.1.435",
|
|
184
|
+
"@djangocfg/typescript-config": "^2.1.435",
|
|
185
185
|
"@types/node": "^25.2.3",
|
|
186
186
|
"@types/react": "^19.2.15",
|
|
187
187
|
"@types/react-dom": "^19.2.3",
|
|
@@ -12,9 +12,9 @@ import { createPasteHandler, useSmartOTP } from './use-otp-input';
|
|
|
12
12
|
import type { SmartOTPProps } from './types'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Size variants for OTP slots.
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Size variants for OTP slots — fixed square dimensions (Vercel/Linear look).
|
|
16
|
+
* The boxes never stretch to the container width: a code is a small, tidy
|
|
17
|
+
* cluster of fixed cells, centered, not a row of full-width fields.
|
|
18
18
|
*/
|
|
19
19
|
const sizeVariants = {
|
|
20
20
|
sm: 'h-10 w-10 text-base',
|
|
@@ -22,14 +22,6 @@ const sizeVariants = {
|
|
|
22
22
|
lg: 'h-14 w-14 text-xl',
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
// Fluid mode: width is fed by flex-1, height by aspect-square. We only
|
|
26
|
-
// need to size the text inside the box.
|
|
27
|
-
const sizeTextVariants = {
|
|
28
|
-
sm: 'text-base',
|
|
29
|
-
default: 'text-lg',
|
|
30
|
-
lg: 'text-xl',
|
|
31
|
-
}
|
|
32
|
-
|
|
33
25
|
/**
|
|
34
26
|
* OTP Separator Component
|
|
35
27
|
*/
|
|
@@ -99,7 +91,6 @@ export const OTPInput = React.forwardRef<
|
|
|
99
91
|
size,
|
|
100
92
|
error = false,
|
|
101
93
|
success = false,
|
|
102
|
-
fluid = false,
|
|
103
94
|
...props
|
|
104
95
|
},
|
|
105
96
|
ref
|
|
@@ -160,9 +151,7 @@ export const OTPInput = React.forwardRef<
|
|
|
160
151
|
key={i}
|
|
161
152
|
index={i}
|
|
162
153
|
className={cn(
|
|
163
|
-
|
|
164
|
-
? `flex-1 min-w-0 aspect-square ${sizeTextVariants[resolvedSize]}`
|
|
165
|
-
: sizeVariants[resolvedSize],
|
|
154
|
+
sizeVariants[resolvedSize],
|
|
166
155
|
error && 'border-destructive ring-destructive/20',
|
|
167
156
|
success && 'border-success ring-success/20',
|
|
168
157
|
slotClassName
|
|
@@ -172,7 +161,7 @@ export const OTPInput = React.forwardRef<
|
|
|
172
161
|
}
|
|
173
162
|
|
|
174
163
|
return slotElements
|
|
175
|
-
}, [length, showSeparator, separatorPosition, separatorClassName, resolvedSize,
|
|
164
|
+
}, [length, showSeparator, separatorPosition, separatorClassName, resolvedSize, error, success, slotClassName])
|
|
176
165
|
|
|
177
166
|
return (
|
|
178
167
|
<InputOTP
|
|
@@ -182,12 +171,12 @@ export const OTPInput = React.forwardRef<
|
|
|
182
171
|
onChange={handleChange}
|
|
183
172
|
onComplete={handleComplete}
|
|
184
173
|
disabled={disabled}
|
|
185
|
-
containerClassName={cn('gap-2',
|
|
174
|
+
containerClassName={cn('gap-2', containerClassName)}
|
|
186
175
|
autoFocus={autoFocus}
|
|
187
176
|
onPaste={pasteHandler}
|
|
188
177
|
{...props}
|
|
189
178
|
>
|
|
190
|
-
<InputOTPGroup className=
|
|
179
|
+
<InputOTPGroup className="gap-2">{slots}</InputOTPGroup>
|
|
191
180
|
</InputOTP>
|
|
192
181
|
)
|
|
193
182
|
}
|
|
@@ -118,13 +118,6 @@ export interface SmartOTPProps {
|
|
|
118
118
|
* Success state
|
|
119
119
|
*/
|
|
120
120
|
success?: boolean
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Fluid mode — slots stretch to fill the full container width.
|
|
124
|
-
* Useful for responsive layouts where fixed slot widths would overflow.
|
|
125
|
-
* @default false
|
|
126
|
-
*/
|
|
127
|
-
fluid?: boolean
|
|
128
121
|
}
|
|
129
122
|
|
|
130
123
|
/**
|
|
@@ -65,7 +65,13 @@ export type { TCountryCode } from 'countries-list';
|
|
|
65
65
|
|
|
66
66
|
// LanguageSelect
|
|
67
67
|
export { LanguageSelect } from './language-select';
|
|
68
|
-
export type {
|
|
68
|
+
export type {
|
|
69
|
+
LanguageSelectProps,
|
|
70
|
+
LanguageSelectSize,
|
|
71
|
+
LanguageSelectVariant,
|
|
72
|
+
LanguageOption,
|
|
73
|
+
TLanguageCode,
|
|
74
|
+
} from './language-select';
|
|
69
75
|
|
|
70
76
|
// Shared types
|
|
71
77
|
export type {
|
|
@@ -25,6 +25,10 @@ export interface LanguageOption {
|
|
|
25
25
|
|
|
26
26
|
export type LanguageSelectVariant = 'dropdown' | 'inline';
|
|
27
27
|
|
|
28
|
+
/** Trigger size for the dropdown variant — mirrors Button/Input sizing.
|
|
29
|
+
* `default` = 40px form control; `sm` = 32px compact (settings rows, chips). */
|
|
30
|
+
export type LanguageSelectSize = 'default' | 'sm';
|
|
31
|
+
|
|
28
32
|
export interface LanguageSelectProps {
|
|
29
33
|
/** Selected language codes (ISO 639-1) */
|
|
30
34
|
value?: string[];
|
|
@@ -34,6 +38,8 @@ export interface LanguageSelectProps {
|
|
|
34
38
|
multiple?: boolean;
|
|
35
39
|
/** Display variant: dropdown (popover) or inline (scrollable list) */
|
|
36
40
|
variant?: LanguageSelectVariant;
|
|
41
|
+
/** Trigger size for the dropdown variant (default | sm). Mirrors Button. */
|
|
42
|
+
size?: LanguageSelectSize;
|
|
37
43
|
/** Placeholder text (default: "Select language...") */
|
|
38
44
|
placeholder?: string;
|
|
39
45
|
/** Search placeholder text (default: "Search...") */
|
|
@@ -121,6 +127,7 @@ export function LanguageSelect({
|
|
|
121
127
|
onChange,
|
|
122
128
|
multiple = false,
|
|
123
129
|
variant = 'dropdown',
|
|
130
|
+
size = 'default',
|
|
124
131
|
placeholder,
|
|
125
132
|
searchPlaceholder,
|
|
126
133
|
emptyText,
|
|
@@ -363,10 +370,17 @@ export function LanguageSelect({
|
|
|
363
370
|
<PopoverTrigger asChild>
|
|
364
371
|
<Button
|
|
365
372
|
variant="outline"
|
|
373
|
+
size={size === 'sm' ? 'sm' : 'default'}
|
|
366
374
|
role="combobox"
|
|
367
375
|
aria-expanded={open}
|
|
368
376
|
className={cn(
|
|
369
|
-
"w-full justify-between
|
|
377
|
+
"w-full justify-between",
|
|
378
|
+
// Single-select: a fixed-height pill (the Button size sets height).
|
|
379
|
+
// Multiple: allow growth so wrapped badges aren't clipped — keep the
|
|
380
|
+
// auto-height min behaviour, scaled to the chosen size.
|
|
381
|
+
multiple
|
|
382
|
+
? (size === 'sm' ? "min-h-8 h-auto py-1" : "min-h-10 h-auto py-2")
|
|
383
|
+
: (size === 'sm' ? "text-xs" : "h-10"),
|
|
370
384
|
className
|
|
371
385
|
)}
|
|
372
386
|
disabled={disabled}
|
|
@@ -374,17 +388,25 @@ export function LanguageSelect({
|
|
|
374
388
|
<div className="flex-1 text-left overflow-hidden">
|
|
375
389
|
{displayValue}
|
|
376
390
|
</div>
|
|
377
|
-
<ChevronsUpDown className="ml-2 h-
|
|
391
|
+
<ChevronsUpDown className={cn("ml-2 shrink-0 opacity-50", size === 'sm' ? "h-3.5 w-3.5" : "h-4 w-4")} />
|
|
378
392
|
</Button>
|
|
379
393
|
</PopoverTrigger>
|
|
380
|
-
|
|
394
|
+
{/* The list must stay readable even when the trigger is a narrow
|
|
395
|
+
status-bar/settings pill: grow to the trigger width but never below a
|
|
396
|
+
legible min, so language names aren't clipped to "En…". */}
|
|
397
|
+
<PopoverContent
|
|
398
|
+
className="w-auto min-w-[var(--radix-popover-trigger-width)] p-0 [--lang-min:11rem] [min-width:max(var(--radix-popover-trigger-width),var(--lang-min))]"
|
|
399
|
+
align="start"
|
|
400
|
+
>
|
|
381
401
|
<Command shouldFilter={false} className="flex flex-col">
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
402
|
+
{showSearch && (
|
|
403
|
+
<CommandInput
|
|
404
|
+
placeholder={resolvedSearchPlaceholder}
|
|
405
|
+
className="shrink-0"
|
|
406
|
+
value={search}
|
|
407
|
+
onValueChange={setSearch}
|
|
408
|
+
/>
|
|
409
|
+
)}
|
|
388
410
|
<CommandList className="max-h-[300px] overflow-y-auto">
|
|
389
411
|
{filteredLanguages.length === 0 ? (
|
|
390
412
|
<CommandEmpty>{resolvedEmptyText}</CommandEmpty>
|