xh / hoist-react

🏗️ ⚛️ The XH Hoist toolkit for React
https://xh.io
Apache License 2.0
24 stars 8 forks source link

Window / Dialog component - replaces direct use of Blueprint dialog #861

Open amcclain opened 5 years ago

amcclain commented 5 years ago

We make frequent and direct use of the Blueprint Dialog out of kit. There are some concrete issues with this:

We could consider:

lbwexler commented 5 years ago

I was actually thinking it might be interesting to offer something like XH.dialog() or XH.window() that would popup a window or dialog imperatively, much like messages get popped-up with XH.message(). That way, applications would not need to have to deal with the whole "isOpen" bookkeeping and needing to place the thing manually into the virtual DOM. Question is how to to specify buttons and how to allow the content in the dialog the ability to close the window....

cnrudd commented 5 years ago

For the first step BP dialog wrapper component with defaulted props: these are the BP defaults to use to turn off open/close animations:

transitionDuration: 0,
transitionName: ‘none’
cnrudd commented 4 years ago

Lee and I reviewed the code in branch 'hoistDialog', which produces a draggable/resizeable dialog or fixed pos/size dialog.

We determined we want to make Dialog a function component with its own model (much like Panel).

Model should have these API properties and methods:

Properties

  1. showTitleBar: boolean
  2. showCloseButton: boolean
  3. showMaxMinButtons: boolean
  4. resizable: boolean
  5. draggable: boolean
  6. closeOnEscape: boolean
  7. closeOnMaskClick: boolean
  8. zIndex: integer
  9. stateful: string (stateId?)
  10. width: number or string px / % (explore other units)
  11. height: number or string px / %
  12. isOpen: boolean (readonly)?

(All properties should be observable)

Methods

  1. show
  2. hide

Component should take these props:

  1. title: String
  2. icon: Element

Also explore if same dialog component can be used on mobile. Maybe not allow resizable or draggable on mobile.

cnrudd commented 4 years ago

Still to do:

amcclain commented 2 years ago

Leaving this here in case relevant at all - https://tympanus.net/codrops/2021/10/06/how-to-implement-and-style-the-dialog-element/