-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: palette fill as a presentation prop; getInputStylePalette fn prop; #1092
Changes from all commits
faf018f
de462fd
4519718
89f3dd3
c6e3c2f
9cafeeb
43ae61f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ import { createContext, PropsWithChildren, useContext, useMemo } from "react"; | |
import { GridStyle } from "src/components/Table"; | ||
import { Typography } from "src/Css"; | ||
|
||
export type InputStylePalette = "success" | "warning" | "caution" | "info"; | ||
|
||
export interface PresentationFieldProps { | ||
numberAlignment?: "left" | "right"; | ||
/** Sets the label position or visibility. Defaults to "above" */ | ||
|
@@ -23,10 +25,13 @@ export interface PresentationFieldProps { | |
errorInTooltip?: true; | ||
/** Allow the fields to grow to the width of its container. By default, fields will extend up to 550px */ | ||
fullWidth?: boolean; | ||
/** Changes bg and hoverBg; Takes priority over `contrast`; Useful when showing many fields w/in a table that require user attention; In no way should be used as a replacement for error/focus state */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great docs! |
||
inputStylePalette?: InputStylePalette; | ||
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this since there's been a lot of discussion around how we can show to users what changes they've made at a glance, mostly in dynamic schedules. With this we can pass something in based on a form state for example if asked |
||
} | ||
|
||
export type PresentationContextProps = { | ||
fieldProps?: PresentationFieldProps; | ||
/** `inputStylePalette` omitted because it is too dependent on the individual field use case to be controlled at this level */ | ||
fieldProps?: Omit<PresentationFieldProps, "inputStylePalette">; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not something we want set at a context level There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense, that it's not a context-level thing, but then wonder if we can find a better spot for declaring it, then Hm, I guess Could make your PR comment an in-source comment 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
gridTableStyle?: GridStyle; | ||
// Defines whether content should be allowed to wrap or not. `undefined` is treated as true. | ||
wrap?: boolean; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mirrors our
coloredChips
and does leave room for more bespoke customization in the future if the need arisesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I like giving the users "logical options" and keeping the physical color palette/colors internally within the component.