plataforma-fundacao-componentes 2.23.31 → 2.23.32

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.
@@ -1,16 +1,11 @@
1
- import React, { LabelHTMLAttributes, ReactElement, SyntheticEvent } from 'react';
1
+ import React, { LabelHTMLAttributes } from 'react';
2
2
  import { ControlLabelPosition } from '../../libraries/ControlLabelPosition';
3
3
  import './ControlLabel.scss';
4
4
  export interface ControlLabelProps extends LabelHTMLAttributes<HTMLLabelElement> {
5
- control: ReactElement<any, any>;
6
- label: string | number;
7
- checked?: boolean;
8
- onChange?: (evt?: SyntheticEvent) => void;
9
- onClick?: (evt?: SyntheticEvent) => void;
10
- value?: unknown;
11
- disabled?: boolean;
5
+ control: JSX.Element;
12
6
  labelPosition?: ControlLabelPosition;
13
7
  labelGap?: number;
8
+ label: string | number;
14
9
  }
15
10
  declare function ControlLabel(props: ControlLabelProps): JSX.Element;
16
11
  declare const _default: React.MemoExoticComponent<typeof ControlLabel>;
@@ -5,5 +5,6 @@ declare const _default: {
5
5
  export default _default;
6
6
  export declare const RadioExample: () => JSX.Element;
7
7
  export declare const CheckedExample: () => JSX.Element;
8
+ export declare const ButtonExample: () => JSX.Element;
8
9
  export declare const SwitchExample: () => JSX.Element;
9
10
  export declare const LabelPositionExample: () => JSX.Element;
@@ -5,4 +5,4 @@ declare const _default: {
5
5
  component: typeof useScreenSize;
6
6
  };
7
7
  export default _default;
8
- export declare const Test: () => JSX.Element;
8
+ export declare const Example: () => JSX.Element;
package/dist/index.js CHANGED
@@ -118,6 +118,61 @@ var FormacaoIcon = function FormacaoIcon() {
118
118
  }));
119
119
  };
120
120
 
121
+ function _extends() {
122
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
123
+ for (var i = 1; i < arguments.length; i++) {
124
+ var source = arguments[i];
125
+
126
+ for (var key in source) {
127
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
128
+ target[key] = source[key];
129
+ }
130
+ }
131
+ }
132
+
133
+ return target;
134
+ };
135
+ return _extends.apply(this, arguments);
136
+ }
137
+
138
+ function _unsupportedIterableToArray(o, minLen) {
139
+ if (!o) return;
140
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
141
+ var n = Object.prototype.toString.call(o).slice(8, -1);
142
+ if (n === "Object" && o.constructor) n = o.constructor.name;
143
+ if (n === "Map" || n === "Set") return Array.from(o);
144
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
145
+ }
146
+
147
+ function _arrayLikeToArray(arr, len) {
148
+ if (len == null || len > arr.length) len = arr.length;
149
+
150
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
151
+
152
+ return arr2;
153
+ }
154
+
155
+ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
156
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
157
+ if (it) return (it = it.call(o)).next.bind(it);
158
+
159
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
160
+ if (it) o = it;
161
+ var i = 0;
162
+ return function () {
163
+ if (i >= o.length) return {
164
+ done: true
165
+ };
166
+ return {
167
+ done: false,
168
+ value: o[i++]
169
+ };
170
+ };
171
+ }
172
+
173
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
174
+ }
175
+
121
176
  var getMergedClassNames = function getMergedClassNames(arr) {
122
177
  return arr.filter(function (el) {
123
178
  return Boolean(el);
@@ -205,6 +260,16 @@ var getParents = function getParents(anchor) {
205
260
 
206
261
  return [anchor].concat(getParents(anchor.parentElement));
207
262
  };
263
+ var objectKeysFiltered = function objectKeysFiltered(obj, keysToExclude) {
264
+ var p = _extends({}, obj);
265
+
266
+ for (var _iterator = _createForOfIteratorHelperLoose(keysToExclude), _step; !(_step = _iterator()).done;) {
267
+ var k = _step.value;
268
+ delete p[k];
269
+ }
270
+
271
+ return p;
272
+ };
208
273
 
209
274
  var rootClassName$7 = 'percent-loader-icon';
210
275
  var PercentLoaderIcon = function PercentLoaderIcon(props) {
@@ -4396,61 +4461,6 @@ var QRCodeWhatsapp = function QRCodeWhatsapp(props) {
4396
4461
  }))));
