Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
feat: add color picker (#763)
Browse files Browse the repository at this point in the history
* feat: add control color picker

* fix: improve  property color’s outside click event

* fix: align box visually with inputs

* fix: remove color from property item state

* refactor: remove state from color picker

* fix: hide unchangeable color picker properties

* fix: add proper padding in color picker
  • Loading branch information
marionebl authored and yuzl committed Mar 27, 2019
1 parent bd0dd37 commit 023bad2
Show file tree
Hide file tree
Showing 27 changed files with 520 additions and 1,866 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function createEnumProperty(
description: '',
example: '',
group: '',
control: '',
hidden: false,
id: enumId,
inputType: Types.PatternPropertyInputType.Default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ function createUnknownProperty(
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.Unknown,
typeText: print(args.symbol.valueDeclaration)
typeText: print(args.symbol.valueDeclaration),
control: ''
};
}

Expand All @@ -153,7 +154,8 @@ function createBooleanProperty(
label: args.symbol.name,
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.Boolean
type: Types.PatternPropertyType.Boolean,
control: ''
};
}

Expand All @@ -173,7 +175,8 @@ function createNumberProperty(
label: args.symbol.name,
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.Number
type: Types.PatternPropertyType.Number,
control: ''
};
}

Expand All @@ -197,7 +200,8 @@ function createStringProperty(
label: args.symbol.name,
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.Asset
type: Types.PatternPropertyType.Asset,
control: ''
};
}

Expand All @@ -214,7 +218,8 @@ function createStringProperty(
label: args.symbol.name,
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.Href
type: Types.PatternPropertyType.Href,
control: ''
};
}

Expand All @@ -230,7 +235,8 @@ function createStringProperty(
label: args.symbol.name,
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.String
type: Types.PatternPropertyType.String,
control: ''
};
}

Expand All @@ -254,7 +260,8 @@ function createEventHandlerProperty(
label: args.symbol.name,
propertyName: args.symbol.name,
required: false,
type: Types.PatternPropertyType.EventHandler
type: Types.PatternPropertyType.EventHandler,
control: ''
};
}

Expand All @@ -274,6 +281,9 @@ function setPropertyMetaData(init: {
property.description = TypescriptUtils.getJsDocValueFromSymbol(symbol, 'description') || '';
property.hidden = TypescriptUtils.hasJsDocTagFromSymbol(symbol, 'ignore');
property.group = TypescriptUtils.getJsDocValueFromSymbol(symbol, 'group') || '';
property.control = TypescriptUtils.getJsDocValueFromSymbol(symbol, 'control') || '';

// TODO

switch (property.type) {
case 'enum':
Expand Down
111 changes: 111 additions & 0 deletions packages/components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 47 additions & 45 deletions packages/components/package.json
Original file line number Diff line number Diff line change
@@ -1,46 +1,48 @@
{
"name": "@meetalva/components",
"version": "1.0.0",
"description": "Alva UI components",
"scripts": {
"check:dependencies": "alva-dependencies -i feather-icons"
},
"repository": {
"type": "git",
"url": "git+https://github.com/meetalva/alva.git"
},
"author": {
"email": "hey@meetalva.io",
"name": "Meet Alva Team",
"url": "https://meetalva.io/"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/meetalva/alva/issues"
},
"devDependencies": {
"@meetalva/tools": "1.0.0",
"dependency-check": "^3.3.0",
"react-testing-library": "5.4.0",
"ts-jest": "^23.10.5",
"ts-loader": "4.4.1"
},
"dependencies": {
"@types/color": "^3.0.0",
"@types/feather-icons": "4.7.0",
"@types/react": "16.7.18",
"@types/react-dom": "16.0.7",
"@types/react-textarea-autosize": "4.3.3",
"@types/styled-components": "4.0.3",
"color": "3.0.0",
"feather-icons": "4.7.3",
"react": "16.7.0",
"react-dom": "16.4.2",
"react-feather": "^1.1.5",
"react-select": "2.0.0-beta.6",
"react-textarea-autosize": "7.0.4",
"tag-hoc": "1.0.0",
"styled-components": "4.0.3"
},
"homepage": "https://meetalva.github.io/"
}
"name": "@meetalva/components",
"version": "1.0.0",
"description": "Alva UI components",
"scripts": {
"check:dependencies": "alva-dependencies -i feather-icons"
},
"repository": {
"type": "git",
"url": "git+https://github.com/meetalva/alva.git"
},
"author": {
"email": "hey@meetalva.io",
"name": "Meet Alva Team",
"url": "https://meetalva.io/"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/meetalva/alva/issues"
},
"devDependencies": {
"@meetalva/tools": "1.0.0",
"dependency-check": "^3.3.0",
"react-testing-library": "5.4.0",
"ts-jest": "^23.10.5",
"ts-loader": "4.4.1"
},
"dependencies": {
"@types/color": "^3.0.0",
"@types/feather-icons": "4.7.0",
"@types/react": "16.7.18",
"@types/react-color": "^2.14.1",
"@types/react-dom": "16.0.7",
"@types/react-textarea-autosize": "4.3.3",
"@types/styled-components": "4.0.3",
"color": "3.0.0",
"feather-icons": "4.7.3",
"react": "16.7.0",
"react-color": "^2.17.0",
"react-dom": "16.4.2",
"react-feather": "^1.1.5",
"react-select": "2.0.0-beta.6",
"react-textarea-autosize": "7.0.4",
"styled-components": "4.0.3",
"tag-hoc": "1.0.0"
},
"homepage": "https://meetalva.github.io/"
}
1 change: 1 addition & 0 deletions packages/components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export * from './property-input';
export * from './property-item';
export * from './property-item-asset';
export * from './property-item-boolean';
export * from './property-item-color';
export * from './property-item-number';
export * from './property-item-radiogroup';
export * from './property-item-select';
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/property-input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export interface PropertyInputProps {
className?: string;
onBlur?: React.FocusEventHandler<HTMLInputElement>;
onChange?: React.ChangeEventHandler<HTMLInputElement>;
onFocus?: React.FocusEventHandler<HTMLInputElement>;
onClick?: React.MouseEventHandler;
placeholder?: string;
type?: PropertyInputType;
value?: string;
Expand All @@ -124,6 +126,8 @@ export const PropertyInput: React.SFC<PropertyInputProps> = props => (
list={props.list}
onChange={props.onChange}
onBlur={props.onBlur}
onFocus={props.onFocus}
onClick={props.onClick}
type={props.type}
value={props.value || ''}
placeholder={props.placeholder}
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/property-item-color/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './property-item-color';
7 changes: 7 additions & 0 deletions packages/components/src/property-item-color/pattern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "property-item-number",
"displayName": "Property Item: Number",
"description": "Input field for number values",
"version": "1.0.0",
"tags": ["property"]
}
Loading

1 comment on commit 023bad2

@marionebl
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.