@gnist/design-system 7.3.1 → 7.5.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 +12 -0
- package/dist/components/actions/chips/StatusIndicator.cjs +48 -0
- package/dist/components/actions/chips/StatusIndicator.d.ts +21 -0
- package/dist/components/actions/chips/StatusIndicator.d.ts.map +1 -0
- package/dist/components/actions/chips/StatusIndicator.js +46 -0
- package/dist/components/actions/chips/index.cjs +2 -0
- package/dist/components/actions/chips/index.d.ts +3 -0
- package/dist/components/actions/chips/index.d.ts.map +1 -1
- package/dist/components/actions/chips/index.js +2 -1
- package/dist/components/actions/chips/statusIndicator.css.cjs +85 -0
- package/dist/components/actions/chips/statusIndicator.css.d.ts +44 -0
- package/dist/components/actions/chips/statusIndicator.css.d.ts.map +1 -0
- package/dist/components/actions/chips/statusIndicator.css.js +82 -0
- package/dist/components/actions/index.cjs +2 -0
- package/dist/components/actions/index.js +2 -1
- package/dist/components/feedback/feedbackInput/FeedbackInput.cjs +72 -0
- package/dist/components/feedback/feedbackInput/FeedbackInput.css.cjs +28 -0
- package/dist/components/feedback/feedbackInput/FeedbackInput.css.d.ts +5 -0
- package/dist/components/feedback/feedbackInput/FeedbackInput.css.d.ts.map +1 -0
- package/dist/components/feedback/feedbackInput/FeedbackInput.css.js +25 -0
- package/dist/components/feedback/feedbackInput/FeedbackInput.d.ts +39 -0
- package/dist/components/feedback/feedbackInput/FeedbackInput.d.ts.map +1 -0
- package/dist/components/feedback/feedbackInput/FeedbackInput.js +70 -0
- package/dist/components/feedback/feedbackInput/index.cjs +4 -0
- package/dist/components/feedback/feedbackInput/index.d.ts +4 -0
- package/dist/components/feedback/feedbackInput/index.d.ts.map +1 -0
- package/dist/components/feedback/feedbackInput/index.js +3 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.cjs +59 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.css.cjs +64 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.css.d.ts +7 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.css.d.ts.map +1 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.css.js +59 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.d.ts +9 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.d.ts.map +1 -0
- package/dist/components/feedback/feedbackInput/internal/RatingScale.js +57 -0
- package/dist/components/feedback/feedbackInput/package.json +7 -0
- package/dist/components/feedback/feedbackInput/types.d.ts +7 -0
- package/dist/components/feedback/feedbackInput/types.d.ts.map +1 -0
- package/dist/components/feedback/index.cjs +3 -0
- package/dist/components/feedback/index.d.ts +1 -0
- package/dist/components/feedback/index.d.ts.map +1 -1
- package/dist/components/feedback/index.js +3 -1
- package/dist/components/index.cjs +5 -1
- package/dist/components/index.js +4 -2
- package/dist/components/inputs/dropdowns/SelectBase.cjs +2 -2
- package/dist/components/inputs/dropdowns/SelectBase.js +2 -2
- package/dist/components/inputs/index.cjs +1 -1
- package/dist/components/inputs/index.js +1 -1
- package/dist/components/inputs/textFields/TextArea.cjs +2 -2
- package/dist/components/inputs/textFields/TextArea.js +2 -2
- package/dist/components/inputs/textFields/TextField.cjs +2 -2
- package/dist/components/inputs/textFields/TextField.js +2 -2
- package/dist/index.cjs +5 -1
- package/dist/index.js +4 -2
- package/dist/utilities/forms/internal/components.cjs +1 -1
- package/dist/utilities/forms/internal/components.js +1 -1
- package/package.json +7 -7
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { BodyText } from "../../../foundation/typography/index.js";
|
|
3
|
+
import { visuallyHidden } from "../../../utilities/accessibility/visuallyHidden.css.js";
|
|
4
|
+
import "../../../utilities/accessibility/index.js";
|
|
5
|
+
import { PrimaryButton } from "../../actions/buttons/PrimaryButton.js";
|
|
6
|
+
import { TextArea } from "../../inputs/textFields/TextArea.js";
|
|
7
|
+
import { feedbackDescription, feedbackInputFeedback, feedbackInputRoot, submitButton } from "./FeedbackInput.css.js";
|
|
8
|
+
import { RatingScale } from "./internal/RatingScale.js";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useId } from "react";
|
|
11
|
+
import classNames from "classnames";
|
|
12
|
+
//#region src/components/feedback/feedbackInput/FeedbackInput.tsx
|
|
13
|
+
/**
|
|
14
|
+
* FeedbackInput renders a controlled score prompt with optional free-text feedback and a submit action.
|
|
15
|
+
*
|
|
16
|
+
* Documentation: [FeedbackInput](https://gnist.moller.no/developers/components/latest/?path=/docs/components-feedback-feedbackinput--docs)
|
|
17
|
+
*/
|
|
18
|
+
function FeedbackInput({ questionLabel, selectedScore, onSelectScore, getScoreButtonLabel, feedbackDescriptionLabel, feedbackLabel, feedbackHelperTextLabel, feedbackValue, onFeedbackChange, maxLength, getCharacterCountLabel, getMaxLengthDescription, getMaxLengthExceededMessage, submitLabel, loadingLabel, onSubmit, submitButtonDisabled = false, status, afterSubmitLabel, className }) {
|
|
19
|
+
const textAreaId = useId();
|
|
20
|
+
const hasMaxLength = maxLength !== void 0;
|
|
21
|
+
const isMaxLengthExceeded = hasMaxLength && feedbackValue.length > maxLength;
|
|
22
|
+
return jsxs("div", {
|
|
23
|
+
className: classNames(className, feedbackInputRoot),
|
|
24
|
+
children: [jsx("div", {
|
|
25
|
+
role: "status",
|
|
26
|
+
"aria-live": "polite",
|
|
27
|
+
"aria-atomic": "true",
|
|
28
|
+
className: classNames(status !== "done" && visuallyHidden),
|
|
29
|
+
children: jsx(BodyText, { children: status === "done" ? afterSubmitLabel : null })
|
|
30
|
+
}), status !== "done" && jsxs(Fragment, { children: [jsx(RatingScale, {
|
|
31
|
+
label: questionLabel,
|
|
32
|
+
selectedScore,
|
|
33
|
+
onSelectScore,
|
|
34
|
+
getScoreButtonLabel
|
|
35
|
+
}), selectedScore !== null && jsxs(Fragment, { children: [jsx(BodyText, {
|
|
36
|
+
"$as": "p",
|
|
37
|
+
className: classNames(feedbackDescription),
|
|
38
|
+
children: feedbackDescriptionLabel
|
|
39
|
+
}), jsxs("div", {
|
|
40
|
+
className: feedbackInputFeedback,
|
|
41
|
+
children: [jsx(TextArea, {
|
|
42
|
+
id: textAreaId,
|
|
43
|
+
label: feedbackLabel,
|
|
44
|
+
value: feedbackValue,
|
|
45
|
+
onChange: (event) => onFeedbackChange(event.target.value),
|
|
46
|
+
helperText: hasMaxLength ? `${feedbackHelperTextLabel} ${getMaxLengthDescription(maxLength)}` : feedbackHelperTextLabel,
|
|
47
|
+
counterText: hasMaxLength ? getCharacterCountLabel(feedbackValue.length, maxLength) : void 0,
|
|
48
|
+
validity: isMaxLengthExceeded ? {
|
|
49
|
+
type: "error",
|
|
50
|
+
message: getMaxLengthExceededMessage(maxLength)
|
|
51
|
+
} : { type: "none" }
|
|
52
|
+
}), jsx(PrimaryButton, {
|
|
53
|
+
className: classNames(submitButton),
|
|
54
|
+
type: "button",
|
|
55
|
+
disabled: submitButtonDisabled || isMaxLengthExceeded,
|
|
56
|
+
onClick: () => onSubmit({
|
|
57
|
+
score: selectedScore,
|
|
58
|
+
feedback: feedbackValue
|
|
59
|
+
}),
|
|
60
|
+
loading: {
|
|
61
|
+
isLoading: status === "pending",
|
|
62
|
+
loadingText: loadingLabel
|
|
63
|
+
},
|
|
64
|
+
children: submitLabel
|
|
65
|
+
})]
|
|
66
|
+
})] })] })]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { FeedbackInput };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/feedbackInput/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,YAAY,EACR,mBAAmB,EACnB,aAAa,EACb,kBAAkB,GACrB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_runtime = require("../../../../_virtual/_rolldown/runtime.cjs");
|
|
3
|
+
const require_Icon = require("../../../../foundation/iconography/Icon.cjs");
|
|
4
|
+
require("../../../../foundation/iconography/index.cjs");
|
|
5
|
+
const require_index$1 = require("../../../../foundation/typography/index.cjs");
|
|
6
|
+
const require_RatingScale_css = require("./RatingScale.css.cjs");
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let classnames = require("classnames");
|
|
9
|
+
classnames = require_runtime.__toESM(classnames, 1);
|
|
10
|
+
//#region src/components/feedback/feedbackInput/internal/RatingScale.tsx
|
|
11
|
+
var ratingScaleIcons = {
|
|
12
|
+
1: "sentiment_very_dissatisfied",
|
|
13
|
+
2: "sentiment_dissatisfied",
|
|
14
|
+
3: "sentiment_neutral",
|
|
15
|
+
4: "sentiment_satisfied",
|
|
16
|
+
5: "sentiment_very_satisfied"
|
|
17
|
+
};
|
|
18
|
+
function RatingScale({ label, selectedScore, onSelectScore, getScoreButtonLabel }) {
|
|
19
|
+
return (0, react_jsx_runtime.jsxs)("fieldset", {
|
|
20
|
+
className: require_RatingScale_css.ratingScaleFieldset,
|
|
21
|
+
children: [(0, react_jsx_runtime.jsx)(require_index$1.BodyText, {
|
|
22
|
+
"$as": "legend",
|
|
23
|
+
className: require_RatingScale_css.ratingScaleLegend,
|
|
24
|
+
children: label
|
|
25
|
+
}), (0, react_jsx_runtime.jsx)("div", {
|
|
26
|
+
className: require_RatingScale_css.ratingScaleContainer,
|
|
27
|
+
children: [
|
|
28
|
+
1,
|
|
29
|
+
2,
|
|
30
|
+
3,
|
|
31
|
+
4,
|
|
32
|
+
5
|
|
33
|
+
].map((score) => {
|
|
34
|
+
const isSelected = selectedScore === score;
|
|
35
|
+
const isLocked = selectedScore !== null;
|
|
36
|
+
const isDisabled = isLocked && !isSelected;
|
|
37
|
+
return (0, react_jsx_runtime.jsx)("button", {
|
|
38
|
+
type: "button",
|
|
39
|
+
"aria-label": getScoreButtonLabel(score),
|
|
40
|
+
"aria-pressed": isSelected,
|
|
41
|
+
"aria-disabled": isLocked,
|
|
42
|
+
disabled: isDisabled,
|
|
43
|
+
className: (0, classnames.default)(require_RatingScale_css.ratingScaleButtonBase, isSelected && require_RatingScale_css.ratingScaleButtonSelected, isLocked && require_RatingScale_css.ratingScaleButtonDisabled),
|
|
44
|
+
onClick: () => {
|
|
45
|
+
if (!isLocked) onSelectScore(score);
|
|
46
|
+
},
|
|
47
|
+
children: (0, react_jsx_runtime.jsx)(require_Icon.Icon, {
|
|
48
|
+
icon: ratingScaleIcons[score],
|
|
49
|
+
size: "l",
|
|
50
|
+
variantOverride: isSelected ? "filled" : "round",
|
|
51
|
+
"aria-hidden": true
|
|
52
|
+
})
|
|
53
|
+
}, score);
|
|
54
|
+
})
|
|
55
|
+
})]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.RatingScale = RatingScale;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_states_css = require("../../../../styles/states.css.cjs");
|
|
3
|
+
let _gnist_themes_atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
4
|
+
let _gnist_themes_layers_css_js = require("@gnist/themes/layers.css.js");
|
|
5
|
+
let _gnist_themes_tokens_css_js = require("@gnist/themes/tokens.css.js");
|
|
6
|
+
//#region src/components/feedback/feedbackInput/internal/RatingScale.css.ts
|
|
7
|
+
var ratingScaleFieldset = (0, _gnist_themes_layers_css_js.gnistStyle)({
|
|
8
|
+
border: "none",
|
|
9
|
+
margin: 0,
|
|
10
|
+
padding: 0
|
|
11
|
+
});
|
|
12
|
+
var ratingScaleLegend = (0, _gnist_themes_layers_css_js.gnistStyle)({
|
|
13
|
+
width: "100%",
|
|
14
|
+
marginBottom: _gnist_themes_tokens_css_js.tokens.spacing.base,
|
|
15
|
+
textAlign: "center"
|
|
16
|
+
});
|
|
17
|
+
var ratingScaleContainer = (0, _gnist_themes_layers_css_js.gnistStyle)({
|
|
18
|
+
display: "flex",
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
gap: _gnist_themes_tokens_css_js.tokens.spacing.m
|
|
21
|
+
});
|
|
22
|
+
var ratingScaleButtonBase = (0, _gnist_themes_layers_css_js.gnistStyle)([
|
|
23
|
+
require_states_css.focusStyle,
|
|
24
|
+
(0, _gnist_themes_atoms_css_js.atoms)({
|
|
25
|
+
display: "inline-flex",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
padding: "none",
|
|
29
|
+
borderRadius: "full"
|
|
30
|
+
}),
|
|
31
|
+
{
|
|
32
|
+
appearance: "none",
|
|
33
|
+
border: "none",
|
|
34
|
+
boxSizing: "border-box",
|
|
35
|
+
width: "44px",
|
|
36
|
+
height: "44px",
|
|
37
|
+
margin: "0",
|
|
38
|
+
backgroundColor: "transparent",
|
|
39
|
+
color: _gnist_themes_tokens_css_js.tokens.color["on-background"],
|
|
40
|
+
transition: "transform 120ms ease, background-color 120ms ease, color 120ms ease, opacity 120ms ease",
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
selectors: {
|
|
43
|
+
"&:hover:not(:disabled):not([aria-disabled='true'])": {
|
|
44
|
+
transform: "scale(1.1)",
|
|
45
|
+
backgroundColor: _gnist_themes_tokens_css_js.tokens.color.surface,
|
|
46
|
+
color: _gnist_themes_tokens_css_js.tokens.color["on-surface"]
|
|
47
|
+
},
|
|
48
|
+
"&:active:not(:disabled):not([aria-disabled='true'])": { transform: "scale(1.05)" }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
var ratingScaleButtonSelected = (0, _gnist_themes_layers_css_js.gnistStyle)({ color: _gnist_themes_tokens_css_js.tokens.color["on-surface"] });
|
|
53
|
+
var ratingScaleButtonDisabled = (0, _gnist_themes_layers_css_js.gnistStyle)({
|
|
54
|
+
cursor: "not-allowed",
|
|
55
|
+
opacity: .2,
|
|
56
|
+
selectors: { "&[aria-pressed='true']": { opacity: .7 } }
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.ratingScaleButtonBase = ratingScaleButtonBase;
|
|
60
|
+
exports.ratingScaleButtonDisabled = ratingScaleButtonDisabled;
|
|
61
|
+
exports.ratingScaleButtonSelected = ratingScaleButtonSelected;
|
|
62
|
+
exports.ratingScaleContainer = ratingScaleContainer;
|
|
63
|
+
exports.ratingScaleFieldset = ratingScaleFieldset;
|
|
64
|
+
exports.ratingScaleLegend = ratingScaleLegend;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ratingScaleFieldset: string;
|
|
2
|
+
export declare const ratingScaleLegend: string;
|
|
3
|
+
export declare const ratingScaleContainer: string;
|
|
4
|
+
export declare const ratingScaleButtonBase: string;
|
|
5
|
+
export declare const ratingScaleButtonSelected: string;
|
|
6
|
+
export declare const ratingScaleButtonDisabled: string;
|
|
7
|
+
//# sourceMappingURL=RatingScale.css.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RatingScale.css.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/feedbackInput/internal/RatingScale.css.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,QAI9B,CAAC;AAEH,eAAO,MAAM,iBAAiB,QAI5B,CAAC;AAEH,eAAO,MAAM,oBAAoB,QAI/B,CAAC;AAEH,eAAO,MAAM,qBAAqB,QAgChC,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAEpC,CAAC;AAEH,eAAO,MAAM,yBAAyB,QAQpC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { focusStyle } from "../../../../styles/states.css.js";
|
|
3
|
+
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
4
|
+
import { gnistStyle } from "@gnist/themes/layers.css.js";
|
|
5
|
+
import { tokens } from "@gnist/themes/tokens.css.js";
|
|
6
|
+
//#region src/components/feedback/feedbackInput/internal/RatingScale.css.ts
|
|
7
|
+
var ratingScaleFieldset = gnistStyle({
|
|
8
|
+
border: "none",
|
|
9
|
+
margin: 0,
|
|
10
|
+
padding: 0
|
|
11
|
+
});
|
|
12
|
+
var ratingScaleLegend = gnistStyle({
|
|
13
|
+
width: "100%",
|
|
14
|
+
marginBottom: tokens.spacing.base,
|
|
15
|
+
textAlign: "center"
|
|
16
|
+
});
|
|
17
|
+
var ratingScaleContainer = gnistStyle({
|
|
18
|
+
display: "flex",
|
|
19
|
+
justifyContent: "center",
|
|
20
|
+
gap: tokens.spacing.m
|
|
21
|
+
});
|
|
22
|
+
var ratingScaleButtonBase = gnistStyle([
|
|
23
|
+
focusStyle,
|
|
24
|
+
atoms({
|
|
25
|
+
display: "inline-flex",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
padding: "none",
|
|
29
|
+
borderRadius: "full"
|
|
30
|
+
}),
|
|
31
|
+
{
|
|
32
|
+
appearance: "none",
|
|
33
|
+
border: "none",
|
|
34
|
+
boxSizing: "border-box",
|
|
35
|
+
width: "44px",
|
|
36
|
+
height: "44px",
|
|
37
|
+
margin: "0",
|
|
38
|
+
backgroundColor: "transparent",
|
|
39
|
+
color: tokens.color["on-background"],
|
|
40
|
+
transition: "transform 120ms ease, background-color 120ms ease, color 120ms ease, opacity 120ms ease",
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
selectors: {
|
|
43
|
+
"&:hover:not(:disabled):not([aria-disabled='true'])": {
|
|
44
|
+
transform: "scale(1.1)",
|
|
45
|
+
backgroundColor: tokens.color.surface,
|
|
46
|
+
color: tokens.color["on-surface"]
|
|
47
|
+
},
|
|
48
|
+
"&:active:not(:disabled):not([aria-disabled='true'])": { transform: "scale(1.05)" }
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
var ratingScaleButtonSelected = gnistStyle({ color: tokens.color["on-surface"] });
|
|
53
|
+
var ratingScaleButtonDisabled = gnistStyle({
|
|
54
|
+
cursor: "not-allowed",
|
|
55
|
+
opacity: .2,
|
|
56
|
+
selectors: { "&[aria-pressed='true']": { opacity: .7 } }
|
|
57
|
+
});
|
|
58
|
+
//#endregion
|
|
59
|
+
export { ratingScaleButtonBase, ratingScaleButtonDisabled, ratingScaleButtonSelected, ratingScaleContainer, ratingScaleFieldset, ratingScaleLegend };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FeedbackScore } from "../types.js";
|
|
2
|
+
export interface RatingScaleProps {
|
|
3
|
+
label: string;
|
|
4
|
+
selectedScore: FeedbackScore | null;
|
|
5
|
+
onSelectScore: (score: FeedbackScore) => void;
|
|
6
|
+
getScoreButtonLabel: (score: FeedbackScore) => string;
|
|
7
|
+
}
|
|
8
|
+
export declare function RatingScale({ label, selectedScore, onSelectScore, getScoreButtonLabel, }: RatingScaleProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=RatingScale.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RatingScale.d.ts","sourceRoot":"","sources":["../../../../../src/components/feedback/feedbackInput/internal/RatingScale.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAyBjD,MAAM,WAAW,gBAAgB;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IACpC,aAAa,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,mBAAmB,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,MAAM,CAAC;CACzD;AAED,wBAAgB,WAAW,CAAC,EACxB,KAAK,EACL,aAAa,EACb,aAAa,EACb,mBAAmB,GACtB,EAAE,gBAAgB,2CA8ClB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Icon } from "../../../../foundation/iconography/Icon.js";
|
|
3
|
+
import "../../../../foundation/iconography/index.js";
|
|
4
|
+
import { BodyText } from "../../../../foundation/typography/index.js";
|
|
5
|
+
import { ratingScaleButtonBase, ratingScaleButtonDisabled, ratingScaleButtonSelected, ratingScaleContainer, ratingScaleFieldset, ratingScaleLegend } from "./RatingScale.css.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import classNames from "classnames";
|
|
8
|
+
//#region src/components/feedback/feedbackInput/internal/RatingScale.tsx
|
|
9
|
+
var ratingScaleIcons = {
|
|
10
|
+
1: "sentiment_very_dissatisfied",
|
|
11
|
+
2: "sentiment_dissatisfied",
|
|
12
|
+
3: "sentiment_neutral",
|
|
13
|
+
4: "sentiment_satisfied",
|
|
14
|
+
5: "sentiment_very_satisfied"
|
|
15
|
+
};
|
|
16
|
+
function RatingScale({ label, selectedScore, onSelectScore, getScoreButtonLabel }) {
|
|
17
|
+
return jsxs("fieldset", {
|
|
18
|
+
className: ratingScaleFieldset,
|
|
19
|
+
children: [jsx(BodyText, {
|
|
20
|
+
"$as": "legend",
|
|
21
|
+
className: ratingScaleLegend,
|
|
22
|
+
children: label
|
|
23
|
+
}), jsx("div", {
|
|
24
|
+
className: ratingScaleContainer,
|
|
25
|
+
children: [
|
|
26
|
+
1,
|
|
27
|
+
2,
|
|
28
|
+
3,
|
|
29
|
+
4,
|
|
30
|
+
5
|
|
31
|
+
].map((score) => {
|
|
32
|
+
const isSelected = selectedScore === score;
|
|
33
|
+
const isLocked = selectedScore !== null;
|
|
34
|
+
const isDisabled = isLocked && !isSelected;
|
|
35
|
+
return jsx("button", {
|
|
36
|
+
type: "button",
|
|
37
|
+
"aria-label": getScoreButtonLabel(score),
|
|
38
|
+
"aria-pressed": isSelected,
|
|
39
|
+
"aria-disabled": isLocked,
|
|
40
|
+
disabled: isDisabled,
|
|
41
|
+
className: classNames(ratingScaleButtonBase, isSelected && ratingScaleButtonSelected, isLocked && ratingScaleButtonDisabled),
|
|
42
|
+
onClick: () => {
|
|
43
|
+
if (!isLocked) onSelectScore(score);
|
|
44
|
+
},
|
|
45
|
+
children: jsx(Icon, {
|
|
46
|
+
icon: ratingScaleIcons[score],
|
|
47
|
+
size: "l",
|
|
48
|
+
variantOverride: isSelected ? "filled" : "round",
|
|
49
|
+
"aria-hidden": true
|
|
50
|
+
})
|
|
51
|
+
}, score);
|
|
52
|
+
})
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { RatingScale };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/feedback/feedbackInput/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,SAAS,GAAG,MAAM,CAAC;AACnE,MAAM,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE9C,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -5,11 +5,14 @@ require("./alerts/index.cjs");
|
|
|
5
5
|
const require_LoadingSpinner = require("./loaders/LoadingSpinner.cjs");
|
|
6
6
|
const require_LoadingBar = require("./loaders/LoadingBar.cjs");
|
|
7
7
|
require("./loaders/index.cjs");
|
|
8
|
+
const require_FeedbackInput = require("./feedbackInput/FeedbackInput.cjs");
|
|
9
|
+
require("./feedbackInput/index.cjs");
|
|
8
10
|
const require_Lozenge = require("./notifications/Lozenge.cjs");
|
|
9
11
|
require("./notifications/index.cjs");
|
|
10
12
|
const require_ProgressBar = require("./progress/ProgressBar.cjs");
|
|
11
13
|
require("./progress/index.cjs");
|
|
12
14
|
exports.AlertBanner = require_AlertBanner.AlertBanner;
|
|
15
|
+
exports.FeedbackInput = require_FeedbackInput.FeedbackInput;
|
|
13
16
|
exports.LoadingBar = require_LoadingBar.LoadingBar;
|
|
14
17
|
exports.LoadingBarComponent = require_LoadingBar.LoadingBarComponent;
|
|
15
18
|
exports.LoadingSpinner = require_LoadingSpinner.LoadingSpinner;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/feedback/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/feedback/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
@@ -4,8 +4,10 @@ import "./alerts/index.js";
|
|
|
4
4
|
import { LoadingSpinner } from "./loaders/LoadingSpinner.js";
|
|
5
5
|
import { LoadingBar, LoadingBarComponent } from "./loaders/LoadingBar.js";
|
|
6
6
|
import "./loaders/index.js";
|
|
7
|
+
import { FeedbackInput } from "./feedbackInput/FeedbackInput.js";
|
|
8
|
+
import "./feedbackInput/index.js";
|
|
7
9
|
import { Lozenge } from "./notifications/Lozenge.js";
|
|
8
10
|
import "./notifications/index.js";
|
|
9
11
|
import { ProgressBar, ProgressBarComponent } from "./progress/ProgressBar.js";
|
|
10
12
|
import "./progress/index.js";
|
|
11
|
-
export { AlertBanner, LoadingBar, LoadingBarComponent, LoadingSpinner, Lozenge, ProgressBar, ProgressBarComponent };
|
|
13
|
+
export { AlertBanner, FeedbackInput, LoadingBar, LoadingBarComponent, LoadingSpinner, Lozenge, ProgressBar, ProgressBarComponent };
|
|
@@ -15,18 +15,20 @@ const require_RadioButton = require("./actions/selectionControls/RadioButton.cjs
|
|
|
15
15
|
const require_Switch = require("./actions/selectionControls/Switch.cjs");
|
|
16
16
|
const require_ActionChip = require("./actions/chips/ActionChip.cjs");
|
|
17
17
|
const require_FilterChip = require("./actions/chips/FilterChip.cjs");
|
|
18
|
+
const require_StatusIndicator = require("./actions/chips/StatusIndicator.cjs");
|
|
18
19
|
const require_TagChip = require("./actions/chips/TagChip.cjs");
|
|
19
20
|
require("./actions/index.cjs");
|
|
20
21
|
const require_AlertBanner = require("./feedback/alerts/AlertBanner.cjs");
|
|
21
22
|
const require_LoadingSpinner = require("./feedback/loaders/LoadingSpinner.cjs");
|
|
22
23
|
const require_LoadingBar = require("./feedback/loaders/LoadingBar.cjs");
|
|
24
|
+
const require_TextArea = require("./inputs/textFields/TextArea.cjs");
|
|
25
|
+
const require_FeedbackInput = require("./feedback/feedbackInput/FeedbackInput.cjs");
|
|
23
26
|
const require_Lozenge = require("./feedback/notifications/Lozenge.cjs");
|
|
24
27
|
const require_ProgressBar = require("./feedback/progress/ProgressBar.cjs");
|
|
25
28
|
require("./feedback/index.cjs");
|
|
26
29
|
const require_MultiSelect = require("./inputs/dropdowns/MultiSelect.cjs");
|
|
27
30
|
const require_SingleSelect = require("./inputs/dropdowns/SingleSelect.cjs");
|
|
28
31
|
const require_calendar = require("./inputs/pickers/calendar.cjs");
|
|
29
|
-
const require_TextArea = require("./inputs/textFields/TextArea.cjs");
|
|
30
32
|
const require_TextField = require("./inputs/textFields/TextField.cjs");
|
|
31
33
|
require("./inputs/index.cjs");
|
|
32
34
|
const require_ActionCard = require("./surfaces/cards/ActionCard.cjs");
|
|
@@ -45,6 +47,7 @@ exports.Calendar = require_calendar.Calendar;
|
|
|
45
47
|
exports.Checkbox = require_Checkbox.Checkbox;
|
|
46
48
|
exports.CheckboxCard = require_CheckboxCard.CheckboxCard;
|
|
47
49
|
exports.DangerButton = require_DangerButton.DangerButton;
|
|
50
|
+
exports.FeedbackInput = require_FeedbackInput.FeedbackInput;
|
|
48
51
|
exports.FilterChip = require_FilterChip.FilterChip;
|
|
49
52
|
exports.GhostButton = require_GhostButton.GhostButton;
|
|
50
53
|
exports.IconButton = require_IconButton.IconButton;
|
|
@@ -65,6 +68,7 @@ exports.RadioGroup = require_RadioGroup.RadioGroup;
|
|
|
65
68
|
exports.SecondaryButton = require_SecondaryButton.SecondaryButton;
|
|
66
69
|
exports.SingleSelect = require_SingleSelect.SingleSelect;
|
|
67
70
|
exports.Spinner = require_Spinner.Spinner;
|
|
71
|
+
exports.StatusIndicator = require_StatusIndicator.StatusIndicator;
|
|
68
72
|
exports.SuccessButton = require_SuccessButton.SuccessButton;
|
|
69
73
|
exports.Switch = require_Switch.Switch;
|
|
70
74
|
exports.TagChip = require_TagChip.TagChip;
|
package/dist/components/index.js
CHANGED
|
@@ -14,18 +14,20 @@ import { RadioButton } from "./actions/selectionControls/RadioButton.js";
|
|
|
14
14
|
import { Switch } from "./actions/selectionControls/Switch.js";
|
|
15
15
|
import { ActionChip } from "./actions/chips/ActionChip.js";
|
|
16
16
|
import { FilterChip } from "./actions/chips/FilterChip.js";
|
|
17
|
+
import { StatusIndicator } from "./actions/chips/StatusIndicator.js";
|
|
17
18
|
import { TagChip } from "./actions/chips/TagChip.js";
|
|
18
19
|
import "./actions/index.js";
|
|
19
20
|
import { AlertBanner } from "./feedback/alerts/AlertBanner.js";
|
|
20
21
|
import { LoadingSpinner } from "./feedback/loaders/LoadingSpinner.js";
|
|
21
22
|
import { LoadingBar, LoadingBarComponent } from "./feedback/loaders/LoadingBar.js";
|
|
23
|
+
import { TextArea, characterCount, wordCount } from "./inputs/textFields/TextArea.js";
|
|
24
|
+
import { FeedbackInput } from "./feedback/feedbackInput/FeedbackInput.js";
|
|
22
25
|
import { Lozenge } from "./feedback/notifications/Lozenge.js";
|
|
23
26
|
import { ProgressBar, ProgressBarComponent } from "./feedback/progress/ProgressBar.js";
|
|
24
27
|
import "./feedback/index.js";
|
|
25
28
|
import { MultiSelect } from "./inputs/dropdowns/MultiSelect.js";
|
|
26
29
|
import { SingleSelect } from "./inputs/dropdowns/SingleSelect.js";
|
|
27
30
|
import { Calendar } from "./inputs/pickers/calendar.js";
|
|
28
|
-
import { TextArea, characterCount, wordCount } from "./inputs/textFields/TextArea.js";
|
|
29
31
|
import { TextField } from "./inputs/textFields/TextField.js";
|
|
30
32
|
import "./inputs/index.js";
|
|
31
33
|
import { ActionCard } from "./surfaces/cards/ActionCard.js";
|
|
@@ -36,4 +38,4 @@ import { RadioCard } from "./surfaces/cards/RadioCard.js";
|
|
|
36
38
|
import { Modal } from "./surfaces/modal/Modal.js";
|
|
37
39
|
import { Accordion } from "./surfaces/accordion/Accordion.js";
|
|
38
40
|
import "./surfaces/index.js";
|
|
39
|
-
export { Accordion, ActionCard, ActionChip, AlertBanner, Calendar, Checkbox, CheckboxCard, DangerButton, FilterChip, GhostButton, IconButton, InfoCard, LinkCard, LoadingBar, LoadingBarComponent, LoadingSpinner, Lozenge, Modal, MultiSelect, PrimaryButton, ProgressBar, ProgressBarComponent, RadioButton, RadioCard, RadioGroup, SecondaryButton, SingleSelect, Spinner, SuccessButton, Switch, TagChip, TextArea, TextButton, TextField, characterCount, wordCount };
|
|
41
|
+
export { Accordion, ActionCard, ActionChip, AlertBanner, Calendar, Checkbox, CheckboxCard, DangerButton, FeedbackInput, FilterChip, GhostButton, IconButton, InfoCard, LinkCard, LoadingBar, LoadingBarComponent, LoadingSpinner, Lozenge, Modal, MultiSelect, PrimaryButton, ProgressBar, ProgressBarComponent, RadioButton, RadioCard, RadioGroup, SecondaryButton, SingleSelect, Spinner, StatusIndicator, SuccessButton, Switch, TagChip, TextArea, TextButton, TextField, characterCount, wordCount };
|
|
@@ -8,9 +8,9 @@ require("../../../building-blocks/index.cjs");
|
|
|
8
8
|
require("../../actions/index.cjs");
|
|
9
9
|
const require_inputFieldConstants_css = require("../shared-styles/inputFieldConstants.css.cjs");
|
|
10
10
|
const require_inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
11
|
-
const require_select_css = require("./select.css.cjs");
|
|
12
|
-
const require_shared = require("../shared.cjs");
|
|
13
11
|
const require_labelStyles_css = require("../shared-styles/labelStyles.css.cjs");
|
|
12
|
+
const require_shared = require("../shared.cjs");
|
|
13
|
+
const require_select_css = require("./select.css.cjs");
|
|
14
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
15
|
let _gnist_themes_atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
16
16
|
let react = require("react");
|
|
@@ -7,9 +7,9 @@ import "../../../building-blocks/index.js";
|
|
|
7
7
|
import "../../actions/index.js";
|
|
8
8
|
import { postInputWidth, preInputWidth } from "../shared-styles/inputFieldConstants.css.js";
|
|
9
9
|
import { inputContentWrapper, inputFieldWrapperRecipe, wrapperStyle } from "../shared-styles/inputField.css.js";
|
|
10
|
-
import { listBoxStyle, optionBackground, optionStyle, popUpStyle, selectStyle, singleOptionStyle } from "./select.css.js";
|
|
11
|
-
import { useSelectInputLogic } from "../shared.js";
|
|
12
10
|
import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
11
|
+
import { useSelectInputLogic } from "../shared.js";
|
|
12
|
+
import { listBoxStyle, optionBackground, optionStyle, popUpStyle, selectStyle, singleOptionStyle } from "./select.css.js";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
15
15
|
import * as React from "react";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const require_TextArea = require("./textFields/TextArea.cjs");
|
|
3
4
|
const require_MultiSelect = require("./dropdowns/MultiSelect.cjs");
|
|
4
5
|
const require_SingleSelect = require("./dropdowns/SingleSelect.cjs");
|
|
5
6
|
require("./dropdowns/index.cjs");
|
|
6
7
|
const require_calendar = require("./pickers/calendar.cjs");
|
|
7
8
|
require("./pickers/index.cjs");
|
|
8
|
-
const require_TextArea = require("./textFields/TextArea.cjs");
|
|
9
9
|
const require_TextField = require("./textFields/TextField.cjs");
|
|
10
10
|
require("./textFields/index.cjs");
|
|
11
11
|
exports.Calendar = require_calendar.Calendar;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { TextArea, characterCount, wordCount } from "./textFields/TextArea.js";
|
|
2
3
|
import { MultiSelect } from "./dropdowns/MultiSelect.js";
|
|
3
4
|
import { SingleSelect } from "./dropdowns/SingleSelect.js";
|
|
4
5
|
import "./dropdowns/index.js";
|
|
5
6
|
import { Calendar } from "./pickers/calendar.js";
|
|
6
7
|
import "./pickers/index.js";
|
|
7
|
-
import { TextArea, characterCount, wordCount } from "./textFields/TextArea.js";
|
|
8
8
|
import { TextField } from "./textFields/TextField.js";
|
|
9
9
|
import "./textFields/index.js";
|
|
10
10
|
export { Calendar, MultiSelect, SingleSelect, TextArea, TextField, characterCount, wordCount };
|
|
@@ -4,12 +4,12 @@ const require_Icon = require("../../../foundation/iconography/Icon.cjs");
|
|
|
4
4
|
require("../../../foundation/index.cjs");
|
|
5
5
|
const require_InputHelperText = require("../../../building-blocks/inputs/InputHelperText.cjs");
|
|
6
6
|
require("../../../building-blocks/index.cjs");
|
|
7
|
+
const require_iconButtonOverlay_css = require("../shared-styles/iconButtonOverlay.css.cjs");
|
|
7
8
|
const require_inputFieldConstants_css = require("../shared-styles/inputFieldConstants.css.cjs");
|
|
8
9
|
const require_inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
9
|
-
const require_shared = require("../shared.cjs");
|
|
10
10
|
const require_labelStyles_css = require("../shared-styles/labelStyles.css.cjs");
|
|
11
|
-
const require_iconButtonOverlay_css = require("../shared-styles/iconButtonOverlay.css.cjs");
|
|
12
11
|
const require_suffixPrefix_css = require("../shared-styles/suffixPrefix.css.cjs");
|
|
12
|
+
const require_shared = require("../shared.cjs");
|
|
13
13
|
const require_textArea_css = require("./textArea.css.cjs");
|
|
14
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
15
15
|
let _gnist_themes_atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
@@ -3,12 +3,12 @@ import { Icon } from "../../../foundation/iconography/Icon.js";
|
|
|
3
3
|
import "../../../foundation/index.js";
|
|
4
4
|
import { InputHelperText } from "../../../building-blocks/inputs/InputHelperText.js";
|
|
5
5
|
import "../../../building-blocks/index.js";
|
|
6
|
+
import { iconButtonOverlayRecipe } from "../shared-styles/iconButtonOverlay.css.js";
|
|
6
7
|
import { postInputWidth, preInputWidth, visibleLines } from "../shared-styles/inputFieldConstants.css.js";
|
|
7
8
|
import { inputContentWrapper, inputFieldStyle, inputFieldWrapperRecipe, wrapperStyle } from "../shared-styles/inputField.css.js";
|
|
8
|
-
import { getInputFieldProps, isClickableIcon, useInputFieldLogic } from "../shared.js";
|
|
9
9
|
import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
10
|
-
import { iconButtonOverlayRecipe } from "../shared-styles/iconButtonOverlay.css.js";
|
|
11
10
|
import { prefixStyle, suffixStyle } from "../shared-styles/suffixPrefix.css.js";
|
|
11
|
+
import { getInputFieldProps, isClickableIcon, useInputFieldLogic } from "../shared.js";
|
|
12
12
|
import { wordCounterStyle } from "./textArea.css.js";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
@@ -4,12 +4,12 @@ const require_Icon = require("../../../foundation/iconography/Icon.cjs");
|
|
|
4
4
|
require("../../../foundation/iconography/index.cjs");
|
|
5
5
|
const require_InputHelperText = require("../../../building-blocks/inputs/InputHelperText.cjs");
|
|
6
6
|
require("../../../building-blocks/index.cjs");
|
|
7
|
+
const require_iconButtonOverlay_css = require("../shared-styles/iconButtonOverlay.css.cjs");
|
|
7
8
|
const require_inputFieldConstants_css = require("../shared-styles/inputFieldConstants.css.cjs");
|
|
8
9
|
const require_inputField_css = require("../shared-styles/inputField.css.cjs");
|
|
9
|
-
const require_shared = require("../shared.cjs");
|
|
10
10
|
const require_labelStyles_css = require("../shared-styles/labelStyles.css.cjs");
|
|
11
|
-
const require_iconButtonOverlay_css = require("../shared-styles/iconButtonOverlay.css.cjs");
|
|
12
11
|
const require_suffixPrefix_css = require("../shared-styles/suffixPrefix.css.cjs");
|
|
12
|
+
const require_shared = require("../shared.cjs");
|
|
13
13
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
14
|
let _gnist_themes_atoms_css_js = require("@gnist/themes/atoms.css.js");
|
|
15
15
|
let _vanilla_extract_dynamic = require("@vanilla-extract/dynamic");
|
|
@@ -3,12 +3,12 @@ import { Icon } from "../../../foundation/iconography/Icon.js";
|
|
|
3
3
|
import "../../../foundation/iconography/index.js";
|
|
4
4
|
import { InputHelperText } from "../../../building-blocks/inputs/InputHelperText.js";
|
|
5
5
|
import "../../../building-blocks/index.js";
|
|
6
|
+
import { iconButtonOverlayRecipe } from "../shared-styles/iconButtonOverlay.css.js";
|
|
6
7
|
import { postInputWidth, preInputWidth } from "../shared-styles/inputFieldConstants.css.js";
|
|
7
8
|
import { inputContentWrapper, inputFieldStyle, inputFieldWrapperRecipe, wrapperStyle } from "../shared-styles/inputField.css.js";
|
|
8
|
-
import { getInputFieldProps, isClickableIcon, useInputFieldLogic } from "../shared.js";
|
|
9
9
|
import { labelStyle } from "../shared-styles/labelStyles.css.js";
|
|
10
|
-
import { iconButtonOverlayRecipe } from "../shared-styles/iconButtonOverlay.css.js";
|
|
11
10
|
import { prefixStyle, suffixStyle } from "../shared-styles/suffixPrefix.css.js";
|
|
11
|
+
import { getInputFieldProps, isClickableIcon, useInputFieldLogic } from "../shared.js";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { atoms } from "@gnist/themes/atoms.css.js";
|
|
14
14
|
import { assignInlineVars } from "@vanilla-extract/dynamic";
|