@navikt/ds-react 0.12.3 → 0.13.3
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/cjs/form/Fieldset/Fieldset.js +6 -3
- package/cjs/form/Select.js +5 -2
- package/cjs/form/TextField.js +8 -3
- package/cjs/form/Textarea.js +5 -2
- package/cjs/form/checkbox/Checkbox.js +9 -8
- package/cjs/form/checkbox/useCheckbox.js +2 -1
- package/cjs/form/radio/Radio.js +8 -14
- package/cjs/form/radio/useRadio.js +2 -1
- package/cjs/form/search-field/SearchField.js +5 -2
- package/esm/form/Fieldset/Fieldset.js +7 -4
- package/esm/form/Fieldset/Fieldset.js.map +1 -1
- package/esm/form/Select.js +5 -2
- package/esm/form/Select.js.map +1 -1
- package/esm/form/TextField.js +9 -4
- package/esm/form/TextField.js.map +1 -1
- package/esm/form/Textarea.js +5 -2
- package/esm/form/Textarea.js.map +1 -1
- package/esm/form/checkbox/Checkbox.d.ts +6 -1
- package/esm/form/checkbox/Checkbox.js +10 -9
- package/esm/form/checkbox/Checkbox.js.map +1 -1
- package/esm/form/checkbox/CheckboxGroup.d.ts +1 -1
- package/esm/form/checkbox/CheckboxGroup.js.map +1 -1
- package/esm/form/checkbox/useCheckbox.js +2 -1
- package/esm/form/checkbox/useCheckbox.js.map +1 -1
- package/esm/form/radio/Radio.d.ts +4 -1
- package/esm/form/radio/Radio.js +9 -15
- package/esm/form/radio/Radio.js.map +1 -1
- package/esm/form/radio/RadioGroup.d.ts +1 -1
- package/esm/form/radio/RadioGroup.js.map +1 -1
- package/esm/form/radio/useRadio.js +2 -1
- package/esm/form/radio/useRadio.js.map +1 -1
- package/esm/form/search-field/SearchField.js +5 -2
- package/esm/form/search-field/SearchField.js.map +1 -1
- package/esm/loader/Loader.d.ts +1 -1
- package/package.json +3 -3
- package/src/form/Fieldset/Fieldset.tsx +25 -12
- package/src/form/Select.tsx +5 -1
- package/src/form/TextField.tsx +30 -11
- package/src/form/Textarea.tsx +5 -1
- package/src/form/checkbox/Checkbox.test.tsx +7 -5
- package/src/form/checkbox/Checkbox.tsx +30 -37
- package/src/form/checkbox/CheckboxGroup.tsx +2 -1
- package/src/form/checkbox/stories/checkbox.stories.mdx +17 -45
- package/src/form/checkbox/stories/checkbox.stories.tsx +55 -82
- package/src/form/checkbox/useCheckbox.ts +5 -1
- package/src/form/radio/Radio.tsx +26 -40
- package/src/form/radio/RadioGroup.tsx +2 -1
- package/src/form/radio/stories/radio.stories.mdx +3 -29
- package/src/form/radio/stories/radio.stories.tsx +33 -61
- package/src/form/radio/useRadio.ts +5 -1
- package/src/form/search-field/SearchField.tsx +5 -1
- package/src/form/search-field/stories/search-field.stories.tsx +25 -1
- package/src/form/stories/fieldset.stories.tsx +6 -2
- package/src/form/stories/select.stories.tsx +1 -1
- package/src/form/stories/text-field.stories.tsx +23 -1
- package/src/form/stories/textarea.stories.tsx +12 -2
|
@@ -21,11 +21,14 @@ export const SearchFieldContext = React.createContext(null);
|
|
|
21
21
|
const SearchField = forwardRef((props, ref) => {
|
|
22
22
|
const { inputProps, errorId, showErrorMsg, hasError, size, inputDescriptionId, } = useFormField(props, "searchfield");
|
|
23
23
|
const { className, hideLabel, children, label, description, error } = props, rest = __rest(props, ["className", "hideLabel", "children", "label", "description", "error"]);
|
|
24
|
-
return (React.createElement("div", Object.assign({ ref: ref }, omit(rest, ["id", "error", "errorId", "size", "disabled"]), { className: cl(className, "navds-form-field", `navds-form-field--${size !== null && size !== void 0 ? size : "medium"}`, "navds-search-field", {
|
|
24
|
+
return (React.createElement("div", Object.assign({ ref: ref }, omit(rest, ["id", "error", "errorId", "size", "disabled"]), { className: cl(className, "navds-form-field", `navds-form-field--${size !== null && size !== void 0 ? size : "medium"}`, "navds-search-field", {
|
|
25
|
+
"navds-search-field--error": hasError,
|
|
26
|
+
"navds-search-field--disabled": !!inputProps.disabled,
|
|
27
|
+
}) }),
|
|
25
28
|
React.createElement(Label, { htmlFor: inputProps.id, size: size, as: "label", className: cl("navds-text-field__label", {
|
|
26
29
|
"sr-only": hideLabel,
|
|
27
30
|
}) }, label),
|
|
28
|
-
!!description && (React.createElement(BodyShort, { className: cl("navds-text-field__description", {
|
|
31
|
+
!!description && (React.createElement(BodyShort, { as: "div", className: cl("navds-text-field__description", {
|
|
29
32
|
"sr-only": hideLabel,
|
|
30
33
|
}), id: inputDescriptionId, size: size }, description)),
|
|
31
34
|
React.createElement("div", { className: "navds-search-field__input-wrapper" },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchField.js","sourceRoot":"","sources":["../../../src/form/search-field/SearchField.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,iBAA4C,MAAM,qBAAqB,CAAC;AAC/E,OAAO,sBAEN,MAAM,0BAA0B,CAAC;AAClC,OAAO,gBAA0C,MAAM,oBAAoB,CAAC;AAY5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CACnD,IAAI,CACL,CAAC;AA4BF,MAAM,WAAW,GAAG,UAAU,CAC5B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,kBAAkB,GACnB,GAAG,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAEvC,MAAM,EACJ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,KAAK,EACL,WAAW,EACX,KAAK,KAEH,KAAK,EADJ,IAAI,UACL,KAAK,EARH,uEAQL,CAAQ,CAAC;IAEV,OAAO,CACL,2CACE,GAAG,EAAE,GAAG,IACJ,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,IAC9D,SAAS,EAAE,EAAE,CACX,SAAS,EACT,kBAAkB,EAClB,qBAAqB,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,QAAQ,EAAE,EACvC,oBAAoB,EACpB,
|
|
1
|
+
{"version":3,"file":"SearchField.js","sourceRoot":"","sources":["../../../src/form/search-field/SearchField.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAkB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,iBAA4C,MAAM,qBAAqB,CAAC;AAC/E,OAAO,sBAEN,MAAM,0BAA0B,CAAC;AAClC,OAAO,gBAA0C,MAAM,oBAAoB,CAAC;AAY5E,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,aAAa,CACnD,IAAI,CACL,CAAC;AA4BF,MAAM,WAAW,GAAG,UAAU,CAC5B,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACb,MAAM,EACJ,UAAU,EACV,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,IAAI,EACJ,kBAAkB,GACnB,GAAG,YAAY,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IAEvC,MAAM,EACJ,SAAS,EACT,SAAS,EACT,QAAQ,EACR,KAAK,EACL,WAAW,EACX,KAAK,KAEH,KAAK,EADJ,IAAI,UACL,KAAK,EARH,uEAQL,CAAQ,CAAC;IAEV,OAAO,CACL,2CACE,GAAG,EAAE,GAAG,IACJ,IAAI,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,IAC9D,SAAS,EAAE,EAAE,CACX,SAAS,EACT,kBAAkB,EAClB,qBAAqB,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,QAAQ,EAAE,EACvC,oBAAoB,EACpB;YACE,2BAA2B,EAAE,QAAQ;YACrC,8BAA8B,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ;SACtD,CACF;QAED,oBAAC,KAAK,IACJ,OAAO,EAAE,UAAU,CAAC,EAAE,EACtB,IAAI,EAAE,IAAI,EACV,EAAE,EAAC,OAAO,EACV,SAAS,EAAE,EAAE,CAAC,yBAAyB,EAAE;gBACvC,SAAS,EAAE,SAAS;aACrB,CAAC,IAED,KAAK,CACA;QACP,CAAC,CAAC,WAAW,IAAI,CAChB,oBAAC,SAAS,IACR,EAAE,EAAC,KAAK,EACR,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE;gBAC7C,SAAS,EAAE,SAAS;aACrB,CAAC,EACF,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,IAAI,IAET,WAAW,CACF,CACb;QACD,6BAAK,SAAS,EAAC,mCAAmC;YAChD,oBAAC,kBAAkB,CAAC,QAAQ,IAC1B,KAAK,EAAE;oBACL,UAAU;oBACV,IAAI;iBACL,IAEA,QAAQ,CACmB,CAC1B;QACN,6BAAK,EAAE,EAAE,OAAO,mBAAgB,oBAAoB,eAAW,QAAQ,IACpE,YAAY,IAAI,oBAAC,YAAY,IAAC,IAAI,EAAE,IAAI,IAAG,KAAK,CAAgB,CAC7D,CACF,CACP,CAAC;AACJ,CAAC,CACsB,CAAC;AAE1B,WAAW,CAAC,MAAM,GAAG,iBAAiB,CAAC;AACvC,WAAW,CAAC,KAAK,GAAG,sBAAsB,CAAC;AAC3C,WAAW,CAAC,KAAK,GAAG,gBAAgB,CAAC;AAErC,eAAe,WAAW,CAAC"}
|
package/esm/loader/Loader.d.ts
CHANGED
|
@@ -18,5 +18,5 @@ export interface LoaderProps extends SVGProps<SVGSVGElement> {
|
|
|
18
18
|
*/
|
|
19
19
|
variant?: "neutral" | "interaction" | "inverted";
|
|
20
20
|
}
|
|
21
|
-
declare const Loader: React.ForwardRefExoticComponent<Pick<LoaderProps, "string" | "filter" | "values" | "fill" | "max" | "type" | "transparent" | "accumulate" | "offset" | "key" | "id" | "media" | "origin" | "height" | "width" | "end" | "name" | "alignmentBaseline" | "baselineShift" | "clip" | "clipPath" | "clipRule" | "color" | "colorInterpolation" | "colorInterpolationFilters" | "cursor" | "direction" | "display" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "imageRendering" | "letterSpacing" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "opacity" | "order" | "overflow" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "textDecoration" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "style" | "title" | "path" | "method" | "target" | "lang" | "className" | "children" | "tabIndex" | "size" | "orientation" | "local" | "x" | "y" | "mathematical" | "azimuth" | "colorRendering" | "glyphOrientationVertical" | "vectorEffect" | "additive" | "crossOrigin" | "href" | "min" | "role" | "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" | "accentHeight" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "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" | "variant"> & React.RefAttributes<SVGSVGElement>>;
|
|
21
|
+
declare const Loader: React.ForwardRefExoticComponent<Pick<LoaderProps, "string" | "filter" | "values" | "fill" | "max" | "type" | "transparent" | "accumulate" | "offset" | "key" | "id" | "media" | "origin" | "height" | "width" | "end" | "name" | "alignmentBaseline" | "baselineShift" | "clip" | "clipPath" | "clipRule" | "color" | "colorInterpolation" | "colorInterpolationFilters" | "cursor" | "direction" | "display" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "imageRendering" | "letterSpacing" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "mask" | "opacity" | "order" | "overflow" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "textDecoration" | "textRendering" | "transform" | "unicodeBidi" | "visibility" | "wordSpacing" | "writingMode" | "alphabetic" | "hanging" | "ideographic" | "style" | "title" | "path" | "method" | "target" | "lang" | "className" | "children" | "tabIndex" | "size" | "orientation" | "local" | "x" | "y" | "mathematical" | "azimuth" | "colorRendering" | "glyphOrientationVertical" | "vectorEffect" | "additive" | "crossOrigin" | "href" | "min" | "role" | "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" | "accentHeight" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "elevation" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "in" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "mode" | "numOctaves" | "operator" | "orient" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "spacing" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicode" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "version" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "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" | "variant"> & React.RefAttributes<SVGSVGElement>>;
|
|
22
22
|
export default Loader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@navikt/ds-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "NAV designsystem react components",
|
|
6
6
|
"author": "NAV Designsystem team",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@material-ui/core": "^4.12.3",
|
|
38
|
-
"@navikt/ds-icons": "^0.6.
|
|
38
|
+
"@navikt/ds-icons": "^0.6.3",
|
|
39
39
|
"@popperjs/core": "^2.10.1",
|
|
40
40
|
"classnames": "^2.2.6",
|
|
41
41
|
"react-collapse": "^5.1.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"react": "^16.8.0 || ^17.0.0"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "f6c4f853afefa13244fe3f9bd55126d7caaa0b70"
|
|
67
67
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cl from "classnames";
|
|
2
2
|
import React, { FieldsetHTMLAttributes, forwardRef, useContext } from "react";
|
|
3
|
-
import { BodyShort, Label, omit } from "../..";
|
|
3
|
+
import { BodyShort, Detail, Label, omit } from "../..";
|
|
4
4
|
import ErrorMessage from "../ErrorMessage";
|
|
5
5
|
import { FormFieldProps } from "../useFormField";
|
|
6
6
|
import { useFieldset } from "./useFieldset";
|
|
@@ -101,17 +101,30 @@ const Fieldset = forwardRef<HTMLFieldSetElement, FieldsetProps>(
|
|
|
101
101
|
>
|
|
102
102
|
{legend}
|
|
103
103
|
</Label>
|
|
104
|
-
{!!description &&
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
{!!description &&
|
|
105
|
+
(size === "medium" ? (
|
|
106
|
+
<BodyShort
|
|
107
|
+
className={cl("navds-fieldset__description", {
|
|
108
|
+
"sr-only": !!hideLegend,
|
|
109
|
+
})}
|
|
110
|
+
id={inputDescriptionId}
|
|
111
|
+
size="small"
|
|
112
|
+
as="div"
|
|
113
|
+
>
|
|
114
|
+
{props.description}
|
|
115
|
+
</BodyShort>
|
|
116
|
+
) : (
|
|
117
|
+
<Detail
|
|
118
|
+
className={cl("navds-fieldset__description", {
|
|
119
|
+
"sr-only": !!hideLegend,
|
|
120
|
+
})}
|
|
121
|
+
id={inputDescriptionId}
|
|
122
|
+
size="small"
|
|
123
|
+
as="div"
|
|
124
|
+
>
|
|
125
|
+
{props.description}
|
|
126
|
+
</Detail>
|
|
127
|
+
))}
|
|
115
128
|
{children}
|
|
116
129
|
<div
|
|
117
130
|
id={errorId}
|
package/src/form/Select.tsx
CHANGED
|
@@ -52,7 +52,10 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>((props, ref) => {
|
|
|
52
52
|
className,
|
|
53
53
|
"navds-form-field",
|
|
54
54
|
`navds-form-field--${size}`,
|
|
55
|
-
{
|
|
55
|
+
{
|
|
56
|
+
"navds-select--error": hasError,
|
|
57
|
+
"navds-select--disabled": !!inputProps.disabled,
|
|
58
|
+
}
|
|
56
59
|
)}
|
|
57
60
|
>
|
|
58
61
|
<Label
|
|
@@ -67,6 +70,7 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>((props, ref) => {
|
|
|
67
70
|
</Label>
|
|
68
71
|
{!!description && (
|
|
69
72
|
<BodyShort
|
|
73
|
+
as="div"
|
|
70
74
|
className={cl("navds-select__description", {
|
|
71
75
|
"sr-only": hideLabel,
|
|
72
76
|
})}
|
package/src/form/TextField.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
2
2
|
import cl from "classnames";
|
|
3
|
-
import { BodyShort, Label, omit } from "..";
|
|
3
|
+
import { BodyShort, Detail, Label, omit } from "..";
|
|
4
4
|
import ErrorMessage from "./ErrorMessage";
|
|
5
5
|
import { FormFieldProps, useFormField } from "./useFormField";
|
|
6
6
|
|
|
@@ -52,7 +52,10 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {
|
|
|
52
52
|
className,
|
|
53
53
|
"navds-form-field",
|
|
54
54
|
`navds-form-field--${size}`,
|
|
55
|
-
{
|
|
55
|
+
{
|
|
56
|
+
"navds-text-field--error": hasError,
|
|
57
|
+
"navds-text-field--disabled": !!inputProps.disabled,
|
|
58
|
+
}
|
|
56
59
|
)}
|
|
57
60
|
>
|
|
58
61
|
<Label
|
|
@@ -65,15 +68,31 @@ const TextField = forwardRef<HTMLInputElement, TextFieldProps>((props, ref) => {
|
|
|
65
68
|
</Label>
|
|
66
69
|
|
|
67
70
|
{!!description && (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
<>
|
|
72
|
+
{size === "medium" ? (
|
|
73
|
+
<BodyShort
|
|
74
|
+
className={cl("navds-text-field__description", {
|
|
75
|
+
"sr-only": hideLabel,
|
|
76
|
+
})}
|
|
77
|
+
id={inputDescriptionId}
|
|
78
|
+
size="small"
|
|
79
|
+
as="div"
|
|
80
|
+
>
|
|
81
|
+
{description}
|
|
82
|
+
</BodyShort>
|
|
83
|
+
) : (
|
|
84
|
+
<Detail
|
|
85
|
+
className={cl("navds-text-field__description", {
|
|
86
|
+
"sr-only": hideLabel,
|
|
87
|
+
})}
|
|
88
|
+
id={inputDescriptionId}
|
|
89
|
+
size="small"
|
|
90
|
+
as="div"
|
|
91
|
+
>
|
|
92
|
+
{description}
|
|
93
|
+
</Detail>
|
|
94
|
+
)}
|
|
95
|
+
</>
|
|
77
96
|
)}
|
|
78
97
|
<input
|
|
79
98
|
{...omit(rest, ["error", "errorId", "size"])}
|
package/src/form/Textarea.tsx
CHANGED
|
@@ -66,7 +66,10 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
66
66
|
className,
|
|
67
67
|
"navds-form-field",
|
|
68
68
|
`navds-form-field--${size}`,
|
|
69
|
-
{
|
|
69
|
+
{
|
|
70
|
+
"navds-textarea--error": hasError,
|
|
71
|
+
"navds-textarea--disabled": !!inputProps.disabled,
|
|
72
|
+
}
|
|
70
73
|
)}
|
|
71
74
|
>
|
|
72
75
|
<Label
|
|
@@ -81,6 +84,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
81
84
|
</Label>
|
|
82
85
|
{!!description && (
|
|
83
86
|
<BodyShort
|
|
87
|
+
as="div"
|
|
84
88
|
className={cl("navds-textarea__description", {
|
|
85
89
|
"sr-only": hideLabel,
|
|
86
90
|
})}
|
|
@@ -29,10 +29,7 @@ test("checkbox group chains onChange calls", () => {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
describe("Checkbox handles controlled-state correctly", () => {
|
|
32
|
-
const CheckboxComponent = ({
|
|
33
|
-
onChange = () => null,
|
|
34
|
-
value,
|
|
35
|
-
}) => (
|
|
32
|
+
const CheckboxComponent = ({ onChange = () => null, value }) => (
|
|
36
33
|
<CheckboxGroup legend="legend" onChange={onChange} value={value}>
|
|
37
34
|
<Checkbox value={"value1"}>label1</Checkbox>
|
|
38
35
|
<Checkbox value={"value2"}>label2</Checkbox>
|
|
@@ -55,7 +52,12 @@ describe("Checkbox handles controlled-state correctly", () => {
|
|
|
55
52
|
test("onChange called with expected values", () => {
|
|
56
53
|
const onGroupChange = jest.fn();
|
|
57
54
|
|
|
58
|
-
render(
|
|
55
|
+
render(
|
|
56
|
+
<CheckboxComponent
|
|
57
|
+
onChange={onGroupChange}
|
|
58
|
+
value={["value1", "value2"]}
|
|
59
|
+
/>
|
|
60
|
+
);
|
|
59
61
|
|
|
60
62
|
userEvent.click(screen.getByLabelText("label1"));
|
|
61
63
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import React, { forwardRef, InputHTMLAttributes } from "react";
|
|
2
2
|
import cl from "classnames";
|
|
3
3
|
import useCheckbox from "./useCheckbox";
|
|
4
|
-
import ErrorMessage from "../ErrorMessage";
|
|
5
4
|
import { FormFieldProps } from "../useFormField";
|
|
6
|
-
import { BodyShort, omit } from "../..";
|
|
5
|
+
import { BodyShort, Detail, omit } from "../..";
|
|
7
6
|
|
|
8
7
|
export interface CheckboxProps
|
|
9
|
-
extends FormFieldProps,
|
|
8
|
+
extends Omit<FormFieldProps, "errorId">,
|
|
10
9
|
Omit<InputHTMLAttributes<HTMLInputElement>, "size"> {
|
|
10
|
+
/**
|
|
11
|
+
* Checkbox has error
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
error?: boolean;
|
|
11
15
|
/**
|
|
12
16
|
* Label for checkbox
|
|
13
17
|
*/
|
|
@@ -23,14 +27,9 @@ export interface CheckboxProps
|
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
26
|
-
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
showErrorMsg,
|
|
30
|
-
hasError,
|
|
31
|
-
size,
|
|
32
|
-
inputDescriptionId,
|
|
33
|
-
} = useCheckbox(props);
|
|
30
|
+
const { inputProps, hasError, size } = useCheckbox(props);
|
|
31
|
+
|
|
32
|
+
const Description = size === "medium" ? BodyShort : Detail;
|
|
34
33
|
|
|
35
34
|
return (
|
|
36
35
|
<div
|
|
@@ -40,8 +39,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
|
40
39
|
`navds-checkbox--${size}`,
|
|
41
40
|
{
|
|
42
41
|
"navds-checkbox--error": hasError,
|
|
43
|
-
"navds-checkbox--
|
|
44
|
-
"navds-checkbox--with-description": !!props.description,
|
|
42
|
+
"navds-checkbox--disabled": inputProps.disabled,
|
|
45
43
|
}
|
|
46
44
|
)}
|
|
47
45
|
>
|
|
@@ -50,7 +48,6 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
|
50
48
|
"children",
|
|
51
49
|
"size",
|
|
52
50
|
"error",
|
|
53
|
-
"errorId",
|
|
54
51
|
"description",
|
|
55
52
|
"hideLabel",
|
|
56
53
|
])}
|
|
@@ -58,30 +55,26 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
|
58
55
|
className="navds-checkbox__input"
|
|
59
56
|
ref={ref}
|
|
60
57
|
/>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
>
|
|
67
|
-
{props.hideLabel ? (
|
|
68
|
-
<span className="sr-only">{props.children}</span>
|
|
69
|
-
) : (
|
|
70
|
-
props.children
|
|
71
|
-
)}
|
|
72
|
-
</BodyShort>
|
|
73
|
-
{props.description && (
|
|
74
|
-
<BodyShort
|
|
75
|
-
size={size}
|
|
76
|
-
id={inputDescriptionId}
|
|
77
|
-
className="navds-checkbox__description"
|
|
58
|
+
<label htmlFor={inputProps.id} className="navds-checkbox__label">
|
|
59
|
+
<div
|
|
60
|
+
className={cl("navds-checkbox__content", {
|
|
61
|
+
"sr-only": props.hideLabel,
|
|
62
|
+
})}
|
|
78
63
|
>
|
|
79
|
-
{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
64
|
+
<BodyShort as="div" size={size}>
|
|
65
|
+
{props.children}
|
|
66
|
+
</BodyShort>
|
|
67
|
+
{props.description && (
|
|
68
|
+
<Description
|
|
69
|
+
as="div"
|
|
70
|
+
size="small"
|
|
71
|
+
className="navds-checkbox__description"
|
|
72
|
+
>
|
|
73
|
+
{props.description}
|
|
74
|
+
</Description>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
</label>
|
|
85
78
|
</div>
|
|
86
79
|
);
|
|
87
80
|
});
|
|
@@ -12,7 +12,8 @@ export const CheckboxGroupContext = createContext<CheckboxGroupState | null>(
|
|
|
12
12
|
null
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
export interface CheckboxGroupProps
|
|
15
|
+
export interface CheckboxGroupProps
|
|
16
|
+
extends Omit<FieldsetProps, "onChange" | "errorPropagation"> {
|
|
16
17
|
/**
|
|
17
18
|
* Checkboxes
|
|
18
19
|
*/
|
|
@@ -49,6 +49,8 @@ Man kan både sette en description på CheckboxGroup og selve checkbox
|
|
|
49
49
|
|
|
50
50
|
## Errors
|
|
51
51
|
|
|
52
|
+
Feilmeldinger kan bare settes på gruppa
|
|
53
|
+
|
|
52
54
|
```jsx
|
|
53
55
|
<CheckboxGroup legend="Mollit eiusmod" error="Boks nr 2 må være valgt">
|
|
54
56
|
<Checkbox value="Apple">Apple</Checkbox>
|
|
@@ -65,37 +67,23 @@ Man kan både sette en description på CheckboxGroup og selve checkbox
|
|
|
65
67
|
</CheckboxGroup>
|
|
66
68
|
</Canvas>
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
Enkelt-checkboxer tar en `boolean` error prop
|
|
69
71
|
|
|
70
72
|
```jsx
|
|
71
|
-
<
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
error="Boks nr 2 må være valgt"
|
|
75
|
-
>
|
|
76
|
-
<Checkbox value="Apple">Apple</Checkbox>
|
|
77
|
-
<Checkbox value="Orange">Orange</Checkbox>
|
|
78
|
-
<Checkbox value="Melon">Melon</Checkbox>
|
|
79
|
-
</CheckboxGroup>
|
|
73
|
+
<Checkbox value="Apple" error>
|
|
74
|
+
Apple
|
|
75
|
+
</Checkbox>
|
|
80
76
|
```
|
|
81
77
|
|
|
82
78
|
<Canvas>
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
error="Boks nr 2 må være valgt"
|
|
87
|
-
>
|
|
88
|
-
<Checkbox value="Apple">Apple</Checkbox>
|
|
89
|
-
<Checkbox value="Orange" error="Boksen må være valgt">
|
|
90
|
-
Orange
|
|
91
|
-
</Checkbox>
|
|
92
|
-
<Checkbox value="Melon">Melon</Checkbox>
|
|
93
|
-
</CheckboxGroup>
|
|
79
|
+
<Checkbox value="Apple" error>
|
|
80
|
+
Apple
|
|
81
|
+
</Checkbox>
|
|
94
82
|
</Canvas>
|
|
95
83
|
|
|
96
84
|
## Sizing
|
|
97
85
|
|
|
98
|
-
Checkboxer har default
|
|
86
|
+
Checkboxer har default 48px høy klikkflate. Med size="small" blir klikkflaten 32px
|
|
99
87
|
|
|
100
88
|
```jsx
|
|
101
89
|
<CheckboxGroup
|
|
@@ -166,31 +154,15 @@ Ved bruk av `hideLegend` på CheckboxGroup kan man gjøre slik at legend/descrip
|
|
|
166
154
|
Ved bruk av `hideLabel` kan man lettere ta i bruk checkbox internt i eks tabeller.
|
|
167
155
|
|
|
168
156
|
```jsx
|
|
169
|
-
<
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
</Checkbox>
|
|
173
|
-
<Checkbox value="Orange" hideLabel>
|
|
174
|
-
Orange
|
|
175
|
-
</Checkbox>
|
|
176
|
-
<Checkbox value="Melon" hideLabel>
|
|
177
|
-
Melon
|
|
178
|
-
</Checkbox>
|
|
179
|
-
</CheckboxGroup>
|
|
157
|
+
<Checkbox value="Orange" hideLabel>
|
|
158
|
+
Orange
|
|
159
|
+
</Checkbox>
|
|
180
160
|
```
|
|
181
161
|
|
|
182
162
|
<Canvas>
|
|
183
|
-
<
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
</Checkbox>
|
|
187
|
-
<Checkbox value="Orange" hideLabel>
|
|
188
|
-
Orange
|
|
189
|
-
</Checkbox>
|
|
190
|
-
<Checkbox value="Melon" hideLabel>
|
|
191
|
-
Melon
|
|
192
|
-
</Checkbox>
|
|
193
|
-
</CheckboxGroup>
|
|
163
|
+
<Checkbox value="Orange" hideLabel>
|
|
164
|
+
Orange
|
|
165
|
+
</Checkbox>
|
|
194
166
|
</Canvas>
|
|
195
167
|
|
|
196
168
|
## Disabled
|
|
@@ -206,7 +178,7 @@ NOTE: Husk at disabled bør unngås!
|
|
|
206
178
|
<Checkbox value="Melon">Melon</Checkbox>
|
|
207
179
|
</CheckboxGroup>
|
|
208
180
|
|
|
209
|
-
<CheckboxGroup legend="Mollit eiusmod"
|
|
181
|
+
<CheckboxGroup legend="Mollit eiusmod">
|
|
210
182
|
<Checkbox value="Apple" disabled>Apple</Checkbox>
|
|
211
183
|
<Checkbox value="Orange">Orange</Checkbox>
|
|
212
184
|
<Checkbox value="Melon">Melon</Checkbox>
|