1.2.3 • Published 8 months ago

djuno-design v1.2.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
8 months ago

Djuno-design Djuno Design

djuno-design is a lightweight, tailwindCSS-based, and wrapper-approach library for React to develop front-end projects easily.

1. Install

npm

npm i djuno-design

yarn

yarn add djuno-design

2. Import styles at the top of your component tree

import 'djuno-design/dist/index.css'

3. Simply you can import all components everywere

import { Button } from 'djuno-design'

function App() {
  return (
    <>
      <Button>Click!</Button>
    </>
  )
}

Documentation

Available providers

  1. DjunoDesignProvider (or DDProvider)

Available components

  1. Button
  2. Tooltip

    • Tooltip.Info
    • Tooltip.Error
  3. Loading

  4. Flex
  5. Card
  6. Typography

    • Title
    • Text
    • Paragraph
    • Link
  7. Alert

  8. Steps
  9. Form

    • Input
    • Textarea
    • Switcher
    • Select
    • Combobox
  10. Skeleton

  11. SimpleTable
    • Head
    • TH
    • Body
    • Row
    • TD
  12. EmptyState
  13. Divider
  14. Modal
  15. Dropdown
  16. SecureCopy
  17. Accordion
  18. Pagination
  19. Layouts

    • PanelLayout
    • PanelSidebar
    • PanelHeader
  20. Sidebar

  21. JsonViewer
  22. Tabs
  23. ThemeChanger & ThemeSwitcher
  24. Popover
  25. Tag
  26. CodeViewer

Available hooks

  1. useShow
  2. useWindowOnClick
  3. useDjunoDesign

Available utility functions

  1. uuid
  2. localStorage
    • getLocalStorage
    • setLocalStorage
    • removeLocalStorage
  3. sleep
  4. copy
    • copyToClipboard

APIs

Button

NameTypeRequireddefaultDescription
uiTypeButtonTypessimple
uiSizeSizeTypesmedium
tooltipTooltipPropsundefined
loadingbooleanfalse
loadingTypeLoadingTypesimple
childrenReact.ReactNode
all <button> propsReact.ButtonHTMLAttributes<HTMLButtonElement>

Tooltip

Tooltip , Tooltip.Info , Tooltip.Error

NameTypeRequireddefaultDescription
contentstring, ReactNode
placeTooltipPlacestop
themeTooltipThemeTypesprimary
clickablebooleanfalse
childrenReact.ReactNode

Loading

NameTypeRequireddefaultDescription
uiTypeLoadingTypesimple
uiSizenumber24px
borderSizenumber2px
themeLoadingThemeTypesprimary

Flex

NameTypeRequireddefaultDescription
directionFlexDirectionrowSpecifies the main-axis
justifyFlexJustifystartAlignment along the main-axis
itemsFlexItemsstartAlignment along the sub-axis
childrenReact.RaectNodestartAlignment along the sub-axis

Card

NameTypeRequireddefaultDescription
idstring
titlestring, ReactNode
titleLevelnumber 1,2,..,65
descriptionstring, ReactNode
settingstring, ReactNode
class names for main sectionsstring
childrenReactNode

Typography

Typography.Title

NameTypeRequireddefaultDescription
levelnumber 1,2,..,61
uiTypeTypographtUiTypesdefault
tooltipTooltipPropsundefined
codebooleanfalse
markbooleanfalse
underlinebooleanfalse
delbooleanfalse
strongbooleanfalse
italicbooleanfalse
copyableboolean or TypographyCopyablePropfalse

Typography.Text

NameTypeRequireddefaultDescription
sizeTypographtSizeTypesbase
uiTypeTypographtUiTypesdefault
tooltipTooltipPropsundefined
codebooleanfalse
markbooleanfalse
underlinebooleanfalse
delbooleanfalse
strongbooleanfalse
italicbooleanfalse
copyableboolean or TypographyCopyablePropfalse

Typography.Paragraph

