@majoo-ui/react 2.0.0 → 2.1.0-rc.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.
- package/charts.esm.js +3 -1453
- package/colors/Colors.esm.js +93 -0
- package/components/accordion/Accordion.esm.js +109 -0
- package/components/alertDialog/AlertDialog.esm.js +440 -0
- package/components/avatar/Avatar.esm.js +83 -0
- package/components/badge/Badge.esm.js +255 -0
- package/components/banner/Banner.esm.js +341 -0
- package/components/barChart/BarChart.esm.js +212 -0
- package/components/breadcrumb/Breadcrumb.esm.js +65 -0
- package/components/breadcrumb/index.esm.js +19 -0
- package/components/button/Button.esm.js +331 -0
- package/components/buttonGroup/ButtonGroup.esm.js +350 -0
- package/components/card/Card.esm.js +236 -0
- package/components/chart/assets/data_kosong.png.esm.js +3 -0
- package/components/chart/lineChart/LineChart.esm.js +358 -0
- package/components/chart/lineChart/components/Comparator.esm.js +82 -0
- package/components/chart/lineChart/components/ComparatorController.esm.js +112 -0
- package/components/chart/lineChart/components/ComparatorItem.esm.js +104 -0
- package/components/chart/lineChart/components/ProductList.esm.js +78 -0
- package/components/chart/lineChart/components/TitleLegend.esm.js +107 -0
- package/components/chart/lineChart/components/Tooltip.esm.js +90 -0
- package/components/chart/utils/index.esm.js +109 -0
- package/components/checkboxTable/CheckboxTable.esm.js +287 -0
- package/components/colorPicker/ColorPicker.esm.js +342 -0
- package/components/colorPicker/InputColorPicker.esm.js +120 -0
- package/components/colorPicker/assets/img_colormap.gif.esm.js +3 -0
- package/components/colorPicker/components/ColorFields.esm.js +144 -0
- package/components/colorPicker/components/ColorMap.esm.js +1188 -0
- package/components/contentEditor/ContentEditor.esm.js +251 -0
- package/components/contentEditor/assets/Inline-code-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Link-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-bulleted-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/List-numbered-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Redo-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-bold-filled.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-clear-format-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-italic-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-strikethrough-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Text-underline-outline.svg.esm.js +3 -0
- package/components/contentEditor/assets/Undo-outline.svg.esm.js +3 -0
- package/components/contextMenu/ContextMenu.esm.js +298 -0
- package/components/datePicker/AdvancedOption.esm.js +37 -0
- package/components/datePicker/CustomDatePicker.esm.js +121 -0
- package/components/datePicker/DatePicker.esm.js +244 -0
- package/components/datePicker/DatePickerMulti.esm.js +70 -0
- package/components/datePicker/InputDatePicker.esm.js +290 -0
- package/components/datePicker/InputDateRangePicker.esm.js +174 -0
- package/components/datePicker/components/Calendar.esm.js +654 -0
- package/components/datePicker/components/CalendarMulti.esm.js +407 -0
- package/components/datePicker/components/CalendarTimePicker.esm.js +104 -0
- package/components/datePicker/components/DateNumber.esm.js +89 -0
- package/components/datePicker/components/MobileCalendar.esm.js +522 -0
- package/components/datePicker/state/reducer.esm.js +286 -0
- package/components/datePicker/timePicker/InputTimePicker.esm.js +205 -0
- package/components/datePicker/timePicker/TimePicker.esm.js +481 -0
- package/components/devicePreview/DevicePreview.esm.js +631 -0
- package/components/devicePreview/deviceFrame/android-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/android-wide-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-email.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-notification.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-sms.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/bg-whatsapp.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/desktop-transparant.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/ic-majoo-profpic.png.esm.js +3 -0
- package/components/devicePreview/deviceFrame/iphone-transparant.png.esm.js +3 -0
- package/components/dialog/Dialog.esm.js +106 -0
- package/components/drawer/Drawer.esm.js +294 -0
- package/components/dropdownMenu/DropdownMenu.esm.js +281 -0
- package/components/editableTable/EditableMobile.esm.js +361 -0
- package/components/editableTable/EditableTable.esm.js +618 -0
- package/components/editableTable/transition.esm.js +37 -0
- package/components/form/components/FormGroup/FormGroup.esm.js +142 -0
- package/components/form/components/FormHelper/Helper.esm.js +50 -0
- package/components/form/components/FormLabel/Label.esm.js +90 -0
- package/components/form/components/InputAddon/InputAddon.esm.js +105 -0
- package/components/form/components/InputCheckbox/CheckboxGroup.esm.js +60 -0
- package/components/form/components/InputCheckbox/InputCheckbox.esm.js +129 -0
- package/components/form/components/InputCheckbox/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputCheckbox/icon/MinusOutline.esm.js +33 -0
- package/components/form/components/InputCombobox/InputCombobox.esm.js +169 -0
- package/components/form/components/InputCounter/InputCounter.esm.js +226 -0
- package/components/form/components/InputCreatable/InputCreatable.esm.js +229 -0
- package/components/form/components/InputDateRange/InputDateRange.esm.js +46 -0
- package/components/form/components/InputElement/InputElement.esm.js +35 -0
- package/components/form/components/InputGroup/InputGroup.esm.js +188 -0
- package/components/form/components/InputLetter/InputLetter.esm.js +68 -0
- package/components/form/components/InputNumber/InputNumber.esm.js +248 -0
- package/components/form/components/InputNumber/NumberFormat.esm.js +1263 -0
- package/components/form/components/InputOTP/InputOTP.esm.js +70 -0
- package/components/form/components/InputRadio/InputRadio.esm.js +273 -0
- package/components/form/components/InputRadio/InputRadioGroup.esm.js +35 -0
- package/components/form/components/InputRadio/context.esm.js +5 -0
- package/components/form/components/InputResourceList/InputResourceList.esm.js +429 -0
- package/components/form/components/InputSearchbox/CloseFilled.esm.js +34 -0
- package/components/form/components/InputSearchbox/InputSearchbox.esm.js +90 -0
- package/components/form/components/InputSearchbox/SearchOutline.esm.js +26 -0
- package/components/form/components/InputSelect/InputSelect.esm.js +964 -0
- package/components/form/components/InputSelectCheck/InputSelectCheck.esm.js +1388 -0
- package/components/form/components/InputSelectCheck/OptionGroupItem.esm.js +39 -0
- package/components/form/components/InputSelectCheck/icon/CheckOutline.esm.js +33 -0
- package/components/form/components/InputSelectTag/InputSelectTag.esm.js +62 -0
- package/components/form/components/InputSignature/InputSignature.esm.js +122 -0
- package/components/form/components/InputSignature/SignatureModal.esm.js +67 -0
- package/components/form/components/InputSwitch/InputSwitch.esm.js +96 -0
- package/components/form/components/InputSwitch/InputSwitchWithImage.esm.js +136 -0
- package/components/form/components/InputTags/InputTags.esm.js +268 -0
- package/components/form/components/InputText/InputText.esm.js +197 -0
- package/components/form/components/InputTextArea/InputTextArea.esm.js +77 -0
- package/components/heading/Heading.esm.js +64 -0
- package/components/iconButton/IconButton.esm.js +71 -0
- package/components/image/Image.esm.js +141 -0
- package/components/link/Link.esm.js +59 -0
- package/components/loadingBar/LoadingBar.esm.js +113 -0
- package/components/mapPicker/InputMapPicker.esm.js +160 -0
- package/components/mapPicker/MapPicker.esm.js +122 -0
- package/components/mapPicker/MapPicker.styles.esm.js +70 -0
- package/components/mapPicker/assets/images/Mapsicle.png.esm.js +3 -0
- package/components/mapPicker/components/AddressCard.esm.js +25 -0
- package/components/mapPicker/components/ButtonSelect.esm.js +46 -0
- package/components/mapPicker/components/ChangeView.esm.js +20 -0
- package/components/mapPicker/components/InputSearch.esm.js +74 -0
- package/components/mapPicker/components/MarkerIcon.esm.js +22 -0
- package/components/mapPicker/components/MarkerSvg.esm.js +62 -0
- package/components/mapPicker/components/ZoomControls.esm.js +36 -0
- package/components/mapPicker/hooks/useMapSearch.esm.js +161 -0
- package/components/modalDialog/ModalDialog.esm.js +247 -0
- package/components/notificationBadge/NotificationBadge.esm.js +149 -0
- package/components/pageDialog/PageDialog.esm.js +291 -0
- package/components/pageDialog/logo.svg.esm.js +3 -0
- package/components/pagination/Pagination.esm.js +94 -0
- package/components/pagination/PaginationButton.esm.js +346 -0
- package/components/pagination/PaginationInfo.esm.js +146 -0
- package/components/paper/Paper.esm.js +76 -0
- package/components/paragraph/Paragraph.esm.js +52 -0
- package/components/pieChart/PieChart.esm.js +287 -0
- package/components/popover/Popover.esm.js +142 -0
- package/components/progress/Progress.esm.js +170 -0
- package/components/progressIndicator/ProgressIndicator.esm.js +287 -0
- package/components/scrollSync/ScrollSync.esm.js +172 -0
- package/components/scrollSync/ScrollSyncNode.esm.js +87 -0
- package/components/scrollSync/utils.esm.js +9 -0
- package/components/separator/Separator.esm.js +43 -0
- package/components/skeleton/Skeleton.esm.js +131 -0
- package/components/slider/Slider.esm.js +345 -0
- package/components/stepWizard/StepWizard.esm.js +451 -0
- package/components/stepWizard/index.esm.js +14 -0
- package/components/table/MobileTable.esm.js +415 -0
- package/components/table/Table.esm.js +1472 -0
- package/components/table/components/columns/DateColumn.esm.js +26 -0
- package/components/table/components/columns/DecimalColumn.esm.js +36 -0
- package/components/table/components/columns/PriceColumn.esm.js +57 -0
- package/components/table/components/columns/RowDraggableColumn.esm.js +24 -0
- package/components/table/components/columns/RowExpanderColumn.esm.js +32 -0
- package/components/table/components/columns/RowExpanderMultipleColumn.esm.js +24 -0
- package/components/table/components/columns/RowMenuColumn.esm.js +101 -0
- package/components/table/components/columns/RowSelectionCallbackColumn.esm.js +38 -0
- package/components/table/components/columns/RowSelectionColumn.esm.js +34 -0
- package/components/table/images/img-emptydata.webp.esm.js +3 -0
- package/components/table/images/img-emptysearchdata.webp.esm.js +3 -0
- package/components/tableOfContent/TableOfContent.esm.js +267 -0
- package/components/tableOfContent/index.esm.js +18 -0
- package/components/tableOfContent/transition.esm.js +38 -0
- package/components/tabs/Tabs.esm.js +282 -0
- package/components/tag/Tag.esm.js +161 -0
- package/components/tagList/TagList.esm.js +90 -0
- package/components/tagStatus/TagStatus.esm.js +134 -0
- package/components/text/Text.esm.js +140 -0
- package/components/toast/Toast.esm.js +297 -0
- package/components/toast/ToastContainer.esm.js +73 -0
- package/components/toast/context/ToastContext.esm.js +5 -0
- package/components/toast/context/ToastProvider.esm.js +96 -0
- package/components/tooltip/Tooltip.esm.js +175 -0
- package/components/upload/Upload.esm.js +1103 -0
- package/components/upload/utils/canvasPreview.esm.js +39 -0
- package/components/upload/utils/imgPreview.esm.js +21 -0
- package/config/stitches.config.esm.js +216 -0
- package/editor.esm.js +1 -264
- package/hooks/useListOption/useListOption.esm.js +56 -0
- package/hooks/useToggle/useToggle.esm.js +8 -0
- package/index.esm.js +106 -42293
- package/layout/box/Box.esm.js +24 -0
- package/layout/flex/Flex.esm.js +135 -0
- package/layout/grid/Grid.esm.js +270 -0
- package/layout/pageContainer/PageContainer.esm.js +60 -0
- package/majoo-provider/MajooProvider.esm.js +42 -0
- package/majoo-provider/ThemeProvider.esm.js +41 -0
- package/majoo-provider/globalStyles.esm.js +242 -0
- package/majoo-provider/styles/modern-normalize.esm.js +95 -0
- package/map.esm.js +2 -734
- package/package.json +16 -5
- package/utils/calendar.esm.js +26 -0
- package/utils/element.esm.js +21 -0
- package/utils/object.esm.js +12 -0
- package/utils/request.esm.js +74 -0
- package/utils/strings.esm.js +6 -0
- package/{useMediaQuery.esm.js → utils/useMediaQuery.esm.js} +1 -1
- package/utils/useNavigatorOnline.esm.js +19 -0
- package/utils/variant.esm.js +12 -0
- package/wrapper/ConditionalWrapper.esm.js +9 -0
- package/ModalDialog.esm.js +0 -2669
- package/Separator.esm.js +0 -3002
- package/stitches.config.esm.js +0 -2284
- package/{index.esm.css → charts.esm.css} +4 -4
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import 'core-js/modules/es.iterator.constructor.js';
|
|
2
|
+
import 'core-js/modules/es.iterator.map.js';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
5
|
+
import Flex from '../../layout/flex/Flex.esm.js';
|
|
6
|
+
import { ColorWrap, Saturation, Hue, Alpha, Swatch } from 'react-color/lib/components/common';
|
|
7
|
+
import * as color from 'react-color/lib/helpers/color';
|
|
8
|
+
import Paragraph from '../paragraph/Paragraph.esm.js';
|
|
9
|
+
import ColorMap, { listGray } from './components/ColorMap.esm.js';
|
|
10
|
+
import ColorFields from './components/ColorFields.esm.js';
|
|
11
|
+
import PropTypes from 'prop-types';
|
|
12
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
13
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
|
+
|
|
15
|
+
const Container = styled(Flex, {
|
|
16
|
+
background: '$white',
|
|
17
|
+
padding: 16,
|
|
18
|
+
borderRadius: 8,
|
|
19
|
+
boxShadow: '0px 10px 15px rgba(31, 41, 55, 0.1), 0px 0px 6px rgba(31, 41, 55, 0.05)',
|
|
20
|
+
width: 264
|
|
21
|
+
});
|
|
22
|
+
const Pointer = styled('div', {
|
|
23
|
+
width: 8,
|
|
24
|
+
height: 8,
|
|
25
|
+
borderRadius: 50,
|
|
26
|
+
background: 'transparent',
|
|
27
|
+
border: '2px solid #FFFFFF',
|
|
28
|
+
cursor: 'pointer'
|
|
29
|
+
});
|
|
30
|
+
const SaturationWrap = styled('div', {
|
|
31
|
+
width: '100%',
|
|
32
|
+
paddingBottom: '75%',
|
|
33
|
+
position: 'relative',
|
|
34
|
+
overflow: 'hidden',
|
|
35
|
+
borderRadius: 4,
|
|
36
|
+
cursor: 'pointer'
|
|
37
|
+
});
|
|
38
|
+
const HueWrap = styled('div', {
|
|
39
|
+
position: 'relative',
|
|
40
|
+
height: '8px',
|
|
41
|
+
overflow: 'hidden',
|
|
42
|
+
borderRadius: 50,
|
|
43
|
+
cursor: 'pointer'
|
|
44
|
+
});
|
|
45
|
+
const AlphaWrap = styled('div', {
|
|
46
|
+
position: 'relative',
|
|
47
|
+
height: '8px',
|
|
48
|
+
marginTop: '4px',
|
|
49
|
+
overflow: 'hidden',
|
|
50
|
+
borderRadius: 50,
|
|
51
|
+
cursor: 'pointer'
|
|
52
|
+
});
|
|
53
|
+
const Colors = styled(Flex, {
|
|
54
|
+
position: 'relative'
|
|
55
|
+
});
|
|
56
|
+
const SwatchWrap = styled('div', {
|
|
57
|
+
width: '16px',
|
|
58
|
+
height: '16px',
|
|
59
|
+
margin: '0 10px 10px 0'
|
|
60
|
+
});
|
|
61
|
+
const Hexagon = ({
|
|
62
|
+
color,
|
|
63
|
+
onClick,
|
|
64
|
+
width,
|
|
65
|
+
height,
|
|
66
|
+
bordered
|
|
67
|
+
}) => {
|
|
68
|
+
return /*#__PURE__*/jsxs("svg", {
|
|
69
|
+
onClick: onClick,
|
|
70
|
+
style: {
|
|
71
|
+
cursor: 'pointer'
|
|
72
|
+
},
|
|
73
|
+
width: width,
|
|
74
|
+
height: height,
|
|
75
|
+
viewBox: "0 0 24 28",
|
|
76
|
+
fill: "none",
|
|
77
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
78
|
+
children: [/*#__PURE__*/jsx("path", {
|
|
79
|
+
d: "M12 0L24 7V21L12 28L0 21V7L12 0Z",
|
|
80
|
+
fill: color
|
|
81
|
+
}), bordered ? /*#__PURE__*/jsx("path", {
|
|
82
|
+
d: "M1 7.57437L12 1.1577L23 7.57437V20.4256L12 26.8423L1 20.4256V7.57437Z",
|
|
83
|
+
stroke: "rgba(0, 0, 0, 0.2)",
|
|
84
|
+
strokeOpacity: "0.5",
|
|
85
|
+
strokeWidth: "3"
|
|
86
|
+
}) : /*#__PURE__*/jsx("path", {
|
|
87
|
+
d: "M1 7.57437L12 1.1577L23 7.57437V20.4256L12 26.8423L1 20.4256V7.57437Z"
|
|
88
|
+
})]
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
Hexagon.defaultProps = {
|
|
92
|
+
width: 14,
|
|
93
|
+
height: 16
|
|
94
|
+
};
|
|
95
|
+
const Tabs = styled(TabsPrimitive.Root, {});
|
|
96
|
+
const TabsList = styled(TabsPrimitive.List, {
|
|
97
|
+
display: 'flex'
|
|
98
|
+
});
|
|
99
|
+
const TabsTrigger = styled(TabsPrimitive.Trigger, {
|
|
100
|
+
userSelect: 'none',
|
|
101
|
+
backgroundColor: 'transparent',
|
|
102
|
+
all: 'unset',
|
|
103
|
+
padding: 8,
|
|
104
|
+
display: 'flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
justifyContent: 'center',
|
|
107
|
+
flex: 1,
|
|
108
|
+
fontWeight: 400,
|
|
109
|
+
fontSize: 14,
|
|
110
|
+
cursor: 'pointer',
|
|
111
|
+
'&:first-child': {
|
|
112
|
+
borderTopLeftRadius: 6,
|
|
113
|
+
borderBottomLeftRadius: 6
|
|
114
|
+
},
|
|
115
|
+
'&:last-child': {
|
|
116
|
+
borderTopRightRadius: 6,
|
|
117
|
+
borderBottomRightRadius: 6
|
|
118
|
+
},
|
|
119
|
+
'&[data-state="active"]': {
|
|
120
|
+
backgroundColor: '$btnPrimary',
|
|
121
|
+
color: '$textWhite'
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
const TabsContent = styled(TabsPrimitive.Content, {});
|
|
125
|
+
function ColorPicker({
|
|
126
|
+
hsl,
|
|
127
|
+
hsv,
|
|
128
|
+
rgb,
|
|
129
|
+
hex,
|
|
130
|
+
renderers,
|
|
131
|
+
presetColors,
|
|
132
|
+
onChange,
|
|
133
|
+
onSwatchHover,
|
|
134
|
+
onAddColor,
|
|
135
|
+
disableAlpha
|
|
136
|
+
}) {
|
|
137
|
+
const [check, setCheck] = useState('Hex');
|
|
138
|
+
function toggleCheck() {
|
|
139
|
+
setCheck(check === 'Hex' ? 'RGB' : 'Hex');
|
|
140
|
+
}
|
|
141
|
+
const handleChange = (data, e) => {
|
|
142
|
+
if (data.hex) {
|
|
143
|
+
color.isValidHex(data.hex) && onChange({
|
|
144
|
+
hex: data.hex,
|
|
145
|
+
source: 'hex'
|
|
146
|
+
}, e);
|
|
147
|
+
} else if (data.r || data.g || data.b) {
|
|
148
|
+
onChange({
|
|
149
|
+
r: data.r || rgb.r,
|
|
150
|
+
g: data.g || rgb.g,
|
|
151
|
+
b: data.b || rgb.b,
|
|
152
|
+
a: rgb.a,
|
|
153
|
+
source: 'rgb'
|
|
154
|
+
}, e);
|
|
155
|
+
} else if (data.a) {
|
|
156
|
+
if (data.a < 0) {
|
|
157
|
+
data.a = 0;
|
|
158
|
+
} else if (data.a > 100) {
|
|
159
|
+
data.a = 100;
|
|
160
|
+
}
|
|
161
|
+
data.a /= 100;
|
|
162
|
+
onChange({
|
|
163
|
+
h: hsl.h,
|
|
164
|
+
s: hsl.s,
|
|
165
|
+
l: hsl.l,
|
|
166
|
+
a: data.a,
|
|
167
|
+
source: 'rgb'
|
|
168
|
+
}, e);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
return /*#__PURE__*/jsx(Container, {
|
|
172
|
+
children: /*#__PURE__*/jsx(Tabs, {
|
|
173
|
+
defaultValue: "tab1",
|
|
174
|
+
children: /*#__PURE__*/jsxs(Flex, {
|
|
175
|
+
direction: "column",
|
|
176
|
+
gap: 5,
|
|
177
|
+
children: [/*#__PURE__*/jsxs(TabsList, {
|
|
178
|
+
children: [/*#__PURE__*/jsx(TabsTrigger, {
|
|
179
|
+
value: "tab1",
|
|
180
|
+
children: "Selection"
|
|
181
|
+
}), /*#__PURE__*/jsx(TabsTrigger, {
|
|
182
|
+
value: "tab2",
|
|
183
|
+
children: "Palette"
|
|
184
|
+
})]
|
|
185
|
+
}), /*#__PURE__*/jsx(TabsContent, {
|
|
186
|
+
value: "tab1",
|
|
187
|
+
children: /*#__PURE__*/jsxs(Flex, {
|
|
188
|
+
direction: "column",
|
|
189
|
+
gap: 5,
|
|
190
|
+
children: [/*#__PURE__*/jsx(SaturationWrap, {
|
|
191
|
+
children: /*#__PURE__*/jsx(Saturation, {
|
|
192
|
+
pointer: Pointer,
|
|
193
|
+
hsl: hsl,
|
|
194
|
+
hsv: hsv,
|
|
195
|
+
onChange: onChange
|
|
196
|
+
})
|
|
197
|
+
}), /*#__PURE__*/jsx(HueWrap, {
|
|
198
|
+
children: /*#__PURE__*/jsx(Hue, {
|
|
199
|
+
pointer: Pointer,
|
|
200
|
+
hsl: hsl,
|
|
201
|
+
onChange: onChange
|
|
202
|
+
})
|
|
203
|
+
}), !disableAlpha && /*#__PURE__*/jsx(AlphaWrap, {
|
|
204
|
+
children: /*#__PURE__*/jsx(Alpha, {
|
|
205
|
+
pointer: Pointer,
|
|
206
|
+
rgb: rgb,
|
|
207
|
+
hsl: hsl,
|
|
208
|
+
renderers: renderers,
|
|
209
|
+
onChange: onChange
|
|
210
|
+
})
|
|
211
|
+
}), /*#__PURE__*/jsx(ColorFields, {
|
|
212
|
+
rgb: rgb,
|
|
213
|
+
hex: hex,
|
|
214
|
+
disableAlpha: disableAlpha,
|
|
215
|
+
check: check,
|
|
216
|
+
onChange: handleChange,
|
|
217
|
+
onChangeCheck: toggleCheck
|
|
218
|
+
}), /*#__PURE__*/jsxs(Flex, {
|
|
219
|
+
justify: "between",
|
|
220
|
+
children: [/*#__PURE__*/jsx(Paragraph, {
|
|
221
|
+
css: {
|
|
222
|
+
fontSize: 12,
|
|
223
|
+
fontWeight: 600
|
|
224
|
+
},
|
|
225
|
+
children: "Saved colors:"
|
|
226
|
+
}), !!onAddColor && /*#__PURE__*/jsx(Paragraph, {
|
|
227
|
+
css: {
|
|
228
|
+
fontSize: 12,
|
|
229
|
+
fontWeight: 600,
|
|
230
|
+
color: '$gray500',
|
|
231
|
+
cursor: 'pointer',
|
|
232
|
+
userSelect: 'none',
|
|
233
|
+
'&:hover': {
|
|
234
|
+
color: '$gray400'
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
onClick: onAddColor,
|
|
238
|
+
children: "+ Add"
|
|
239
|
+
})]
|
|
240
|
+
}), /*#__PURE__*/jsx(Colors, {
|
|
241
|
+
wrap: "wrap",
|
|
242
|
+
gap: 3,
|
|
243
|
+
children: presetColors.map(colorObjOrString => {
|
|
244
|
+
const c = typeof colorObjOrString === 'string' ? {
|
|
245
|
+
color: colorObjOrString
|
|
246
|
+
} : colorObjOrString;
|
|
247
|
+
const key = `${c.color}${c.title || ''}`;
|
|
248
|
+
return /*#__PURE__*/jsx(SwatchWrap, {
|
|
249
|
+
children: /*#__PURE__*/jsx(Swatch, {
|
|
250
|
+
...c,
|
|
251
|
+
onClick: onChange,
|
|
252
|
+
onHover: onSwatchHover,
|
|
253
|
+
style: {
|
|
254
|
+
borderRadius: 50,
|
|
255
|
+
width: 24,
|
|
256
|
+
height: 24
|
|
257
|
+
},
|
|
258
|
+
focusStyle: {
|
|
259
|
+
boxShadow: `inset 0 0 0 1px rgba(0,0,0,.15), 0 0 4px ${c.color}`
|
|
260
|
+
}
|
|
261
|
+
})
|
|
262
|
+
}, key);
|
|
263
|
+
})
|
|
264
|
+
})]
|
|
265
|
+
})
|
|
266
|
+
}), /*#__PURE__*/jsx(TabsContent, {
|
|
267
|
+
value: "tab2",
|
|
268
|
+
children: /*#__PURE__*/jsxs(Flex, {
|
|
269
|
+
direction: "column",
|
|
270
|
+
gap: 5,
|
|
271
|
+
children: [/*#__PURE__*/jsx(ColorMap, {
|
|
272
|
+
onClick: handleChange
|
|
273
|
+
}), /*#__PURE__*/jsxs(Flex, {
|
|
274
|
+
justify: "evenly",
|
|
275
|
+
children: [/*#__PURE__*/jsxs(Flex, {
|
|
276
|
+
direction: "column",
|
|
277
|
+
children: [/*#__PURE__*/jsx(Flex, {
|
|
278
|
+
wrap: "wrap",
|
|
279
|
+
css: {
|
|
280
|
+
marginLeft: 6,
|
|
281
|
+
marginBottom: '-4px'
|
|
282
|
+
},
|
|
283
|
+
children: listGray.map((item, index) => {
|
|
284
|
+
return index < 7 && /*#__PURE__*/jsx(Hexagon, {
|
|
285
|
+
color: item,
|
|
286
|
+
onClick: e => handleChange({
|
|
287
|
+
hex: item
|
|
288
|
+
}, e)
|
|
289
|
+
}, index);
|
|
290
|
+
})
|
|
291
|
+
}), /*#__PURE__*/jsx(Flex, {
|
|
292
|
+
wrap: "wrap",
|
|
293
|
+
children: listGray.map((item, index) => {
|
|
294
|
+
return index >= 7 && /*#__PURE__*/jsx(Hexagon, {
|
|
295
|
+
color: item,
|
|
296
|
+
onClick: e => handleChange({
|
|
297
|
+
hex: item
|
|
298
|
+
}, e)
|
|
299
|
+
}, index);
|
|
300
|
+
})
|
|
301
|
+
})]
|
|
302
|
+
}), /*#__PURE__*/jsx(Hexagon, {
|
|
303
|
+
width: 24,
|
|
304
|
+
height: 28,
|
|
305
|
+
color: hex,
|
|
306
|
+
bordered: true
|
|
307
|
+
})]
|
|
308
|
+
})]
|
|
309
|
+
})
|
|
310
|
+
})]
|
|
311
|
+
})
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
ColorPicker.propTypes = {
|
|
316
|
+
/**
|
|
317
|
+
Color code to be displayed.
|
|
318
|
+
*/
|
|
319
|
+
color: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
320
|
+
/**
|
|
321
|
+
Additional color list
|
|
322
|
+
*/
|
|
323
|
+
presetColors: PropTypes.array,
|
|
324
|
+
/**
|
|
325
|
+
Change event handler
|
|
326
|
+
*/
|
|
327
|
+
onChange: PropTypes.func,
|
|
328
|
+
/**
|
|
329
|
+
Add preset color event handler
|
|
330
|
+
*/
|
|
331
|
+
onAddColor: PropTypes.func,
|
|
332
|
+
/**
|
|
333
|
+
Disable opacity selector
|
|
334
|
+
*/
|
|
335
|
+
disableAlpha: PropTypes.bool
|
|
336
|
+
};
|
|
337
|
+
ColorPicker.defaultProps = {
|
|
338
|
+
presetColors: ['#EF4444', '#F97316', '#FACC15', '#4ADE80', '#2DD4BF', '#3B82F6', '#6467F2', '#EC4899', '#F43F5E', '#D946EF', '#8B5CF6', '#0EA5E9', '#10B981', '#84CC16']
|
|
339
|
+
};
|
|
340
|
+
var ColorPicker$1 = ColorWrap(ColorPicker);
|
|
341
|
+
|
|
342
|
+
export { ColorPicker$1 as default };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { styled } from '../../config/stitches.config.esm.js';
|
|
3
|
+
import ColorPicker from './ColorPicker.esm.js';
|
|
4
|
+
import { InputGroup } from '../form/components/InputGroup/InputGroup.esm.js';
|
|
5
|
+
import { InputLeftElement } from '../form/components/InputElement/InputElement.esm.js';
|
|
6
|
+
import { InputText } from '../form/components/InputText/InputText.esm.js';
|
|
7
|
+
import Box from '../../layout/box/Box.esm.js';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
import { Popover, PopoverTrigger, PopoverContent } from '../popover/Popover.esm.js';
|
|
11
|
+
|
|
12
|
+
const Separator = styled('div', {
|
|
13
|
+
height: 20,
|
|
14
|
+
width: 1,
|
|
15
|
+
backgroundColor: '$iconSecondary',
|
|
16
|
+
marginRight: 4
|
|
17
|
+
});
|
|
18
|
+
function InputColorPicker(props) {
|
|
19
|
+
const [isPopover, setIsPopover] = useState(false);
|
|
20
|
+
function getColor() {
|
|
21
|
+
const color = props?.color;
|
|
22
|
+
if (typeof color === 'string') {
|
|
23
|
+
return color?.toUpperCase();
|
|
24
|
+
}
|
|
25
|
+
return `rgba(${color.r},${color.g},${color.b},${color.a})`;
|
|
26
|
+
}
|
|
27
|
+
function renderInputGroup() {
|
|
28
|
+
return /*#__PURE__*/jsxs(InputGroup, {
|
|
29
|
+
size: props.size,
|
|
30
|
+
disabled: props.disabled,
|
|
31
|
+
...(!props.disabled && {
|
|
32
|
+
onClick: () => setIsPopover(true)
|
|
33
|
+
}),
|
|
34
|
+
children: [/*#__PURE__*/jsx(InputLeftElement, {
|
|
35
|
+
children: /*#__PURE__*/jsx(Box, {
|
|
36
|
+
css: {
|
|
37
|
+
width: 16,
|
|
38
|
+
height: 16,
|
|
39
|
+
borderRadius: 2,
|
|
40
|
+
backgroundColor: getColor()
|
|
41
|
+
}
|
|
42
|
+
})
|
|
43
|
+
}), /*#__PURE__*/jsx(Separator, {}), /*#__PURE__*/jsx(InputText, {
|
|
44
|
+
isPicker: true,
|
|
45
|
+
placeholder: "Select color",
|
|
46
|
+
value: getColor()
|
|
47
|
+
})]
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function renderColorPicker() {
|
|
51
|
+
return /*#__PURE__*/jsx(ColorPicker, {
|
|
52
|
+
...props
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return /*#__PURE__*/jsxs(Popover, {
|
|
56
|
+
open: isPopover,
|
|
57
|
+
onOpenChange: setIsPopover,
|
|
58
|
+
placement: props.placement,
|
|
59
|
+
children: [/*#__PURE__*/jsx(PopoverTrigger, {
|
|
60
|
+
disabled: props.disabled,
|
|
61
|
+
children: renderInputGroup()
|
|
62
|
+
}), /*#__PURE__*/jsx(PopoverContent, {
|
|
63
|
+
isMobile: props.isMobile,
|
|
64
|
+
style: props.popoverCss,
|
|
65
|
+
children: renderColorPicker()
|
|
66
|
+
})]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
InputColorPicker.displayName = 'InputColorPicker';
|
|
70
|
+
InputColorPicker.propTypes = {
|
|
71
|
+
/**
|
|
72
|
+
Specify change InputColorPicker size.
|
|
73
|
+
*/
|
|
74
|
+
size: PropTypes.oneOf(['sm', 'lg']),
|
|
75
|
+
/**
|
|
76
|
+
Color code to be displayed.
|
|
77
|
+
*/
|
|
78
|
+
color: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
79
|
+
/**
|
|
80
|
+
Additional color list.
|
|
81
|
+
*/
|
|
82
|
+
presetColors: PropTypes.array,
|
|
83
|
+
/**
|
|
84
|
+
Change event handler.
|
|
85
|
+
*/
|
|
86
|
+
onChange: PropTypes.func,
|
|
87
|
+
/**
|
|
88
|
+
Add preset color event handler.
|
|
89
|
+
*/
|
|
90
|
+
onAddColor: PropTypes.func,
|
|
91
|
+
/**
|
|
92
|
+
Disable opacity selector.
|
|
93
|
+
*/
|
|
94
|
+
disableAlpha: PropTypes.bool,
|
|
95
|
+
/**
|
|
96
|
+
Input placement.
|
|
97
|
+
*/
|
|
98
|
+
placement: PropTypes.string,
|
|
99
|
+
/**
|
|
100
|
+
Define is mobile layout or not.
|
|
101
|
+
*/
|
|
102
|
+
isMobile: PropTypes.bool,
|
|
103
|
+
/**
|
|
104
|
+
Define popover custom styling.
|
|
105
|
+
*/
|
|
106
|
+
popoverCss: PropTypes.shape({}),
|
|
107
|
+
/**
|
|
108
|
+
Disabled state.
|
|
109
|
+
*/
|
|
110
|
+
disabled: PropTypes.bool
|
|
111
|
+
};
|
|
112
|
+
InputColorPicker.defaultProps = {
|
|
113
|
+
size: 'sm',
|
|
114
|
+
presetColors: ['#EF4444', '#F97316', '#FACC15', '#4ADE80', '#2DD4BF', '#3B82F6', '#6467F2', '#EC4899', '#F43F5E', '#D946EF', '#8B5CF6', '#0EA5E9', '#10B981', '#84CC16'],
|
|
115
|
+
placement: 'bottom-start',
|
|
116
|
+
isMobile: false,
|
|
117
|
+
popoverCss: {}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export { InputColorPicker as default };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var img = "data:image/gif;base64,R0lGODlh6gDHAOZ/AJkAAADM/zMzAAAzAP9QUAAzZoAAAGYzAGYAM/9mZmYAzGZmMzMzmQBmZv9mAJkAmTNmmZn/Zv/M/2YAZv/MzADMmZkz/5kA//8zmcwzmcwAmf8zAMwzAMwAAJkzM5kAM5n/MwBmmZlmADMzzAAzzAAA/wAAzDNm/wBm/wBmzP+Zmcxm/5lm/2aZmf+Z/wCZ//+ZAMyZAP///8xmmf//ZgDMZv8zzGb/zP/MZjOZM//MmQCZmZkzZjPM/8z//2b/mZmZ/wBmAP//zGYA/2b/ZswAZplmMwAAmQD/mZkAzACZAMz/zGZmmczM//+ZZv//ADPMzDOZZjNmzGZm/5nM//9m/zPMMwDMAGb//2bM////mcz/mZn/mf/MAMz/M2b/MwD//wAzmQAAZpnMAJkzmf8AAJkzAP8AZgCZM8wA/2aZ/5n/zAD/AP8A/8wAzP+ZM8z/ZjOZ/8xmAACZzDMz/2aZAP9mzP+Z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TvDfGfXP8t4mBmzu4uoUbfni8idu7uL6N+/t4iZGXO3m6lbd7OeaZZ7t5vp33+/mCoTc7OrSlT3u6tamrvvrSrTv9+nux8zx77ULfnjvSu/fu++/LBT/7z7XfXnTuu/PeOvPuOT989MZTn3zv2AMf+CaTb1L5Jpdvkvkmm2/Sefiw7/zJ1J9U/cnVn2T9ydafdA0/4AUbhclGkbJRsGwULxuFzEbhtv+B7QDSSJc02iWNeEmjXtLIlzRc97RAAAA7";
|
|
2
|
+
|
|
3
|
+
export { img as default };
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { EditableInput } from 'react-color/lib/components/common';
|
|
3
|
+
import Box from '../../../layout/box/Box.esm.js';
|
|
4
|
+
import Flex from '../../../layout/flex/Flex.esm.js';
|
|
5
|
+
import { ChevronUpDownOutline } from '@majoo-ui/icons';
|
|
6
|
+
import { styled } from '../../../config/stitches.config.esm.js';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
const CheckBoard = styled(Flex, {
|
|
10
|
+
background: '$bgwhite',
|
|
11
|
+
border: '1px solid #E5E7EB',
|
|
12
|
+
boxShadow: '0px 1px 2px rgba(31, 41, 55, 0.08)',
|
|
13
|
+
borderRadius: 4,
|
|
14
|
+
height: 28,
|
|
15
|
+
padding: '4px 6px',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
fontWeight: 400,
|
|
18
|
+
fontSize: 14
|
|
19
|
+
});
|
|
20
|
+
const editableInputStyle = {
|
|
21
|
+
input: {
|
|
22
|
+
maxWidth: 95,
|
|
23
|
+
background: '$bgwhite',
|
|
24
|
+
border: '1px solid #E5E7EB',
|
|
25
|
+
boxShadow: '0px 1px 2px rgba(31, 41, 55, 0.08)',
|
|
26
|
+
borderRadius: 4,
|
|
27
|
+
height: 28,
|
|
28
|
+
padding: '4px 6px',
|
|
29
|
+
width: '100%',
|
|
30
|
+
fontWeight: 400,
|
|
31
|
+
fontSize: 14,
|
|
32
|
+
outline: 'none'
|
|
33
|
+
},
|
|
34
|
+
label: {
|
|
35
|
+
display: 'none'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function ColorFields({
|
|
39
|
+
rgb,
|
|
40
|
+
hex,
|
|
41
|
+
check,
|
|
42
|
+
disableAlpha,
|
|
43
|
+
onChange,
|
|
44
|
+
onChangeCheck
|
|
45
|
+
}) {
|
|
46
|
+
return /*#__PURE__*/jsxs(Flex, {
|
|
47
|
+
direction: "row",
|
|
48
|
+
justify: "between",
|
|
49
|
+
gap: 2,
|
|
50
|
+
children: [/*#__PURE__*/jsxs(CheckBoard, {
|
|
51
|
+
justify: "between",
|
|
52
|
+
align: "center",
|
|
53
|
+
gap: 1,
|
|
54
|
+
onClick: onChangeCheck,
|
|
55
|
+
children: [check, /*#__PURE__*/jsx(ChevronUpDownOutline, {
|
|
56
|
+
color: "#9CA3AF",
|
|
57
|
+
size: 20
|
|
58
|
+
})]
|
|
59
|
+
}), check === 'Hex' ? /*#__PURE__*/jsxs(Box, {
|
|
60
|
+
css: {
|
|
61
|
+
position: 'relative'
|
|
62
|
+
},
|
|
63
|
+
children: [/*#__PURE__*/jsx(EditableInput, {
|
|
64
|
+
label: "hex",
|
|
65
|
+
style: {
|
|
66
|
+
input: {
|
|
67
|
+
...editableInputStyle.input,
|
|
68
|
+
paddingLeft: 16
|
|
69
|
+
},
|
|
70
|
+
label: {
|
|
71
|
+
...editableInputStyle.label
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
value: hex.replace('#', ''),
|
|
75
|
+
onChange: onChange
|
|
76
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
77
|
+
css: {
|
|
78
|
+
position: 'absolute',
|
|
79
|
+
top: 5,
|
|
80
|
+
left: 5,
|
|
81
|
+
bottom: 5,
|
|
82
|
+
userSelect: 'none',
|
|
83
|
+
color: '$gray400'
|
|
84
|
+
},
|
|
85
|
+
children: "#"
|
|
86
|
+
})]
|
|
87
|
+
}) : /*#__PURE__*/jsxs(React__default.Fragment, {
|
|
88
|
+
children: [/*#__PURE__*/jsx(EditableInput, {
|
|
89
|
+
label: "r",
|
|
90
|
+
style: editableInputStyle,
|
|
91
|
+
value: rgb.r,
|
|
92
|
+
onChange: onChange,
|
|
93
|
+
dragLabel: "true",
|
|
94
|
+
dragMax: "255"
|
|
95
|
+
}), /*#__PURE__*/jsx(EditableInput, {
|
|
96
|
+
label: "g",
|
|
97
|
+
style: editableInputStyle,
|
|
98
|
+
value: rgb.g,
|
|
99
|
+
onChange: onChange,
|
|
100
|
+
dragLabel: "true",
|
|
101
|
+
dragMax: "255"
|
|
102
|
+
}), /*#__PURE__*/jsx(EditableInput, {
|
|
103
|
+
label: "b",
|
|
104
|
+
style: editableInputStyle,
|
|
105
|
+
value: rgb.b,
|
|
106
|
+
onChange: onChange,
|
|
107
|
+
dragLabel: "true",
|
|
108
|
+
dragMax: "255"
|
|
109
|
+
})]
|
|
110
|
+
}), !disableAlpha && /*#__PURE__*/jsxs(Box, {
|
|
111
|
+
css: {
|
|
112
|
+
position: 'relative'
|
|
113
|
+
},
|
|
114
|
+
children: [/*#__PURE__*/jsx(EditableInput, {
|
|
115
|
+
label: "a",
|
|
116
|
+
style: {
|
|
117
|
+
input: {
|
|
118
|
+
...editableInputStyle.input,
|
|
119
|
+
paddingRight: 12,
|
|
120
|
+
width: 50
|
|
121
|
+
},
|
|
122
|
+
label: {
|
|
123
|
+
...editableInputStyle.label
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
value: Math.round(rgb.a * 100),
|
|
127
|
+
onChange: onChange,
|
|
128
|
+
dragLabel: "true",
|
|
129
|
+
dragMax: "100"
|
|
130
|
+
}), /*#__PURE__*/jsx(Box, {
|
|
131
|
+
css: {
|
|
132
|
+
position: 'absolute',
|
|
133
|
+
top: 5,
|
|
134
|
+
right: 5,
|
|
135
|
+
bottom: 5,
|
|
136
|
+
userSelect: 'none'
|
|
137
|
+
},
|
|
138
|
+
children: "%"
|
|
139
|
+
})]
|
|
140
|
+
})]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { ColorFields as default };
|