goobs-frontend 0.7.67 → 0.7.69

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.
Files changed (42) hide show
  1. package/package.json +14 -16
  2. package/src/app/_app.tsx +8 -8
  3. package/src/components/Button/index.tsx +95 -203
  4. package/src/components/ConfirmationCodeInput/index.tsx +4 -6
  5. package/src/components/Content/Structure/button/useButton.tsx +1 -35
  6. package/src/components/Content/Structure/datefield/useDateField.tsx +55 -0
  7. package/src/components/Content/Structure/dropdown/useDropdown.tsx +55 -0
  8. package/src/components/Content/Structure/incremementNumberField/useIncremementNumberField.tsx +65 -0
  9. package/src/components/Content/Structure/numberField/useNumberField.tsx +55 -0
  10. package/src/components/Content/Structure/passwordField/usePasswordField.tsx +57 -0
  11. package/src/components/Content/Structure/phoneNumber/usePhoneNumber.tsx +0 -0
  12. package/src/components/Content/Structure/qrcode/useQRCode.tsx +69 -0
  13. package/src/components/Content/Structure/searchbar/useSearchbar.tsx +55 -0
  14. package/src/components/Content/Structure/textfield/useTextField.tsx +84 -0
  15. package/src/components/Content/index.tsx +44 -7
  16. package/src/components/DateField/index.tsx +112 -0
  17. package/src/components/Dropdown/index.tsx +91 -0
  18. package/src/components/Form/Popup/index.tsx +1 -1
  19. package/src/components/IncrementNumberField/index.tsx +123 -0
  20. package/src/components/Nav/HorizontalVariant/index.tsx +18 -12
  21. package/src/components/Nav/VerticalVariant/index.tsx +14 -10
  22. package/src/components/NumberField/index.tsx +95 -0
  23. package/src/components/PasswordField/index.tsx +105 -0
  24. package/src/components/PhoneNumberField/index.tsx +102 -0
  25. package/src/components/PricingTable/index.tsx +10 -8
  26. package/src/components/QRCode/index.tsx +105 -0
  27. package/src/components/Searchbar/index.tsx +77 -0
  28. package/src/components/TextField/index.tsx +130 -0
  29. package/src/components/Toolbar/index.tsx +11 -10
  30. package/src/index.ts +54 -9
  31. package/src/components/Button/hook/useHelperFooter.tsx +0 -214
  32. package/src/components/Content/Structure/styledcomponent/useStyledComponent.tsx +0 -104
  33. package/src/components/StyledComponent/adornment/index.tsx +0 -125
  34. package/src/components/StyledComponent/hooks/useDropdown.tsx +0 -150
  35. package/src/components/StyledComponent/hooks/useInputHelperFooter.tsx +0 -524
  36. package/src/components/StyledComponent/hooks/usePhoneNumber.tsx +0 -99
  37. package/src/components/StyledComponent/hooks/useRequiredFieldsValidator.tsx +0 -190
  38. package/src/components/StyledComponent/hooks/useSearchbar.tsx +0 -46
  39. package/src/components/StyledComponent/hooks/useSplitButton.tsx +0 -70
  40. package/src/components/StyledComponent/index.tsx +0 -473
  41. package/src/components/StyledComponent/useCallbacks/index.tsx +0 -46
  42. package/src/styles/StyledComponent/Label/index.ts +0 -76
@@ -1,125 +0,0 @@
1
- import React from 'react'
2
- import { InputAdornment, Button, Box } from '@mui/material'
3
- import SearchIcon from '../../Icons/Search'
4
- import ShowHideEyeIcon from '../../Icons/ShowHideEye'
5
- import DownArrowFilledIcon from '../../Icons/DownArrowFilled'
6
-
7
- /**
8
- * Props interface for the Adornment components
9
- */
10
- export interface AdornmentProps {
11
- componentvariant: string
12
- iconcolor?: string
13
- passwordVisible?: boolean
14
- togglePasswordVisibility?: () => void
15
- marginRight?: number | string
16
- handleIncrement?: () => void
17
- handleDecrement?: () => void
18
- }
19
-
20
- /**
21
- * StartAdornment component renders the start adornment for the input component.
22
- * @param props The props for the StartAdornment component.
23
- * @returns The start adornment component or null.
24
- */
25
- export const StartAdornment: React.FC<AdornmentProps> = props => {
26
- const { componentvariant, iconcolor } = props
27
- // Render the search icon for the search bar variant
28
- if (componentvariant === 'searchbar') {
29
- return (
30
- <InputAdornment position="start">
31
- <SearchIcon color={iconcolor} />
32
- </InputAdornment>
33
- )
34
- }
35
- return null
36
- }
37
-
38
- /**
39
- * EndAdornment component renders the end adornment for the input component.
40
- * @param props The props for the EndAdornment component.
41
- * @returns The end adornment component or null.
42
- */
43
- export const EndAdornment: React.FC<AdornmentProps> = props => {
44
- const {
45
- componentvariant,
46
- passwordVisible,
47
- togglePasswordVisibility,
48
- handleIncrement,
49
- handleDecrement,
50
- } = props
51
-
52
- const adornmentStyle = {
53
- cursor: 'pointer',
54
- }
55
-
56
- // Render the show/hide eye icon for the password variant
57
- if (componentvariant === 'password') {
58
- return (
59
- <InputAdornment
60
- position="end"
61
- onClick={togglePasswordVisibility}
62
- style={adornmentStyle}
63
- >
64
- <ShowHideEyeIcon visible={passwordVisible} />
65
- </InputAdornment>
66
- )
67
- }
68
- // Render the down arrow icon for the dropdown variant
69
- else if (componentvariant === 'dropdown') {
70
- return (
71
- <InputAdornment position="end" style={adornmentStyle}>
72
- <DownArrowFilledIcon />
73
- </InputAdornment>
74
- )
75
- }
76
- // Render the increment/decrement buttons for the splitbutton variant
77
- else if (componentvariant === 'splitbutton') {
78
- return (
79
- <InputAdornment position="end">
80
- <Button
81
- sx={{
82
- minWidth: '20px',
83
- padding: 0,
84
- height: '100%',
85
- borderLeft: '1px solid #c4c4c4',
86
- borderRadius: '0 4px 4px 0',
87
- backgroundColor: '#f0f0f0',
88
- color: 'black',
89
- '&:hover': {
90
- backgroundColor: '#e0e0e0',
91
- },
92
- }}
93
- >
94
- <Box
95
- sx={{
96
- display: 'flex',
97
- flexDirection: 'column',
98
- alignItems: 'center',
99
- }}
100
- >
101
- <Box
102
- sx={{ fontSize: '10px', lineHeight: 1, cursor: 'pointer' }}
103
- onClick={handleIncrement}
104
- >
105
-
106
- </Box>
107
- <Box
108
- sx={{ fontSize: '10px', lineHeight: 1, cursor: 'pointer' }}
109
- onClick={handleDecrement}
110
- >
111
-
112
- </Box>
113
- </Box>
114
- </Button>
115
- </InputAdornment>
116
- )
117
- }
118
- // Render an empty end adornment for the search bar variant
119
- else if (componentvariant === 'searchbar') {
120
- return (
121
- <InputAdornment position="end" style={adornmentStyle}></InputAdornment>
122
- )
123
- }
124
- return null
125
- }
@@ -1,150 +0,0 @@
1
- 'use client'
2
-
3
- import { useState, useCallback } from 'react'
4
- import { StyledComponentProps } from '..'
5
- import { styled, Menu, MenuItem } from '@mui/material'
6
- import React from 'react'
7
-
8
- /**
9
- * Styled MenuItem component for the dropdown menu.
10
- */
11
- const StyledSelectMenu = styled(MenuItem)({
12
- backgroundColor: 'white',
13
- color: 'black',
14
- '&:hover': { backgroundColor: '#63B3DD' },
15
- '&[aria-selected=true]': {
16
- color: 'white',
17
- backgroundColor: '#9CE4F8',
18
- },
19
- })
20
-
21
- /**
22
- * Custom hook for managing a dropdown component.
23
- *
24
- * @param {StyledComponentProps} props - The props passed to the StyledComponent.
25
- * @param {React.RefObject<HTMLDivElement>} inputBoxRef - Ref to the input box element.
26
- * @param {(option: string) => void} [onOptionSelect] - Optional callback function when an option is selected.
27
- * @returns {Object} An object containing state and handlers for the dropdown.
28
- */
29
- export const useDropdown = (
30
- props: StyledComponentProps,
31
- inputBoxRef: React.RefObject<HTMLDivElement>,
32
- onOptionSelect?: (option: string) => void
33
- ) => {
34
- const { componentvariant, options, value, defaultOption } = props
35
-
36
- /** State to control if the dropdown is open */
37
- const [isDropdownOpen, setIsDropdownOpen] = useState(false)
38
- /** State to store the anchor element for the dropdown */
39
- const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
40
- /** State to store the filtered options */
41
- const [filteredOptions, setFilteredOptions] = useState<string[]>(
42
- componentvariant === 'dropdown' && options ? [...options] : []
43
- )
44
- /** State to store the currently selected option */
45
- const [selectedOption, setSelectedOption] = useState(() => {
46
- if (value !== undefined) return value
47
- if (defaultOption !== undefined) return defaultOption
48
- if (options && options.length > 0) return options[0]
49
- return ''
50
- })
51
- /** State to track if the dropdown is focused */
52
- const [isDropdownFocused, setIsDropdownFocused] = useState(false)
53
-
54
- /**
55
- * Handle click on the dropdown to open/close it
56
- */
57
- const handleDropdownClick = useCallback(() => {
58
- if (componentvariant === 'dropdown') {
59
- setAnchorEl(inputBoxRef.current)
60
- setIsDropdownOpen(prev => !prev)
61
- }
62
- }, [componentvariant, inputBoxRef])
63
-
64
- /**
65
- * Handle selection of an option from the dropdown
66
- * @param {string} option - The selected option
67
- */
68
- const handleOptionSelect = useCallback(
69
- (option: string) => {
70
- setSelectedOption(option)
71
- setIsDropdownOpen(false)
72
- if (onOptionSelect) {
73
- onOptionSelect(option)
74
- }
75
- },
76
- [onOptionSelect]
77
- )
78
-
79
- /**
80
- * Handle focus/blur of the dropdown input
81
- * @param {boolean} focused - Whether the input is focused
82
- */
83
- const handleInputFocus = useCallback(
84
- (focused: boolean) => {
85
- if (componentvariant === 'dropdown') {
86
- setIsDropdownFocused(focused)
87
- }
88
- },
89
- [componentvariant]
90
- )
91
-
92
- /**
93
- * Update filtered options and selected option when props change
94
- */
95
- const updateDropdownState = useCallback(() => {
96
- if (componentvariant === 'dropdown' && options) {
97
- setFilteredOptions([...options])
98
- }
99
- if (value !== undefined) {
100
- setSelectedOption(value)
101
- } else if (defaultOption !== undefined) {
102
- setSelectedOption(defaultOption)
103
- } else if (options && options.length > 0) {
104
- setSelectedOption(options[0])
105
- }
106
- }, [componentvariant, options, value, defaultOption])
107
-
108
- /**
109
- * Render the dropdown menu
110
- */
111
- const renderMenu = (
112
- <Menu
113
- anchorEl={anchorEl}
114
- open={isDropdownOpen}
115
- onClose={() => setIsDropdownOpen(false)}
116
- PaperProps={{
117
- style: {
118
- minWidth: inputBoxRef.current?.offsetWidth,
119
- },
120
- }}
121
- >
122
- {filteredOptions && filteredOptions.length > 0 ? (
123
- filteredOptions.map((option: string) => (
124
- <StyledSelectMenu
125
- key={option}
126
- onClick={() => handleOptionSelect(option)}
127
- selected={option === selectedOption}
128
- >
129
- {option}
130
- </StyledSelectMenu>
131
- ))
132
- ) : (
133
- <MenuItem disabled>No Options Found</MenuItem>
134
- )}
135
- </Menu>
136
- )
137
-
138
- return {
139
- renderMenu,
140
- isDropdownOpen,
141
- anchorEl,
142
- filteredOptions,
143
- handleDropdownClick,
144
- selectedOption,
145
- handleOptionSelect,
146
- isDropdownFocused,
147
- handleInputFocus,
148
- updateDropdownState,
149
- }
150
- }