NameTypeRequireddefaultDescription
sizeTypographtSizeTypesbase
uiTypeTypographtUiTypesdefault
tooltipTooltipPropsundefined
codebooleanfalse
markbooleanfalse
underlinebooleanfalse
delbooleanfalse
strongbooleanfalse
italicbooleanfalse
copyableboolean or TypographyCopyablePropfalse

Typography.Link

NameTypeRequireddefaultDescription
all <a> propsReact.AnchorHTMLAttributes
sizeTypographtSizeTypesbase
uiTypeTypographtUiTypesdefault
tooltipTooltipPropsundefined
codebooleanfalse
markbooleanfalse
underlinebooleanfalse
delbooleanfalse
strongbooleanfalse
italicbooleanfalse
copyableboolean, TypographyCopyablePropfalse

Alert

NameTypeRequireddefaultDescription
messagestring, ReactNode
descriptionstring, ReactNode
uiTypeAlertTypesneutral
showIconbooleanfalse
bannerbooleanfalseDisplay Alert as a banner
closablebooleanfalseIf true, the alert can be closed (disappears on click).
onClose() => voidCallback function to be called when the alert is closed.
childrenReact.ReactNode

Steps

NameTypeRequireddefaultDescription
stepsStepItem[]yes
stepstringyes

Input

NameTypeRequireddefaultDescription
idstring
all <input> propsReact.InputHTMLAttributes<HTMLInputElement>
labelstring, React.ReactNode
uiTypeInputTypes
requiredboolean
errorstring , boolean , React.ReactNode
hintstring, React.ReactNode
loadingboolean
loadingTypeLoadingType
placeholderstring
tooltipTooltipProps
uiSizeSizeTypesmedium
copyableCopyableProp
labelClassNamestring
containerClassNamestring
AfterComponentReact.ReactNode

Textarea

NameTypeRequireddefaultDescription
idstring
all <textarea> propsReact.TextareaHTMLAttributes<HTMLTextAreaElement>
placeholderstring
labelstring, React.ReactNode
requiredboolean
errorstring, boolean, React.ReactNode
hintstring , React.ReactNode
uiTypeInputTypes
tooltipTooltipProps
uiSizeSizeTypesmedium
copyableCopyableProp
labelClassNamestring
loadingboolean
loadingTypeLoadingType
containerClassNamestring

Switcher

NameTypeRequireddefaultDescription
valueboolean
onChange(value: boolean) => void
disabledboolean
loadingboolean
loadingTypeLoadingProps
uiSizeSizeTypesmedium

Select

NameTypeRequiredDefaultDescription
idstring
valueTThe currently selected value.
onChange(value: T or undefined) => voidCallback function triggered when the selected value changes.
defaultValueTThe default value of the select component.
optionsSelectOption<T, ET>[]Array of options available for selection.
classNamestringAdditional CSS classes for custom styling of the select component.
labelClassNamestringAdditional CSS classes for custom label
buttonClassNamestringAdditional CSS classes for custom styling of the select button.
optionsClassNamestringAdditional CSS classes for custom styling of the options list.
optionClassNamestringAdditional CSS classes for custom styling of the each option
labelstring or React.ReactNodeThe label displayed above the select component.
errorstring or boolean or React.ReactNodeError message to display if there is a validation issue.
requiredbooleanIndicates if the select component is required.
uiTypeSelectTypesThe uiType of the select component.
tooltipTooltipPropsTooltip properties to display additional information.
hintstring or React.ReactNodeHint text to provide additional context or instructions.
loadingbooleanIndicates if the select component is in a loading state.
loadingTypeLoadingTypeType of loading indicator to display when the select component is loading.
emptyStringstringText to display when there are no options available.
clearablebooleanIf true, allows the user to clear the selected value.
disabledbooleanIf true, disables the select component.
uiSizeSizeTypesSize of the select component (e.g., small, medium, large).
onBlur(e: FocusEvent) => voidCallback function triggered when the select component loses focus.

Combobox

