@obosbbl/grunnmuren-react 0.3.0 → 1.1.0

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.
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ interface CampaignProps<T extends React.ElementType> {
3
+ /** @default div */
4
+ as?: T;
5
+ body: React.ReactElement;
6
+ /** Use the `body` and `image` props. */
7
+ children?: never;
8
+ image: React.ReactElement;
9
+ /**
10
+ * Setting this to false changes the ordering of the body and the image on >= medium sceens.
11
+ * Use this to alternate the image's positon with lists of Campaigns.
12
+ * @default true
13
+ */
14
+ rightAlignBody?: boolean;
15
+ }
16
+ declare const Campaign: {
17
+ <T extends import("react").ElementType<any> = "div">(props: CampaignProps<T> & Omit<import("react").PropsWithoutRef<import("react").ComponentProps<T>>, keyof CampaignProps<T>>): JSX.Element;
18
+ Body: (props: CampaignBodyProps) => JSX.Element;
19
+ Image: (props: CampaignImageProps) => JSX.Element;
20
+ };
21
+ interface CampaignBodyProps extends React.ComponentPropsWithoutRef<'div'> {
22
+ }
23
+ interface CampaignImageProps extends React.ComponentPropsWithoutRef<'img'> {
24
+ }
25
+ export { Campaign };
@@ -0,0 +1 @@
1
+ export * from './Campaign';
@@ -5,5 +5,7 @@
5
5
  export interface CheckboxProps extends React.ComponentPropsWithRef<'input'> {
6
6
  children: React.ReactNode;
7
7
  className?: string;
8
+ /** Error message for the form control */
9
+ error?: string;
8
10
  }
9
- export declare const Checkbox: import("react").ForwardRefExoticComponent<Pick<CheckboxProps, "className" | "children" | "form" | "slot" | "style" | "title" | "pattern" | "list" | "role" | "key" | "alt" | "crossOrigin" | "height" | "src" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "multiple" | "maxLength" | "minLength" | "enterKeyHint" | "max" | "min" | "readOnly" | "required" | "size"> & import("react").RefAttributes<HTMLInputElement>>;
11
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Pick<CheckboxProps, "className" | "children" | "form" | "slot" | "style" | "title" | "pattern" | "list" | "role" | "error" | "key" | "alt" | "crossOrigin" | "height" | "src" | "width" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "autoFocus" | "disabled" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "name" | "type" | "value" | "autoComplete" | "accept" | "capture" | "checked" | "multiple" | "maxLength" | "minLength" | "enterKeyHint" | "max" | "min" | "readOnly" | "required" | "size"> & import("react").RefAttributes<HTMLInputElement>>;
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ interface StepListProps extends React.ComponentPropsWithoutRef<'ol'> {
3
+ }
4
+ declare const StepList: {
5
+ (props: StepListProps): JSX.Element;
6
+ Item: (props: StepListItemProps) => JSX.Element;
7
+ };
8
+ interface StepListItemProps extends React.ComponentPropsWithoutRef<'li'> {
9
+ /** Content for the StepListItem's bullet */
10
+ bullet: React.ReactNode;
11
+ }
12
+ export declare const StepListItem: (props: StepListItemProps) => JSX.Element;
13
+ export { StepList };
@@ -0,0 +1 @@
1
+ export * from './StepList';
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
31
31
  };
32
32
  import classNames from "clsx";
33
33
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
34
- import { useCallback, useState, useEffect, useId, forwardRef, useContext, createContext, useMemo, useRef } from "react";
34
+ import { useCallback, useState, useEffect, useId, forwardRef, useContext, createContext, isValidElement, Children, cloneElement, useMemo, useRef } from "react";
35
35
  var __defProp2 = Object.defineProperty;
36
36
  var __defProps2 = Object.defineProperties;
37
37
  var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
