@paygreen/pgui 2.3.0 → 2.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.
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { TextareaProps } from '@chakra-ui/react';
3
+ export declare const Textarea: ({ onFocus, onBlur, onMouseEnter, onMouseLeave, variant, borderRadius, ...rest }: TextareaProps & {
4
+ onFocus?: (() => void) | undefined;
5
+ onBlur?: (() => void) | undefined;
6
+ onMouseEnter?: (() => void) | undefined;
7
+ onMouseLeave?: (() => void) | undefined;
8
+ }) => JSX.Element;
@@ -0,0 +1,11 @@
1
+ declare const _default: {
2
+ defaultProps: {
3
+ colorScheme: string;
4
+ };
5
+ baseStyle: {
6
+ control: {
7
+ borderRadius: string;
8
+ };
9
+ };
10
+ };
11
+ export default _default;
@@ -1,5 +1,12 @@
1
1
  export { default as Badge } from './badge';
2
2
  export { default as Button } from './button';
3
+ export { default as Checkbox } from './checkbox';
3
4
  export { default as Drawer } from './drawer';
4
5
  export { default as Input } from './input';
6
+ export { default as NumberInput } from './number-input';
7
+ export { default as PinInput } from './pin-input';
8
+ export { default as Radio } from './radio';
9
+ export { default as Slider } from './slider';
10
+ export { default as Switch } from './switch';
5
11
  export { default as Tag } from './tag';