NameTypeRequiredDefaultDescription
idstring
valuestringThe currently selected value.
onChange(value: string or undefined) => voidCallback function triggered when the selected value changes.
querystringThe currently query value.
onChangeQuery(value: string or undefined) => voidCallback function triggered when the input value changes.
defaultValuestringThe default value of the combobox component.
optionsComboboxOption<T, ET>[]Array of options available for selection.
classNamestringAdditional CSS classes for custom styling.
labelClassNamestringAdditional CSS classes for custom label.
buttonClassNamestringAdditional CSS classes for custom styling of the button.
inputClassNamestringAdditional CSS classes for custom styling of the input element.
optionsClassNamestringAdditional CSS classes for custom styling of the options list.
optionClassNamestringAdditional CSS classes for custom styling of the each option
labelstring or React.ReactNodeThe label displayed above the combobox component.
errorstring or boolean or React.ReactNodeError message to display if there is a validation issue.
requiredbooleanIndicates if the combobox component is required.
uiTypeSelectTypesThe uiType of the combobox component.
tooltipTooltipPropsTooltip properties to display additional information.
hintstring or React.ReactNodeHint text to provide additional context or instructions.
loadingbooleanIndicates if the combobox component is in a loading state.
loadingTypeLoadingTypeType of loading indicator to display when the combobox component is loading.
clearablebooleanIf true, allows the user to clear the selected value.
disabledbooleanIf true, disables the combobox component.
uiSizeSizeTypesSize of the combobox component (e.g., small, medium, large).
clearQueryOnClosebooleantrueIf true, the query gets an empty string after closing the options.

Skeleton

NameTypeRequireddefaultDescription
shapeSkeletonShapesrectangle
uiSizeSizeTypesmedium
animationSkeletonAnimationspulse
styleReact.CSSPropertiespulse

SimpleTable

NameTypeRequireddefaultDescription
classNamestring
containerClassNamestring
loadingbooleanfalse
loadingSettingLoadingProps

SimpleTable.Row

NameTypeRequireddefaultDescription
classNamestring
withoutHoverStyleboolean

SimpleTable.TD

NameTypeRequireddefaultDescription
classNamestring

SimpleTable.TH

NameTypeRequireddefaultDescription
labelstring, ReactNode

EmptyState

NameTypeRequireddefaultDescription
textReact.ReactNodeNo data
iconReact.ReactNodePRESENTED_IMAGE_DEFAULT
classNamestring
iconClassNamestring
textClassNamestring
usingIconbooleantrue
usingTextbooleantrue

Divider

NameTypeRequireddefaultDescription
uiTypeDividerTypes
classNamestring
orientationOrientationTypes
textstring
textClassNamestring
childrenReact.ReactNode

Modal

NameTypeRequiredDefaultDescription
titleReact.ReactNodeThe title of the modal, which can be a string or any React node.
isOpenbooleanControls whether the modal is open or closed.
onClose() => voidCallback function triggered when the modal is requested to close.
contentClassNamestringAdditional CSS classes for custom styling of the modal content.
containerClassNamestringAdditional CSS classes for custom styling of the modal container.
closablebooleanIf true, displays a close button in the modal.
rendered() => voidCallback function triggered when the modal is rendered.
childrenReact.ReactNodeThe content to be displayed inside the modal.

Dropdown

NameTypeRequireddefaultDescription
menuDropdownElement[]
titlestring
buttonClassNamestring
itemsClassNamestring
itemClassNamestring
childrenReact.ReactNode
anchorAnchorPropsbottom start

SecureCopy

NameTypeRequireddefaultDescription
textstring
classNamestring
typeActionTypes
textClassNamestring
iconClassNamestring
showTextboolean
uiSizeSizeTypesmedium
copyableCopyableProp

Accordion

NameTypeRequireddefaultDescription
itemsAccordionItem[]
panelClassNamestring
labelClassNamestring
loadingbooleanfalse
loadingSettingLoadingProps
uiTypeAccordinTypedefault

Pagination

NameTypeRequireddefaultDescription
limitnumber
offsetnumber
totalnumber
siblingCountnumber
onPageChange(offset: number, limit: number) => void
classNamestring
loadingboolean

