@postenbring/hedwig-react 0.0.0-validation-message-20251021083235 → 0.0.0-validation-message-20251024111714
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/{chunk-Q2TXRD4L.mjs → chunk-4OXVKNAW.mjs} +5 -2
- package/dist/chunk-4OXVKNAW.mjs.map +1 -0
- package/dist/{chunk-MAZTLFXA.mjs → chunk-4ZVXLOFK.mjs} +26 -3
- package/dist/chunk-4ZVXLOFK.mjs.map +1 -0
- package/dist/{chunk-IAFIEBPC.mjs → chunk-OURI27KA.mjs} +26 -3
- package/dist/chunk-OURI27KA.mjs.map +1 -0
- package/dist/{chunk-I767NTEX.mjs → chunk-WTDLYUKK.mjs} +3 -3
- package/dist/chunk-WTDLYUKK.mjs.map +1 -0
- package/dist/{chunk-OIVSI3X4.mjs → chunk-Z5TRWYQO.mjs} +26 -3
- package/dist/chunk-Z5TRWYQO.mjs.map +1 -0
- package/dist/form/date-picker/date-picker.d.ts.map +1 -1
- package/dist/form/date-picker/date-picker.js +5 -2
- package/dist/form/date-picker/date-picker.js.map +1 -1
- package/dist/form/date-picker/date-picker.mjs +2 -2
- package/dist/form/date-picker/index.js +5 -2
- package/dist/form/date-picker/index.js.map +1 -1
- package/dist/form/date-picker/index.mjs +2 -2
- package/dist/form/index.js +77 -5
- package/dist/form/index.js.map +1 -1
- package/dist/form/index.mjs +5 -5
- package/dist/form/input/index.js +26 -3
- package/dist/form/input/index.js.map +1 -1
- package/dist/form/input/index.mjs +2 -2
- package/dist/form/input/input.d.ts.map +1 -1
- package/dist/form/input/input.js +26 -3
- package/dist/form/input/input.js.map +1 -1
- package/dist/form/input/input.mjs +2 -2
- package/dist/form/input-group/index.js +2 -2
- package/dist/form/input-group/index.js.map +1 -1
- package/dist/form/input-group/index.mjs +1 -1
- package/dist/form/input-group/input-group.d.ts.map +1 -1
- package/dist/form/input-group/input-group.js +2 -2
- package/dist/form/input-group/input-group.js.map +1 -1
- package/dist/form/input-group/input-group.mjs +1 -1
- package/dist/form/select/index.js +26 -3
- package/dist/form/select/index.js.map +1 -1
- package/dist/form/select/index.mjs +2 -2
- package/dist/form/select/select.d.ts.map +1 -1
- package/dist/form/select/select.js +26 -3
- package/dist/form/select/select.js.map +1 -1
- package/dist/form/select/select.mjs +2 -2
- package/dist/form/textarea/index.js +26 -3
- package/dist/form/textarea/index.js.map +1 -1
- package/dist/form/textarea/index.mjs +2 -2
- package/dist/form/textarea/textarea.d.ts.map +1 -1
- package/dist/form/textarea/textarea.js +26 -3
- package/dist/form/textarea/textarea.js.map +1 -1
- package/dist/form/textarea/textarea.mjs +2 -2
- package/dist/index.js +77 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
- package/src/form/date-picker/date-picker.tsx +2 -0
- package/src/form/input/input.tsx +14 -1
- package/src/form/input-group/input-group.tsx +3 -2
- package/src/form/select/select.tsx +14 -1
- package/src/form/textarea/textarea.tsx +14 -1
- package/dist/chunk-I767NTEX.mjs.map +0 -1
- package/dist/chunk-IAFIEBPC.mjs.map +0 -1
- package/dist/chunk-MAZTLFXA.mjs.map +0 -1
- package/dist/chunk-OIVSI3X4.mjs.map +0 -1
- package/dist/chunk-Q2TXRD4L.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WTDLYUKK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useMergeRefs
|
|
6
6
|
} from "./chunk-77M2ZTP7.mjs";
|
|
@@ -19,6 +19,7 @@ var DatePicker = forwardRef(function DatePicker2(_a, ref) {
|
|
|
19
19
|
className,
|
|
20
20
|
size,
|
|
21
21
|
errorMessage,
|
|
22
|
+
validationMessage,
|
|
22
23
|
labelProps,
|
|
23
24
|
label,
|
|
24
25
|
id,
|
|
@@ -30,6 +31,7 @@ var DatePicker = forwardRef(function DatePicker2(_a, ref) {
|
|
|
30
31
|
"className",
|
|
31
32
|
"size",
|
|
32
33
|
"errorMessage",
|
|
34
|
+
"validationMessage",
|
|
33
35
|
"labelProps",
|
|
34
36
|
"label",
|
|
35
37
|
"id",
|
|
@@ -46,6 +48,7 @@ var DatePicker = forwardRef(function DatePicker2(_a, ref) {
|
|
|
46
48
|
className: clsx("hds-date-picker", className),
|
|
47
49
|
disabled,
|
|
48
50
|
errorMessage,
|
|
51
|
+
validationMessage,
|
|
49
52
|
id,
|
|
50
53
|
label,
|
|
51
54
|
labelProps,
|
|
@@ -83,4 +86,4 @@ DatePicker.displayName = "DatePicker";
|
|
|
83
86
|
export {
|
|
84
87
|
DatePicker
|
|
85
88
|
};
|
|
86
|
-
//# sourceMappingURL=chunk-
|
|
89
|
+
//# sourceMappingURL=chunk-4OXVKNAW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/date-picker/date-picker.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup, type InputGroupProps } from \"../input-group\";\nimport { useMergeRefs } from \"../../utils/utils\";\n\nexport type DatePickerProps = Omit<\n InputGroupProps & Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n \"children\" | \"type\"\n> & {\n /**\n * Accessible title for the calendar button\n *\n * This button currently only shows in Chrome.\n *\n * @defaultValue \"Åpne kalender\"\n */\n calendarButtonTitle?: string;\n};\n\n/**\n * A basic implementation of a date picker\n *\n * This date picker is an implementation of native date picker, as you get\n * with `<input type=\"date\" />`, where the input field is dressed in Hedwig styling.\n *\n * Due to accessibility concerns you will only see the appropriate Hedwig calendar\n * icon in Chrome. Firefox will show built in icon and Safari will show no icon.\n * Not tested in Edge.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n {\n className,\n size,\n errorMessage,\n validationMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n readOnly,\n calendarButtonTitle = \"Åpne kalender\",\n ...rest\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n return (\n <InputGroup\n className={clsx(\"hds-date-picker\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n validationMessage={validationMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n size={size}\n >\n {(inputProps) => (\n <>\n <input\n {...rest}\n {...inputProps}\n disabled={disabled}\n readOnly={readOnly}\n ref={mergedRef}\n type=\"date\"\n />\n <button\n className={clsx(\"hds-date-picker__calendar-button\")}\n type=\"button\"\n title={calendarButtonTitle}\n onClick={() => {\n inputRef.current?.showPicker();\n }}\n />\n </>\n )}\n </InputGroup>\n );\n});\n\nDatePicker.displayName = \"DatePicker\";\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,YAAY,cAAwC;AAC7D,SAAS,YAAY;AA8Db,mBACE,KADF;AAlCD,IAAM,aAAa,WAA8C,SAASA,YAC/E,IAcA,KACA;AAfA,eACE;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,sBAAsB;AAAA,EAzC1B,IA8BE,IAYK,iBAZL,IAYK;AAAA,IAXH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKF,QAAM,WAAW,OAAyB,IAAI;AAC9C,QAAM,YAAY,aAAa,CAAC,UAAU,GAAG,CAAC;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,KAAK,mBAAmB,SAAsB;AAAA,MACzD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC,WAAC,eACA,iCACE;AAAA;AAAA,UAAC;AAAA,0DACK,OACA,aAFL;AAAA,YAGC;AAAA,YACA;AAAA,YACA,KAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,KAAK,kCAAkC;AAAA,YAClD,MAAK;AAAA,YACL,OAAO;AAAA,YACP,SAAS,MAAM;AA5E3B,kBAAAC;AA6Ec,eAAAA,MAAA,SAAS,YAAT,gBAAAA,IAAkB;AAAA,YACpB;AAAA;AAAA,QACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,WAAW,cAAc;","names":["DatePicker","_a"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WTDLYUKK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -12,13 +12,36 @@ import { forwardRef } from "react";
|
|
|
12
12
|
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
14
14
|
var Input = forwardRef(function Input2(_a, ref) {
|
|
15
|
-
var _b = _a, {
|
|
15
|
+
var _b = _a, {
|
|
16
|
+
className,
|
|
17
|
+
size,
|
|
18
|
+
errorMessage,
|
|
19
|
+
validationMessage,
|
|
20
|
+
labelProps,
|
|
21
|
+
label,
|
|
22
|
+
id,
|
|
23
|
+
style,
|
|
24
|
+
disabled,
|
|
25
|
+
readOnly
|
|
26
|
+
} = _b, rest = __objRest(_b, [
|
|
27
|
+
"className",
|
|
28
|
+
"size",
|
|
29
|
+
"errorMessage",
|
|
30
|
+
"validationMessage",
|
|
31
|
+
"labelProps",
|
|
32
|
+
"label",
|
|
33
|
+
"id",
|
|
34
|
+
"style",
|
|
35
|
+
"disabled",
|
|
36
|
+
"readOnly"
|
|
37
|
+
]);
|
|
16
38
|
return /* @__PURE__ */ jsx(
|
|
17
39
|
InputGroup,
|
|
18
40
|
{
|
|
19
41
|
className: clsx("hds-input", className),
|
|
20
42
|
disabled,
|
|
21
43
|
errorMessage,
|
|
44
|
+
validationMessage,
|
|
22
45
|
id,
|
|
23
46
|
label,
|
|
24
47
|
labelProps,
|
|
@@ -34,4 +57,4 @@ Input.displayName = "Input";
|
|
|
34
57
|
export {
|
|
35
58
|
Input
|
|
36
59
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-4ZVXLOFK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/input/input.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\n/**\n * Omitting:\n * - `size` from InputHTMLAttributes\n * - `children` from InputGroupProps\n * The original `size` prop that input elements have is not in use in HDS.\n * It is overridden by styling.\n */\nexport type InputProps = Omit<\n InputGroupProps & Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n \"children\"\n>;\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n {\n className,\n size,\n errorMessage,\n validationMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n readOnly,\n ...rest\n },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-input\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n validationMessage={validationMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n size={size}\n >\n <input {...rest} disabled={disabled} readOnly={readOnly} ref={ref} />\n </InputGroup>\n );\n});\n\nInput.displayName = \"Input\";\n"],"mappings":";;;;;;;;;;AAAA,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AA6Cf;AA7BC,IAAM,QAAQ,WAAyC,SAASA,OACrE,IAaA,KACA;AAdA,eACE;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EA7BJ,IAmBE,IAWK,iBAXL,IAWK;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,KAAK,aAAa,SAAsB;AAAA,MACnD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,8BAAC,0CAAU,OAAV,EAAgB,UAAoB,UAAoB,MAAU;AAAA;AAAA,EACrE;AAEJ,CAAC;AAED,MAAM,cAAc;","names":["Input"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WTDLYUKK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -12,13 +12,36 @@ import { forwardRef } from "react";
|
|
|
12
12
|
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
14
14
|
var Textarea = forwardRef(function Textarea2(_a, ref) {
|
|
15
|
-
var _b = _a, {
|
|
15
|
+
var _b = _a, {
|
|
16
|
+
className,
|
|
17
|
+
size,
|
|
18
|
+
errorMessage,
|
|
19
|
+
validationMessage,
|
|
20
|
+
labelProps,
|
|
21
|
+
label,
|
|
22
|
+
id,
|
|
23
|
+
style,
|
|
24
|
+
disabled,
|
|
25
|
+
readOnly
|
|
26
|
+
} = _b, rest = __objRest(_b, [
|
|
27
|
+
"className",
|
|
28
|
+
"size",
|
|
29
|
+
"errorMessage",
|
|
30
|
+
"validationMessage",
|
|
31
|
+
"labelProps",
|
|
32
|
+
"label",
|
|
33
|
+
"id",
|
|
34
|
+
"style",
|
|
35
|
+
"disabled",
|
|
36
|
+
"readOnly"
|
|
37
|
+
]);
|
|
16
38
|
return /* @__PURE__ */ jsx(
|
|
17
39
|
InputGroup,
|
|
18
40
|
{
|
|
19
41
|
className: clsx("hds-textarea", className),
|
|
20
42
|
disabled,
|
|
21
43
|
errorMessage,
|
|
44
|
+
validationMessage,
|
|
22
45
|
id,
|
|
23
46
|
label,
|
|
24
47
|
labelProps,
|
|
@@ -34,4 +57,4 @@ Textarea.displayName = "Textarea";
|
|
|
34
57
|
export {
|
|
35
58
|
Textarea
|
|
36
59
|
};
|
|
37
|
-
//# sourceMappingURL=chunk-
|
|
60
|
+
//# sourceMappingURL=chunk-OURI27KA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/textarea/textarea.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\nimport type { TextareaHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type TextareaProps = Omit<\n InputGroupProps & TextareaHTMLAttributes<HTMLTextAreaElement>,\n \"children\"\n>;\n\nexport const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(function Textarea(\n {\n className,\n size,\n errorMessage,\n validationMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n readOnly,\n ...rest\n },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-textarea\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n validationMessage={validationMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n size={size}\n >\n <textarea {...rest} disabled={disabled} readOnly={readOnly} ref={ref} />\n </InputGroup>\n );\n});\n\nTextarea.displayName = \"Textarea\";\n"],"mappings":";;;;;;;;;;AAAA,SAAS,kBAAkB;AAE3B,SAAS,YAAY;AAsCf;AA7BC,IAAM,WAAW,WAA+C,SAASA,UAC9E,IAaA,KACA;AAdA,eACE;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAtBJ,IAYE,IAWK,iBAXL,IAWK;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,KAAK,gBAAgB,SAAsB;AAAA,MACtD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,8BAAC,6CAAa,OAAb,EAAmB,UAAoB,UAAoB,MAAU;AAAA;AAAA,EACxE;AAEJ,CAAC;AAED,SAAS,cAAc;","names":["Textarea"]}
|
|
@@ -60,7 +60,7 @@ var InputGroup = forwardRef(function InputGroup2(_a, ref) {
|
|
|
60
60
|
var _a2;
|
|
61
61
|
const inputProps = {
|
|
62
62
|
"aria-describedby": validationMessageValue ? validationMessageId : void 0,
|
|
63
|
-
"aria-invalid": validationMessageValue ? true : void 0,
|
|
63
|
+
"aria-invalid": validationMessageValue && validationMessageVariant === "danger" ? true : void 0,
|
|
64
64
|
id: id != null ? id : inputId,
|
|
65
65
|
className: clsx("hds-input-group__input")
|
|
66
66
|
};
|
|
@@ -82,7 +82,7 @@ var InputGroup = forwardRef(function InputGroup2(_a, ref) {
|
|
|
82
82
|
"hds-input-group",
|
|
83
83
|
{
|
|
84
84
|
[`hds-input-group--${size}`]: size,
|
|
85
|
-
"hds-input-group--error":
|
|
85
|
+
"hds-input-group--error": validationMessageValue && validationMessageVariant === "danger"
|
|
86
86
|
},
|
|
87
87
|
className
|
|
88
88
|
),
|
|
@@ -125,4 +125,4 @@ var InputGroup = forwardRef(function InputGroup2(_a, ref) {
|
|
|
125
125
|
export {
|
|
126
126
|
InputGroup
|
|
127
127
|
};
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-WTDLYUKK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/input-group/input-group.tsx"],"sourcesContent":["import { useId, forwardRef, Children, isValidElement, cloneElement } from \"react\";\nimport type { LabelHTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\n\ninterface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n className?: string;\n}\n\nexport interface InputGroupProps {\n id?: string;\n className?: string;\n style?: CSSProperties;\n size?: \"large\" | \"small\";\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n validationMessage?: ReactNode | { value: ReactNode; variant: ValidationMessageProps[\"variant\"] };\n validationMessageProps?: Partial<ValidationMessageProps>;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n /**\n * `children` must be either a single input element or a render function.\n *\n * If you use a render function, make sure you spread the input props to the appropriate element.\n */\n children: Exclude<ReactNode, Iterable<ReactNode>> | ((inputProps: InputProps) => ReactNode);\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n size = \"large\",\n errorMessage,\n errorMessageProps,\n validationMessage,\n validationMessageProps,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const inputId = useId();\n const validationMessageId = useId();\n let validationMessageValue: ReactNode;\n let validationMessageVariant: ValidationMessageProps[\"variant\"] = \"danger\";\n\n if (validationMessage) {\n if (\n typeof validationMessage === \"object\" &&\n \"value\" in validationMessage &&\n \"variant\" in validationMessage\n ) {\n validationMessageValue = validationMessage.value;\n validationMessageVariant = validationMessage.variant;\n } else {\n validationMessageValue = validationMessage;\n }\n } else if (errorMessage) {\n validationMessageValue = errorMessage;\n }\n\n const renderInput = () => {\n const inputProps: InputProps = {\n \"aria-describedby\": validationMessageValue ? validationMessageId : undefined,\n \"aria-invalid\":\n validationMessageValue && validationMessageVariant === \"danger\" ? true : undefined,\n id: id ?? inputId,\n className: clsx(\"hds-input-group__input\"),\n };\n\n if (typeof children === \"function\") {\n return children(inputProps);\n }\n\n const input: ReactNode = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n className: `${inputProps.className} ${input.props.className ?? \"\"}`,\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${size}`]: size,\n \"hds-input-group--error\": validationMessageValue && validationMessageVariant === \"danger\",\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n {...rest}\n >\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ValidationMessage\n id={validationMessageId}\n variant={validationMessageVariant}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n});\n"],"mappings":";;;;;;;;;;AAAA,SAAS,OAAO,YAAY,UAAU,gBAAgB,oBAAoB;AAE1E,SAAS,YAAY;AAoGjB,SAaE,KAbF;AAlEG,IAAM,aAAa,WAA4C,SAASA,YAC7E,IAgBA,KACA;AAjBA,eASc;AAAA,IARZ;A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M,MAAM,cAAZ,OAAAA,MAAyB,EAAE;AAAA,IACnE,EAAC;AAAA,EACH;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,UACE,CAAC,oBAAoB,IAAI,EAAE,GAAG;AAAA,UAC9B,0BAA0B,0BAA0B,6BAA6B;AAAA,QACnF;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,OACI,OAXL;AAAA,MAaC;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,KAAK,0BAA0B,cAA2B;AAAA,aACjE,aAFL;AAAA,YAGC,SAAS,kBAAM;AAAA,YAEd;AAAA;AAAA,QACH;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,KAAK,gCAAgC;AAAA,YAChD,iBAAe;AAAA,YACf,iBAAe;AAAA,YAEd,sBAAY;AAAA;AAAA,QACf;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,IAAI;AAAA,YACJ,SAAS;AAAA,aACJ,0DAA0B,oBAHhC;AAAA,YAKE;AAAA;AAAA,QACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["InputGroup","_a"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InputGroup
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WTDLYUKK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__objRest,
|
|
6
6
|
__spreadProps,
|
|
@@ -12,13 +12,36 @@ import { forwardRef } from "react";
|
|
|
12
12
|
import { clsx } from "@postenbring/hedwig-css/typed-classname";
|
|
13
13
|
import { jsx } from "react/jsx-runtime";
|
|
14
14
|
var Select = forwardRef(function Select2(_a, ref) {
|
|
15
|
-
var _b = _a, {
|
|
15
|
+
var _b = _a, {
|
|
16
|
+
className,
|
|
17
|
+
size,
|
|
18
|
+
errorMessage,
|
|
19
|
+
validationMessage,
|
|
20
|
+
labelProps,
|
|
21
|
+
label,
|
|
22
|
+
id,
|
|
23
|
+
style,
|
|
24
|
+
disabled,
|
|
25
|
+
children
|
|
26
|
+
} = _b, rest = __objRest(_b, [
|
|
27
|
+
"className",
|
|
28
|
+
"size",
|
|
29
|
+
"errorMessage",
|
|
30
|
+
"validationMessage",
|
|
31
|
+
"labelProps",
|
|
32
|
+
"label",
|
|
33
|
+
"id",
|
|
34
|
+
"style",
|
|
35
|
+
"disabled",
|
|
36
|
+
"children"
|
|
37
|
+
]);
|
|
16
38
|
return /* @__PURE__ */ jsx(
|
|
17
39
|
InputGroup,
|
|
18
40
|
{
|
|
19
41
|
className: clsx("hds-select", className),
|
|
20
42
|
disabled,
|
|
21
43
|
errorMessage,
|
|
44
|
+
validationMessage,
|
|
22
45
|
id,
|
|
23
46
|
label,
|
|
24
47
|
labelProps,
|
|
@@ -33,4 +56,4 @@ Select.displayName = "Select";
|
|
|
33
56
|
export {
|
|
34
57
|
Select
|
|
35
58
|
};
|
|
36
|
-
//# sourceMappingURL=chunk-
|
|
59
|
+
//# sourceMappingURL=chunk-Z5TRWYQO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/form/select/select.tsx"],"sourcesContent":["import { forwardRef, type ReactNode, type SelectHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup } from \"../input-group\";\nimport type { InputGroupProps } from \"../input-group\";\n\nexport type SelectProps = Omit<\n InputGroupProps & Omit<SelectHTMLAttributes<HTMLSelectElement>, \"size\">,\n \"readOnly\" | \"children\"\n> & { children: ReactNode };\n\nexport const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(\n {\n className,\n size,\n errorMessage,\n validationMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n children,\n ...rest\n },\n ref,\n) {\n return (\n <InputGroup\n className={clsx(\"hds-select\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n validationMessage={validationMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n style={style}\n size={size}\n >\n <select {...rest} disabled={disabled} ref={ref}>\n {children}\n </select>\n </InputGroup>\n );\n});\n\nSelect.displayName = \"Select\";\n"],"mappings":";;;;;;;;;;AAAA,SAAS,kBAA6D;AACtE,SAAS,YAAY;AAqCf;AA5BC,IAAM,SAAS,WAA2C,SAASA,QACxE,IAaA,KACA;AAdA,eACE;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EArBJ,IAWE,IAWK,iBAXL,IAWK;AAAA,IAVH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,KAAK,cAAc,SAAsB;AAAA,MACpD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEA,8BAAC,2CAAW,OAAX,EAAiB,UAAoB,KACnC,WACH;AAAA;AAAA,EACF;AAEJ,CAAC;AAED,OAAO,cAAc;","names":["Select"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/form/date-picker/date-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGlE,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EACrE,UAAU,GAAG,MAAM,CACpB,GAAG;IACF;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;IApBrB;;;;;;OAMG;0BACmB,MAAM;
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/form/date-picker/date-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAErE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGlE,MAAM,MAAM,eAAe,GAAG,IAAI,CAChC,eAAe,GAAG,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EACrE,UAAU,GAAG,MAAM,CACpB,GAAG;IACF;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU;IApBrB;;;;;;OAMG;0BACmB,MAAM;oDAoE5B,CAAC"}
|
|
@@ -146,7 +146,7 @@ var InputGroup = (0, import_react2.forwardRef)(function InputGroup2(_a, ref) {
|
|
|
146
146
|
var _a2;
|
|
147
147
|
const inputProps = {
|
|
148
148
|
"aria-describedby": validationMessageValue ? validationMessageId : void 0,
|
|
149
|
-
"aria-invalid": validationMessageValue ? true : void 0,
|
|
149
|
+
"aria-invalid": validationMessageValue && validationMessageVariant === "danger" ? true : void 0,
|
|
150
150
|
id: id != null ? id : inputId,
|
|
151
151
|
className: (0, import_typed_classname2.clsx)("hds-input-group__input")
|
|
152
152
|
};
|
|
@@ -168,7 +168,7 @@ var InputGroup = (0, import_react2.forwardRef)(function InputGroup2(_a, ref) {
|
|
|
168
168
|
"hds-input-group",
|
|
169
169
|
{
|
|
170
170
|
[`hds-input-group--${size}`]: size,
|
|
171
|
-
"hds-input-group--error":
|
|
171
|
+
"hds-input-group--error": validationMessageValue && validationMessageVariant === "danger"
|
|
172
172
|
},
|
|
173
173
|
className
|
|
174
174
|
),
|
|
@@ -236,6 +236,7 @@ var DatePicker = (0, import_react4.forwardRef)(function DatePicker2(_a, ref) {
|
|
|
236
236
|
className,
|
|
237
237
|
size,
|
|
238
238
|
errorMessage,
|
|
239
|
+
validationMessage,
|
|
239
240
|
labelProps,
|
|
240
241
|
label,
|
|
241
242
|
id,
|
|
@@ -247,6 +248,7 @@ var DatePicker = (0, import_react4.forwardRef)(function DatePicker2(_a, ref) {
|
|
|
247
248
|
"className",
|
|
248
249
|
"size",
|
|
249
250
|
"errorMessage",
|
|
251
|
+
"validationMessage",
|
|
250
252
|
"labelProps",
|
|
251
253
|
"label",
|
|
252
254
|
"id",
|
|
@@ -263,6 +265,7 @@ var DatePicker = (0, import_react4.forwardRef)(function DatePicker2(_a, ref) {
|
|
|
263
265
|
className: (0, import_typed_classname3.clsx)("hds-date-picker", className),
|
|
264
266
|
disabled,
|
|
265
267
|
errorMessage,
|
|
268
|
+
validationMessage,
|
|
266
269
|
id,
|
|
267
270
|
label,
|
|
268
271
|
labelProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/date-picker/date-picker.tsx","../../../src/form/input-group/input-group.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup, type InputGroupProps } from \"../input-group\";\nimport { useMergeRefs } from \"../../utils/utils\";\n\nexport type DatePickerProps = Omit<\n InputGroupProps & Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n \"children\" | \"type\"\n> & {\n /**\n * Accessible title for the calendar button\n *\n * This button currently only shows in Chrome.\n *\n * @defaultValue \"Åpne kalender\"\n */\n calendarButtonTitle?: string;\n};\n\n/**\n * A basic implementation of a date picker\n *\n * This date picker is an implementation of native date picker, as you get\n * with `<input type=\"date\" />`, where the input field is dressed in Hedwig styling.\n *\n * Due to accessibility concerns you will only see the appropriate Hedwig calendar\n * icon in Chrome. Firefox will show built in icon and Safari will show no icon.\n * Not tested in Edge.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n {\n className,\n size,\n errorMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n readOnly,\n calendarButtonTitle = \"Åpne kalender\",\n ...rest\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n return (\n <InputGroup\n className={clsx(\"hds-date-picker\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n size={size}\n >\n {(inputProps) => (\n <>\n <input\n {...rest}\n {...inputProps}\n disabled={disabled}\n readOnly={readOnly}\n ref={mergedRef}\n type=\"date\"\n />\n <button\n className={clsx(\"hds-date-picker__calendar-button\")}\n type=\"button\"\n title={calendarButtonTitle}\n onClick={() => {\n inputRef.current?.showPicker();\n }}\n />\n </>\n )}\n </InputGroup>\n );\n});\n\nDatePicker.displayName = \"DatePicker\";\n","import { useId, forwardRef, Children, isValidElement, cloneElement } from \"react\";\nimport type { LabelHTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\n\ninterface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n className?: string;\n}\n\nexport interface InputGroupProps {\n id?: string;\n className?: string;\n style?: CSSProperties;\n size?: \"large\" | \"small\";\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n validationMessage?: ReactNode | { value: ReactNode; variant: ValidationMessageProps[\"variant\"] };\n validationMessageProps?: Partial<ValidationMessageProps>;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n /**\n * `children` must be either a single input element or a render function.\n *\n * If you use a render function, make sure you spread the input props to the appropriate element.\n */\n children: Exclude<ReactNode, Iterable<ReactNode>> | ((inputProps: InputProps) => ReactNode);\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n size = \"large\",\n errorMessage,\n errorMessageProps,\n validationMessage,\n validationMessageProps,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const inputId = useId();\n const validationMessageId = useId();\n let validationMessageValue: ReactNode;\n let validationMessageVariant: ValidationMessageProps[\"variant\"] = \"danger\";\n\n if (validationMessage) {\n if (\n typeof validationMessage === \"object\" &&\n \"value\" in validationMessage &&\n \"variant\" in validationMessage\n ) {\n validationMessageValue = validationMessage.value;\n validationMessageVariant = validationMessage.variant;\n } else {\n validationMessageValue = validationMessage;\n }\n } else if (errorMessage) {\n validationMessageValue = errorMessage;\n }\n\n const renderInput = () => {\n const inputProps: InputProps = {\n \"aria-describedby\": validationMessageValue ? validationMessageId : undefined,\n \"aria-invalid\": validationMessageValue ? true : undefined,\n id: id ?? inputId,\n className: clsx(\"hds-input-group__input\"),\n };\n\n if (typeof children === \"function\") {\n return children(inputProps);\n }\n\n const input: ReactNode = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n className: `${inputProps.className} ${input.props.className ?? \"\"}`,\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${size}`]: size,\n \"hds-input-group--error\": errorMessage,\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n {...rest}\n >\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ValidationMessage\n id={validationMessageId}\n variant={validationMessageVariant}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n\n /**\n * Variant of validation message\n * @default \"danger\"\n */\n variant?: \"info\" | \"success\" | \"warning\" | \"danger\";\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, variant = \"danger\", className, ...rest }, ref) => {\n return (\n <div\n aria-live=\"polite\"\n className={clsx(\n \"hds-validation-message\",\n `hds-validation-message--${variant}`,\n className as undefined,\n )}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA6D;AAC7D,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA0E;AAE1E,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AACrB,mBAA2C;AAiBrC;AAHC,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAA0D,QAAQ;AAAlE,iBAAE,YAAU,IAAI,UAAU,UAAU,UAhBvC,IAgBG,IAAkD,iBAAlD,IAAkD,CAAhD,YAAU,MAAI,WAAoB;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW;AAAA,UACT;AAAA,UACA,2BAA2B,OAAO;AAAA,UAClC;AAAA,QACF;AAAA,QACA;AAAA,QACA;AAAA,SACI,OATL;AAAA,QAWE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,kBAAkB,cAAc;;;ADmE5B,IAAAC,sBAAA;AAjEG,IAAM,iBAAa,0BAA4C,SAASC,YAC7E,IAgBA,KACA;AAjBA,eASc;AAAA,IARZ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,KAA+C,CAAC;AAAA,EA9ChE,IAqCE,IASc,SAAE,aAAW,eA9C7B,IA8CgB,IAAgC,uBAAhC,IAAgC,CAA9B,eAThB,SAUE;AAAA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAlDJ,IAqCE,IAcK,iBAdL,IAcK;AAAA,IAbH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;A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CAAC;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,8BAAK,mBAAmB,SAAsB;AAAA,MACzD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC,WAAC,eACA,8EACE;AAAA;AAAA,UAAC;AAAA,0DACK,OACA,aAFL;AAAA,YAGC;AAAA,YACA;AAAA,YACA,KAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,8BAAK,kCAAkC;AAAA,YAClD,MAAK;AAAA,YACL,OAAO;AAAA,YACP,SAAS,MAAM;AA1E3B,kBAAAC;AA2Ec,eAAAA,MAAA,SAAS,YAAT,gBAAAA,IAAkB;AAAA,YACpB;AAAA;AAAA,QACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,WAAW,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","InputGroup","_a","import_react","import_jsx_runtime","DatePicker","_a"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/date-picker/date-picker.tsx","../../../src/form/input-group/input-group.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup, type InputGroupProps } from \"../input-group\";\nimport { useMergeRefs } from \"../../utils/utils\";\n\nexport type DatePickerProps = Omit<\n InputGroupProps & Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n \"children\" | \"type\"\n> & {\n /**\n * Accessible title for the calendar button\n *\n * This button currently only shows in Chrome.\n *\n * @defaultValue \"Åpne kalender\"\n */\n calendarButtonTitle?: string;\n};\n\n/**\n * A basic implementation of a date picker\n *\n * This date picker is an implementation of native date picker, as you get\n * with `<input type=\"date\" />`, where the input field is dressed in Hedwig styling.\n *\n * Due to accessibility concerns you will only see the appropriate Hedwig calendar\n * icon in Chrome. Firefox will show built in icon and Safari will show no icon.\n * Not tested in Edge.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n {\n className,\n size,\n errorMessage,\n validationMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n readOnly,\n calendarButtonTitle = \"Åpne kalender\",\n ...rest\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n return (\n <InputGroup\n className={clsx(\"hds-date-picker\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n validationMessage={validationMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n size={size}\n >\n {(inputProps) => (\n <>\n <input\n {...rest}\n {...inputProps}\n disabled={disabled}\n readOnly={readOnly}\n ref={mergedRef}\n type=\"date\"\n />\n <button\n className={clsx(\"hds-date-picker__calendar-button\")}\n type=\"button\"\n title={calendarButtonTitle}\n onClick={() => {\n inputRef.current?.showPicker();\n }}\n />\n </>\n )}\n </InputGroup>\n );\n});\n\nDatePicker.displayName = \"DatePicker\";\n","import { useId, forwardRef, Children, isValidElement, cloneElement } from \"react\";\nimport type { LabelHTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\n\ninterface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n className?: string;\n}\n\nexport interface InputGroupProps {\n id?: string;\n className?: string;\n style?: CSSProperties;\n size?: \"large\" | \"small\";\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n validationMessage?: ReactNode | { value: ReactNode; variant: ValidationMessageProps[\"variant\"] };\n validationMessageProps?: Partial<ValidationMessageProps>;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n /**\n * `children` must be either a single input element or a render function.\n *\n * If you use a render function, make sure you spread the input props to the appropriate element.\n */\n children: Exclude<ReactNode, Iterable<ReactNode>> | ((inputProps: InputProps) => ReactNode);\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n size = \"large\",\n errorMessage,\n errorMessageProps,\n validationMessage,\n validationMessageProps,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const inputId = useId();\n const validationMessageId = useId();\n let validationMessageValue: ReactNode;\n let validationMessageVariant: ValidationMessageProps[\"variant\"] = \"danger\";\n\n if (validationMessage) {\n if (\n typeof validationMessage === \"object\" &&\n \"value\" in validationMessage &&\n \"variant\" in validationMessage\n ) {\n validationMessageValue = validationMessage.value;\n validationMessageVariant = validationMessage.variant;\n } else {\n validationMessageValue = validationMessage;\n }\n } else if (errorMessage) {\n validationMessageValue = errorMessage;\n }\n\n const renderInput = () => {\n const inputProps: InputProps = {\n \"aria-describedby\": validationMessageValue ? validationMessageId : undefined,\n \"aria-invalid\":\n validationMessageValue && validationMessageVariant === \"danger\" ? true : undefined,\n id: id ?? inputId,\n className: clsx(\"hds-input-group__input\"),\n };\n\n if (typeof children === \"function\") {\n return children(inputProps);\n }\n\n const input: ReactNode = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n className: `${inputProps.className} ${input.props.className ?? \"\"}`,\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${size}`]: size,\n \"hds-input-group--error\": validationMessageValue && validationMessageVariant === \"danger\",\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n {...rest}\n >\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ValidationMessage\n id={validationMessageId}\n variant={validationMessageVariant}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n\n /**\n * Variant of validation message\n * @default \"danger\"\n */\n variant?: \"info\" | \"success\" | \"warning\" | \"danger\";\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, variant = \"danger\", className, ...rest }, ref) => {\n return (\n <div\n aria-live=\"polite\"\n className={clsx(\n \"hds-validation-message\",\n `hds-validation-message--${variant}`,\n className as undefined,\n )}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA6D;AAC7D,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA0E;AAE1E,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AACrB,mBAA2C;AAiBrC;AAHC,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAA0D,QAAQ;AAAlE,iBAAE,YAAU,IAAI,UAAU,UAAU,UAhBvC,IAgBG,IAAkD,iBAAlD,IAAkD,CAAhD,YAAU,MAAI,WAAoB;AACnC,WACE;AAAA,MAAC;AAAA;AAAA,QACC,aAAU;AAAA,QACV,eAAW;AAAA,UACT;AAAA,UACA,2BAA2B,OAAO;AAAA,UAClC;AAAA,QACF;AAAA,QACA;AAAA,QACA;AAAA,SACI,OATL;AAAA,QAWE;AAAA;AAAA,IACH;AAAA,EAEJ;AACF;AACA,kBAAkB,cAAc;;;ADoE5B,IAAAC,sBAAA;AAlEG,IAAM,iBAAa,0BAA4C,SAASC,YAC7E,IAgBA,KACA;AAjBA,eASc;AAAA,IARZ;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,KAA+C,CAAC;AAAA,EA9ChE,IAqCE,IASc,SAAE,aAAW,eA9C7B,IA8CgB,IAAgC,uBAAhC,IAAgC,CAA9B,eAThB,SAUE;AAAA;AAAA,IACA;AAAA,IACA;AAA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AAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAKF,QAAM,eAAW,sBAAyB,IAAI;AAC9C,QAAM,YAAY,aAAa,CAAC,UAAU,GAAG,CAAC;AAE9C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,8BAAK,mBAAmB,SAAsB;AAAA,MACzD;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEC,WAAC,eACA,8EACE;AAAA;AAAA,UAAC;AAAA,0DACK,OACA,aAFL;AAAA,YAGC;AAAA,YACA;AAAA,YACA,KAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,8BAAK,kCAAkC;AAAA,YAClD,MAAK;AAAA,YACL,OAAO;AAAA,YACP,SAAS,MAAM;AA5E3B,kBAAAC;AA6Ec,eAAAA,MAAA,SAAS,YAAT,gBAAAA,IAAkB;AAAA,YACpB;AAAA;AAAA,QACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,WAAW,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","InputGroup","_a","import_react","import_jsx_runtime","DatePicker","_a"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DatePicker
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-4OXVKNAW.mjs";
|
|
4
4
|
import "../../chunk-Y5SUMFYJ.mjs";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-WTDLYUKK.mjs";
|
|
6
6
|
import "../../chunk-NSLSA7F7.mjs";
|
|
7
7
|
import "../../chunk-Y3HYCHMM.mjs";
|
|
8
8
|
import "../../chunk-5M6MEYM7.mjs";
|
|
@@ -148,7 +148,7 @@ var InputGroup = (0, import_react2.forwardRef)(function InputGroup2(_a, ref) {
|
|
|
148
148
|
var _a2;
|
|
149
149
|
const inputProps = {
|
|
150
150
|
"aria-describedby": validationMessageValue ? validationMessageId : void 0,
|
|
151
|
-
"aria-invalid": validationMessageValue ? true : void 0,
|
|
151
|
+
"aria-invalid": validationMessageValue && validationMessageVariant === "danger" ? true : void 0,
|
|
152
152
|
id: id != null ? id : inputId,
|
|
153
153
|
className: (0, import_typed_classname2.clsx)("hds-input-group__input")
|
|
154
154
|
};
|
|
@@ -170,7 +170,7 @@ var InputGroup = (0, import_react2.forwardRef)(function InputGroup2(_a, ref) {
|
|
|
170
170
|
"hds-input-group",
|
|
171
171
|
{
|
|
172
172
|
[`hds-input-group--${size}`]: size,
|
|
173
|
-
"hds-input-group--error":
|
|
173
|
+
"hds-input-group--error": validationMessageValue && validationMessageVariant === "danger"
|
|
174
174
|
},
|
|
175
175
|
className
|
|
176
176
|
),
|
|
@@ -238,6 +238,7 @@ var DatePicker = (0, import_react4.forwardRef)(function DatePicker2(_a, ref) {
|
|
|
238
238
|
className,
|
|
239
239
|
size,
|
|
240
240
|
errorMessage,
|
|
241
|
+
validationMessage,
|
|
241
242
|
labelProps,
|
|
242
243
|
label,
|
|
243
244
|
id,
|
|
@@ -249,6 +250,7 @@ var DatePicker = (0, import_react4.forwardRef)(function DatePicker2(_a, ref) {
|
|
|
249
250
|
"className",
|
|
250
251
|
"size",
|
|
251
252
|
"errorMessage",
|
|
253
|
+
"validationMessage",
|
|
252
254
|
"labelProps",
|
|
253
255
|
"label",
|
|
254
256
|
"id",
|
|
@@ -265,6 +267,7 @@ var DatePicker = (0, import_react4.forwardRef)(function DatePicker2(_a, ref) {
|
|
|
265
267
|
className: (0, import_typed_classname3.clsx)("hds-date-picker", className),
|
|
266
268
|
disabled,
|
|
267
269
|
errorMessage,
|
|
270
|
+
validationMessage,
|
|
268
271
|
id,
|
|
269
272
|
label,
|
|
270
273
|
labelProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/form/date-picker/index.tsx","../../../src/form/date-picker/date-picker.tsx","../../../src/form/input-group/input-group.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts"],"sourcesContent":["export { DatePicker } from \"./date-picker\";\nexport type * from \"./date-picker\";\n","import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup, type InputGroupProps } from \"../input-group\";\nimport { useMergeRefs } from \"../../utils/utils\";\n\nexport type DatePickerProps = Omit<\n InputGroupProps & Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n \"children\" | \"type\"\n> & {\n /**\n * Accessible title for the calendar button\n *\n * This button currently only shows in Chrome.\n *\n * @defaultValue \"Åpne kalender\"\n */\n calendarButtonTitle?: string;\n};\n\n/**\n * A basic implementation of a date picker\n *\n * This date picker is an implementation of native date picker, as you get\n * with `<input type=\"date\" />`, where the input field is dressed in Hedwig styling.\n *\n * Due to accessibility concerns you will only see the appropriate Hedwig calendar\n * icon in Chrome. Firefox will show built in icon and Safari will show no icon.\n * Not tested in Edge.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n {\n className,\n size,\n errorMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n readOnly,\n calendarButtonTitle = \"Åpne kalender\",\n ...rest\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n return (\n <InputGroup\n className={clsx(\"hds-date-picker\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n size={size}\n >\n {(inputProps) => (\n <>\n <input\n {...rest}\n {...inputProps}\n disabled={disabled}\n readOnly={readOnly}\n ref={mergedRef}\n type=\"date\"\n />\n <button\n className={clsx(\"hds-date-picker__calendar-button\")}\n type=\"button\"\n title={calendarButtonTitle}\n onClick={() => {\n inputRef.current?.showPicker();\n }}\n />\n </>\n )}\n </InputGroup>\n );\n});\n\nDatePicker.displayName = \"DatePicker\";\n","import { useId, forwardRef, Children, isValidElement, cloneElement } from \"react\";\nimport type { LabelHTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\n\ninterface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n className?: string;\n}\n\nexport interface InputGroupProps {\n id?: string;\n className?: string;\n style?: CSSProperties;\n size?: \"large\" | \"small\";\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n validationMessage?: ReactNode | { value: ReactNode; variant: ValidationMessageProps[\"variant\"] };\n validationMessageProps?: Partial<ValidationMessageProps>;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n /**\n * `children` must be either a single input element or a render function.\n *\n * If you use a render function, make sure you spread the input props to the appropriate element.\n */\n children: Exclude<ReactNode, Iterable<ReactNode>> | ((inputProps: InputProps) => ReactNode);\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n size = \"large\",\n errorMessage,\n errorMessageProps,\n validationMessage,\n validationMessageProps,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const inputId = useId();\n const validationMessageId = useId();\n let validationMessageValue: ReactNode;\n let validationMessageVariant: ValidationMessageProps[\"variant\"] = \"danger\";\n\n if (validationMessage) {\n if (\n typeof validationMessage === \"object\" &&\n \"value\" in validationMessage &&\n \"variant\" in validationMessage\n ) {\n validationMessageValue = validationMessage.value;\n validationMessageVariant = validationMessage.variant;\n } else {\n validationMessageValue = validationMessage;\n }\n } else if (errorMessage) {\n validationMessageValue = errorMessage;\n }\n\n const renderInput = () => {\n const inputProps: InputProps = {\n \"aria-describedby\": validationMessageValue ? validationMessageId : undefined,\n \"aria-invalid\": validationMessageValue ? true : undefined,\n id: id ?? inputId,\n className: clsx(\"hds-input-group__input\"),\n };\n\n if (typeof children === \"function\") {\n return children(inputProps);\n }\n\n const input: ReactNode = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n className: `${inputProps.className} ${input.props.className ?? \"\"}`,\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${size}`]: size,\n \"hds-input-group--error\": errorMessage,\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n {...rest}\n >\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ValidationMessage\n id={validationMessageId}\n variant={validationMessageVariant}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n\n /**\n * Variant of validation message\n * @default \"danger\"\n */\n variant?: \"info\" | \"success\" | \"warning\" | \"danger\";\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, variant = \"danger\", className, ...rest }, ref) => {\n return (\n <div\n aria-live=\"polite\"\n className={clsx(\n \"hds-validation-message\",\n `hds-validation-message--${variant}`,\n className as undefined,\n )}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA6D;AAC7D,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA0E;AAE1E,IAAAC,0BAAqB;;;ACFrB,6BAAqB;AACrB,mBAA2C;AAiBrC;AAHC,IAAM,wBAAoB;AAAA,EAC/B,CAAC,IAA0D,QAAQ;AAAlE,iBAAE,YAAU,IAAI,UAAU,UAAU,UAhBvC,IAgBG,IAAkD,iBAAlD,IAAkD,CAAhD,YAAU,MAAI,WAA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AAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,WAAW,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","InputGroup","_a","import_react","import_jsx_runtime","DatePicker","_a"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/form/date-picker/index.tsx","../../../src/form/date-picker/date-picker.tsx","../../../src/form/input-group/input-group.tsx","../../../src/form/validation-message/validation-message.tsx","../../../src/utils/utils.ts"],"sourcesContent":["export { DatePicker } from \"./date-picker\";\nexport type * from \"./date-picker\";\n","import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { InputGroup, type InputGroupProps } from \"../input-group\";\nimport { useMergeRefs } from \"../../utils/utils\";\n\nexport type DatePickerProps = Omit<\n InputGroupProps & Omit<InputHTMLAttributes<HTMLInputElement>, \"size\">,\n \"children\" | \"type\"\n> & {\n /**\n * Accessible title for the calendar button\n *\n * This button currently only shows in Chrome.\n *\n * @defaultValue \"Åpne kalender\"\n */\n calendarButtonTitle?: string;\n};\n\n/**\n * A basic implementation of a date picker\n *\n * This date picker is an implementation of native date picker, as you get\n * with `<input type=\"date\" />`, where the input field is dressed in Hedwig styling.\n *\n * Due to accessibility concerns you will only see the appropriate Hedwig calendar\n * icon in Chrome. Firefox will show built in icon and Safari will show no icon.\n * Not tested in Edge.\n */\nexport const DatePicker = forwardRef<HTMLInputElement, DatePickerProps>(function DatePicker(\n {\n className,\n size,\n errorMessage,\n validationMessage,\n labelProps,\n label,\n id,\n style,\n disabled,\n readOnly,\n calendarButtonTitle = \"Åpne kalender\",\n ...rest\n },\n ref,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n const mergedRef = useMergeRefs([inputRef, ref]);\n\n return (\n <InputGroup\n className={clsx(\"hds-date-picker\", className as undefined)}\n disabled={disabled}\n errorMessage={errorMessage}\n validationMessage={validationMessage}\n id={id}\n label={label}\n labelProps={labelProps}\n readOnly={readOnly}\n style={style}\n size={size}\n >\n {(inputProps) => (\n <>\n <input\n {...rest}\n {...inputProps}\n disabled={disabled}\n readOnly={readOnly}\n ref={mergedRef}\n type=\"date\"\n />\n <button\n className={clsx(\"hds-date-picker__calendar-button\")}\n type=\"button\"\n title={calendarButtonTitle}\n onClick={() => {\n inputRef.current?.showPicker();\n }}\n />\n </>\n )}\n </InputGroup>\n );\n});\n\nDatePicker.displayName = \"DatePicker\";\n","import { useId, forwardRef, Children, isValidElement, cloneElement } from \"react\";\nimport type { LabelHTMLAttributes, ReactNode, CSSProperties } from \"react\";\nimport { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { type ErrorMessageProps } from \"../error-message\";\nimport { ValidationMessage, type ValidationMessageProps } from \"../validation-message\";\n\ninterface InputProps {\n \"aria-describedby\"?: string;\n \"aria-invalid\"?: boolean;\n id?: string;\n className?: string;\n}\n\nexport interface InputGroupProps {\n id?: string;\n className?: string;\n style?: CSSProperties;\n size?: \"large\" | \"small\";\n /** @deprecated Use `validationMessage` instead */\n errorMessage?: ReactNode;\n /** @deprecated Use `validationMessageProps` instead */\n errorMessageProps?: Partial<ErrorMessageProps>;\n validationMessage?: ReactNode | { value: ReactNode; variant: ValidationMessageProps[\"variant\"] };\n validationMessageProps?: Partial<ValidationMessageProps>;\n labelProps?: LabelHTMLAttributes<HTMLLabelElement>;\n label: ReactNode;\n disabled?: boolean;\n readOnly?: boolean;\n /**\n * `children` must be either a single input element or a render function.\n *\n * If you use a render function, make sure you spread the input props to the appropriate element.\n */\n children: Exclude<ReactNode, Iterable<ReactNode>> | ((inputProps: InputProps) => ReactNode);\n}\n\nexport const InputGroup = forwardRef<HTMLDivElement, InputGroupProps>(function InputGroup(\n {\n id,\n className,\n style,\n size = \"large\",\n errorMessage,\n errorMessageProps,\n validationMessage,\n validationMessageProps,\n labelProps: { className: labelClassName, ...labelProps } = {},\n label,\n disabled,\n readOnly,\n children,\n ...rest\n },\n ref,\n) {\n const inputId = useId();\n const validationMessageId = useId();\n let validationMessageValue: ReactNode;\n let validationMessageVariant: ValidationMessageProps[\"variant\"] = \"danger\";\n\n if (validationMessage) {\n if (\n typeof validationMessage === \"object\" &&\n \"value\" in validationMessage &&\n \"variant\" in validationMessage\n ) {\n validationMessageValue = validationMessage.value;\n validationMessageVariant = validationMessage.variant;\n } else {\n validationMessageValue = validationMessage;\n }\n } else if (errorMessage) {\n validationMessageValue = errorMessage;\n }\n\n const renderInput = () => {\n const inputProps: InputProps = {\n \"aria-describedby\": validationMessageValue ? validationMessageId : undefined,\n \"aria-invalid\":\n validationMessageValue && validationMessageVariant === \"danger\" ? true : undefined,\n id: id ?? inputId,\n className: clsx(\"hds-input-group__input\"),\n };\n\n if (typeof children === \"function\") {\n return children(inputProps);\n }\n\n const input: ReactNode = Children.toArray(children)[0];\n\n if (!isValidElement<InputProps>(input)) {\n return;\n }\n\n return cloneElement<InputProps>(input, {\n ...inputProps,\n ...input.props,\n className: `${inputProps.className} ${input.props.className ?? \"\"}`,\n });\n };\n\n return (\n <div\n className={clsx(\n \"hds-input-group\",\n {\n [`hds-input-group--${size}`]: size,\n \"hds-input-group--error\": validationMessageValue && validationMessageVariant === \"danger\",\n },\n className as undefined,\n )}\n ref={ref}\n style={style}\n {...rest}\n >\n <label\n className={clsx(\"hds-input-group__label\", labelClassName as undefined)}\n {...labelProps}\n htmlFor={id ?? inputId}\n >\n {label}\n </label>\n <div\n className={clsx(\"hds-input-group__input-wrapper\")}\n data-disabled={disabled}\n data-readonly={readOnly}\n >\n {renderInput()}\n </div>\n <ValidationMessage\n id={validationMessageId}\n variant={validationMessageVariant}\n {...(validationMessageProps ?? errorMessageProps)}\n >\n {validationMessageValue}\n </ValidationMessage>\n </div>\n );\n});\n","import { clsx } from \"@postenbring/hedwig-css/typed-classname\";\nimport { forwardRef, type ReactNode } from \"react\";\n\nexport interface ValidationMessageProps extends React.HTMLAttributes<HTMLDivElement> {\n children: ReactNode;\n id: string;\n\n /**\n * Variant of validation message\n * @default \"danger\"\n */\n variant?: \"info\" | \"success\" | \"warning\" | \"danger\";\n className?: string;\n}\n\nexport const ValidationMessage = forwardRef<HTMLDivElement, ValidationMessageProps>(\n ({ children, id, variant = \"danger\", className, ...rest }, ref) => {\n return (\n <div\n aria-live=\"polite\"\n className={clsx(\n \"hds-validation-message\",\n `hds-validation-message--${variant}`,\n className as undefined,\n )}\n id={id}\n ref={ref}\n {...rest}\n >\n {children}\n </div>\n );\n },\n);\nValidationMessage.displayName = \"ValidationMessage\";\n","import * as React from \"react\";\nimport { useCallback, useEffect, useState, version } from \"react\";\n\n/**\n * Merges an array of refs into a single memoized callback ref or `null`.\n * @see https://floating-ui.com/docs/useMergeRefs\n */\nexport function useMergeRefs<Instance>(\n refs: (React.Ref<Instance> | undefined)[],\n): React.RefCallback<Instance> | null {\n return React.useMemo(() => {\n if (refs.every((ref) => ref === null)) {\n return null;\n }\n\n return (value) => {\n refs.forEach((ref) => {\n if (typeof ref === \"function\") {\n ref(value);\n } else if (ref !== null) {\n (ref as React.MutableRefObject<Instance | null>).current = value;\n }\n });\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, refs);\n}\n\nexport function useResize<Instance extends HTMLElement>(\n ref: React.RefObject<Instance> | undefined | null,\n): { width: number; height: number } {\n const [width, setWidth] = useState<number>(0);\n const [height, setHeight] = useState<number>(0);\n const handleResize = useCallback(() => {\n if (ref?.current !== null) {\n setWidth(ref?.current?.offsetWidth ?? 0);\n setHeight(ref?.current?.offsetHeight ?? 0);\n }\n }, [ref]);\n useEffect(() => {\n window.addEventListener(\"load\", handleResize);\n window.addEventListener(\"resize\", handleResize);\n return () => {\n window.removeEventListener(\"load\", handleResize);\n window.removeEventListener(\"resize\", handleResize);\n };\n }, [ref, handleResize]);\n useEffect(() => {\n handleResize();\n // eslint-disable-next-line react-hooks/exhaustive-deps -- It's ok\n }, []);\n return { width, height };\n}\n\nfunction subscribe() {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- It's ok\n return () => {};\n}\n\nexport function useHydrated() {\n return React.useSyncExternalStore(\n subscribe,\n () => true,\n () => false,\n );\n}\n\n/**\n * Trap focus inside an element using the `inert` attribute.\n *\n * Adds `inert` to all siblings of the given element, and all their ancestors up to the body.\n * Returns a cleanup function which removes the `inert` property from the elements, effectively giving focus back to rest of the document.\n *\n * NOTE: Does not support portals, i.e. elements outside the DOM hierarchy of the given element.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert\n * @see https://web.dev/articles/inert\n */\nexport function focusTrap(element: HTMLElement) {\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- NOP on focus trapping the body element\n if (element === document.body) return () => {};\n\n let inertElements: HTMLElement[] = [];\n for (let el: HTMLElement | null = element; el; el = el.parentElement) {\n if (el === document.body) break;\n\n for (const sibling of el.parentElement?.children ?? []) {\n if (sibling === el) continue;\n if (!(sibling instanceof HTMLElement)) continue;\n if (sibling.hasAttribute(\"inert\")) continue;\n\n sibling.setAttribute(\"inert\", \"true\");\n inertElements.push(sibling);\n }\n }\n\n return () => {\n releaseFocusTrap(inertElements);\n inertElements = [];\n };\n}\n\n/**\n * Unset the `inert` attribute on all elements given\n */\nfunction releaseFocusTrap(inertElements: Iterable<HTMLElement>) {\n for (const el of inertElements) {\n el.removeAttribute(\"inert\");\n }\n}\n\n/**\n * React 19 supports inert prop\n * React 18 needs inert to be a string\n */\nconst inertBooleanSupported: boolean = Number(version.split(\".\")[0]) >= 19;\n\n/**\n * Returns the inert prop value based on the React version.\n */\nexport const inertPropValue: (x: boolean) => boolean | \"\" | undefined = inertBooleanSupported\n ? (x: boolean): boolean => x\n : (x: boolean): \"\" | undefined => (x ? \"\" : undefined);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAA6D;AAC7D,IAAAC,0BAAqB;;;ACDrB,IAAAC,gBAA0E;AAE1E,IAAA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A;AAAA,YACA,KAAK;AAAA,YACL,MAAK;AAAA;AAAA,QACP;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,eAAW,8BAAK,kCAAkC;AAAA,YAClD,MAAK;AAAA,YACL,OAAO;AAAA,YACP,SAAS,MAAM;AA5E3B,kBAAAC;AA6Ec,eAAAA,MAAA,SAAS,YAAT,gBAAAA,IAAkB;AAAA,YACpB;AAAA;AAAA,QACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ,CAAC;AAED,WAAW,cAAc;","names":["import_react","import_typed_classname","import_react","import_typed_classname","import_jsx_runtime","InputGroup","_a","import_react","import_jsx_runtime","DatePicker","_a"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "../../chunk-TDLSHJ4Z.mjs";
|
|
2
2
|
import {
|
|
3
3
|
DatePicker
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-4OXVKNAW.mjs";
|
|
5
5
|
import "../../chunk-Y5SUMFYJ.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-WTDLYUKK.mjs";
|
|
7
7
|
import "../../chunk-NSLSA7F7.mjs";
|
|
8
8
|
import "../../chunk-Y3HYCHMM.mjs";
|
|
9
9
|
import "../../chunk-5M6MEYM7.mjs";
|