4397
4462
  };
4398
4463
 
4399
- function _extends() {
4400
- _extends = Object.assign ? Object.assign.bind() : function (target) {
4401
- for (var i = 1; i < arguments.length; i++) {
4402
- var source = arguments[i];
4403
-
4404
- for (var key in source) {
4405
- if (Object.prototype.hasOwnProperty.call(source, key)) {
4406
- target[key] = source[key];
4407
- }
4408
- }
4409
- }
4410
-
4411
- return target;
4412
- };
4413
- return _extends.apply(this, arguments);
4414
- }
4415
-
4416
- function _unsupportedIterableToArray(o, minLen) {
4417
- if (!o) return;
4418
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
4419
- var n = Object.prototype.toString.call(o).slice(8, -1);
4420
- if (n === "Object" && o.constructor) n = o.constructor.name;
4421
- if (n === "Map" || n === "Set") return Array.from(o);
4422
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
4423
- }
4424
-
4425
- function _arrayLikeToArray(arr, len) {
4426
- if (len == null || len > arr.length) len = arr.length;
4427
-
4428
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
4429
-
4430
- return arr2;
4431
- }
4432
-
4433
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
4434
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
4435
- if (it) return (it = it.call(o)).next.bind(it);
4436
-
4437
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
4438
- if (it) o = it;
4439
- var i = 0;
4440
- return function () {
4441
- if (i >= o.length) return {
4442
- done: true
4443
- };
4444
- return {
4445
- done: false,
4446
- value: o[i++]
4447
- };
4448
- };
4449
- }
4450
-
4451
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
4452
- }
4453
-
4454
4464
  var rootClassName$1y = 'component-collapse';
4455
4465
 
4456
4466
  function Collapse(props) {
@@ -8176,39 +8186,19 @@ Col.defaultProps = {
8176
8186
  var Col$1 = React.memo(Col);
8177
8187
 
8178
8188
  var rootClassName$23 = 'component-control-label';
8189
+ var keysToExclude = ['control', 'controlProps', 'labelPosition', 'labelGap', 'label'];
8179
8190
 
8180
8191
  function ControlLabel(props) {
8181
- var ref = React.useRef();
8182
-
8183
- var getProps = function getProps() {
8184
- var p = _extends({}, props);
8192
+ var _props$control$props;
8185
8193
 
8186
- delete p.control;
8187
- delete p.value;
8188
- delete p.label;
8189
- delete p.labelPosition;
8190
- delete p.labelGap;
8191
- return p;
8192
- };
8193
-
8194
- var disabled = props.disabled;
8195
- var controlProps = {
8196
- disabled: disabled
8197
- };
8198
- ['checked', 'onChange', 'value', 'onClick'].forEach(function (key) {
8199
- var _props$control;
8200
-
8201
- if (typeof ((_props$control = props.control) === null || _props$control === void 0 ? void 0 : _props$control.props[key]) === 'undefined' && typeof props[key] !== 'undefined') {
8202
- controlProps[key] = props[key];
8203
- }
8204
- });
8194
+ var ref = React.useRef();
8205
8195
  return React__default.createElement("label", Object.assign({
8206
- className: getMergedClassNames([rootClassName$23, props.labelPosition ? props.labelPosition : '', controlProps.disabled ? 'disabled' : '']),
8196
+ className: getMergedClassNames([rootClassName$23, props.labelPosition ? props.labelPosition : '', (_props$control$props = props.control.props) !== null && _props$control$props !== void 0 && _props$control$props.disabled ? 'disabled' : '']),
8207
8197
  ref: ref,
8208
8198
  style: props.labelGap ? {
8209
8199
  gap: props.labelGap + "px"
8210
8200
  } : {}
8211
- }, getProps()), React.cloneElement(props.control, controlProps), React__default.createElement("span", {
8201
+ }, objectKeysFiltered(props, keysToExclude)), props.control, React__default.createElement("span", {
8212
8202
  className: 'nunito'
8213
8203
  }, props.label));
8214
8204
  }