1.1.13 • Published 2 years ago

@matthew2097/bdp-search-component v1.1.13

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

bdp-search-component

Busem do Polski to baza firm oferujących przewóz osób. Szybko i skutecznie znajdziesz przewoźnika, który obsługuje interesujące Cię przejazdy. To prosta baza przewoźników, którzy zabiorą Cię z adresu na adres. Na bus do Polski znajdziesz nie tylko powroty do kraju, ale również przewoźników, którzy przewiozą Cię do pracy za granicą, oferują regularne wyjazdy i przewóz paczek. Komponent bdp-search-component - to komponent wyszukiwarki, która ma ułatwić integrację z wieloma środowiskami.

Built with lit-element

Install

Before you start, please look at the DEMO - with npm (DEMO) project There are two ways to use this component. For simple projects or just to get started fast, we recommend using the component by script tag. If your project is using npm then we recommend using the npm package.

Script tag

  • Put this script tag in the head of your index.html:
<link rel="preload" href="/node_modules/@matthew2097/bdp-search-component/docs/index.js" as="script" />
<link rel="preload" href="/node_modules/@matthew2097/bdp-search-component/docs/webcomponents-loader.js" as="script" />
<script type="module" src="/node_modules/@matthew2097/bdp-search-component/docs/webcomponents-loader.js"></script>
<script src="/node_modules/@matthew2097/bdp-search-component/docs/webcomponents-loader.js" defer></script>
<script type="module">
    window.WebComponents = window.WebComponents || {
        waitFor(cb) {
            addEventListener('WebComponentsReady', cb)
        }
    }

    WebComponents.waitFor(async () => {
        import('/node_modules/@matthew2097/bdp-search-component/docs/index.js');
    });
</script>

NPM

  • Run npm i @matthew2097/bdp-search-component
  • import with import '@matthew2097/bdp-search-component'
  • copy the img and i18n folders to the assets folder cp -R node_modules/@matthew2097/bdp-search-component/docs/img src/assets && cp -R node_modules/@matthew2097/bdp-search-component/docs/i18n src/assets
  • put this code in your project or use dotenv (if you copied the img and i18n folder, enter the path to these folders in ASSETS_PATH):
    window.process = {
        env: {
            ASSETS_PATH: "https://cdn.jsdelivr.net/npm/@matthew2097/bdp-search-component/docs" //this item is required
        },
    };

Then you can use the element <bdp-search-componentl searchButtonText=""></bdp-search-component> anywhere in your template, JSX, html etc. live demo: https://vhst2.csb.app/

API

Properties

PropertyAttributeDescriptionTypeDefault
searchButtonTextsearchButtonTextThe text displayed in the buttonString""
emailemailOnly for partnersString""
partnerpartnerOnly for partnersstring""
.phoneIsRequired.phoneIsRequiredOut this parameter when the phone number is not requiredBooleanTrue
onlyMobileonlyMobileMobile version onlyBooleanFalse
autoClearautoClearClear the form after clicking the "search" buttonBooleanFalse
callbackcallbackreturn redirect path by eventBooleanFalse
Example

<bdp-search-component
  searchButtonText="Szukaj"
  email=""
  partner=""
  .phoneIsRequired="false"
  onlyMobile
  autoClear
></bdp-search-component>

Methods

nameDescription
clear()Clear form (not working yet)

Interactions with the methods requires a reference to the element itself, if using webcomponents or a library like Lit-Element or Fast-Element, this can be done easily within the if using the component from the browser

Styling

CSS Variables

We recommend using our CSS variables to easliy tweak the style of this component to fit your project. Here are our current supported CSS variables.

nameDescription
--button-bg-color-rgbChanges the color of the button background
--button-color-rgbChanges the text color of the button
--checkbox-text-color-rgbChanges the text color of the checkbox
--checkbox-border-color-rgbChanges the checkbox border color
--checkbox-bg-color-rgbChanges the checkbox color - checked
--checkbox-tick-color-rgbChanges the checkbox tick color - checked
--component-structure-gridChanges the position of the elements in a component

Example

:root {
  --button-bg-color-rgb: 248, 91, 90;
  --button-color-rgb: 255, 255, 255;
  --checkbox-text-color-rgb: 46, 46, 46;
  --checkbox-border-color-rgb: 19, 24, 79;
  --checkbox-bg-color-rgb: 19, 24, 79;
  --checkbox-tick-color-rgb: 255, 255, 255;
  --component-structure-grid: "from" "to" "error" "date" "intl-tel" "intl-tel2"
    "passengers" "button" "attributes" "attributes2";
}

Geting data from component - Examples

EventListener

const component = document.querySelector("bdp-search-component");

component.addEventListener("bdp-event", (e) => {
  console.log(e.detail);
});
1.1.13

2 years ago

1.1.9

2 years ago

1.1.12

2 years ago

1.1.11

2 years ago

1.1.10

2 years ago

1.1.8

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago