@frontile/theme 0.18.0 → 0.18.2
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/declarations/components/avatar.d.ts +66 -0
- package/declarations/components/avatar.d.ts.map +1 -1
- package/declarations/components/chip.d.ts +18 -0
- package/declarations/components/chip.d.ts.map +1 -1
- package/declarations/components/forms/forms.d.ts +264 -1
- package/declarations/components/forms/forms.d.ts.map +1 -1
- package/dist/index.js +204 -3
- package/dist/index.js.map +1 -1
- package/package.json +8 -9
package/dist/index.js
CHANGED
|
@@ -318,7 +318,7 @@ const alert = tv({
|
|
|
318
318
|
|
|
319
319
|
const avatar = tv({
|
|
320
320
|
slots: {
|
|
321
|
-
base: ['flex', 'relative', 'justify-center', 'items-center', 'box-border', 'overflow-hidden', 'align-middle', 'text-neutral-strong', 'z-0', 'bg-neutral-subtle'
|
|
321
|
+
base: ['flex', 'relative', 'justify-center', 'items-center', 'box-border', 'overflow-hidden', 'align-middle', 'text-neutral-strong', 'z-0', 'bg-neutral-subtle'],
|
|
322
322
|
img: 'size-full',
|
|
323
323
|
name: ['w-full', 'font-label', 'text-center', 'text-inherit', 'absolute', 'top-1/2', 'left-1/2', '-translate-x-1/2', '-translate-y-1/2', 'select-none']
|
|
324
324
|
},
|
|
@@ -343,11 +343,72 @@ const avatar = tv({
|
|
|
343
343
|
xl: {
|
|
344
344
|
base: 'size-12 text-label-lg'
|
|
345
345
|
}
|
|
346
|
+
},
|
|
347
|
+
/**
|
|
348
|
+
* How the image fills the avatar. `cover` crops to fill, which suits
|
|
349
|
+
* photos. `contain` shows the whole image inset from the edge, which suits
|
|
350
|
+
* logos and wordmarks that must not be cropped.
|
|
351
|
+
*/
|
|
352
|
+
fit: {
|
|
353
|
+
cover: {
|
|
354
|
+
img: 'object-cover'
|
|
355
|
+
},
|
|
356
|
+
contain: {
|
|
357
|
+
img: 'object-contain'
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
/**
|
|
361
|
+
* Draws a hairline just inside the edge, so the avatar's shape holds
|
|
362
|
+
* against a page or photo of the same colour.
|
|
363
|
+
*/
|
|
364
|
+
isBordered: {
|
|
365
|
+
true: {
|
|
366
|
+
// On ::after so it paints over the image; an inset box-shadow on the
|
|
367
|
+
// root would sit beneath the <img>. A single translucent line, not an
|
|
368
|
+
// offset ring, so an image does not get a gap and a second edge.
|
|
369
|
+
base: ['after:absolute after:inset-0 after:rounded-[inherit]', 'after:pointer-events-none', 'after:ring-1 after:ring-inset after:ring-surface-overlay-mild']
|
|
370
|
+
}
|
|
346
371
|
}
|
|
347
372
|
},
|
|
373
|
+
compoundVariants: [
|
|
374
|
+
// The inset keeps a contained image off the round edge. It lives on the
|
|
375
|
+
// img, so padding shrinks the box `object-contain` fits into.
|
|
376
|
+
{
|
|
377
|
+
fit: 'contain',
|
|
378
|
+
size: 'xs',
|
|
379
|
+
class: {
|
|
380
|
+
img: 'p-px'
|
|
381
|
+
}
|
|
382
|
+
}, {
|
|
383
|
+
fit: 'contain',
|
|
384
|
+
size: 'sm',
|
|
385
|
+
class: {
|
|
386
|
+
img: 'p-0.5'
|
|
387
|
+
}
|
|
388
|
+
}, {
|
|
389
|
+
fit: 'contain',
|
|
390
|
+
size: 'md',
|
|
391
|
+
class: {
|
|
392
|
+
img: 'p-0.5'
|
|
393
|
+
}
|
|
394
|
+
}, {
|
|
395
|
+
fit: 'contain',
|
|
396
|
+
size: 'lg',
|
|
397
|
+
class: {
|
|
398
|
+
img: 'p-1'
|
|
399
|
+
}
|
|
400
|
+
}, {
|
|
401
|
+
fit: 'contain',
|
|
402
|
+
size: 'xl',
|
|
403
|
+
class: {
|
|
404
|
+
img: 'p-1'
|
|
405
|
+
}
|
|
406
|
+
}],
|
|
348
407
|
defaultVariants: {
|
|
349
408
|
size: 'md',
|
|
350
|
-
shape: 'circle'
|
|
409
|
+
shape: 'circle',
|
|
410
|
+
fit: 'cover',
|
|
411
|
+
isBordered: true
|
|
351
412
|
}
|
|
352
413
|
});
|
|
353
414
|
|
|
@@ -835,6 +896,17 @@ const chip = tv({
|
|
|
835
896
|
}
|
|
836
897
|
},
|
|
837
898
|
size: {
|
|
899
|
+
// For dense UI — table cells, list rows, multi-select fields. It keeps
|
|
900
|
+
// `sm`'s text size and loses height and padding instead: 12px is about
|
|
901
|
+
// as small as a label stays readable. The close button drops to
|
|
902
|
+
// `label-micro` so its circle (icon plus `p-0.5`) still fits the 20px
|
|
903
|
+
// chip.
|
|
904
|
+
xs: {
|
|
905
|
+
base: 'text-label-2xs px-0.5 h-5',
|
|
906
|
+
content: 'px-1',
|
|
907
|
+
dot: 'size-1.5',
|
|
908
|
+
closeButton: 'text-label-micro'
|
|
909
|
+
},
|
|
838
910
|
sm: {
|
|
839
911
|
base: 'text-label-2xs px-1 h-6',
|
|
840
912
|
content: 'px-1',
|
|
@@ -3417,6 +3489,40 @@ const formFeedback = tv({
|
|
|
3417
3489
|
// invalid/disabled treatments. Shared by the `input` slot and by `select`'s
|
|
3418
3490
|
// `chipsField`, which becomes the shell when chips render beside the trigger.
|
|
3419
3491
|
const fieldShell = ['bg-surface-input', 'border', 'border-neutral-soft', 'rounded-xl', 'selection:bg-surface-overlay-soft'];
|
|
3492
|
+
|
|
3493
|
+
/**
|
|
3494
|
+
* The field shell for a segmented date field.
|
|
3495
|
+
*
|
|
3496
|
+
* It goes on the container rather than on the segment row, so the clear and
|
|
3497
|
+
* calendar buttons sit inside the border with the segments. Focus lands on an
|
|
3498
|
+
* individual segment, never on the container, so the ring is `focus-within`;
|
|
3499
|
+
* and `role="group"` supports neither `aria-invalid` nor `aria-readonly`, so
|
|
3500
|
+
* the invalid and disabled states are read from data attributes the host
|
|
3501
|
+
* writes instead of from ARIA.
|
|
3502
|
+
*/
|
|
3503
|
+
const segmentedFieldShell = ['relative flex items-center w-full', ...fieldShell, 'font-body text-base leading-tight text-neutral-strong', 'focus-within:ring-3', 'focus-within:ring-focus', 'focus-within:border-primary', 'data-[invalid=true]:border-danger', 'data-[invalid=true]:focus-within:ring-danger-muted', 'data-[disabled=true]:border-neutral-subtle', 'data-[disabled=true]:text-neutral-soft'];
|
|
3504
|
+
|
|
3505
|
+
/**
|
|
3506
|
+
* The segment row, shared by `dateInput` and `datePicker`.
|
|
3507
|
+
*
|
|
3508
|
+
* Spread into both rather than duplicated: the tv() note below excuses
|
|
3509
|
+
* restating slots *inherited from `input`*, which is a typing constraint --
|
|
3510
|
+
* these are new strings, and keeping two copies had already let `gap-0` land
|
|
3511
|
+
* in one and not the other.
|
|
3512
|
+
*/
|
|
3513
|
+
const segmentRowSlots = {
|
|
3514
|
+
// `tabular-nums` stops the field twitching as digits change width;
|
|
3515
|
+
// `select-none` keeps a drag across segments from starting a text selection
|
|
3516
|
+
// that spans them.
|
|
3517
|
+
group: 'flex items-center flex-1 min-w-0 gap-0 tabular-nums select-none',
|
|
3518
|
+
segment: ['rounded-xs px-px outline-none caret-transparent', 'focus:bg-primary focus:text-on-primary', 'data-[placeholder=true]:text-neutral',
|
|
3519
|
+
// The focused segment is filled with `primary`, so a placeholder sitting
|
|
3520
|
+
// in it has to take the contrast colour too. Stated as a combined variant
|
|
3521
|
+
// rather than relying on source order: both rules are one class deep
|
|
3522
|
+
// otherwise, and whichever Tailwind emits last would win.
|
|
3523
|
+
'focus:data-[placeholder=true]:text-on-primary', 'data-[disabled=true]:pointer-events-none'],
|
|
3524
|
+
literal: 'text-neutral-soft px-px'
|
|
3525
|
+
};
|
|
3420
3526
|
const input = tv({
|
|
3421
3527
|
slots: {
|
|
3422
3528
|
base: '',
|
|
@@ -3805,6 +3911,11 @@ const datePicker = tv({
|
|
|
3805
3911
|
base: [],
|
|
3806
3912
|
placeholder: 'text-neutral',
|
|
3807
3913
|
input: 'cursor-default text-left',
|
|
3914
|
+
// Restated from `input` rather than inherited: tv() drops inherited slot
|
|
3915
|
+
// names from the variant type, and `isSegmented` below has to target
|
|
3916
|
+
// both of these.
|
|
3917
|
+
innerContainer: 'relative flex',
|
|
3918
|
+
endContent: 'absolute inset-y-0 right-0 flex items-center',
|
|
3808
3919
|
// The calendar sits in the popover, which supplies its own surface and
|
|
3809
3920
|
// padding, so this only reserves room around the grid.
|
|
3810
3921
|
calendar: 'p-2',
|
|
@@ -3818,7 +3929,13 @@ const datePicker = tv({
|
|
|
3818
3929
|
// calendar decide how wide the popover is, and the buttons wrap within it.
|
|
3819
3930
|
footer: ['flex flex-wrap items-center gap-2', 'w-0 min-w-full', 'border-t border-neutral-soft p-2'],
|
|
3820
3931
|
icon: 'w-5 h-5',
|
|
3821
|
-
clearButton: 'pointer-events-auto'
|
|
3932
|
+
clearButton: 'pointer-events-auto',
|
|
3933
|
+
...segmentRowSlots,
|
|
3934
|
+
// Sits between the two groups of a `@mode="range"` field. `DatePicker`
|
|
3935
|
+
// renders it, not `SegmentGroup` -- it separates groups rather than
|
|
3936
|
+
// living inside one.
|
|
3937
|
+
separator: 'text-neutral px-1',
|
|
3938
|
+
calendarButton: 'pointer-events-auto'
|
|
3822
3939
|
},
|
|
3823
3940
|
variants: {
|
|
3824
3941
|
// The trigger is a `<button>` whose text *is* the value, so with neither a
|
|
@@ -3842,6 +3959,89 @@ const datePicker = tv({
|
|
|
3842
3959
|
lg: {
|
|
3843
3960
|
input: 'min-h-[calc(1.25rem+2rem+2px)]'
|
|
3844
3961
|
}
|
|
3962
|
+
},
|
|
3963
|
+
// The segmented trigger renders no `<button>`, so nothing carries the
|
|
3964
|
+
// field shell. It moves onto the container, which is also what puts the
|
|
3965
|
+
// clear and calendar buttons inside the border rather than beyond it.
|
|
3966
|
+
isSegmented: {
|
|
3967
|
+
true: {
|
|
3968
|
+
innerContainer: segmentedFieldShell,
|
|
3969
|
+
// With no trigger underneath to click through to, the cluster sits in
|
|
3970
|
+
// flow beside the segments instead of floating over the field's right
|
|
3971
|
+
// edge.
|
|
3972
|
+
// `ms-auto` rather than relying on the group's `flex-1` to push it:
|
|
3973
|
+
// in range mode the groups no longer grow (see `isRange`), so without
|
|
3974
|
+
// this the cluster would sit tight against the end group instead of
|
|
3975
|
+
// at the field's right edge.
|
|
3976
|
+
endContent: 'static top-auto bottom-auto right-auto p-0 gap-1 shrink-0 ms-auto'
|
|
3977
|
+
}
|
|
3978
|
+
},
|
|
3979
|
+
// Two groups sharing one shell must not each claim half of it -- growing
|
|
3980
|
+
// would strand the separator in the middle of the field with a gap of
|
|
3981
|
+
// dead space on either side, instead of reading as one `start - end`
|
|
3982
|
+
// phrase. The end content takes the slack instead.
|
|
3983
|
+
// `flex-none`, not `grow-0`: the group's `flex-1` is `flex: 1 1 0%`, so
|
|
3984
|
+
// removing only the grow leaves a 0% basis with shrink still on and the
|
|
3985
|
+
// group collapses to zero width with its segments overflowing it.
|
|
3986
|
+
isRange: {
|
|
3987
|
+
true: {
|
|
3988
|
+
group: 'flex-none'
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
},
|
|
3992
|
+
compoundVariants: [
|
|
3993
|
+
// Padding follows the shell onto the container, for the same reason.
|
|
3994
|
+
{
|
|
3995
|
+
isSegmented: true,
|
|
3996
|
+
size: 'sm',
|
|
3997
|
+
class: {
|
|
3998
|
+
innerContainer: 'p-2'
|
|
3999
|
+
}
|
|
4000
|
+
}, {
|
|
4001
|
+
isSegmented: true,
|
|
4002
|
+
size: 'md',
|
|
4003
|
+
class: {
|
|
4004
|
+
innerContainer: 'p-3'
|
|
4005
|
+
}
|
|
4006
|
+
}, {
|
|
4007
|
+
isSegmented: true,
|
|
4008
|
+
size: 'lg',
|
|
4009
|
+
class: {
|
|
4010
|
+
innerContainer: 'p-4'
|
|
4011
|
+
}
|
|
4012
|
+
}],
|
|
4013
|
+
defaultVariants: {
|
|
4014
|
+
size: 'md'
|
|
4015
|
+
}
|
|
4016
|
+
});
|
|
4017
|
+
|
|
4018
|
+
// Extends `input` directly, not `datePicker`: tv() loses slot types across a
|
|
4019
|
+
// two-level extend, which is why `datePicker` extends `input` too.
|
|
4020
|
+
const dateInput = tv({
|
|
4021
|
+
extend: input,
|
|
4022
|
+
slots: {
|
|
4023
|
+
base: [],
|
|
4024
|
+
innerContainer: segmentedFieldShell,
|
|
4025
|
+
...segmentRowSlots,
|
|
4026
|
+
endContent: 'flex items-center gap-1 shrink-0',
|
|
4027
|
+
icon: 'w-5 h-5',
|
|
4028
|
+
clearButton: 'pointer-events-auto',
|
|
4029
|
+
calendarButton: 'pointer-events-auto'
|
|
4030
|
+
},
|
|
4031
|
+
variants: {
|
|
4032
|
+
// `input`'s size variant pads the `input` slot, which a segmented field
|
|
4033
|
+
// does not render -- the padding has to move onto the container that
|
|
4034
|
+
// actually draws the shell.
|
|
4035
|
+
size: {
|
|
4036
|
+
sm: {
|
|
4037
|
+
innerContainer: 'p-2'
|
|
4038
|
+
},
|
|
4039
|
+
md: {
|
|
4040
|
+
innerContainer: 'p-3'
|
|
4041
|
+
},
|
|
4042
|
+
lg: {
|
|
4043
|
+
innerContainer: 'p-4'
|
|
4044
|
+
}
|
|
3845
4045
|
}
|
|
3846
4046
|
},
|
|
3847
4047
|
defaultVariants: {
|
|
@@ -4105,6 +4305,7 @@ var components = /*#__PURE__*/Object.freeze({
|
|
|
4105
4305
|
closeButton: closeButton,
|
|
4106
4306
|
command: command,
|
|
4107
4307
|
commandDialog: commandDialog,
|
|
4308
|
+
dateInput: dateInput,
|
|
4108
4309
|
datePicker: datePicker,
|
|
4109
4310
|
divider: divider,
|
|
4110
4311
|
drawer: drawer,
|