@obosbbl/grunnmuren-react 2.0.0-canary.1 → 2.0.0-canary.11

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 ADDED
@@ -0,0 +1,518 @@
1
+ import { Text, CheckboxContext, Checkbox as Checkbox$1, Label as Label$1, CheckboxGroup as CheckboxGroup$1, FieldError, ListBoxItem as ListBoxItem$1, ListBox as ListBox$1, ComboBox, Group, Input, Button, Popover, RadioGroup as RadioGroup$1, Radio as Radio$1, Select as Select$1, SelectValue, TextField as TextField$1, TextArea as TextArea$1, NumberField as NumberField$1 } from 'react-aria-components';
2
+ export { Form, I18nProvider } from 'react-aria-components';
3
+ export { _ as Button } from './Button-client-XmGlKEk4.js';
4
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
+ import { forwardRef, useId } from 'react';
6
+ import { cx, cva, compose } from 'cva';
7
+ import { Check, LoadingSpinner, ChevronDown } from '@obosbbl/grunnmuren-icons-react';
8
+
9
+ const formField = cx('group flex flex-col gap-2');
10
+ const formFieldError = cx('w-fit rounded-sm bg-red-light px-2 py-1 text-sm leading-6 text-red');
11
+ const input = cva({
12
+ base: [
13
+ 'rounded-md px-3 py-2.5 text-sm font-normal leading-6 placeholder-[#727070] outline-none ring-1 ring-black',
14
+ // invalid styles
15
+ 'group-data-[invalid]:ring-2 group-data-[invalid]:ring-red',
16
+ // Fix invisible ring on safari: https://github.com/tailwindlabs/tailwindcss.com/issues/1135
17
+ 'appearance-none'
18
+ ],
19
+ variants: {
20
+ // Focus rings. Can either be :focus or :focus-visible based on the needs of the particular component.
21
+ focusModifier: {
22
+ focus: 'focus:ring-2 group-data-[invalid]:focus:ring',
23
+ visible: 'data-[focus-visible]:ring-2 group-data-[invalid]:data-[focus-visible]:ring'
24
+ },
25
+ isGrouped: {
26
+ false: '',
27
+ //
28
+ true: 'flex-1 !ring-0 first:pl-0 last:pr-0'
29
+ }
30
+ },
31
+ defaultVariants: {
32
+ focusModifier: 'focus',
33
+ isGrouped: false
34
+ }
35
+ });
36
+ const inputGroup = cx('inline-flex items-center overflow-hidden rounded-md px-3 ring-1 ring-black focus-within:ring-2 group-data-[invalid]:ring-2 group-data-[invalid]:ring-red group-data-[invalid]:focus-within:ring');
37
+ const dropdown = {
38
+ 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
+ listbox: cx('text-sm outline-none'),
40
+ chevronIcon: cx('text-base transition-transform duration-150 group-data-[open]:rotate-180 motion-reduce:transition-none')
41
+ };
42
+
43
+ function ErrorMessage(props) {
44
+ const { children, className, ...restProps } = props;
45
+ return /*#__PURE__*/ jsx(Text, {
46
+ ...restProps,
47
+ className: cx(className, formFieldError),
48
+ slot: "errorMessage",
49
+ children: children
50
+ });
51
+ }
52
+
53
+ function Description(props) {
54
+ const { className, ...restProps } = props;
55
+ return /*#__PURE__*/ jsx(Text, {
56
+ ...restProps,
57
+ className: cx(className, 'text-sm font-light leading-6'),
58
+ slot: "description"
59
+ });
60
+ }
61
+
62
+ const defaultClasses$1 = cx([
63
+ 'group relative left-0 inline-flex max-w-fit cursor-pointer items-start gap-4 py-2 leading-7'
64
+ ]);
65
+ // Pulling this out into it's own component. Will probably export it in the future
66
+ // so it can be used in other views, outside of an input of type checkbox, like in table rows.
67
+ function CheckmarkBox() {
68
+ return /*#__PURE__*/ jsx("span", {
69
+ className: cx([
70
+ 'relative left-0 grid flex-none place-content-center rounded-sm border-2 border-black text-white',
71
+ // to vertically align the radio we need to calculate the label's height, which is equal to it's font size multiplied by the line height.
72
+ // For the ::before psuedo element the line height of the label is always 1em.
73
+ // When we know the height of the label we use the height of the radio to push it down to align with the label's first line
74
+ // TODO: 1.75 here is the unit less lineheight, altough we use 1.75rem as the line height, so there is a mismatch here. Revisit this when we've worked on typography in v2. Should this be a CSS custom property instead?
75
+ 'mt-[calc((1em_*_1.75_-_24px)_/_2)] h-[24px] w-[24px]',
76
+ // selected
77
+ 'group-data-[selected]:!border-green group-data-[selected]:!bg-green',
78
+ // focus
79
+ 'group-data-[focus-visible]:ring-2 group-data-[focus-visible]:ring-black group-data-[focus-visible]:ring-offset-[9px]',
80
+ // hovered
81
+ 'group-data-[hovered]:border-green group-data-[hovered]:group-data-[invalid]:border-red group-data-[hovered]:bg-green-lightest group-data-[hovered]:group-data-[invalid]:bg-red-light',
82
+ // invalid - The border is 1 px thicker when invalid. We don't actually want to change the border width, as that causes the element's size to change
83
+ // so we use an inner shadow of 1 px instead to pad the actual border
84
+ 'group-data-[invalid]:border-red group-data-[invalid]:group-data-[selected]:shadow-none group-data-[invalid]:shadow-[inset_0_0_0_1px] group-data-[invalid]:shadow-red'
85
+ ]),
86
+ children: /*#__PURE__*/ jsx(Check, {
87
+ className: "h-full w-full opacity-0 group-data-[selected]:opacity-100"
88
+ })
89
+ });
90
+ }
91
+ function Checkbox(props, ref) {
92
+ const { children, className, description, errorMessage, isInvalid: _isInvalid, ...restProps } = props;
93
+ const id = useId();
94
+ const descriptionId = 'desc' + id;
95
+ const errorMessageId = 'error' + id;
96
+ const isInvalid = _isInvalid || errorMessage != null;
97
+ return /*#__PURE__*/ jsx("div", {
98
+ children: /*#__PURE__*/ jsxs(CheckboxContext.Provider, {
99
+ value: {
100
+ 'aria-describedby': description ? descriptionId : undefined,
101
+ 'aria-errormessage': errorMessage ? errorMessageId : undefined
102
+ },
103
+ children: [
104
+ /*#__PURE__*/ jsxs(Checkbox$1, {
105
+ ...restProps,
106
+ className: cx(className, defaultClasses$1),
107
+ isInvalid: isInvalid,
108
+ ref: ref,
109
+ children: [
110
+ /*#__PURE__*/ jsx("span", {
111
+ className: "absolute -left-2.5 top-0 z-10 h-11 w-11"
112
+ }),
113
+ /*#__PURE__*/ jsx(CheckmarkBox, {}),
114
+ children
115
+ ]
116
+ }),
117
+ description && /*#__PURE__*/ jsx(Description, {
118
+ className: "block",
119
+ id: descriptionId,
120
+ children: description
121
+ }),
122
+ errorMessage && /*#__PURE__*/ jsx(ErrorMessage, {
123
+ className: "mt-2 block",
124
+ id: errorMessageId,
125
+ children: errorMessage
126
+ })
127
+ ]
128
+ })
129
+ });
130
+ }
131
+ const _Checkbox = /*#__PURE__*/ forwardRef(Checkbox);
132
+
133
+ function Label(props) {
134
+ const { children, className, ...restProps } = props;
135
+ return /*#__PURE__*/ jsx(Label$1, {
136
+ className: cx(className, 'font-semibold leading-7'),
137
+ ...restProps,
138
+ children: children
139
+ });
140
+ }
141
+
142
+ function CheckboxGroup(props, ref) {
143
+ const { children, className, description, errorMessage, label, isRequired, isInvalid: _isInvalid, ...restProps } = props;
144
+ const isInvalid = _isInvalid || errorMessage != null;
145
+ return /*#__PURE__*/ jsxs(CheckboxGroup$1, {
146
+ ...restProps,
147
+ className: cx(className, 'flex flex-col gap-2'),
148
+ isInvalid: isInvalid,
149
+ isRequired: isRequired,
150
+ ref: ref,
151
+ children: [
152
+ label && /*#__PURE__*/ jsx(Label, {
153
+ children: label
154
+ }),
155
+ description && /*#__PURE__*/ jsx(Description, {
156
+ children: description
157
+ }),
158
+ children,
159
+ errorMessage && /*#__PURE__*/ jsx(ErrorMessage, {
160
+ children: errorMessage
161
+ })
162
+ ]
163
+ });
164
+ }
165
+ const _CheckboxGroup = /*#__PURE__*/ forwardRef(CheckboxGroup);
166
+
167
+ /**
168
+ * This component handles renders a custom error message (if provided), otherwise it falls back to the browser's native validation.
169
+ * In other words, this handles controlled and uncontrolled form errors.
170
+ */ function ErrorMessageOrFieldError({ errorMessage }) {
171
+ return errorMessage ? /*#__PURE__*/ jsx(ErrorMessage, {
172
+ children: errorMessage
173
+ }) : /*#__PURE__*/ jsx(FieldError, {
174
+ className: formFieldError
175
+ });
176
+ }
177
+
178
+ const ListBox = ({ className, ...restProps })=>/*#__PURE__*/ jsx(ListBox$1, {
179
+ ...restProps,
180
+ className: cx(dropdown.listbox, className)
181
+ });
182
+ const ListBoxItem = (props)=>{
183
+ let textValue = props.textValue;
184
+ // When the ListBoxItem child isn't a string we have to set textValue for keyboard completion to work.
185
+ // Since we use a render function (to handle the selected state) the child is never a string.
186
+ // This condition adds back that behaviour
187
+ if (textValue == null && typeof props.children === 'string') {
188
+ textValue = props.children;
189
+ }
190
+ return /*#__PURE__*/ jsx(ListBoxItem$1, {
191
+ ...props,
192
+ className: cx(props.className, 'flex cursor-pointer px-6 py-3 leading-6 outline-none data-[focused]:bg-sky-lightest'),
193
+ textValue: textValue,
194
+ children: ({ isSelected })=>/*#__PURE__*/ jsxs(Fragment, {
195
+ children: [
196
+ isSelected && /*#__PURE__*/ jsx(Check, {
197
+ className: "-ml-6 text-base"
198
+ }),
199
+ props.children
200
+ ]
201
+ })
202
+ });
203
+ };
204
+
205
+ function Combobox(props, ref) {
206
+ const { className, children, description, errorMessage, isLoading, label, isInvalid: _isInvalid, ...restProps } = props;
207
+ const isInvalid = _isInvalid || errorMessage != null;
208
+ return /*#__PURE__*/ jsxs(ComboBox, {
209
+ ...restProps,
210
+ className: cx(className, formField),
211
+ isInvalid: isInvalid,
212
+ children: [
213
+ label && /*#__PURE__*/ jsx(Label, {
214
+ children: label
215
+ }),
216
+ description && /*#__PURE__*/ jsx(Description, {
217
+ children: description
218
+ }),
219
+ /*#__PURE__*/ jsxs(Group, {
220
+ className: inputGroup,
221
+ children: [
222
+ /*#__PURE__*/ jsx(Input, {
223
+ className: input({
224
+ isGrouped: true
225
+ }),
226
+ ref: ref
227
+ }),
228
+ /*#__PURE__*/ jsx(Button, {
229
+ children: isLoading ? /*#__PURE__*/ jsx(LoadingSpinner, {
230
+ className: "animate-spin"
231
+ }) : /*#__PURE__*/ jsx(ChevronDown, {
232
+ className: dropdown.chevronIcon
233
+ })
234
+ })
235
+ ]
236
+ }),
237
+ /*#__PURE__*/ jsx(ErrorMessageOrFieldError, {
238
+ errorMessage: errorMessage
239
+ }),
240
+ /*#__PURE__*/ jsx(Popover, {
241
+ // FIXME: The trigger width doesn't include the padding of the group, so for now we have to apply this workaround.
242
+ // Also... the combobox border gets a pixel wider when focused, so we account for that as well when calculating the width
243
+ // and the offset.
244
+ // The input gutter should probably be moved to a theme variable instead of using the hardcoded value as here.
245
+ className: cx(dropdown.popover, 'min-w-[calc(var(--trigger-width)+26px)]'),
246
+ crossOffset: -13,
247
+ children: /*#__PURE__*/ jsx(ListBox, {
248
+ children: children
249
+ })
250
+ })
251
+ ]
252
+ });
253
+ }
254
+ const _Combobox = /*#__PURE__*/ forwardRef(Combobox);
255
+
256
+ function RadioGroup(props, ref) {
257
+ const { children, className, description, errorMessage, label, isRequired, isInvalid: _isInvalid, ...restProps } = props;
258
+ const isInvalid = _isInvalid || errorMessage != null;
259
+ return /*#__PURE__*/ jsxs(RadioGroup$1, {
260
+ ...restProps,
261
+ className: cx(className, 'flex flex-col gap-2'),
262
+ isInvalid: isInvalid,
263
+ isRequired: isRequired,
264
+ ref: ref,
265
+ children: [
266
+ label && /*#__PURE__*/ jsx(Label, {
267
+ children: label
268
+ }),
269
+ description && /*#__PURE__*/ jsx(Description, {
270
+ children: description
271
+ }),
272
+ children,
273
+ errorMessage && /*#__PURE__*/ jsx(ErrorMessage, {
274
+ children: errorMessage
275
+ })
276
+ ]
277
+ });
278
+ }
279
+ const _RadioGroup = /*#__PURE__*/ forwardRef(RadioGroup);
280
+
281
+ const defaultClasses = cx([
282
+ 'relative inline-flex max-w-fit cursor-pointer items-start gap-4 py-2 leading-7',
283
+ // the radio button itself
284
+ 'before:flex-none before:rounded-full before:border-2 before:border-black',
285
+ // to vertically align the radio we need to calculate the label's height, which is equal to it's font size multiplied by the line height.
286
+ // For the ::before psuedo element the line height of the label is always 1em.
287
+ // When we know the height of the label we use the height of the radio to push it down to align with the label's first line
288
+ // TODO: 1.75 here is the unit less lineheight, altough we use 1.75rem as the line height, so there is a mismatch here. Revisit this when we've worked on typography in v2. Should this be a CSS custom property instead?
289
+ 'before:mt-[calc((1em_*_1.75_-_24px)_/_2)] before:h-[24px] before:w-[24px]',
290
+ // selected
291
+ 'data-[selected]:before:border-black data-[selected]:before:bg-green data-[selected]:before:shadow-[inset_0_0_0_4px_rgb(255,255,255)]',
292
+ // hover
293
+ 'data-[hovered]:before:border-green data-[hovered]:before:bg-green-lightest data-[hovered]:data-[invalid]:before:bg-red-light',
294
+ // focus
295
+ 'data-[focus-visible]:before:ring data-[focus-visible]:before:ring-black data-[focus-visible]:before:ring-offset-[9px]',
296
+ // invalid - The border is 1 px thicker when invalid. We don't actually want to change the border width, as that causes the element's size to change
297
+ // so we use an inner outline to artifically pad the border
298
+ 'data-[invalid]:before:outline-solid data-[invalid]:before:border-red data-[invalid]:data-[selected]:before:!bg-red data-[invalid]:before:outline data-[invalid]:before:outline-[3px] data-[invalid]:before:outline-offset-[-3px] data-[invalid]:before:outline-red'
299
+ ]);
300
+ function Radio(props, ref) {
301
+ const { children, className, description, ...restProps } = props;
302
+ return /*#__PURE__*/ jsxs(Radio$1, {
303
+ ...restProps,
304
+ className: cx(className, defaultClasses),
305
+ ref: ref,
306
+ children: [
307
+ /*#__PURE__*/ jsx("span", {
308
+ className: "absolute -left-2.5 top-0 z-10 h-11 w-11 "
309
+ }),
310
+ /*#__PURE__*/ jsxs("div", {
311
+ children: [
312
+ children,
313
+ description && /*#__PURE__*/ jsx(Description, {
314
+ className: "mt-2 block",
315
+ children: description
316
+ })
317
+ ]
318
+ })
319
+ ]
320
+ });
321
+ }
322
+ const _Radio = /*#__PURE__*/ forwardRef(Radio);
323
+
324
+ function Select(props, ref) {
325
+ const { className, children, description, errorMessage, label, isInvalid: _isInvalid, ...restProps } = props;
326
+ const isInvalid = _isInvalid || errorMessage != null;
327
+ return /*#__PURE__*/ jsxs(Select$1, {
328
+ ...restProps,
329
+ className: cx(className, formField),
330
+ isInvalid: isInvalid,
331
+ children: [
332
+ label && /*#__PURE__*/ jsx(Label, {
333
+ children: label
334
+ }),
335
+ description && /*#__PURE__*/ jsx(Description, {
336
+ children: description
337
+ }),
338
+ /*#__PURE__*/ jsxs(Button, {
339
+ className: cx(input({
340
+ focusModifier: 'visible'
341
+ }), // How to reuse placeholder text?
342
+ 'inline-flex cursor-default items-center gap-2'),
343
+ // See https://github.com/adobe/react-spectrum/discussions/4792#discussioncomment-6492305
344
+ ref: ref,
345
+ children: [
346
+ /*#__PURE__*/ jsx(SelectValue, {
347
+ className: "flex-1 truncate text-left data-[placeholder]:text-[#727070]"
348
+ }),
349
+ /*#__PURE__*/ jsx(ChevronDown, {
350
+ className: dropdown.chevronIcon
351
+ })
352
+ ]
353
+ }),
354
+ /*#__PURE__*/ jsx(ErrorMessageOrFieldError, {
355
+ errorMessage: errorMessage
356
+ }),
357
+ /*#__PURE__*/ jsx(Popover, {
358
+ className: dropdown.popover,
359
+ children: /*#__PURE__*/ jsx(ListBox, {
360
+ children: children
361
+ })
362
+ })
363
+ ]
364
+ });
365
+ }
366
+ const _Select = /*#__PURE__*/ forwardRef(Select);
367
+
368
+ function TextArea(props, ref) {
369
+ const { className, description, errorMessage, label, isInvalid: _isInvalid, rows, ...restProps } = props;
370
+ const isInvalid = _isInvalid || errorMessage != null;
371
+ return /*#__PURE__*/ jsxs(TextField$1, {
372
+ ...restProps,
373
+ className: cx(className, formField),
374
+ isInvalid: isInvalid,
375
+ children: [
376
+ label && /*#__PURE__*/ jsx(Label, {
377
+ children: label
378
+ }),
379
+ description && /*#__PURE__*/ jsx(Description, {
380
+ children: description
381
+ }),
382
+ /*#__PURE__*/ jsx(TextArea$1, {
383
+ className: input(),
384
+ rows: rows,
385
+ ref: ref
386
+ }),
387
+ /*#__PURE__*/ jsx(ErrorMessageOrFieldError, {
388
+ errorMessage: errorMessage
389
+ })
390
+ ]
391
+ });
392
+ }
393
+ const _TextArea = /*#__PURE__*/ forwardRef(TextArea);
394
+
395
+ const inputWithAlignment$1 = compose(input, cva({
396
+ base: '',
397
+ variants: {
398
+ textAlign: {
399
+ right: 'text-right',
400
+ left: ''
401
+ }
402
+ }
403
+ }));
404
+ function TextField(props, ref) {
405
+ const { className, description, errorMessage, label, leftAddon, isInvalid: _isInvalid, textAlign, rightAddon, withAddonDivider, ...restProps } = props;
406
+ const isInvalid = _isInvalid || errorMessage != null;
407
+ return /*#__PURE__*/ jsxs(TextField$1, {
408
+ ...restProps,
409
+ className: cx(className, formField),
410
+ isInvalid: isInvalid,
411
+ children: [
412
+ label && /*#__PURE__*/ jsx(Label, {
413
+ children: label
414
+ }),
415
+ description && /*#__PURE__*/ jsx(Description, {
416
+ children: description
417
+ }),
418
+ leftAddon || rightAddon ? /*#__PURE__*/ jsxs(Group, {
419
+ className: inputGroup,
420
+ children: [
421
+ leftAddon,
422
+ withAddonDivider && leftAddon && /*#__PURE__*/ jsx(Divider$1, {
423
+ className: "ml-3"
424
+ }),
425
+ /*#__PURE__*/ jsx(Input, {
426
+ className: inputWithAlignment$1({
427
+ textAlign,
428
+ isGrouped: true
429
+ }),
430
+ ref: ref
431
+ }),
432
+ withAddonDivider && rightAddon && /*#__PURE__*/ jsx(Divider$1, {
433
+ className: "mr-3"
434
+ }),
435
+ rightAddon
436
+ ]
437
+ }) : /*#__PURE__*/ jsx(Input, {
438
+ className: inputWithAlignment$1({
439
+ textAlign
440
+ }),
441
+ ref: ref
442
+ }),
443
+ /*#__PURE__*/ jsx(ErrorMessageOrFieldError, {
444
+ errorMessage: errorMessage
445
+ })
446
+ ]
447
+ });
448
+ }
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
+ const _TextField = /*#__PURE__*/ forwardRef(TextField);
455
+
456
+ // This component is based on a copy of ../textfield/TextField, refactoring is TBD: https://github.com/code-obos/grunnmuren/pull/722#issuecomment-1931478786
457
+ const inputWithAlignment = compose(input, cva({
458
+ base: '',
459
+ variants: {
460
+ textAlign: {
461
+ right: 'text-right',
462
+ left: ''
463
+ }
464
+ }
465
+ }));
466
+ function NumberField(props, ref) {
467
+ const { className, description, errorMessage, label, leftAddon, isInvalid: _isInvalid, textAlign, rightAddon, withAddonDivider, ...restProps } = props;
468
+ const isInvalid = _isInvalid || errorMessage != null;
469
+ return /*#__PURE__*/ jsxs(NumberField$1, {
470
+ ...restProps,
471
+ className: cx(className, formField),
472
+ isInvalid: isInvalid,
473
+ children: [
474
+ label && /*#__PURE__*/ jsx(Label, {
475
+ children: label
476
+ }),
477
+ description && /*#__PURE__*/ jsx(Description, {
478
+ children: description
479
+ }),
480
+ leftAddon || rightAddon ? /*#__PURE__*/ jsxs(Group, {
481
+ className: inputGroup,
482
+ children: [
483
+ leftAddon,
484
+ withAddonDivider && leftAddon && /*#__PURE__*/ jsx(Divider, {
485
+ className: "ml-3"
486
+ }),
487
+ /*#__PURE__*/ jsx(Input, {
488
+ className: inputWithAlignment({
489
+ textAlign,
490
+ isGrouped: true
491
+ }),
492
+ ref: ref
493
+ }),
494
+ withAddonDivider && rightAddon && /*#__PURE__*/ jsx(Divider, {
495
+ className: "mr-3"
496
+ }),
497
+ rightAddon
498
+ ]
499
+ }) : /*#__PURE__*/ jsx(Input, {
500
+ className: inputWithAlignment({
501
+ textAlign
502
+ }),
503
+ ref: ref
504
+ }),
505
+ /*#__PURE__*/ jsx(ErrorMessageOrFieldError, {
506
+ errorMessage: errorMessage
507
+ })
508
+ ]
509
+ });
510
+ }
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
+ const _NumberField = /*#__PURE__*/ forwardRef(NumberField);
517
+
518
+ 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "2.0.0-canary.1",
3
+ "version": "2.0.0-canary.11",
4
4
  "description": "Grunnmuren components in React",
