react-science 23.1.0 → 24.0.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/lib/components/accordion/accordion_context.d.ts +1 -1
- package/lib/components/accordion/accordion_context.js +3 -3
- package/lib/components/accordion/accordion_context.js.map +1 -1
- package/lib/components/accordion/accordion_context_provider.d.ts.map +1 -1
- package/lib/components/accordion/accordion_context_provider.js +3 -3
- package/lib/components/accordion/accordion_context_provider.js.map +1 -1
- package/lib/components/accordion/accordion_hooks.js +3 -3
- package/lib/components/accordion/accordion_hooks.js.map +1 -1
- package/lib/components/button/Button.d.ts.map +1 -1
- package/lib/components/button/Button.js +3 -2
- package/lib/components/button/Button.js.map +1 -1
- package/lib/components/color-picker/react-color/ColorPicker.d.ts +2 -2
- package/lib/components/color-picker/react-color/ColorPicker.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/ColorPicker.js +25 -22
- package/lib/components/color-picker/react-color/ColorPicker.js.map +1 -1
- package/lib/components/color-picker/react-color/common/Alpha.d.ts +1 -2
- package/lib/components/color-picker/react-color/common/Alpha.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/Alpha.js +5 -6
- package/lib/components/color-picker/react-color/common/Alpha.js.map +1 -1
- package/lib/components/color-picker/react-color/common/CheckBoard.d.ts +1 -2
- package/lib/components/color-picker/react-color/common/CheckBoard.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/CheckBoard.js +2 -3
- package/lib/components/color-picker/react-color/common/CheckBoard.js.map +1 -1
- package/lib/components/color-picker/react-color/common/EditableInput.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/EditableInput.js +30 -26
- package/lib/components/color-picker/react-color/common/EditableInput.js.map +1 -1
- package/lib/components/color-picker/react-color/common/Hue.d.ts +1 -2
- package/lib/components/color-picker/react-color/common/Hue.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/Hue.js +5 -6
- package/lib/components/color-picker/react-color/common/Hue.js.map +1 -1
- package/lib/components/color-picker/react-color/common/Saturation.d.ts +1 -2
- package/lib/components/color-picker/react-color/common/Saturation.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/Saturation.js +6 -7
- package/lib/components/color-picker/react-color/common/Saturation.js.map +1 -1
- package/lib/components/color-picker/react-color/common/Swatch.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/Swatch.js +10 -11
- package/lib/components/color-picker/react-color/common/Swatch.js.map +1 -1
- package/lib/components/color-picker/react-color/common/interaction.d.ts +1 -1
- package/lib/components/color-picker/react-color/common/interaction.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/common/interaction.js +9 -9
- package/lib/components/color-picker/react-color/common/interaction.js.map +1 -1
- package/lib/components/color-picker/react-color/common/useOnChange.js +2 -2
- package/lib/components/color-picker/react-color/common/useOnChange.js.map +1 -1
- package/lib/components/color-picker/react-color/helpers/alpha.d.ts +1 -1
- package/lib/components/color-picker/react-color/helpers/alpha.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/helpers/alpha.js +4 -5
- package/lib/components/color-picker/react-color/helpers/alpha.js.map +1 -1
- package/lib/components/color-picker/react-color/helpers/color.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/helpers/color.js +15 -13
- package/lib/components/color-picker/react-color/helpers/color.js.map +1 -1
- package/lib/components/color-picker/react-color/helpers/hue.d.ts +1 -1
- package/lib/components/color-picker/react-color/helpers/hue.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/helpers/hue.js +14 -23
- package/lib/components/color-picker/react-color/helpers/hue.js.map +1 -1
- package/lib/components/color-picker/react-color/helpers/saturation.d.ts +1 -1
- package/lib/components/color-picker/react-color/helpers/saturation.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/helpers/saturation.js +3 -3
- package/lib/components/color-picker/react-color/helpers/saturation.js.map +1 -1
- package/lib/components/color-picker/react-color/sketch/SketchFields.d.ts +1 -1
- package/lib/components/color-picker/react-color/sketch/SketchFields.d.ts.map +1 -1
- package/lib/components/color-picker/react-color/sketch/SketchFields.js +6 -6
- package/lib/components/color-picker/react-color/sketch/SketchFields.js.map +1 -1
- package/lib/components/color-picker/react-color/sketch/SketchPresetColors.js +8 -8
- package/lib/components/color-picker/react-color/sketch/SketchPresetColors.js.map +1 -1
- package/lib/components/dialog/ConfirmDialog.js +2 -2
- package/lib/components/dialog/ConfirmDialog.js.map +1 -1
- package/lib/components/draggable/draggable.d.ts.map +1 -1
- package/lib/components/draggable/draggable.js +10 -9
- package/lib/components/draggable/draggable.js.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.d.ts.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.js +8 -8
- package/lib/components/form/components/field_groups/svg_text_style.js.map +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.schema.js +1 -1
- package/lib/components/form/components/field_groups/svg_text_style.schema.js.map +1 -1
- package/lib/components/form/components/input/checkbox.js +3 -3
- package/lib/components/form/components/input/checkbox.js.map +1 -1
- package/lib/components/form/components/input/color_picker.js +1 -1
- package/lib/components/form/components/input/color_picker.js.map +1 -1
- package/lib/components/form/components/input/draggable_numeric_input.js +1 -1
- package/lib/components/form/components/input/draggable_numeric_input.js.map +1 -1
- package/lib/components/form/components/input/index.d.ts +1 -0
- package/lib/components/form/components/input/index.d.ts.map +1 -1
- package/lib/components/form/components/input/input.js +1 -1
- package/lib/components/form/components/input/input.js.map +1 -1
- package/lib/components/form/components/input/numeric_input.js +1 -1
- package/lib/components/form/components/input/numeric_input.js.map +1 -1
- package/lib/components/form/components/input/radio_group.js +1 -1
- package/lib/components/form/components/input/radio_group.js.map +1 -1
- package/lib/components/form/components/input/select.js +1 -1
- package/lib/components/form/components/input/select.js.map +1 -1
- package/lib/components/form/components/input/switch.js +1 -1
- package/lib/components/form/components/input/switch.js.map +1 -1
- package/lib/components/form/components/input/textarea.js +1 -1
- package/lib/components/form/components/input/textarea.js.map +1 -1
- package/lib/components/form/components/input_groups/form.js +2 -2
- package/lib/components/form/components/input_groups/form.js.map +1 -1
- package/lib/components/form/components/input_groups/form_context.d.ts +1 -1
- package/lib/components/form/components/input_groups/form_context.js +3 -3
- package/lib/components/form/components/input_groups/form_context.js.map +1 -1
- package/lib/components/form/components/layout/form.d.ts +1 -1
- package/lib/components/form/components/layout/form.d.ts.map +1 -1
- package/lib/components/form/components/layout/form.js +1 -4
- package/lib/components/form/components/layout/form.js.map +1 -1
- package/lib/components/form/utils/validators.d.ts +14 -8
- package/lib/components/form/utils/validators.d.ts.map +1 -1
- package/lib/components/form/utils/validators.js +11 -11
- package/lib/components/form/utils/validators.js.map +1 -1
- package/lib/components/fullscreen/fullscreen_context.d.ts +1 -1
- package/lib/components/fullscreen/fullscreen_context.js +3 -3
- package/lib/components/fullscreen/fullscreen_context.js.map +1 -1
- package/lib/components/fullscreen/fullscreen_context.provider.d.ts +1 -3
- package/lib/components/fullscreen/fullscreen_context.provider.d.ts.map +1 -1
- package/lib/components/fullscreen/fullscreen_context.provider.js +3 -3
- package/lib/components/fullscreen/fullscreen_context.provider.js.map +1 -1
- package/lib/components/hooks/useDoubleClick.js +8 -8
- package/lib/components/hooks/useDoubleClick.js.map +1 -1
- package/lib/components/hooks/useOnClickOutside.js +2 -2
- package/lib/components/hooks/useOnClickOutside.js.map +1 -1
- package/lib/components/hooks/useOnOff.d.ts +1 -1
- package/lib/components/hooks/useOnOff.d.ts.map +1 -1
- package/lib/components/hooks/useOnOff.js +5 -5
- package/lib/components/hooks/useOnOff.js.map +1 -1
- package/lib/components/hooks/useSelect.d.ts.map +1 -1
- package/lib/components/hooks/useSelect.js +4 -3
- package/lib/components/hooks/useSelect.js.map +1 -1
- package/lib/components/hooks/useToggle.d.ts +1 -1
- package/lib/components/hooks/useToggle.d.ts.map +1 -1
- package/lib/components/hooks/useToggle.js +2 -2
- package/lib/components/hooks/useToggle.js.map +1 -1
- package/lib/components/info-panel/InfoPanel.d.ts.map +1 -1
- package/lib/components/info-panel/InfoPanel.js +10 -13
- package/lib/components/info-panel/InfoPanel.js.map +1 -1
- package/lib/components/input/radio-button-group/RadioButtonGroup.d.ts.map +1 -1
- package/lib/components/input/radio-button-group/RadioButtonGroup.js +3 -2
- package/lib/components/input/radio-button-group/RadioButtonGroup.js.map +1 -1
- package/lib/components/logger/FifoLoggerDialog.d.ts.map +1 -1
- package/lib/components/logger/FifoLoggerDialog.js +3 -1
- package/lib/components/logger/FifoLoggerDialog.js.map +1 -1
- package/lib/components/logger/FifoLoggerProvider.d.ts.map +1 -1
- package/lib/components/logger/FifoLoggerProvider.js +2 -2
- package/lib/components/logger/FifoLoggerProvider.js.map +1 -1
- package/lib/components/logger/loggerContext.d.ts +1 -1
- package/lib/components/logger/loggerContext.js +1 -1
- package/lib/components/logger/useFifoLogger.d.ts.map +1 -1
- package/lib/components/logger/useFifoLogger.js +7 -5
- package/lib/components/logger/useFifoLogger.js.map +1 -1
- package/lib/components/root-layout/root_layout.d.ts.map +1 -1
- package/lib/components/root-layout/root_layout.js +5 -3
- package/lib/components/root-layout/root_layout.js.map +1 -1
- package/lib/components/root-layout/root_layout_context.d.ts +1 -1
- package/lib/components/root-layout/root_layout_context.js +3 -3
- package/lib/components/root-layout/root_layout_context.js.map +1 -1
- package/lib/components/root-layout/root_layout_context.provider.js +2 -2
- package/lib/components/root-layout/root_layout_context.provider.js.map +1 -1
- package/lib/components/selected-total/SelectedTotal.js +1 -1
- package/lib/components/selected-total/SelectedTotal.js.map +1 -1
- package/lib/components/split_pane/split_pane.d.ts.map +1 -1
- package/lib/components/split_pane/split_pane.js +14 -18
- package/lib/components/split_pane/split_pane.js.map +1 -1
- package/lib/components/split_pane/split_pane_helpers.js +1 -1
- package/lib/components/split_pane/split_pane_helpers.js.map +1 -1
- package/lib/components/split_pane/use_split_pane_size.d.ts.map +1 -1
- package/lib/components/split_pane/use_split_pane_size.js +4 -3
- package/lib/components/split_pane/use_split_pane_size.js.map +1 -1
- package/lib/components/table/default_table_cell.d.ts.map +1 -1
- package/lib/components/table/default_table_cell.js +6 -14
- package/lib/components/table/default_table_cell.js.map +1 -1
- package/lib/components/table/flash_row/flashed_row_context.d.ts +1 -1
- package/lib/components/table/flash_row/flashed_row_context.js +3 -3
- package/lib/components/table/flash_row/flashed_row_context.js.map +1 -1
- package/lib/components/table/flash_row/flashed_row_provider.d.ts.map +1 -1
- package/lib/components/table/flash_row/flashed_row_provider.js +5 -4
- package/lib/components/table/flash_row/flashed_row_provider.js.map +1 -1
- package/lib/components/table/flash_row/use_flash_row_effect.d.ts.map +1 -1
- package/lib/components/table/flash_row/use_flash_row_effect.js +6 -5
- package/lib/components/table/flash_row/use_flash_row_effect.js.map +1 -1
- package/lib/components/table/preview_table.js +2 -2
- package/lib/components/table/preview_table.js.map +1 -1
- package/lib/components/table/preview_table_context.d.ts +2 -2
- package/lib/components/table/preview_table_context.js +6 -6
- package/lib/components/table/preview_table_context.js.map +1 -1
- package/lib/components/table/reorder_rows/draggable_row_context.d.ts +4 -6
- package/lib/components/table/reorder_rows/draggable_row_context.d.ts.map +1 -1
- package/lib/components/table/reorder_rows/draggable_row_context.js +3 -3
- package/lib/components/table/reorder_rows/draggable_row_context.js.map +1 -1
- package/lib/components/table/reorder_rows/draggable_row_tr.d.ts.map +1 -1
- package/lib/components/table/reorder_rows/draggable_row_tr.js +4 -3
- package/lib/components/table/reorder_rows/draggable_row_tr.js.map +1 -1
- package/lib/components/table/reorder_rows/item_order_context.d.ts +2 -2
- package/lib/components/table/reorder_rows/item_order_context.d.ts.map +1 -1
- package/lib/components/table/reorder_rows/item_order_context.js +3 -3
- package/lib/components/table/reorder_rows/item_order_context.js.map +1 -1
- package/lib/components/table/reorder_rows/item_order_provider.d.ts.map +1 -1
- package/lib/components/table/reorder_rows/item_order_provider.js +2 -2
- package/lib/components/table/reorder_rows/item_order_provider.js.map +1 -1
- package/lib/components/table/reorder_rows/use_drop_monitor.d.ts +2 -2
- package/lib/components/table/reorder_rows/use_drop_monitor.d.ts.map +1 -1
- package/lib/components/table/reorder_rows/use_drop_monitor.js +4 -4
- package/lib/components/table/reorder_rows/use_drop_monitor.js.map +1 -1
- package/lib/components/table/table_body.d.ts.map +1 -1
- package/lib/components/table/table_body.js +10 -6
- package/lib/components/table/table_body.js.map +1 -1
- package/lib/components/table/table_features.js +7 -7
- package/lib/components/table/table_features.js.map +1 -1
- package/lib/components/table/table_header_cell.d.ts +1 -1
- package/lib/components/table/table_header_cell.d.ts.map +1 -1
- package/lib/components/table/table_root.d.ts +2 -2
- package/lib/components/table/table_root.d.ts.map +1 -1
- package/lib/components/table/table_root.js +12 -12
- package/lib/components/table/table_root.js.map +1 -1
- package/lib/components/table/table_utils.d.ts +1 -1
- package/lib/components/table/table_utils.d.ts.map +1 -1
- package/lib/components/table/table_utils.js.map +1 -1
- package/lib/components/table/use_table_columns.d.ts +2 -2
- package/lib/components/table/use_table_columns.d.ts.map +1 -1
- package/lib/components/table/use_table_columns.js +4 -4
- package/lib/components/table/use_table_columns.js.map +1 -1
- package/lib/components/table/use_table_scroll.d.ts.map +1 -1
- package/lib/components/table/use_table_scroll.js +13 -15
- package/lib/components/table/use_table_scroll.js.map +1 -1
- package/lib/components/toolbar/OverflowButton.js +5 -5
- package/lib/components/toolbar/OverflowButton.js.map +1 -1
- package/lib/components/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/components/toolbar/Toolbar.js +5 -8
- package/lib/components/toolbar/Toolbar.js.map +1 -1
- package/lib/components/toolbar/TooltipHelpContent.d.ts.map +1 -1
- package/lib/components/toolbar/TooltipHelpContent.js +5 -2
- package/lib/components/toolbar/TooltipHelpContent.js.map +1 -1
- package/lib/components/toolbar/toolbarContext.d.ts +3 -3
- package/lib/components/toolbar/toolbarContext.d.ts.map +1 -1
- package/lib/components/toolbar/toolbarContext.js +4 -4
- package/lib/components/toolbar/toolbarContext.js.map +1 -1
- package/lib/components/toolbar/useCheckOverflow.d.ts.map +1 -1
- package/lib/components/toolbar/useCheckOverflow.js +1 -0
- package/lib/components/toolbar/useCheckOverflow.js.map +1 -1
- package/lib/components/utils/debounce.d.ts +1 -1
- package/lib/components/utils/debounce.d.ts.map +1 -1
- package/lib/components/utils/debounce.js +3 -3
- package/lib/components/utils/debounce.js.map +1 -1
- package/lib/components/utils/forward_all_props_except.d.ts +2 -0
- package/lib/components/utils/forward_all_props_except.d.ts.map +1 -0
- package/lib/components/utils/{shouldForwardPropExcept.js → forward_all_props_except.js} +2 -2
- package/lib/components/utils/forward_all_props_except.js.map +1 -0
- package/lib/components/utils/svg.d.ts.map +1 -1
- package/lib/components/utils/svg.js +12 -6
- package/lib/components/utils/svg.js.map +1 -1
- package/lib/components/utils/svg_path_builder.d.ts +8 -8
- package/lib/components/utils/svg_path_builder.d.ts.map +1 -1
- package/lib/components/utils/svg_path_builder.js +16 -14
- package/lib/components/utils/svg_path_builder.js.map +1 -1
- package/lib/components/utils/throttle.d.ts +1 -1
- package/lib/components/utils/throttle.d.ts.map +1 -1
- package/lib/components/utils/throttle.js +10 -9
- package/lib/components/utils/throttle.js.map +1 -1
- package/package.json +47 -47
- package/src/components/accordion/accordion_context.ts +3 -3
- package/src/components/accordion/accordion_context_provider.tsx +3 -7
- package/src/components/accordion/accordion_hooks.ts +3 -3
- package/src/components/button/Button.tsx +11 -2
- package/src/components/color-picker/react-color/ColorPicker.tsx +36 -30
- package/src/components/color-picker/react-color/common/Alpha.tsx +5 -7
- package/src/components/color-picker/react-color/common/CheckBoard.tsx +2 -4
- package/src/components/color-picker/react-color/common/EditableInput.tsx +35 -29
- package/src/components/color-picker/react-color/common/Hue.tsx +5 -7
- package/src/components/color-picker/react-color/common/Saturation.tsx +7 -9
- package/src/components/color-picker/react-color/common/Swatch.tsx +18 -9
- package/src/components/color-picker/react-color/common/interaction.tsx +12 -13
- package/src/components/color-picker/react-color/common/useOnChange.tsx +2 -2
- package/src/components/color-picker/react-color/helpers/alpha.ts +6 -5
- package/src/components/color-picker/react-color/helpers/color.ts +16 -13
- package/src/components/color-picker/react-color/helpers/hue.ts +16 -25
- package/src/components/color-picker/react-color/helpers/saturation.ts +5 -3
- package/src/components/color-picker/react-color/sketch/SketchFields.tsx +8 -8
- package/src/components/color-picker/react-color/sketch/SketchPresetColors.tsx +9 -9
- package/src/components/dialog/ConfirmDialog.tsx +2 -2
- package/src/components/draggable/draggable.tsx +20 -18
- package/src/components/form/components/field_groups/svg_text_style.schema.ts +1 -1
- package/src/components/form/components/field_groups/svg_text_style.tsx +17 -15
- package/src/components/form/components/input/checkbox.tsx +3 -3
- package/src/components/form/components/input/color_picker.tsx +1 -1
- package/src/components/form/components/input/draggable_numeric_input.tsx +1 -1
- package/src/components/form/components/input/index.ts +1 -0
- package/src/components/form/components/input/input.tsx +1 -1
- package/src/components/form/components/input/numeric_input.tsx +1 -1
- package/src/components/form/components/input/radio_group.tsx +1 -1
- package/src/components/form/components/input/select.tsx +1 -1
- package/src/components/form/components/input/switch.tsx +1 -1
- package/src/components/form/components/input/textarea.tsx +1 -1
- package/src/components/form/components/input_groups/form.tsx +3 -3
- package/src/components/form/components/input_groups/form_context.ts +3 -3
- package/src/components/form/components/layout/form.tsx +4 -6
- package/src/components/form/utils/validators.ts +29 -23
- package/src/components/fullscreen/fullscreen_context.provider.tsx +4 -9
- package/src/components/fullscreen/fullscreen_context.ts +3 -3
- package/src/components/hooks/useDoubleClick.ts +8 -8
- package/src/components/hooks/useOnClickOutside.ts +2 -2
- package/src/components/hooks/useOnOff.ts +5 -5
- package/src/components/hooks/useSelect.tsx +5 -3
- package/src/components/hooks/useToggle.ts +2 -2
- package/src/components/info-panel/InfoPanel.tsx +12 -16
- package/src/components/input/radio-button-group/RadioButtonGroup.tsx +5 -2
- package/src/components/logger/FifoLoggerDialog.tsx +1 -0
- package/src/components/logger/FifoLoggerProvider.tsx +2 -4
- package/src/components/logger/loggerContext.ts +1 -1
- package/src/components/logger/useFifoLogger.ts +7 -5
- package/src/components/root-layout/root_layout.tsx +6 -3
- package/src/components/root-layout/root_layout_context.provider.tsx +3 -3
- package/src/components/root-layout/root_layout_context.ts +3 -3
- package/src/components/selected-total/SelectedTotal.tsx +1 -1
- package/src/components/split_pane/split_pane.tsx +17 -20
- package/src/components/split_pane/split_pane_helpers.ts +1 -1
- package/src/components/split_pane/use_split_pane_size.tsx +4 -3
- package/src/components/table/default_table_cell.tsx +10 -11
- package/src/components/table/flash_row/flashed_row_context.ts +3 -3
- package/src/components/table/flash_row/flashed_row_provider.tsx +8 -6
- package/src/components/table/flash_row/use_flash_row_effect.ts +7 -5
- package/src/components/table/preview_table.tsx +3 -3
- package/src/components/table/preview_table_context.ts +6 -6
- package/src/components/table/reorder_rows/draggable_row_context.ts +6 -10
- package/src/components/table/reorder_rows/draggable_row_tr.tsx +11 -6
- package/src/components/table/reorder_rows/item_order_context.ts +4 -4
- package/src/components/table/reorder_rows/item_order_provider.tsx +2 -6
- package/src/components/table/reorder_rows/use_drop_monitor.ts +4 -4
- package/src/components/table/table_body.tsx +19 -5
- package/src/components/table/table_features.ts +12 -12
- package/src/components/table/table_root.tsx +20 -18
- package/src/components/table/table_utils.ts +4 -5
- package/src/components/table/use_table_columns.ts +7 -7
- package/src/components/table/use_table_scroll.ts +18 -21
- package/src/components/toolbar/OverflowButton.tsx +5 -5
- package/src/components/toolbar/Toolbar.tsx +8 -20
- package/src/components/toolbar/TooltipHelpContent.tsx +10 -5
- package/src/components/toolbar/toolbarContext.ts +5 -7
- package/src/components/toolbar/useCheckOverflow.tsx +1 -0
- package/src/components/utils/debounce.ts +5 -5
- package/src/components/utils/{shouldForwardPropExcept.ts → forward_all_props_except.ts} +1 -1
- package/src/components/utils/svg.ts +5 -2
- package/src/components/utils/svg_path_builder.ts +22 -19
- package/src/components/utils/throttle.ts +13 -11
- package/lib/components/utils/shouldForwardPropExcept.d.ts +0 -2
- package/lib/components/utils/shouldForwardPropExcept.d.ts.map +0 -1
- package/lib/components/utils/shouldForwardPropExcept.js.map +0 -1
|
@@ -60,12 +60,12 @@ const EditableInput = (props) => {
|
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
const setUpdatedValue = useCallback(
|
|
63
|
-
(value,
|
|
63
|
+
(value, event) => {
|
|
64
64
|
const onChangeValue = props.label
|
|
65
65
|
? getValueObjectWithLabel(value)
|
|
66
66
|
: value;
|
|
67
67
|
if (props.onChange) {
|
|
68
|
-
props.onChange(onChangeValue,
|
|
68
|
+
props.onChange(onChangeValue, event);
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
setState({ value });
|
|
@@ -73,58 +73,64 @@ const EditableInput = (props) => {
|
|
|
73
73
|
[getValueObjectWithLabel, props],
|
|
74
74
|
);
|
|
75
75
|
const handleChange = useCallback(
|
|
76
|
-
(
|
|
77
|
-
setUpdatedValue(
|
|
76
|
+
(event) => {
|
|
77
|
+
setUpdatedValue(event.target.value, event);
|
|
78
78
|
},
|
|
79
79
|
[setUpdatedValue],
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
const handleKeyDown = useCallback(
|
|
83
|
-
(
|
|
84
|
-
// In case `
|
|
83
|
+
(event) => {
|
|
84
|
+
// In case `event.target.value` is a percentage remove the `%` character
|
|
85
85
|
// and update accordingly with a percentage
|
|
86
86
|
// https://github.com/casesandberg/react-color/issues/383
|
|
87
|
-
const value = getNumberValue(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const updatedValue =
|
|
91
|
-
e.keyCode === UP_KEY_CODE ? value + offset : value - offset;
|
|
92
|
-
|
|
93
|
-
setUpdatedValue(updatedValue, e);
|
|
87
|
+
const value = getNumberValue(event.target.value);
|
|
88
|
+
if (Number.isNaN(value) || !isValidKeyCode(event.keyCode)) {
|
|
89
|
+
return;
|
|
94
90
|
}
|
|
91
|
+
const offset: number = props.arrowOffset || DEFAULT_ARROW_OFFSET;
|
|
92
|
+
const updatedValue =
|
|
93
|
+
event.keyCode === UP_KEY_CODE ? value + offset : value - offset;
|
|
94
|
+
setUpdatedValue(updatedValue, event);
|
|
95
95
|
},
|
|
96
96
|
[props.arrowOffset, setUpdatedValue],
|
|
97
97
|
);
|
|
98
98
|
|
|
99
99
|
const handleDrag = useCallback(
|
|
100
|
-
(
|
|
101
|
-
if (props.dragLabel) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
(event: MouseEvent) => {
|
|
101
|
+
if (!props.dragLabel) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const newValue = Math.round(valueRef.current + event.movementX);
|
|
106
|
+
if (newValue < 0 || newValue > props.dragMax) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
valueRef.current = newValue;
|
|
111
|
+
|
|
112
|
+
if (props.onChange) {
|
|
113
|
+
props.onChange(getValueObjectWithLabel(newValue), event);
|
|
110
114
|
}
|
|
111
115
|
},
|
|
112
116
|
[props, getValueObjectWithLabel],
|
|
113
117
|
);
|
|
114
118
|
|
|
115
119
|
const handleMouseDown = useCallback(
|
|
116
|
-
(
|
|
120
|
+
(event) => {
|
|
117
121
|
function mouseUp() {
|
|
118
122
|
window.removeEventListener('mousemove', handleDrag);
|
|
119
123
|
window.removeEventListener('mouseup', mouseUp);
|
|
120
124
|
}
|
|
121
125
|
|
|
122
|
-
if (props.dragLabel) {
|
|
123
|
-
|
|
124
|
-
handleDrag(e);
|
|
125
|
-
window.addEventListener('mousemove', handleDrag);
|
|
126
|
-
window.addEventListener('mouseup', mouseUp);
|
|
126
|
+
if (!props.dragLabel) {
|
|
127
|
+
return;
|
|
127
128
|
}
|
|
129
|
+
|
|
130
|
+
event.preventDefault();
|
|
131
|
+
handleDrag(event);
|
|
132
|
+
window.addEventListener('mousemove', handleDrag);
|
|
133
|
+
window.addEventListener('mouseup', mouseUp);
|
|
128
134
|
},
|
|
129
135
|
[handleDrag, props.dragLabel],
|
|
130
136
|
);
|
|
@@ -58,7 +58,7 @@ const styles = {
|
|
|
58
58
|
},
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
export default function Hue(props) {
|
|
62
62
|
const {
|
|
63
63
|
direction = 'horizontal',
|
|
64
64
|
hsl,
|
|
@@ -72,15 +72,15 @@ const Hue = (props) => {
|
|
|
72
72
|
const containerRef = useRef();
|
|
73
73
|
|
|
74
74
|
const handleChange = useCallback(
|
|
75
|
-
(
|
|
75
|
+
(event) => {
|
|
76
76
|
const change = hue.calculateChange(
|
|
77
|
-
|
|
77
|
+
event,
|
|
78
78
|
direction,
|
|
79
79
|
hsl,
|
|
80
80
|
containerRef.current,
|
|
81
81
|
);
|
|
82
82
|
if (change && typeof onChange === 'function') {
|
|
83
|
-
onChange(change,
|
|
83
|
+
onChange(change, event);
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
[direction, hsl, onChange],
|
|
@@ -108,6 +108,4 @@ const Hue = (props) => {
|
|
|
108
108
|
</div>
|
|
109
109
|
</div>
|
|
110
110
|
);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
export default Hue;
|
|
111
|
+
}
|
|
@@ -52,24 +52,24 @@ const styles = {
|
|
|
52
52
|
},
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
export default function Saturation(props) {
|
|
56
56
|
const { hsl, hsv, pointer, onChange, onBlur } = props;
|
|
57
57
|
|
|
58
58
|
const throttleRef = useRef(
|
|
59
|
-
throttle((
|
|
60
|
-
|
|
59
|
+
throttle((function_, data, event) => {
|
|
60
|
+
function_(data, event);
|
|
61
61
|
}, 50),
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
const containerRef = useRef();
|
|
65
65
|
|
|
66
66
|
const handleChange = useCallback(
|
|
67
|
-
(
|
|
67
|
+
(event) => {
|
|
68
68
|
if (onChange && typeof onChange === 'function') {
|
|
69
69
|
throttleRef.current(
|
|
70
70
|
onChange,
|
|
71
|
-
saturation.calculateChange(
|
|
72
|
-
|
|
71
|
+
saturation.calculateChange(event, hsl, containerRef.current),
|
|
72
|
+
event,
|
|
73
73
|
);
|
|
74
74
|
}
|
|
75
75
|
},
|
|
@@ -99,6 +99,4 @@ const Saturation = (props) => {
|
|
|
99
99
|
</div>
|
|
100
100
|
</div>
|
|
101
101
|
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export default Saturation;
|
|
102
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
|
|
4
|
+
import type { CSSProperties } from 'react';
|
|
4
5
|
import { useCallback } from 'react';
|
|
5
6
|
|
|
6
7
|
import CheckBoard from './CheckBoard.js';
|
|
@@ -24,6 +25,8 @@ const styles = {
|
|
|
24
25
|
outline: 'none',
|
|
25
26
|
};
|
|
26
27
|
|
|
28
|
+
const defaultFocusStyle: CSSProperties = {};
|
|
29
|
+
|
|
27
30
|
const SwatchWithFocus = handleFocus(function Swatch({
|
|
28
31
|
color,
|
|
29
32
|
style,
|
|
@@ -32,20 +35,26 @@ const SwatchWithFocus = handleFocus(function Swatch({
|
|
|
32
35
|
title = color,
|
|
33
36
|
children,
|
|
34
37
|
focus,
|
|
35
|
-
focusStyle =
|
|
38
|
+
focusStyle = defaultFocusStyle,
|
|
36
39
|
}) {
|
|
37
|
-
const
|
|
40
|
+
const isTransparent = color === 'transparent';
|
|
38
41
|
|
|
39
|
-
const handleClick = useCallback(
|
|
42
|
+
const handleClick = useCallback(
|
|
43
|
+
(event) => onClick?.(color, event),
|
|
44
|
+
[color, onClick],
|
|
45
|
+
);
|
|
40
46
|
const handleKeyDown = useCallback(
|
|
41
|
-
(
|
|
42
|
-
if (
|
|
43
|
-
onClick?.(color,
|
|
47
|
+
(event) => {
|
|
48
|
+
if (event.key.toLowerCase() === 'enter') {
|
|
49
|
+
onClick?.(color, event);
|
|
44
50
|
}
|
|
45
51
|
},
|
|
46
52
|
[color, onClick],
|
|
47
53
|
);
|
|
48
|
-
const handleHover = useCallback(
|
|
54
|
+
const handleHover = useCallback(
|
|
55
|
+
(event) => onHover?.(color, event),
|
|
56
|
+
[color, onHover],
|
|
57
|
+
);
|
|
49
58
|
|
|
50
59
|
const optionalEvents = {};
|
|
51
60
|
if (onHover) {
|
|
@@ -58,7 +67,7 @@ const SwatchWithFocus = handleFocus(function Swatch({
|
|
|
58
67
|
...styles,
|
|
59
68
|
background: color,
|
|
60
69
|
...style,
|
|
61
|
-
...(focus
|
|
70
|
+
...(focus && focusStyle),
|
|
62
71
|
}}
|
|
63
72
|
onClick={handleClick}
|
|
64
73
|
title={title}
|
|
@@ -67,7 +76,7 @@ const SwatchWithFocus = handleFocus(function Swatch({
|
|
|
67
76
|
{...optionalEvents}
|
|
68
77
|
>
|
|
69
78
|
{children}
|
|
70
|
-
{
|
|
79
|
+
{isTransparent && (
|
|
71
80
|
<CheckBoard
|
|
72
81
|
borderRadius={style.borderRadius}
|
|
73
82
|
boxShadow="inset 0 0 0 1px rgba(0,0,0,0.1)"
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { useCallback, useState } from 'react';
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
handleFocus = () =>
|
|
10
|
-
handleBlur = () =>
|
|
6
|
+
export function handleFocus(WrappedComponent: any, Span = 'span'): any {
|
|
7
|
+
return function Focus(props: any) {
|
|
8
|
+
const [focus, setFocus] = useState(false);
|
|
9
|
+
const handleFocus = useCallback(() => setFocus(true), []);
|
|
10
|
+
const handleBlur = useCallback(() => setFocus(false), []);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
);
|
|
18
|
-
}
|
|
12
|
+
return (
|
|
13
|
+
<Span onFocus={handleFocus} onBlur={handleBlur}>
|
|
14
|
+
<WrappedComponent {...props} focus={focus} />
|
|
15
|
+
</Span>
|
|
16
|
+
);
|
|
19
17
|
};
|
|
18
|
+
}
|
|
@@ -4,8 +4,8 @@ export function useOnChange(
|
|
|
4
4
|
onChange: (event: Event) => void,
|
|
5
5
|
): (event: Event) => void {
|
|
6
6
|
return useCallback(
|
|
7
|
-
(
|
|
8
|
-
onChange(
|
|
7
|
+
(event) => {
|
|
8
|
+
onChange(event);
|
|
9
9
|
|
|
10
10
|
function handleMouseUp() {
|
|
11
11
|
window.removeEventListener('mousemove', onChange);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
|
|
4
4
|
export function calculateChange(
|
|
5
|
-
|
|
5
|
+
event,
|
|
6
6
|
hsl,
|
|
7
7
|
direction,
|
|
8
8
|
initialA,
|
|
@@ -10,14 +10,16 @@ export function calculateChange(
|
|
|
10
10
|
) {
|
|
11
11
|
const containerWidth = container.clientWidth;
|
|
12
12
|
const containerHeight = container.clientHeight;
|
|
13
|
-
const x =
|
|
14
|
-
|
|
13
|
+
const x =
|
|
14
|
+
typeof event.pageX === 'number' ? event.pageX : event.touches[0].pageX;
|
|
15
|
+
const y =
|
|
16
|
+
typeof event.pageY === 'number' ? event.pageY : event.touches[0].pageY;
|
|
15
17
|
const left =
|
|
16
18
|
x - (container.getBoundingClientRect().left + window.pageXOffset);
|
|
17
19
|
const top = y - (container.getBoundingClientRect().top + window.pageYOffset);
|
|
18
20
|
|
|
21
|
+
let a;
|
|
19
22
|
if (direction === 'vertical') {
|
|
20
|
-
let a;
|
|
21
23
|
if (top < 0) {
|
|
22
24
|
a = 0;
|
|
23
25
|
} else if (top > containerHeight) {
|
|
@@ -36,7 +38,6 @@ export function calculateChange(
|
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
} else {
|
|
39
|
-
let a;
|
|
40
41
|
if (left < 0) {
|
|
41
42
|
a = 0;
|
|
42
43
|
} else if (left > containerWidth) {
|
|
@@ -9,25 +9,28 @@ function simpleCheckForValidColor(data) {
|
|
|
9
9
|
let passed = 0;
|
|
10
10
|
|
|
11
11
|
for (const letter of keysToCheck) {
|
|
12
|
-
if (data[letter]) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
if (!data[letter]) {
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
checked += 1;
|
|
17
|
+
if (!Number.isNaN(Number(data[letter]))) {
|
|
18
|
+
passed += 1;
|
|
19
|
+
}
|
|
20
|
+
if (letter !== 's' && letter !== 'l') {
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const percentPattern = /^\d+%$/;
|
|
24
|
+
if (percentPattern.test(data[letter])) {
|
|
25
|
+
passed += 1;
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
|
|
26
|
-
return checked === passed
|
|
29
|
+
return checked === passed && data;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
function toState(data, oldHue?: number) {
|
|
30
|
-
const color =
|
|
33
|
+
const color = tinycolor(data.hex || data);
|
|
31
34
|
const hsl = color.toHsl();
|
|
32
35
|
const hsv = color.toHsv();
|
|
33
36
|
const rgb = color.toRgb();
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
|
|
4
|
-
export function calculateChange(
|
|
4
|
+
export function calculateChange(event, direction, hsl, container: Element) {
|
|
5
5
|
const containerWidth = container.clientWidth;
|
|
6
6
|
const containerHeight = container.clientHeight;
|
|
7
|
-
const x =
|
|
8
|
-
|
|
7
|
+
const x =
|
|
8
|
+
typeof event.pageX === 'number' ? event.pageX : event.touches[0].pageX;
|
|
9
|
+
const y =
|
|
10
|
+
typeof event.pageY === 'number' ? event.pageY : event.touches[0].pageY;
|
|
9
11
|
const left =
|
|
10
12
|
x - (container.getBoundingClientRect().left + window.pageXOffset);
|
|
11
13
|
const top = y - (container.getBoundingClientRect().top + window.pageYOffset);
|
|
12
14
|
|
|
15
|
+
let h;
|
|
13
16
|
if (direction === 'vertical') {
|
|
14
|
-
let h;
|
|
15
17
|
if (top < 0) {
|
|
16
18
|
h = 359;
|
|
17
19
|
} else if (top > containerHeight) {
|
|
@@ -20,18 +22,8 @@ export function calculateChange(e, direction, hsl, container: Element) {
|
|
|
20
22
|
const percent = -((top * 100) / containerHeight) + 100;
|
|
21
23
|
h = (360 * percent) / 100;
|
|
22
24
|
}
|
|
23
|
-
|
|
24
|
-
if (hsl.h !== h) {
|
|
25
|
-
return {
|
|
26
|
-
h,
|
|
27
|
-
s: hsl.s,
|
|
28
|
-
l: hsl.l,
|
|
29
|
-
a: hsl.a,
|
|
30
|
-
source: 'hsl',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
25
|
} else {
|
|
34
|
-
|
|
26
|
+
// eslint-disable-next-line no-lonely-if
|
|
35
27
|
if (left < 0) {
|
|
36
28
|
h = 0;
|
|
37
29
|
} else if (left > containerWidth) {
|
|
@@ -40,16 +32,15 @@ export function calculateChange(e, direction, hsl, container: Element) {
|
|
|
40
32
|
const percent = (left * 100) / containerWidth;
|
|
41
33
|
h = (360 * percent) / 100;
|
|
42
34
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
35
|
+
}
|
|
36
|
+
if (hsl.h !== h) {
|
|
37
|
+
return {
|
|
38
|
+
h,
|
|
39
|
+
s: hsl.s,
|
|
40
|
+
l: hsl.l,
|
|
41
|
+
a: hsl.a,
|
|
42
|
+
source: 'hsl',
|
|
43
|
+
};
|
|
53
44
|
}
|
|
54
45
|
return null;
|
|
55
46
|
}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
|
|
4
|
-
export function calculateChange(
|
|
4
|
+
export function calculateChange(event, hsl, container: Element) {
|
|
5
5
|
const { width: containerWidth, height: containerHeight } =
|
|
6
6
|
container.getBoundingClientRect();
|
|
7
|
-
const x =
|
|
8
|
-
|
|
7
|
+
const x =
|
|
8
|
+
typeof event.pageX === 'number' ? event.pageX : event.touches[0].pageX;
|
|
9
|
+
const y =
|
|
10
|
+
typeof event.pageY === 'number' ? event.pageY : event.touches[0].pageY;
|
|
9
11
|
let left = x - (container.getBoundingClientRect().left + window.pageXOffset);
|
|
10
12
|
let top = y - (container.getBoundingClientRect().top + window.pageYOffset);
|
|
11
13
|
|
|
@@ -8,7 +8,7 @@ import * as color from '../helpers/color.js';
|
|
|
8
8
|
export interface SketchFieldsProps {
|
|
9
9
|
onChange: (
|
|
10
10
|
data: (RGB | HSL | { hex: string }) & { source: string },
|
|
11
|
-
|
|
11
|
+
event: Event,
|
|
12
12
|
) => void;
|
|
13
13
|
onBlur?: (event: FocusEvent<HTMLElement>) => void;
|
|
14
14
|
hsl: HSL;
|
|
@@ -21,7 +21,7 @@ const styles: Record<
|
|
|
21
21
|
'fields' | 'single' | 'double' | 'input' | 'label',
|
|
22
22
|
CSSProperties
|
|
23
23
|
> &
|
|
24
|
-
Record<'alpha', (
|
|
24
|
+
Record<'alpha', (isAlphaDisabled: boolean) => CSSProperties> = {
|
|
25
25
|
fields: {
|
|
26
26
|
display: 'flex',
|
|
27
27
|
paddingTop: '4px',
|
|
@@ -30,10 +30,10 @@ const styles: Record<
|
|
|
30
30
|
flex: '1',
|
|
31
31
|
paddingLeft: '6px',
|
|
32
32
|
},
|
|
33
|
-
alpha: (
|
|
33
|
+
alpha: (isAlphaDisabled: boolean) => ({
|
|
34
34
|
flex: '1',
|
|
35
35
|
paddingLeft: '6px',
|
|
36
|
-
...(
|
|
36
|
+
...(isAlphaDisabled && { display: 'none' }),
|
|
37
37
|
}),
|
|
38
38
|
double: {
|
|
39
39
|
flex: '2',
|
|
@@ -65,7 +65,7 @@ const SketchFields = ({
|
|
|
65
65
|
disableAlpha,
|
|
66
66
|
}: SketchFieldsProps) => {
|
|
67
67
|
const handleChange = useCallback(
|
|
68
|
-
(data: any,
|
|
68
|
+
(data: any, event: any) => {
|
|
69
69
|
if (data.hex) {
|
|
70
70
|
if (color.isValidHex(data.hex)) {
|
|
71
71
|
onChange(
|
|
@@ -73,7 +73,7 @@ const SketchFields = ({
|
|
|
73
73
|
hex: data.hex,
|
|
74
74
|
source: 'hex',
|
|
75
75
|
},
|
|
76
|
-
|
|
76
|
+
event,
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
} else if (data.r || data.g || data.b) {
|
|
@@ -85,7 +85,7 @@ const SketchFields = ({
|
|
|
85
85
|
a: rgb.a,
|
|
86
86
|
source: 'rgb',
|
|
87
87
|
},
|
|
88
|
-
|
|
88
|
+
event,
|
|
89
89
|
);
|
|
90
90
|
} else if (data.a) {
|
|
91
91
|
if (data.a < 0) {
|
|
@@ -103,7 +103,7 @@ const SketchFields = ({
|
|
|
103
103
|
a: data.a,
|
|
104
104
|
source: 'rgb',
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
event,
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
},
|
|
@@ -10,15 +10,15 @@ interface SketchPresetColorsProps {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
const styles: Record<'swatchWrap' | 'swatch', CSSProperties> &
|
|
13
|
-
Record<'colors', (
|
|
14
|
-
colors: (
|
|
13
|
+
Record<'colors', (isHidden: boolean) => CSSProperties> = {
|
|
14
|
+
colors: (isHidden: boolean) => ({
|
|
15
15
|
margin: '0 -10px',
|
|
16
16
|
padding: '10px 0 0 10px',
|
|
17
17
|
borderTop: '1px solid #eee',
|
|
18
18
|
display: 'flex',
|
|
19
19
|
flexWrap: 'wrap',
|
|
20
20
|
position: 'relative',
|
|
21
|
-
...(
|
|
21
|
+
...(isHidden && { display: 'none' }),
|
|
22
22
|
}),
|
|
23
23
|
swatchWrap: {
|
|
24
24
|
width: '16px',
|
|
@@ -35,13 +35,13 @@ const SketchPresetColors = (props: SketchPresetColorsProps) => {
|
|
|
35
35
|
const { colors, onClick, onSwatchHover } = props;
|
|
36
36
|
|
|
37
37
|
const handleClick = useCallback(
|
|
38
|
-
(hex: any,
|
|
38
|
+
(hex: any, event: MouseEvent) => {
|
|
39
39
|
onClick?.(
|
|
40
40
|
{
|
|
41
41
|
hex,
|
|
42
42
|
source: 'hex',
|
|
43
43
|
},
|
|
44
|
-
|
|
44
|
+
event,
|
|
45
45
|
);
|
|
46
46
|
},
|
|
47
47
|
[onClick],
|
|
@@ -49,11 +49,11 @@ const SketchPresetColors = (props: SketchPresetColorsProps) => {
|
|
|
49
49
|
|
|
50
50
|
return (
|
|
51
51
|
<div style={styles.colors(!colors || colors.length === 0)}>
|
|
52
|
-
{colors.map((
|
|
52
|
+
{colors.map((colorObjectOrString) => {
|
|
53
53
|
const c =
|
|
54
|
-
typeof
|
|
55
|
-
? { color:
|
|
56
|
-
:
|
|
54
|
+
typeof colorObjectOrString === 'string'
|
|
55
|
+
? { color: colorObjectOrString }
|
|
56
|
+
: colorObjectOrString;
|
|
57
57
|
const key = `${c.color}${'title' in c ? c?.title : ''}`;
|
|
58
58
|
return (
|
|
59
59
|
<div key={key} style={styles.swatchWrap}>
|
|
@@ -3,7 +3,7 @@ import { Classes, Dialog, DialogBody, DialogFooter } from '@blueprintjs/core';
|
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
4
|
|
|
5
5
|
import { Button } from '../button/index.js';
|
|
6
|
-
import {
|
|
6
|
+
import { forwardAllPropsExcept } from '../utils/forward_all_props_except.ts';
|
|
7
7
|
|
|
8
8
|
interface ConfirmDialogProps extends Omit<DialogProps, 'isCloseButtonShown'> {
|
|
9
9
|
onConfirm: () => void;
|
|
@@ -14,7 +14,7 @@ interface ConfirmDialogProps extends Omit<DialogProps, 'isCloseButtonShown'> {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
const DialogWithHeaderColor = styled(Dialog, {
|
|
17
|
-
shouldForwardProp:
|
|
17
|
+
shouldForwardProp: forwardAllPropsExcept(['headerColor']),
|
|
18
18
|
})<{ headerColor: string }>`
|
|
19
19
|
.${Classes.DIALOG_HEADER} {
|
|
20
20
|
background-color: ${(props) => props.headerColor};
|
|
@@ -67,25 +67,27 @@ export function Draggable(props: DraggableProps) {
|
|
|
67
67
|
const diff = event.clientX - previousPositionRef.current;
|
|
68
68
|
previousPositionRef.current = event.clientX;
|
|
69
69
|
|
|
70
|
-
if (event.buttons
|
|
71
|
-
|
|
72
|
-
.with({ shiftKey: true }, () => majorStepSize ?? stepSize)
|
|
73
|
-
.with({ altKey: true }, () => minorStepSize ?? stepSize)
|
|
74
|
-
.otherwise(() => stepSize);
|
|
75
|
-
|
|
76
|
-
const precision = Math.max(
|
|
77
|
-
Utils.countDecimalPlaces(draggedValueRef.current),
|
|
78
|
-
Utils.countDecimalPlaces(minorStepSize ?? stepSize),
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
const nextValue = toMaxPrecision(
|
|
82
|
-
draggedValueRef.current + diff * step,
|
|
83
|
-
precision,
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
draggedValueRef.current = clamp(nextValue, min, max);
|
|
87
|
-
onChangeRef.current(0, String(draggedValueRef.current));
|
|
70
|
+
if (event.buttons !== 1) {
|
|
71
|
+
return;
|
|
88
72
|
}
|
|
73
|
+
|
|
74
|
+
const step = match(event)
|
|
75
|
+
.with({ shiftKey: true }, () => majorStepSize ?? stepSize)
|
|
76
|
+
.with({ altKey: true }, () => minorStepSize ?? stepSize)
|
|
77
|
+
.otherwise(() => stepSize);
|
|
78
|
+
|
|
79
|
+
const precision = Math.max(
|
|
80
|
+
Utils.countDecimalPlaces(draggedValueRef.current),
|
|
81
|
+
Utils.countDecimalPlaces(minorStepSize ?? stepSize),
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const nextValue = toMaxPrecision(
|
|
85
|
+
draggedValueRef.current + diff * step,
|
|
86
|
+
precision,
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
draggedValueRef.current = clamp(nextValue, min, max);
|
|
90
|
+
onChangeRef.current(0, String(draggedValueRef.current));
|
|
89
91
|
}
|
|
90
92
|
|
|
91
93
|
function handleMouseUp() {
|
|
@@ -6,7 +6,7 @@ export const svgTextStyleFieldsSchema = z.object({
|
|
|
6
6
|
fill: z.string().optional(),
|
|
7
7
|
fontSize: stringToNumberOptional({
|
|
8
8
|
numSchema: z.int().min(1),
|
|
9
|
-
parse: (
|
|
9
|
+
parse: (string_) => Math.trunc(Number(string_)),
|
|
10
10
|
}),
|
|
11
11
|
fontStyle: z.enum(['normal', 'italic']).optional(),
|
|
12
12
|
fontWeight: z.enum(['normal', 'bold']).optional(),
|