@synerise/ds-completed-within 0.3.15 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
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
+ # [0.4.0](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.3.15...@synerise/ds-completed-within@0.4.0) (2022-04-05)
7
+
8
+
9
+ ### Features
10
+
11
+ * **completed-within:** adds placeholder nad tooltip props ([22976de](https://github.com/Synerise/synerise-design/commit/22976deac9012e1654b86ad745da7207e664ad88))
12
+ * **completed-within:** adds placeholder prop ([6aa6e91](https://github.com/Synerise/synerise-design/commit/6aa6e91cb9fae233d6c2e1cf447fd91082c67686))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [0.3.15](https://github.com/Synerise/synerise-design/compare/@synerise/ds-completed-within@0.3.14...@synerise/ds-completed-within@0.3.15) (2022-03-30)
7
19
 
8
20
  **Note:** Version bump only for package @synerise/ds-completed-within
package/README.md CHANGED
@@ -29,12 +29,13 @@ import CompletedWithin from '@synerise/ds-completed-within'
29
29
 
30
30
  ## API
31
31
 
32
- | Property | Description | Type | Default |
33
- | --- | --- | --- | --- |
34
- | text | Custom labels and tooltips | CompletedWithinTexts | - |
35
- | value | Selected value | PeriodValue | { value: undefined, period: 'YEARS'} |
36
- | onSetValue | Function called when user has closed the settings with set value, and period | (value: PeriodValue) => void | - |
37
- | periods | Custom list of periods | CustomPeriod[] | - |
32
+ | Property | Description | Type | Default |
33
+ | --- | --- | --- | --- |
34
+ | text | Custom labels and tooltips | CompletedWithinTexts | - |
35
+ | value | Selected value | PeriodValue | { value: undefined, period: 'YEARS'} |
36
+ | onSetValue | Function called when user has closed the settings with set value, and period | (value: PeriodValue) => void | - |
37
+ | periods | Custom list of periods | CustomPeriod[] | - |
38
+ | placeholder | Trigger button label | string | - |
38
39
 
39
40
  ### CompletedWithinTexts
40
41
 
@@ -18,7 +18,8 @@ var CompletedWithin = function CompletedWithin(_ref) {
18
18
  var value = _ref.value,
19
19
  onSetValue = _ref.onSetValue,
20
20
  text = _ref.text,
21
- periods = _ref.periods;
21
+ periods = _ref.periods,
22
+ placeholder = _ref.placeholder;
22
23
  var intl = useIntl();
23
24
  var texts = React.useMemo(function () {
24
25
  return _objectSpread({
@@ -84,22 +85,22 @@ var CompletedWithin = function CompletedWithin(_ref) {
84
85
  });
85
86
  }, [onSetValue]);
86
87
  var triggerMode = React.useMemo(function () {
87
- if (!hasValue) return 'single-icon';
88
- return 'icon-label';
89
- }, [hasValue]);
88
+ if (hasValue || placeholder) return 'icon-label';
89
+ return 'single-icon';
90
+ }, [hasValue, placeholder]);
90
91
  var triggerLabel = React.useMemo(function () {
91
92
  var _getPeriods$find;
92
93
 
93
- return hasValue && texts.completedLabel + " " + value.value + " " + ((_getPeriods$find = getPeriods.find(function (singlePeriod) {
94
+ return hasValue ? texts.completedLabel + " " + value.value + " " + ((_getPeriods$find = getPeriods.find(function (singlePeriod) {
94
95
  return singlePeriod.value === value.period;
95
- })) == null ? void 0 : _getPeriods$find.label);
96
- }, [getPeriods, hasValue, texts, value]);
96
+ })) == null ? void 0 : _getPeriods$find.label) : placeholder;
97
+ }, [getPeriods, hasValue, texts, value, placeholder]);
97
98
  return /*#__PURE__*/React.createElement(S.CompletedWithinWrapper, {
98
99
  withValue: hasValue
99
100
  }, /*#__PURE__*/React.createElement(Dropdown, {
100
101
  overlay: /*#__PURE__*/React.createElement(Settings, {
101
102
  value: {
102
- value: Number(innerValue),
103
+ value: innerValue !== undefined ? Number(innerValue) : 0,
103
104
  period: innerPeriod
104
105
  },
105
106
  onValueChange: setInnerValue,
@@ -19,4 +19,5 @@ export declare type CompletedWithinProps = {
19
19
  value: PeriodValue;
20
20
  onSetValue: (value: PeriodValue) => void;
21
21
  periods?: CustomPeriod[];
22
+ placeholder?: string | undefined;
22
23
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-completed-within",
3
- "version": "0.3.15",
3
+ "version": "0.4.0",
4
4
  "description": "CompletedWithin UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -33,7 +33,7 @@
33
33
  "types": "dist/index.d.ts",
34
34
  "dependencies": {
35
35
  "@synerise/ds-button": "^0.17.2",
36
- "@synerise/ds-dropdown": "^0.17.15",
36
+ "@synerise/ds-dropdown": "^0.17.16",
37
37
  "@synerise/ds-icon": "^0.49.0",
38
38
  "@synerise/ds-input-number": "^0.3.45",
39
39
  "@synerise/ds-select": "^0.14.11",
@@ -43,5 +43,5 @@
43
43
  "@synerise/ds-core": "*",
44
44
  "react": ">=16.9.0 < 17.0.0"
45
45
  },
46
- "gitHead": "93d7c60a7fe73188d715fd52b9701f81fcb4e60a"
46
+ "gitHead": "5793ce09feb88b36cc8ca1923ddfcb272b889cb0"
47
47
  }