@@ -77,36 +77,6 @@ const InfoCircle = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spread
77
77
  d: "M16 0C12.8355 0 9.74207 0.938384 7.11088 2.69649C4.4797 4.45459 2.42894 6.95345 1.21793 9.87707C0.0069325 12.8007 -0.309921 16.0177 0.307443 19.1214C0.924806 22.2251 2.44866 25.0761 4.6863 27.3137C6.92394 29.5513 9.77487 31.0752 12.8786 31.6926C15.9823 32.3099 19.1993 31.9931 22.1229 30.7821C25.0466 29.5711 27.5454 27.5203 29.3035 24.8891C31.0616 22.2579 32 19.1645 32 16C32 11.7565 30.3143 7.68687 27.3137 4.68629C24.3131 1.68571 20.2435 0 16 0ZM18 26H14V15H18V26ZM18 11H14V7H18V11Z"
78
78
  })
79
79
  }));
80
- const Mail = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
81
- width: "1.25em",
82
- height: "1.25em",
83
- fill: "none",
84
- viewBox: "0 0 28 22",
85
- role: "img",
86
- "aria-hidden": props["aria-label"] == null
87
- }, props), {
88
- children: /* @__PURE__ */ jsx("path", {
89
- fill: "currentColor",
90
- fillRule: "evenodd",
91
- d: "M28 4L15.984 10.866C15.3797 11.2112 14.6959 11.3927 14 11.3927C13.3041 11.3927 12.6203 11.2112 12.016 10.866L0 4C0 2.93913 0.421427 1.92172 1.17157 1.17157C1.92172 0.421427 2.93913 0 4 0H24C25.0609 0 26.0783 0.421427 26.8284 1.17157C27.5786 1.92172 28 2.93913 28 4ZM0 9L12 16H16L28 9V18C28 19.0609 27.5786 20.0783 26.8284 20.8284C26.0783 21.5786 25.0609 22 24 22H4C2.93913 22 1.92172 21.5786 1.17157 20.8284C0.421427 20.0783 0 19.0609 0 18V9Z",
92
- clipRule: "evenodd"
93
- })
94
- }));
95
- const MapPin = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
96
- width: "1.25em",
97
- height: "1.25em",
98
- fill: "none",
99
- viewBox: "0 0 22 35",
100
- role: "img",
101
- "aria-hidden": props["aria-label"] == null
102
- }, props), {
103
- children: /* @__PURE__ */ jsx("path", {
104
- fill: "currentColor",
105
- fillRule: "evenodd",
106
- d: "M2.51 17.205L2.28 16.915H2.24C1.09834 15.315 0.41945 13.4314 0.277819 11.471C0.136187 9.51058 0.537288 7.54902 1.43711 5.80154C2.33694 4.05407 3.70071 2.58821 5.37881 1.56481C7.0569 0.541404 8.98446 0 10.95 0C12.9155 0 14.8431 0.541404 16.5212 1.56481C18.1993 2.58821 19.5631 4.05407 20.4629 5.80154C21.3627 7.54902 21.7638 9.51058 21.6222 11.471C21.4806 13.4314 20.8017 15.315 19.66 16.915L19.43 17.215L19.43 17.215C19.33 17.345 19.23 17.475 19.12 17.595L14.12 24.015C13.828 24.6005 13.3785 25.0931 12.8221 25.4374C12.2657 25.7816 11.6243 25.964 10.97 25.964C10.3157 25.964 9.67431 25.7816 9.11789 25.4374C8.56147 25.0931 8.11202 24.6005 7.82 24.015L2.82 17.605C2.74304 17.514 2.67097 17.4182 2.60037 17.3243C2.57007 17.284 2.54004 17.244 2.51 17.205ZM14 8.00497H8V14.005H14V8.00497ZM4 30.005H18L22 34.005H0L4 30.005Z",
107
- clipRule: "evenodd"
108
- })
109
- }));
110
80
  const MenuAlt = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
111
81
  width: "1.25em",
112
82
  height: "1.25em",
@@ -122,19 +92,6 @@ const MenuAlt = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadVal
122
92
  clipRule: "evenodd"
123
93
  })
124
94
  }));
