@geotab/zenith 3.2.0-beta.0 → 3.2.0-beta.1

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.
@@ -32,7 +32,6 @@ injectString("th", "Custom", "\u0E01\u0E33\u0E2B\u0E19\u0E14\u0E40\u0E2D\u0E07")
32
32
  injectString("tr", "Custom", "\xD6zel");
33
33
  injectString("zh-Hans", "Custom", "\u5B9A\u5236");
34
34
  injectString("zh-TW", "Custom", "\u81EA\u8A02");
35
- const radioGroup_1 = require("../radioGroup/radioGroup");
36
35
  const dateInputInner_1 = require("../dateInputInner/dateInputInner");
37
36
  const react_1 = require("react");
38
37
  const useLanguage_1 = require("../utils/localization/useLanguage");
@@ -42,6 +41,7 @@ const iconChevronRight_1 = require("../icons/iconChevronRight");
42
41
  const dateRange_1 = require("../dateRange/dateRange");
43
42
  const normalizeDates_1 = require("../filtersBar/components/filtersBarPeriodPicker/normalizeDates");
44
43
  const classNames_1 = require("../commonHelpers/classNames/classNames");
44
+ const radioGroupRaw_1 = require("../radioGroupRaw/radioGroupRaw");
45
45
  exports.CUSTOM_CALENDAR_ID = "Custom";
46
46
  const DateRangeInner = ({
47
47
  id,
@@ -139,7 +139,7 @@ const DateRangeInner = ({
139
139
  const isMobileCalendar = isMobileView && showMobileCalendar;
140
140
  const memoizedRadioGroup = (0, react_1.useMemo)(() => {
141
141
  if (!isMobileView || !showMobileCalendar) {
142
- return (0, jsx_runtime_1.jsx)(radioGroup_1.RadioGroup
142
+ return (0, jsx_runtime_1.jsx)(radioGroupRaw_1.RadioGroupRaw
143
143
  // className when there is a custom property in mobile view
144
144
  , {
145
145
  // className when there is a custom property in mobile view
@@ -19,11 +19,11 @@ const dropdown_1 = require("../../dropdown/dropdown");
19
19
  const filtersHelper_1 = require("../filtersHelper");
20
20
  const filtersChip_1 = require("./filtersChip");
21
21
  const skeleton_1 = require("../../skeleton/skeleton");
22
- const radioGroup_1 = require("../../radioGroup/radioGroup");
23
22
  const useLanguage_1 = require("../../utils/localization/useLanguage");
24
23
  const skeletonList_1 = require("../../skeletonList/skeletonList");
25
24
  const groupsHelper_1 = require("../../groupsFilterRaw/groupsHelper");
26
25
  const dropdownHelper_1 = require("../../dropdownRaw/dropdownHelper");
26
+ const radioGroupRaw_1 = require("../../radioGroupRaw/radioGroupRaw");
27
27
  const FiltersSidePanelDropdown = ({ elemProps, currentState, handleStateChange }) => {
28
28
  const simpleViewLimit = 7;
29
29
  const _a = elemProps, { id, name, state: _globalState, onChange: _globalOnChange, defaultState, fetchState, dataItems, isLoading, classNamePopup } = _a, otherProps = __rest(_a, ["id", "name", "state", "onChange", "defaultState", "fetchState", "dataItems", "isLoading", "classNamePopup"]);
@@ -73,7 +73,7 @@ const FiltersSidePanelDropdown = ({ elemProps, currentState, handleStateChange }
73
73
  return (0, jsx_runtime_1.jsx)("div", { className: (0, classNames_1.classNames)(["zen-side-panel-filters__dropdown-item-chips-container"]), children: dropdownChips });
74
74
  }
75
75
  if (componentType === "radio" && dropdownDataRef.current) {
76
- const dropdownRadioGroup = (0, jsx_runtime_1.jsx)(radioGroup_1.RadioGroup, { direction: "vertical", size: "small", id: `${id}-side-panel-dropdown-radio-group`, className: "zen-side-panel-radio-group__filter-item", items: dropdownDataRef.current.map((item) => ({
76
+ const dropdownRadioGroup = (0, jsx_runtime_1.jsx)(radioGroupRaw_1.RadioGroupRaw, { direction: "vertical", size: "small", id: `${id}-side-panel-dropdown-radio-group`, className: "zen-side-panel-radio-group__filter-item", items: dropdownDataRef.current.map((item) => ({
77
77
  id: `${id}_radio-group-item_${item.id}`,
78
78
  value: item.id,
79
79
  children: (0, jsx_runtime_1.jsx)("span", { children: (0, groupsHelper_1.getGroupDescription)(item, translate) })
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FiltersBarSidePanelRadioGroup = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const radioGroup_1 = require("../../../../radioGroup/radioGroup");
6
5
  const useUniqueId_1 = require("../../../../commonHelpers/useUniqueId");
6
+ const radioGroupRaw_1 = require("../../../../radioGroupRaw/radioGroupRaw");
7
7
  const FiltersBarSidePanelRadioGroup = (props) => {
8
8
  const name = (0, useUniqueId_1.useUniqueId)();
9
- return (0, jsx_runtime_1.jsx)("div", { className: "zen-side-panel-radio-group", children: (0, jsx_runtime_1.jsx)(radioGroup_1.RadioGroup, Object.assign({}, props, { className: "zen-side-panel-radio-group__item", fullWidth: true, name: name })) });
9
+ return (0, jsx_runtime_1.jsx)("div", { className: "zen-side-panel-radio-group", children: (0, jsx_runtime_1.jsx)(radioGroupRaw_1.RadioGroupRaw, Object.assign({}, props, { className: "zen-side-panel-radio-group__item", fullWidth: true, name: name })) });
10
10
  };
11
11
  exports.FiltersBarSidePanelRadioGroup = FiltersBarSidePanelRadioGroup;
@@ -34,12 +34,24 @@ const useReadonly_1 = require("./hooks/useReadonly");
34
34
  const formFieldWithLabel_1 = require("./components/formFieldWithLabel");
35
35
  const formFieldWithoutLabel_1 = require("./components/formFieldWithoutLabel");
36
36
  const trailingComponent_1 = require("./components/trailingComponent");
37
+ const formSectionProvider_1 = require("../formSection/utils/formSectionProvider");
38
+ const OLD_FORM_FIELD_COMPONENTS = [
39
+ "SearchInputRaw",
40
+ "SelectRaw",
41
+ "StepperRaw",
42
+ "TextAreaInput",
43
+ "TextInputRaw"
44
+ ];
45
+ const isOldFormFieldComponent = (component) =>
46
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
47
+ OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.displayName) || "") || OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.name) || "");
37
48
  // eslint-disable-next-line @typescript-eslint/naming-convention
38
49
  const FormField = function FormFieldInner(WrappedComponent) {
39
50
  // eslint-disable-next-line complexity
40
51
  const InnerFormField = (props) => {
41
52
  const isMobile = (0, useMobile_1.useMobile)();
42
53
  const ref = props.ref;
54
+ const { isFormSection } = (0, react_1.useContext)(formSectionProvider_1.FormSectionContext);
43
55
  const { id: assistiveId, assistive } = (0, useAssistive_1.useAssistive)(props);
44
56
  const { id: trailingId, trailing } = (0, useTrailing_1.useTrailing)(props);
45
57
  const { id: errorId, error, errorBanner } = (0, useError_1.useError)(props);
@@ -74,6 +86,8 @@ const FormField = function FormFieldInner(WrappedComponent) {
74
86
  isMobile ? "zen-form-field--mobile" : "",
75
87
  banner ? "zen-form-field--with-banner" : "",
76
88
  !props.label ? "" : props.labelAlign ? `zen-form-field--label-${props.labelAlign}` : "zen-form-field--label-left",
89
+ !isOldFormFieldComponent(WrappedComponent) ? "zen-form-field--new-component" : "",
90
+ isFormSection ? "zen-form-field--form-item" : "",
77
91
  className || ""
78
92
  ]);
79
93
  if (isLoading) {
package/dist/index.css CHANGED
@@ -5792,6 +5792,9 @@
5792
5792
  .zen-form-field * {
5793
5793
  box-sizing: border-box;
5794
5794
  }
5795
+ .zen-form-field--new-component {
5796
+ display: inline-flex;
5797
+ }
5795
5798
  .zen-form-field--with-banner {
5796
5799
  gap: 8px;
5797
5800
  }
@@ -5816,12 +5819,12 @@
5816
5819
  .zen-form-field__input-container--with-trailing {
5817
5820
  gap: 8px;
5818
5821
  }
5819
- .zen-form-field__input-container .zen-radio {
5820
- padding: 0 16px 12px 0;
5821
- }
5822
5822
  .zen-form-field__input-container--review {
5823
5823
  grid-template-columns: max-content max-content;
5824
5824
  }
5825
+ .zen-form-field.zen-form-field--form-item .zen-radio {
5826
+ padding: 0 16px 12px 0;
5827
+ }
5825
5828
  .zen-form-field__trailing-text {
5826
5829
  display: flex;
5827
5830
  align-items: center;
@@ -1,6 +1,5 @@
1
1
  import { injectString } from "../utils/localization/translationsDictionary";
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
- import { RadioGroup } from "../radioGroup/radioGroup";
4
3
  import { DateInputInner } from "../dateInputInner/dateInputInner";
5
4
  import { useCallback, useContext, useMemo } from "react";
6
5
  import { useLanguage } from "../utils/localization/useLanguage";
@@ -10,6 +9,7 @@ import { IconChevronRight } from "../icons/iconChevronRight";
10
9
  import { parseLabel } from "../dateRange/dateRange";
11
10
  import { normalizeDates } from "../filtersBar/components/filtersBarPeriodPicker/normalizeDates";
12
11
  import { classNames } from "../commonHelpers/classNames/classNames";
12
+ import { RadioGroupRaw } from "../radioGroupRaw/radioGroupRaw";
13
13
  injectString("cs", "Custom", "Vlastn\xED");
14
14
  injectString("da-DK", "Custom", "Brugerdefineret");
15
15
  injectString("de", "Custom", "Individuell");
@@ -131,7 +131,7 @@ export const DateRangeInner = ({
131
131
  const isMobileCalendar = isMobileView && showMobileCalendar;
132
132
  const memoizedRadioGroup = useMemo(() => {
133
133
  if (!isMobileView || !showMobileCalendar) {
134
- return _jsx(RadioGroup
134
+ return _jsx(RadioGroupRaw
135
135
  // className when there is a custom property in mobile view
136
136
  , {
137
137
  // className when there is a custom property in mobile view
@@ -16,11 +16,11 @@ import { Dropdown } from "../../dropdown/dropdown";
16
16
  import { getDropdownStateType, prepareDefaultDropdownState } from "../filtersHelper";
17
17
  import { FiltersChip } from "./filtersChip";
18
18
  import { Skeleton } from "../../skeleton/skeleton";
19
- import { RadioGroup } from "../../radioGroup/radioGroup";
20
19
  import { useLanguage } from "../../utils/localization/useLanguage";
21
20
  import { SkeletonList } from "../../skeletonList/skeletonList";
22
21
  import { getGroupDescription } from "../../groupsFilterRaw/groupsHelper";
23
22
  import { sortDropdownItemArray } from "../../dropdownRaw/dropdownHelper";
23
+ import { RadioGroupRaw } from "../../radioGroupRaw/radioGroupRaw";
24
24
  export const FiltersSidePanelDropdown = ({ elemProps, currentState, handleStateChange }) => {
25
25
  const simpleViewLimit = 7;
26
26
  const _a = elemProps, { id, name, state: _globalState, onChange: _globalOnChange, defaultState, fetchState, dataItems, isLoading, classNamePopup } = _a, otherProps = __rest(_a, ["id", "name", "state", "onChange", "defaultState", "fetchState", "dataItems", "isLoading", "classNamePopup"]);
@@ -70,7 +70,7 @@ export const FiltersSidePanelDropdown = ({ elemProps, currentState, handleStateC
70
70
  return _jsx("div", { className: classNames(["zen-side-panel-filters__dropdown-item-chips-container"]), children: dropdownChips });
71
71
  }
72
72
  if (componentType === "radio" && dropdownDataRef.current) {
73
- const dropdownRadioGroup = _jsx(RadioGroup, { direction: "vertical", size: "small", id: `${id}-side-panel-dropdown-radio-group`, className: "zen-side-panel-radio-group__filter-item", items: dropdownDataRef.current.map((item) => ({
73
+ const dropdownRadioGroup = _jsx(RadioGroupRaw, { direction: "vertical", size: "small", id: `${id}-side-panel-dropdown-radio-group`, className: "zen-side-panel-radio-group__filter-item", items: dropdownDataRef.current.map((item) => ({
74
74
  id: `${id}_radio-group-item_${item.id}`,
75
75
  value: item.id,
76
76
  children: _jsx("span", { children: getGroupDescription(item, translate) })
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { RadioGroup } from "../../../../radioGroup/radioGroup";
3
2
  import { useUniqueId } from "../../../../commonHelpers/useUniqueId";
3
+ import { RadioGroupRaw } from "../../../../radioGroupRaw/radioGroupRaw";
4
4
  export const FiltersBarSidePanelRadioGroup = (props) => {
5
5
  const name = useUniqueId();
6
- return _jsx("div", { className: "zen-side-panel-radio-group", children: _jsx(RadioGroup, Object.assign({}, props, { className: "zen-side-panel-radio-group__item", fullWidth: true, name: name })) });
6
+ return _jsx("div", { className: "zen-side-panel-radio-group", children: _jsx(RadioGroupRaw, Object.assign({}, props, { className: "zen-side-panel-radio-group__item", fullWidth: true, name: name })) });
7
7
  };
@@ -10,7 +10,7 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
- import { useId, useMemo } from "react";
13
+ import { useId, useMemo, useContext } from "react";
14
14
  import { classNames } from "../commonHelpers/classNames/classNames";
15
15
  import { useDriveClassName } from "../utils/theme/useDriveClassName";
16
16
  import { FormFieldError } from "../formFieldError/formFieldError";
@@ -31,12 +31,24 @@ import { useReadonly } from "./hooks/useReadonly";
31
31
  import { FormFieldWithLabel } from "./components/formFieldWithLabel";
32
32
  import { FormFieldWithoutLabel } from "./components/formFieldWithoutLabel";
33
33
  import { TrailingComponent } from "./components/trailingComponent";
34
+ import { FormSectionContext } from "../formSection/utils/formSectionProvider";
35
+ const OLD_FORM_FIELD_COMPONENTS = [
36
+ "SearchInputRaw",
37
+ "SelectRaw",
38
+ "StepperRaw",
39
+ "TextAreaInput",
40
+ "TextInputRaw"
41
+ ];
42
+ const isOldFormFieldComponent = (component) =>
43
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
44
+ OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.displayName) || "") || OLD_FORM_FIELD_COMPONENTS.includes((component === null || component === void 0 ? void 0 : component.name) || "");
34
45
  // eslint-disable-next-line @typescript-eslint/naming-convention
35
46
  export const FormField = function FormFieldInner(WrappedComponent) {
36
47
  // eslint-disable-next-line complexity
37
48
  const InnerFormField = (props) => {
38
49
  const isMobile = useMobile();
39
50
  const ref = props.ref;
51
+ const { isFormSection } = useContext(FormSectionContext);
40
52
  const { id: assistiveId, assistive } = useAssistive(props);
41
53
  const { id: trailingId, trailing } = useTrailing(props);
42
54
  const { id: errorId, error, errorBanner } = useError(props);
@@ -71,6 +83,8 @@ export const FormField = function FormFieldInner(WrappedComponent) {
71
83
  isMobile ? "zen-form-field--mobile" : "",
72
84
  banner ? "zen-form-field--with-banner" : "",
73
85
  !props.label ? "" : props.labelAlign ? `zen-form-field--label-${props.labelAlign}` : "zen-form-field--label-left",
86
+ !isOldFormFieldComponent(WrappedComponent) ? "zen-form-field--new-component" : "",
87
+ isFormSection ? "zen-form-field--form-item" : "",
74
88
  className || ""
75
89
  ]);
76
90
  if (isLoading) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geotab/zenith",
3
- "version": "3.2.0-beta.0",
3
+ "version": "3.2.0-beta.1",
4
4
  "description": "Zenith components library on React",
5
5
  "main": "dist/index.js",
6
6
  "types": "esm/index.d.ts",
@@ -11,6 +11,9 @@
11
11
  "**/react-chartjs/dateAdapter.ts",
12
12
  "**/react-chartjs/dateAdapter.js"
13
13
  ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ },
14
17
  "scripts": {
15
18
  "test": "npm run clean && npm run test-build && node build-utils/translations/inject-translations.js && jest --clearCache && jest",
16
19
  "start": "npm run storybook --loglevel verbose",
@@ -104,8 +107,5 @@
104
107
  "last 1 firefox version",
105
108
  "last 1 safari version"
106
109
  ]
107
- },
108
- "publishConfig": {
109
- "access": "public"
110
110
  }
111
111
  }