optimized-react-component-library-xyz123 0.1.16 → 0.1.18
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/index.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +72 -47
- package/dist/index.mjs +73 -48
- package/package.json +14 -11
package/dist/index.d.mts
CHANGED
|
@@ -299,10 +299,14 @@ interface ValidationErrorSummaryListProps {
|
|
|
299
299
|
declare const ValidationErrorSummaryList: React.FC<ValidationErrorSummaryListProps>;
|
|
300
300
|
|
|
301
301
|
interface CookieBannerProps {
|
|
302
|
-
isTouched
|
|
302
|
+
isTouched?: any;
|
|
303
|
+
onCookieStateChange?: () => void;
|
|
303
304
|
visible?: boolean;
|
|
305
|
+
onClose?: () => void;
|
|
306
|
+
acceptCookies: () => void;
|
|
307
|
+
rejectCookies: () => void;
|
|
304
308
|
}
|
|
305
309
|
|
|
306
|
-
declare const CookieBanner: FC<CookieBannerProps>;
|
|
310
|
+
declare const CookieBanner: React.FC<CookieBannerProps>;
|
|
307
311
|
|
|
308
312
|
export { CookieBanner, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList };
|
package/dist/index.d.ts
CHANGED
|
@@ -299,10 +299,14 @@ interface ValidationErrorSummaryListProps {
|
|
|
299
299
|
declare const ValidationErrorSummaryList: React.FC<ValidationErrorSummaryListProps>;
|
|
300
300
|
|
|
301
301
|
interface CookieBannerProps {
|
|
302
|
-
isTouched
|
|
302
|
+
isTouched?: any;
|
|
303
|
+
onCookieStateChange?: () => void;
|
|
303
304
|
visible?: boolean;
|
|
305
|
+
onClose?: () => void;
|
|
306
|
+
acceptCookies: () => void;
|
|
307
|
+
rejectCookies: () => void;
|
|
304
308
|
}
|
|
305
309
|
|
|
306
|
-
declare const CookieBanner: FC<CookieBannerProps>;
|
|
310
|
+
declare const CookieBanner: React.FC<CookieBannerProps>;
|
|
307
311
|
|
|
308
312
|
export { CookieBanner, CreateApiDataObject, doCategoriesAndQuestionsVisible as DoCategoriesAndQuestionsVisible, EditPreviewLink as EditPreviewLinkStandard, FilesUpload as FilesUploadStandard, Footer as FooterStandard, groupQuestionByStepPreviewPage as GroupQuestionByStepPreviewPage, groupQuestionsByStepCategoryGroup as GroupQuestionsByStepCategoryGroup, Header as HeaderStandard, type IApplicationContent, type IFormState, type ILanguage, type ILanguageSupport, ILanguageSupportinitialState, type IOption, type IPTSLink, type IQuestion, type IQuestionExtraAttribute, type IStepObject, type IStepQuestionData, type ITextBlock, InfoOnly as InfoOnlyStandard, isDependsOnOtherQuestionTrue as IsDependsOnOtherQuestionTrue, Modal as ModalStandard, MultipleCheckboxes as MultipleCheckboxesStandard, PrincipleOfPublicity as PrincipleOfPublicityStandard, questionHasValidationError as QuestionHasValidationError, QuestioninitialState, InputRadio as RadioMultipleStandard, RenderQuestion, RenderQuestionGroup, ServiceHeadlineAndBody as ServiceHeadlineAndBodyStandard, SkipLink as SkipLinkStandard, StepperButtons as StepperButtonsStandard, Stepper as StepperStandard, InputTextarea as TextAreaStandard, TextFieldStandard, TextHeadlineAndBody as TextHeadlineAndBodyStandard, validationCheckAllVisibleQuestions as ValidationCheckAllVisibleQuestion, ValidationErrorSummaryList };
|
package/dist/index.js
CHANGED
|
@@ -1789,34 +1789,43 @@ var Modal = ({ showModal: isOpen, activatedLanguage = "" }) => {
|
|
|
1789
1789
|
var ModalStandard_default = Modal;
|
|
1790
1790
|
|
|
1791
1791
|
// src/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1792
|
+
var import_react5 = require("react");
|
|
1792
1793
|
var import_dompurify5 = __toESM(require("dompurify"));
|
|
1793
1794
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1794
1795
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
1795
|
-
const HeadlineTag = headlineType;
|
|
1796
1796
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "pts-textHeadlineAndBody-container", children: [
|
|
1797
|
-
data.headline &&
|
|
1797
|
+
data.headline && (0, import_react5.createElement)(headlineType, {}, data.headline),
|
|
1798
1798
|
data.body && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { dangerouslySetInnerHTML: { __html: import_dompurify5.default.sanitize(data.body) } }),
|
|
1799
|
-
data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1810
|
-
"path",
|
|
1799
|
+
data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1800
|
+
"a",
|
|
1801
|
+
{
|
|
1802
|
+
href: link.url,
|
|
1803
|
+
target: "_blank",
|
|
1804
|
+
rel: "noopener noreferrer",
|
|
1805
|
+
"aria-label": link.ariaLabel,
|
|
1806
|
+
children: [
|
|
1807
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "MoreInfoIcon", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1808
|
+
"svg",
|
|
1811
1809
|
{
|
|
1812
|
-
|
|
1813
|
-
|
|
1810
|
+
"aria-hidden": "true",
|
|
1811
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1812
|
+
width: "12",
|
|
1813
|
+
height: "10",
|
|
1814
|
+
viewBox: "0 0 12 10",
|
|
1815
|
+
fill: "none",
|
|
1816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1817
|
+
"path",
|
|
1818
|
+
{
|
|
1819
|
+
d: "M6.00001 9.63253L5.10321 8.82184L8.62749 5.57905H0.965332V4.42091H8.62749L5.10321 1.17813L6.00001 0.367432L11.0347 4.99998L6.00001 9.63253Z",
|
|
1820
|
+
fill: "#ffffff"
|
|
1821
|
+
}
|
|
1822
|
+
)
|
|
1814
1823
|
}
|
|
1815
|
-
)
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1824
|
+
) }),
|
|
1825
|
+
link.title
|
|
1826
|
+
]
|
|
1827
|
+
}
|
|
1828
|
+
) }, `more-info-${index}`)) })
|
|
1820
1829
|
] });
|
|
1821
1830
|
};
|
|
1822
1831
|
var TextHeadlineAndBodyStandard_default = TextHeadlineAndBody;
|
|
@@ -1952,14 +1961,14 @@ var StepperButtons = ({
|
|
|
1952
1961
|
var StepperButtonsStandard_default = StepperButtons;
|
|
1953
1962
|
|
|
1954
1963
|
// src/NewTextComponentStandard/StepperStandard/StepperStandard.tsx
|
|
1955
|
-
var
|
|
1964
|
+
var import_react6 = __toESM(require("react"));
|
|
1956
1965
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1957
1966
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
1958
1967
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
1959
1968
|
const isActive = step.step === activeStep;
|
|
1960
1969
|
const lastElement = arraySteps.length;
|
|
1961
1970
|
const isDone = step.step < activeStep;
|
|
1962
|
-
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
1971
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_react6.default.Fragment, { children: [
|
|
1963
1972
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "pts-stepper-step", children: [
|
|
1964
1973
|
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1965
1974
|
"div",
|
|
@@ -2050,12 +2059,43 @@ var ValidationErrorSummaryList = ({
|
|
|
2050
2059
|
var ValidationErrorSummaryList_default = ValidationErrorSummaryList;
|
|
2051
2060
|
|
|
2052
2061
|
// src/NewTextComponentStandard/CookieBanner/CookieBanner.tsx
|
|
2062
|
+
var import_react7 = require("react");
|
|
2053
2063
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2054
|
-
var CookieBanner = ({
|
|
2055
|
-
|
|
2064
|
+
var CookieBanner = ({
|
|
2065
|
+
visible = false,
|
|
2066
|
+
onCookieStateChange,
|
|
2067
|
+
onClose,
|
|
2068
|
+
acceptCookies,
|
|
2069
|
+
rejectCookies
|
|
2070
|
+
}) => {
|
|
2071
|
+
(0, import_react7.useEffect)(() => {
|
|
2072
|
+
if (visible) {
|
|
2073
|
+
document.body.classList.add("has-cookie-banner");
|
|
2074
|
+
} else {
|
|
2075
|
+
document.body.classList.remove("has-cookie-banner");
|
|
2076
|
+
}
|
|
2077
|
+
return () => {
|
|
2078
|
+
document.body.classList.remove("has-cookie-banner");
|
|
2079
|
+
};
|
|
2080
|
+
}, [visible]);
|
|
2081
|
+
if (!visible) return null;
|
|
2082
|
+
const handleCookieChoice = (accepted) => {
|
|
2083
|
+
if (accepted) {
|
|
2084
|
+
acceptCookies();
|
|
2085
|
+
} else {
|
|
2086
|
+
rejectCookies();
|
|
2087
|
+
}
|
|
2088
|
+
if (onCookieStateChange) {
|
|
2089
|
+
onCookieStateChange();
|
|
2090
|
+
}
|
|
2091
|
+
if (onClose) {
|
|
2092
|
+
onClose();
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "pts-cookieBanner", role: "dialog", "aria-labelledby": "cookie-banner-title", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "content", children: [
|
|
2056
2096
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("h3", { children: "Kakor (cookies)" }),
|
|
2057
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children:
|
|
2058
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "pts-cookieBanner-
|
|
2097
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: 'PTS skulle vilja anv\xE4nda en statistikkaka i syfte att rapportera anv\xE4ndarstatistik till Europeiska kommissionen. Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt samtycke klickar du p\xE5 "Kakor" l\xE4ngst ned till v\xE4nster p\xE5 webbplatsen.' }),
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "pts-cookieBanner-Links", children: [
|
|
2059
2099
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2060
2100
|
"svg",
|
|
2061
2101
|
{
|
|
@@ -2064,6 +2104,7 @@ var CookieBanner = ({ isTouched, visible = true }) => {
|
|
|
2064
2104
|
viewBox: "0 0 27 27",
|
|
2065
2105
|
fill: "none",
|
|
2066
2106
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2107
|
+
"aria-hidden": "true",
|
|
2067
2108
|
children: [
|
|
2068
2109
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("rect", { width: "27", height: "27", rx: "13.5", fill: "#6E3282" }),
|
|
2069
2110
|
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
@@ -2076,27 +2117,11 @@ var CookieBanner = ({ isTouched, visible = true }) => {
|
|
|
2076
2117
|
]
|
|
2077
2118
|
}
|
|
2078
2119
|
),
|
|
2079
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: "www.pts.se", target: "
|
|
2120
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("a", { href: "www.pts.se", target: "_blank", rel: "noopener noreferrer", children: "Kakor (cookies) p\xE5 pts.se" })
|
|
2080
2121
|
] }),
|
|
2081
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "pts-cookieBanner-
|
|
2082
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2083
|
-
|
|
2084
|
-
{
|
|
2085
|
-
onClick: () => {
|
|
2086
|
-
isTouched(true);
|
|
2087
|
-
},
|
|
2088
|
-
children: "Ja, jag samtycker"
|
|
2089
|
-
}
|
|
2090
|
-
),
|
|
2091
|
-
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2092
|
-
"button",
|
|
2093
|
-
{
|
|
2094
|
-
onClick: () => {
|
|
2095
|
-
isTouched(false);
|
|
2096
|
-
},
|
|
2097
|
-
children: "Nej, jag samtycker inte"
|
|
2098
|
-
}
|
|
2099
|
-
)
|
|
2122
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "pts-cookieBanner-Buttons", children: [
|
|
2123
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { onClick: () => handleCookieChoice(true), children: "Ja, jag samtycker" }),
|
|
2124
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("button", { onClick: () => handleCookieChoice(false), children: "Nej, jag samtycker inte" })
|
|
2100
2125
|
] })
|
|
2101
2126
|
] }) });
|
|
2102
2127
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1725,34 +1725,43 @@ var Modal = ({ showModal: isOpen, activatedLanguage = "" }) => {
|
|
|
1725
1725
|
var ModalStandard_default = Modal;
|
|
1726
1726
|
|
|
1727
1727
|
// src/NewTextComponentStandard/TextHeadlineAndBodyStandard/TextHeadlineAndBodyStandard.tsx
|
|
1728
|
+
import { createElement } from "react";
|
|
1728
1729
|
import DOMPurify5 from "dompurify";
|
|
1729
1730
|
import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1730
1731
|
var TextHeadlineAndBody = ({ data, headlineType = "h2" }) => {
|
|
1731
|
-
const HeadlineTag = headlineType;
|
|
1732
1732
|
return /* @__PURE__ */ jsxs14("section", { className: "pts-textHeadlineAndBody-container", children: [
|
|
1733
|
-
data.headline &&
|
|
1733
|
+
data.headline && createElement(headlineType, {}, data.headline),
|
|
1734
1734
|
data.body && /* @__PURE__ */ jsx14("div", { dangerouslySetInnerHTML: { __html: DOMPurify5.sanitize(data.body) } }),
|
|
1735
|
-
data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ jsx14("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ jsxs14(
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
children: /* @__PURE__ */ jsx14(
|
|
1746
|
-
"path",
|
|
1735
|
+
data.linksForMoreInfo && data.linksForMoreInfo.length > 0 && /* @__PURE__ */ jsx14("ul", { className: "pts-moreinfo-list", children: data.linksForMoreInfo.map((link, index) => /* @__PURE__ */ jsx14("li", { className: index > 0 ? "notFirstInList" : "", children: /* @__PURE__ */ jsxs14(
|
|
1736
|
+
"a",
|
|
1737
|
+
{
|
|
1738
|
+
href: link.url,
|
|
1739
|
+
target: "_blank",
|
|
1740
|
+
rel: "noopener noreferrer",
|
|
1741
|
+
"aria-label": link.ariaLabel,
|
|
1742
|
+
children: [
|
|
1743
|
+
/* @__PURE__ */ jsx14("span", { className: "MoreInfoIcon", children: /* @__PURE__ */ jsx14(
|
|
1744
|
+
"svg",
|
|
1747
1745
|
{
|
|
1748
|
-
|
|
1749
|
-
|
|
1746
|
+
"aria-hidden": "true",
|
|
1747
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1748
|
+
width: "12",
|
|
1749
|
+
height: "10",
|
|
1750
|
+
viewBox: "0 0 12 10",
|
|
1751
|
+
fill: "none",
|
|
1752
|
+
children: /* @__PURE__ */ jsx14(
|
|
1753
|
+
"path",
|
|
1754
|
+
{
|
|
1755
|
+
d: "M6.00001 9.63253L5.10321 8.82184L8.62749 5.57905H0.965332V4.42091H8.62749L5.10321 1.17813L6.00001 0.367432L11.0347 4.99998L6.00001 9.63253Z",
|
|
1756
|
+
fill: "#ffffff"
|
|
1757
|
+
}
|
|
1758
|
+
)
|
|
1750
1759
|
}
|
|
1751
|
-
)
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1760
|
+
) }),
|
|
1761
|
+
link.title
|
|
1762
|
+
]
|
|
1763
|
+
}
|
|
1764
|
+
) }, `more-info-${index}`)) })
|
|
1756
1765
|
] });
|
|
1757
1766
|
};
|
|
1758
1767
|
var TextHeadlineAndBodyStandard_default = TextHeadlineAndBody;
|
|
@@ -1888,14 +1897,14 @@ var StepperButtons = ({
|
|
|
1888
1897
|
var StepperButtonsStandard_default = StepperButtons;
|
|
1889
1898
|
|
|
1890
1899
|
// src/NewTextComponentStandard/StepperStandard/StepperStandard.tsx
|
|
1891
|
-
import
|
|
1900
|
+
import React5 from "react";
|
|
1892
1901
|
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1893
1902
|
var Stepper = ({ arraySteps = [], activeStep = 1 }) => {
|
|
1894
1903
|
return /* @__PURE__ */ jsx19("div", { className: "pts-stepper-container", "aria-hidden": "true", children: arraySteps.map((step, index) => {
|
|
1895
1904
|
const isActive = step.step === activeStep;
|
|
1896
1905
|
const lastElement = arraySteps.length;
|
|
1897
1906
|
const isDone = step.step < activeStep;
|
|
1898
|
-
return /* @__PURE__ */ jsxs17(
|
|
1907
|
+
return /* @__PURE__ */ jsxs17(React5.Fragment, { children: [
|
|
1899
1908
|
/* @__PURE__ */ jsxs17("div", { className: "pts-stepper-step", children: [
|
|
1900
1909
|
/* @__PURE__ */ jsx19(
|
|
1901
1910
|
"div",
|
|
@@ -1986,12 +1995,43 @@ var ValidationErrorSummaryList = ({
|
|
|
1986
1995
|
var ValidationErrorSummaryList_default = ValidationErrorSummaryList;
|
|
1987
1996
|
|
|
1988
1997
|
// src/NewTextComponentStandard/CookieBanner/CookieBanner.tsx
|
|
1989
|
-
import {
|
|
1990
|
-
|
|
1991
|
-
|
|
1998
|
+
import { useEffect as useEffect4 } from "react";
|
|
1999
|
+
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2000
|
+
var CookieBanner = ({
|
|
2001
|
+
visible = false,
|
|
2002
|
+
onCookieStateChange,
|
|
2003
|
+
onClose,
|
|
2004
|
+
acceptCookies,
|
|
2005
|
+
rejectCookies
|
|
2006
|
+
}) => {
|
|
2007
|
+
useEffect4(() => {
|
|
2008
|
+
if (visible) {
|
|
2009
|
+
document.body.classList.add("has-cookie-banner");
|
|
2010
|
+
} else {
|
|
2011
|
+
document.body.classList.remove("has-cookie-banner");
|
|
2012
|
+
}
|
|
2013
|
+
return () => {
|
|
2014
|
+
document.body.classList.remove("has-cookie-banner");
|
|
2015
|
+
};
|
|
2016
|
+
}, [visible]);
|
|
2017
|
+
if (!visible) return null;
|
|
2018
|
+
const handleCookieChoice = (accepted) => {
|
|
2019
|
+
if (accepted) {
|
|
2020
|
+
acceptCookies();
|
|
2021
|
+
} else {
|
|
2022
|
+
rejectCookies();
|
|
2023
|
+
}
|
|
2024
|
+
if (onCookieStateChange) {
|
|
2025
|
+
onCookieStateChange();
|
|
2026
|
+
}
|
|
2027
|
+
if (onClose) {
|
|
2028
|
+
onClose();
|
|
2029
|
+
}
|
|
2030
|
+
};
|
|
2031
|
+
return /* @__PURE__ */ jsx21("div", { className: "pts-cookieBanner", role: "dialog", "aria-labelledby": "cookie-banner-title", children: /* @__PURE__ */ jsxs19("div", { className: "content", children: [
|
|
1992
2032
|
/* @__PURE__ */ jsx21("h3", { children: "Kakor (cookies)" }),
|
|
1993
|
-
/* @__PURE__ */ jsx21("p", { children:
|
|
1994
|
-
/* @__PURE__ */ jsxs19("div", { className: "pts-cookieBanner-
|
|
2033
|
+
/* @__PURE__ */ jsx21("p", { children: 'PTS skulle vilja anv\xE4nda en statistikkaka i syfte att rapportera anv\xE4ndarstatistik till Europeiska kommissionen. Samtycker du till det? Du kan n\xE4r som helst \xE4ndra ditt val. F\xF6r att \xE5terkalla ditt samtycke klickar du p\xE5 "Kakor" l\xE4ngst ned till v\xE4nster p\xE5 webbplatsen.' }),
|
|
2034
|
+
/* @__PURE__ */ jsxs19("div", { className: "pts-cookieBanner-Links", children: [
|
|
1995
2035
|
/* @__PURE__ */ jsxs19(
|
|
1996
2036
|
"svg",
|
|
1997
2037
|
{
|
|
@@ -2000,6 +2040,7 @@ var CookieBanner = ({ isTouched, visible = true }) => {
|
|
|
2000
2040
|
viewBox: "0 0 27 27",
|
|
2001
2041
|
fill: "none",
|
|
2002
2042
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2043
|
+
"aria-hidden": "true",
|
|
2003
2044
|
children: [
|
|
2004
2045
|
/* @__PURE__ */ jsx21("rect", { width: "27", height: "27", rx: "13.5", fill: "#6E3282" }),
|
|
2005
2046
|
/* @__PURE__ */ jsx21(
|
|
@@ -2012,27 +2053,11 @@ var CookieBanner = ({ isTouched, visible = true }) => {
|
|
|
2012
2053
|
]
|
|
2013
2054
|
}
|
|
2014
2055
|
),
|
|
2015
|
-
/* @__PURE__ */ jsx21("a", { href: "www.pts.se", target: "
|
|
2056
|
+
/* @__PURE__ */ jsx21("a", { href: "www.pts.se", target: "_blank", rel: "noopener noreferrer", children: "Kakor (cookies) p\xE5 pts.se" })
|
|
2016
2057
|
] }),
|
|
2017
|
-
/* @__PURE__ */ jsxs19("div", { className: "pts-cookieBanner-
|
|
2018
|
-
/* @__PURE__ */ jsx21(
|
|
2019
|
-
|
|
2020
|
-
{
|
|
2021
|
-
onClick: () => {
|
|
2022
|
-
isTouched(true);
|
|
2023
|
-
},
|
|
2024
|
-
children: "Ja, jag samtycker"
|
|
2025
|
-
}
|
|
2026
|
-
),
|
|
2027
|
-
/* @__PURE__ */ jsx21(
|
|
2028
|
-
"button",
|
|
2029
|
-
{
|
|
2030
|
-
onClick: () => {
|
|
2031
|
-
isTouched(false);
|
|
2032
|
-
},
|
|
2033
|
-
children: "Nej, jag samtycker inte"
|
|
2034
|
-
}
|
|
2035
|
-
)
|
|
2058
|
+
/* @__PURE__ */ jsxs19("div", { className: "pts-cookieBanner-Buttons", children: [
|
|
2059
|
+
/* @__PURE__ */ jsx21("button", { onClick: () => handleCookieChoice(true), children: "Ja, jag samtycker" }),
|
|
2060
|
+
/* @__PURE__ */ jsx21("button", { onClick: () => handleCookieChoice(false), children: "Nej, jag samtycker inte" })
|
|
2036
2061
|
] })
|
|
2037
2062
|
] }) });
|
|
2038
2063
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "optimized-react-component-library-xyz123",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "A modern React component library using TypeScript.",
|
|
3
|
+
"version": "0.1.18",
|
|
4
|
+
"description": "A modern React component library using TypeScript with React 19 support.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -30,37 +30,40 @@
|
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/YOUR_USERNAME/optimized-react-component-library-xyz123.git"
|
|
33
|
+
"url": "git+https://github.com/YOUR_USERNAME/optimized-react-component-library-xyz123-ch-react19.git"
|
|
34
34
|
},
|
|
35
35
|
"keywords": [
|
|
36
36
|
"react",
|
|
37
|
+
"react19",
|
|
37
38
|
"component-library",
|
|
38
39
|
"typescript",
|
|
39
40
|
"npm",
|
|
41
|
+
"modern-react",
|
|
40
42
|
"boilerplate"
|
|
41
43
|
],
|
|
42
44
|
"author": "YOUR NAME",
|
|
43
45
|
"license": "MIT",
|
|
44
46
|
"peerDependencies": {
|
|
45
|
-
"react": "
|
|
46
|
-
"react-dom": "
|
|
47
|
+
"react": "^19.2.0",
|
|
48
|
+
"react-dom": "^19.2.0"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
51
|
"@testing-library/jest-dom": "^6.8.0",
|
|
50
52
|
"@testing-library/react": "^16.3.0",
|
|
51
53
|
"@types/dompurify": "^3.0.5",
|
|
52
|
-
"@types/react": "^
|
|
53
|
-
"@types/react-dom": "^
|
|
54
|
-
"eslint": "^
|
|
54
|
+
"@types/react": "^19.2.2",
|
|
55
|
+
"@types/react-dom": "^19.2.1",
|
|
56
|
+
"eslint": "^9.0.0",
|
|
55
57
|
"eslint-config-prettier": "^9.0.0",
|
|
56
|
-
"eslint-plugin-react": "^7.
|
|
58
|
+
"eslint-plugin-react": "^7.35.0",
|
|
59
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
57
60
|
"husky": "^9.0.0",
|
|
58
61
|
"jsdom": "^26.1.0",
|
|
59
62
|
"prettier": "^3.0.0",
|
|
60
63
|
"standard-version": "^9.5.0",
|
|
61
64
|
"tsup": "^8.0.0",
|
|
62
|
-
"typescript": "^5.
|
|
63
|
-
"vitest": "^
|
|
65
|
+
"typescript": "^5.6.0",
|
|
66
|
+
"vitest": "^2.0.0"
|
|
64
67
|
},
|
|
65
68
|
"dependencies": {
|
|
66
69
|
"clsx": "^2.1.1",
|