sag_components 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc.json +15 -0
- package/.storybook/YourTheme.js +11 -0
- package/.storybook/main.js +30 -0
- package/.storybook/manager.js +8 -0
- package/.storybook/preview.js +14 -0
- package/.storybook/webpack.config.js +16 -0
- package/README.md +85 -0
- package/azure-pipelines.yml +50 -0
- package/babel.config.js +10 -0
- package/build/favicon.ico +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/Dropdown.js +237 -0
- package/dist/OneColumnContainer.js +44 -0
- package/package.json +66 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +52 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/src/App.css +7 -0
- package/src/App.js +55 -0
- package/src/App.test.js +8 -0
- package/src/index.css +13 -0
- package/src/index.js +22 -0
- package/src/logo.svg +1 -0
- package/src/stories/ButtonText.jsx +28 -0
- package/src/stories/ButtonText.stories.js +65 -0
- package/src/stories/ButtonText.style.js +9 -0
- package/src/stories/Dropdown.stories.jsx +238 -0
- package/src/stories/Dropdown.style.js +9 -0
- package/src/stories/InfoIcon.jsx +5 -0
- package/src/stories/Introduction.mdx +119 -0
- package/src/stories/OneColumnContainer.stories.js +20 -0
- package/src/stories/OneColumnContainer.style.js +41 -0
- package/src/stories/assets/code-brackets.svg +1 -0
- package/src/stories/assets/colors.svg +1 -0
- package/src/stories/assets/comments.svg +1 -0
- package/src/stories/assets/direction.svg +1 -0
- package/src/stories/assets/flow.svg +1 -0
- package/src/stories/assets/info.svg +1 -0
- package/src/stories/assets/plugin.svg +1 -0
- package/src/stories/assets/repo.svg +1 -0
- package/src/stories/assets/stackalt.svg +1 -0
- package/src/stories/components/Dropdown.jsx +249 -0
- package/src/stories/components/OneColumnContainer.jsx +33 -0
- package/storybook-static/256.47510a7e.iframe.bundle.js +2 -0
- package/storybook-static/256.47510a7e.iframe.bundle.js.LICENSE.txt +9 -0
- package/storybook-static/333.c94a363a.iframe.bundle.js +1 -0
- package/storybook-static/383.2aff9f43.iframe.bundle.js +1 -0
- package/storybook-static/385.7e265f0d.iframe.bundle.js +402 -0
- package/storybook-static/385.7e265f0d.iframe.bundle.js.LICENSE.txt +53 -0
- package/storybook-static/385.7e265f0d.iframe.bundle.js.map +1 -0
- package/storybook-static/433.06d7c436.iframe.bundle.js +1 -0
- package/storybook-static/446.dd9a0d77.iframe.bundle.js +1 -0
- package/storybook-static/463.60fe9b8e.iframe.bundle.js +44 -0
- package/storybook-static/463.60fe9b8e.iframe.bundle.js.map +1 -0
- package/storybook-static/537.29807a20.iframe.bundle.js +121 -0
- package/storybook-static/537.29807a20.iframe.bundle.js.map +1 -0
- package/storybook-static/55.d0744d52.iframe.bundle.js +76 -0
- package/storybook-static/55.d0744d52.iframe.bundle.js.LICENSE.txt +26 -0
- package/storybook-static/55.d0744d52.iframe.bundle.js.map +1 -0
- package/storybook-static/58.676f9d84.iframe.bundle.js +1 -0
- package/storybook-static/661.14a42934.iframe.bundle.js +1 -0
- package/storybook-static/720.f79ea110.iframe.bundle.js +1 -0
- package/storybook-static/923.47c94418.iframe.bundle.js +1 -0
- package/storybook-static/ButtonText-stories.ac096281.iframe.bundle.js +1 -0
- package/storybook-static/Dropdown-stories.825dde1a.iframe.bundle.js +8 -0
- package/storybook-static/Dropdown-stories.825dde1a.iframe.bundle.js.map +1 -0
- package/storybook-static/Introduction-mdx.f8264230.iframe.bundle.js +2 -0
- package/storybook-static/Introduction-mdx.f8264230.iframe.bundle.js.LICENSE.txt +9 -0
- package/storybook-static/OneColumnContainer-stories.65049871.iframe.bundle.js +36 -0
- package/storybook-static/OneColumnContainer-stories.65049871.iframe.bundle.js.LICENSE.txt +18 -0
- package/storybook-static/OneColumnContainer-stories.65049871.iframe.bundle.js.map +1 -0
- package/storybook-static/favicon.svg +7 -0
- package/storybook-static/iframe.html +355 -0
- package/storybook-static/index.html +138 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/main.612c6447.iframe.bundle.js +1 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/runtime~main.55585f00.iframe.bundle.js +1 -0
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +4 -0
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js +13 -0
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-backgrounds-3/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +117 -0
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.LEGAL.txt +18 -0
- package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js +4 -0
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-measure-6/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js +4 -0
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-outline-7/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js +4 -0
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-toolbars-5/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js +4 -0
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/essentials-viewport-4/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js +31 -0
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js.LEGAL.txt +18 -0
- package/storybook-static/sb-addons/interactions-8/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/links-0/manager-bundle.js +4 -0
- package/storybook-static/sb-addons/links-0/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/links-0/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/storybook-10/manager-bundle.js +4 -0
- package/storybook-static/sb-addons/storybook-10/manager-bundle.js.LEGAL.txt +0 -0
- package/storybook-static/sb-addons/storybook-10/manager-bundle.js.map +7 -0
- package/storybook-static/sb-addons/storysource-9/manager-bundle.js +23 -0
- package/storybook-static/sb-addons/storysource-9/manager-bundle.js.LEGAL.txt +14 -0
- package/storybook-static/sb-addons/storysource-9/manager-bundle.js.map +7 -0
- package/storybook-static/sb-common-assets/fonts.css +31 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/GlobalScrollAreaStyles-XIHNDKUY-F4JIPIHL.js +1 -0
- package/storybook-static/sb-manager/OverlayScrollbars-VAV6LJAB-K3TMPSMY.js +6 -0
- package/storybook-static/sb-manager/WithTooltip-FBT32F6Q-7QJ37TCY.js +1 -0
- package/storybook-static/sb-manager/chunk-3FAXWWKG.js +15 -0
- package/storybook-static/sb-manager/chunk-54KM6K5Z.js +7 -0
- package/storybook-static/sb-manager/chunk-AS2AMEUR.js +1 -0
- package/storybook-static/sb-manager/chunk-F3MVQVF6.js +207 -0
- package/storybook-static/sb-manager/chunk-FENICTK6.js +1 -0
- package/storybook-static/sb-manager/chunk-GQDEE62S.js +406 -0
- package/storybook-static/sb-manager/chunk-PUVLCKJJ.js +140 -0
- package/storybook-static/sb-manager/chunk-QPL63VNK.js +1 -0
- package/storybook-static/sb-manager/formatter-S4K5WUZV-4LPR5OBX.js +156 -0
- package/storybook-static/sb-manager/globals.js +1 -0
- package/storybook-static/sb-manager/index.js +1 -0
- package/storybook-static/sb-manager/runtime.js +1 -0
- package/storybook-static/sb-manager/syntaxhighlighter-QTQ2UBB4-F5YUFYAB.js +1 -0
- package/storybook-static/sb-preview/globals.js +1 -0
- package/storybook-static/sb-preview/runtime.js +105 -0
- package/storybook-static/static/media/code-brackets.2e1112d7.svg +1 -0
- package/storybook-static/static/media/colors.a4bd0486.svg +1 -0
- package/storybook-static/static/media/comments.a3859089.svg +1 -0
- package/storybook-static/static/media/direction.b770f9af.svg +1 -0
- package/storybook-static/static/media/flow.edad2ac1.svg +1 -0
- package/storybook-static/static/media/plugin.d494b228.svg +1 -0
- package/storybook-static/static/media/repo.6d496322.svg +1 -0
- package/storybook-static/static/media/stackalt.dba9fbb3.svg +1 -0
- package/storybook-static/stories.json +1 -0
package/.babelrc.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// .storybook/YourTheme.js
|
|
2
|
+
|
|
3
|
+
import { create } from "@storybook/theming";
|
|
4
|
+
|
|
5
|
+
export default create({
|
|
6
|
+
base: "light",
|
|
7
|
+
brandTitle: "Sagramata storybook",
|
|
8
|
+
brandUrl: "https://www.sag121.com/",
|
|
9
|
+
brandImage: "https://www.sag121.com/wp-content/uploads/2022/09/logo-1.svg",
|
|
10
|
+
brandTarget: "_self",
|
|
11
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
|
|
2
|
+
const config = {
|
|
3
|
+
stories: ["../src/stories/**/*.mdx", "../src/stories/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
4
|
+
addons: [
|
|
5
|
+
"@storybook/addon-links",
|
|
6
|
+
"@storybook/addon-essentials",
|
|
7
|
+
"@storybook/addon-interactions",
|
|
8
|
+
{
|
|
9
|
+
name: '@storybook/addon-storysource',
|
|
10
|
+
options: {
|
|
11
|
+
rule: {
|
|
12
|
+
test: [/\.stories\.jsx?$/], //This is default
|
|
13
|
+
//include: [path.resolve(__dirname, '../stories')], // You can specify directories
|
|
14
|
+
},
|
|
15
|
+
loaderOptions: {
|
|
16
|
+
prettierConfig: { printWidth: 80, singleQuote: false },
|
|
17
|
+
injectStoryParameters: false,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
framework: {
|
|
23
|
+
name: "@storybook/react-webpack5",
|
|
24
|
+
options: {},
|
|
25
|
+
},
|
|
26
|
+
docs: {
|
|
27
|
+
autodocs: "tag",
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export default config;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** @type { import('@storybook/react').Preview } */
|
|
2
|
+
const preview = {
|
|
3
|
+
parameters: {
|
|
4
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
5
|
+
controls: {
|
|
6
|
+
matchers: {
|
|
7
|
+
color: /(background|color)$/i,
|
|
8
|
+
date: /Date$/,
|
|
9
|
+
},
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default preview;
|
package/README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Introduction
|
|
2
|
+
Storybook is a user interface development environment and playground for UI components. The tool enables developers to create interactive UI components in isolation, which helps in building and maintaining complex user interfaces.
|
|
3
|
+
|
|
4
|
+
# Getting Started
|
|
5
|
+
TODO: Guide users through getting your code up and running on their own system. In this section you can talk about:
|
|
6
|
+
|
|
7
|
+
1. Installation process
|
|
8
|
+
In Strorybook project:
|
|
9
|
+
Use the Storybook CLI to install it in a single command. Run this inside your existing project’s root directory:
|
|
10
|
+
npx storybook@latest init
|
|
11
|
+
Storybook init command needs to be installed into a project (react project) that is already set up with a framework.
|
|
12
|
+
|
|
13
|
+
To create new Storybook project for Chromatic, first open new terminal, install chromatic package:
|
|
14
|
+
npm install --save-dev chromatic
|
|
15
|
+
Then create a new react Storybook probect, use one command:
|
|
16
|
+
npx sb init
|
|
17
|
+
Select project type: react
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
Publish your Storybook
|
|
21
|
+
On the command line, publish to Chromatic’s secure CDN for the first time with the following command:
|
|
22
|
+
npx chromatic --project-token=
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
2. Software dependencies
|
|
26
|
+
Storybook will look into your project's dependencies during its install process and provide you with the best configuration available.
|
|
27
|
+
The installation will make the following changes to your local environment:
|
|
28
|
+
Install the required dependencies.
|
|
29
|
+
Setup the necessary scripts to run and build Storybook.
|
|
30
|
+
Add the default Storybook configuration.
|
|
31
|
+
|
|
32
|
+
3. Latest releases
|
|
33
|
+
|
|
34
|
+
4. API references
|
|
35
|
+
|
|
36
|
+
5. Deployment Storybook components in other applications:
|
|
37
|
+
|
|
38
|
+
Publish your Storybook: Once your Storybook is built, you can publish it to a hosting service like GitHub Pages, Netlify, or AWS S3. This will make your Storybook accessible via a URL.
|
|
39
|
+
|
|
40
|
+
Once your Storybook is published, you can install your components in other applications. You can do this by adding a dependency to your package.json file and then importing the component from your Storybook.
|
|
41
|
+
|
|
42
|
+
For example, let's say you have a component called Button in your Storybook. To install this component in another application, you would add the following to your package.json file:
|
|
43
|
+
{
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@your-username/your-storybook": "1.0.0"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
Then, you can import the Button component like this:
|
|
49
|
+
import { Button } from '@your-username/your-storybook';
|
|
50
|
+
|
|
51
|
+
Use your Storybook components in other applications: Once you've installed your Storybook components in another application, you can use them just like any other component. For example, you could use the Button component like this:
|
|
52
|
+
|
|
53
|
+
import React from 'react';
|
|
54
|
+
import { Button } from '@your-username/your-storybook';
|
|
55
|
+
|
|
56
|
+
function MyComponent() {
|
|
57
|
+
return (
|
|
58
|
+
<Button>Click me!</Button>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
# Build and Test
|
|
63
|
+
TODO: Describe and show how to build your code and run the tests.
|
|
64
|
+
|
|
65
|
+
First, build your own components in:
|
|
66
|
+
\stories
|
|
67
|
+
Every component must include 3 files, for example the 'Button' component:
|
|
68
|
+
button.css - defines the style of the button
|
|
69
|
+
Button.jsx - includes React js code that defines the button
|
|
70
|
+
Button.stories.jsx - A *.stories.js file defines all the stories for a component. Each story has a corresponding sidebar item.
|
|
71
|
+
|
|
72
|
+
When you completed creating your component, check that everything worked by running:
|
|
73
|
+
npm run storybook
|
|
74
|
+
It will start Storybook locally in a new browser tab (port 6006),
|
|
75
|
+
In sidebar item click on a story, it renders in the Canvas an isolated preview iframe.
|
|
76
|
+
Navigate between stories by clicking on them in the sidebar.
|
|
77
|
+
If you want to learn more: https://storybook.js.org/docs/react/get-started/browse-stories
|
|
78
|
+
|
|
79
|
+
# Contribute
|
|
80
|
+
TODO: Explain how other users and developers can contribute to make your code better.
|
|
81
|
+
|
|
82
|
+
You can create or improve existed stories for your UI components in the src/stories directory. A story is a functional use case of a UI component. For example, if you have a button component, you might create stories for "Primary Button", "Secondary Button", "Disabled Button", etc.
|
|
83
|
+
You can also add addons to Storybook to extend its functionality. Addons can do things like display component props, simulate different device sizes, and more. To add an addon, follow the instructions provided in the addon's documentation.
|
|
84
|
+
Users and developers may use addons to investigate the functionality of components, get ideas what to improve, and in case of developers may try to change a code of components to make it better.
|
|
85
|
+
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Starter pipeline
|
|
2
|
+
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
|
3
|
+
# Add steps that build, run tests, deploy, and more:
|
|
4
|
+
# https://aka.ms/yaml
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# 👇 Event to trigger pipeline execution
|
|
8
|
+
trigger:
|
|
9
|
+
- DEV
|
|
10
|
+
|
|
11
|
+
# Other configurations
|
|
12
|
+
|
|
13
|
+
# Pipeline stages
|
|
14
|
+
stages:
|
|
15
|
+
- stage: Test
|
|
16
|
+
displayName: Chromatic Testing
|
|
17
|
+
# Job list
|
|
18
|
+
jobs:
|
|
19
|
+
- job: Chromatic_Deploy
|
|
20
|
+
displayName: Install packages and publishes to Chromatic
|
|
21
|
+
variables:
|
|
22
|
+
# Sets scoped environment variable to cache packages
|
|
23
|
+
npm_config_cache: $(Pipeline.Workspace)/.npm
|
|
24
|
+
# List of steps
|
|
25
|
+
steps:
|
|
26
|
+
- checkout: self
|
|
27
|
+
displayName: "Get full Git history"
|
|
28
|
+
fetchDepth: 0
|
|
29
|
+
# 👇 Installs and configures Node environment
|
|
30
|
+
- task: NodeTool@0
|
|
31
|
+
inputs:
|
|
32
|
+
versionSpec: "16.x"
|
|
33
|
+
displayName: "Install Node.js"
|
|
34
|
+
- task: Cache@2
|
|
35
|
+
displayName: Install and cache packages
|
|
36
|
+
inputs:
|
|
37
|
+
key: 'npm | "$(Agent.OS)" | package-lock.json'
|
|
38
|
+
restoreKeys: |
|
|
39
|
+
npm | "$(Agent.OS)"
|
|
40
|
+
path: $(npm_config_cache)
|
|
41
|
+
- script: npm ci
|
|
42
|
+
condition: ne(variables.CACHE_RESTORED, 'true')
|
|
43
|
+
# 👇 Adds Chromatic as a step
|
|
44
|
+
- task: CmdLine@2
|
|
45
|
+
displayName: Publish to Chromatic
|
|
46
|
+
inputs:
|
|
47
|
+
# 👇 Runs Chromatic
|
|
48
|
+
script: npx chromatic --project-token=c74e7c242a07 --exit-zero-on-changes
|
|
49
|
+
env:
|
|
50
|
+
CHROMATIC_PROJECT_TOKEN: $(CHROMATIC_PROJECT_TOKEN)
|
package/babel.config.js
ADDED
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"short_name": "React App",
|
|
3
|
+
"name": "Create React App Sample",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
package/build/robots.txt
ADDED
package/dist/Dropdown.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.Dropdown = void 0;
|
|
9
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _DropdownStyle = require("../Dropdown.style.js");
|
|
13
|
+
var _Autocomplete = _interopRequireDefault(require("@mui/material/Autocomplete"));
|
|
14
|
+
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
|
15
|
+
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
16
|
+
var _InputAdornment = _interopRequireDefault(require("@mui/material/InputAdornment"));
|
|
17
|
+
var _Icon = _interopRequireDefault(require("@mui/material/Icon"));
|
|
18
|
+
var _CheckBoxOutlineBlank = _interopRequireDefault(require("@mui/icons-material/CheckBoxOutlineBlank"));
|
|
19
|
+
var _CheckBox = _interopRequireDefault(require("@mui/icons-material/CheckBox"));
|
|
20
|
+
var _Search = _interopRequireDefault(require("@mui/icons-material/Search.js"));
|
|
21
|
+
var _ArrowDropDown = _interopRequireDefault(require("@mui/icons-material/ArrowDropDown.js"));
|
|
22
|
+
//import PropTypes from "prop-types";
|
|
23
|
+
|
|
24
|
+
// import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
|
25
|
+
// import { faChevronDown, faAsterisk } from "@fortawesome/free-solid-svg-icons";
|
|
26
|
+
var icon = /*#__PURE__*/_react.default.createElement(_CheckBoxOutlineBlank.default, {
|
|
27
|
+
fontSize: "small"
|
|
28
|
+
});
|
|
29
|
+
var checkedIcon = /*#__PURE__*/_react.default.createElement(_CheckBox.default, {
|
|
30
|
+
fontSize: "small"
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* SAG Dropdown
|
|
35
|
+
*/
|
|
36
|
+
var Dropdown = function Dropdown(_ref) {
|
|
37
|
+
var width = _ref.width,
|
|
38
|
+
size = _ref.size,
|
|
39
|
+
text = _ref.text,
|
|
40
|
+
shape = _ref.shape,
|
|
41
|
+
placeHolder = _ref.placeHolder,
|
|
42
|
+
multiSelect = _ref.multiSelect,
|
|
43
|
+
limitTagsOnMultiSelect = _ref.limitTagsOnMultiSelect,
|
|
44
|
+
showPopupIcon = _ref.showPopupIcon,
|
|
45
|
+
showSearchIcon = _ref.showSearchIcon,
|
|
46
|
+
options = _ref.options,
|
|
47
|
+
onChange = _ref.onChange,
|
|
48
|
+
onInputChange = _ref.onInputChange;
|
|
49
|
+
/**
|
|
50
|
+
* SAG Dropdown
|
|
51
|
+
*/
|
|
52
|
+
var _useState = (0, _react.useState)(null),
|
|
53
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
54
|
+
currentInputValue = _useState2[0],
|
|
55
|
+
setCurrentInputValue = _useState2[1];
|
|
56
|
+
var _useState3 = (0, _react.useState)(null),
|
|
57
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
58
|
+
currentOption = _useState4[0],
|
|
59
|
+
setCurrentOption = _useState4[1];
|
|
60
|
+
(0, _react.useEffect)(function () {
|
|
61
|
+
var delayDebounceFn = setTimeout(function () {
|
|
62
|
+
onInputChange(currentInputValue);
|
|
63
|
+
}, 1000);
|
|
64
|
+
return function () {
|
|
65
|
+
return clearTimeout(delayDebounceFn);
|
|
66
|
+
};
|
|
67
|
+
}, [currentInputValue]);
|
|
68
|
+
|
|
69
|
+
//defines shape: squire or round
|
|
70
|
+
var getTextFieldStyle = function getTextFieldStyle() {
|
|
71
|
+
if (shape === "round") {
|
|
72
|
+
// round
|
|
73
|
+
return {
|
|
74
|
+
"& .MuiOutlinedInput-root": {
|
|
75
|
+
borderRadius: "50px",
|
|
76
|
+
legend: {
|
|
77
|
+
marginLeft: "30px"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"& .MuiAutocomplete-inputRoot": {
|
|
81
|
+
paddingLeft: "20px !important",
|
|
82
|
+
borderRadius: "50px"
|
|
83
|
+
},
|
|
84
|
+
"& .MuiInputLabel-outlined": {
|
|
85
|
+
paddingLeft: "20px"
|
|
86
|
+
},
|
|
87
|
+
"& .MuiInputLabel-shrink": {
|
|
88
|
+
marginLeft: "20px",
|
|
89
|
+
paddingLeft: "10px",
|
|
90
|
+
paddingRight: 0,
|
|
91
|
+
background: "white"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
} else {
|
|
95
|
+
//square
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
var onInputChangeHandler = function onInputChangeHandler(event, newInputValue) {
|
|
100
|
+
setCurrentInputValue({
|
|
101
|
+
syntheticBaseEvent: event,
|
|
102
|
+
inputValue: newInputValue
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
var onChangeHandler = function onChangeHandler(event, newValue) {
|
|
106
|
+
setCurrentOption(newValue);
|
|
107
|
+
onChange(event, newValue);
|
|
108
|
+
};
|
|
109
|
+
var getAutocompleteSingle = function getAutocompleteSingle() {
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement(_Autocomplete.default, {
|
|
111
|
+
onChange: function onChange(event, newValue) {
|
|
112
|
+
onChangeHandler(event, newValue);
|
|
113
|
+
},
|
|
114
|
+
onInputChange: function onInputChange(event, newInputValue) {
|
|
115
|
+
onInputChangeHandler(event, newInputValue);
|
|
116
|
+
},
|
|
117
|
+
disablePortal: true,
|
|
118
|
+
id: "combo-box",
|
|
119
|
+
options: options,
|
|
120
|
+
sx: {
|
|
121
|
+
width: width
|
|
122
|
+
},
|
|
123
|
+
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, null) : null,
|
|
124
|
+
forcePopupIcon: "auto",
|
|
125
|
+
renderInput: function renderInput(params) {
|
|
126
|
+
return /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
127
|
+
label: text,
|
|
128
|
+
size: size,
|
|
129
|
+
sx: getTextFieldStyle(),
|
|
130
|
+
placeholder: placeHolder,
|
|
131
|
+
InputProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params.InputProps), {}, {
|
|
132
|
+
startAdornment: showSearchIcon ? /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
133
|
+
position: "start"
|
|
134
|
+
}, /*#__PURE__*/_react.default.createElement(_Search.default, {
|
|
135
|
+
fontSize: "medium"
|
|
136
|
+
})) : null
|
|
137
|
+
})
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
var getAutocompleteMulti = function getAutocompleteMulti() {
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement(_Autocomplete.default, {
|
|
144
|
+
onChange: function onChange(event, newValue) {
|
|
145
|
+
onChangeHandler(event, newValue);
|
|
146
|
+
},
|
|
147
|
+
onInputChange: function onInputChange(event, newInputValue) {
|
|
148
|
+
onInputChangeHandler(event, newInputValue);
|
|
149
|
+
},
|
|
150
|
+
multiple: true,
|
|
151
|
+
limitTags: limitTagsOnMultiSelect,
|
|
152
|
+
size: size,
|
|
153
|
+
id: "checkboxes-tags",
|
|
154
|
+
options: options,
|
|
155
|
+
disableCloseOnSelect: true,
|
|
156
|
+
getOptionLabel: function getOptionLabel(option) {
|
|
157
|
+
return option.label;
|
|
158
|
+
},
|
|
159
|
+
popupIcon: showPopupIcon ? /*#__PURE__*/_react.default.createElement(_ArrowDropDown.default, null) : null,
|
|
160
|
+
renderOption: function renderOption(props, option, _ref2) {
|
|
161
|
+
var selected = _ref2.selected;
|
|
162
|
+
return /*#__PURE__*/_react.default.createElement("li", props, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
163
|
+
icon: icon,
|
|
164
|
+
checkedIcon: checkedIcon,
|
|
165
|
+
style: {
|
|
166
|
+
marginRight: 8
|
|
167
|
+
},
|
|
168
|
+
checked: selected
|
|
169
|
+
}), option.label);
|
|
170
|
+
},
|
|
171
|
+
style: {
|
|
172
|
+
width: width
|
|
173
|
+
},
|
|
174
|
+
renderInput: function renderInput(params) {
|
|
175
|
+
return showSearchIcon && (!currentOption || currentOption && currentOption.length === 0) ? /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
176
|
+
label: text,
|
|
177
|
+
size: size,
|
|
178
|
+
sx: getTextFieldStyle(),
|
|
179
|
+
placeholder: placeHolder,
|
|
180
|
+
InputProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params.InputProps), {}, {
|
|
181
|
+
startAdornment: /*#__PURE__*/_react.default.createElement(_InputAdornment.default, {
|
|
182
|
+
position: "start"
|
|
183
|
+
}, /*#__PURE__*/_react.default.createElement(_Search.default, {
|
|
184
|
+
fontSize: "medium"
|
|
185
|
+
}))
|
|
186
|
+
})
|
|
187
|
+
})) : /*#__PURE__*/_react.default.createElement(_TextField.default, Object.assign({}, params, {
|
|
188
|
+
label: text,
|
|
189
|
+
size: size,
|
|
190
|
+
sx: getTextFieldStyle(),
|
|
191
|
+
placeholder: placeHolder
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
return /*#__PURE__*/_react.default.createElement(_DropdownStyle.DropdownContainer, {
|
|
197
|
+
width: width
|
|
198
|
+
}, multiSelect ? getAutocompleteMulti() : getAutocompleteSingle());
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// Dropdown.propTypes = {
|
|
202
|
+
// /**
|
|
203
|
+
// * dropdown width
|
|
204
|
+
// */
|
|
205
|
+
// width: PropTypes.string,
|
|
206
|
+
|
|
207
|
+
// /**
|
|
208
|
+
// * dropdown size: small/large
|
|
209
|
+
// */
|
|
210
|
+
// size: PropTypes.string,
|
|
211
|
+
|
|
212
|
+
// /**
|
|
213
|
+
// * dropdown initial input text
|
|
214
|
+
// */
|
|
215
|
+
// text: PropTypes.string,
|
|
216
|
+
|
|
217
|
+
// /**
|
|
218
|
+
// * arrayOf <T> - options array to load into dropdown
|
|
219
|
+
// */
|
|
220
|
+
// options: PropTypes.arrayOf,
|
|
221
|
+
|
|
222
|
+
// /**
|
|
223
|
+
// * shape: round/square
|
|
224
|
+
// */
|
|
225
|
+
// shape: PropTypes.string,
|
|
226
|
+
// };
|
|
227
|
+
|
|
228
|
+
// Dropdown.defaultProps = {
|
|
229
|
+
// width: 300,
|
|
230
|
+
// size: "small",
|
|
231
|
+
// text: "Select retailer...",
|
|
232
|
+
// options: [],
|
|
233
|
+
// shape: "round",
|
|
234
|
+
// };
|
|
235
|
+
exports.Dropdown = Dropdown;
|
|
236
|
+
var _default = Dropdown;
|
|
237
|
+
exports.default = _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.OneColumnContainer = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _OneColumnContainer = require("./OneColumnContainer.style");
|
|
13
|
+
var _InfoIcon = require("./InfoIcon");
|
|
14
|
+
var _excluded = ["width", "height", "infoText"];
|
|
15
|
+
/**
|
|
16
|
+
* Primary UI component for user interaction
|
|
17
|
+
*/
|
|
18
|
+
var OneColumnContainer = function OneColumnContainer(_ref) {
|
|
19
|
+
var width = _ref.width,
|
|
20
|
+
height = _ref.height,
|
|
21
|
+
infoText = _ref.infoText,
|
|
22
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
23
|
+
var _useState = (0, _react.useState)(false),
|
|
24
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
25
|
+
clicked = _useState2[0],
|
|
26
|
+
setClicked = _useState2[1];
|
|
27
|
+
var onInfoClick = function onInfoClick() {
|
|
28
|
+
setClicked(!clicked);
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_OneColumnContainer.StyledContainer, {
|
|
31
|
+
width: width,
|
|
32
|
+
height: height
|
|
33
|
+
}, /*#__PURE__*/_react.default.createElement(_OneColumnContainer.InfoTextContainer, {
|
|
34
|
+
clicked: clicked,
|
|
35
|
+
width: width,
|
|
36
|
+
height: height
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_OneColumnContainer.InfoTextLabel, null, infoText)), /*#__PURE__*/_react.default.createElement(_OneColumnContainer.IconContainer, {
|
|
38
|
+
onClick: onInfoClick
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement(_InfoIcon.InfoIcon, {
|
|
40
|
+
clicked: clicked
|
|
41
|
+
})));
|
|
42
|
+
};
|
|
43
|
+
exports.OneColumnContainer = OneColumnContainer;
|
|
44
|
+
OneColumnContainer.defaultProps = {};
|
package/package.json
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sag_components",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "react-scripts start",
|
|
8
|
+
"build": "cross-env BABEL_ENV=production babel src -d dist",
|
|
9
|
+
"storybook": "storybook dev -p 6006",
|
|
10
|
+
"build-storybook": "storybook build"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [],
|
|
13
|
+
"author": "SAG",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@babel/cli": "^7.21.5",
|
|
17
|
+
"@babel/preset-env": "^7.21.4",
|
|
18
|
+
"@babel/preset-react": "^7.18.6",
|
|
19
|
+
"@babel/preset-typescript": "^7.21.4",
|
|
20
|
+
"@storybook/addon-a11y": "^7.0.7",
|
|
21
|
+
"@storybook/addon-essentials": "^7.0.6",
|
|
22
|
+
"@storybook/addon-interactions": "^7.0.6",
|
|
23
|
+
"@storybook/addon-links": "^7.0.6",
|
|
24
|
+
"@storybook/blocks": "^7.0.6",
|
|
25
|
+
"@storybook/preset-scss": "^1.0.3",
|
|
26
|
+
"@storybook/react": "^7.0.6",
|
|
27
|
+
"@storybook/react-webpack5": "^7.0.6",
|
|
28
|
+
"@storybook/testing-library": "^0.0.14-next.2",
|
|
29
|
+
"cross-env": "^7.0.3",
|
|
30
|
+
"css-loader": "^5.2.7",
|
|
31
|
+
"prop-types": "^15.8.1",
|
|
32
|
+
"react": "^18.2.0",
|
|
33
|
+
"react-dom": "^18.2.0",
|
|
34
|
+
"sass": "^1.62.0",
|
|
35
|
+
"sass-loader": "^10.4.1",
|
|
36
|
+
"storybook": "^7.0.6",
|
|
37
|
+
"style-loader": "^2.0.0",
|
|
38
|
+
"styled-components": "^5.3.10"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@emotion/react": "^11.11.0",
|
|
42
|
+
"@emotion/styled": "^11.11.0",
|
|
43
|
+
"@fontsource/roboto": "^4.5.8",
|
|
44
|
+
"@fortawesome/fontawesome-svg-core": "^6.4.0",
|
|
45
|
+
"@fortawesome/free-solid-svg-icons": "^6.4.0",
|
|
46
|
+
"@fortawesome/react-fontawesome": "^0.2.0",
|
|
47
|
+
"@mui/icons-material": "^5.11.16",
|
|
48
|
+
"@mui/material": "^5.13.0",
|
|
49
|
+
"@mui/styled-engine-sc": "^5.12.0",
|
|
50
|
+
"@storybook/addon-storysource": "^7.0.7",
|
|
51
|
+
"hoopy": "^0.1.4",
|
|
52
|
+
"react-scripts": "5.0.1"
|
|
53
|
+
},
|
|
54
|
+
"browserslist": {
|
|
55
|
+
"production": [
|
|
56
|
+
">0.2%",
|
|
57
|
+
"not dead",
|
|
58
|
+
"not op_mini all"
|
|
59
|
+
],
|
|
60
|
+
"development": [
|
|
61
|
+
"last 1 chrome version",
|
|
62
|
+
"last 1 firefox version",
|
|
63
|
+
"last 1 safari version"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
Binary file
|