@gnist/design-system 3.8.4 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/components/actions/chips/ActionChip.cjs +4 -4
- package/dist/components/actions/chips/ActionChip.d.ts +1 -1
- package/dist/components/actions/chips/ActionChip.d.ts.map +1 -1
- package/dist/components/actions/chips/ActionChip.js +4 -4
- package/dist/components/actions/chips/FilterChip.cjs +4 -4
- package/dist/components/actions/chips/FilterChip.d.ts +1 -1
- package/dist/components/actions/chips/FilterChip.d.ts.map +1 -1
- package/dist/components/actions/chips/FilterChip.js +4 -4
- package/dist/components/actions/chips/TagChip.cjs +4 -4
- package/dist/components/actions/chips/TagChip.d.ts +1 -1
- package/dist/components/actions/chips/TagChip.d.ts.map +1 -1
- package/dist/components/actions/chips/TagChip.js +4 -4
- package/dist/components/actions/index.cjs +2 -0
- package/dist/components/actions/index.js +2 -0
- package/dist/components/actions/selectionControls/Checkbox.cjs +5 -5
- package/dist/components/actions/selectionControls/Checkbox.d.ts +5 -2
- package/dist/components/actions/selectionControls/Checkbox.d.ts.map +1 -1
- package/dist/components/actions/selectionControls/Checkbox.js +5 -5
- package/dist/components/actions/selectionControls/RadioButton.cjs +5 -5
- package/dist/components/actions/selectionControls/RadioButton.d.ts +5 -2
- package/dist/components/actions/selectionControls/RadioButton.d.ts.map +1 -1
- package/dist/components/actions/selectionControls/RadioButton.js +5 -5
- package/dist/components/actions/selectionControls/Switch.cjs +49 -0
- package/dist/components/actions/selectionControls/Switch.d.ts +17 -0
- package/dist/components/actions/selectionControls/Switch.d.ts.map +1 -0
- package/dist/components/actions/selectionControls/Switch.js +49 -0
- package/dist/components/actions/selectionControls/index.cjs +2 -0
- package/dist/components/actions/selectionControls/index.d.ts +1 -0
- package/dist/components/actions/selectionControls/index.d.ts.map +1 -1
- package/dist/components/actions/selectionControls/index.js +3 -1
- package/dist/components/actions/selectionControls/switch.css.cjs +165 -0
- package/dist/components/actions/selectionControls/switch.css.d.ts +46 -0
- package/dist/components/actions/selectionControls/switch.css.d.ts.map +1 -0
- package/dist/components/actions/selectionControls/switch.css.js +165 -0
- package/dist/components/index.cjs +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/inputs/dropdowns/MultiSelect.cjs +3 -4
- package/dist/components/inputs/dropdowns/MultiSelect.d.ts +1 -1
- package/dist/components/inputs/dropdowns/MultiSelect.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/MultiSelect.js +3 -4
- package/dist/components/inputs/dropdowns/SelectBase.cjs +9 -7
- package/dist/components/inputs/dropdowns/SelectBase.d.ts +1 -2
- package/dist/components/inputs/dropdowns/SelectBase.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/SelectBase.js +9 -7
- package/dist/components/inputs/dropdowns/SingleSelect.cjs +3 -4
- package/dist/components/inputs/dropdowns/SingleSelect.d.ts +1 -1
- package/dist/components/inputs/dropdowns/SingleSelect.d.ts.map +1 -1
- package/dist/components/inputs/dropdowns/SingleSelect.js +3 -4
- package/dist/components/inputs/pickers/calendar.cjs +9 -7
- package/dist/components/inputs/pickers/calendar.d.ts +3 -1
- package/dist/components/inputs/pickers/calendar.d.ts.map +1 -1
- package/dist/components/inputs/pickers/calendar.js +10 -8
- package/dist/components/inputs/textFields/TextArea.cjs +5 -5
- package/dist/components/inputs/textFields/TextArea.d.ts +3 -17
- package/dist/components/inputs/textFields/TextArea.d.ts.map +1 -1
- package/dist/components/inputs/textFields/TextArea.js +5 -5
- package/dist/components/inputs/textFields/TextField.cjs +5 -5
- package/dist/components/inputs/textFields/TextField.d.ts +5 -3
- package/dist/components/inputs/textFields/TextField.d.ts.map +1 -1
- package/dist/components/inputs/textFields/TextField.js +5 -5
- package/dist/components/surfaces/modal/Modal.cjs +10 -5
- package/dist/components/surfaces/modal/Modal.js +10 -5
- package/dist/foundation/typography/index.d.ts +2 -4
- package/dist/foundation/typography/index.d.ts.map +1 -1
- package/dist/index.cjs +2 -0
- package/dist/index.js +2 -0
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Ref } from "react";
|
|
1
2
|
export interface CalendarProps {
|
|
2
3
|
/** Seleted date */
|
|
3
4
|
selected: Date | undefined;
|
|
@@ -13,11 +14,12 @@ export interface CalendarProps {
|
|
|
13
14
|
onNavigate?: (date: Date) => void;
|
|
14
15
|
/** Decides if the calendar is in a loading state */
|
|
15
16
|
isLoading?: boolean;
|
|
17
|
+
ref?: Ref<HTMLDivElement>;
|
|
16
18
|
}
|
|
17
19
|
/**
|
|
18
20
|
* When a user does not know what date they will select, it can be useful to offer a browsing experience using a calendar component. This allows users to see dates organized into weeks and months, or with additional context such as which dates are unavailable for selection.
|
|
19
21
|
*
|
|
20
22
|
* Documentation: [Calendar](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-pickers-calendar--docs)
|
|
21
23
|
*/
|
|
22
|
-
export declare
|
|
24
|
+
export declare function Calendar({ selected, setSelected, isDateUnavailable, minDate: origMinDate, maxDate: origMaxDate, onNavigate, isLoading, ref, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
//# sourceMappingURL=calendar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/pickers/calendar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"calendar.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/pickers/calendar.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,GAAG,EAA+B,MAAM,OAAO,CAAC;AA4RzD,MAAM,WAAW,aAAa;IAC1B,mBAAmB;IACnB,QAAQ,EAAE,IAAI,GAAG,SAAS,CAAC;IAC3B,kCAAkC;IAClC,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,KAAK,IAAI,CAAC;IAC9C,0DAA0D;IAC1D,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;IAC5C,6BAA6B;IAC7B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,4BAA4B;IAC5B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClC,oDAAoD;IACpD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC7B;AAED;;;;GAIG;AAEH,wBAAgB,QAAQ,CAAC,EACrB,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,UAAU,EACV,SAAS,EACT,GAAG,GACN,EAAE,aAAa,2CA8Gf"}
|
|
@@ -7,7 +7,7 @@ import "../../../foundation/iconography/IconVariantProvider.js";
|
|
|
7
7
|
import "../../../foundation/iconography/icons.js";
|
|
8
8
|
import "../../../foundation/iconography/Icon.js";
|
|
9
9
|
import "../../../foundation/typography/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { useState, useEffect, useRef } from "react";
|
|
11
11
|
import "classnames";
|
|
12
12
|
import "../../../foundation/logos/Logo.css.js";
|
|
13
13
|
import "@gnist/themes/atoms.css.js";
|
|
@@ -26,11 +26,13 @@ import "../../progress/Spinner.js";
|
|
|
26
26
|
import "../../actions/buttons/styles.css.js";
|
|
27
27
|
import "../../../styles/states.css.js";
|
|
28
28
|
import { IconButton } from "../../actions/buttons/IconButton.js";
|
|
29
|
-
import "../../actions/selectionControls/
|
|
30
|
-
import "../../actions/selectionControls/
|
|
31
|
-
import "
|
|
32
|
-
import "../../actions/
|
|
33
|
-
import "../../actions/
|
|
29
|
+
import "../../actions/selectionControls/checkbox.css.js";
|
|
30
|
+
import "../../actions/selectionControls/shared.css.js";
|
|
31
|
+
import "../../../utilities/layout/Column.js";
|
|
32
|
+
import "../../actions/selectionControls/radiobutton.css.js";
|
|
33
|
+
import "../../actions/selectionControls/Switch.js";
|
|
34
|
+
import "../../../styles/animations.css.js";
|
|
35
|
+
import "../../actions/chips/styles.css.js";
|
|
34
36
|
import { headerCell, containerStyle, selectMonthRow, buttonRow, arrowButton, gridStyle, rowStyle, cellSkeletonStyle, firstDay, cellRecipe } from "./Calendar.css.js";
|
|
35
37
|
const HeaderCell = component("HeaderCell", headerCell, "div");
|
|
36
38
|
function weekDayNumberStartingMonday(date) {
|
|
@@ -163,7 +165,7 @@ function clampDate(date, minDate, maxDate) {
|
|
|
163
165
|
}
|
|
164
166
|
return date;
|
|
165
167
|
}
|
|
166
|
-
|
|
168
|
+
function Calendar({ selected, setSelected, isDateUnavailable, minDate: origMinDate, maxDate: origMaxDate, onNavigate, isLoading, ref }) {
|
|
167
169
|
const minDate = origMinDate ? getStartOfDay(origMinDate) : void 0;
|
|
168
170
|
const maxDate = origMaxDate ? getStartOfDay(origMaxDate) : void 0;
|
|
169
171
|
const text = useTranslation((t) => t.components.inputs.pickers.calendar);
|
|
@@ -202,7 +204,7 @@ const Calendar = forwardRef(function Calendar2({ selected, setSelected, isDateUn
|
|
|
202
204
|
}, label: text.showPreviousMonth, disabled: minDate && maxDayOfMonth(nextMonth(current, -1)) < minDate }), jsx(IconButton, { className: arrowButton, icon: "arrow_forward", onClick: () => {
|
|
203
205
|
handleChangeMonth(1);
|
|
204
206
|
}, label: text.showNextMonth, disabled: maxDate && nextMonth(current, 1) > maxDate })] })] }), jsxs("div", { className: gridStyle, role: "grid", children: [jsxs("div", { className: rowStyle, role: "row", style: { height: "unset" }, children: [jsx(HeaderCell, { role: "columnheader", children: days.mon }), jsx(HeaderCell, { role: "columnheader", children: days.tue }), jsx(HeaderCell, { role: "columnheader", children: days.wed }), jsx(HeaderCell, { role: "columnheader", children: days.thu }), jsx(HeaderCell, { role: "columnheader", children: days.fri }), jsx(HeaderCell, { role: "columnheader", children: days.sat }), jsx(HeaderCell, { role: "columnheader", children: days.sun })] }), jsx(DateGrid, { current, setCurrent, selected, setSelected, focused, setFocus, focusRef, isDateUnavailable, minDate, maxDate, isLoading: !!isLoading })] })] });
|
|
205
|
-
}
|
|
207
|
+
}
|
|
206
208
|
export {
|
|
207
209
|
Calendar
|
|
208
210
|
};
|
|
@@ -6,7 +6,7 @@ const InputHelperText = require("../../../building-blocks/inputs/InputHelperText
|
|
|
6
6
|
require("../../../utilities/layout/Row.cjs");
|
|
7
7
|
require("@gnist/themes/tokens.css.js");
|
|
8
8
|
require("react-content-loader");
|
|
9
|
-
|
|
9
|
+
require("react");
|
|
10
10
|
require("../../../foundation/iconography/ExtraIconsProvider.cjs");
|
|
11
11
|
require("../../../foundation/iconography/IconVariantProvider.cjs");
|
|
12
12
|
require("../../../foundation/iconography/icons.cjs");
|
|
@@ -25,10 +25,10 @@ const shared = require("../shared.cjs");
|
|
|
25
25
|
const textArea_css = require("./textArea.css.cjs");
|
|
26
26
|
const _interopDefaultCompat = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
27
27
|
const classNames__default = /* @__PURE__ */ _interopDefaultCompat(classNames);
|
|
28
|
-
|
|
28
|
+
function TextArea({ counterText, visibleLines: visibleLinesProp, ref, ...props }) {
|
|
29
29
|
const { wrapperProps, contentProps, commonInputProps } = shared.useInputFieldLogic(props);
|
|
30
30
|
const { inputProps } = shared.getInputFieldProps(props);
|
|
31
|
-
return jsxRuntime.jsxs("span", {
|
|
31
|
+
return jsxRuntime.jsxs("span", { className: classNames__default.default(wrapperProps.className, inputField_css.wrapperStyle), children: [props.leadingIcon && shared.isClickableIcon(props.leadingIcon) && jsxRuntime.jsx("button", { className: iconButtonOverlay_css.iconButtonOverlayRecipe({
|
|
32
32
|
placement: "left",
|
|
33
33
|
density: wrapperProps.density
|
|
34
34
|
}), title: props.leadingIcon.title, onClick: props.leadingIcon.onClick }), jsxRuntime.jsxs("label", { htmlFor: props.id, className: inputField_css.inputFieldWrapperRecipe({
|
|
@@ -40,7 +40,7 @@ const TextArea = React.forwardRef(function TextArea2({ counterText, visibleLines
|
|
|
40
40
|
...dynamic.assignInlineVars({
|
|
41
41
|
[inputFieldConstants_css.visibleLines]: (visibleLinesProp ?? 4).toString()
|
|
42
42
|
})
|
|
43
|
-
}, children: [jsxRuntime.jsx("textarea", { ...commonInputProps, ...inputProps, className: classNames__default.default(inputField_css.inputFieldStyle, inputProps.className), style: {
|
|
43
|
+
}, children: [jsxRuntime.jsx("textarea", { ...commonInputProps, ...inputProps, ref, className: classNames__default.default(inputField_css.inputFieldStyle, inputProps.className), style: {
|
|
44
44
|
...dynamic.assignInlineVars({
|
|
45
45
|
[inputFieldConstants_css.preInputWidth]: wrapperProps.preInputWidth,
|
|
46
46
|
[inputFieldConstants_css.postInputWidth]: wrapperProps.postInputWidth
|
|
@@ -63,7 +63,7 @@ const TextArea = React.forwardRef(function TextArea2({ counterText, visibleLines
|
|
|
63
63
|
placement: "right",
|
|
64
64
|
density: wrapperProps.density
|
|
65
65
|
}), title: props.trailingIcon.title, onClick: props.trailingIcon.onClick, type: "button" }), jsxRuntime.jsx(InputHelperText.InputHelperText, { id: contentProps.helperId, validity: props.validity, helperText: props.helperText, reserveSpaceForMessage: props.reserveSpaceForMessage, disabled: props.disabled })] });
|
|
66
|
-
}
|
|
66
|
+
}
|
|
67
67
|
const wordCount = (value, max) => `${value.trim().split(/\s/).filter((x) => !!x).length}/${max} words`;
|
|
68
68
|
const characterCount = (value, max) => `${value.trim().length}/${max}`;
|
|
69
69
|
exports.TextArea = TextArea;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TextareaHTMLAttributes } from "react";
|
|
1
|
+
import { Ref, TextareaHTMLAttributes } from "react";
|
|
2
2
|
import { TextInputProps } from "../shared.js";
|
|
3
3
|
export type TextAreaProps = TextInputProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "placeholder" | "value"> & {
|
|
4
4
|
/**
|
|
@@ -15,6 +15,7 @@ export type TextAreaProps = TextInputProps & Omit<TextareaHTMLAttributes<HTMLTex
|
|
|
15
15
|
* @default 4
|
|
16
16
|
*/
|
|
17
17
|
visibleLines?: number;
|
|
18
|
+
ref?: Ref<HTMLTextAreaElement>;
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
21
|
Text areas are fixed-height fields that are taller than text fields and wrap overflow text onto a new line.
|
|
@@ -28,22 +29,7 @@ If they are used, you must ensure the label and helper text in combination adequ
|
|
|
28
29
|
|
|
29
30
|
Documentation: [TextArea](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-textfields-textarea--docs)
|
|
30
31
|
*/
|
|
31
|
-
export declare
|
|
32
|
-
/**
|
|
33
|
-
* Text which shows e.g. a word or character count.
|
|
34
|
-
* `wordCount` and `characterCount` functions are available to generate this text.
|
|
35
|
-
*
|
|
36
|
-
* Accessibility note: The counter is hidden from screen readers, as live updates to the count tend to be "cut off"
|
|
37
|
-
* by the word being typed. If there is a max count it should also be communicated through helper text and
|
|
38
|
-
* validation.
|
|
39
|
-
*/
|
|
40
|
-
counterText?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Number of lines that should be visible without scrolling
|
|
43
|
-
* @default 4
|
|
44
|
-
*/
|
|
45
|
-
visibleLines?: number;
|
|
46
|
-
} & import("react").RefAttributes<HTMLSpanElement>>;
|
|
32
|
+
export declare function TextArea({ counterText, visibleLines: visibleLinesProp, ref, ...props }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
47
33
|
export declare const wordCount: (value: string, max: number) => string;
|
|
48
34
|
export declare const characterCount: (value: string, max: number) => string;
|
|
49
35
|
//# sourceMappingURL=TextArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/textFields/TextArea.tsx"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/textFields/TextArea.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,GAAG,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAC;AAepD,OAAO,EAGH,cAAc,EAEjB,MAAM,cAAc,CAAC;AAGtB,MAAM,MAAM,aAAa,GAAG,cAAc,GACtC,IAAI,CACA,sBAAsB,CAAC,mBAAmB,CAAC,EAC3C,aAAa,GAAG,OAAO,CAC1B,GAAG;IACA;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,GAAG,CAAC,mBAAmB,CAAC,CAAC;CAClC,CAAC;AAEN;;;;;;;;;;;EAWE;AACF,wBAAgB,QAAQ,CAAC,EACrB,WAAW,EACX,YAAY,EAAE,gBAAgB,EAC9B,GAAG,EACH,GAAG,KAAK,EACX,EAAE,aAAa,2CA6If;AAED,eAAO,MAAM,SAAS,UAAW,MAAM,OAAO,MAAM,WAMjC,CAAC;AAEpB,eAAO,MAAM,cAAc,UAAW,MAAM,OAAO,MAAM,WACtB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { InputHelperText } from "../../../building-blocks/inputs/InputHelperText
|
|
|
4
4
|
import "../../../utilities/layout/Row.js";
|
|
5
5
|
import "@gnist/themes/tokens.css.js";
|
|
6
6
|
import "react-content-loader";
|
|
7
|
-
import
|
|
7
|
+
import "react";
|
|
8
8
|
import "../../../foundation/iconography/ExtraIconsProvider.js";
|
|
9
9
|
import "../../../foundation/iconography/IconVariantProvider.js";
|
|
10
10
|
import "../../../foundation/iconography/icons.js";
|
|
@@ -21,10 +21,10 @@ import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
|
21
21
|
import { prefixStyle, suffixStyle } from "../shared-styles/suffixPrefix.css.js";
|
|
22
22
|
import { useInputFieldLogic, getInputFieldProps, isClickableIcon } from "../shared.js";
|
|
23
23
|
import { wordCounterStyle } from "./textArea.css.js";
|
|
24
|
-
|
|
24
|
+
function TextArea({ counterText, visibleLines: visibleLinesProp, ref, ...props }) {
|
|
25
25
|
const { wrapperProps, contentProps, commonInputProps } = useInputFieldLogic(props);
|
|
26
26
|
const { inputProps } = getInputFieldProps(props);
|
|
27
|
-
return jsxs("span", {
|
|
27
|
+
return jsxs("span", { className: classNames(wrapperProps.className, wrapperStyle), children: [props.leadingIcon && isClickableIcon(props.leadingIcon) && jsx("button", { className: iconButtonOverlayRecipe({
|
|
28
28
|
placement: "left",
|
|
29
29
|
density: wrapperProps.density
|
|
30
30
|
}), title: props.leadingIcon.title, onClick: props.leadingIcon.onClick }), jsxs("label", { htmlFor: props.id, className: inputFieldWrapperRecipe({
|
|
@@ -36,7 +36,7 @@ const TextArea = forwardRef(function TextArea2({ counterText, visibleLines: visi
|
|
|
36
36
|
...assignInlineVars({
|
|
37
37
|
[visibleLines]: (visibleLinesProp ?? 4).toString()
|
|
38
38
|
})
|
|
39
|
-
}, children: [jsx("textarea", { ...commonInputProps, ...inputProps, className: classNames(inputFieldStyle, inputProps.className), style: {
|
|
39
|
+
}, children: [jsx("textarea", { ...commonInputProps, ...inputProps, ref, className: classNames(inputFieldStyle, inputProps.className), style: {
|
|
40
40
|
...assignInlineVars({
|
|
41
41
|
[preInputWidth]: wrapperProps.preInputWidth,
|
|
42
42
|
[postInputWidth]: wrapperProps.postInputWidth
|
|
@@ -59,7 +59,7 @@ const TextArea = forwardRef(function TextArea2({ counterText, visibleLines: visi
|
|
|
59
59
|
placement: "right",
|
|
60
60
|
density: wrapperProps.density
|
|
61
61
|
}), title: props.trailingIcon.title, onClick: props.trailingIcon.onClick, type: "button" }), jsx(InputHelperText, { id: contentProps.helperId, validity: props.validity, helperText: props.helperText, reserveSpaceForMessage: props.reserveSpaceForMessage, disabled: props.disabled })] });
|
|
62
|
-
}
|
|
62
|
+
}
|
|
63
63
|
const wordCount = (value, max) => `${value.trim().split(/\s/).filter((x) => !!x).length}/${max} words`;
|
|
64
64
|
const characterCount = (value, max) => `${value.trim().length}/${max}`;
|
|
65
65
|
export {
|
|
@@ -9,11 +9,11 @@ const Icon = require("../../../foundation/iconography/Icon.cjs");
|
|
|
9
9
|
const atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
10
10
|
const dynamic = require("@vanilla-extract/dynamic");
|
|
11
11
|
const classNames = require("classnames");
|
|
12
|
-
const React = require("react");
|
|
13
12
|
const InputHelperText = require("../../../building-blocks/inputs/InputHelperText.cjs");
|
|
14
13
|
require("../../../utilities/layout/Row.cjs");
|
|
15
14
|
require("@gnist/themes/tokens.css.js");
|
|
16
15
|
require("react-content-loader");
|
|
16
|
+
require("react");
|
|
17
17
|
const iconButtonOverlay_css = require("../shared-styles/iconButtonOverlay.css.cjs");
|
|
18
18
|
const inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
19
19
|
const inputFieldConstants_css = require("../shared-styles/inputFieldConstants.css.cjs");
|
|
@@ -22,7 +22,7 @@ const suffixPrefix_css = require("../shared-styles/suffixPrefix.css.cjs");
|
|
|
22
22
|
const shared = require("../shared.cjs");
|
|
23
23
|
const _interopDefaultCompat = (e) => e && typeof e === "object" && "default" in e ? e : { default: e };
|
|
24
24
|
const classNames__default = /* @__PURE__ */ _interopDefaultCompat(classNames);
|
|
25
|
-
|
|
25
|
+
function TextField(props) {
|
|
26
26
|
const { wrapperProps, contentProps, commonInputProps } = shared.useInputFieldLogic(props);
|
|
27
27
|
const { inputProps } = shared.getInputFieldProps(props);
|
|
28
28
|
const isModeCurrencyOrNumberFormatting = props.mode?.style === "currency" || props.mode?.style === "numberSpacing";
|
|
@@ -47,14 +47,14 @@ const TextField = React.forwardRef(function TextField2(props, ref) {
|
|
|
47
47
|
}).format(parseFloat(inputProps.value)).replaceAll(/[^0-9.,\W]/g, "").trim();
|
|
48
48
|
inputProps.value = numberPrefix + formattedValue;
|
|
49
49
|
}
|
|
50
|
-
return jsxRuntime.jsxs("span", {
|
|
50
|
+
return jsxRuntime.jsxs("span", { className: classNames__default.default(wrapperProps.className, inputField_css.wrapperStyle), children: [props.leadingIcon && shared.isClickableIcon(props.leadingIcon) && jsxRuntime.jsx("button", { className: iconButtonOverlay_css.iconButtonOverlayRecipe({
|
|
51
51
|
placement: "left",
|
|
52
52
|
density: wrapperProps.density
|
|
53
53
|
}), title: props.leadingIcon.title, onClick: props.leadingIcon.onClick }), jsxRuntime.jsxs("label", { htmlFor: props.id, className: inputField_css.inputFieldWrapperRecipe({
|
|
54
54
|
disabled: props.disabled,
|
|
55
55
|
density: props.density,
|
|
56
56
|
validityType: props.validity?.type
|
|
57
|
-
}), children: [jsxRuntime.jsx("input", { ...commonInputProps, ...inputProps, value: inputProps.value, onChange: onChangeHandler, className: classNames__default.default(inputField_css.inputFieldStyle, inputProps.className), style: dynamic.assignInlineVars({
|
|
57
|
+
}), children: [jsxRuntime.jsx("input", { ...commonInputProps, ...inputProps, ref: props.ref, value: inputProps.value, onChange: onChangeHandler, className: classNames__default.default(inputField_css.inputFieldStyle, inputProps.className), style: dynamic.assignInlineVars({
|
|
58
58
|
[inputFieldConstants_css.preInputWidth]: wrapperProps.preInputWidth,
|
|
59
59
|
[inputFieldConstants_css.postInputWidth]: wrapperProps.postInputWidth
|
|
60
60
|
}), onFocus: (event) => {
|
|
@@ -75,5 +75,5 @@ const TextField = React.forwardRef(function TextField2(props, ref) {
|
|
|
75
75
|
placement: "right",
|
|
76
76
|
density: wrapperProps.density
|
|
77
77
|
}), title: props.trailingIcon.title, onClick: props.trailingIcon.onClick, type: "button" }), jsxRuntime.jsx(InputHelperText.InputHelperText, { id: contentProps.helperId, validity: props.validity, helperText: props.helperText, reserveSpaceForMessage: props.reserveSpaceForMessage, disabled: props.disabled })] });
|
|
78
|
-
}
|
|
78
|
+
}
|
|
79
79
|
exports.TextField = TextField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { InputHTMLAttributes } from "react";
|
|
1
|
+
import { InputHTMLAttributes, Ref } from "react";
|
|
2
2
|
import { TextInputProps } from "../shared.js";
|
|
3
3
|
export type TextFieldModeProps = {
|
|
4
4
|
/**
|
|
@@ -11,7 +11,9 @@ export type TextFieldModeProps = {
|
|
|
11
11
|
currency: "NOK";
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
|
-
export type TextFieldProps = TextInputProps & TextFieldModeProps & Omit<InputHTMLAttributes<HTMLInputElement>, "placeholder" | "value"
|
|
14
|
+
export type TextFieldProps = TextInputProps & TextFieldModeProps & Omit<InputHTMLAttributes<HTMLInputElement>, "placeholder" | "value"> & {
|
|
15
|
+
ref?: Ref<HTMLInputElement>;
|
|
16
|
+
};
|
|
15
17
|
/**
|
|
16
18
|
A text field is an input that allows a user to write or edit text. Text fields typically appear in forms and dialogs.
|
|
17
19
|
|
|
@@ -23,5 +25,5 @@ _Accessibility note:_ The leading/trailing icon and prefix/suffix text will not
|
|
|
23
25
|
|
|
24
26
|
Documentation: [TextField](https://gnist.moller.no/developers/components/latest/?path=/docs/components-inputs-textfields-textfield--docs)
|
|
25
27
|
*/
|
|
26
|
-
export declare
|
|
28
|
+
export declare function TextField(props: TextFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
//# sourceMappingURL=TextField.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/textFields/TextField.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"TextField.d.ts","sourceRoot":"","sources":["../../../../src/components/inputs/textFields/TextField.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAejD,OAAO,EAGH,cAAc,EAEjB,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,kBAAkB,GAAG;IAC7B;;OAEG;IACH,IAAI,CAAC,EAAE;QAAE,KAAK,EAAE,eAAe,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAA;KAAE,CAAC;CAC9E,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GACvC,kBAAkB,GAClB,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG;IACnE,GAAG,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC;CAC/B,CAAC;AAEN;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,2CAgL9C"}
|
|
@@ -7,18 +7,18 @@ import { Icon } from "../../../foundation/iconography/Icon.js";
|
|
|
7
7
|
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
8
8
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
9
9
|
import classNames from "classnames";
|
|
10
|
-
import { forwardRef } from "react";
|
|
11
10
|
import { InputHelperText } from "../../../building-blocks/inputs/InputHelperText.js";
|
|
12
11
|
import "../../../utilities/layout/Row.js";
|
|
13
12
|
import "@gnist/themes/tokens.css.js";
|
|
14
13
|
import "react-content-loader";
|
|
14
|
+
import "react";
|
|
15
15
|
import { iconButtonOverlayRecipe } from "../shared-styles/iconButtonOverlay.css.js";
|
|
16
16
|
import { inputFieldWrapperRecipe, inputFieldStyle, inputContentWrapper, wrapperStyle } from "../shared-styles/inputField.css.js";
|
|
17
17
|
import { postInputWidth, preInputWidth } from "../shared-styles/inputFieldConstants.css.js";
|
|
18
18
|
import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
19
19
|
import { prefixStyle, suffixStyle } from "../shared-styles/suffixPrefix.css.js";
|
|
20
20
|
import { useInputFieldLogic, getInputFieldProps, isClickableIcon } from "../shared.js";
|
|
21
|
-
|
|
21
|
+
function TextField(props) {
|
|
22
22
|
const { wrapperProps, contentProps, commonInputProps } = useInputFieldLogic(props);
|
|
23
23
|
const { inputProps } = getInputFieldProps(props);
|
|
24
24
|
const isModeCurrencyOrNumberFormatting = props.mode?.style === "currency" || props.mode?.style === "numberSpacing";
|
|
@@ -43,14 +43,14 @@ const TextField = forwardRef(function TextField2(props, ref) {
|
|
|
43
43
|
}).format(parseFloat(inputProps.value)).replaceAll(/[^0-9.,\W]/g, "").trim();
|
|
44
44
|
inputProps.value = numberPrefix + formattedValue;
|
|
45
45
|
}
|
|
46
|
-
return jsxs("span", {
|
|
46
|
+
return jsxs("span", { className: classNames(wrapperProps.className, wrapperStyle), children: [props.leadingIcon && isClickableIcon(props.leadingIcon) && jsx("button", { className: iconButtonOverlayRecipe({
|
|
47
47
|
placement: "left",
|
|
48
48
|
density: wrapperProps.density
|
|
49
49
|
}), title: props.leadingIcon.title, onClick: props.leadingIcon.onClick }), jsxs("label", { htmlFor: props.id, className: inputFieldWrapperRecipe({
|
|
50
50
|
disabled: props.disabled,
|
|
51
51
|
density: props.density,
|
|
52
52
|
validityType: props.validity?.type
|
|
53
|
-
}), children: [jsx("input", { ...commonInputProps, ...inputProps, value: inputProps.value, onChange: onChangeHandler, className: classNames(inputFieldStyle, inputProps.className), style: assignInlineVars({
|
|
53
|
+
}), children: [jsx("input", { ...commonInputProps, ...inputProps, ref: props.ref, value: inputProps.value, onChange: onChangeHandler, className: classNames(inputFieldStyle, inputProps.className), style: assignInlineVars({
|
|
54
54
|
[preInputWidth]: wrapperProps.preInputWidth,
|
|
55
55
|
[postInputWidth]: wrapperProps.postInputWidth
|
|
56
56
|
}), onFocus: (event) => {
|
|
@@ -71,7 +71,7 @@ const TextField = forwardRef(function TextField2(props, ref) {
|
|
|
71
71
|
placement: "right",
|
|
72
72
|
density: wrapperProps.density
|
|
73
73
|
}), title: props.trailingIcon.title, onClick: props.trailingIcon.onClick, type: "button" }), jsx(InputHelperText, { id: contentProps.helperId, validity: props.validity, helperText: props.helperText, reserveSpaceForMessage: props.reserveSpaceForMessage, disabled: props.disabled })] });
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
export {
|
|
76
76
|
TextField
|
|
77
77
|
};
|
|
@@ -19,11 +19,16 @@ require("../../actions/buttons/styles.css.cjs");
|
|
|
19
19
|
require("../../../styles/states.css.cjs");
|
|
20
20
|
const TextButton = require("../../actions/buttons/TextButton.cjs");
|
|
21
21
|
const IconButton = require("../../actions/buttons/IconButton.cjs");
|
|
22
|
-
require("
|
|
23
|
-
require("
|
|
24
|
-
require("../../actions/
|
|
25
|
-
require("../../actions/
|
|
26
|
-
require("
|
|
22
|
+
require("../../../building-blocks/inputs/internal/TextBelowInput.cjs");
|
|
23
|
+
require("@gnist/themes/atoms.css.js");
|
|
24
|
+
require("../../actions/selectionControls/checkbox.css.cjs");
|
|
25
|
+
require("../../actions/selectionControls/shared.css.cjs");
|
|
26
|
+
require("../../../utilities/layout/Column.cjs");
|
|
27
|
+
require("../../../utilities/layout/Row.cjs");
|
|
28
|
+
require("../../actions/selectionControls/radiobutton.css.cjs");
|
|
29
|
+
require("../../actions/selectionControls/Switch.cjs");
|
|
30
|
+
require("../../../styles/animations.css.cjs");
|
|
31
|
+
require("../../actions/chips/styles.css.cjs");
|
|
27
32
|
const index = require("../../../translations/index.cjs");
|
|
28
33
|
const reactDom = require("react-dom");
|
|
29
34
|
const modal_css = require("./modal.css.cjs");
|
|
@@ -18,11 +18,16 @@ import "../../actions/buttons/styles.css.js";
|
|
|
18
18
|
import "../../../styles/states.css.js";
|
|
19
19
|
import { TextButton } from "../../actions/buttons/TextButton.js";
|
|
20
20
|
import { IconButton } from "../../actions/buttons/IconButton.js";
|
|
21
|
-
import "
|
|
22
|
-
import "
|
|
23
|
-
import "../../actions/
|
|
24
|
-
import "../../actions/
|
|
25
|
-
import "
|
|
21
|
+
import "../../../building-blocks/inputs/internal/TextBelowInput.js";
|
|
22
|
+
import "@gnist/themes/atoms.css.js";
|
|
23
|
+
import "../../actions/selectionControls/checkbox.css.js";
|
|
24
|
+
import "../../actions/selectionControls/shared.css.js";
|
|
25
|
+
import "../../../utilities/layout/Column.js";
|
|
26
|
+
import "../../../utilities/layout/Row.js";
|
|
27
|
+
import "../../actions/selectionControls/radiobutton.css.js";
|
|
28
|
+
import "../../actions/selectionControls/Switch.js";
|
|
29
|
+
import "../../../styles/animations.css.js";
|
|
30
|
+
import "../../actions/chips/styles.css.js";
|
|
26
31
|
import { useTranslation } from "../../../translations/index.js";
|
|
27
32
|
import { createPortal } from "react-dom";
|
|
28
33
|
import { modalStyle, backdropStyle, headerRowRecipe, modalHeadingStyle, contentContainerRecipe, actionRowRecipe, dialogRecipe } from "./modal.css.js";
|
|
@@ -6,7 +6,7 @@ export interface DensityTextProps {
|
|
|
6
6
|
}
|
|
7
7
|
export declare const TextContainer: import("@gnist/component-utils").VanillaComponent<import("react").ElementType, "div">;
|
|
8
8
|
/**
|
|
9
|
-
Display is
|
|
9
|
+
The Display type is designed for attention-grabbing, prominent text that needs to stand out. Use this type sparingly to avoid overwhelming the user and ensure it retains its impact.
|
|
10
10
|
*/
|
|
11
11
|
export declare const DisplayText: import("@gnist/component-utils").VanillaComponent<import("react").ElementType, "h1">;
|
|
12
12
|
/**
|
|
@@ -22,9 +22,7 @@ export declare const Heading2Text: import("@gnist/component-utils").VanillaCompo
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const Heading3Text: import("@gnist/component-utils").VanillaComponent<import("react").ElementType, "h4">;
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
The lead paragraph should be not be longer than a single sentence, containing no more than 30 words.
|
|
25
|
+
Lead is the opening paragraph in an article that gives the reader a summary of the article and draws them in. This typo is mainly used in editorial content. The paragraph should be no longer than 30 words.
|
|
28
26
|
*/
|
|
29
27
|
export declare const LeadText: import("@gnist/component-utils").VanillaComponent<import("react").ElementType, "p">;
|
|
30
28
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundation/typography/index.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAIjD,eAAO,MAAM,YAAY,sCAExB,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC7B,OAAO,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,uFAAmD,CAAC;AAE9E;;EAEE;AACF,eAAO,MAAM,WAAW,sFAA8C,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,YAAY,sFAAgD,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,YAAY,sFAAgD,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,YAAY,sFAAgD,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/foundation/typography/index.tsx"],"names":[],"mappings":"AAaA,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAIjD,eAAO,MAAM,YAAY,sCAExB,CAAC;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC7B,OAAO,CAAC,EAAE,YAAY,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,uFAAmD,CAAC;AAE9E;;EAEE;AACF,eAAO,MAAM,WAAW,sFAA8C,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,YAAY,sFAAgD,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,YAAY,sFAAgD,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,YAAY,sFAAgD,CAAC;AAE1E;;GAEG;AACH,eAAO,MAAM,QAAQ,qFAAuC,CAAC;AAE7D;;GAEG;AACH,eAAO,MAAM,QAAQ,uFAAyC,CAAC;AAE/D;;EAEE;AACF,eAAO,MAAM,IAAI,qFAAmC,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,UAAU,qFAA2C,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -11,6 +11,7 @@ const TextButton = require("./components/actions/buttons/TextButton.cjs");
|
|
|
11
11
|
const IconButton = require("./components/actions/buttons/IconButton.cjs");
|
|
12
12
|
const Checkbox = require("./components/actions/selectionControls/Checkbox.cjs");
|
|
13
13
|
const RadioButton = require("./components/actions/selectionControls/RadioButton.cjs");
|
|
14
|
+
const Switch = require("./components/actions/selectionControls/Switch.cjs");
|
|
14
15
|
const ActionChip = require("./components/actions/chips/ActionChip.cjs");
|
|
15
16
|
const FilterChip = require("./components/actions/chips/FilterChip.cjs");
|
|
16
17
|
const TagChip = require("./components/actions/chips/TagChip.cjs");
|
|
@@ -60,6 +61,7 @@ exports.TextButton = TextButton.TextButton;
|
|
|
60
61
|
exports.IconButton = IconButton.IconButton;
|
|
61
62
|
exports.Checkbox = Checkbox.Checkbox;
|
|
62
63
|
exports.RadioButton = RadioButton.RadioButton;
|
|
64
|
+
exports.Switch = Switch.Switch;
|
|
63
65
|
exports.ActionChip = ActionChip.ActionChip;
|
|
64
66
|
exports.FilterChip = FilterChip.FilterChip;
|
|
65
67
|
exports.TagChip = TagChip.TagChip;
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,7 @@ import { TextButton } from "./components/actions/buttons/TextButton.js";
|
|
|
9
9
|
import { IconButton } from "./components/actions/buttons/IconButton.js";
|
|
10
10
|
import { Checkbox } from "./components/actions/selectionControls/Checkbox.js";
|
|
11
11
|
import { RadioButton } from "./components/actions/selectionControls/RadioButton.js";
|
|
12
|
+
import { Switch } from "./components/actions/selectionControls/Switch.js";
|
|
12
13
|
import { ActionChip } from "./components/actions/chips/ActionChip.js";
|
|
13
14
|
import { FilterChip } from "./components/actions/chips/FilterChip.js";
|
|
14
15
|
import { TagChip } from "./components/actions/chips/TagChip.js";
|
|
@@ -101,6 +102,7 @@ export {
|
|
|
101
102
|
SkodaFont,
|
|
102
103
|
Spinner,
|
|
103
104
|
SuccessButton,
|
|
105
|
+
Switch,
|
|
104
106
|
TagChip,
|
|
105
107
|
TextArea,
|
|
106
108
|
TextButton,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gnist/design-system",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"optional": true
|
|
103
103
|
}
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "3e5cba978c8b0145ee4f46b341191212e14ecd6f"
|
|
106
106
|
}
|