Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b6935e0
feat: initial commit for input component
annsch Dec 16, 2022
ac9f57f
fix: generate mitosis component
annsch Jan 5, 2023
83475ec
feat: input field guidelines 3.0
annsch Jan 5, 2023
1351e1e
feat: added missing attributes
annsch Jan 6, 2023
f49aee0
fix: use inherited font-family for native Elements to overwrite user …
annsch Jan 6, 2023
d5fda80
feat: improvements according to long label text
annsch Jan 6, 2023
0141e01
feat: added vue showcase
annsch Jan 16, 2023
f75972e
Update input.lite.tsx
mfranzke Jan 18, 2023
4a9eb77
Update input.lite.tsx
mfranzke Jan 18, 2023
8467d74
Update input.scss
mfranzke Jan 18, 2023
64c9a09
feat: added basic methods for input
annsch Jan 20, 2023
2bdbd7b
feat: initial commit for input component
annsch Dec 16, 2022
9408b9d
feat: input field guidelines 3.0
annsch Jan 5, 2023
a0858e1
feat: added missing attributes
annsch Jan 6, 2023
2aaabce
feat: improvements according to long label text
annsch Jan 6, 2023
40e6159
refactor: remove logs
annsch Jan 20, 2023
7b35b60
Update packages/components/src/components/input/input.lite.tsx
annsch Jan 23, 2023
9316fc1
refactor: CSS solution for required fields
annsch Jan 23, 2023
adc0dbf
refactor: review feedback
annsch Jan 23, 2023
5422934
Merge branch 'main' into feat-input
annsch Jan 23, 2023
29fff2c
Update model.ts
mfranzke Jan 23, 2023
412530e
Update model.ts
mfranzke Jan 23, 2023
afadc20
refactor: review feedback
annsch Jan 23, 2023
1195426
Merge branch 'feat-input' of https://github.com/db-ui/mono into feat-…
annsch Jan 23, 2023
0d5159c
Update styles.scss
mfranzke Jan 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"update:components:button": "cpr ../core/source/_patterns/01-elements/buttons/button.scss packages/components/src/components/button/button.scss -o",
"update:components:card": "cpr ../core/source/_patterns/02-components/cards/card.scss packages/components/src/components/card/card.scss -o",
"update:components:cards": "cpr ../core/source/_patterns/02-components/cards/cards.scss packages/components/src/components/cards/cards.scss -o",
"update:components:input": "cpr ../core/source/_patterns/02-components/input/input.scss packages/components/src/components/input/input.scss -o",
"update:components": "npm-run-all -p update:core:*",
"build:foundations": "npm run build --workspace=@db-ui/foundations",
"build:components": "npm run build --workspace=@db-ui/components",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DBInput, DBInputModule } from "./input";
5 changes: 5 additions & 0 deletions packages/components/scripts/post-build/components.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
module.exports = [
{
name: "input",
defaultStylePath: "components/input/input.css",
},

{
name: 'divider',
defaultStylePath: 'components/divider/divider.css',
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/components/card/card.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
&[data-variant="ia"] {
&:hover {
cursor: pointer;
box-shadow: $db-elevation-8;
box-shadow: $db-elevation-4;
}

&:active {
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/components/input/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as DBInput } from "./input";
99 changes: 99 additions & 0 deletions packages/components/src/components/input/input.lite.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
import { onMount, Show, useMetadata, useRef, useStore } from "@builder.io/mitosis";
import { DBInputState, DBInputProps, iconVariants } from "./model";
import { DBIcon } from '../icon';
import "./input.scss";

useMetadata({
isAttachedToShadowDom: false,
component: {
includeIcon: false,
properties: [],
},
});

export default function DBInput(props: DBInputProps) {
const textInputRef = useRef(null);
const state = useStore<DBInputState>({
_isValid: undefined,
handleChange: (event) => {
if (props.onChange) {
props.onChange(event);
}
if (props.change) {
props.change(event);
}

if (textInputRef?.validity?.valid != state._isValid ) {
state._isValid = textInputRef?.validity?.valid;
if( props.validityChange ) {
props.validityChange(textInputRef?.validity?.valid);
}
}
},
handleBlur: (event) => {
if (props.onBlur) {
props.onBlur(event);
}
if (props.blur) {
props.blur(event);
}
},
handleFocus: (event) => {
if (props.onFocus) {
props.onFocus(event);
}
if (props.focus) {
props.focus(event);
}
}
});

onMount(() => {
if (props.stylePath) {
state.stylePath = props.stylePath;
}
});

return (
<div class={ 'db-input ' + (props.className || '') } data-variant={props.variant}>
<Show when={state.stylePath}>
<link rel="stylesheet" href={state.stylePath} />
</Show>
<Show when={props.iconBefore}>
<DBIcon icon={props.iconBefore} className="icon-before" />
</Show>
<input
ref={textInputRef}
id={props.id}
name={props.name}
type={props.type || 'text'}
placeholder={props.placeholder}
aria-labelledby={props.id + '-label'}
disabled={props.disabled}
required={props.required}
value={props.value}
maxLength={props.maxLength}
minLength={props.minLength}
pattern={props.pattern}
onChange={(event) => state.handleChange(event)}
onBlur={(event) => state.handleBlur(event)}
onFocus={(event) => state.handleFocus(event)}
/>
<label for={props.id} aria-hidden="true" id={props.id + '-label'}>
<span>{props.label}</span>
</label>
<Show when={props.description}>
<p className="description">{props.description}</p>
</Show>
<Show when={props.variant || props.required || props.pattern}>
<DBIcon
icon={props.variant && iconVariants[props.variant]}
className="icon-input-state"
/>
</Show>
<Show when={props.iconAfter}>
<DBIcon icon={props.iconAfter} className="icon-after" />
</Show>
</div>
);
}
Loading