@obosbbl/grunnmuren-react 2.0.0-canary.11 → 2.0.0-canary.12
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/dist/index.mjs +19 -27
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ const formField = cx('group flex flex-col gap-2');
|
|
|
10
10
|
const formFieldError = cx('w-fit rounded-sm bg-red-light px-2 py-1 text-sm leading-6 text-red');
|
|
11
11
|
const input = cva({
|
|
12
12
|
base: [
|
|
13
|
-
'rounded-md
|
|
13
|
+
'rounded-md py-2.5 text-sm font-normal leading-6 placeholder-[#727070] outline-none ring-1 ring-black',
|
|
14
14
|
// invalid styles
|
|
15
15
|
'group-data-[invalid]:ring-2 group-data-[invalid]:ring-red',
|
|
16
16
|
// Fix invisible ring on safari: https://github.com/tailwindlabs/tailwindcss.com/issues/1135
|
|
@@ -23,9 +23,8 @@ const input = cva({
|
|
|
23
23
|
visible: 'data-[focus-visible]:ring-2 group-data-[invalid]:data-[focus-visible]:ring'
|
|
24
24
|
},
|
|
25
25
|
isGrouped: {
|
|
26
|
-
false: '',
|
|
27
|
-
|
|
28
|
-
true: 'flex-1 !ring-0 first:pl-0 last:pr-0'
|
|
26
|
+
false: 'px-3',
|
|
27
|
+
true: 'flex-1 !ring-0'
|
|
29
28
|
}
|
|
30
29
|
},
|
|
31
30
|
defaultVariants: {
|
|
@@ -33,7 +32,12 @@ const input = cva({
|
|
|
33
32
|
isGrouped: false
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
|
-
const inputGroup = cx(
|
|
35
|
+
const inputGroup = cx([
|
|
36
|
+
'inline-flex items-center gap-3 overflow-hidden rounded-md px-3 text-sm ring-1 ring-black focus-within:ring-2',
|
|
37
|
+
'group-data-[invalid]:ring-2 group-data-[invalid]:ring-red group-data-[invalid]:focus-within:ring',
|
|
38
|
+
// Make sure icons are the correct size
|
|
39
|
+
'[&_svg]:text-base'
|
|
40
|
+
]);
|
|
37
41
|
const dropdown = {
|
|
38
42
|
popover: cx('min-w-[--trigger-width] overflow-auto rounded-md border border-black bg-white shadow data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in data-[exiting]:fade-out'),
|
|
39
43
|
listbox: cx('text-sm outline-none'),
|
|
@@ -202,6 +206,12 @@ const ListBoxItem = (props)=>{
|
|
|
202
206
|
});
|
|
203
207
|
};
|
|
204
208
|
|
|
209
|
+
function InputAddonDivider() {
|
|
210
|
+
return /*#__PURE__*/ jsx("span", {
|
|
211
|
+
className: "block h-6 w-px flex-none bg-black"
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
|
|
205
215
|
function Combobox(props, ref) {
|
|
206
216
|
const { className, children, description, errorMessage, isLoading, label, isInvalid: _isInvalid, ...restProps } = props;
|
|
207
217
|
const isInvalid = _isInvalid || errorMessage != null;
|
|
@@ -419,9 +429,7 @@ function TextField(props, ref) {
|
|
|
419
429
|
className: inputGroup,
|
|
420
430
|
children: [
|
|
421
431
|
leftAddon,
|
|
422
|
-
withAddonDivider && leftAddon && /*#__PURE__*/ jsx(
|
|
423
|
-
className: "ml-3"
|
|
424
|
-
}),
|
|
432
|
+
withAddonDivider && leftAddon && /*#__PURE__*/ jsx(InputAddonDivider, {}),
|
|
425
433
|
/*#__PURE__*/ jsx(Input, {
|
|
426
434
|
className: inputWithAlignment$1({
|
|
427
435
|
textAlign,
|
|
@@ -429,9 +437,7 @@ function TextField(props, ref) {
|
|
|
429
437
|
}),
|
|
430
438
|
ref: ref
|
|
431
439
|
}),
|
|
432
|
-
withAddonDivider && rightAddon && /*#__PURE__*/ jsx(
|
|
433
|
-
className: "mr-3"
|
|
434
|
-
}),
|
|
440
|
+
withAddonDivider && rightAddon && /*#__PURE__*/ jsx(InputAddonDivider, {}),
|
|
435
441
|
rightAddon
|
|
436
442
|
]
|
|
437
443
|
}) : /*#__PURE__*/ jsx(Input, {
|
|
@@ -446,11 +452,6 @@ function TextField(props, ref) {
|
|
|
446
452
|
]
|
|
447
453
|
});
|
|
448
454
|
}
|
|
449
|
-
function Divider$1({ className }) {
|
|
450
|
-
return /*#__PURE__*/ jsx("span", {
|
|
451
|
-
className: cx(className, 'block h-6 w-px flex-none bg-black')
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
455
|
const _TextField = /*#__PURE__*/ forwardRef(TextField);
|
|
455
456
|
|
|
456
457
|
// This component is based on a copy of ../textfield/TextField, refactoring is TBD: https://github.com/code-obos/grunnmuren/pull/722#issuecomment-1931478786
|
|
@@ -481,9 +482,7 @@ function NumberField(props, ref) {
|
|
|
481
482
|
className: inputGroup,
|
|
482
483
|
children: [
|
|
483
484
|
leftAddon,
|
|
484
|
-
withAddonDivider && leftAddon && /*#__PURE__*/ jsx(
|
|
485
|
-
className: "ml-3"
|
|
486
|
-
}),
|
|
485
|
+
withAddonDivider && leftAddon && /*#__PURE__*/ jsx(InputAddonDivider, {}),
|
|
487
486
|
/*#__PURE__*/ jsx(Input, {
|
|
488
487
|
className: inputWithAlignment({
|
|
489
488
|
textAlign,
|
|
@@ -491,9 +490,7 @@ function NumberField(props, ref) {
|
|
|
491
490
|
}),
|
|
492
491
|
ref: ref
|
|
493
492
|
}),
|
|
494
|
-
withAddonDivider && rightAddon && /*#__PURE__*/ jsx(
|
|
495
|
-
className: "mr-3"
|
|
496
|
-
}),
|
|
493
|
+
withAddonDivider && rightAddon && /*#__PURE__*/ jsx(InputAddonDivider, {}),
|
|
497
494
|
rightAddon
|
|
498
495
|
]
|
|
499
496
|
}) : /*#__PURE__*/ jsx(Input, {
|
|
@@ -508,11 +505,6 @@ function NumberField(props, ref) {
|
|
|
508
505
|
]
|
|
509
506
|
});
|
|
510
507
|
}
|
|
511
|
-
function Divider({ className }) {
|
|
512
|
-
return /*#__PURE__*/ jsx("span", {
|
|
513
|
-
className: cx(className, 'block h-6 w-px flex-none bg-black')
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
508
|
const _NumberField = /*#__PURE__*/ forwardRef(NumberField);
|
|
517
509
|
|
|
518
510
|
export { _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, _Combobox as Combobox, ListBoxItem as ComboboxItem, _NumberField as NumberField, _Radio as Radio, _RadioGroup as RadioGroup, _Select as Select, ListBoxItem as SelectItem, _TextArea as TextArea, _TextField as TextField };
|