{"_id":"@braudypedrosa/bp-search-widget","_rev":"6-1c8c9c925273c4b1b7434b4b418ba45a","name":"@braudypedrosa/bp-search-widget","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@braudypedrosa/bp-search-widget","version":"1.0.0","keywords":["search-widget","vacation-rental","booking","datepicker","javascript"],"license":"MIT","_id":"@braudypedrosa/bp-search-widget@1.0.0","maintainers":[{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"}],"homepage":"https://github.com/braudypedrosa/bp-search-widget#readme","bugs":{"url":"https://github.com/braudypedrosa/bp-search-widget/issues"},"dist":{"shasum":"c433f6e32e51b2b4455a08885a42ef4c353bcc6a","tarball":"https://registry.npmjs.org/@braudypedrosa/bp-search-widget/-/bp-search-widget-1.0.0.tgz","fileCount":5,"integrity":"sha512-qyfijre2Ns9Ty23G+qeChWNl7k6FZS0UTMQAv3GS3FVDi+RWNjRv7CVNyMRLkjCfw1PydfoDGROiU13ejMqhuw==","signatures":[{"sig":"MEQCIHllZu0JOF8sXO1KeyimtxNMoV/CzHJkwJuSv5uwMBobAiBOlNBt1O/HoqTNl8sywKbFF4UIRVCzdU/ku6L+h2vULw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76181},"main":"./bp-search-widget.js","type":"module","module":"./bp-search-widget.js","exports":{".":"./bp-search-widget.js","./styles":"./bp-search-widget.scss"},"gitHead":"748cd34735780fab202da0500bc673e23ed29b38","scripts":{"dev":"vite","test":"vitest run --environment jsdom","release":"bash ./scripts/release.sh","release:npm":"npm publish","release:major":"bash ./scripts/release.sh major","release:minor":"bash ./scripts/release.sh minor","release:patch":"bash ./scripts/release.sh patch"},"_npmUser":{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"},"repository":{"url":"git+https://github.com/braudypedrosa/bp-search-widget.git","type":"git"},"_npmVersion":"11.8.0","description":"Framework-agnostic vacation rental search widget powered by bp-calendar","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@braudypedrosa/bp-calendar":"^1.0.1","@fortawesome/fontawesome-free":"^7.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.2.0","jsdom":"^26.0.0","vitest":"^3.0.8","sass-embedded":"^1.83.4"},"_npmOperationalInternal":{"tmp":"tmp/bp-search-widget_1.0.0_1772286551467_0.5083382910001868","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.1":{"name":"@braudypedrosa/bp-search-widget","version":"1.0.1","keywords":["search-widget","vacation-rental","booking","datepicker","javascript"],"license":"MIT","_id":"@braudypedrosa/bp-search-widget@1.0.1","maintainers":[{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"}],"homepage":"https://github.com/braudypedrosa/bp-search-widget#readme","bugs":{"url":"https://github.com/braudypedrosa/bp-search-widget/issues"},"dist":{"shasum":"63ba2f12218a34fd15e1de7001ee90fb5536d451","tarball":"https://registry.npmjs.org/@braudypedrosa/bp-search-widget/-/bp-search-widget-1.0.1.tgz","fileCount":5,"integrity":"sha512-5nkZW7fonBA61DTf0XaGh8tQgG1ATkfsTua7yHaonozGWeRJX+rG0Y2FMpR3yfYlsjLj8gwz8Zg/E91UkyKGNA==","signatures":[{"sig":"MEUCIEmH2m97Iji7fasP6gxyKdmYQQ/dE1TVvK1nmr8OlVTpAiEAl/X7m4JwYtM51EC3GN/0KojvSehzv5J/Nf8cwy0I8N0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":85735},"main":"./bp-search-widget.js","type":"module","module":"./bp-search-widget.js","exports":{".":"./bp-search-widget.js","./styles":"./bp-search-widget.scss"},"gitHead":"3e77dd2eed0637b9a18356cbf23cfe88a3a85ee2","scripts":{"dev":"vite","test":"vitest run --environment jsdom","release":"bash ./scripts/release.sh","release:npm":"npm publish","release:major":"bash ./scripts/release.sh major","release:minor":"bash ./scripts/release.sh minor","release:patch":"bash ./scripts/release.sh patch"},"_npmUser":{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"},"repository":{"url":"git+https://github.com/braudypedrosa/bp-search-widget.git","type":"git"},"_npmVersion":"11.8.0","description":"Framework-agnostic vacation rental search widget powered by bp-calendar","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@braudypedrosa/bp-calendar":"^1.0.1","@fortawesome/fontawesome-free":"^7.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.2.0","jsdom":"^26.0.0","vitest":"^3.0.8","sass-embedded":"^1.83.4"},"_npmOperationalInternal":{"tmp":"tmp/bp-search-widget_1.0.1_1772309249895_0.20891707929982628","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.2":{"name":"@braudypedrosa/bp-search-widget","version":"1.0.2","keywords":["search-widget","vacation-rental","booking","datepicker","javascript"],"license":"MIT","_id":"@braudypedrosa/bp-search-widget@1.0.2","maintainers":[{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"}],"homepage":"https://github.com/braudypedrosa/bp-search-widget#readme","bugs":{"url":"https://github.com/braudypedrosa/bp-search-widget/issues"},"dist":{"shasum":"454e1aa15331db50f5f603e581c563ebf70db7fb","tarball":"https://registry.npmjs.org/@braudypedrosa/bp-search-widget/-/bp-search-widget-1.0.2.tgz","fileCount":5,"integrity":"sha512-BysrV2Y0FhFnfFSBwZQeWNppLU/FZzvQ+bIq0N7diUg5RyoxsBiHdfz9LuKAjzr5+IlyTB0FvRPh/RVf7H+40A==","signatures":[{"sig":"MEQCIEc7485Or4MHylQugog0Tf8pj4sKYkT7/HAxkA610hTQAiBGtsH0hSx2spbDWp7FhF63PuLBUeSKjtIzXUB8fE0r4g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":87632},"main":"./bp-search-widget.js","type":"module","module":"./bp-search-widget.js","exports":{".":"./bp-search-widget.js","./styles":"./bp-search-widget.scss"},"gitHead":"19d3bd0f72c515f844082a99c876296160112e8c","scripts":{"dev":"vite","test":"vitest run --environment jsdom","release":"bash ./scripts/release.sh","release:npm":"npm publish","release:major":"bash ./scripts/release.sh major","release:minor":"bash ./scripts/release.sh minor","release:patch":"bash ./scripts/release.sh patch"},"_npmUser":{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"},"repository":{"url":"git+https://github.com/braudypedrosa/bp-search-widget.git","type":"git"},"_npmVersion":"11.10.1","description":"Framework-agnostic vacation rental search widget powered by bp-calendar","directories":{},"_nodeVersion":"25.7.0","dependencies":{"@braudypedrosa/bp-calendar":"^1.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.2.0","jsdom":"^26.0.0","vitest":"^3.0.8","sass-embedded":"^1.83.4"},"peerDependencies":{"@fortawesome/fontawesome-free":">=6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bp-search-widget_1.0.2_1772538184429_0.37818917152388143","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.3":{"name":"@braudypedrosa/bp-search-widget","version":"1.0.3","keywords":["search-widget","vacation-rental","booking","datepicker","javascript"],"license":"MIT","_id":"@braudypedrosa/bp-search-widget@1.0.3","maintainers":[{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"}],"homepage":"https://github.com/braudypedrosa/bp-search-widget#readme","bugs":{"url":"https://github.com/braudypedrosa/bp-search-widget/issues"},"dist":{"shasum":"ba56de5b2cb8e0e27109e218ccf79ac86485d4ee","tarball":"https://registry.npmjs.org/@braudypedrosa/bp-search-widget/-/bp-search-widget-1.0.3.tgz","fileCount":5,"integrity":"sha512-m9YkRv31QBNJfRwbNYpPxyNmTyNmSrIBYTvdhGlIznTf5EuMkai7XxsAmuczL8qMToUD/wxKaD4MBQ7K59W/5g==","signatures":[{"sig":"MEUCIQC2rwdmFCSNEKVrdnzLbHjiI+6K/bV7PLyFQQjxcZZ9UQIgG5TFTV0AVsw7qvZosyAfNXYHiG9Dc+P5bSshIOsm9PA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":88120},"main":"./bp-search-widget.js","type":"module","module":"./bp-search-widget.js","exports":{".":"./bp-search-widget.js","./styles":"./bp-search-widget.scss"},"gitHead":"2bb41d8d6d8b6c588b30bb647168472008cb5a46","scripts":{"dev":"vite","test":"vitest run --environment jsdom","release":"bash ./scripts/release.sh","release:npm":"npm publish","release:major":"bash ./scripts/release.sh major","release:minor":"bash ./scripts/release.sh minor","release:patch":"bash ./scripts/release.sh patch"},"_npmUser":{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"},"repository":{"url":"git+https://github.com/braudypedrosa/bp-search-widget.git","type":"git"},"_npmVersion":"11.10.1","description":"Framework-agnostic vacation rental search widget powered by bp-calendar","directories":{},"_nodeVersion":"25.7.0","dependencies":{"@braudypedrosa/bp-calendar":"^1.0.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.2.0","jsdom":"^26.0.0","vitest":"^3.0.8","sass-embedded":"^1.83.4"},"peerDependencies":{"@fortawesome/fontawesome-free":">=6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bp-search-widget_1.0.3_1772550646146_0.6769700854020717","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.1.0":{"name":"@braudypedrosa/bp-search-widget","version":"1.1.0","keywords":["search-widget","vacation-rental","booking","datepicker","javascript"],"license":"MIT","_id":"@braudypedrosa/bp-search-widget@1.1.0","maintainers":[{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"}],"homepage":"https://github.com/braudypedrosa/bp-search-widget#readme","bugs":{"url":"https://github.com/braudypedrosa/bp-search-widget/issues"},"dist":{"shasum":"714c3cbaf5c6d8c53b2cc8bcaebd86459ae30605","tarball":"https://registry.npmjs.org/@braudypedrosa/bp-search-widget/-/bp-search-widget-1.1.0.tgz","fileCount":6,"integrity":"sha512-Rsd4aTLUtg9yxhmzOi9/WUuyEVADDISsiyCoB2cmrUcMJSE+fzMUkmr6uVOW20a0Y8CfYXjk359VYZUb7iJB2Q==","signatures":[{"sig":"MEUCIFjilZzV+DGH7fnUCtXSEHqrF6Q9XDLQ13ROwulTpqMKAiEA3/tM0VqmTtYK5vfgPeHdEcE/9Id9XZ2m8KGWr3mw5Uc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":167195},"main":"./bp-search-widget.js","type":"module","module":"./bp-search-widget.js","exports":{".":"./bp-search-widget.js","./styles":"./dist/bp-search-widget.css"},"gitHead":"cbb67e24348af2eface0dcad8dabf27548126004","scripts":{"dev":"vite","test":"vitest run","release":"npm run build:css && bash ./scripts/release.sh","build:css":"node ./scripts/build-css.mjs","release:npm":"npm publish","release:major":"npm run build:css && bash ./scripts/release.sh major","release:minor":"npm run build:css && bash ./scripts/release.sh minor","release:patch":"npm run build:css && bash ./scripts/release.sh patch"},"_npmUser":{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"},"repository":{"url":"git+https://github.com/braudypedrosa/bp-search-widget.git","type":"git"},"_npmVersion":"11.10.1","description":"Framework-agnostic vacation rental search widget powered by bp-calendar","directories":{},"_nodeVersion":"25.7.0","dependencies":{"@braudypedrosa/bp-calendar":"^1.0.5","@braudypedrosa/bp-ui-components":"^0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^7.3.1","jsdom":"^28.1.0","vitest":"^4.0.18","sass-embedded":"^1.97.3"},"peerDependencies":{"@fortawesome/fontawesome-free":">=6.0.0"},"_npmOperationalInternal":{"tmp":"tmp/bp-search-widget_1.1.0_1772564425553_0.01657982864027585","host":"s3://npm-registry-packages-npm-production"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2026-02-28T13:49:11.369Z","modified":"2026-03-05T22:42:06.992Z","1.0.0":"2026-02-28T13:49:11.631Z","1.0.1":"2026-02-28T20:07:30.039Z","1.0.2":"2026-03-03T11:43:04.572Z","1.0.3":"2026-03-03T15:10:46.299Z","1.1.0":"2026-03-03T19:00:25.693Z"},"bugs":{"url":"https://github.com/braudypedrosa/bp-search-widget/issues"},"license":"MIT","homepage":"https://github.com/braudypedrosa/bp-search-widget#readme","keywords":["search-widget","vacation-rental","booking","datepicker","javascript"],"repository":{"url":"git+https://github.com/braudypedrosa/bp-search-widget.git","type":"git"},"description":"Framework-agnostic vacation rental search widget powered by bp-calendar","maintainers":[{"name":"braudypedrosa","email":"braudypedrosa@gmail.com"}],"readme":"# bp-search-widget\n\nA framework-agnostic vacation rental search widget powered by [`@braudypedrosa/bp-calendar`](https://www.npmjs.com/package/@braudypedrosa/bp-calendar).\n\n## Features\n\n- standalone JavaScript widget with no framework dependency\n- compact pill-style search bar with a filter modal\n- filter modal footer with Reset and Apply actions\n- active-filter badge count on the filter button\n- built-in `bp-calendar` datepicker integration\n- Font Awesome Free icons supported through an explicit stylesheet import\n- custom Font Awesome icons for inline `fields`\n- runtime inline field management with `addField`, `removeField`, and `updateField`\n- runtime filter management with `addFilter`, `removeFilter`, and `updateFilter`\n- filter types: `input`, `select`, `checkbox`, `radio`, `counter`\n- width-aware filter layout with up to 4 cards per row\n- search callback with normalized `checkIn`, `checkOut`, inline field values, and filter values\n\n## Installation\n\n```bash\nnpm install @braudypedrosa/bp-search-widget @fortawesome/fontawesome-free\n```\n\n## Usage\n\n```js\nimport { BPSearchWidget } from '@braudypedrosa/bp-search-widget';\nimport '@fortawesome/fontawesome-free/css/all.min.css';\nimport '@braudypedrosa/bp-search-widget/styles';\n\nconst widget = new BPSearchWidget('#widget', {\n  fields: [\n    { label: 'Promo Code', type: 'input', position: 'start', icon: 'fa-solid fa-ticket' },\n    { label: 'Guests', type: 'select', options: ['1', '2', '3', '4+'], position: 'end', required: true, icon: 'fa-solid fa-users' },\n  ],\n  filters: [\n    { label: 'Bedrooms', type: 'counter', min: 1, max: 8, defaultValue: 2, width: '30%' },\n    { label: 'View', type: 'select', options: ['Ocean', 'Garden', 'City'], width: '30%' },\n    { label: 'Amenities', type: 'checkbox', options: ['Pool', 'Spa', 'Gym'] },\n    { label: 'Property Type', type: 'radio', options: ['Villa', 'Cabin', 'Suite'] },\n  ],\n  calendarOptions: {\n    monthsToShow: 2,\n    datepickerPlacement: 'auto',\n  },\n  onSearch: (payload) => {\n    console.log('search', payload);\n  },\n  onFilterClick: (payload) => {\n    console.log('filter button clicked', payload);\n  },\n});\n```\n\nThe visible date UI is a single combined field, but the widget output always exposes separate `checkIn` and `checkOut` values.\n\nThe widget uses Font Awesome class names for its built-in icons and inline `fields`, so import `@fortawesome/fontawesome-free/css/all.min.css` once in your app before rendering the widget.\n\n`@braudypedrosa/bp-search-widget/styles` is self-contained and already includes the internal `bp-calendar` and shared `bp-ui-components` styles used by the widget.\n\n## Browser Global\n\nThe module also registers globals on `window`:\n\n- `window.BPSearchWidget`\n- `window.BP_SearchWidget`\n\nExample:\n\n```html\n<div id=\"widget\"></div>\n<script type=\"module\">\n  import '@fortawesome/fontawesome-free/css/all.min.css';\n  import '@braudypedrosa/bp-search-widget/styles';\n  import '@braudypedrosa/bp-search-widget';\n\n  new window.BPSearchWidget('#widget', {\n    fields: [\n      { label: 'Guests', type: 'select', options: ['1', '2', '3', '4+'] },\n    ],\n    filters: [\n      { label: 'Bedrooms', type: 'counter', min: 1, defaultValue: 2, width: '40%' },\n      { label: 'View', type: 'select', options: ['Ocean', 'Garden'] },\n    ],\n    onSearch: (payload) => console.log(payload),\n  });\n</script>\n```\n\n## API\n\n### Constructor\n\n```js\nnew BPSearchWidget(container, options)\nBP_SearchWidget(container, options)\n```\n\n- `container`: `HTMLElement | string`\n- `options`: object\n\n### Options\n\n- `showLocation: boolean` default `true`\n- `showFilterButton: boolean` default `true`\n- `locationLabel: string` default `'Location'`\n- `locationPlaceholder: string` default `'Where are you going?'`\n- `dateLabel: string` default `'Dates'`\n- `datePlaceholder: string` default `'Check in — Check out'`\n- `fields: FieldDescriptor[]` default `[]`\n- `filters: FilterDescriptor[]` default `[]`\n- `calendarOptions: WidgetCalendarOptions` default `{ datepickerPlacement: 'auto' }`\n- `onSearch: (payload, instance) => void`\n- `onFilterClick: (payload, instance) => void`\n\n`showFilterButton` only renders the icon when at least one filter is configured. Clicking the icon opens the filter modal and still calls `onFilterClick`. The modal Reset button clears filter values back to their empty or default state and keeps the modal open. The Apply button just closes the modal; it does not alter validation or trigger search. When filters are active, the filter button shows a badge with the number of active filter fields. `counter` filters only count toward the badge when they differ from their `defaultValue`.\n\n### `FieldDescriptor`\n\n```js\n{\n  label: string,\n  type: 'input' | 'select' | 'checkbox' | 'radio',\n  options?: string[] | Array<{ label: string, value: string }>,\n  position?: 'start' | 'end',\n  required?: boolean,\n  key?: string,\n  icon?: string\n}\n```\n\nRules:\n\n- `options` is required for `select`, `checkbox`, and `radio`\n- `position` defaults to `'end'`\n- `required` defaults to `false`\n- `key` defaults to `bp-${slugify(label)}`\n- `icon` accepts a Font Awesome class string such as `'fa-solid fa-users'`\n- `width` is not supported on inline `fields`\n- `icon` is only supported on inline `fields`, not `filters`\n\n### `FilterDescriptor`\n\n```js\n{\n  label: string,\n  type: 'input' | 'select' | 'checkbox' | 'radio' | 'counter',\n  options?: string[] | Array<{ label: string, value: string }>,\n  required?: boolean,\n  key?: string,\n  width?: number | `${number}%`,\n  min?: number,\n  max?: number,\n  step?: number,\n  defaultValue?: number\n}\n```\n\nRules:\n\n- filters render in declaration order only\n- `position` is not supported on filters\n- up to 4 filters are placed in a row before wrapping\n- `width` is optional and only supported on filters\n- `width` accepts either a number or a percentage string such as `'30%'`\n- within each row, explicit widths reserve space first and unset widths split the remaining space equally\n- `options` is required for `select`, `checkbox`, and `radio`\n- `counter` does not accept `options`\n- `counter` defaults: `min = 0`, `max = Infinity`, `step = 1`, `defaultValue = min`\n\n### `WidgetCalendarOptions`\n\nThe widget forwards these options to the internal `BPCalendar` instance:\n\n- `startDate`\n- `monthsToShow`\n- `breakpoints`\n- `dateConfig`\n- `defaultMinDays`\n- `tooltipLabel`\n- `showTooltip`\n- `showClearButton`\n- `datepickerPlacement`\n\nThe widget always forces:\n\n- `mode: 'datepicker'`\n- an internal `onRangeSelect` handler that keeps widget state in sync\n\n### Instance Methods\n\n- `getValues()`\n- `addField(fieldDescriptor)`\n- `removeField(key)`\n- `updateField(key, patch)`\n- `addFilter(filterDescriptor)`\n- `removeFilter(key)`\n- `updateFilter(key, patch)`\n- `updateOptions(newOptions)`\n- `destroy()`\n\n### `getValues()`\n\nReturns:\n\n```js\n{\n  location: string,\n  checkIn: string | null,\n  checkOut: string | null,\n  customFields: Record<string, string | string[]>,\n  filters: Record<string, string | string[] | number>\n}\n```\n\nSearch is enabled only when dates are selected and every required inline field and required filter has a value.\n\n## Runtime Updates\n\n```js\nwidget.addField({\n  label: 'Promo Code',\n  type: 'input',\n  position: 'start',\n});\n\nwidget.updateField('bp-guests', {\n  label: 'Adults',\n  options: ['1', '2', '3', '4', '5+'],\n});\n\nwidget.addFilter({\n  label: 'Bedrooms',\n  type: 'counter',\n  min: 1,\n  max: 8,\n  defaultValue: 2,\n  width: '30%',\n});\n\nwidget.updateFilter('bp-view', {\n  label: 'Scenery',\n  options: ['Ocean', 'Garden', 'City'],\n});\n\nwidget.removeFilter('bp-amenities');\n```\n\n## Local Demo\n\nThis repo includes a demo page at [`index.html`](/Users/braudypedorsa/Projects/libraries/bp-search-widget/index.html).\n\nRun it locally with:\n\n```bash\nnpm install\nnpm run dev\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}