5
5
  "repository": {
6
6
  "url": "https://github.com/code-obos/grunnmuren"
@@ -9,54 +9,24 @@
9
9
  "sideEffects": false,
10
10
  "type": "module",
11
11
  "exports": {
12
- "./button": {
13
- "types": "./dist/button/Button.d.ts",
14
- "default": "./dist/button/Button.mjs"
15
- },
16
- "./checkbox": {
17
- "types": "./dist/checkbox/index.d.ts",
18
- "default": "./dist/checkbox/index.mjs"
19
- },
20
- "./label": {
21
- "types": "./dist/label/index.d.ts",
22
- "default": "./dist/label/index.mjs"
23
- },
24
- "./radiogroup": {
25
- "types": "./dist/radiogroup/index.d.ts",
26
- "default": "./dist/radiogroup/index.mjs"
27
- },
28
- "./textfield": {
29
- "types": "./dist/textfield/index.d.ts",
30
- "default": "./dist/textfield/index.mjs"
12
+ ".": {
13
+ "types": "./dist/index.d.mts",
14
+ "default": "./dist/index.mjs"
31
15
  }
32
16
  },
33
17
  "files": [
34
18
  "dist"
35
19
  ],
36
20
  "dependencies": {
37
- "@obosbbl/grunnmuren-icons-react": "^2.0.0-canary.0",
21
+ "@obosbbl/grunnmuren-icons-react": "^2.0.0-canary.1",
22
+ "@react-aria/utils": "^3.23.0",
38
23
  "cva": "1.0.0-beta.1",
39
- "react-aria-components": "1.0.0-rc.0"
24
+ "react-aria-components": "^1.0.0"
40
25
  },
41
26
  "peerDependencies": {
42
27
  "react": "^18"
43
28
  },
44
- "unbuild": {
45
- "entries": [
46
- "./src/button/Button.tsx",
47
- "./src/checkbox/index.ts",
48
- "./src/label/index.ts",
49
- "./src/radiogroup/index.ts",
50
- "./src/textfield/index.ts"
51
- ],
52
- "declaration": true,
53
- "rollup": {
54
- "esbuild": {
55
- "jsx": "automatic"
56
- }
57
- }
58
- },
59
29
  "scripts": {
60
- "build": "unbuild"
30
+ "build": "bunchee"
61
31
  }
62
32
  }
@@ -1,83 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { VariantProps } from 'cva';
3
-
4
- /**
5
- * Figma: https://www.figma.com/file/9OvSg0ZXI5E1eQYi7AWiWn/Grunnmuren-2.0-%E2%94%82-Designsystem?node-id=30%3A2574&mode=dev
6
- */
7
- declare const buttonVariants: (props?: ({
8
- variant?: "primary" | "secondary" | "tertiary" | undefined;
9
- color?: "green" | "mint" | "white" | undefined;
10
- isIconOnly?: boolean | undefined;
11
- } & ({
12
- class?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
13
- [x: string]: any;
14
- } | null | undefined)[] | {
15
- [x: string]: any;
16
- } | null | undefined)[] | {
17
- [x: string]: any;
18
- } | null | undefined)[] | {
19
- [x: string]: any;
20
- } | null | undefined)[] | {
21
- [x: string]: any;
22
- } | null | undefined)[] | {
23
- [x: string]: any;
24
- } | null | undefined)[] | {
25
- [x: string]: any;
26
- } | null | undefined)[] | {
27
- [x: string]: any;
28
- } | null | undefined)[] | {
29
- [x: string]: any;
30
- } | null | undefined)[] | {
31
- [x: string]: any;
32
- } | null | undefined)[] | {
33
- [x: string]: any;
34
- } | null | undefined)[] | {
35
- [x: string]: any;
36
- } | null | undefined;
37
- className?: undefined;
38
- } | {
39
- class?: undefined;
40
- className?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
41
- [x: string]: any;
42
- } | null | undefined)[] | {
43
- [x: string]: any;
44
- } | null | undefined)[] | {
45
- [x: string]: any;
46
- } | null | undefined)[] | {
47
- [x: string]: any;
48
- } | null | undefined)[] | {
49
- [x: string]: any;
50
- } | null | undefined)[] | {
51
- [x: string]: any;
52
- } | null | undefined)[] | {
53
- [x: string]: any;
54
- } | null | undefined)[] | {
55
- [x: string]: any;
56
- } | null | undefined)[] | {
57
- [x: string]: any;
58
- } | null | undefined)[] | {
59
- [x: string]: any;
60
- } | null | undefined)[] | {
61
- [x: string]: any;
62
- } | null | undefined)[] | {
63
- [x: string]: any;
64
- } | null | undefined;
65
- })) | undefined) => string;
66
- type ButtonOrLinkProps = (React.ComponentPropsWithoutRef<'button'> & {
67
- href?: never;
68
- }) | (React.ComponentPropsWithoutRef<'a'> & {
69
- href: string;
70
- });
71
- type ButtonProps = VariantProps<typeof buttonVariants> & {
72
- className?: string;
73
- children: React.ReactNode;
74
- /**
75
- * Display the button in a loading state
76
- * @default false
77
- */
78
- loading?: boolean;
79
- style?: React.CSSProperties;
80
- } & ButtonOrLinkProps;
81
- declare function Button(props: ButtonProps): react_jsx_runtime.JSX.Element;
82
-
83
- export { Button, type ButtonProps };