12
+ export { default as Textarea } from './textarea';
@@ -9,7 +9,6 @@ declare const _default: {
9
9
  field: {
10
10
  bg: string;
11
11
  borderColor: string;
12
- borderRadius: string;
13
12
  _focus: {
14
13
  borderColor: string;
15
14
  };
@@ -26,7 +25,6 @@ declare const _default: {
26
25
  bg: string;
27
26
  borderWidth: string;
28
27
  borderColor: string;
29
- borderRadius: string;
30
28
  _hover: {
31
29
  bg: string;
32
30
  borderColor: string;
@@ -0,0 +1,54 @@
1
+ declare const _default: {
2
+ baseStyle: {
3
+ field: {
4
+ borderRadius: string;
5
+ };
6
+ stepperGroup: {
7
+ width: string;
8
+ };
9
+ stepper: {
10
+ paddingRight: string;
11
+ };
12
+ };
13
+ variants: {
14
+ outline: (props: any) => {
15
+ field: {
16
+ bg: string;
17
+ borderColor: string;
18
+ borderRadius: string;
19
+ _focus: {
20
+ borderColor: string;
21
+ };
22
+ _focusVisible: {
23
+ boxShadow: string;
24
+ };
25
+ };
26
+ addon: {
27
+ borderRadius: string;
28
+ };
29
+ };
30
+ filled: (props: any) => {
31
+ field: {
32
+ bg: string;
33
+ borderWidth: string;
34
+ borderColor: string;
35
+ borderRadius: string;
36
+ _hover: {
37
+ bg: string;
38
+ borderColor: string;
39
+ };
40
+ _focus: {
41
+ bg: string;
42
+ borderColor: string;
43
+ };
44
+ _focusVisible: {
45
+ boxShadow: string;
46
+ };
47
+ };
48
+ addon: {
49
+ borderRadius: string;
50
+ };
51
+ };
52
+ };
53
+ };
54
+ export default _default;
@@ -0,0 +1,31 @@
1
+ declare const _default: {
2
+ variants: {
3
+ outline: (props: any) => {
4
+ bg: string;
5
+ borderColor: string;
6
+ _focus: {
7
+ borderColor: string;
8
+ };
9
+ _focusVisible: {
10
+ boxShadow: string;
11
+ };
12
+ };
13
+ filled: (props: any) => {
14
+ bg: string;
15
+ borderWidth: string;
16
+ borderColor: string;
17
+ _hover: {
18
+ bg: string;
19
+ borderColor: string;
20
+ };
21
+ _focus: {
22
+ bg: string;
23
+ borderColor: string;
24
+ };
25
+ _focusVisible: {
26
+ boxShadow: string;
27
+ };
28
+ };
29
+ };
30
+ };
31
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ defaultProps: {
3
+ colorScheme: string;
4
+ };
5
+ };
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ defaultProps: {
3
+ colorScheme: string;
4
+ };
5
+ };
6
+ export default _default;
@@ -0,0 +1,6 @@
1
+ declare const _default: {
2
+ defaultProps: {
3
+ colorScheme: string;
4
+ };
5
+ };
6
+ export default _default;
@@ -0,0 +1,42 @@
1
+ declare const _default: {
2
+ baseStyle: {
3
+ paddingY: string;
4
+ minHeight: string;
5
+ lineHeight: string;
6
+ verticalAlign: string;
7
+ borderRadius: string;
8
+ };
9
+ variants: {
10
+ outline: (props: any) => {
11
+ bg: string;
12
+ borderColor: string;
13
+ _focus: {
14
+ borderColor: string;
15
+ };
16
+ _focusVisible: {
17
+ boxShadow: string;
18
+ };
19
+ };
20
+ filled: (props: any) => {
21
+ bg: string;
22
+ borderWidth: string;
23
+ borderColor: string;
24
+ _hover: {
25
+ bg: string;
26
+ borderColor: string;
27
+ };
28
+ _focus: {
29
+ bg: string;
30
+ borderColor: string;
31
+ };
32
+ _focusVisible: {
33
+ boxShadow: string;
34
+ };
35
+ };
36
+ };
37
+ defaultProps: {
38
+ size: string;
39
+ variant: string;
40
+ };
41
+ };
42
+ export default _default;
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import React__default, { useState, useRef, useEffect, useContext, createContext, forwardRef as forwardRef$1, useLayoutEffect, createElement, Fragment, Component, useCallback, useMemo } from 'react';
3
- import { forwardRef, IconButton, Flex, createStylesContext, chakra, useMultiStyleConfig, useMenuItem, MenuIcon, MenuCommand, useMenuState, Icon, Text, useBreakpointValue, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, Box, Accordion, FormControl, FormLabel, FormHelperText, FormErrorMessage, SlideFade, useDisclosure, Popover, PopoverTrigger, InputGroup, Input as Input$1, InputRightElement, PopoverContent, PopoverArrow, HStack, useControllableState, useMergeRefs, useTheme, useColorModeValue, useStyleConfig, useToken, useBreakpoint, Drawer, DrawerOverlay, DrawerContent, DrawerCloseButton, VStack, Button as Button$1, Stack, extendTheme } from '@chakra-ui/react';
3
+ import { forwardRef, IconButton, Flex, createStylesContext, chakra, useMultiStyleConfig, useMenuItem, MenuIcon, MenuCommand, useMenuState, Icon, Text, useBreakpointValue, AccordionItem, AccordionButton, AccordionIcon, AccordionPanel, Box, Accordion, FormControl, FormLabel, FormHelperText, FormErrorMessage, SlideFade, useDisclosure, Popover, PopoverTrigger, InputGroup, Input as Input$2, InputRightElement, PopoverContent, PopoverArrow, HStack, useControllableState, useMergeRefs, useTheme, useColorModeValue, useStyleConfig, useToken, useBreakpoint, Drawer, DrawerOverlay, DrawerContent, DrawerCloseButton, VStack, Button as Button$1, Stack, extendTheme } from '@chakra-ui/react';
4
4
 
5
5
  /******************************************************************************
6
6
  Copyright (c) Microsoft Corporation.
@@ -8750,7 +8750,7 @@ var InputDayPicker = function (_a) {
8750
8750
  React__default.createElement(Popover, __assign$2({ closeOnBlur: true, closeOnEsc: true, isOpen: isOpen, onClose: onClose, placement: "bottom-start", autoFocus: true }, popoverProps),
8751
8751
  React__default.createElement(PopoverTrigger, null,
8752
8752
  React__default.createElement(InputGroup, null,
8753
- React__default.createElement(Input$1, __assign$2({ value: value, onChange: handleInputChange, isDisabled: isDisabled, placeholder: "DD/MM/YYYY" }, inputProps)),
8753
+ React__default.createElement(Input$2, __assign$2({ value: value, onChange: handleInputChange, isDisabled: isDisabled, placeholder: "DD/MM/YYYY" }, inputProps)),
8754
8754
  React__default.createElement(InputRightElement, { w: "fit-content", mr: "0.25rem", height: "".concat(renderInputRightElement()) },
8755
8755
  React__default.createElement(IconButton, { "aria-label": "Calendrier", icon: React__default.createElement(Icon, { as: isOpen ? MdClose : MdCalendarToday, height: (inputProps === null || inputProps === void 0 ? void 0 : inputProps.size) === 'xs' ? '0.5rem' : 'fit-content' }), size: "".concat(renderIconSize()), onClick: onToggle, isDisabled: isDisabled, variant: isOpen ? '@danger' : 'solid', w: "".concat(renderBtnSize()), h: "".concat(renderBtnSize()) })))),
8756
8756
  React__default.createElement(PopoverContent, null,
@@ -8861,7 +8861,7 @@ var SearchInput = forwardRef(function (_a, ref) {
8861
8861
  }
8862
8862
  };
8863
8863
  return (React__default.createElement(InputGroup, __assign$2({}, rest),
8864
- React__default.createElement(Input$1, { ref: refs, onChange: handleChange, value: search || '', placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Recherche...', isDisabled: isDisabled, onKeyDown: handleEscape }),
8864
+ React__default.createElement(Input$2, { ref: refs, onChange: handleChange, value: search || '', placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Recherche...', isDisabled: isDisabled, onKeyDown: handleEscape }),
8865
8865
  React__default.createElement(InputRightElement, { color: isDisabled ? 'gray.300' : 'gray.400' }, !isDisabled && search ? (React__default.createElement(IconButton, { onClick: handleClear, variant: "@secondary", size: "xs", "aria-label": clearLabel !== null && clearLabel !== void 0 ? clearLabel : 'Effacer la recherche' },
8866
8866
  React__default.createElement(FiX, null))) : (React__default.createElement(FiSearch, null)))));
8867
8867
  });
@@ -43907,7 +43907,7 @@ var inputStyle = function inputStyle(isHidden) {
43907
43907
  }, spacingStyle);
43908
43908
  };
43909
43909
 
43910
- var Input = function Input(props) {
43910
+ var Input$1 = function Input(props) {
43911
43911
  var className = props.className,
43912
43912
  cx = props.cx,
43913
43913
  getStyles = props.getStyles,
@@ -44169,7 +44169,7 @@ var components$1 = {
44169
44169
  GroupHeading: GroupHeading,
44170
44170
  IndicatorsContainer: IndicatorsContainer,
44171
44171
  IndicatorSeparator: IndicatorSeparator,
44172
- Input: Input,
44172
+ Input: Input$1,
44173
44173
  LoadingIndicator: LoadingIndicator,
44174
44174
  Menu: Menu,
44175
44175
  MenuList: MenuList,
@@ -45263,7 +45263,7 @@ var defaultTheme = {
45263
45263
  spacing: spacing
45264
45264
  };
45265
45265
 
45266
- var defaultProps = {
45266
+ var defaultProps$5 = {
45267
45267
  'aria-live': 'polite',
45268
45268
  backspaceRemovesValue: true,
45269
45269
  blurInputOnSelect: isTouchCapable(),
@@ -47047,7 +47047,7 @@ var Select$1 = /*#__PURE__*/function (_Component) {
47047
47047
  return Select;
47048
47048
  }(Component);
47049
47049
 
47050
- Select$1.defaultProps = defaultProps;
47050
+ Select$1.defaultProps = defaultProps$5;
47051
47051
 
47052
47052
  var StateManagedSelect = /*#__PURE__*/forwardRef$1(function (props, ref) {
47053
47053
  var baseSelectProps = useStateManager(props);
@@ -51059,6 +51059,19 @@ var button = {
51059
51059
  }
51060
51060
  };
51061
51061
 
51062
+ var defaultProps$4 = {
51063
+ colorScheme: 'brand'
51064
+ };
51065
+ var baseStyle$1 = {
51066
+ control: {
51067
+ borderRadius: '4px'
51068
+ }
51069
+ };
51070
+ var checkbox = {
51071
+ defaultProps: defaultProps$4,
51072
+ baseStyle: baseStyle$1
51073
+ };
51074
+
51062
51075
  var getSize = function (value) {
51063
51076
  if (value === 'full') {
51064
51077
  return {
@@ -51076,10 +51089,64 @@ var drawer = {
51076
51089
  sizes: sizes$1
51077
51090
  };
51078
51091
 
51079
- var input = {
51092
+ var Input = {
51093
+ baseStyle: {
51094
+ field: {
51095
+ borderRadius: 'full'
51096
+ }
51097
+ },
51098
+ variants: {
51099
+ outline: function (props) {
51100
+ return {
51101
+ field: {
51102
+ bg: 'white',
51103
+ borderColor: 'gray.200',
51104
+ _focus: {
51105
+ borderColor: 'brand.500'
51106
+ },
51107
+ _focusVisible: {
51108
+ boxShadow: "0 0 0 1px ".concat(props.theme.colors.brand[500])
51109
+ }
51110
+ },
51111
+ addon: {
51112
+ borderRadius: 'full'
51113
+ }
51114
+ };
51115
+ },
51116
+ filled: function (props) { return ({
51117
+ field: {
51118
+ bg: 'gray.50',
51119
+ borderWidth: '1px',
51120
+ borderColor: 'gray.200',
51121
+ _hover: {
51122
+ bg: 'gray.50',
51123
+ borderColor: 'gray.200'
51124
+ },
51125
+ _focus: {
51126
+ bg: 'gray.50',
51127
+ borderColor: 'brand.500'
51128
+ },
51129
+ _focusVisible: {
51130
+ boxShadow: "0 0 0 1px ".concat(props.theme.colors.brand[500])
51131
+ }
51132
+ },
51133
+ addon: {
51134
+ borderRadius: 'full'
51135
+ }
51136
+ }); }
51137
+ }
51138
+ };
51139
+
51140
+ var numberInput = {
51080
51141
  baseStyle: {
51081
51142
  field: {
51082
51143
  borderRadius: 'full'
51144
+ },
51145
+ stepperGroup: {
51146
+ width: '2rem'
51147
+ },
51148
+ stepper: {
51149
+ paddingRight: '0.2rem'
51083
51150
  }
51084
51151
  },
51085
51152
  variants: {
@@ -51126,6 +51193,35 @@ var input = {
51126
51193
  }
51127
51194
  };
51128
51195
 
51196
+ var variants$1 = {
51197
+ outline: function (props) { var _a; return (_a = Input.variants.outline(props).field) !== null && _a !== void 0 ? _a : {}; },
51198
+ filled: function (props) { var _a; return (_a = Input.variants.filled(props).field) !== null && _a !== void 0 ? _a : {}; }
51199
+ };
51200
+ var pinInput = {
51201
+ variants: variants$1
51202
+ };
51203
+
51204
+ var defaultProps$3 = {
51205
+ colorScheme: 'brand'
51206
+ };
51207
+ var radio = {
51208
+ defaultProps: defaultProps$3
51209
+ };
51210
+
51211
+ var defaultProps$2 = {
51212
+ colorScheme: 'brand'
51213
+ };
51214
+ var slider = {
51215
+ defaultProps: defaultProps$2
51216
+ };
51217
+
51218
+ var defaultProps$1 = {
51219
+ colorScheme: 'brand'
51220
+ };
51221
+ var _switch = {
51222
+ defaultProps: defaultProps$1
51223
+ };
51224
+
51129
51225
  var tag = {
51130
51226
  baseStyle: {
51131
51227
  container: {
@@ -51135,13 +51231,35 @@ var tag = {
51135
51231
  }
51136
51232
  };
51137
51233
 
51234
+ var baseStyle = __assign$2(__assign$2({}, Input.baseStyle.field), { paddingY: '8px', minHeight: '80px', lineHeight: 'short', verticalAlign: 'top' });
51235
+ var variants = {
51236
+ outline: function (props) { var _a; return (_a = Input.variants.outline(props).field) !== null && _a !== void 0 ? _a : {}; },
51237
+ filled: function (props) { var _a; return (_a = Input.variants.filled(props).field) !== null && _a !== void 0 ? _a : {}; }
51238
+ };
51239
+ var defaultProps = {
51240
+ size: 'md',
51241
+ variant: 'outline'
51242
+ };
51243
+ var textarea = {
51244
+ baseStyle: baseStyle,
51245
+ variants: variants,
51246
+ defaultProps: defaultProps
51247
+ };
51248
+
51138
51249
  var components = /*#__PURE__*/Object.freeze({
51139
51250
  __proto__: null,
51140
51251
  Badge: badge,
51141
51252
  Button: button,
51253
+ Checkbox: checkbox,
51142
51254
  Drawer: drawer,
51143
- Input: input,
51144
- Tag: tag
51255
+ Input: Input,
51256
+ NumberInput: numberInput,
51257
+ PinInput: pinInput,
51258
+ Radio: radio,
51259
+ Slider: slider,
51260
+ Switch: _switch,
51261
+ Tag: tag,
51262
+ Textarea: textarea
51145
51263
  });
51146
51264
 
51147
51265
  var colors = {