PanelLayout

NameTypeRequiredDefaultDescription
typePanelLayoutTypesDefines the layout type, such as 'normal' or 'mini'.
pathnamestringThe current pathname used to generate segments for the sidebar.
renderSidebar({ segments, isShowSidebar, type }: { segments: string[], isShowSidebar: boolean, type: PanelLayoutTypes }) => React.ReactNodeFunction to render the sidebar, receiving segments, sidebar visibility state, and layout type.
renderHeader({ handleHideSidebar, handleShowSidebar, isShowSidebar }: { handleHideSidebar: () => void, handleShowSidebar: () => void, isShowSidebar: boolean }) => React.ReactNodeFunction to render the header, receiving callbacks to show or hide the sidebar.
childrenReact.ReactNodeThe content to be displayed within the layout's main area.
enableGoToTopAfterScrollbooleantrueShowing a button to go to the top of the page after a little scrolling
enableGoToTopAfterChangeRoutebooleantrueScrolling to the top after changing pathname prop.
globalLoadingbooleanfalseControls whether the global loading state is active.
globalLoadingContentReact.ReactNodeCustom content to display within the global loading overlay.
contentLoadingbooleanfalseControls whether the content loading state is active.
contentLoadingContentReact.ReactNodeCustom content to display within the content loading overlay.
loadingsContainerClassNamestringA custom CSS class applied to the container of both global and content loading overlays.

PanelSidebar

NameTypeRequiredDefaultDescription
isShowSidebarbooleanDetermines whether the sidebar is visible or hidden.
typePanelLayoutTypesThe type of sidebar layout, such as 'normal' or 'mini'.
sidebarHeaderReact.ReactNodeOptional header content to display at the top of the sidebar.
childrenReact.ReactNodeThe content to be displayed within the sidebar.

PanelHeader

NameTypeRequiredDefaultDescription
handleHideSidebar() => voidCallback function to hide the sidebar.
handleShowSidebar() => voidCallback function to show the sidebar.
mobileIconReact.ReactNodeAn optional icon or element to display in the mobile view.
childrenReact.ReactNodeThe content to be displayed within the header.

Checkbox

NameTypeRequireddefaultDescription
idstring
labelstring, React.ReactNode
requiredbooleanfalse
errorstring, boolean, React.ReactNode
tooltipTooltipProps
valueboolean
onChange() => void
disabledboolean
labelClassNamestring

Sidebar

NameTypeRequiredDefaultDescription
itemsSidebarItem[]List of items to be displayed in the sidebar.
segmentsstring[]Array of URL segments used to determine the active item.
subItemsSidebarItem[]Additional items to be displayed below the main items.
loadingbooleanIndicates whether the sidebar is in a loading state.
loadingModeSidebarLoadingModesDetermines the visual loading state (e.g., spinner, skeleton).
typePanelLayoutTypesSpecifies the sidebar layout type (e.g., 'normal' or 'mini').
childrenReact.ReactNodeAdditional content to be rendered at the bottom of the sidebar.
navItemHeightnmber

SidebarItem

NameTypeRequiredDefaultDescription
idstring or numberYesUnique identifier for the sidebar item.
activeConditionsSidebarActiveItemCondition[]Conditions to determine if the item is active.
labelSidebarItemLabelLabel content for the sidebar item (can be text, node, or function).
linkstringOptional link associated with the item.
onClick(item?: SidebarItem) => voidClick handler for the item.
iconReact.FunctionComponent<React.SVGProps<SVGSVGElement>>Icon component for the item.
disabledbooleanIf true, the item is disabled and not clickable.
childrenSidebarItem[]Nested items to be displayed below the current item
activebooleanConditions to determine if the item is visible or not.
testIdstringTest ID for the sidebar item (useful for testing).

JsonViewer

NameTypeRequireddefaultDescription
valueobject, null{}
collapsednumber, boolean
styleReact.CSSProperties
copyableboolean

