Skip to content

Commit

Permalink
Update gr.ColorPicker UI (#9570)
Browse files Browse the repository at this point in the history
* update color picker dialog

* add changeset

* add tinycolor types

* fix disabled param

* add changeset

---------

Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com>
  • Loading branch information
hannahblair and gradio-pr-bot authored Oct 7, 2024
1 parent 00c6bb1 commit e0ee3d5
Show file tree
Hide file tree
Showing 8 changed files with 466 additions and 13 deletions.
6 changes: 6 additions & 0 deletions .changeset/chilly-jars-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@gradio/colorpicker": minor
"gradio": minor
---

feat:Update gr.ColorPicker UI
4 changes: 2 additions & 2 deletions js/colorpicker/ColorPicker.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<Meta title="Components/Color Picker" component={ColorPicker} argTypes={{}} />

<Template let:args>
<ColorPicker value="Color Picker" {...args} />
<ColorPicker label="Color Picker" {...args} />
</Template>

<Story name="Default" />
<Story name="Default" args={{ interactive: true }} />
<Story
name="Color Picker with a color value and hidden label"
args={{ value: "#FFC0CB", show_label: false, interactive: true }}
Expand Down
4 changes: 2 additions & 2 deletions js/colorpicker/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import { Block } from "@gradio/atoms";
import { StatusTracker } from "@gradio/statustracker";
import type { LoadingStatus } from "@gradio/statustracker";
import exp from "constants";
export let label = "ColorPicker";
export let info: string | undefined = undefined;
Expand All @@ -34,6 +33,7 @@
clear_status: LoadingStatus;
}>;
export let interactive: boolean;
export let disabled = false;
</script>

<Block {visible} {elem_id} {elem_classes} {container} {scale} {min_width}>
Expand All @@ -50,7 +50,7 @@
{label}
{info}
{show_label}
disabled={!interactive}
disabled={!interactive || disabled}
on:change={() => gradio.dispatch("change")}
on:input={() => gradio.dispatch("input")}
on:submit={() => gradio.dispatch("submit")}
Expand Down
5 changes: 4 additions & 1 deletion js/colorpicker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
"dependencies": {
"@gradio/atoms": "workspace:^",
"@gradio/statustracker": "workspace:^",
"@gradio/utils": "workspace:^"
"@gradio/utils": "workspace:^",
"@gradio/icons": "workspace:^",
"tinycolor2": "^1.6.0",
"@types/tinycolor2": "^1.4.6"
},
"devDependencies": {
"@gradio/preview": "workspace:^"
Expand Down
Loading

0 comments on commit e0ee3d5

Please sign in to comment.