125
- const Mobile = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
126
- width: "1.25em",
127
- height: "1.25em",
128
- fill: "none",
129
- viewBox: "0 0 22 32",
130
- role: "img",
131
- "aria-hidden": props["aria-label"] == null
132
- }, props), {
133
- children: /* @__PURE__ */ jsx("path", {
134
- fill: "currentColor",
135
- d: "M18 0H4C2.93914 0 1.92172 0.421427 1.17157 1.17157C0.421427 1.92172 0 2.93913 0 4V28C0 29.0609 0.421427 30.0783 1.17157 30.8284C1.92172 31.5786 2.93914 32 4 32H18C19.0609 32 20.0783 31.5786 20.8284 30.8284C21.5786 30.0783 22 29.0609 22 28V4C22 2.93913 21.5786 1.92172 20.8284 1.17157C20.0783 0.421427 19.0609 0 18 0ZM13.036 28H9.036V24H13.036V28ZM16.036 20H6.036V6H16.036V20Z"
136
- })
137
- }));
138
95
  const Warning = (props) => /* @__PURE__ */ jsx("svg", __spreadProps2(__spreadValues2({
139
96
  width: "1.25em",
140
97
  height: "1.25em",
@@ -368,6 +325,62 @@ const Button = forwardRef((props, ref) => {
368
325
  });
369
326
  });
370
327
  const ButtonColorContext = createContext("standard");
328
+ const CampaignContext = createContext(true);
329
+ const Campaign = (props) => {
330
+ const _a = props, {
331
+ as: Component = "div",
332
+ body: Body,
333
+ className,
334
+ image: Image,
335
+ rightAlignBody = true
336
+ } = _a, rest = __objRest(_a, [
337
+ "as",
338
+ "body",
339
+ "className",
340
+ "image",
341
+ "rightAlignBody"
342
+ ]);
343
+ return /* @__PURE__ */ jsxs(Component, __spreadProps(__spreadValues({
344
+ className: classNames(className, "grid gap-8 md:grid-flow-col md:grid-cols-[50%,50%] md:gap-0")
345
+ }, rest), {
346
+ children: [/* @__PURE__ */ jsx(CampaignContext.Provider, {
347
+ value: rightAlignBody,
348
+ children: Image
349
+ }), Body]
350
+ }));
351
+ };
352
+ const CampaignBody = (props) => {
353
+ const _a = props, {
354
+ className
355
+ } = _a, rest = __objRest(_a, [
356
+ "className"
357
+ ]);
358
+ return /* @__PURE__ */ jsx("div", __spreadValues({
359
+ className: classNames(className, "md:mx-18 self-center")
360
+ }, rest));
361
+ };
362
+ const CampaignImage = (props) => {
363
+ const _a = props, {
364
+ className: classNameProp,
365
+ children
366
+ } = _a, rest = __objRest(_a, [
367
+ "className",
368
+ "children"
369
+ ]);
370
+ const bodyIsRightAligned = useContext(CampaignContext);
371
+ const className = classNames(classNameProp, "<md:rounded-b-3xl w-full", bodyIsRightAligned ? "md:rounded-r-3xl" : "md:rounded-l-3xl md:order-1");
372
+ if (isValidElement(children)) {
373
+ const child = Children.only(children);
374
+ return cloneElement(child, __spreadValues({
375
+ className
376
+ }, rest));
377
+ }
378
+ return /* @__PURE__ */ jsx("img", __spreadValues({
379
+ className
380
+ }, rest));
381
+ };
382
+ Campaign.Body = CampaignBody;
383
+ Campaign.Image = CampaignImage;
371
384
  const Card = (props) => {
372
385
  const _a = props, {
373
386
  as: Component = "div",
@@ -423,26 +436,52 @@ const CardContent = (props) => {
423
436
  }, rest));
424
437
  };
425
438
  const CardLinkOverlay = forwardRef((props, ref) => {
439
+ const _a = props, {
440
+ className
441
+ } = _a, rest = __objRest(_a, [
442
+ "className"
443
+ ]);
426
444
  return /* @__PURE__ */ jsx("a", __spreadValues({
427
- className: "no-underline before:absolute before:top-0 before:left-0 before:block before:h-full before:w-full before:content-[''] hover:underline",
445
+ className: classNames(className, "no-underline before:absolute before:top-0 before:left-0 before:block before:h-full before:w-full hover:underline"),
428
446
  ref
429
- }, props));
447
+ }, rest));
430
448
  });