Tabs

NameTypeRequiredDefaultDescription
optionsTabOptions
selectedIndexnumber
onChange() => void
listClassNamestring
panelClassNamestring
tabTypestring

ThemeChanger , ThemeSwitcher

NameTypeRequireddefaultDescription
itemsClassNamestring
anchorAnchorPropsbottom start

Popover

NameTypeRequireddefaultDescription
contentReact.ReactNode
childrenReact.ReactNode
panelclassNamestring
panelStyleReact.CSSProperties
anchorAnchorPropsbottom start

Tag

NameTypeRequiredDefaultDescription
classNamestringAdditional class names to apply to the tag.
colorPresetColorNamesColor type of the tag (e.g., 'processing', 'success',).
styleReact.CSSPropertiesInline styles for the tag.
childrenReact.ReactNodeContent to be displayed inside the tag.
iconReact.ReactNodeIcon to be displayed before the content.
borderedbooleantrueIf false, the tag will not have a border.
closablebooleanfalseIf true, the tag can be closed (disappears on click).
onClose() => voidCallback function to be called when the tag is closed.

CodeViewer

NameTypeRequiredDefaultDescription
codestringThe code to be displayed in the viewer.
languageCodeViewerLanguagesThe programming language for syntax highlighting.
showLineNumbersbooleanfalseIf true, line numbers are displayed.
wrapLongLinesbooleanfalseIf true, long lines are wrapped instead of scrolling horizontally.
bgTransparentbooleantrueIf true, the background is set to transparent.
startingLineNumbernumberThe line number to start counting from if showLineNumbers is true.
themeThemeModesThe theme mode for syntax highlighting ('light' or 'dark'). If not provided, DjunoDesignProvider will determine the theme.
fontSizestring0.85remThe font size of the code.
copyableCopyablePropEnables the copy-to-clipboard feature. Can be customized with tooltips and icons.

Countdown

NameTypeRequiredDefaultDescription
secondsnumber
classNamestring
showTimerboolean
childrenReact.ReactNode
timerPosition'start or end or hidden'
timerRender(props: CountdownRenderProps) => React.ReactNode
onClick() => void
childrenReactNode or ((props: CountdownRenderProps) => ReactNode)

Contributor ✨

Contributors (https://github.com/sanaz-git)

1.2.0

8 months ago

1.2.3

8 months ago

1.2.2

8 months ago

1.2.1

8 months ago

1.1.0-beta

9 months ago

1.0.0-beta

9 months ago

0.9.9

11 months ago

0.9.89

11 months ago

0.9.87

11 months ago

0.9.85

12 months ago

0.9.86

12 months ago

0.9.84

12 months ago

0.9.82

12 months ago

0.9.83

12 months ago

0.9.81

12 months ago

0.9.8

1 year ago

0.9.7

1 year ago

0.9.6

1 year ago

0.8.9

1 year ago

0.8.8

1 year ago

0.8.5

1 year ago

0.8.4

1 year ago

0.8.7

1 year ago

0.8.6

1 year ago

0.9.0

1 year ago

0.7.2

1 year ago

0.5.4

1 year ago

0.5.3

1 year ago

0.9.2

1 year ago

0.7.4

1 year ago

0.9.1

1 year ago

0.7.3

1 year ago

0.5.5

1 year ago

0.5.0

1 year ago

0.7.0

1 year ago

0.5.2

1 year ago

0.5.1

1 year ago

0.7.9

1 year ago

0.9.4

1 year ago

0.7.6

1 year ago

0.9.3

1 year ago

0.7.5

1 year ago

0.7.8

1 year ago

0.9.5

1 year ago

0.7.7

1 year ago

0.8.1

1 year ago

0.8.0

1 year ago

0.6.2

1 year ago

0.8.3

1 year ago

0.8.2

1 year ago

0.6.4

1 year ago

0.4.0

1 year ago

0.6.1

1 year ago

0.6.0

1 year ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.6-beta

2 years ago

0.0.51

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.31

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago