@opalkelly/frontpanel-react-components 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +45 -0
- package/README.md +26 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/types/components/FrontPanel/FrontPanel.d.ts +10 -0
- package/dist/cjs/types/components/FrontPanel/FrontPanel.props.d.ts +23 -0
- package/dist/cjs/types/components/FrontPanel/index.d.ts +7 -0
- package/dist/cjs/types/components/FrontPanelIndicator/FrontPanelIndicator.d.ts +30 -0
- package/dist/cjs/types/components/FrontPanelIndicator/FrontPanelIndicator.props.d.ts +17 -0
- package/dist/cjs/types/components/FrontPanelIndicator/index.d.ts +8 -0
- package/dist/cjs/types/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.d.ts +33 -0
- package/dist/cjs/types/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.props.d.ts +23 -0
- package/dist/cjs/types/components/FrontPanelNumberDisplay/index.d.ts +8 -0
- package/dist/cjs/types/components/FrontPanelNumberEntry/FrontPanelNumberEntry.d.ts +33 -0
- package/dist/cjs/types/components/FrontPanelNumberEntry/FrontPanelNumberEntry.props.d.ts +27 -0
- package/dist/cjs/types/components/FrontPanelNumberEntry/index.d.ts +8 -0
- package/dist/cjs/types/components/FrontPanelPushButton/FrontPanelPushButton.d.ts +31 -0
- package/dist/cjs/types/components/FrontPanelPushButton/FrontPanelPushButton.props.d.ts +17 -0
- package/dist/cjs/types/components/FrontPanelPushButton/index.d.ts +8 -0
- package/dist/cjs/types/components/FrontPanelRangeSlider/FrontPanelRangeSlider.d.ts +31 -0
- package/dist/cjs/types/components/FrontPanelRangeSlider/FrontPanelRangeSlider.props.d.ts +21 -0
- package/dist/cjs/types/components/FrontPanelRangeSlider/index.d.ts +8 -0
- package/dist/cjs/types/components/FrontPanelSelectEntry/FrontPanelSelectEntry.d.ts +17 -0
- package/dist/cjs/types/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.d.ts +43 -0
- package/dist/cjs/types/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.props.d.ts +21 -0
- package/dist/cjs/types/components/FrontPanelSelectEntry/index.d.ts +15 -0
- package/dist/cjs/types/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.d.ts +31 -0
- package/dist/cjs/types/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.props.d.ts +17 -0
- package/dist/cjs/types/components/FrontPanelToggleSwitch/index.d.ts +8 -0
- package/dist/cjs/types/components/FrontPanelTriggerButton/FrontPanelTriggerButton.d.ts +32 -0
- package/dist/cjs/types/components/FrontPanelTriggerButton/FrontPanelTriggerButton.props.d.ts +18 -0
- package/dist/cjs/types/components/FrontPanelTriggerButton/index.d.ts +8 -0
- package/dist/cjs/types/components/Icons/ChevronIcon.d.ts +17 -0
- package/dist/cjs/types/components/Icons/IndicatorArrowIcon.d.ts +17 -0
- package/dist/cjs/types/components/Icons/IndicatorBarIcon.d.ts +10 -0
- package/dist/cjs/types/components/Icons/IndicatorStateIcon.d.ts +14 -0
- package/dist/cjs/types/components/Icons/RadioToggleStateIcon.d.ts +14 -0
- package/dist/cjs/types/components/Icons/SwitchToggleStateIcon.d.ts +14 -0
- package/dist/cjs/types/components/Icons/index.d.ts +12 -0
- package/dist/cjs/types/components/Icons/types.d.ts +17 -0
- package/dist/cjs/types/components/index.d.ts +16 -0
- package/dist/cjs/types/components/types.d.ts +11 -0
- package/dist/cjs/types/contexts/FrontPanelContext.d.ts +15 -0
- package/dist/cjs/types/contexts/index.d.ts +8 -0
- package/dist/cjs/types/core/Binary.d.ts +7 -0
- package/dist/cjs/types/core/Numeric.d.ts +80 -0
- package/dist/cjs/types/core/Types.d.ts +34 -0
- package/dist/cjs/types/core/index.d.ts +9 -0
- package/dist/cjs/types/index.d.ts +10 -0
- package/dist/cjs/types/primitives/Application/Application.d.ts +10 -0
- package/dist/cjs/types/primitives/Application/Application.props.d.ts +10 -0
- package/dist/cjs/types/primitives/Application/index.d.ts +1 -0
- package/dist/cjs/types/primitives/Button/Button.d.ts +33 -0
- package/dist/cjs/types/primitives/Button/Button.props.d.ts +44 -0
- package/dist/cjs/types/primitives/Button/index.d.ts +3 -0
- package/dist/cjs/types/primitives/DigitEntry/DigitEntry.d.ts +33 -0
- package/dist/cjs/types/primitives/DigitEntry/DigitEntry.props.d.ts +51 -0
- package/dist/cjs/types/primitives/DigitEntry/index.d.ts +9 -0
- package/dist/cjs/types/primitives/Indicator/Indicator.d.ts +29 -0
- package/dist/cjs/types/primitives/Indicator/Indicator.props.d.ts +35 -0
- package/dist/cjs/types/primitives/Indicator/index.d.ts +9 -0
- package/dist/cjs/types/primitives/Label/Label.d.ts +31 -0
- package/dist/cjs/types/primitives/Label/Label.props.d.ts +33 -0
- package/dist/cjs/types/primitives/Label/index.d.ts +9 -0
- package/dist/cjs/types/primitives/NumberDisplay/NumberDisplay.d.ts +31 -0
- package/dist/cjs/types/primitives/NumberDisplay/NumberDisplay.props.d.ts +52 -0
- package/dist/cjs/types/primitives/NumberDisplay/index.d.ts +9 -0
- package/dist/cjs/types/primitives/NumberEntry/NumberEntry.d.ts +34 -0
- package/dist/cjs/types/primitives/NumberEntry/NumberEntry.props.d.ts +69 -0
- package/dist/cjs/types/primitives/NumberEntry/NumberEntryDigits.d.ts +27 -0
- package/dist/cjs/types/primitives/NumberEntry/NumberEntryDigits.props.d.ts +43 -0
- package/dist/cjs/types/primitives/NumberEntry/index.d.ts +9 -0
- package/dist/cjs/types/primitives/RangeSlider/RangeSlider.d.ts +33 -0
- package/dist/cjs/types/primitives/RangeSlider/RangeSlider.props.d.ts +77 -0
- package/dist/cjs/types/primitives/RangeSlider/index.d.ts +9 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntry.d.ts +17 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryContent.d.ts +16 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryGroup.d.ts +15 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryItem.d.ts +15 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryLabel.d.ts +15 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryRoot.d.ts +39 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryRoot.props.d.ts +31 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntrySeparator.d.ts +15 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryTrigger.d.ts +16 -0
- package/dist/cjs/types/primitives/SelectEntry/SelectEntryTrigger.props.d.ts +16 -0
- package/dist/cjs/types/primitives/SelectEntry/index.d.ts +17 -0
- package/dist/cjs/types/primitives/Toggle/Toggle.d.ts +35 -0
- package/dist/cjs/types/primitives/Toggle/Toggle.props.d.ts +37 -0
- package/dist/cjs/types/primitives/Toggle/index.d.ts +9 -0
- package/dist/cjs/types/primitives/ToggleSwitch/ToggleSwitch.d.ts +32 -0
- package/dist/cjs/types/primitives/ToggleSwitch/ToggleSwitch.props.d.ts +22 -0
- package/dist/cjs/types/primitives/ToggleSwitch/index.d.ts +8 -0
- package/dist/cjs/types/primitives/Tooltip/Tooltip.d.ts +35 -0
- package/dist/cjs/types/primitives/Tooltip/Tooltip.props.d.ts +17 -0
- package/dist/cjs/types/primitives/Tooltip/index.d.ts +8 -0
- package/dist/cjs/types/primitives/TooltipUtility.d.ts +12 -0
- package/dist/cjs/types/primitives/index.d.ts +24 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/types/components/FrontPanel/FrontPanel.d.ts +10 -0
- package/dist/esm/types/components/FrontPanel/FrontPanel.props.d.ts +23 -0
- package/dist/esm/types/components/FrontPanel/index.d.ts +7 -0
- package/dist/esm/types/components/FrontPanelIndicator/FrontPanelIndicator.d.ts +30 -0
- package/dist/esm/types/components/FrontPanelIndicator/FrontPanelIndicator.props.d.ts +17 -0
- package/dist/esm/types/components/FrontPanelIndicator/index.d.ts +8 -0
- package/dist/esm/types/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.d.ts +33 -0
- package/dist/esm/types/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.props.d.ts +23 -0
- package/dist/esm/types/components/FrontPanelNumberDisplay/index.d.ts +8 -0
- package/dist/esm/types/components/FrontPanelNumberEntry/FrontPanelNumberEntry.d.ts +33 -0
- package/dist/esm/types/components/FrontPanelNumberEntry/FrontPanelNumberEntry.props.d.ts +27 -0
- package/dist/esm/types/components/FrontPanelNumberEntry/index.d.ts +8 -0
- package/dist/esm/types/components/FrontPanelPushButton/FrontPanelPushButton.d.ts +31 -0
- package/dist/esm/types/components/FrontPanelPushButton/FrontPanelPushButton.props.d.ts +17 -0
- package/dist/esm/types/components/FrontPanelPushButton/index.d.ts +8 -0
- package/dist/esm/types/components/FrontPanelRangeSlider/FrontPanelRangeSlider.d.ts +31 -0
- package/dist/esm/types/components/FrontPanelRangeSlider/FrontPanelRangeSlider.props.d.ts +21 -0
- package/dist/esm/types/components/FrontPanelRangeSlider/index.d.ts +8 -0
- package/dist/esm/types/components/FrontPanelSelectEntry/FrontPanelSelectEntry.d.ts +17 -0
- package/dist/esm/types/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.d.ts +43 -0
- package/dist/esm/types/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.props.d.ts +21 -0
- package/dist/esm/types/components/FrontPanelSelectEntry/index.d.ts +15 -0
- package/dist/esm/types/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.d.ts +31 -0
- package/dist/esm/types/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.props.d.ts +17 -0
- package/dist/esm/types/components/FrontPanelToggleSwitch/index.d.ts +8 -0
- package/dist/esm/types/components/FrontPanelTriggerButton/FrontPanelTriggerButton.d.ts +32 -0
- package/dist/esm/types/components/FrontPanelTriggerButton/FrontPanelTriggerButton.props.d.ts +18 -0
- package/dist/esm/types/components/FrontPanelTriggerButton/index.d.ts +8 -0
- package/dist/esm/types/components/Icons/ChevronIcon.d.ts +17 -0
- package/dist/esm/types/components/Icons/IndicatorArrowIcon.d.ts +17 -0
- package/dist/esm/types/components/Icons/IndicatorBarIcon.d.ts +10 -0
- package/dist/esm/types/components/Icons/IndicatorStateIcon.d.ts +14 -0
- package/dist/esm/types/components/Icons/RadioToggleStateIcon.d.ts +14 -0
- package/dist/esm/types/components/Icons/SwitchToggleStateIcon.d.ts +14 -0
- package/dist/esm/types/components/Icons/index.d.ts +12 -0
- package/dist/esm/types/components/Icons/types.d.ts +17 -0
- package/dist/esm/types/components/index.d.ts +16 -0
- package/dist/esm/types/components/types.d.ts +11 -0
- package/dist/esm/types/contexts/FrontPanelContext.d.ts +15 -0
- package/dist/esm/types/contexts/index.d.ts +8 -0
- package/dist/esm/types/core/Binary.d.ts +7 -0
- package/dist/esm/types/core/Numeric.d.ts +80 -0
- package/dist/esm/types/core/Types.d.ts +34 -0
- package/dist/esm/types/core/index.d.ts +9 -0
- package/dist/esm/types/index.d.ts +10 -0
- package/dist/esm/types/primitives/Application/Application.d.ts +10 -0
- package/dist/esm/types/primitives/Application/Application.props.d.ts +10 -0
- package/dist/esm/types/primitives/Application/index.d.ts +1 -0
- package/dist/esm/types/primitives/Button/Button.d.ts +33 -0
- package/dist/esm/types/primitives/Button/Button.props.d.ts +44 -0
- package/dist/esm/types/primitives/Button/index.d.ts +3 -0
- package/dist/esm/types/primitives/DigitEntry/DigitEntry.d.ts +33 -0
- package/dist/esm/types/primitives/DigitEntry/DigitEntry.props.d.ts +51 -0
- package/dist/esm/types/primitives/DigitEntry/index.d.ts +9 -0
- package/dist/esm/types/primitives/Indicator/Indicator.d.ts +29 -0
- package/dist/esm/types/primitives/Indicator/Indicator.props.d.ts +35 -0
- package/dist/esm/types/primitives/Indicator/index.d.ts +9 -0
- package/dist/esm/types/primitives/Label/Label.d.ts +31 -0
- package/dist/esm/types/primitives/Label/Label.props.d.ts +33 -0
- package/dist/esm/types/primitives/Label/index.d.ts +9 -0
- package/dist/esm/types/primitives/NumberDisplay/NumberDisplay.d.ts +31 -0
- package/dist/esm/types/primitives/NumberDisplay/NumberDisplay.props.d.ts +52 -0
- package/dist/esm/types/primitives/NumberDisplay/index.d.ts +9 -0
- package/dist/esm/types/primitives/NumberEntry/NumberEntry.d.ts +34 -0
- package/dist/esm/types/primitives/NumberEntry/NumberEntry.props.d.ts +69 -0
- package/dist/esm/types/primitives/NumberEntry/NumberEntryDigits.d.ts +27 -0
- package/dist/esm/types/primitives/NumberEntry/NumberEntryDigits.props.d.ts +43 -0
- package/dist/esm/types/primitives/NumberEntry/index.d.ts +9 -0
- package/dist/esm/types/primitives/RangeSlider/RangeSlider.d.ts +33 -0
- package/dist/esm/types/primitives/RangeSlider/RangeSlider.props.d.ts +77 -0
- package/dist/esm/types/primitives/RangeSlider/index.d.ts +9 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntry.d.ts +17 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryContent.d.ts +16 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryGroup.d.ts +15 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryItem.d.ts +15 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryLabel.d.ts +15 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryRoot.d.ts +39 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryRoot.props.d.ts +31 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntrySeparator.d.ts +15 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryTrigger.d.ts +16 -0
- package/dist/esm/types/primitives/SelectEntry/SelectEntryTrigger.props.d.ts +16 -0
- package/dist/esm/types/primitives/SelectEntry/index.d.ts +17 -0
- package/dist/esm/types/primitives/Toggle/Toggle.d.ts +35 -0
- package/dist/esm/types/primitives/Toggle/Toggle.props.d.ts +37 -0
- package/dist/esm/types/primitives/Toggle/index.d.ts +9 -0
- package/dist/esm/types/primitives/ToggleSwitch/ToggleSwitch.d.ts +32 -0
- package/dist/esm/types/primitives/ToggleSwitch/ToggleSwitch.props.d.ts +22 -0
- package/dist/esm/types/primitives/ToggleSwitch/index.d.ts +8 -0
- package/dist/esm/types/primitives/Tooltip/Tooltip.d.ts +35 -0
- package/dist/esm/types/primitives/Tooltip/Tooltip.props.d.ts +17 -0
- package/dist/esm/types/primitives/Tooltip/index.d.ts +8 -0
- package/dist/esm/types/primitives/TooltipUtility.d.ts +12 -0
- package/dist/esm/types/primitives/index.d.ts +24 -0
- package/dist/index.d.ts +1456 -0
- package/package.json +81 -0
- package/src/components/FrontPanel/FrontPanel.props.ts +25 -0
- package/src/components/FrontPanel/FrontPanel.tsx +33 -0
- package/src/components/FrontPanel/index.ts +8 -0
- package/src/components/FrontPanelIndicator/FrontPanelIndicator.css +0 -0
- package/src/components/FrontPanelIndicator/FrontPanelIndicator.props.ts +20 -0
- package/src/components/FrontPanelIndicator/FrontPanelIndicator.stories.tsx +44 -0
- package/src/components/FrontPanelIndicator/FrontPanelIndicator.tsx +81 -0
- package/src/components/FrontPanelIndicator/index.ts +10 -0
- package/src/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.css +0 -0
- package/src/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.props.ts +27 -0
- package/src/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.stories.tsx +67 -0
- package/src/components/FrontPanelNumberDisplay/FrontPanelNumberDisplay.tsx +130 -0
- package/src/components/FrontPanelNumberDisplay/index.ts +10 -0
- package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.css +0 -0
- package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.props.ts +32 -0
- package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.stories.tsx +104 -0
- package/src/components/FrontPanelNumberEntry/FrontPanelNumberEntry.tsx +195 -0
- package/src/components/FrontPanelNumberEntry/index.ts +10 -0
- package/src/components/FrontPanelPushButton/FrontPanelPushButton.css +0 -0
- package/src/components/FrontPanelPushButton/FrontPanelPushButton.props.ts +20 -0
- package/src/components/FrontPanelPushButton/FrontPanelPushButton.stories.tsx +46 -0
- package/src/components/FrontPanelPushButton/FrontPanelPushButton.tsx +80 -0
- package/src/components/FrontPanelPushButton/index.ts +10 -0
- package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.css +0 -0
- package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.props.ts +25 -0
- package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.stories.tsx +92 -0
- package/src/components/FrontPanelRangeSlider/FrontPanelRangeSlider.tsx +108 -0
- package/src/components/FrontPanelRangeSlider/index.ts +10 -0
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntry.css +0 -0
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntry.stories.tsx +107 -0
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntry.tsx +30 -0
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.props.ts +25 -0
- package/src/components/FrontPanelSelectEntry/FrontPanelSelectEntryRoot.tsx +175 -0
- package/src/components/FrontPanelSelectEntry/index.ts +17 -0
- package/src/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.css +0 -0
- package/src/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.props.ts +20 -0
- package/src/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.stories.tsx +46 -0
- package/src/components/FrontPanelToggleSwitch/FrontPanelToggleSwitch.tsx +108 -0
- package/src/components/FrontPanelToggleSwitch/index.ts +10 -0
- package/src/components/FrontPanelTriggerButton/FrontPanelTriggerButton.css +0 -0
- package/src/components/FrontPanelTriggerButton/FrontPanelTriggerButton.props.ts +21 -0
- package/src/components/FrontPanelTriggerButton/FrontPanelTriggerButton.stories.tsx +46 -0
- package/src/components/FrontPanelTriggerButton/FrontPanelTriggerButton.tsx +65 -0
- package/src/components/FrontPanelTriggerButton/index.ts +10 -0
- package/src/components/Icons/ChevronIcon.tsx +69 -0
- package/src/components/Icons/IndicatorArrowIcon.tsx +59 -0
- package/src/components/Icons/IndicatorBarIcon.tsx +34 -0
- package/src/components/Icons/IndicatorStateIcon.tsx +82 -0
- package/src/components/Icons/RadioToggleStateIcon.tsx +62 -0
- package/src/components/Icons/SwitchToggleStateIcon.tsx +68 -0
- package/src/components/Icons/index.ts +15 -0
- package/src/components/Icons/types.ts +20 -0
- package/src/components/index.ts +31 -0
- package/src/components/types.ts +13 -0
- package/src/contexts/FrontPanelContext.ts +23 -0
- package/src/contexts/index.ts +10 -0
- package/src/core/Binary.ts +23 -0
- package/src/core/Numeric.ts +168 -0
- package/src/core/Types.ts +39 -0
- package/src/core/index.ts +11 -0
- package/src/fonts/Inter-VariableFont_slnt,wght.ttf +0 -0
- package/src/index.css +11 -0
- package/src/index.ts +11 -0
- package/src/primitives/Application/Application.props.ts +10 -0
- package/src/primitives/Application/Application.tsx +24 -0
- package/src/primitives/Application/index.ts +1 -0
- package/src/primitives/Button/Button.css +60 -0
- package/src/primitives/Button/Button.props.ts +53 -0
- package/src/primitives/Button/Button.stories.tsx +54 -0
- package/src/primitives/Button/Button.tsx +75 -0
- package/src/primitives/Button/index.ts +4 -0
- package/src/primitives/DigitEntry/DigitEntry.css +120 -0
- package/src/primitives/DigitEntry/DigitEntry.props.ts +62 -0
- package/src/primitives/DigitEntry/DigitEntry.stories.tsx +84 -0
- package/src/primitives/DigitEntry/DigitEntry.tsx +226 -0
- package/src/primitives/DigitEntry/index.ts +15 -0
- package/src/primitives/Indicator/Indicator.css +66 -0
- package/src/primitives/Indicator/Indicator.props.ts +42 -0
- package/src/primitives/Indicator/Indicator.stories.tsx +44 -0
- package/src/primitives/Indicator/Indicator.tsx +64 -0
- package/src/primitives/Indicator/index.ts +11 -0
- package/src/primitives/Label/Label.css +49 -0
- package/src/primitives/Label/Label.props.ts +38 -0
- package/src/primitives/Label/Label.stories.tsx +53 -0
- package/src/primitives/Label/Label.tsx +66 -0
- package/src/primitives/Label/index.ts +11 -0
- package/src/primitives/NumberDisplay/NumberDisplay.css +63 -0
- package/src/primitives/NumberDisplay/NumberDisplay.props.ts +65 -0
- package/src/primitives/NumberDisplay/NumberDisplay.stories.tsx +83 -0
- package/src/primitives/NumberDisplay/NumberDisplay.tsx +155 -0
- package/src/primitives/NumberDisplay/index.ts +11 -0
- package/src/primitives/NumberEntry/NumberEntry.css +71 -0
- package/src/primitives/NumberEntry/NumberEntry.props.ts +86 -0
- package/src/primitives/NumberEntry/NumberEntry.stories.tsx +129 -0
- package/src/primitives/NumberEntry/NumberEntry.tsx +249 -0
- package/src/primitives/NumberEntry/NumberEntryDigits.props.ts +57 -0
- package/src/primitives/NumberEntry/NumberEntryDigits.tsx +117 -0
- package/src/primitives/NumberEntry/index.ts +11 -0
- package/src/primitives/RangeSlider/RangeSlider.css +110 -0
- package/src/primitives/RangeSlider/RangeSlider.props.ts +93 -0
- package/src/primitives/RangeSlider/RangeSlider.stories.tsx +76 -0
- package/src/primitives/RangeSlider/RangeSlider.tsx +168 -0
- package/src/primitives/RangeSlider/index.ts +14 -0
- package/src/primitives/SelectEntry/SelectEntry.stories.tsx +86 -0
- package/src/primitives/SelectEntry/SelectEntry.tsx +29 -0
- package/src/primitives/SelectEntry/SelectEntryContent.css +94 -0
- package/src/primitives/SelectEntry/SelectEntryContent.tsx +63 -0
- package/src/primitives/SelectEntry/SelectEntryGroup.css +17 -0
- package/src/primitives/SelectEntry/SelectEntryGroup.tsx +37 -0
- package/src/primitives/SelectEntry/SelectEntryItem.css +35 -0
- package/src/primitives/SelectEntry/SelectEntryItem.tsx +51 -0
- package/src/primitives/SelectEntry/SelectEntryLabel.css +16 -0
- package/src/primitives/SelectEntry/SelectEntryLabel.tsx +43 -0
- package/src/primitives/SelectEntry/SelectEntryRoot.css +10 -0
- package/src/primitives/SelectEntry/SelectEntryRoot.props.ts +38 -0
- package/src/primitives/SelectEntry/SelectEntryRoot.tsx +69 -0
- package/src/primitives/SelectEntry/SelectEntrySeparator.css +12 -0
- package/src/primitives/SelectEntry/SelectEntrySeparator.tsx +38 -0
- package/src/primitives/SelectEntry/SelectEntryTrigger.css +49 -0
- package/src/primitives/SelectEntry/SelectEntryTrigger.props.ts +18 -0
- package/src/primitives/SelectEntry/SelectEntryTrigger.tsx +111 -0
- package/src/primitives/SelectEntry/index.ts +20 -0
- package/src/primitives/Toggle/Toggle.css +67 -0
- package/src/primitives/Toggle/Toggle.props.ts +44 -0
- package/src/primitives/Toggle/Toggle.stories.tsx +61 -0
- package/src/primitives/Toggle/Toggle.tsx +90 -0
- package/src/primitives/Toggle/index.ts +11 -0
- package/src/primitives/ToggleSwitch/ToggleSwitch.css +118 -0
- package/src/primitives/ToggleSwitch/ToggleSwitch.props.ts +26 -0
- package/src/primitives/ToggleSwitch/ToggleSwitch.stories.tsx +85 -0
- package/src/primitives/ToggleSwitch/ToggleSwitch.tsx +73 -0
- package/src/primitives/ToggleSwitch/index.ts +10 -0
- package/src/primitives/Tooltip/Tooltip.css +93 -0
- package/src/primitives/Tooltip/Tooltip.props.ts +20 -0
- package/src/primitives/Tooltip/Tooltip.tsx +91 -0
- package/src/primitives/Tooltip/index.ts +10 -0
- package/src/primitives/TooltipUtility.tsx +24 -0
- package/src/primitives/index.ts +44 -0
- package/src/stories/decorators/Application.decorator.tsx +20 -0
- package/src/stories/decorators/FrontPanel.decorator.tsx +47 -0
@@ -0,0 +1,168 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import { NumeralSystem } from "./Types";
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Class representing numeric digits in various numeral systems.
|
12
|
+
*/
|
13
|
+
export class NumericDigits {
|
14
|
+
/**
|
15
|
+
* Maximum number of digits.
|
16
|
+
*/
|
17
|
+
static readonly MAX_DIGITS: number = 1024;
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Binary digit values.
|
21
|
+
*/
|
22
|
+
static readonly BINARY_DIGITVALUES = ["0", "1"];
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Octal digit values.
|
26
|
+
*/
|
27
|
+
static readonly OCTAL_DIGITVALUES = ["0", "1", "2", "3", "4", "5", "6", "7"];
|
28
|
+
|
29
|
+
/**
|
30
|
+
* Decimal digit values.
|
31
|
+
*/
|
32
|
+
static readonly DECIMAL_DIGITVALUES = [...NumericDigits.OCTAL_DIGITVALUES, "8", "9"];
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Hexadecimal digit values.
|
36
|
+
*/
|
37
|
+
static readonly HEXADECIMAL_DIGITVALUES = [
|
38
|
+
...NumericDigits.DECIMAL_DIGITVALUES,
|
39
|
+
"A",
|
40
|
+
"B",
|
41
|
+
"C",
|
42
|
+
"D",
|
43
|
+
"E",
|
44
|
+
"F"
|
45
|
+
];
|
46
|
+
|
47
|
+
private readonly _DigitCount: bigint;
|
48
|
+
private readonly _NumeralSystem: NumeralSystem;
|
49
|
+
private readonly _DigitChars: string[];
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Gets the count of digits.
|
53
|
+
*/
|
54
|
+
public get DigitCount() {
|
55
|
+
return this._DigitCount;
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Gets the numeral system.
|
60
|
+
*/
|
61
|
+
public get NumeralSystem() {
|
62
|
+
return this._NumeralSystem;
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Gets the digit characters.
|
67
|
+
*/
|
68
|
+
public get DigitChars() {
|
69
|
+
return this._DigitChars;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Creates a new instance of NumericDigits.
|
74
|
+
* @param digitCount - The count of digits.
|
75
|
+
* @param numeralSystem - The numeral system.
|
76
|
+
*/
|
77
|
+
constructor(digitCount: bigint, numeralSystem: NumeralSystem) {
|
78
|
+
this._DigitCount = digitCount;
|
79
|
+
this._NumeralSystem = numeralSystem;
|
80
|
+
this._DigitChars = NumericDigits.GetDigitChars(numeralSystem);
|
81
|
+
}
|
82
|
+
|
83
|
+
/**
|
84
|
+
* Gets the character representation of the digit corresponding
|
85
|
+
* to the value specified.
|
86
|
+
* @param value - The value.
|
87
|
+
* @returns {string} - The digit as represented in the numeral system.
|
88
|
+
*/
|
89
|
+
public GetDigitFromValue(value: number): string {
|
90
|
+
let targetDigitValue: number = value % this._NumeralSystem;
|
91
|
+
|
92
|
+
if (targetDigitValue < 0) {
|
93
|
+
targetDigitValue += this._NumeralSystem;
|
94
|
+
}
|
95
|
+
|
96
|
+
return targetDigitValue.toString(this._NumeralSystem);
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Gets the digit characters from the numeral.
|
101
|
+
* @param numeral - The numeral system.
|
102
|
+
* @returns {string[]} - The digit characters.
|
103
|
+
*/
|
104
|
+
public static GetDigitChars(numeral: NumeralSystem): string[] {
|
105
|
+
let retval: string[];
|
106
|
+
|
107
|
+
switch (numeral) {
|
108
|
+
case NumeralSystem.Binary:
|
109
|
+
retval = NumericDigits.BINARY_DIGITVALUES;
|
110
|
+
break;
|
111
|
+
case NumeralSystem.Octal:
|
112
|
+
retval = NumericDigits.OCTAL_DIGITVALUES;
|
113
|
+
break;
|
114
|
+
case NumeralSystem.Decimal:
|
115
|
+
retval = NumericDigits.DECIMAL_DIGITVALUES;
|
116
|
+
break;
|
117
|
+
case NumeralSystem.Hexadecimal:
|
118
|
+
retval = NumericDigits.HEXADECIMAL_DIGITVALUES;
|
119
|
+
break;
|
120
|
+
default:
|
121
|
+
retval = [];
|
122
|
+
break;
|
123
|
+
}
|
124
|
+
|
125
|
+
return retval;
|
126
|
+
}
|
127
|
+
|
128
|
+
/**
|
129
|
+
* Computes the digit count from the bits.
|
130
|
+
* @param bitcount - The bit count.
|
131
|
+
* @param numeral - The numeral.
|
132
|
+
* @returns {bigint} - The digit count.
|
133
|
+
*/
|
134
|
+
public static ComputeDigitCountFromBits(bitcount: number, numeral: NumeralSystem) {
|
135
|
+
const maxValue: bigint = (1n << BigInt(bitcount)) - 1n;
|
136
|
+
|
137
|
+
return this.ComputeDigitCountFromValue(maxValue, numeral);
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Computes the digit count from the value.
|
142
|
+
* @param value - The value.
|
143
|
+
* @param numeral - The numeral.
|
144
|
+
* @returns {bigint} - The digit count.
|
145
|
+
*/
|
146
|
+
public static ComputeDigitCountFromValue(value: bigint, numeral: NumeralSystem): bigint {
|
147
|
+
// The following equation computes the number of digits necessary to represent the value
|
148
|
+
// given the radix. However, an iterative solution is used because Math.log operates on
|
149
|
+
// the number type and therefore limits the value to 52 bits. This solution should allow
|
150
|
+
// value to be any number of bits.
|
151
|
+
//
|
152
|
+
// d = ceiling(log[radix](value))
|
153
|
+
// v = value
|
154
|
+
// d = digits
|
155
|
+
|
156
|
+
const radix: bigint = BigInt(numeral);
|
157
|
+
|
158
|
+
let val: bigint = value;
|
159
|
+
|
160
|
+
let digitIndex: bigint;
|
161
|
+
|
162
|
+
for (digitIndex = 0n; digitIndex < NumericDigits.MAX_DIGITS && val !== 0n; digitIndex++) {
|
163
|
+
val = val / radix;
|
164
|
+
}
|
165
|
+
|
166
|
+
return digitIndex > 0n ? digitIndex : 1n;
|
167
|
+
}
|
168
|
+
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
/**
|
9
|
+
* Enumeration representing numeral systems.
|
10
|
+
*/
|
11
|
+
export enum NumeralSystem {
|
12
|
+
/**
|
13
|
+
* Binary numeral system (base 2).
|
14
|
+
*/
|
15
|
+
Binary = 2,
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Octal numeral system (base 8).
|
19
|
+
*/
|
20
|
+
Octal = 8,
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Decimal numeral system (base 10).
|
24
|
+
*/
|
25
|
+
Decimal = 10,
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Hexadecimal numeral system (base 16).
|
29
|
+
*/
|
30
|
+
Hexadecimal = 16
|
31
|
+
}
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Enumeration representing toggle states.
|
35
|
+
*/
|
36
|
+
export enum ToggleState {
|
37
|
+
Off,
|
38
|
+
On
|
39
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
export * from "./Types";
|
9
|
+
|
10
|
+
export * from "./Numeric";
|
11
|
+
export * from "./Binary";
|
Binary file
|
package/src/index.css
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
@font-face {
|
9
|
+
font-family: "Inter";
|
10
|
+
src: url("./fonts/Inter-VariableFont_slnt\,wght.ttf") format("truetype");
|
11
|
+
}
|
package/src/index.ts
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
export * from "./core";
|
9
|
+
export * from "./components";
|
10
|
+
export * from "./contexts";
|
11
|
+
export * from "./primitives";
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
interface ApplicationProps extends React.PropsWithChildren<NonNullable<unknown>> {}
|
9
|
+
|
10
|
+
export { ApplicationProps };
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import * as React from "react";
|
9
|
+
|
10
|
+
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
11
|
+
|
12
|
+
import { ApplicationProps } from "./Application.props";
|
13
|
+
|
14
|
+
type ApplicationElement = React.ElementRef<"div">;
|
15
|
+
|
16
|
+
const Application = React.forwardRef<ApplicationElement, ApplicationProps>(
|
17
|
+
(props, _forwardedRef) => {
|
18
|
+
return <TooltipPrimitive.Provider>{props.children}</TooltipPrimitive.Provider>;
|
19
|
+
}
|
20
|
+
);
|
21
|
+
|
22
|
+
Application.displayName = "Application";
|
23
|
+
|
24
|
+
export default Application;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default } from "./Application";
|
@@ -0,0 +1,60 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
.okButton {
|
9
|
+
/* Layout */
|
10
|
+
display: inline-flex;
|
11
|
+
padding: var(--button-padding, 6px 12px);
|
12
|
+
justify-content: center;
|
13
|
+
align-items: center;
|
14
|
+
gap: 8px;
|
15
|
+
|
16
|
+
/* Style */
|
17
|
+
border-width: 0px;
|
18
|
+
border-radius: 4px;
|
19
|
+
background: var(--brand-12, #44bd84);
|
20
|
+
|
21
|
+
/* Typography */
|
22
|
+
color: var(--Base-White, #fff);
|
23
|
+
text-align: center;
|
24
|
+
font-family: Inter, "Nunito Sans", sans-serif, ui-sans-serif;
|
25
|
+
font-size: var(--button-font-size, 12px);
|
26
|
+
font-style: normal;
|
27
|
+
font-weight: 600;
|
28
|
+
line-height: var(--button-line-height, 12px); /* 100% */
|
29
|
+
|
30
|
+
/* State Pressed */
|
31
|
+
&:is(:active) {
|
32
|
+
background: #329466;
|
33
|
+
}
|
34
|
+
|
35
|
+
/* State Disabled */
|
36
|
+
&:is(:disabled) {
|
37
|
+
background: var(--Gray-2, #d0d7df);
|
38
|
+
}
|
39
|
+
|
40
|
+
/* Size 1 */
|
41
|
+
&:where(.ok-r-size-1) {
|
42
|
+
--button-padding: 6px 12px;
|
43
|
+
--button-font-size: 12px;
|
44
|
+
--button-line-height: 12px;
|
45
|
+
}
|
46
|
+
|
47
|
+
/* Sizes 2*/
|
48
|
+
&:where(.ok-r-size-2) {
|
49
|
+
--button-padding: 10px 18px;
|
50
|
+
--button-font-size: 14px;
|
51
|
+
--button-line-height: 14px;
|
52
|
+
}
|
53
|
+
|
54
|
+
/* Sizes 3*/
|
55
|
+
&:where(.ok-r-size-3) {
|
56
|
+
--button-padding: 18px 22px;
|
57
|
+
--button-font-size: 20px;
|
58
|
+
--button-line-height: 20px;
|
59
|
+
}
|
60
|
+
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
export type ButtonSize = 1 | 2 | 3;
|
9
|
+
export type ButtonStateChangeEventHandler = () => void;
|
10
|
+
export type ButtonClickEventHandler = () => void;
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Interface for the properties of the `Button` component.
|
14
|
+
*/
|
15
|
+
interface ButtonProps {
|
16
|
+
/**
|
17
|
+
* Label text to be displayed in the button
|
18
|
+
*/
|
19
|
+
label: string;
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Optional CSS class to apply to the button
|
23
|
+
*/
|
24
|
+
className?: string;
|
25
|
+
|
26
|
+
/**
|
27
|
+
* Optional size of the button
|
28
|
+
* @default 1
|
29
|
+
*/
|
30
|
+
size?: ButtonSize;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Optional tooltip text to be displayed on hover
|
34
|
+
*/
|
35
|
+
tooltip?: string;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Optional event handler for the button down event
|
39
|
+
*/
|
40
|
+
onButtonDown?: ButtonStateChangeEventHandler;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Optional event handler for the button up event
|
44
|
+
*/
|
45
|
+
onButtonUp?: ButtonStateChangeEventHandler;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Optional event handler for the button click event
|
49
|
+
*/
|
50
|
+
onButtonClick?: ButtonClickEventHandler;
|
51
|
+
}
|
52
|
+
|
53
|
+
export default ButtonProps;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
9
|
+
|
10
|
+
import withApplication from "../../stories/decorators/Application.decorator";
|
11
|
+
|
12
|
+
import Button from "./Button";
|
13
|
+
|
14
|
+
// Configure Story metadata
|
15
|
+
const meta = {
|
16
|
+
title: "Components/Button",
|
17
|
+
component: Button,
|
18
|
+
parameters: {
|
19
|
+
layout: "centered" // Center the component in the Canvas
|
20
|
+
},
|
21
|
+
tags: ["autodocs"], // Automatically generate documentation
|
22
|
+
argTypes: {
|
23
|
+
size: {
|
24
|
+
control: { type: "range", min: 1, max: 3, step: 1 }
|
25
|
+
},
|
26
|
+
disabled: { control: "boolean" },
|
27
|
+
// Disable event callback arguments
|
28
|
+
onButtonClick: {
|
29
|
+
control: { disable: true }
|
30
|
+
},
|
31
|
+
onButtonDown: {
|
32
|
+
control: { disable: true }
|
33
|
+
},
|
34
|
+
onButtonUp: {
|
35
|
+
control: { disable: true }
|
36
|
+
}
|
37
|
+
}
|
38
|
+
} satisfies Meta<typeof Button>;
|
39
|
+
|
40
|
+
export default meta;
|
41
|
+
|
42
|
+
type Story = StoryObj<typeof meta>;
|
43
|
+
|
44
|
+
// Primary Story
|
45
|
+
export const Primary: Story = {
|
46
|
+
decorators: [withApplication],
|
47
|
+
args: {
|
48
|
+
label: "Button",
|
49
|
+
// Optional Properties
|
50
|
+
size: 1,
|
51
|
+
disabled: false,
|
52
|
+
tooltip: "Button tooltip"
|
53
|
+
}
|
54
|
+
};
|
@@ -0,0 +1,75 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import React from "react";
|
9
|
+
|
10
|
+
import classNames from "classnames";
|
11
|
+
|
12
|
+
import ButtonProps from "./Button.props";
|
13
|
+
|
14
|
+
import "../../index.css";
|
15
|
+
|
16
|
+
import "./Button.css";
|
17
|
+
|
18
|
+
//import { Slot } from "@radix-ui/react-slot";
|
19
|
+
|
20
|
+
import { withTooltip } from "../TooltipUtility";
|
21
|
+
|
22
|
+
type ButtonElement = React.ElementRef<"button">;
|
23
|
+
|
24
|
+
interface ButtonCombinedProps extends React.ComponentPropsWithoutRef<"button">, ButtonProps {}
|
25
|
+
|
26
|
+
export type { ButtonCombinedProps };
|
27
|
+
|
28
|
+
/**
|
29
|
+
* `Button` is a React component that renders a button with an optional label and optional tooltip.
|
30
|
+
* The button event handlers provide notification when the button is clicked, pressed, or released
|
31
|
+
* and can be used to perform actions in response to these events.
|
32
|
+
*
|
33
|
+
* @component
|
34
|
+
* @param {object} props - Properties passed to component
|
35
|
+
* @param {React.Ref} forwardedRef - Forwarded ref for the button
|
36
|
+
*
|
37
|
+
* @returns {React.Node} The rendered Button component
|
38
|
+
*
|
39
|
+
* @example
|
40
|
+
* ```jsx
|
41
|
+
* <Button
|
42
|
+
* label="Button"
|
43
|
+
* onButtonClick={() => console.log("Button clicked")} />
|
44
|
+
* ```
|
45
|
+
*/
|
46
|
+
const Button = React.forwardRef<ButtonElement, ButtonCombinedProps>((props, forwardedRef) => {
|
47
|
+
const {
|
48
|
+
className,
|
49
|
+
label,
|
50
|
+
size = 1,
|
51
|
+
onButtonUp,
|
52
|
+
onButtonDown,
|
53
|
+
onButtonClick,
|
54
|
+
...buttonProps
|
55
|
+
} = props;
|
56
|
+
|
57
|
+
const ButtonWithTooltip = withTooltip(
|
58
|
+
<button
|
59
|
+
data-disabled={buttonProps.disabled || undefined}
|
60
|
+
{...buttonProps}
|
61
|
+
ref={forwardedRef}
|
62
|
+
className={classNames("okButton", className, "ok-r-size-" + size)}
|
63
|
+
onMouseDown={onButtonDown}
|
64
|
+
onMouseUp={onButtonUp}
|
65
|
+
onClick={onButtonClick}>
|
66
|
+
{label}
|
67
|
+
</button>
|
68
|
+
);
|
69
|
+
|
70
|
+
return <ButtonWithTooltip {...props} />;
|
71
|
+
});
|
72
|
+
|
73
|
+
Button.displayName = "Button";
|
74
|
+
|
75
|
+
export default Button;
|
@@ -0,0 +1,120 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2024 Opal Kelly Incorporated
|
3
|
+
*
|
4
|
+
* This source code is licensed under the FrontPanel license.
|
5
|
+
* See the LICENSE file found in the root directory of this project.
|
6
|
+
*/
|
7
|
+
|
8
|
+
.okDigitEntry {
|
9
|
+
/* Layout */
|
10
|
+
display: inline-flex;
|
11
|
+
flex-direction: column;
|
12
|
+
justify-content: center;
|
13
|
+
align-items: center;
|
14
|
+
gap: 1px;
|
15
|
+
|
16
|
+
/* Content Style */
|
17
|
+
.okDigitEntryContent {
|
18
|
+
/* Layout */
|
19
|
+
display: flex;
|
20
|
+
padding: var(--spacing-xxs, 2px);
|
21
|
+
flex-direction: column;
|
22
|
+
justify-content: center;
|
23
|
+
align-items: center;
|
24
|
+
|
25
|
+
/* Style */
|
26
|
+
border-radius: 1px;
|
27
|
+
|
28
|
+
/* Typography */
|
29
|
+
color: var(--Dark, #343434);
|
30
|
+
text-align: center;
|
31
|
+
font-family: Monaco;
|
32
|
+
font-size: var(--digit-font-size, 12px);
|
33
|
+
font-style: normal;
|
34
|
+
font-weight: 400;
|
35
|
+
line-height: var(--digit-line-height, 12px); /* 200% */
|
36
|
+
letter-spacing: 1.26px;
|
37
|
+
text-transform: uppercase;
|
38
|
+
}
|
39
|
+
|
40
|
+
/* Increment Indicator Style */
|
41
|
+
.okDigitEntryIncrementIndicator {
|
42
|
+
visibility: hidden;
|
43
|
+
}
|
44
|
+
|
45
|
+
/* Decrement Indicator Style */
|
46
|
+
.okDigitEntryDecrementIndicator {
|
47
|
+
visibility: hidden;
|
48
|
+
}
|
49
|
+
|
50
|
+
/* Size 1 */
|
51
|
+
&:where(.ok-r-size-1) {
|
52
|
+
--digit-font-size: 12px;
|
53
|
+
--digit-line-height: 12px;
|
54
|
+
}
|
55
|
+
|
56
|
+
/* Sizes 2 */
|
57
|
+
&:where(.ok-r-size-2) {
|
58
|
+
--digit-font-size: 14px;
|
59
|
+
--digit-line-height: 14px;
|
60
|
+
}
|
61
|
+
|
62
|
+
/* Sizes 3 */
|
63
|
+
&:where(.ok-r-size-3) {
|
64
|
+
--digit-font-size: 20px;
|
65
|
+
--digit-line-height: 20px;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
div.okDigitEntry:focus {
|
70
|
+
/* Layout */
|
71
|
+
display: inline-flex;
|
72
|
+
flex-direction: column;
|
73
|
+
justify-content: center;
|
74
|
+
align-items: center;
|
75
|
+
gap: 1px;
|
76
|
+
|
77
|
+
/* Style */
|
78
|
+
outline: none;
|
79
|
+
overscroll-behavior: none;
|
80
|
+
|
81
|
+
/* Content Style */
|
82
|
+
.okDigitEntryContent {
|
83
|
+
/* Layout */
|
84
|
+
display: flex;
|
85
|
+
padding: var(--spacing-xxs, 2px);
|
86
|
+
flex-direction: column;
|
87
|
+
justify-content: center;
|
88
|
+
align-items: center;
|
89
|
+
|
90
|
+
/* Style */
|
91
|
+
border-radius: 1px;
|
92
|
+
background: var(--brand-12, #44bd84);
|
93
|
+
|
94
|
+
/* Typography */
|
95
|
+
color: var(--Light, #fff);
|
96
|
+
text-align: center;
|
97
|
+
font-family: Monaco;
|
98
|
+
font-size: var(--digit-font-size, 12px);
|
99
|
+
font-style: normal;
|
100
|
+
font-weight: 400;
|
101
|
+
line-height: var(--digit-line-height, 12px); /* 200% */
|
102
|
+
letter-spacing: 1.26px;
|
103
|
+
}
|
104
|
+
|
105
|
+
.okDigitEntryIncrementIndicator {
|
106
|
+
visibility: visible;
|
107
|
+
}
|
108
|
+
|
109
|
+
.okDigitEntryDecrementIndicator {
|
110
|
+
visibility: visible;
|
111
|
+
}
|
112
|
+
|
113
|
+
.okDigitEntryIncrementIndicator[data-enabled="false"] {
|
114
|
+
opacity: 0.25;
|
115
|
+
}
|
116
|
+
|
117
|
+
.okDigitEntryDecrementIndicator[data-enabled="false"] {
|
118
|
+
opacity: 0.25;
|
119
|
+
}
|
120
|
+
}
|