@sheetxl/studio-mui 0.7.26 → 0.7.28-beta.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/README.md +2 -2
- package/browser/cjs/BQJKf40kttQWOzLw.cjs +20 -0
- package/browser/cjs/BTZ5uzK0wHzpiZGC.cjs +1 -0
- package/browser/cjs/B_D3JKseVvpRyX-E.cjs +1 -0
- package/browser/cjs/B_WyRpeiesnEiNP4.cjs +11 -0
- package/browser/cjs/BeKpqOx8It0RD0Rf.cjs +2 -0
- package/browser/cjs/Bj-EvSYeDfqmU0V6.cjs +2 -0
- package/browser/cjs/Bo9Kx3L_XQkGPBJ5.cjs +1 -0
- package/browser/cjs/ByIEqNsvj52sihT9.cjs +5 -0
- package/browser/cjs/C3moehR3VOd0LnmM.cjs +1 -0
- package/browser/cjs/C97KHSuikAbr1qVM.cjs +1 -0
- package/browser/cjs/CJLwX_A3y3TQUmzj.cjs +1 -0
- package/browser/cjs/CPSc2VSYZeZ1B9mi.cjs +1 -0
- package/browser/cjs/CPcBvw4ZPwHVTUZF.cjs +1 -0
- package/browser/cjs/CZm1jVZaHQ246prW.cjs +1 -0
- package/browser/cjs/CdDYyAfccXme8w6m.cjs +1 -0
- package/browser/cjs/DBJLJGiCGXesx5n6.cjs +1 -0
- package/browser/cjs/DLScL5AOXhHu9O9H.cjs +7 -0
- package/browser/cjs/Djsiad0Qha1Y-YaS.cjs +1 -0
- package/browser/cjs/IASAYG6qgv7lJY7y.cjs +1 -0
- package/browser/cjs/KZvriGbhEOVkQD0b.cjs +1 -0
- package/browser/cjs/UnMhi28mbvLiOXQe.cjs +1 -0
- package/browser/cjs/Vbigo0kFP3PFfmeA.cjs +1 -0
- package/browser/cjs/iMWEL01eC83oU-YY.cjs +1 -0
- package/browser/cjs/index.cjs +2 -7
- package/browser/cjs/w2GjebPlOFv3pCbm.cjs +1 -0
- package/browser/cjs/zQsyZpeXAvcVXJMs.cjs +1 -0
- package/browser/esm/0EONOhVZ7oT0C_G2.mjs +1150 -0
- package/browser/esm/5x7evORpymnb5SfW.mjs +129 -0
- package/browser/esm/BACBR1jjcpJbhOWA.mjs +191 -0
- package/browser/esm/BPZne8WpzrkWOH6L.mjs +47 -0
- package/browser/esm/BeKa8xVj69hAVKRN.mjs +155 -0
- package/browser/esm/BeQ9bqOvNNP-arFP.mjs +219 -0
- package/browser/esm/Bf3PIOM6U-NmWk2O.mjs +20 -0
- package/browser/esm/C4BPDYeqgN59wMGp.mjs +411 -0
- package/browser/esm/CGbn_xdhgTvk2mvb.mjs +612 -0
- package/browser/esm/CKADOp3hTx0MSNY7.mjs +52 -0
- package/browser/esm/CR2sUEZyRqVv2SNl.mjs +105 -0
- package/browser/esm/CTN8J8c1AneJu3Lu.mjs +2207 -0
- package/browser/esm/Cc5akPEmIwbgKIfc.mjs +516 -0
- package/browser/esm/CePKCTL6D05kDy2E.mjs +82 -0
- package/browser/esm/DBM1blcMTZMAM-eR.mjs +217 -0
- package/browser/esm/DPBnKqhSuJ414Pxx.mjs +99 -0
- package/browser/esm/F51tGfYHocox80zY.mjs +468 -0
- package/browser/esm/SDzKpaiuhQux7tAh.mjs +5391 -0
- package/browser/esm/TDH9XceS8cAkO5d3.mjs +508 -0
- package/browser/esm/XKVlG-x_9q5dbVIW.mjs +8878 -0
- package/browser/esm/fJiwyUQJ18X-cCQz.mjs +1376 -0
- package/browser/esm/fel6EbPAcZOsBmks.mjs +42 -0
- package/browser/esm/flvjZEXrSDrtDzLB.mjs +113 -0
- package/browser/esm/index.mjs +152 -91
- package/licenses/dependencies.txt +137 -627
- package/node/esm/B9-0usA1hSoD0Nk3.mjs +679 -0
- package/node/esm/BO1vNzjGWYdZdbq9.mjs +113 -0
- package/node/esm/BYigefA8bf9FOVib.mjs +47 -0
- package/node/esm/BdrLZp98HQaVMykZ.mjs +82 -0
- package/node/esm/BlubX7gm8wTUNiZ-.mjs +106 -0
- package/node/esm/C8a6QwMGW1tMiWA6.mjs +516 -0
- package/node/esm/CCCnorMn30oUDDIY.mjs +4536 -0
- package/node/esm/CKpik3HRSANKEy4G.mjs +99 -0
- package/node/esm/CTZcfST8pUcLMail.mjs +509 -0
- package/node/esm/D1K9Ji7iQwnOnd1-.mjs +190 -0
- package/node/esm/DuUiuB59bQRPQi-D.mjs +155 -0
- package/node/esm/eKP73GEWmonTXpfv.mjs +470 -0
- package/node/esm/g3y8kxL1Ln214UNr.mjs +129 -0
- package/node/esm/index.mjs +10603 -2832
- package/package.json +27 -27
- package/resources/contents.json +30 -0
- package/resources/locales/contents.json +44 -0
- package/resources/locales/de/groups.cmd.json +219 -0
- package/resources/locales/de/studio.cmd.json +159 -0
- package/resources/locales/de/ui.msg.json +507 -0
- package/resources/locales/en/groups.cmd.json +219 -0
- package/resources/locales/en/studio.cmd.json +159 -0
- package/resources/locales/en/ui.msg.json +508 -0
- package/types/index.d.ts +2 -1761
- package/types/src/anchorItems/AnchorItemsDescriptor.d.ts +131 -0
- package/types/src/anchorItems/AnchorItemsPanel.d.ts +29 -0
- package/types/src/anchorItems/index.d.ts +3 -0
- package/types/src/border/BorderPopupButton.d.ts +30 -0
- package/types/src/border/BorderStylePopupButton.d.ts +40 -0
- package/types/src/border/index.d.ts +3 -0
- package/types/src/chart/command/InsertChartCommandButton.d.ts +10 -0
- package/types/src/chart/command/index.d.ts +2 -0
- package/types/src/color/Alpha.d.ts +36 -0
- package/types/src/color/Checkboard.d.ts +11 -0
- package/types/src/color/CheckboardUtils.d.ts +3 -0
- package/types/src/color/ColorButton.d.ts +21 -0
- package/types/src/color/ColorButtonList.d.ts +17 -0
- package/types/src/color/ColorPanel.d.ts +71 -0
- package/types/src/color/ColorPopupButton.d.ts +29 -0
- package/types/src/color/CustomColorPanel.d.ts +16 -0
- package/types/src/color/EditableInput.d.ts +22 -0
- package/types/src/color/Hue.d.ts +29 -0
- package/types/src/color/Saturation.d.ts +45 -0
- package/types/src/color/SketchFields.d.ts +9 -0
- package/types/src/color/Swatch.d.ts +16 -0
- package/types/src/color/Types.d.ts +11 -0
- package/types/src/color/_Utils.d.ts +4 -0
- package/types/src/color/index.d.ts +7 -0
- package/types/src/command/AccountingStyleCommandButton.d.ts +18 -0
- package/types/src/command/AppearanceCommandButton.d.ts +3 -0
- package/types/src/command/BorderCommandButton.d.ts +20 -0
- package/types/src/command/ColorCommandButton.d.ts +23 -0
- package/types/src/command/DocThemeCommandButton.d.ts +19 -0
- package/types/src/command/FileCommandButton.d.ts +8 -0
- package/types/src/command/FontFamilyCommandButton.d.ts +9 -0
- package/types/src/command/FontSizeCommandButton.d.ts +21 -0
- package/types/src/command/InsertFunctionCommandPopupButton.d.ts +9 -0
- package/types/src/command/InsertFunctionSumCommandPopupButton.d.ts +8 -0
- package/types/src/command/LanguageCommandButton.d.ts +19 -0
- package/types/src/command/LocaleCommandButton.d.ts +17 -0
- package/types/src/command/NumberFormatCommandButton.d.ts +6 -0
- package/types/src/command/PasteCommandButton.d.ts +14 -0
- package/types/src/command/PresetCellStylesCommandButton.d.ts +11 -0
- package/types/src/command/PresetTableStylesCommandButton.d.ts +12 -0
- package/types/src/command/RegisterCatalog.d.ts +3 -0
- package/types/src/command/SheetCommandGroups.d.ts +10 -0
- package/types/src/command/SheetZoomCommandButton.d.ts +9 -0
- package/types/src/command/StudioCommandGroups.d.ts +11 -0
- package/types/src/command/TextEffectsCommandButton.d.ts +6 -0
- package/types/src/command/TextRotateGroupButton.d.ts +14 -0
- package/types/src/command/UndoRedoCommandButton.d.ts +14 -0
- package/types/src/command/WalkingCopyCommandButton.d.ts +6 -0
- package/types/src/command/WorkbookCommandGroups.d.ts +11 -0
- package/types/src/command/index.d.ts +23 -0
- package/types/src/conditionalFormat/ColorScaleRulePanel.d.ts +18 -0
- package/types/src/conditionalFormat/ConditionalFormatDetailsPanel.d.ts +23 -0
- package/types/src/conditionalFormat/ConditionalFormatDetailsTaskPane.d.ts +4 -0
- package/types/src/conditionalFormat/ConditionalFormatEditorPanel.d.ts +20 -0
- package/types/src/conditionalFormat/ConditionalFormatPlugin.d.ts +2 -0
- package/types/src/conditionalFormat/ConditionalFormatRangeField.d.ts +32 -0
- package/types/src/conditionalFormat/ConditionalFormatStylePicker.d.ts +34 -0
- package/types/src/conditionalFormat/ConditionalFormatTitle.d.ts +10 -0
- package/types/src/conditionalFormat/DataBarRulePanel.d.ts +23 -0
- package/types/src/conditionalFormat/IconSetRulePanel.d.ts +23 -0
- package/types/src/conditionalFormat/PresetChip.d.ts +30 -0
- package/types/src/conditionalFormat/PresetScalesCommandButton.d.ts +20 -0
- package/types/src/conditionalFormat/RulePreview.d.ts +23 -0
- package/types/src/conditionalFormat/RuleSection.d.ts +20 -0
- package/types/src/conditionalFormat/ScaleMiniGrid.d.ts +59 -0
- package/types/src/conditionalFormat/ScaleStopRow.d.ts +34 -0
- package/types/src/conditionalFormat/index.d.ts +3 -0
- package/types/src/conditionalFormat/previewColor.d.ts +50 -0
- package/types/src/conditions/AverageOption.d.ts +25 -0
- package/types/src/conditions/BetweenOption.d.ts +25 -0
- package/types/src/conditions/BooleanOption.d.ts +24 -0
- package/types/src/conditions/CombinatorOption.d.ts +41 -0
- package/types/src/conditions/ConditionEditor.d.ts +57 -0
- package/types/src/conditions/ConditionUtils.d.ts +83 -0
- package/types/src/conditions/DateTimeOption.d.ts +43 -0
- package/types/src/conditions/ExpressionOption.d.ts +26 -0
- package/types/src/conditions/InSetOption.d.ts +37 -0
- package/types/src/conditions/NumberOption.d.ts +24 -0
- package/types/src/conditions/OperatorAndParamEditor.d.ts +55 -0
- package/types/src/conditions/OperatorSelect.d.ts +35 -0
- package/types/src/conditions/OperatorSelectPopupButton.d.ts +39 -0
- package/types/src/conditions/ScalarOption.d.ts +29 -0
- package/types/src/conditions/SelectorSelect.d.ts +43 -0
- package/types/src/conditions/StringOption.d.ts +24 -0
- package/types/src/conditions/TimePeriodOption.d.ts +25 -0
- package/types/src/conditions/TopNOption.d.ts +25 -0
- package/types/src/conditions/index.d.ts +13 -0
- package/types/src/dataValidation/DataValidationDetailsPanel.d.ts +16 -0
- package/types/src/dataValidation/DataValidationDetailsTaskPane.d.ts +3 -0
- package/types/src/dataValidation/DataValidationEditorPanel.d.ts +12 -0
- package/types/src/dataValidation/DataValidationPlugin.d.ts +2 -0
- package/types/src/dataValidation/index.d.ts +2 -0
- package/types/src/debug/DebugUtils.d.ts +4 -0
- package/types/src/debug/index.d.ts +2 -0
- package/types/src/dialog/CommentsDialog.d.ts +11 -0
- package/types/src/dialog/FindReplaceWindow.d.ts +13 -0
- package/types/src/dialog/HyperlinkDialog.d.ts +28 -0
- package/types/src/dialog/InsertFunctionDialog.d.ts +25 -0
- package/types/src/dialog/NamedReferenceDialog.d.ts +17 -0
- package/types/src/dialog/NumberFormatDialog.d.ts +12 -0
- package/types/src/dialog/ResizeHeaderDialog.d.ts +15 -0
- package/types/src/dialog/ShortcutKeysDialog.d.ts +9 -0
- package/types/src/dialog/ShortcutKeysPanel.d.ts +28 -0
- package/types/src/dialog/SortDialog.d.ts +9 -0
- package/types/src/dialog/TableNewDialog.d.ts +14 -0
- package/types/src/dialog/WorkbookStatisticsDialog.d.ts +13 -0
- package/types/src/dialog/index.d.ts +10 -0
- package/types/src/filter/ColumnMenu.d.ts +13 -0
- package/types/src/filter/FilterList.d.ts +28 -0
- package/types/src/filter/index.d.ts +3 -0
- package/types/src/form/FormulaField.d.ts +221 -0
- package/types/src/form/InputField.d.ts +89 -0
- package/types/src/form/index.d.ts +3 -0
- package/types/src/formulaBar/FormulaBar.d.ts +8 -0
- package/types/src/formulaBar/IFormulaBar.d.ts +51 -0
- package/types/src/formulaBar/index.d.ts +3 -0
- package/types/src/function/FunctionArgumentsPanel.d.ts +57 -0
- package/types/src/function/FunctionSearchPanel.d.ts +35 -0
- package/types/src/function/InsertFunctionWizard.d.ts +79 -0
- package/types/src/function/index.d.ts +4 -0
- package/types/src/function/paneMetrics.d.ts +33 -0
- package/types/src/index.d.ts +21 -0
- package/types/src/itemsPanel/EditorPanel.d.ts +21 -0
- package/types/src/itemsPanel/ItemCard.d.ts +57 -0
- package/types/src/itemsPanel/ItemsDescriptor.d.ts +215 -0
- package/types/src/itemsPanel/ItemsPanel.d.ts +45 -0
- package/types/src/itemsPanel/SortableCards.d.ts +67 -0
- package/types/src/itemsPanel/index.d.ts +6 -0
- package/types/src/movable/MovableContextMenu.d.ts +13 -0
- package/types/src/movable/index.d.ts +2 -0
- package/types/src/named/INamedCollectionEditor.d.ts +37 -0
- package/types/src/named/NamedCollectionEditor.d.ts +7 -0
- package/types/src/named/NamedDetailsPanel.d.ts +11 -0
- package/types/src/named/NamedDetailsTaskPane.d.ts +3 -0
- package/types/src/named/NamedDraft.d.ts +68 -0
- package/types/src/named/NamedEditorPanel.d.ts +19 -0
- package/types/src/named/NamedPlugin.d.ts +2 -0
- package/types/src/named/index.d.ts +8 -0
- package/types/src/numberFormat/NumberFormatPanel.d.ts +29 -0
- package/types/src/numberFormat/NumberFormatTaskPane.d.ts +12 -0
- package/types/src/numberFormat/index.d.ts +8 -0
- package/types/src/protectedRange/ProtectedRangeDetailsPanel.d.ts +20 -0
- package/types/src/protectedRange/ProtectedRangeDetailsTaskPane.d.ts +3 -0
- package/types/src/protectedRange/ProtectedRangeEditorPanel.d.ts +27 -0
- package/types/src/protectedRange/ProtectedRangePlugin.d.ts +2 -0
- package/types/src/protectedRange/index.d.ts +2 -0
- package/types/src/protection/WorkbookProtectionDialog.d.ts +23 -0
- package/types/src/protection/WorkbookProtectionPanel.d.ts +51 -0
- package/types/src/protection/index.d.ts +3 -0
- package/types/src/sheet/SheetTabMenu.d.ts +21 -0
- package/types/src/sheet/SheetsAllMenu.d.ts +16 -0
- package/types/src/sheet/index.d.ts +3 -0
- package/types/src/statusBar/NumberStats.d.ts +27 -0
- package/types/src/statusBar/SheetZoomScale.d.ts +11 -0
- package/types/src/statusBar/StatusBar.d.ts +35 -0
- package/types/src/statusBar/index.d.ts +4 -0
- package/types/src/studio/CommandsWrapper.d.ts +36 -0
- package/types/src/studio/DefaultLogo.d.ts +3 -0
- package/types/src/studio/EagerStudio.d.ts +5 -0
- package/types/src/studio/Studio.d.ts +26 -0
- package/types/src/studio/StudioCommandProvider.d.ts +26 -0
- package/types/src/studio/StudioCommands.d.ts +115 -0
- package/types/src/studio/StudioNotifierProvider.d.ts +10 -0
- package/types/src/studio/StudioProps.d.ts +372 -0
- package/types/src/studio/StudioSplitPane.d.ts +60 -0
- package/types/src/studio/StudioTaskPaneArea.d.ts +8 -0
- package/types/src/studio/StudioToolbar.d.ts +37 -0
- package/types/src/studio/index.d.ts +4 -0
- package/types/src/studio/useStudioApp.d.ts +51 -0
- package/types/src/table/TableDetailsPanel.d.ts +17 -0
- package/types/src/table/TableDetailsTaskPane.d.ts +3 -0
- package/types/src/table/TablePlugin.d.ts +2 -0
- package/types/src/table/TableStyleCanvasPreview.d.ts +21 -0
- package/types/src/table/TableStyleOptionsPanel.d.ts +38 -0
- package/types/src/table/TableStylePreview.d.ts +43 -0
- package/types/src/table/index.d.ts +7 -0
- package/types/src/theme/ThemeSelectButton.d.ts +23 -0
- package/types/src/theme/ThemeSelectPanel.d.ts +17 -0
- package/types/src/theme/ThemeSelectPopupButton.d.ts +24 -0
- package/types/src/theme/ThemeUtils.d.ts +57 -0
- package/types/src/theme/index.d.ts +5 -0
- package/types/src/toast/ToastError.d.ts +10 -0
- package/types/src/toast/index.d.ts +2 -0
- package/types/src/toolbar/WorkbookToolbars.d.ts +46 -0
- package/types/src/toolbar/index.d.ts +2 -0
- package/types/src/workbook/DefaultRenderers.d.ts +23 -0
- package/types/src/workbook/DocumentTitle.d.ts +69 -0
- package/types/src/workbook/WorkbookContextMenu.d.ts +13 -0
- package/types/src/workbook/WorkbookElement.d.ts +12 -0
- package/types/src/workbook/WorkbookStrip.d.ts +37 -0
- package/types/src/workbook/index.d.ts +7 -0
- package/browser/cjs/52tjAlO48FpZgfzG.cjs +0 -6
- package/browser/cjs/BGu2_YqVJMQjYx4D.cjs +0 -18
- package/browser/cjs/C83Rzj_Jwq-o69wr.cjs +0 -42
- package/browser/cjs/CldYLQnjFC_g8o3t.cjs +0 -6
- package/browser/cjs/Cpv3j_Ra1h-axLRG.cjs +0 -6
- package/browser/cjs/D-5Cg1Y0zALF_JEs.cjs +0 -7
- package/browser/cjs/D58sOTRZwQ59CgOf.cjs +0 -6
- package/browser/cjs/DEd-0xEuUoELRnQb.cjs +0 -6
- package/browser/cjs/DahKlfm68zudpndW.cjs +0 -20
- package/browser/cjs/Dd7t0gfO3bzS0-B8.cjs +0 -6
- package/browser/cjs/DxAU6DV3UCUDVoSH.cjs +0 -6
- package/browser/cjs/uj7GSwDaUyTKEjrN.cjs +0 -6
- package/browser/esm/BLuR1D2n--9QSJL9.mjs +0 -26
- package/browser/esm/BSOhdb74viwmCi54.mjs +0 -2159
- package/browser/esm/BTAhrEfV-DH0-Ldk.mjs +0 -640
- package/browser/esm/BgsyX5QL9OLy0DN3.mjs +0 -4533
- package/browser/esm/CFPGs5_tLGrpkW8L.mjs +0 -25
- package/browser/esm/CbCX3t0hx-h6pV7Q.mjs +0 -46
- package/browser/esm/D3dDP89ml0258MGb.mjs +0 -53
- package/browser/esm/DYk55y6IEOCytW3g.mjs +0 -50
- package/browser/esm/DfUqOxFfhJcaq847.mjs +0 -2411
- package/browser/esm/DhWeeZyxUc-LbP8E.mjs +0 -50
- package/browser/esm/DqLDLUCqiFovdBf0.mjs +0 -155
- package/browser/esm/Dvo0k3olgFuAso_O.mjs +0 -54
- package/node/assets/style.css +0 -1
- package/node/esm/BM_pvbGlgXydGNT3.mjs +0 -52
- package/node/esm/CFBcwLP2q2_EUXvE.mjs +0 -156
- package/node/esm/Cg9JFB8nOnVfR0Uo.mjs +0 -26
- package/node/esm/D3kxA1LpG-PpZvCb.mjs +0 -25
- package/node/esm/D_s6w_GWb8l7uGW3.mjs +0 -53
- package/node/esm/XI3nj4zD7mXOyxSm.mjs +0 -57
- package/node/esm/YXQgUYqP1qsi_MPX.mjs +0 -46
- package/node/esm/m2lejeU-ViEhFj_N.mjs +0 -91
- package/node/esm/sevERUPIPJCb-jYL.mjs +0 -88
- package/node/esm/zdjaq7yEfEvgHrDi.mjs +0 -50
|
@@ -0,0 +1,679 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license @sheetxl/studio-mui - Studio - Spreadsheet UI built with SheetXL SDK using React & MUI. - v0.7.28-beta.1
|
|
3
|
+
*
|
|
4
|
+
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
+
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
+
*/
|
|
7
|
+
import { x as e } from "./index.mjs";
|
|
8
|
+
import { ReactUtils as t } from "@sheetxl/utils-react";
|
|
9
|
+
import { Component as n, PureComponent as i, memo as s, useCallback as r, useLayoutEffect as o, useState as a } from "react";
|
|
10
|
+
import { jsx as l, jsxs as h } from "react/jsx-runtime";
|
|
11
|
+
import { Box as p, useTheme as d } from "@mui/material";
|
|
12
|
+
import u from "tinycolor2";
|
|
13
|
+
var g = class extends (i || n) {
|
|
14
|
+
constructor(...e) {
|
|
15
|
+
super(...e), this.handleChange = (e) => {
|
|
16
|
+
const t = ((e, t, n, i) => {
|
|
17
|
+
const s = i.clientWidth, r = i.clientHeight, o = "number" == typeof e.pageX ? e.pageX : e.touches[0].pageX, a = "number" == typeof e.pageY ? e.pageY : e.touches[0].pageY, l = o - (i.getBoundingClientRect().left + window.pageXOffset), h = a - (i.getBoundingClientRect().top + window.pageYOffset);
|
|
18
|
+
if ("vertical" === t) {
|
|
19
|
+
let e;
|
|
20
|
+
if (e = h < 0 ? 359 : h > r ? 0 : 360 * (-100 * h / r + 100) / 100, n.h !== e) return {
|
|
21
|
+
h: e,
|
|
22
|
+
s: n.s,
|
|
23
|
+
l: n.l,
|
|
24
|
+
a: n.a,
|
|
25
|
+
source: "hsl"
|
|
26
|
+
};
|
|
27
|
+
} else {
|
|
28
|
+
let e;
|
|
29
|
+
if (e = l < 0 ? 0 : l > s ? 359 : 100 * l / s * 360 / 100, n.h !== e) return {
|
|
30
|
+
h: e,
|
|
31
|
+
s: n.s,
|
|
32
|
+
l: n.l,
|
|
33
|
+
a: n.a,
|
|
34
|
+
source: "hsl"
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
})(e, this.props.direction, this.props.hsl, this.container);
|
|
39
|
+
t && "function" == typeof this.props.onChange && this.props.onChange(t, e);
|
|
40
|
+
}, this.handleMouseDown = (e) => {
|
|
41
|
+
this.handleChange(e), window.addEventListener("mousemove", this.handleChange), window.addEventListener("mouseup", this.handleMouseUp);
|
|
42
|
+
}, this.handleMouseUp = () => {
|
|
43
|
+
this.unbindEventListeners();
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
componentWillUnmount() {
|
|
47
|
+
this.unbindEventListeners();
|
|
48
|
+
}
|
|
49
|
+
unbindEventListeners() {
|
|
50
|
+
window.removeEventListener("mousemove", this.handleChange), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
53
|
+
const e = this.props.direction ?? "horizontal", t = "vertical" === e, n = {
|
|
54
|
+
hue: {
|
|
55
|
+
position: "absolute",
|
|
56
|
+
top: "0px",
|
|
57
|
+
right: "0px",
|
|
58
|
+
bottom: "0px",
|
|
59
|
+
left: "0px",
|
|
60
|
+
borderRadius: this.props.radius,
|
|
61
|
+
boxShadow: this.props.shadow
|
|
62
|
+
},
|
|
63
|
+
container: {
|
|
64
|
+
padding: "0 2px",
|
|
65
|
+
position: "relative",
|
|
66
|
+
height: "100%",
|
|
67
|
+
borderRadius: this.props.radius
|
|
68
|
+
},
|
|
69
|
+
pointer: {
|
|
70
|
+
position: "absolute",
|
|
71
|
+
left: t ? "0px" : 100 * this.props.hsl.h / 360 + "%",
|
|
72
|
+
...t ? { top: -100 * this.props.hsl.h / 360 + 100 + "%" } : {}
|
|
73
|
+
},
|
|
74
|
+
slider: {
|
|
75
|
+
marginTop: "1px",
|
|
76
|
+
width: "4px",
|
|
77
|
+
borderRadius: "1px",
|
|
78
|
+
height: "8px",
|
|
79
|
+
boxShadow: "0 0 2px rgba(0, 0, 0, .6)",
|
|
80
|
+
background: "#fff",
|
|
81
|
+
transform: "translateX(-2px)"
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
return l("div", {
|
|
85
|
+
style: n.hue,
|
|
86
|
+
children: h("div", {
|
|
87
|
+
className: `hue-${e}`,
|
|
88
|
+
style: n.container,
|
|
89
|
+
ref: (e) => {
|
|
90
|
+
this.container = e;
|
|
91
|
+
},
|
|
92
|
+
onMouseDown: this.handleMouseDown,
|
|
93
|
+
onTouchMove: this.handleChange,
|
|
94
|
+
onTouchStart: this.handleChange,
|
|
95
|
+
children: [l("style", { children: "\n .hue-horizontal {\n background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n .hue-vertical {\n background: linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n background: -webkit-linear-gradient(to top, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);\n }\n " }), l("div", {
|
|
96
|
+
style: n.pointer,
|
|
97
|
+
children: this.props.pointer ? l(this.props.pointer, { ...this.props }) : l("div", { style: n.slider })
|
|
98
|
+
})]
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}, c = class extends (i || n) {
|
|
103
|
+
constructor(...e) {
|
|
104
|
+
super(...e), this.handleChange = (e) => {
|
|
105
|
+
const t = ((e, t, n, i, s) => {
|
|
106
|
+
const r = s.clientWidth, o = s.clientHeight, a = "number" == typeof e.pageX ? e.pageX : e.touches[0].pageX, l = "number" == typeof e.pageY ? e.pageY : e.touches[0].pageY, h = a - (s.getBoundingClientRect().left + window.pageXOffset), p = l - (s.getBoundingClientRect().top + window.pageYOffset);
|
|
107
|
+
if ("vertical" === n) {
|
|
108
|
+
let e;
|
|
109
|
+
if (e = p < 0 ? 0 : p > o ? 1 : Math.round(100 * p / o) / 100, t.a !== e) return {
|
|
110
|
+
h: t.h,
|
|
111
|
+
s: t.s,
|
|
112
|
+
l: t.l,
|
|
113
|
+
a: e,
|
|
114
|
+
source: "rgb"
|
|
115
|
+
};
|
|
116
|
+
} else {
|
|
117
|
+
let e;
|
|
118
|
+
if (e = h < 0 ? 0 : h > r ? 1 : Math.round(100 * h / r) / 100, i !== e) return {
|
|
119
|
+
h: t.h,
|
|
120
|
+
s: t.s,
|
|
121
|
+
l: t.l,
|
|
122
|
+
a: e,
|
|
123
|
+
source: "rgb"
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
return null;
|
|
127
|
+
})(e, this.props.hsl, this.props.direction, this.props.a, this.container);
|
|
128
|
+
t && "function" == typeof this.props.onChange && this.props.onChange(t, e);
|
|
129
|
+
}, this.handleMouseDown = (e) => {
|
|
130
|
+
this.handleChange(e), window.addEventListener("mousemove", this.handleChange), window.addEventListener("mouseup", this.handleMouseUp);
|
|
131
|
+
}, this.handleMouseUp = () => {
|
|
132
|
+
this.unbindEventListeners();
|
|
133
|
+
}, this.unbindEventListeners = () => {
|
|
134
|
+
window.removeEventListener("mousemove", this.handleChange), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
componentWillUnmount() {
|
|
138
|
+
this.unbindEventListeners();
|
|
139
|
+
}
|
|
140
|
+
render() {
|
|
141
|
+
const { rgb: t } = this.props, n = "vertical" === this.props.direction, i = {
|
|
142
|
+
position: "absolute",
|
|
143
|
+
top: "0px",
|
|
144
|
+
right: "0px",
|
|
145
|
+
bottom: "0px",
|
|
146
|
+
left: "0px"
|
|
147
|
+
}, s = `linear-gradient(to right, rgba(${t.r},${t.g},${t.b}, 0) 0%,\n rgba(${t.r},${t.g},${t.b}, 1) 100%)`, r = `linear-gradient(to bottom, rgba(${t.r},${t.g},${t.b}, 0) 0%,\n rgba(${t.r},${t.g},${t.b}, 1) 100%)`, o = {
|
|
148
|
+
alpha: {
|
|
149
|
+
...i,
|
|
150
|
+
borderRadius: this.props.radius
|
|
151
|
+
},
|
|
152
|
+
checkboard: {
|
|
153
|
+
...i,
|
|
154
|
+
overflow: "hidden",
|
|
155
|
+
borderRadius: this.props.radius
|
|
156
|
+
},
|
|
157
|
+
gradient: {
|
|
158
|
+
...i,
|
|
159
|
+
background: n ? r : s,
|
|
160
|
+
boxShadow: this.props.shadow,
|
|
161
|
+
borderRadius: this.props.radius
|
|
162
|
+
},
|
|
163
|
+
container: {
|
|
164
|
+
position: "relative",
|
|
165
|
+
height: "100%",
|
|
166
|
+
margin: "0 3px"
|
|
167
|
+
},
|
|
168
|
+
pointer: {
|
|
169
|
+
position: "absolute",
|
|
170
|
+
left: n ? 0 : 100 * t.a + "%",
|
|
171
|
+
...n ? { top: 100 * t.a + "%" } : {}
|
|
172
|
+
},
|
|
173
|
+
slider: {
|
|
174
|
+
width: "4px",
|
|
175
|
+
borderRadius: "1px",
|
|
176
|
+
height: "8px",
|
|
177
|
+
boxShadow: "0 0 2px rgba(0, 0, 0, .6)",
|
|
178
|
+
background: "#fff",
|
|
179
|
+
marginTop: "1px",
|
|
180
|
+
transform: "translateX(-2px)"
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
return h("div", {
|
|
184
|
+
style: o.alpha,
|
|
185
|
+
children: [
|
|
186
|
+
l("div", {
|
|
187
|
+
style: o.checkboard,
|
|
188
|
+
children: l(e, {
|
|
189
|
+
grey: "rgba(0,0,0,.08)",
|
|
190
|
+
renderers: this.props.renderers
|
|
191
|
+
})
|
|
192
|
+
}),
|
|
193
|
+
l("div", { style: o.gradient }),
|
|
194
|
+
l("div", {
|
|
195
|
+
style: o.container,
|
|
196
|
+
ref: (e) => {
|
|
197
|
+
this.container = e;
|
|
198
|
+
},
|
|
199
|
+
onMouseDown: this.handleMouseDown,
|
|
200
|
+
onTouchMove: this.handleChange,
|
|
201
|
+
onTouchStart: this.handleChange,
|
|
202
|
+
children: l("div", {
|
|
203
|
+
style: o.pointer,
|
|
204
|
+
children: this.props.pointer ? l(this.props.pointer, { ...this.props }) : l("div", { style: o.slider })
|
|
205
|
+
})
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}, b = [38, 40], f = 1, v = class extends (i || n) {
|
|
211
|
+
constructor(e) {
|
|
212
|
+
super(e), this.handleBlur = () => {
|
|
213
|
+
this.state.blurValue && this.setState({
|
|
214
|
+
value: this.state.blurValue,
|
|
215
|
+
blurValue: null
|
|
216
|
+
});
|
|
217
|
+
}, this.handleChange = (e) => {
|
|
218
|
+
this.setUpdatedValue(e.target.value, e);
|
|
219
|
+
}, this.handleKeyDown = (e) => {
|
|
220
|
+
const t = ((e) => Number(String(e).replace(/%/g, "")))(e.target.value);
|
|
221
|
+
if (!isNaN(t) && (n = e.keyCode, b.indexOf(n) > -1)) {
|
|
222
|
+
const n = this.getArrowOffset(), i = 38 === e.keyCode ? t + n : t - n;
|
|
223
|
+
this.setUpdatedValue(i, e);
|
|
224
|
+
}
|
|
225
|
+
var n;
|
|
226
|
+
}, this.handleDrag = (e) => {
|
|
227
|
+
if (this.props.dragLabel) {
|
|
228
|
+
const t = Math.round(this.props.value + e.movementX);
|
|
229
|
+
t >= 0 && t <= this.props.dragMax && this.props.onChange && this.props.onChange(this.getValueObjectWithLabel(t), e);
|
|
230
|
+
}
|
|
231
|
+
}, this.handleMouseDown = (e) => {
|
|
232
|
+
this.props.dragLabel && (e.preventDefault(), this.handleDrag(e), window.addEventListener("mousemove", this.handleDrag), window.addEventListener("mouseup", this.handleMouseUp));
|
|
233
|
+
}, this.handleMouseUp = () => {
|
|
234
|
+
this.unbindEventListeners();
|
|
235
|
+
}, this.unbindEventListeners = () => {
|
|
236
|
+
window.removeEventListener("mousemove", this.handleDrag), window.removeEventListener("mouseup", this.handleMouseUp);
|
|
237
|
+
}, this.state = {
|
|
238
|
+
value: String(e.value).toUpperCase(),
|
|
239
|
+
blurValue: String(e.value).toUpperCase()
|
|
240
|
+
}, this.inputId = "rc-editable-input-" + f++;
|
|
241
|
+
}
|
|
242
|
+
componentDidUpdate(e, t) {
|
|
243
|
+
this.props.value === this.state.value || e.value === this.props.value && t.value === this.state.value || (this.input === document.activeElement ? this.setState({ blurValue: String(this.props.value).toUpperCase() }) : this.setState({
|
|
244
|
+
value: String(this.props.value).toUpperCase(),
|
|
245
|
+
blurValue: !this.state.blurValue && String(this.props.value).toUpperCase()
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
componentWillUnmount() {
|
|
249
|
+
this.unbindEventListeners();
|
|
250
|
+
}
|
|
251
|
+
getValueObjectWithLabel(e) {
|
|
252
|
+
return { [this.props.label]: e };
|
|
253
|
+
}
|
|
254
|
+
getArrowOffset() {
|
|
255
|
+
return this.props.arrowOffset || 1;
|
|
256
|
+
}
|
|
257
|
+
setUpdatedValue(e, t) {
|
|
258
|
+
const n = this.props.label ? this.getValueObjectWithLabel(e) : e;
|
|
259
|
+
this.props.onChange && this.props.onChange(n, t), this.setState({ value: e });
|
|
260
|
+
}
|
|
261
|
+
render() {
|
|
262
|
+
const e = this.props.style || {}, t = {
|
|
263
|
+
wrap: {
|
|
264
|
+
position: "relative",
|
|
265
|
+
...e.wrap || {}
|
|
266
|
+
},
|
|
267
|
+
input: { ...e.input || {} },
|
|
268
|
+
label: {
|
|
269
|
+
...e.label || {},
|
|
270
|
+
...this.props.dragLabel ? { cursor: "ew-resize" } : {}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
return h("div", {
|
|
274
|
+
style: t.wrap,
|
|
275
|
+
children: [l("input", {
|
|
276
|
+
id: this.inputId,
|
|
277
|
+
style: t.input,
|
|
278
|
+
ref: (e) => {
|
|
279
|
+
this.input = e;
|
|
280
|
+
},
|
|
281
|
+
value: this.state.value,
|
|
282
|
+
onKeyDown: this.handleKeyDown,
|
|
283
|
+
onChange: this.handleChange,
|
|
284
|
+
onBlur: this.handleBlur,
|
|
285
|
+
placeholder: this.props.placeholder,
|
|
286
|
+
spellCheck: "false"
|
|
287
|
+
}), this.props.label && !this.props.hideLabel ? l("label", {
|
|
288
|
+
htmlFor: this.inputId,
|
|
289
|
+
style: t.label,
|
|
290
|
+
onMouseDown: this.handleMouseDown,
|
|
291
|
+
children: this.props.label
|
|
292
|
+
}) : null]
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}, x = ({ onChange: e, rgb: t, hsl: n, hex: i, disableAlpha: s }) => {
|
|
296
|
+
const r = {
|
|
297
|
+
fields: {
|
|
298
|
+
display: "flex",
|
|
299
|
+
paddingTop: "4px"
|
|
300
|
+
},
|
|
301
|
+
single: {
|
|
302
|
+
flex: "1",
|
|
303
|
+
paddingLeft: "6px"
|
|
304
|
+
},
|
|
305
|
+
alpha: {
|
|
306
|
+
flex: "1",
|
|
307
|
+
paddingLeft: "6px",
|
|
308
|
+
...s ? { display: "none" } : {}
|
|
309
|
+
},
|
|
310
|
+
double: { flex: "2" },
|
|
311
|
+
input: {
|
|
312
|
+
width: "80%",
|
|
313
|
+
padding: "4px 10% 3px",
|
|
314
|
+
border: "none",
|
|
315
|
+
boxShadow: "inset 0 0 0 1px #ccc",
|
|
316
|
+
fontSize: "11px"
|
|
317
|
+
},
|
|
318
|
+
label: {
|
|
319
|
+
display: "block",
|
|
320
|
+
textAlign: "center",
|
|
321
|
+
fontSize: "11px",
|
|
322
|
+
color: "#222",
|
|
323
|
+
paddingTop: "3px",
|
|
324
|
+
paddingBottom: "4px",
|
|
325
|
+
textTransform: "capitalize"
|
|
326
|
+
}
|
|
327
|
+
}, o = (i, s) => {
|
|
328
|
+
i.hex ? ((e) => {
|
|
329
|
+
if ("transparent" === e) return !0;
|
|
330
|
+
const t = "#" === String(e).charAt(0) ? 1 : 0;
|
|
331
|
+
return e.length !== 4 + t && e.length < 7 + t && u(e).isValid();
|
|
332
|
+
})(i.hex) && e({
|
|
333
|
+
hex: i.hex,
|
|
334
|
+
source: "hex"
|
|
335
|
+
}, s) : i.r || i.g || i.b ? e({
|
|
336
|
+
r: i.r || t.r,
|
|
337
|
+
g: i.g || t.g,
|
|
338
|
+
b: i.b || t.b,
|
|
339
|
+
a: t.a,
|
|
340
|
+
source: "rgb"
|
|
341
|
+
}, s) : i.a && (i.a < 0 ? i.a = 0 : i.a > 100 && (i.a = 100), i.a /= 100, e({
|
|
342
|
+
h: n.h,
|
|
343
|
+
s: n.s,
|
|
344
|
+
l: n.l,
|
|
345
|
+
a: i.a,
|
|
346
|
+
source: "rgb"
|
|
347
|
+
}, s));
|
|
348
|
+
};
|
|
349
|
+
return h("div", {
|
|
350
|
+
style: r.fields,
|
|
351
|
+
className: "flexbox-fix",
|
|
352
|
+
children: [
|
|
353
|
+
l("div", {
|
|
354
|
+
style: r.double,
|
|
355
|
+
children: l(v, {
|
|
356
|
+
style: {
|
|
357
|
+
input: r.input,
|
|
358
|
+
label: r.label
|
|
359
|
+
},
|
|
360
|
+
label: "hex",
|
|
361
|
+
value: i.replace("#", ""),
|
|
362
|
+
onChange: o
|
|
363
|
+
})
|
|
364
|
+
}),
|
|
365
|
+
l("div", {
|
|
366
|
+
style: r.single,
|
|
367
|
+
children: l(v, {
|
|
368
|
+
style: {
|
|
369
|
+
input: r.input,
|
|
370
|
+
label: r.label
|
|
371
|
+
},
|
|
372
|
+
label: "r",
|
|
373
|
+
value: t.r,
|
|
374
|
+
onChange: o,
|
|
375
|
+
dragLabel: "true",
|
|
376
|
+
dragMax: "255"
|
|
377
|
+
})
|
|
378
|
+
}),
|
|
379
|
+
l("div", {
|
|
380
|
+
style: r.single,
|
|
381
|
+
children: l(v, {
|
|
382
|
+
style: {
|
|
383
|
+
input: r.input,
|
|
384
|
+
label: r.label
|
|
385
|
+
},
|
|
386
|
+
label: "g",
|
|
387
|
+
value: t.g,
|
|
388
|
+
onChange: o,
|
|
389
|
+
dragLabel: "true",
|
|
390
|
+
dragMax: "255"
|
|
391
|
+
})
|
|
392
|
+
}),
|
|
393
|
+
l("div", {
|
|
394
|
+
style: r.single,
|
|
395
|
+
children: l(v, {
|
|
396
|
+
style: {
|
|
397
|
+
input: r.input,
|
|
398
|
+
label: r.label
|
|
399
|
+
},
|
|
400
|
+
label: "b",
|
|
401
|
+
value: t.b,
|
|
402
|
+
onChange: o,
|
|
403
|
+
dragLabel: "true",
|
|
404
|
+
dragMax: "255"
|
|
405
|
+
})
|
|
406
|
+
}),
|
|
407
|
+
l("div", {
|
|
408
|
+
style: r.alpha,
|
|
409
|
+
children: l(v, {
|
|
410
|
+
style: {
|
|
411
|
+
input: r.input,
|
|
412
|
+
label: r.label
|
|
413
|
+
},
|
|
414
|
+
label: "a",
|
|
415
|
+
value: Math.round(100 * t.a),
|
|
416
|
+
onChange: o,
|
|
417
|
+
dragLabel: "true",
|
|
418
|
+
dragMax: "100"
|
|
419
|
+
})
|
|
420
|
+
})
|
|
421
|
+
]
|
|
422
|
+
});
|
|
423
|
+
}, m = class extends (i || n) {
|
|
424
|
+
constructor(e) {
|
|
425
|
+
super(e), this.handleChange = (e) => {
|
|
426
|
+
"function" == typeof this.props.onChange && this.throttle(this.props.onChange, ((e, t, n) => {
|
|
427
|
+
var i = n.getBoundingClientRect(), s = i.width, r = i.height, o = "number" == typeof e.pageX ? e.pageX : e.touches[0].pageX, a = "number" == typeof e.pageY ? e.pageY : e.touches[0].pageY, l = o - (n.getBoundingClientRect().left + window.pageXOffset), h = a - (n.getBoundingClientRect().top + window.pageYOffset);
|
|
428
|
+
l < 0 ? l = 0 : l > s && (l = s), h < 0 ? h = 0 : h > r && (h = r);
|
|
429
|
+
var p = l / s, d = 1 - h / r;
|
|
430
|
+
return {
|
|
431
|
+
h: t.h,
|
|
432
|
+
s: p,
|
|
433
|
+
v: d,
|
|
434
|
+
a: t.a,
|
|
435
|
+
source: "hsv"
|
|
436
|
+
};
|
|
437
|
+
})(e, this.props.hsl, this.container), e), e.preventDefault();
|
|
438
|
+
}, this.handleMouseDown = (e) => {
|
|
439
|
+
this.handleChange(e);
|
|
440
|
+
const t = this.getContainerRenderWindow();
|
|
441
|
+
t.addEventListener("mousemove", this.handleChange), t.addEventListener("mouseup", this.handleMouseUp);
|
|
442
|
+
}, this.handleMouseUp = (e) => {
|
|
443
|
+
e.preventDefault(), this.unbindEventListeners();
|
|
444
|
+
}, this.throttle = function(e, t, n) {
|
|
445
|
+
let i, s, r, o;
|
|
446
|
+
var a = 0;
|
|
447
|
+
n || (n = {});
|
|
448
|
+
let l = function() {
|
|
449
|
+
a = !1 === n.leading ? 0 : Date.now(), i = null, o = e.apply(s, r), i || (s = r = null);
|
|
450
|
+
}, h = function() {
|
|
451
|
+
var h = Date.now();
|
|
452
|
+
a || !1 !== n.leading || (a = h);
|
|
453
|
+
var p = t - (h - a);
|
|
454
|
+
return s = this, r = arguments, p <= 0 || p > t ? (i && (clearTimeout(i), i = null), a = h, o = e.apply(s, r), i || (s = r = null)) : i || !1 === n.trailing || (i = setTimeout(l, p)), o;
|
|
455
|
+
};
|
|
456
|
+
return h.cancel = function() {
|
|
457
|
+
clearTimeout(i), a = 0, i = s = r = null;
|
|
458
|
+
}, h;
|
|
459
|
+
}((e, t, n) => {
|
|
460
|
+
e(t, n);
|
|
461
|
+
}, 50);
|
|
462
|
+
}
|
|
463
|
+
componentWillUnmount() {
|
|
464
|
+
this.throttle.cancel(), this.unbindEventListeners();
|
|
465
|
+
}
|
|
466
|
+
getContainerRenderWindow() {
|
|
467
|
+
const { container: e } = this;
|
|
468
|
+
let t = window;
|
|
469
|
+
for (; !t.document.contains(e) && t.parent !== t;) t = t.parent;
|
|
470
|
+
return t;
|
|
471
|
+
}
|
|
472
|
+
unbindEventListeners() {
|
|
473
|
+
const e = this.getContainerRenderWindow();
|
|
474
|
+
e.removeEventListener("mousemove", this.handleChange), e.removeEventListener("mouseup", this.handleMouseUp);
|
|
475
|
+
}
|
|
476
|
+
render() {
|
|
477
|
+
const { color: e, white: t, black: n, pointer: i, circle: s } = this.props || {}, r = {
|
|
478
|
+
position: "absolute",
|
|
479
|
+
top: "0px",
|
|
480
|
+
left: "0px",
|
|
481
|
+
right: "0px",
|
|
482
|
+
bottom: "0px"
|
|
483
|
+
}, o = {
|
|
484
|
+
color: {
|
|
485
|
+
...r,
|
|
486
|
+
backgroundColor: `hsl(${this.props.hsl?.h},100%, 50%)`,
|
|
487
|
+
borderRadius: this.props.style?.borderRadius
|
|
488
|
+
},
|
|
489
|
+
white: {
|
|
490
|
+
...r,
|
|
491
|
+
borderRadius: this.props.style?.borderRadius
|
|
492
|
+
},
|
|
493
|
+
black: {
|
|
494
|
+
...r,
|
|
495
|
+
boxShadow: this.props.style?.boxShadow,
|
|
496
|
+
borderRadius: this.props.style?.borderRadius
|
|
497
|
+
},
|
|
498
|
+
pointer: {
|
|
499
|
+
...r,
|
|
500
|
+
top: -100 * this.props.hsv?.v + 100 + "%",
|
|
501
|
+
left: 100 * this.props.hsv?.s + "%",
|
|
502
|
+
cursor: "default"
|
|
503
|
+
},
|
|
504
|
+
circle: {
|
|
505
|
+
width: "4px",
|
|
506
|
+
height: "4px",
|
|
507
|
+
boxShadow: "0 0 0 1.5px #fff, inset 0 0 1px 1px rgba(0,0,0,.3),\n 0 0 1px 2px rgba(0,0,0,.4)",
|
|
508
|
+
borderRadius: "50%",
|
|
509
|
+
cursor: "hand",
|
|
510
|
+
transform: "translate(-2px, -2px)"
|
|
511
|
+
}
|
|
512
|
+
};
|
|
513
|
+
return h("div", {
|
|
514
|
+
style: o.color,
|
|
515
|
+
ref: (e) => this.container = e,
|
|
516
|
+
onMouseDown: this.handleMouseDown,
|
|
517
|
+
onTouchMove: this.handleChange,
|
|
518
|
+
onTouchStart: this.handleChange,
|
|
519
|
+
children: [l("style", { children: "\n .saturation-white {\n background: -webkit-linear-gradient(to right, #fff, rgba(255,255,255,0));\n background: linear-gradient(to right, #fff, rgba(255,255,255,0));\n }\n .saturation-black {\n background: -webkit-linear-gradient(to top, #000, rgba(0,0,0,0));\n background: linear-gradient(to top, #000, rgba(0,0,0,0));\n }\n " }), h("div", {
|
|
520
|
+
style: o.white,
|
|
521
|
+
className: "saturation-white",
|
|
522
|
+
children: [l("div", {
|
|
523
|
+
style: o.black,
|
|
524
|
+
className: "saturation-black"
|
|
525
|
+
}), l("div", {
|
|
526
|
+
style: o.pointer,
|
|
527
|
+
children: this.props.pointer ? l(this.props.pointer, { ...this.props }) : l("div", { style: o.circle })
|
|
528
|
+
})]
|
|
529
|
+
})]
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}, w = (e, t = null) => {
|
|
533
|
+
const n = e.hex ? u(e.hex) : u(e || "transparent"), i = n.toHsl(), s = n.toHsv(), r = n.toRgb(), o = n.toHex();
|
|
534
|
+
return 0 === i.s && (i.h = t ?? 0, s.h = t ?? 0), {
|
|
535
|
+
hsl: i,
|
|
536
|
+
hex: "#" + o,
|
|
537
|
+
rgb: r,
|
|
538
|
+
hsv: s,
|
|
539
|
+
source: e.source
|
|
540
|
+
};
|
|
541
|
+
}, y = s((n) => {
|
|
542
|
+
const { selectedColor: i, onColorChange: s, renderers: u, disableAlpha: b = !1, style: f = t.EmptyCssProperties, ...v } = n, y = d(), [C, L] = a(() => w(i)), [M, E] = a(C.hsl.h ?? 0), k = r((e) => {
|
|
543
|
+
let t = w(e, M);
|
|
544
|
+
return E(t.hsl.h ?? 0), L(t), t;
|
|
545
|
+
}, [M]), R = r((e) => {
|
|
546
|
+
const t = k(e), n = `rgba(${t.rgb.r},${t.rgb.g},${t.rgb.b},${b ? 1 : t.rgb.a})`;
|
|
547
|
+
s?.(n);
|
|
548
|
+
}, [
|
|
549
|
+
s,
|
|
550
|
+
k,
|
|
551
|
+
b
|
|
552
|
+
]);
|
|
553
|
+
o(() => {
|
|
554
|
+
k(i);
|
|
555
|
+
}, [i, k]);
|
|
556
|
+
const S = l("div", {
|
|
557
|
+
style: {
|
|
558
|
+
position: "relative",
|
|
559
|
+
minHeight: "10px",
|
|
560
|
+
maxHeight: "10px",
|
|
561
|
+
width: "100%"
|
|
562
|
+
},
|
|
563
|
+
children: l(c, {
|
|
564
|
+
style: {
|
|
565
|
+
radius: "2px",
|
|
566
|
+
shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
|
|
567
|
+
},
|
|
568
|
+
rgb: C.rgb,
|
|
569
|
+
hsl: C.hsl,
|
|
570
|
+
renderers: u,
|
|
571
|
+
onChange: R
|
|
572
|
+
})
|
|
573
|
+
});
|
|
574
|
+
return h("div", {
|
|
575
|
+
style: {
|
|
576
|
+
display: "flex",
|
|
577
|
+
flexDirection: "column",
|
|
578
|
+
...f
|
|
579
|
+
},
|
|
580
|
+
...v,
|
|
581
|
+
children: [
|
|
582
|
+
l("div", {
|
|
583
|
+
style: {
|
|
584
|
+
width: "100%",
|
|
585
|
+
flex: "1 1 100%",
|
|
586
|
+
position: "relative",
|
|
587
|
+
overflow: "hidden"
|
|
588
|
+
},
|
|
589
|
+
children: l(m, {
|
|
590
|
+
style: {
|
|
591
|
+
borderRadius: "3px",
|
|
592
|
+
boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
|
|
593
|
+
},
|
|
594
|
+
hsl: C.hsl,
|
|
595
|
+
hsv: C.hsv,
|
|
596
|
+
onChange: R
|
|
597
|
+
})
|
|
598
|
+
}),
|
|
599
|
+
h("div", {
|
|
600
|
+
style: {
|
|
601
|
+
marginTop: "4px",
|
|
602
|
+
display: "flex",
|
|
603
|
+
gap: "4px"
|
|
604
|
+
},
|
|
605
|
+
children: [h("div", {
|
|
606
|
+
style: {
|
|
607
|
+
flex: "1",
|
|
608
|
+
display: "flex",
|
|
609
|
+
flexDirection: b ? "row" : "column",
|
|
610
|
+
justifyContent: "space-between",
|
|
611
|
+
alignItems: "center"
|
|
612
|
+
},
|
|
613
|
+
children: [l("div", {
|
|
614
|
+
style: {
|
|
615
|
+
position: "relative",
|
|
616
|
+
minHeight: "10px",
|
|
617
|
+
maxHeight: "10px",
|
|
618
|
+
width: "100%"
|
|
619
|
+
},
|
|
620
|
+
children: l(g, {
|
|
621
|
+
style: {
|
|
622
|
+
radius: "2px",
|
|
623
|
+
shadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
|
|
624
|
+
},
|
|
625
|
+
hsl: C.hsl,
|
|
626
|
+
onChange: R
|
|
627
|
+
})
|
|
628
|
+
}), b ? null : S]
|
|
629
|
+
}), h("div", {
|
|
630
|
+
style: {
|
|
631
|
+
minWidth: "24px",
|
|
632
|
+
maxWidth: "24px",
|
|
633
|
+
minHeight: "24px",
|
|
634
|
+
maxHeight: "24px",
|
|
635
|
+
position: "relative",
|
|
636
|
+
borderRadius: "1px",
|
|
637
|
+
overflow: "hidden"
|
|
638
|
+
},
|
|
639
|
+
children: [l(e, { grey: y.palette.text.icon ?? y.palette.action.active }), l("div", { style: {
|
|
640
|
+
position: "absolute",
|
|
641
|
+
height: "100%",
|
|
642
|
+
width: "100%",
|
|
643
|
+
background: `rgba(${C.rgb.r},${C.rgb.g},${C.rgb.b},${b ? 1 : C.rgb.a})`,
|
|
644
|
+
boxShadow: "inset 0 0 0 1px rgba(0,0,0,.15), inset 0 0 4px rgba(0,0,0,.25)"
|
|
645
|
+
} })]
|
|
646
|
+
})]
|
|
647
|
+
}),
|
|
648
|
+
l(p, {
|
|
649
|
+
sx: {
|
|
650
|
+
marginBottom: "4px",
|
|
651
|
+
"& label": {
|
|
652
|
+
fontFamily: (e) => `${e.typography.fontFamily} !important`,
|
|
653
|
+
color: (e) => `${e.palette.text.secondary} !important`
|
|
654
|
+
},
|
|
655
|
+
"& *": {
|
|
656
|
+
fontFamily: (e) => `${e.typography.fontFamily} !important`,
|
|
657
|
+
userSelect: "none"
|
|
658
|
+
},
|
|
659
|
+
"& input": {
|
|
660
|
+
paddingLeft: (e) => `${e.spacing(.5)} !important`,
|
|
661
|
+
paddingRight: (e) => `${e.spacing(.5)} !important`,
|
|
662
|
+
outline: "none",
|
|
663
|
+
boxSizing: "border-box",
|
|
664
|
+
width: "100% !important",
|
|
665
|
+
textAlign: "center"
|
|
666
|
+
}
|
|
667
|
+
},
|
|
668
|
+
children: l(x, {
|
|
669
|
+
rgb: C.rgb,
|
|
670
|
+
hsl: C.hsl,
|
|
671
|
+
hex: C.hex,
|
|
672
|
+
disableAlpha: b,
|
|
673
|
+
onChange: R
|
|
674
|
+
})
|
|
675
|
+
})
|
|
676
|
+
]
|
|
677
|
+
});
|
|
678
|
+
});
|
|
679
|
+
export { y as CustomColorPanel, y as default };
|