@synerise/ds-field-set 1.1.8 → 1.1.10
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 +10 -0
- package/README.md +11 -8
- package/dist/FieldSet.d.ts +1 -1
- package/dist/FieldSet.js +17 -6
- package/dist/FieldSet.styles.d.ts +1 -1
- package/dist/FieldSet.styles.js +2 -2
- package/dist/FieldSet.types.d.ts +2 -0
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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.1.10](https://github.com/Synerise/synerise-design/compare/@synerise/ds-field-set@1.1.9...@synerise/ds-field-set@1.1.10) (2026-01-22)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @synerise/ds-field-set
|
|
9
|
+
|
|
10
|
+
## [1.1.9](https://github.com/Synerise/synerise-design/compare/@synerise/ds-field-set@1.1.8...@synerise/ds-field-set@1.1.9) (2026-01-20)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- **field-set:** new prefix for field-set with switch ([a18a0df](https://github.com/Synerise/synerise-design/commit/a18a0df04cba27c77ef25c17a957c378267b9229))
|
|
15
|
+
|
|
6
16
|
## [1.1.8](https://github.com/Synerise/synerise-design/compare/@synerise/ds-field-set@1.1.7...@synerise/ds-field-set@1.1.8) (2026-01-15)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @synerise/ds-field-set
|
package/README.md
CHANGED
|
@@ -28,11 +28,14 @@ import FieldSet from '@synerise/ds-field-set'
|
|
|
28
28
|
|
|
29
29
|
## API
|
|
30
30
|
|
|
31
|
-
| Property | Description | Type
|
|
32
|
-
| ------------ | ------------------------- |
|
|
33
|
-
| component | prop to set component | React.ReactNode
|
|
34
|
-
| title | text of title | string
|
|
35
|
-
| onTitleClick | onclick handler for title | () => void
|
|
36
|
-
| description | text of the description | string
|
|
37
|
-
| prefix | prop to set prefix item | React.ReactNode
|
|
38
|
-
| button | prop to set button | React.ReactNode
|
|
31
|
+
| Property | Description | Type | Default |
|
|
32
|
+
| ------------ | ------------------------- | ------------------------ | --------------- |
|
|
33
|
+
| component | prop to set component | React.ReactNode | - |
|
|
34
|
+
| title | text of title | string | - |
|
|
35
|
+
| onTitleClick | onclick handler for title | () => void | - |
|
|
36
|
+
| description | text of the description | string | - |
|
|
37
|
+
| prefix | prop to set prefix item | React.ReactNode | - |
|
|
38
|
+
| button | prop to set button | React.ReactNode | - |
|
|
39
|
+
| expandable | prop to expand field-set | boolean | - |
|
|
40
|
+
| typeTrigger | Trigger type prefix | `expander` / `switch` | `expander` |
|
|
41
|
+
| divider | props to set divider | boolean | - |
|
package/dist/FieldSet.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type FieldSetProps } from './FieldSet.types';
|
|
3
|
-
declare const FieldSet: ({ className, prefix, title, description, component, button, onTitleClick, divider, expandable, defaultExpanded, ...htmlAttributes }: FieldSetProps) => React.JSX.Element;
|
|
3
|
+
declare const FieldSet: ({ className, prefix, title, description, component, button, onTitleClick, divider, expandable, defaultExpanded, triggerType, ...htmlAttributes }: FieldSetProps) => React.JSX.Element;
|
|
4
4
|
export default FieldSet;
|
package/dist/FieldSet.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
var _excluded = ["className", "prefix", "title", "description", "component", "button", "onTitleClick", "divider", "expandable", "defaultExpanded"];
|
|
1
|
+
var _excluded = ["className", "prefix", "title", "description", "component", "button", "onTitleClick", "divider", "expandable", "defaultExpanded", "triggerType"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
5
|
import Button from '@synerise/ds-button';
|
|
6
|
+
import { RawSwitch } from '@synerise/ds-switch';
|
|
6
7
|
import { useResizeObserver } from '@synerise/ds-utils';
|
|
7
8
|
import * as S from './FieldSet.styles';
|
|
8
9
|
var FieldSet = function FieldSet(_ref) {
|
|
@@ -17,6 +18,8 @@ var FieldSet = function FieldSet(_ref) {
|
|
|
17
18
|
divider = _ref$divider === void 0 ? true : _ref$divider,
|
|
18
19
|
expandable = _ref.expandable,
|
|
19
20
|
defaultExpanded = _ref.defaultExpanded,
|
|
21
|
+
_ref$triggerType = _ref.triggerType,
|
|
22
|
+
triggerType = _ref$triggerType === void 0 ? 'expander' : _ref$triggerType,
|
|
20
23
|
htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21
24
|
var _useState = useState(!!defaultExpanded),
|
|
22
25
|
expanded = _useState[0],
|
|
@@ -37,16 +40,24 @@ var FieldSet = function FieldSet(_ref) {
|
|
|
37
40
|
defaultExpanded !== undefined && setExpanded(defaultExpanded);
|
|
38
41
|
}, [defaultExpanded]);
|
|
39
42
|
var headerPrefix = useMemo(function () {
|
|
40
|
-
if (expandable) {
|
|
41
|
-
return /*#__PURE__*/React.createElement(S.
|
|
43
|
+
if (expandable && (!triggerType || triggerType === 'expander')) {
|
|
44
|
+
return /*#__PURE__*/React.createElement(S.PrefixWrapper, null, /*#__PURE__*/React.createElement(Button.Expander, {
|
|
42
45
|
expanded: expanded,
|
|
43
46
|
onClick: function onClick() {
|
|
44
47
|
return setExpanded(!expanded);
|
|
45
48
|
}
|
|
46
|
-
}))
|
|
49
|
+
}));
|
|
47
50
|
}
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
if (expandable && triggerType === 'switch') {
|
|
52
|
+
return /*#__PURE__*/React.createElement(S.PrefixWrapper, null, /*#__PURE__*/React.createElement(RawSwitch, {
|
|
53
|
+
checked: expanded,
|
|
54
|
+
onClick: function onClick() {
|
|
55
|
+
return setExpanded(!expanded);
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
return prefix && /*#__PURE__*/React.createElement(S.PrefixWrapper, null, prefix);
|
|
60
|
+
}, [expandable, prefix, expanded, triggerType]);
|
|
50
61
|
var handleTitleClick = useCallback(function (event) {
|
|
51
62
|
expandable && setExpanded(!expanded);
|
|
52
63
|
onTitleClick && onTitleClick(event);
|
|
@@ -6,7 +6,7 @@ export declare const ContainerWrapper: import("styled-components").StyledCompone
|
|
|
6
6
|
export declare const HeaderWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
7
7
|
topAlign?: boolean;
|
|
8
8
|
}, never>;
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const PrefixWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
10
|
export declare const ActionButton: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
11
11
|
export declare const ExpanderWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
12
12
|
export declare const FieldSetTitle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
package/dist/FieldSet.styles.js
CHANGED
|
@@ -18,8 +18,8 @@ export var HeaderWrapper = styled.div.withConfig({
|
|
|
18
18
|
})(["display:flex;align-items:center;gap:16px;align-items:", ";"], function (props) {
|
|
19
19
|
return props.topAlign ? 'flex-start' : 'center';
|
|
20
20
|
});
|
|
21
|
-
export var
|
|
22
|
-
displayName: "
|
|
21
|
+
export var PrefixWrapper = styled.div.withConfig({
|
|
22
|
+
displayName: "FieldSetstyles__PrefixWrapper",
|
|
23
23
|
componentId: "sc-1hezedi-3"
|
|
24
24
|
})(["display:flex;"]);
|
|
25
25
|
export var ActionButton = styled.div.withConfig({
|
package/dist/FieldSet.types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type MouseEvent as ReactMouseEvent, type ReactNode } from 'react';
|
|
2
2
|
import { type WithHTMLAttributes } from '@synerise/ds-utils';
|
|
3
|
+
export type TriggerType = 'expander' | 'switch';
|
|
3
4
|
export type FieldSetProps = WithHTMLAttributes<HTMLDivElement, {
|
|
4
5
|
component?: ReactNode;
|
|
5
6
|
prefix?: ReactNode;
|
|
@@ -10,5 +11,6 @@ export type FieldSetProps = WithHTMLAttributes<HTMLDivElement, {
|
|
|
10
11
|
className?: string;
|
|
11
12
|
divider?: boolean;
|
|
12
13
|
expandable?: boolean;
|
|
14
|
+
triggerType?: TriggerType;
|
|
13
15
|
defaultExpanded?: boolean;
|
|
14
16
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synerise/ds-field-set",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.10",
|
|
4
4
|
"description": "FieldSet UI Component for the Synerise Design System",
|
|
5
5
|
"license": "ISC",
|
|
6
6
|
"repository": "Synerise/synerise-design",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"types": "dist/index.d.ts",
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@synerise/ds-button": "^1.5.5",
|
|
39
|
-
"@synerise/ds-divider": "^1.2.
|
|
39
|
+
"@synerise/ds-divider": "^1.2.7",
|
|
40
|
+
"@synerise/ds-switch": "^1.2.7",
|
|
40
41
|
"@synerise/ds-utils": "^1.5.3"
|
|
41
42
|
},
|
|
42
43
|
"peerDependencies": {
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"react": ">=16.9.0 <= 18.3.1",
|
|
46
47
|
"styled-components": "^5.3.3"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "13055ac4f0b05cc3eb06021d51c93c8d32328053"
|
|
49
50
|
}
|