431
449
  const Checkbox = forwardRef((props, ref) => {
432
450
  const _a = props, {
433
451
  children,
434
- className
452
+ className,
453
+ error,
454
+ id: idProp
435
455
  } = _a, rest = __objRest(_a, [
436
456
  "children",
437
- "className"
457
+ "className",
458
+ "error",
459
+ "id"
438
460
  ]);
439
- return /* @__PURE__ */ jsxs("label", {
440
- className: classNames(className, "inline-flex cursor-pointer items-center"),
441
- children: [/* @__PURE__ */ jsx("input", __spreadValues({
442
- className: "checkbox border-gray-dark checked:bg-green checked:border-green mr-3 grid h-[1.25em] w-[1.25em] cursor-pointer appearance-none place-content-center rounded border-2 border-solid bg-white text-white focus:outline-none focus:ring-2 focus:ring-black",
443
- ref,
444
- type: "checkbox"
445
- }, rest)), children]
461
+ const id = useFallbackId(idProp);
462
+ const errorMsgId = id + "err";
463
+ return /* @__PURE__ */ jsxs("div", {
464
+ className: "grid gap-2",
465
+ children: [/* @__PURE__ */ jsxs("label", {
466
+ className: classNames(className, "inline-flex cursor-pointer items-center"),
467
+ children: [/* @__PURE__ */ jsx("input", __spreadProps(__spreadValues({
468
+ id,
469
+ className: classNames("checkbox checked:bg-green checked:border-green bg-whit mr-3 grid h-[1.25em] w-[1.25em] flex-none cursor-pointer appearance-none place-content-center rounded border-2 border-solid text-white focus:outline-none focus:ring-2", {
470
+ "border-gray-dark focus:ring-black": !error,
471
+ "border-red focus:ring-red": !!error
472
+ }),
473
+ ref,
474
+ type: "checkbox"
475
+ }, rest), {
476
+ "aria-describedby": classNames({
477
+ [errorMsgId]: !!error
478
+ }),
479
+ "aria-invalid": !!error
480
+ })), children]
481
+ }), !!error && /* @__PURE__ */ jsx(FormErrorMessage, {
482
+ id: errorMsgId,
483
+ children: error
484
+ })]
446
485
  });
447
486
  });
448
487
  const Footer = (props) => {
@@ -722,30 +761,6 @@ const HeroActions = (props) => {
722
761
  })
723
762
  }, rest));
724
763
  };
725
- const IconLegacy = (props) => {
726
- var _b;
727
- const _a = props, {
728
- className,
729
- name
730
- } = _a, rest = __objRest(_a, [
731
- "className",
732
- "name"
733
- ]);
734
- const IconComponent = (_b = iconMap[name]) != null ? _b : IconFallback;
735
- return /* @__PURE__ */ jsx(IconComponent, __spreadValues({
736
- className: classNames(className, "inline")
737
- }, rest));
738
- };
739
- const IconFallback = (props) => /* @__PURE__ */ jsx("svg", __spreadValues({
740
- "aria-hidden": props["aria-label"] == null,
741
- height: "1.25em",
742
- width: "1.25em"
743
- }, props));
744
- const iconMap = {
745
- mapmarker: MapPin,
746
- smartphone: Mobile,
747
- envelope: Mail
748
- };
749
764
  const Input = forwardRef((props, ref) => {
750
765
  const _a = props, {
751
766
  className,
@@ -993,10 +1008,10 @@ const SnackbarContent = (props) => {
993
1008
  children: props.children
994
1009
  }));
995
1010
  };
