@mackin.com/styleguide 8.8.0 → 8.9.2
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/index.d.ts +11 -2
- package/index.js +13 -8
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -662,7 +662,7 @@ declare type PickerOption<T> = T | {
|
|
|
662
662
|
id: T;
|
|
663
663
|
name?: string;
|
|
664
664
|
};
|
|
665
|
-
interface SelectProps extends Omit<React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, 'value' | 'options'> {
|
|
665
|
+
interface SelectProps extends Omit<React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement>, 'value' | 'options' | 'string'> {
|
|
666
666
|
}
|
|
667
667
|
interface PickerProps<T extends PickerValue> extends SelectProps {
|
|
668
668
|
value: T;
|
|
@@ -672,6 +672,12 @@ interface PickerProps<T extends PickerValue> extends SelectProps {
|
|
|
672
672
|
round?: boolean;
|
|
673
673
|
/** If true, bottom padding will be added to account for other inputs having space for error messages. */
|
|
674
674
|
controlAlign?: boolean;
|
|
675
|
+
/** This will be applied to the select element. */
|
|
676
|
+
className?: string;
|
|
677
|
+
/** Applies to the outer wrapper which contains the select and other elements. */
|
|
678
|
+
wrapperClassName?: string;
|
|
679
|
+
/** Applies to the custom down arrow. */
|
|
680
|
+
iconClassName?: string;
|
|
675
681
|
}
|
|
676
682
|
declare const Picker: <T extends PickerValue>(props: PickerProps<T>) => JSX.Element;
|
|
677
683
|
|
|
@@ -715,7 +721,6 @@ interface SearchBoxProps {
|
|
|
715
721
|
id?: string;
|
|
716
722
|
placeholder?: string;
|
|
717
723
|
round?: boolean;
|
|
718
|
-
onSubmit?: () => Promise<void>;
|
|
719
724
|
/** Defaults to 250ms */
|
|
720
725
|
debounceMs?: number;
|
|
721
726
|
autoFocus?: boolean;
|
|
@@ -723,6 +728,10 @@ interface SearchBoxProps {
|
|
|
723
728
|
className?: string;
|
|
724
729
|
buttonClassName?: string;
|
|
725
730
|
inputClassName?: string;
|
|
731
|
+
/** This will be ignored if 'noForm' is true. */
|
|
732
|
+
onSubmit?: () => Promise<void>;
|
|
733
|
+
/** If true, the controls will not be wrapped in a Form component. In addition, 'onSubmit' will be ignored. */
|
|
734
|
+
noForm?: boolean;
|
|
726
735
|
}
|
|
727
736
|
declare const SearchBox: (props: SearchBoxProps) => JSX.Element;
|
|
728
737
|
|
package/index.js
CHANGED
|
@@ -3218,7 +3218,7 @@ const roundPxPadding = '4px';
|
|
|
3218
3218
|
const Picker = (props) => {
|
|
3219
3219
|
const selectProps = __rest(props
|
|
3220
3220
|
// if we put numbers in, we expect them out
|
|
3221
|
-
, ["value", "options", "onValueChange", "readOnly", "round", "controlAlign"]);
|
|
3221
|
+
, ["value", "options", "onValueChange", "readOnly", "round", "controlAlign", "wrapperClassName", "iconClassName"]);
|
|
3222
3222
|
// if we put numbers in, we expect them out
|
|
3223
3223
|
let isNumber = false;
|
|
3224
3224
|
if (props.options && props.options.length) {
|
|
@@ -3314,20 +3314,21 @@ const Picker = (props) => {
|
|
|
3314
3314
|
}
|
|
3315
3315
|
return React__namespace.createElement("option", { key: val, value: val }, label);
|
|
3316
3316
|
})));
|
|
3317
|
-
return (React__namespace.createElement("span", { className: css.css({
|
|
3317
|
+
return (React__namespace.createElement("span", { className: css.cx(css.css({
|
|
3318
3318
|
label: 'PickerWrapper',
|
|
3319
3319
|
position: 'relative',
|
|
3320
3320
|
display: 'inline-block',
|
|
3321
3321
|
width: '100%',
|
|
3322
3322
|
paddingBottom: props.controlAlign ? theme.controls.inputErrorMinHeight : undefined
|
|
3323
|
-
}) },
|
|
3323
|
+
}), props.wrapperClassName) },
|
|
3324
3324
|
select,
|
|
3325
|
-
!props.readOnly && (React__namespace.createElement(Icon, { id: "sortDesc", className: css.css({
|
|
3325
|
+
!props.readOnly && (React__namespace.createElement(Icon, { id: "sortDesc", className: css.cx(css.css({
|
|
3326
3326
|
position: 'absolute',
|
|
3327
3327
|
right: `calc(${theme.controls.padding} + ${props.round ? roundPxPadding : '0px'})`,
|
|
3328
3328
|
height: '100%',
|
|
3329
|
-
pointerEvents: 'none'
|
|
3330
|
-
|
|
3329
|
+
pointerEvents: 'none',
|
|
3330
|
+
color: theme.colors.font
|
|
3331
|
+
}), props.iconClassName) }))));
|
|
3331
3332
|
};
|
|
3332
3333
|
|
|
3333
3334
|
const Pager = (props) => {
|
|
@@ -3836,8 +3837,12 @@ const SearchBox = (props) => {
|
|
|
3836
3837
|
}), props.buttonClassName), variant: "icon", small: true },
|
|
3837
3838
|
React__namespace.createElement(Icon, { id: waiting ? 'waiting' : 'search', spin: waiting })));
|
|
3838
3839
|
//TB: FUTURE replace with new inputs
|
|
3839
|
-
|
|
3840
|
-
|
|
3840
|
+
const input = (React__namespace.createElement(Input, { inputClassName: props.inputClassName, autoFocus: props.autoFocus, id: props.id, debounceMs: props.debounceMs, disabled: waiting, type: "text", value: props.value, placeholder: props.placeholder, round: props.round, onChange: props.onChange, rightControl: submitButton }));
|
|
3841
|
+
const wrapperClassName = css.cx('searchBox', props.className);
|
|
3842
|
+
if (!props.noForm) {
|
|
3843
|
+
return (React__namespace.createElement(Form, { role: "search", className: wrapperClassName, onSubmit: onSubmit }, input));
|
|
3844
|
+
}
|
|
3845
|
+
return (React__namespace.createElement("div", { className: wrapperClassName }, input));
|
|
3841
3846
|
};
|
|
3842
3847
|
|
|
3843
3848
|
const GlobalStyles = (p) => {
|