@okta/odyssey-react-mui 1.13.2 → 1.13.4
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 +8 -0
- package/dist/Checkbox.js +1 -1
- package/dist/Checkbox.js.map +1 -1
- package/dist/i18n.js.map +1 -1
- package/dist/labs/Switch.js +5 -1
- package/dist/labs/Switch.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui.js +2 -0
- package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/src/Checkbox.d.ts +1 -1
- package/dist/src/Checkbox.d.ts.map +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/src/i18n.d.ts +1 -1
- package/dist/src/i18n.d.ts.map +1 -1
- package/dist/src/labs/Switch.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui.d.ts +2 -0
- package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/theme/components.js +5 -0
- package/dist/theme/components.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/Checkbox.tsx +2 -2
- package/src/i18n.ts +1 -1
- package/src/labs/Switch.tsx +3 -1
- package/src/properties/odyssey-react-mui.properties +2 -0
- package/src/properties/ts/odyssey-react-mui.ts +1 -1
- package/src/theme/components.tsx +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.13.4](https://github.com/okta/odyssey/compare/v1.13.3...v1.13.4) (2024-02-12)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
9
|
+
|
|
10
|
+
## [1.13.3](https://github.com/okta/odyssey/compare/v1.13.2...v1.13.3) (2024-02-09)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @okta/odyssey-react-mui
|
|
13
|
+
|
|
6
14
|
## [1.13.2](https://github.com/okta/odyssey/compare/v1.13.1...v1.13.2) (2024-02-08)
|
|
7
15
|
|
|
8
16
|
### Bug Fixes
|
package/dist/Checkbox.js
CHANGED
|
@@ -15,8 +15,8 @@ import _FormHelperText from "@mui/material/FormHelperText";
|
|
|
15
15
|
|
|
16
16
|
import { useTranslation } from "react-i18next";
|
|
17
17
|
import { memo, useCallback, useMemo, useRef, useImperativeHandle } from "react";
|
|
18
|
-
import { Typography } from "./Typography.js";
|
|
19
18
|
import { ComponentControlledState, getControlState } from "./inputUtils.js";
|
|
19
|
+
import { Typography } from "./Typography.js";
|
|
20
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
21
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
package/dist/Checkbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","names":["useTranslation","memo","useCallback","useMemo","useRef","useImperativeHandle","
|
|
1
|
+
{"version":3,"file":"Checkbox.js","names":["useTranslation","memo","useCallback","useMemo","useRef","useImperativeHandle","ComponentControlledState","getControlState","Typography","jsxs","_jsxs","Fragment","_Fragment","jsx","_jsx","checkboxValidityValues","Checkbox","_ref","ariaLabel","ariaLabelledBy","id","idOverride","inputRef","isChecked","isDefaultChecked","isDisabled","isIndeterminate","isRequired","label","labelProp","hint","name","nameOverride","onChange","onChangeProp","onBlur","onBlurProp","testId","translate","validity","value","t","controlledStateRef","controlledValue","uncontrolledValue","inputValues","current","CONTROLLED","checked","defaultChecked","localInputRef","focus","children","component","color","_FormHelperText","event","_FormControlLabel","sx","alignItems","className","control","_Checkbox","indeterminate","required","inputProps","marginBlockStart","disabled","MemoizedCheckbox","displayName"],"sources":["../src/Checkbox.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport { useTranslation } from \"react-i18next\";\nimport { memo, useCallback, useMemo, useRef, useImperativeHandle } from \"react\";\nimport {\n Checkbox as MuiCheckbox,\n CheckboxProps as MuiCheckboxProps,\n FormControlLabel,\n FormControlLabelProps as MuiFormControlLabelProps,\n FormHelperText,\n} from \"@mui/material\";\n\nimport { FieldComponentProps } from \"./FieldComponentProps\";\nimport { CheckedFieldProps } from \"./FormCheckedProps\";\nimport type { HtmlProps } from \"./HtmlProps\";\nimport {\n ComponentControlledState,\n FocusHandle,\n getControlState,\n} from \"./inputUtils\";\nimport { Typography } from \"./Typography\";\n\nexport const checkboxValidityValues = [\"valid\", \"invalid\", \"inherit\"] as const;\n\nexport type CheckboxProps = {\n /**\n * The ARIA label for the Checkbox\n */\n ariaLabel?: string;\n /**\n * The ID of the element that labels the Checkbox\n */\n ariaLabelledBy?: string;\n /**\n * The id of the `input` element.\n */\n id?: string;\n /**\n * The ref forwarded to the Checkbox\n */\n inputRef?: React.RefObject<FocusHandle>;\n /**\n * Determines whether the Checkbox is disabled\n */\n isDisabled?: boolean;\n /**\n * Determines whether the Checkbox is in an indeterminate state\n */\n isIndeterminate?: boolean;\n /**\n * Determines whether the Checkbox is required\n */\n isRequired?: boolean;\n /**\n * The label text for the Checkbox\n */\n label?: string;\n /**\n * The helper text content\n */\n hint?: string;\n /**\n * The checkbox validity, if different from its enclosing group. Defaults to \"inherit\".\n */\n validity?: (typeof checkboxValidityValues)[number];\n /**\n * The value attribute of the Checkbox\n */\n value?: string;\n /**\n * Callback fired when the blur event happens. Provides event value.\n */\n onBlur?: MuiFormControlLabelProps[\"onBlur\"];\n} & Pick<FieldComponentProps, \"id\" | \"isDisabled\" | \"name\"> &\n CheckedFieldProps<MuiCheckboxProps> &\n HtmlProps;\n\nconst Checkbox = ({\n ariaLabel,\n ariaLabelledBy,\n id: idOverride,\n inputRef,\n isChecked,\n isDefaultChecked,\n isDisabled,\n isIndeterminate,\n isRequired,\n label: labelProp,\n hint,\n name: nameOverride,\n onChange: onChangeProp,\n onBlur: onBlurProp,\n testId,\n translate,\n validity = \"inherit\",\n value,\n}: CheckboxProps) => {\n const { t } = useTranslation();\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: isChecked,\n uncontrolledValue: isDefaultChecked,\n })\n );\n const inputValues = useMemo(() => {\n if (controlledStateRef.current === ComponentControlledState.CONTROLLED) {\n return { checked: isChecked };\n }\n return { defaultChecked: isDefaultChecked };\n }, [isDefaultChecked, isChecked]);\n\n const localInputRef = useRef<HTMLInputElement>(null);\n useImperativeHandle(\n inputRef,\n () => {\n return {\n focus: () => {\n localInputRef.current?.focus();\n },\n };\n },\n []\n );\n\n const label = useMemo(() => {\n return (\n <>\n {labelProp}\n {isRequired && (\n <>\n {\" \"}\n <Typography component=\"span\" color=\"textSecondary\">\n ({t(\"fieldlabel.required.text\")})\n </Typography>\n </>\n )}\n {hint && <FormHelperText translate={translate}>{hint}</FormHelperText>}\n </>\n );\n }, [isRequired, labelProp, hint, t, translate]);\n\n const onChange = useCallback<NonNullable<MuiCheckboxProps[\"onChange\"]>>(\n (event, checked) => {\n onChangeProp?.(event, checked);\n },\n [onChangeProp]\n );\n\n const onBlur = useCallback<NonNullable<MuiFormControlLabelProps[\"onBlur\"]>>(\n (event) => {\n onBlurProp?.(event);\n },\n [onBlurProp]\n );\n\n return (\n <FormControlLabel\n sx={{ alignItems: \"flex-start\" }}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n className={\n validity === \"invalid\"\n ? \"Mui-error\"\n : validity === \"valid\"\n ? \"Mui-valid\"\n : \"\"\n }\n control={\n <MuiCheckbox\n {...inputValues}\n indeterminate={isIndeterminate}\n onChange={onChange}\n required={isRequired}\n inputProps={{\n \"data-se\": testId,\n }}\n inputRef={localInputRef}\n sx={() => ({\n marginBlockStart: \"2px\",\n })}\n />\n }\n disabled={isDisabled}\n id={idOverride}\n label={label}\n name={nameOverride ?? idOverride}\n value={value}\n required={isRequired}\n onBlur={onBlur}\n translate={translate}\n />\n );\n};\n\nconst MemoizedCheckbox = memo(Checkbox);\nMemoizedCheckbox.displayName = \"Checkbox\";\n\nexport { MemoizedCheckbox as Checkbox };\n"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,eAAe;AAC9C,SAASC,IAAI,EAAEC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,mBAAmB,QAAQ,OAAO;AAAC,SAa9EC,wBAAwB,EAExBC,eAAe;AAAA,SAERC,UAAU;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEnB,OAAO,MAAMC,sBAAsB,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAU;AAuD9E,MAAMC,QAAQ,GAAGC,IAAA,IAmBI;EAAA,IAnBH;IAChBC,SAAS;IACTC,cAAc;IACdC,EAAE,EAAEC,UAAU;IACdC,QAAQ;IACRC,SAAS;IACTC,gBAAgB;IAChBC,UAAU;IACVC,eAAe;IACfC,UAAU;IACVC,KAAK,EAAEC,SAAS;IAChBC,IAAI;IACJC,IAAI,EAAEC,YAAY;IAClBC,QAAQ,EAAEC,YAAY;IACtBC,MAAM,EAAEC,UAAU;IAClBC,MAAM;IACNC,SAAS;IACTC,QAAQ,GAAG,SAAS;IACpBC;EACa,CAAC,GAAAvB,IAAA;EACd,MAAM;I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AQ"}
|
package/dist/i18n.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","names":["i18n","initReactI18next","translation","cs","da","de","el","en","es","fi","fr","hu","id","it","ja","ko","ms","nb","nlNL","okPL","okSK","pl","ptBR","ro","ru","sv","th","tr","uk","vi","zhCN","znTW","defaultLNG","defaultNS","resources","nl_NL","ok_PL","ok_SK","pt_BR","zh_CN","zh_TW","use","init","ns","fallbackLng","load","keySeparator","interpolation","escapeValue","skipOnVariables","react","useSuspense","bindI18nStore","Object","entries","forEach","_ref","locale","property","addResourceBundle","odysseyTranslate","t","bind"],"sources":["../src/i18n.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport i18n from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\n\nimport { translation as cs } from \"./properties/ts/odyssey-react-mui_cs\";\nimport { translation as da } from \"./properties/ts/odyssey-react-mui_da\";\nimport { translation as de } from \"./properties/ts/odyssey-react-mui_de\";\nimport { translation as el } from \"./properties/ts/odyssey-react-mui_el\";\nimport { translation as en } from \"./properties/ts/odyssey-react-mui\";\nimport { translation as es } from \"./properties/ts/odyssey-react-mui_es\";\nimport { translation as fi } from \"./properties/ts/odyssey-react-mui_fi\";\nimport { translation as fr } from \"./properties/ts/odyssey-react-mui_fr\";\nimport { translation as hu } from \"./properties/ts/odyssey-react-mui_hu\";\nimport { translation as id } from \"./properties/ts/odyssey-react-mui_id\";\nimport { translation as it } from \"./properties/ts/odyssey-react-mui_it\";\nimport { translation as ja } from \"./properties/ts/odyssey-react-mui_ja\";\nimport { translation as ko } from \"./properties/ts/odyssey-react-mui_ko\";\nimport { translation as ms } from \"./properties/ts/odyssey-react-mui_ms\";\nimport { translation as nb } from \"./properties/ts/odyssey-react-mui_nb\";\nimport { translation as nlNL } from \"./properties/ts/odyssey-react-mui_nl_NL\";\nimport { translation as okPL } from \"./properties/ts/odyssey-react-mui_ok_PL\";\nimport { translation as okSK } from \"./properties/ts/odyssey-react-mui_ok_SK\";\nimport { translation as pl } from \"./properties/ts/odyssey-react-mui_pl\";\nimport { translation as ptBR } from \"./properties/ts/odyssey-react-mui_pt_BR\";\nimport { translation as ro } from \"./properties/ts/odyssey-react-mui_ro\";\nimport { translation as ru } from \"./properties/ts/odyssey-react-mui_ru\";\nimport { translation as sv } from \"./properties/ts/odyssey-react-mui_sv\";\nimport { translation as th } from \"./properties/ts/odyssey-react-mui_th\";\nimport { translation as tr } from \"./properties/ts/odyssey-react-mui_tr\";\nimport { translation as uk } from \"./properties/ts/odyssey-react-mui_uk\";\nimport { translation as vi } from \"./properties/ts/odyssey-react-mui_vi\";\nimport { translation as zhCN } from \"./properties/ts/odyssey-react-mui_zh_CN\";\nimport { translation as znTW } from \"./properties/ts/odyssey-react-mui_zh_TW\";\n\nexport const defaultLNG = \"en\";\nexport const defaultNS = \"translations\";\n\n// Note: This is type \"string\" to allow translation overrides from other languages\nexport type I18nResources = Record<string, typeof en
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["i18n","initReactI18next","translation","cs","da","de","el","en","es","fi","fr","hu","id","it","ja","ko","ms","nb","nlNL","okPL","okSK","pl","ptBR","ro","ru","sv","th","tr","uk","vi","zhCN","znTW","defaultLNG","defaultNS","resources","nl_NL","ok_PL","ok_SK","pt_BR","zh_CN","zh_TW","use","init","ns","fallbackLng","load","keySeparator","interpolation","escapeValue","skipOnVariables","react","useSuspense","bindI18nStore","Object","entries","forEach","_ref","locale","property","addResourceBundle","odysseyTranslate","t","bind"],"sources":["../src/i18n.ts"],"sourcesContent":["/*!\n * Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport i18n from \"i18next\";\nimport { initReactI18next } from \"react-i18next\";\n\nimport { translation as cs } from \"./properties/ts/odyssey-react-mui_cs\";\nimport { translation as da } from \"./properties/ts/odyssey-react-mui_da\";\nimport { translation as de } from \"./properties/ts/odyssey-react-mui_de\";\nimport { translation as el } from \"./properties/ts/odyssey-react-mui_el\";\nimport { translation as en } from \"./properties/ts/odyssey-react-mui\";\nimport { translation as es } from \"./properties/ts/odyssey-react-mui_es\";\nimport { translation as fi } from \"./properties/ts/odyssey-react-mui_fi\";\nimport { translation as fr } from \"./properties/ts/odyssey-react-mui_fr\";\nimport { translation as hu } from \"./properties/ts/odyssey-react-mui_hu\";\nimport { translation as id } from \"./properties/ts/odyssey-react-mui_id\";\nimport { translation as it } from \"./properties/ts/odyssey-react-mui_it\";\nimport { translation as ja } from \"./properties/ts/odyssey-react-mui_ja\";\nimport { translation as ko } from \"./properties/ts/odyssey-react-mui_ko\";\nimport { translation as ms } from \"./properties/ts/odyssey-react-mui_ms\";\nimport { translation as nb } from \"./properties/ts/odyssey-react-mui_nb\";\nimport { translation as nlNL } from \"./properties/ts/odyssey-react-mui_nl_NL\";\nimport { translation as okPL } from \"./properties/ts/odyssey-react-mui_ok_PL\";\nimport { translation as okSK } from \"./properties/ts/odyssey-react-mui_ok_SK\";\nimport { translation as pl } from \"./properties/ts/odyssey-react-mui_pl\";\nimport { translation as ptBR } from \"./properties/ts/odyssey-react-mui_pt_BR\";\nimport { translation as ro } from \"./properties/ts/odyssey-react-mui_ro\";\nimport { translation as ru } from \"./properties/ts/odyssey-react-mui_ru\";\nimport { translation as sv } from \"./properties/ts/odyssey-react-mui_sv\";\nimport { translation as th } from \"./properties/ts/odyssey-react-mui_th\";\nimport { translation as tr } from \"./properties/ts/odyssey-react-mui_tr\";\nimport { translation as uk } from \"./properties/ts/odyssey-react-mui_uk\";\nimport { translation as vi } from \"./properties/ts/odyssey-react-mui_vi\";\nimport { translation as zhCN } from \"./properties/ts/odyssey-react-mui_zh_CN\";\nimport { translation as znTW } from \"./properties/ts/odyssey-react-mui_zh_TW\";\n\nexport const defaultLNG = \"en\";\nexport const defaultNS = \"translations\";\n\n// Note: This is type \"string\" to allow translation overrides from other languages\nexport type I18nResources = Record<string, Partial<typeof en>>;\nexport const resources: I18nResources = {\n cs,\n da,\n de,\n el,\n en,\n es,\n fi,\n fr,\n hu,\n id,\n it,\n ja,\n ko,\n ms,\n nb,\n nl_NL: nlNL,\n ok_PL: okPL,\n ok_SK: okSK,\n pl,\n pt_BR: ptBR,\n ro,\n ru,\n sv,\n th,\n tr,\n uk,\n vi,\n zh_CN: zhCN,\n zh_TW: znTW,\n};\n\ni18n.use(initReactI18next).init({\n defaultNS,\n ns: [defaultNS],\n fallbackLng: defaultLNG,\n load: \"currentOnly\",\n keySeparator: false,\n interpolation: {\n escapeValue: false, // react already safe from xss\n skipOnVariables: false, // to handle translations that use nesting\n },\n react: {\n useSuspense: false,\n bindI18nStore: \"added\",\n },\n});\n\nObject.entries(resources).forEach(([locale, property]) => {\n i18n.addResourceBundle(locale, defaultNS, property);\n});\n\nexport const odysseyTranslate = i18n.t.bind(i18n);\nexport { i18n };\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,SAAS;AAC1B,SAASC,gBAAgB,QAAQ,eAAe;AAAC,SAExCC,WAAW,IAAIC,EAAE;AAAA,SACjBD,WAAW,IAAIE,EAAE;AAAA,SACjBF,W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AAEjB,IAAI;EACXkB,KAAK,EAAEjB,IAAI;EACXC,EAAE;EACFiB,KAAK,EAAEhB,IAAI;EACXC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFC,EAAE;EACFU,KAAK,EAAET,IAAI;EACXU,KAAK,EAAET;AACT,CAAC;AAED/B,IAAI,CAACyC,GAAG,CAACxC,gBAAgB,CAAC,CAACyC,IAAI,CAAC;EAC9BT,SAAS;EACTU,EAAE,EAAE,CAACV,SAAS,CAAC;EACfW,WAAW,EAAEZ,UAAU;EACvBa,IAAI,EAAE,aAAa;EACnBC,YAAY,EAAE,KAAK;EACnBC,aAAa,EAAE;IACbC,WAAW,EAAE,KAAK;IAClBC,eAAe,EAAE;EACnB,CAAC;EACDC,KAAK,EAAE;IACLC,WAAW,EAAE,KAAK;IAClBC,aAAa,EAAE;EACjB;AACF,CAAC,CAAC;AAEFC,MAAM,CAACC,OAAO,CAACpB,SAAS,CAAC,CAACqB,OAAO,CAACC,IAAA,IAAwB;EAAA,IAAvB,CAACC,MAAM,EAAEC,QAAQ,CAAC,GAAAF,IAAA;EACnDxD,IAAI,CAAC2D,iBAAiB,CAACF,MAAM,EAAExB,SAAS,EAAEyB,QAAQ,CAAC;AACrD,CAAC,CAAC;AAEF,OAAO,MAAME,gBAAgB,GAAG5D,IAAI,CAAC6D,CAAC,CAACC,IAAI,CAAC9D,IAAI,CAAC;AACjD,SAASA,IAAI"}
|
package/dist/labs/Switch.js
CHANGED
|
@@ -13,6 +13,7 @@ import _Switch from "@mui/material/Switch";
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
16
|
+
import { useTranslation } from "react-i18next";
|
|
16
17
|
import { useOdysseyDesignTokens } from "../OdysseyDesignTokensContext.js";
|
|
17
18
|
import { Box } from "../Box.js";
|
|
18
19
|
import { FieldHint } from "../FieldHint.js";
|
|
@@ -33,6 +34,9 @@ const SwitchLabel = _ref => {
|
|
|
33
34
|
label
|
|
34
35
|
} = _ref;
|
|
35
36
|
const odysseyDesignTokens = useOdysseyDesignTokens();
|
|
37
|
+
const {
|
|
38
|
+
t
|
|
39
|
+
} = useTranslation();
|
|
36
40
|
return _jsxs(_Fragment, {
|
|
37
41
|
children: [_jsxs(Box, {
|
|
38
42
|
sx: {
|
|
@@ -56,7 +60,7 @@ const SwitchLabel = _ref => {
|
|
|
56
60
|
transitionProperty: "background-color, color",
|
|
57
61
|
transitionDuration: odysseyDesignTokens.TransitionDurationMain
|
|
58
62
|
},
|
|
59
|
-
children: checked ? "
|
|
63
|
+
children: checked ? t("switch.active") : t("switch.inactive")
|
|
60
64
|
})]
|
|
61
65
|
}), hint && _jsx(FieldHint, {
|
|
62
66
|
id: hintId,
|
package/dist/labs/Switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","useOdysseyDesignTokens","Box","FieldHint","useUniqueId","ComponentControlledState","getControlState","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CONTROLLED","SwitchLabel","_ref","checked","hint","hintId","isFullWidth","label","odysseyDesignTokens","children","sx","display","alignItems","flexWrap","gap","Spacing1","margin","maxWidth","TypographyLineLengthMax","fontWeight","TypographyWeightBodyBold","padding","backgroundColor","PaletteSuccessLighter","HueNeutral100","borderRadius","BorderRadiusMain","color","PaletteSuccessText","HueNeutral700","fontSize","TypographyScale0","lineHeight","TypographyLineHeightOverline","transitionProperty","transitionDuration","TransitionDurationMain","id","text","Switch","_ref2","_id","isChecked","isDefaultChecked","isDisabled","name","_name","onChange","testId","value","controlledStateRef","controlledValue","uncontrolledValue","inputValues","current","defaultChecked","internalSwitchChecked","setInternalSwitchChecked","Boolean","undefined","labelElementId","handleOnChange","_","renderSwitchComponent","_Switch","disabled","disableRipple","inputProps","marginBlockEnd","Spacing2","_FormControlLabel","control","labelPlacement","justifyContent","Spacing4","width","MemoizedSwitch","displayName"],"sources":["../../src/labs/Switch.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n memo,\n SyntheticEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n Switch as MuiSwitch,\n SwitchProps as MuiSwitchProps,\n FormControlLabel,\n} from \"@mui/material\";\n\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext\";\nimport { Box } from \"../Box\";\nimport { FieldComponentProps } from \"../FieldComponentProps\";\nimport { FieldHint } from \"../FieldHint\";\nimport type { HtmlProps } from \"../HtmlProps\";\nimport { useUniqueId } from \"../useUniqueId\";\nimport { ComponentControlledState, getControlState } from \"../inputUtils\";\nimport { CheckedFieldProps } from \"../FormCheckedProps\";\n\nconst { CONTROLLED } = ComponentControlledState;\n\ntype OnChangeCallbackArguments = {\n checked: boolean;\n value: string;\n};\n\nexport type SwitchProps = {\n /**\n * if `true`, the label and switch span entire containing element's width\n */\n isFullWidth?: boolean;\n /**\n * The label text for the Switch\n */\n label: string;\n /**\n * The change event handler for the Switch\n */\n onChange?: ({ checked, value }: OnChangeCallbackArguments) => void;\n /**\n * The value attribute of the Switch\n */\n value: string;\n} & Pick<\n FieldComponentProps,\n \"hint\" | \"id\" | \"isFullWidth\" | \"isDisabled\" | \"name\"\n> &\n CheckedFieldProps<MuiSwitchProps> &\n HtmlProps;\n\ntype SwitchLabelProps = {\n checked: boolean;\n hint: SwitchProps[\"hint\"];\n hintId?: string;\n isFullWidth: SwitchProps[\"isFullWidth\"];\n label: SwitchProps[\"label\"];\n};\n\nconst SwitchLabel = ({\n checked,\n hint,\n hintId,\n isFullWidth,\n label,\n}: SwitchLabelProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n\n return (\n <>\n <Box\n sx={{\n display: \"flex\",\n alignItems: \"center\",\n flexWrap: \"wrap\",\n gap: odysseyDesignTokens.Spacing1,\n margin: 0,\n maxWidth: isFullWidth\n ? \"100%\"\n : odysseyDesignTokens.TypographyLineLengthMax,\n fontWeight: odysseyDesignTokens.TypographyWeightBodyBold,\n }}\n >\n {label}\n <Box\n sx={{\n padding: \"2px 4px\",\n backgroundColor: checked\n ? odysseyDesignTokens.PaletteSuccessLighter\n : odysseyDesignTokens.HueNeutral100,\n borderRadius: odysseyDesignTokens.BorderRadiusMain,\n color: checked\n ? odysseyDesignTokens.PaletteSuccessText\n : odysseyDesignTokens.HueNeutral700,\n fontWeight: odysseyDesignTokens.TypographyWeightBodyBold,\n fontSize: odysseyDesignTokens.TypographyScale0,\n lineHeight: odysseyDesignTokens.TypographyLineHeightOverline,\n transitionProperty: \"background-color, color\",\n transitionDuration: odysseyDesignTokens.TransitionDurationMain,\n }}\n >\n {checked ? \"Active\" : \"Inactive\"}\n </Box>\n </Box>\n {hint && <FieldHint id={hintId} text={hint} />}\n </>\n );\n};\n\nconst Switch = ({\n hint,\n id: _id,\n isChecked,\n isDefaultChecked,\n isDisabled,\n isFullWidth = false,\n label,\n name: _name,\n onChange,\n testId,\n value = \"Something\",\n}: SwitchProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: isChecked,\n uncontrolledValue: isDefaultChecked,\n })\n );\n const inputValues = useMemo(() => {\n if (controlledStateRef.current === CONTROLLED) {\n return { checked: isChecked };\n }\n return { defaultChecked: isDefaultChecked };\n }, [isDefaultChecked, isChecked]);\n\n const [internalSwitchChecked, setInternalSwitchChecked] = useState(\n controlledStateRef.current === CONTROLLED\n ? Boolean(isChecked)\n : Boolean(isDefaultChecked)\n );\n\n useEffect(() => {\n if (controlledStateRef.current === CONTROLLED) {\n setInternalSwitchChecked(Boolean(isChecked));\n }\n }, [isChecked]);\n\n const id = useUniqueId(_id);\n\n const hintId = hint ? `${id}-hint` : undefined;\n const labelElementId = `${id}-label`;\n\n const handleOnChange = useCallback(\n (_: SyntheticEvent<Element, Event>, checked: boolean) => {\n setInternalSwitchChecked(checked);\n onChange?.({ checked, value });\n },\n [onChange, setInternalSwitchChecked, value]\n );\n\n const renderSwitchComponent = useMemo(\n () => (\n <MuiSwitch\n {...inputValues}\n disabled={isDisabled}\n disableRipple\n inputProps={{\n \"aria-checked\": internalSwitchChecked,\n \"aria-describedby\": hintId,\n \"aria-label\": label,\n \"aria-labelledby\": labelElementId,\n \"data-se\": testId,\n }}\n name={_name ?? id}\n onChange={handleOnChange}\n />\n ),\n [\n handleOnChange,\n hintId,\n inputValues,\n internalSwitchChecked,\n id,\n isDisabled,\n label,\n labelElementId,\n _name,\n testId,\n ]\n );\n\n return (\n <Box\n sx={{\n marginBlockEnd: odysseyDesignTokens.Spacing2,\n }}\n >\n <FormControlLabel\n checked={internalSwitchChecked}\n control={renderSwitchComponent}\n disabled={isDisabled}\n id={labelElementId}\n label={\n <SwitchLabel\n checked={internalSwitchChecked}\n hint={hint}\n hintId={hintId}\n isFullWidth={isFullWidth}\n label={label}\n />\n }\n labelPlacement=\"start\"\n sx={{\n justifyContent: \"space-between\",\n alignItems: \"flex-start\",\n gap: odysseyDesignTokens.Spacing4,\n width: \"100%\",\n maxWidth: isFullWidth\n ? \"100%\"\n : odysseyDesignTokens.TypographyLineLengthMax,\n }}\n value={value}\n />\n </Box>\n );\n};\n\nconst MemoizedSwitch = memo(Switch);\nMemoizedSwitch.displayName = \"Switch\";\n\nexport { MemoizedSwitch as Switch };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,IAAI,EA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AC6D;IACtC,CAAE;IAAA5D,QAAA,EAEFd,IAAA,CAAA2E,iBAAA;MACEnE,OAAO,EAAEqD,qBAAsB;MAC/Be,OAAO,EAAER,qBAAsB;MAC/BE,QAAQ,EAAErB,UAAW;MACrBP,EAAE,EAAEuB,cAAe;MACnBrD,KAAK,EACHZ,IAAA,CAACM,WAAW;QACVE,OAAO,EAAEqD,qBAAsB;QAC/BpD,IAAI,EAAEA,IAAK;QACXC,MAAM,EAAEA,MAAO;QACfC,WAAW,EAAEA,WAAY;QACzBC,KAAK,EAAEA;MAAM,CACd,CACF;MACDiE,cAAc,EAAC,OAAO;MACtB9D,EAAE,EAAE;QACF+D,cAAc,EAAE,eAAe;QAC/B7D,UAAU,EAAE,YAAY;QACxBE,GAAG,EAAEN,mBAAmB,CAACkE,QAAQ;QACjCC,KAAK,EAAE,MAAM;QACb1D,QAAQ,EAAEX,WAAW,GACjB,MAAM,GACNE,mBAAmB,CAACU;MAC1B,CAAE;MACF+B,KAAK,EAAEA;IAAM,CACd;EAAC,CACC,CAAC;AAEV,CAAC;AAED,MAAM2B,cAAc,GAAG9F,IAAI,CAACyD,MAAM,CAAC;AACnCqC,cAAc,CAACC,WAAW,GAAG,QAAQ;AAErC,SAASD,cAAc,IAAIrC,MAAM"}
|
|
1
|
+
{"version":3,"file":"Switch.js","names":["memo","useCallback","useEffect","useMemo","useRef","useState","useTranslation","useOdysseyDesignTokens","Box","FieldHint","useUniqueId","ComponentControlledState","getControlState","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","CONTROLLED","SwitchLabel","_ref","checked","hint","hintId","isFullWidth","label","odysseyDesignTokens","t","children","sx","display","alignItems","flexWrap","gap","Spacing1","margin","maxWidth","TypographyLineLengthMax","fontWeight","TypographyWeightBodyBold","padding","backgroundColor","PaletteSuccessLighter","HueNeutral100","borderRadius","BorderRadiusMain","color","PaletteSuccessText","HueNeutral700","fontSize","TypographyScale0","lineHeight","TypographyLineHeightOverline","transitionProperty","transitionDuration","TransitionDurationMain","id","text","Switch","_ref2","_id","isChecked","isDefaultChecked","isDisabled","name","_name","onChange","testId","value","controlledStateRef","controlledValue","uncontrolledValue","inputValues","current","defaultChecked","internalSwitchChecked","setInternalSwitchChecked","Boolean","undefined","labelElementId","handleOnChange","_","renderSwitchComponent","_Switch","disabled","disableRipple","inputProps","marginBlockEnd","Spacing2","_FormControlLabel","control","labelPlacement","justifyContent","Spacing4","width","MemoizedSwitch","displayName"],"sources":["../../src/labs/Switch.tsx"],"sourcesContent":["/*!\n * Copyright (c) 2022-present, Okta, Inc. and/or its affiliates. All rights reserved.\n * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the \"License.\")\n *\n * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *\n * See the License for the specific language governing permissions and limitations under the License.\n */\n\nimport {\n memo,\n SyntheticEvent,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n Switch as MuiSwitch,\n SwitchProps as MuiSwitchProps,\n FormControlLabel,\n} from \"@mui/material\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { useOdysseyDesignTokens } from \"../OdysseyDesignTokensContext\";\nimport { Box } from \"../Box\";\nimport { FieldComponentProps } from \"../FieldComponentProps\";\nimport { FieldHint } from \"../FieldHint\";\nimport type { HtmlProps } from \"../HtmlProps\";\nimport { useUniqueId } from \"../useUniqueId\";\nimport { ComponentControlledState, getControlState } from \"../inputUtils\";\nimport { CheckedFieldProps } from \"../FormCheckedProps\";\n\nconst { CONTROLLED } = ComponentControlledState;\n\ntype OnChangeCallbackArguments = {\n checked: boolean;\n value: string;\n};\n\nexport type SwitchProps = {\n /**\n * if `true`, the label and switch span entire containing element's width\n */\n isFullWidth?: boolean;\n /**\n * The label text for the Switch\n */\n label: string;\n /**\n * The change event handler for the Switch\n */\n onChange?: ({ checked, value }: OnChangeCallbackArguments) => void;\n /**\n * The value attribute of the Switch\n */\n value: string;\n} & Pick<\n FieldComponentProps,\n \"hint\" | \"id\" | \"isFullWidth\" | \"isDisabled\" | \"name\"\n> &\n CheckedFieldProps<MuiSwitchProps> &\n HtmlProps;\n\ntype SwitchLabelProps = {\n checked: boolean;\n hint: SwitchProps[\"hint\"];\n hintId?: string;\n isFullWidth: SwitchProps[\"isFullWidth\"];\n label: SwitchProps[\"label\"];\n};\n\nconst SwitchLabel = ({\n checked,\n hint,\n hintId,\n isFullWidth,\n label,\n}: SwitchLabelProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const { t } = useTranslation();\n\n return (\n <>\n <Box\n sx={{\n display: \"flex\",\n alignItems: \"center\",\n flexWrap: \"wrap\",\n gap: odysseyDesignTokens.Spacing1,\n margin: 0,\n maxWidth: isFullWidth\n ? \"100%\"\n : odysseyDesignTokens.TypographyLineLengthMax,\n fontWeight: odysseyDesignTokens.TypographyWeightBodyBold,\n }}\n >\n {label}\n <Box\n sx={{\n padding: \"2px 4px\",\n backgroundColor: checked\n ? odysseyDesignTokens.PaletteSuccessLighter\n : odysseyDesignTokens.HueNeutral100,\n borderRadius: odysseyDesignTokens.BorderRadiusMain,\n color: checked\n ? odysseyDesignTokens.PaletteSuccessText\n : odysseyDesignTokens.HueNeutral700,\n fontWeight: odysseyDesignTokens.TypographyWeightBodyBold,\n fontSize: odysseyDesignTokens.TypographyScale0,\n lineHeight: odysseyDesignTokens.TypographyLineHeightOverline,\n transitionProperty: \"background-color, color\",\n transitionDuration: odysseyDesignTokens.TransitionDurationMain,\n }}\n >\n {checked ? t(\"switch.active\") : t(\"switch.inactive\")}\n </Box>\n </Box>\n {hint && <FieldHint id={hintId} text={hint} />}\n </>\n );\n};\n\nconst Switch = ({\n hint,\n id: _id,\n isChecked,\n isDefaultChecked,\n isDisabled,\n isFullWidth = false,\n label,\n name: _name,\n onChange,\n testId,\n value = \"Something\",\n}: SwitchProps) => {\n const odysseyDesignTokens = useOdysseyDesignTokens();\n const controlledStateRef = useRef(\n getControlState({\n controlledValue: isChecked,\n uncontrolledValue: isDefaultChecked,\n })\n );\n const inputValues = useMemo(() => {\n if (controlledStateRef.current === CONTROLLED) {\n return { checked: isChecked };\n }\n return { defaultChecked: isDefaultChecked };\n }, [isDefaultChecked, isChecked]);\n\n const [internalSwitchChecked, setInternalSwitchChecked] = useState(\n controlledStateRef.current === CONTROLLED\n ? Boolean(isChecked)\n : Boolean(isDefaultChecked)\n );\n\n useEffect(() => {\n if (controlledStateRef.current === CONTROLLED) {\n setInternalSwitchChecked(Boolean(isChecked));\n }\n }, [isChecked]);\n\n const id = useUniqueId(_id);\n\n const hintId = hint ? `${id}-hint` : undefined;\n const labelElementId = `${id}-label`;\n\n const handleOnChange = useCallback(\n (_: SyntheticEvent<Element, Event>, checked: boolean) => {\n setInternalSwitchChecked(checked);\n onChange?.({ checked, value });\n },\n [onChange, setInternalSwitchChecked, value]\n );\n\n const renderSwitchComponent = useMemo(\n () => (\n <MuiSwitch\n {...inputValues}\n disabled={isDisabled}\n disableRipple\n inputProps={{\n \"aria-checked\": internalSwitchChecked,\n \"aria-describedby\": hintId,\n \"aria-label\": label,\n \"aria-labelledby\": labelElementId,\n \"data-se\": testId,\n }}\n name={_name ?? id}\n onChange={handleOnChange}\n />\n ),\n [\n handleOnChange,\n hintId,\n inputValues,\n internalSwitchChecked,\n id,\n isDisabled,\n label,\n labelElementId,\n _name,\n testId,\n ]\n );\n\n return (\n <Box\n sx={{\n marginBlockEnd: odysseyDesignTokens.Spacing2,\n }}\n >\n <FormControlLabel\n checked={internalSwitchChecked}\n control={renderSwitchComponent}\n disabled={isDisabled}\n id={labelElementId}\n label={\n <SwitchLabel\n checked={internalSwitchChecked}\n hint={hint}\n hintId={hintId}\n isFullWidth={isFullWidth}\n label={label}\n />\n }\n labelPlacement=\"start\"\n sx={{\n justifyContent: \"space-between\",\n alignItems: \"flex-start\",\n gap: odysseyDesignTokens.Spacing4,\n width: \"100%\",\n maxWidth: isFullWidth\n ? \"100%\"\n : odysseyDesignTokens.TypographyLineLengthMax,\n }}\n value={value}\n />\n </Box>\n );\n};\n\nconst MemoizedSwitch = memo(Switch);\nMemoizedSwitch.displayName = \"Switch\";\n\nexport { MemoizedSwitch as Switch };\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SACEA,IAAI,EAEJC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAMd,SAASC,cAAc,QAAQ,eAAe;AAAC,SAEtCC,sBAAsB;AAAA,SACtBC,GAAG;AAAA,SAEHC,SAAS;AAAA,SAETC,WAAW;AAAA,SACXC,wBAAwB,EAAEC,eAAe;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAGlD,MAAM;EAAEC;AAAW,CAAC,GAAGR,wBAAwB;AAuC/C,MAAMS,WAAW,GAAGC,IAAA,IAMI;EAAA,IANH;IACnBC,OAAO;IACPC,IAAI;IACJC,MAAM;IACNC,WAAW;IACXC;EACgB,CAAC,GAAAL,IAAA;EACjB,MAAMM,mBAAmB,GAAGpB,sBAAsB,CAAC,CAAC;EACpD,MAAM;IAAEqB;EAAE,CAAC,GAAGtB,cAAc,CAAC,CAAC;EAE9B,OACEU,KAAA,CAAAE,SAAA;IAAAW,QAAA,GACEb,KAAA,CAACR,GAAG;MACFsB,EAAE,EAAE;QACFC,OAAO,EAAE,MAAM;QACfC,UAAU,EAAE,QAAQ;QACpBC,QAAQ,EAAE,MAAM;QAChBC,GAAG,EAAEP,mBAAmB,CAACQ,QAAQ;QACjCC,MAAM,EAAE,CAAC;QACTC,QAAQ,EAAEZ,WAAW,GACjB,MAAM,GACNE,mBAAmB,CAACW,uBAAuB;QAC/CC,UAAU,EAAEZ,mBAA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
|
@@ -11,6 +11,8 @@ export const translation = {
|
|
|
11
11
|
"severity.info": "info",
|
|
12
12
|
"severity.success": "success",
|
|
13
13
|
"severity.warning": "warning",
|
|
14
|
+
"switch.active": "Active",
|
|
15
|
+
"switch.inactive": "Inactive",
|
|
14
16
|
"table.error": "Error loading data.",
|
|
15
17
|
"table.fetchedrows.text": "Fetched {{totalRows}} row",
|
|
16
18
|
"table.fetchedrows.text_plural": "Fetched {{totalRows}} total rows",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odyssey-react-mui.js","names":["translation"],"sources":["../../../src/properties/ts/odyssey-react-mui.ts"],"sourcesContent":["export const translation = {\"breadcrumbs.home.text\":\"Home\",\"breadcrumbs.label.text\":\"Breadcrumbs\",\"close.text\":\"close\",\"fielderror.screenreader.text\":\"Error\",\"fieldlabel.optional.text\":\"Optional\",\"fieldlabel.required.text\":\"Required\",\"passwordfield.icon.label.show\":\"Show password\",\"passwordfield.icon.label.hide\":\"Hide password\",\"severity.error\":\"error\",\"severity.info\":\"info\",\"severity.success\":\"success\",\"severity.warning\":\"warning\",\"table.error\":\"Error loading data.\",\"table.fetchedrows.text\":\"Fetched {{totalRows}} row\",\"table.fetchedrows.text_plural\":\"Fetched {{totalRows}} total rows\",\"table.rows.text\":\"{{totalRows}} row\",\"table.rows.text_plural\":\"{{totalRows}} rows\"};"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG;EAAC,uBAAuB,EAAC,MAAM;EAAC,wBAAwB,EAAC,aAAa;EAAC,YAAY,EAAC,OAAO;EAAC,8BAA8B,EAAC,OAAO;EAAC,0BAA0B,EAAC,UAAU;EAAC,0BAA0B,EAAC,UAAU;EAAC,+BAA+B,EAAC,eAAe;EAAC,+BAA+B,EAAC,eAAe;EAAC,gBAAgB,EAAC,OAAO;EAAC,eAAe,EAAC,MAAM;EAAC,kBAAkB,EAAC,SAAS;EAAC,kBAAkB,EAAC,SAAS;EAAC,aAAa,EAAC,qBAAqB;EAAC,wBAAwB,EAAC,2BAA2B;EAAC,+BAA+B,EAAC,kCAAkC;EAAC,iBAAiB,EAAC,mBAAmB;EAAC,wBAAwB,EAAC;AAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"odyssey-react-mui.js","names":["translation"],"sources":["../../../src/properties/ts/odyssey-react-mui.ts"],"sourcesContent":["export const translation = {\"breadcrumbs.home.text\":\"Home\",\"breadcrumbs.label.text\":\"Breadcrumbs\",\"close.text\":\"close\",\"fielderror.screenreader.text\":\"Error\",\"fieldlabel.optional.text\":\"Optional\",\"fieldlabel.required.text\":\"Required\",\"passwordfield.icon.label.show\":\"Show password\",\"passwordfield.icon.label.hide\":\"Hide password\",\"severity.error\":\"error\",\"severity.info\":\"info\",\"severity.success\":\"success\",\"severity.warning\":\"warning\",\"switch.active\":\"Active\",\"switch.inactive\":\"Inactive\",\"table.error\":\"Error loading data.\",\"table.fetchedrows.text\":\"Fetched {{totalRows}} row\",\"table.fetchedrows.text_plural\":\"Fetched {{totalRows}} total rows\",\"table.rows.text\":\"{{totalRows}} row\",\"table.rows.text_plural\":\"{{totalRows}} rows\"};"],"mappings":"AAAA,OAAO,MAAMA,WAAW,GAAG;EAAC,uBAAuB,EAAC,MAAM;EAAC,wBAAwB,EAAC,aAAa;EAAC,YAAY,EAAC,OAAO;EAAC,8BAA8B,EAAC,OAAO;EAAC,0BAA0B,EAAC,UAAU;EAAC,0BAA0B,EAAC,UAAU;EAAC,+BAA+B,EAAC,eAAe;EAAC,+BAA+B,EAAC,eAAe;EAAC,gBAAgB,EAAC,OAAO;EAAC,eAAe,EAAC,MAAM;EAAC,kBAAkB,EAAC,SAAS;EAAC,kBAAkB,EAAC,SAAS;EAAC,eAAe,EAAC,QAAQ;EAAC,iBAAiB,EAAC,UAAU;EAAC,aAAa,EAAC,qBAAqB;EAAC,wBAAwB,EAAC,2BAA2B;EAAC,+BAA+B,EAAC,kCAAkC;EAAC,iBAAiB,EAAC,mBAAmB;EAAC,wBAAwB,EAAC;AAAoB,CAAC"}
|
package/dist/src/Checkbox.d.ts
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
/// <reference types="react" />
|
|
13
13
|
import { CheckboxProps as MuiCheckboxProps, FormControlLabelProps as MuiFormControlLabelProps } from "@mui/material";
|
|
14
14
|
import { FieldComponentProps } from "./FieldComponentProps";
|
|
15
|
+
import { CheckedFieldProps } from "./FormCheckedProps";
|
|
15
16
|
import type { HtmlProps } from "./HtmlProps";
|
|
16
17
|
import { FocusHandle } from "./inputUtils";
|
|
17
|
-
import { CheckedFieldProps } from "./FormCheckedProps";
|
|
18
18
|
export declare const checkboxValidityValues: readonly ["valid", "invalid", "inherit"];
|
|
19
19
|
export type CheckboxProps = {
|
|
20
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAIH,OAAO,EAEL,aAAa,IAAI,gBAAgB,EAEjC,qBAAqB,IAAI,wBAAwB,EAElD,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../src/Checkbox.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAIH,OAAO,EAEL,aAAa,IAAI,gBAAgB,EAEjC,qBAAqB,IAAI,wBAAwB,EAElD,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAEL,WAAW,EAEZ,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,sBAAsB,0CAA2C,CAAC;AAE/E,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;IACnD;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;CAC7C,GAAG,IAAI,CAAC,mBAAmB,EAAE,IAAI,GAAG,YAAY,GAAG,MAAM,CAAC,GACzD,iBAAiB,CAAC,gBAAgB,CAAC,GACnC,SAAS,CAAC;AAuHZ,QAAA,MAAM,gBAAgB,mSAlGnB,aAAa,iBAkGuB,CAAC;AAGxC,OAAO,EAAE,gBAAgB,IAAI,QAAQ,EAAE,CAAC"}
|
|
@@ -13,7 +13,7 @@ import { ReactNode } from "react";
|
|
|
13
13
|
import { DefaultSupportedLanguages } from "./OdysseyTranslationProvider.types";
|
|
14
14
|
import { resources } from "./i18n";
|
|
15
15
|
export type OdysseyI18nResourceKeys = (typeof resources)["en"];
|
|
16
|
-
export declare const odysseyI18nResourceKeysList: ("breadcrumbs.home.text" | "breadcrumbs.label.text" | "close.text" | "fielderror.screenreader.text" | "fieldlabel.optional.text" | "fieldlabel.required.text" | "passwordfield.icon.label.show" | "passwordfield.icon.label.hide" | "severity.error" | "severity.info" | "severity.success" | "severity.warning" | "table.error" | "table.fetchedrows.text" | "table.fetchedrows.text_plural" | "table.rows.text" | "table.rows.text_plural")[];
|
|
16
|
+
export declare const odysseyI18nResourceKeysList: ("breadcrumbs.home.text" | "breadcrumbs.label.text" | "close.text" | "fielderror.screenreader.text" | "fieldlabel.optional.text" | "fieldlabel.required.text" | "passwordfield.icon.label.show" | "passwordfield.icon.label.hide" | "severity.error" | "severity.info" | "severity.success" | "severity.warning" | "switch.active" | "switch.inactive" | "table.error" | "table.fetchedrows.text" | "table.fetchedrows.text_plural" | "table.rows.text" | "table.rows.text_plural")[];
|
|
17
17
|
export type TranslationOverrides<SupportedLanguages extends string = DefaultSupportedLanguages> = Record<SupportedLanguages, Partial<OdysseyI18nResourceKeys>>;
|
|
18
18
|
export type OdysseyTranslationProviderProps<SupportedLanguages extends string = DefaultSupportedLanguages> = {
|
|
19
19
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OdysseyTranslationProvider.d.ts","sourceRoot":"","sources":["../../src/OdysseyTranslationProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,EAAmB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIpD,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/D,eAAO,MAAM,2BAA2B,
|
|
1
|
+
{"version":3,"file":"OdysseyTranslationProvider.d.ts","sourceRoot":"","sources":["../../src/OdysseyTranslationProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAa,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAC;AAE/E,OAAO,EAAmB,SAAS,EAAE,MAAM,QAAQ,CAAC;AAIpD,MAAM,MAAM,uBAAuB,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,IAAI,CAAC,CAAC;AAC/D,eAAO,MAAM,2BAA2B,udAAsC,CAAC;AAE/E,MAAM,MAAM,oBAAoB,CAC9B,kBAAkB,SAAS,MAAM,GAAG,yBAAyB,IAC3D,MAAM,CAAC,kBAAkB,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAcjE,MAAM,MAAM,+BAA+B,CACzC,kBAAkB,SAAS,MAAM,GAAG,yBAAyB,IAC3D;IACF,QAAQ,EAAE,SAAS,CAAC;IACpB,YAAY,CAAC,EAAE,kBAAkB,GAAG,yBAAyB,CAAC;IAC9D,oBAAoB,CAAC,EAAE,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;CACjE,CAAC;AAMF,eAAO,MAAM,0BAA0B,4JAmCtC,CAAC"}
|
package/dist/src/i18n.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import i18n from "i18next";
|
|
|
13
13
|
import { translation as en } from "./properties/ts/odyssey-react-mui";
|
|
14
14
|
export declare const defaultLNG = "en";
|
|
15
15
|
export declare const defaultNS = "translations";
|
|
16
|
-
export type I18nResources = Record<string, typeof en
|
|
16
|
+
export type I18nResources = Record<string, Partial<typeof en>>;
|
|
17
17
|
export declare const resources: I18nResources;
|
|
18
18
|
export declare const odysseyTranslate: import("i18next").TFunction<["translation", ..."translations"[]], undefined>;
|
|
19
19
|
export { i18n };
|
package/dist/src/i18n.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAO3B,OAAO,EAAE,WAAW,IAAI,EAAE,EAAE,MAAM,mCAAmC,CAAC;AA0BtE,eAAO,MAAM,UAAU,OAAO,CAAC;AAC/B,eAAO,MAAM,SAAS,iBAAiB,CAAC;AAGxC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/i18n.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,IAAI,MAAM,SAAS,CAAC;AAO3B,OAAO,EAAE,WAAW,IAAI,EAAE,EAAE,MAAM,mCAAmC,CAAC;AA0BtE,eAAO,MAAM,UAAU,OAAO,CAAC;AAC/B,eAAO,MAAM,SAAS,iBAAiB,CAAC;AAGxC,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAC/D,eAAO,MAAM,SAAS,EAAE,aA8BvB,CAAC;AAsBF,eAAO,MAAM,gBAAgB,8EAAoB,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/labs/Switch.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAWH,OAAO,EAEL,WAAW,IAAI,cAAc,EAE9B,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/labs/Switch.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAWH,OAAO,EAEL,WAAW,IAAI,cAAc,EAE9B,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,yBAAyB,KAAK,IAAI,CAAC;IACnE;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CACN,mBAAmB,EACnB,MAAM,GAAG,IAAI,GAAG,aAAa,GAAG,YAAY,GAAG,MAAM,CACtD,GACC,iBAAiB,CAAC,cAAc,CAAC,GACjC,SAAS,CAAC;AAoLZ,QAAA,MAAM,cAAc,8JA3GjB,WAAW,iBA2GqB,CAAC;AAGpC,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -11,6 +11,8 @@ export declare const translation: {
|
|
|
11
11
|
"severity.info": string;
|
|
12
12
|
"severity.success": string;
|
|
13
13
|
"severity.warning": string;
|
|
14
|
+
"switch.active": string;
|
|
15
|
+
"switch.inactive": string;
|
|
14
16
|
"table.error": string;
|
|
15
17
|
"table.fetchedrows.text": string;
|
|
16
18
|
"table.fetchedrows.text_plural": string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odyssey-react-mui.d.ts","sourceRoot":"","sources":["../../../../src/properties/ts/odyssey-react-mui.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"odyssey-react-mui.d.ts","sourceRoot":"","sources":["../../../../src/properties/ts/odyssey-react-mui.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;CAAksB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/theme/components.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,eAAO,MAAM,UAAU;mBAIN,YAAY;;MAEzB,YAAY,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../../src/theme/components.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAqC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGvC,eAAO,MAAM,UAAU;mBAIN,YAAY;;MAEzB,YAAY,CAAC,YAAY,CAgpF5B,CAAC"}
|
package/dist/theme/components.js
CHANGED
|
@@ -699,6 +699,7 @@ export const components = _ref => {
|
|
|
699
699
|
} = _ref13;
|
|
700
700
|
return {
|
|
701
701
|
width: `${odysseyTokens.TypographyLineHeightUi}em`,
|
|
702
|
+
minWidth: `${odysseyTokens.TypographyLineHeightUi}em`,
|
|
702
703
|
height: `${odysseyTokens.TypographyLineHeightUi}em`,
|
|
703
704
|
borderRadius: odysseyTokens.BorderRadiusTight,
|
|
704
705
|
borderWidth: odysseyTokens.BorderWidthMain,
|
|
@@ -1436,6 +1437,9 @@ export const components = _ref => {
|
|
|
1436
1437
|
"&.Mui-disabled": {
|
|
1437
1438
|
pointerEvents: "none"
|
|
1438
1439
|
},
|
|
1440
|
+
[`:has(> .${radioClasses.root})`]: {
|
|
1441
|
+
alignItems: "flex-start"
|
|
1442
|
+
},
|
|
1439
1443
|
[`& .${checkboxClasses.root}`]: {
|
|
1440
1444
|
marginBlockStart: 0
|
|
1441
1445
|
},
|
|
@@ -1925,6 +1929,7 @@ export const components = _ref => {
|
|
|
1925
1929
|
} = _ref26;
|
|
1926
1930
|
return {
|
|
1927
1931
|
width: `${odysseyTokens.TypographyLineHeightUi}em`,
|
|
1932
|
+
minWidth: `${odysseyTokens.TypographyLineHeightUi}em`,
|
|
1928
1933
|
height: `${odysseyTokens.TypographyLineHeightUi}em`,
|
|
1929
1934
|
borderRadius: `${odysseyTokens.TypographyLineHeightUi}em`,
|
|
1930
1935
|
borderWidth: odysseyTokens.BorderWidthMain,
|