996
- const Stepper = (props) => {
1011
+ const StepList = (props) => {
997
1012
  return /* @__PURE__ */ jsx("ol", __spreadValues({}, props));
998
1013
  };
999
- const Step = (props) => {
1014
+ const StepListItem = (props) => {
1000
1015
  const _a = props, {
1001
1016
  className,
1002
1017
  children,
@@ -1009,22 +1024,18 @@ const Step = (props) => {
1009
1024
  return /* @__PURE__ */ jsxs("li", __spreadProps(__spreadValues({
1010
1025
  className: classNames(className, "group relative flex gap-4 pb-8 text-sm last:pb-0 md:gap-8 md:pb-12 md:text-base")
1011
1026
  }, rest), {
1012
- children: [/* @__PURE__ */ jsx(StepBullet, {
1027
+ children: [/* @__PURE__ */ jsx(StepListBullet, {
1013
1028
  children: bullet
1014
1029
  }), children]
1015
1030
  }));
1016
1031
  };
1017
- const StepBullet = (props) => {
1018
- const _a = props, {
1019
- className
1020
- } = _a, rest = __objRest(_a, [
1021
- "className"
1022
- ]);
1032
+ const StepListBullet = (props) => {
1023
1033
  return /* @__PURE__ */ jsx("span", __spreadValues({
1024
1034
  "aria-hidden": true,
1025
- className: classNames(className, "text-green border-gray-light after:bg-gray-light grid h-10 w-10 flex-none place-content-center rounded-full border-2 text-sm font-bold after:absolute after:left-5 after:top-10 after:bottom-0 after:w-0.5 group-last:after:hidden md:h-20 md:w-20 md:text-xl md:after:left-10 md:after:top-20")
1026
- }, rest));
1035
+ className: "text-green border-gray-light after:bg-gray-light grid h-10 w-10 flex-none place-content-center rounded-full border-2 text-sm font-bold after:absolute after:left-5 after:top-10 after:bottom-0 after:w-0.5 group-last:after:hidden md:h-20 md:w-20 md:text-xl md:after:left-10 md:after:top-20"
1036
+ }, props));
1027
1037
  };
1038
+ StepList.Item = StepListItem;
1028
1039
  const TextArea = forwardRef((props, ref) => {
1029
1040
  const _a = props, {
1030
1041
  description,
@@ -1129,4 +1140,4 @@ const TextField = forwardRef((props, ref) => {
1129
1140
  })]
1130
1141
  });
1131
1142
  });
1132
- export { Alert, Banner, BannerImage, Button, ButtonColorContext, Card, CardContent, CardImage, CardLinkOverlay, CardList, Checkbox, Footer, Form, FormError, FormErrorMessage, FormHeading, FormHelperText, FormLabel, FormSuccess, Hero, HeroActions, HeroContent, HeroContext, HeroImage, IconLegacy, Input, Link, Navbar, NavbarCollapsible, NavbarContent, NavbarExpandedMobileContent, NavbarItem, NavbarItems, Snackbar, SnackbarButton, SnackbarContent, Step, StepBullet, Stepper, TextArea, TextField, assignRef, useBlockBackgroundColor, useComposedRefs, useFallbackId, useFormControlValidity, useMedia, usePrefersReducedMotion, useScreenMaxWidthMd };
1143
+ export { Alert, Banner, BannerImage, Button, ButtonColorContext, Campaign, Card, CardContent, CardImage, CardLinkOverlay, CardList, Checkbox, Footer, Form, FormError, FormErrorMessage, FormHeading, FormHelperText, FormLabel, FormSuccess, Hero, HeroActions, HeroContent, HeroContext, HeroImage, Input, Link, Navbar, NavbarCollapsible, NavbarContent, NavbarExpandedMobileContent, NavbarItem, NavbarItems, Snackbar, SnackbarButton, SnackbarContent, StepList, StepListItem, TextArea, TextField, assignRef, useBlockBackgroundColor, useComposedRefs, useFallbackId, useFormControlValidity, useMedia, usePrefersReducedMotion, useScreenMaxWidthMd };
package/dist/index.d.ts CHANGED
@@ -1,17 +1,17 @@
1
1
  export * from './Alert';
2
2
  export * from './Banner';
3
3
  export * from './Button';
4
+ export * from './Campaign';
4
5
  export * from './Card';
5
6
  export * from './Checkbox';
6
7
  export * from './Footer';
7
8
  export * from './Form';
8
9
  export * from './Hero';
9
- export * from './IconLegacy';
10
10
  export * from './Input';
11
11
  export * from './Link';
12
12
  export * from './Navbar';
13
13
  export * from './Snackbar';
14
- export * from './Stepper';
14
+ export * from './StepList';
15
15
  export * from './TextArea';
16
16
  export * from './TextField';
17
17
  export * from './hooks';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obosbbl/grunnmuren-react",
3
- "version": "0.3.0",
3
+ "version": "1.1.0",
4
4
  "description": "OBOS Grunnmuren design system React components",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -17,32 +17,32 @@
17
17
  ],
18
18
  "types": "./dist/index.d.ts",
19
19
  "devDependencies": {
20
- "@babel/core": "7.18.2",
21
- "@obosbbl/grunnmuren-tailwind": "^0.3.1",
22
- "@storybook/addon-controls": "6.5.5",
23
- "@storybook/addon-docs": "6.5.5",
20
+ "@babel/core": "7.18.6",
21
+ "@obosbbl/grunnmuren-tailwind": "^0.4.1",
22
+ "@storybook/addon-controls": "6.5.9",
23
+ "@storybook/addon-docs": "6.5.9",
24
24
  "@storybook/addon-postcss": "2.0.0",
25
- "@storybook/builder-webpack5": "6.5.5",
26
- "@storybook/manager-webpack5": "6.5.5",
27
- "@storybook/react": "6.5.5",
28
- "@types/react": "18.0.9",
25
+ "@storybook/builder-webpack5": "6.5.9",
26
+ "@storybook/manager-webpack5": "6.5.9",
27
+ "@storybook/react": "6.5.9",
28
+ "@types/react": "18.0.14",
29
29
  "@types/react-dom": "18.0.5",
30
30
  "@vitejs/plugin-react": "1.3.2",
31
31
  "postcss": "8.4.14",
32
- "react": "18.1.0",
33
- "react-dom": "18.1.0",
32
+ "react": "18.2.0",
33
+ "react-dom": "18.2.0",
34
34
  "require-from-string": "2.0.2",
35
- "tailwindcss": "3.0.24",
36
- "vite": "2.9.9",
37
- "webpack": "5.72.1"
35
+ "tailwindcss": "3.1.4",
36
+ "vite": "2.9.13",
37
+ "webpack": "5.73.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@obosbbl/grunnmuren-icons": "^0.3.0",
41
- "clsx": "1.1.1"
41
+ "clsx": "1.2.0"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": "^18",
45
- "@obosbbl/grunnmuren-tailwind": "^0.3.1"
45
+ "@obosbbl/grunnmuren-tailwind": "^0.4.1"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "@obosbbl/grunnmuren-tailwind": {
@@ -1,20 +0,0 @@
1
- /// <reference types="react" />
2
- export declare type IconName = keyof typeof iconMap;
3
- interface IconLegacyProps {
4
- className?: string;
5
- name: IconName;
6
- children?: never;
7
- }
8
- /**
9
- *
10
- * NB! This component should only be used for compatibility reasons.
11
- * It uses old icon names and it causes all the referenced icons to be inluded in the application bundle.
12
- * Import icons from @obosbbl/grunnmuren-icons instead.
13
- */
14
- export declare const IconLegacy: (props: IconLegacyProps) => JSX.Element;
15
- declare const iconMap: {
16
- readonly mapmarker: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
17
- readonly smartphone: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
18
- readonly envelope: (props: import("react").SVGProps<SVGSVGElement>) => JSX.Element;
19
- };
20
- export {};
@@ -1 +0,0 @@
1
- export * from './IconLegacy';
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- interface StepperProps extends React.ComponentPropsWithoutRef<'ol'> {
3
- }
4
- export declare const Stepper: (props: StepperProps) => JSX.Element;
5
- interface StepProps extends React.ComponentPropsWithoutRef<'li'> {
6
- /** Content for the Step item's bullet */
7
- bullet: React.ReactNode;
8
- }
9
- export declare const Step: (props: StepProps) => JSX.Element;
10
- interface StepBulletProps extends React.ComponentPropsWithoutRef<'span'> {
11
- }
12
- export declare const StepBullet: (props: StepBulletProps) => JSX.Element;
13
- export {};
@@ -1 +0,0 @@
1
- export * from './Stepper';