@xqmsg/ui-core 0.27.0 → 0.28.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.27.0",
2
+ "version": "0.28.1",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -14,6 +14,7 @@ export interface BannerProps {
14
14
  buttonText?: string;
15
15
  onClick?: () => void;
16
16
  type?: 'condensed' | 'expanded';
17
+ centered?: boolean;
17
18
  }
18
19
 
19
20
  /**
@@ -25,6 +26,7 @@ export const Banner: React.FC<BannerProps> = ({
25
26
  buttonText,
26
27
  onClick,
27
28
  type = 'expanded',
29
+ centered = false,
28
30
  }) => {
29
31
  const Icon = useMemo(() => {
30
32
  switch (variant) {
@@ -42,15 +44,26 @@ export const Banner: React.FC<BannerProps> = ({
42
44
  }, [variant]);
43
45
 
44
46
  return (
45
- <Alert variant={variant} borderRadius="4px">
47
+ <Alert
48
+ variant={variant}
49
+ borderRadius="4px"
50
+ justifyContent={centered ? 'center' : undefined}
51
+ >
46
52
  <AlertDescription>
47
53
  <Flex
48
- flexDirection={type === 'condensed' ? 'row' : 'column'}
49
- alignItems={type === 'condensed' ? 'center' : ''}
54
+ flexDirection={centered || type === 'condensed' ? 'row' : 'column'}
55
+ alignItems={centered || type === 'condensed' ? 'center' : ''}
56
+ justifyContent={centered ? 'center' : undefined}
50
57
  minHeight="26px"
51
58
  >
52
- <Box pr="8px">{Icon}</Box>
53
- <Box flexGrow="1" pt={type === 'condensed' ? 0 : '8px'}>
59
+ <Box pr="8px" pt={!centered && type !== 'condensed' ? '8px' : 0}>
60
+ {Icon}
61
+ </Box>
62
+ <Box
63
+ flexGrow={centered ? undefined : '1'}
64
+ pt={!centered && type !== 'condensed' ? '8px' : 0}
65
+ textAlign={centered ? 'center' : 'left'}
66
+ >
54
67
  {message}
55
68
  </Box>
56
69
  {onClick && buttonText && (
@@ -22,7 +22,7 @@ export type InputType =
22
22
  export type FieldOption = {
23
23
  label: string;
24
24
  value: string | 'section_header';
25
- sortValue: number;
25
+ sortValue?: number;
26
26
  };
27
27
 
28
28
  export interface ValidationProps {
@@ -159,7 +159,9 @@ const StackedMultiSelect = React.forwardRef<
159
159
  });
160
160
 
161
161
  setLocalOptions(prevLocalOptions =>
162
- [...prevLocalOptions, option].sort((a, b) => a.sortValue - b.sortValue)
162
+ [...prevLocalOptions, option].sort(
163
+ (a, b) => (a.sortValue ?? 0) - (b.sortValue ?? 0)
164
+ )
163
165
  );
164
166
 
165
167
  setLocalValues(prevLocalValues =>
@@ -80,11 +80,7 @@ const StackedSelect = React.forwardRef<HTMLInputElement, StackedSelectProps>(
80
80
  setSearchValue('');
81
81
  });
82
82
 
83
- const handleOnSelectItem = (option: {
84
- label: string;
85
- value: string;
86
- sortValue: number;
87
- }) => {
83
+ const handleOnSelectItem = (option: FieldOption) => {
88
84
  if (handleOnChange) {
89
85
  handleOnChange(option.value);
90
86
  }